linear-react-components-ui 1.1.0-beta.0 → 1.1.0-beta.2

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.
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v20.11.0
@@ -32,18 +32,14 @@ var getEventProps = function getEventProps(_ref) {
32
32
  _onKeyDown = _ref.onKeyDown,
33
33
  handlerFieldValidade = _ref.handlerFieldValidade,
34
34
  handlerFieldChange = _ref.handlerFieldChange,
35
- handleShowValidateMessages = _ref.handleShowValidateMessages,
36
- _onChange = _ref.onChange;
35
+ handleShowValidateMessages = _ref.handleShowValidateMessages;
37
36
  return {
38
37
  onBlur: function onBlur(e) {
38
+ if (handlerFieldChange) handlerFieldChange(e);
39
39
  if (validators && handlerFieldValidade) handlerFieldValidade(name, e.target.value, validators);
40
40
  if (_onBlur) _onBlur(e);
41
41
  handleShowValidateMessages(true);
42
42
  },
43
- onChange: function onChange(e) {
44
- if (handlerFieldChange) handlerFieldChange(e);
45
- if (_onChange) _onChange(e);
46
- },
47
43
  onKeyDown: function onKeyDown(e) {
48
44
  if ([constants.keyCodes.ENTER].includes(e.keyCode)) {
49
45
  handlerFieldChange === null || handlerFieldChange === void 0 ? void 0 : handlerFieldChange(e);
package/lib/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { default as List } from './list/index.js';
7
7
  export { default as Radio } from './radio/index.js';
8
8
  export { default as Tab } from './tabs/index.js';
9
9
  export { default as Dialog } from './dialog/base/index.js';
10
- import './types-PItfhaS-.js';
10
+ import './types-exUmt06D.js';
11
11
  import 'react';
12
12
  import './@types/PermissionAttr.js';
13
13
  import './internals/colorStyles.js';
@@ -1,4 +1,4 @@
1
- import { a as IPanelContentProps } from '../types-PItfhaS-.js';
1
+ import { a as IPanelContentProps } from '../types-exUmt06D.js';
2
2
  import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
@@ -13,6 +13,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
13
13
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
14
14
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
15
15
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
16
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
17
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
18
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
16
19
  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; }
17
20
  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; }
18
21
  var PanelContent = function PanelContent(_ref) {
@@ -26,35 +29,59 @@ var PanelContent = function PanelContent(_ref) {
26
29
  onEndReachedThreshold = _useContext$onEndReac === void 0 ? 0.1 : _useContext$onEndReac,
27
30
  hideContent = _useContext.hideContent;
28
31
  var rootElementRef = (0, _react.useRef)(null);
29
- var enableOnEndReached = (0, _react.useRef)(true);
30
32
  var lastScrollHeight = (0, _react.useRef)(0);
31
- var onScrollEndReached = (0, _react.useCallback)(function () {
32
- var element = rootElementRef.current;
33
- if (element && onEndReached) {
34
- var scrollTop = element.scrollTop,
35
- scrollHeight = element.scrollHeight,
36
- clientHeight = element.clientHeight;
37
- var scrollOffset = scrollHeight - clientHeight - scrollTop - 1;
38
- var threshold = (0, _helpers.getCurrentThreshold)(element, onEndReachedThreshold);
39
- if (scrollOffset <= threshold && enableOnEndReached.current) {
40
- onEndReached();
41
- lastScrollHeight.current = scrollHeight;
42
- if (lastScrollHeight.current === scrollHeight) enableOnEndReached.current = false;
43
- } else if (scrollOffset > threshold && !enableOnEndReached.current) {
44
- enableOnEndReached.current = true;
33
+ var enableOnEndReached = (0, _react.useRef)(true);
34
+ var onScrollEndReached = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
35
+ var element, scrollTop, scrollHeight, clientHeight, scrollOffset, threshold;
36
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
37
+ while (1) switch (_context.prev = _context.next) {
38
+ case 0:
39
+ element = rootElementRef.current;
40
+ if (!(element && onEndReached)) {
41
+ _context.next = 10;
42
+ break;
43
+ }
44
+ scrollTop = element.scrollTop, scrollHeight = element.scrollHeight, clientHeight = element.clientHeight;
45
+ scrollOffset = scrollHeight - clientHeight - scrollTop - 1;
46
+ threshold = (0, _helpers.getCurrentThreshold)(element, onEndReachedThreshold);
47
+ if (!(scrollOffset <= threshold && enableOnEndReached.current)) {
48
+ _context.next = 10;
49
+ break;
50
+ }
51
+ enableOnEndReached.current = false;
52
+ _context.next = 9;
53
+ return new Promise(function (resolve) {
54
+ resolve(onEndReached());
55
+ });
56
+ case 9:
57
+ lastScrollHeight.current = scrollHeight;
58
+ case 10:
59
+ case "end":
60
+ return _context.stop();
45
61
  }
46
- }
47
- }, [onEndReached, onEndReachedThreshold, enableOnEndReached.current, rootElementRef.current, lastScrollHeight.current]);
62
+ }, _callee);
63
+ })), [onEndReached, onEndReachedThreshold, rootElementRef.current, lastScrollHeight.current]);
48
64
  (0, _react.useEffect)(function () {
49
- if (onEndReached) {
50
- var _rootElementRef$curre, _rootElementRef$curre2;
51
- (_rootElementRef$curre = rootElementRef.current) === null || _rootElementRef$curre === void 0 ? void 0 : _rootElementRef$curre.addEventListener('scroll', onScrollEndReached);
52
- (_rootElementRef$curre2 = rootElementRef.current) === null || _rootElementRef$curre2 === void 0 ? void 0 : _rootElementRef$curre2.addEventListener('resize', onScrollEndReached);
65
+ var observer;
66
+ if (rootElementRef.current && onEndReached) {
67
+ observer = new ResizeObserver(function () {
68
+ var _ref3 = rootElementRef.current,
69
+ scrollHeight = _ref3.scrollHeight;
70
+ if (scrollHeight !== lastScrollHeight.current) {
71
+ var _observer;
72
+ enableOnEndReached.current = true;
73
+ (_observer = observer) === null || _observer === void 0 ? void 0 : _observer.disconnect();
74
+ }
75
+ });
76
+ observer.observe(rootElementRef.current);
77
+ rootElementRef.current.addEventListener('scroll', onScrollEndReached);
78
+ rootElementRef.current.addEventListener('resize', onScrollEndReached);
53
79
  }
54
80
  return function () {
55
- var _rootElementRef$curre3, _rootElementRef$curre4;
56
- (_rootElementRef$curre3 = rootElementRef.current) === null || _rootElementRef$curre3 === void 0 ? void 0 : _rootElementRef$curre3.removeEventListener('scroll', onScrollEndReached);
57
- (_rootElementRef$curre4 = rootElementRef.current) === null || _rootElementRef$curre4 === void 0 ? void 0 : _rootElementRef$curre4.removeEventListener('resize', onScrollEndReached);
81
+ var _rootElementRef$curre, _rootElementRef$curre2, _observer2;
82
+ (_rootElementRef$curre = rootElementRef.current) === null || _rootElementRef$curre === void 0 ? void 0 : _rootElementRef$curre.removeEventListener('scroll', onScrollEndReached);
83
+ (_rootElementRef$curre2 = rootElementRef.current) === null || _rootElementRef$curre2 === void 0 ? void 0 : _rootElementRef$curre2.removeEventListener('resize', onScrollEndReached);
84
+ (_observer2 = observer) === null || _observer2 === void 0 ? void 0 : _observer2.disconnect();
58
85
  };
59
86
  }, [onScrollEndReached]);
60
87
  if (!opened) return null;
@@ -1,4 +1,4 @@
1
- import { I as IPanelProps } from '../types-PItfhaS-.js';
1
+ import { I as IPanelProps } from '../types-exUmt06D.js';
2
2
  import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
@@ -1,4 +1,4 @@
1
- import { I as IPanelProps } from '../types-PItfhaS-.js';
1
+ import { I as IPanelProps } from '../types-exUmt06D.js';
2
2
  import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
@@ -1,4 +1,4 @@
1
- import { b as IPanelHeaderProps } from '../types-PItfhaS-.js';
1
+ import { b as IPanelHeaderProps } from '../types-exUmt06D.js';
2
2
  import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
@@ -1,4 +1,4 @@
1
- import { I as IPanelProps } from '../types-PItfhaS-.js';
1
+ import { I as IPanelProps } from '../types-exUmt06D.js';
2
2
  import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
@@ -1,4 +1,4 @@
1
- import { I as IPanelProps } from '../types-PItfhaS-.js';
1
+ import { I as IPanelProps } from '../types-exUmt06D.js';
2
2
  import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
@@ -1,4 +1,4 @@
1
- import { I as IPanelProps } from '../types-PItfhaS-.js';
1
+ import { I as IPanelProps } from '../types-exUmt06D.js';
2
2
  import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
@@ -1,4 +1,4 @@
1
- import { I as IPanelProps } from '../types-PItfhaS-.js';
1
+ import { I as IPanelProps } from '../types-exUmt06D.js';
2
2
  import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
@@ -1,4 +1,4 @@
1
- import { I as IPanelProps } from '../types-PItfhaS-.js';
1
+ import { I as IPanelProps } from '../types-exUmt06D.js';
2
2
  import 'react';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
@@ -1,5 +1,5 @@
1
1
  import 'react';
2
- export { P as default, g as getCurrentThreshold, n as numberAroundZeroAndOne } from '../types-PItfhaS-.js';
2
+ export { P as default, g as getCurrentThreshold, n as numberAroundZeroAndOne } from '../types-exUmt06D.js';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
5
5
  import '../@types/Icon.js';
@@ -20,15 +20,17 @@ function numberAroundZeroAndOne(_ref) {
20
20
  }
21
21
  return null;
22
22
  }
23
- function getCurrentThreshold(element, threshold) {
24
- if (threshold > 1) return 1;
25
- if (threshold < 0) return 0;
26
- var scrollHeight = element.scrollHeight,
27
- clientHeight = element.clientHeight;
23
+ function getCurrentThreshold(scrollableElement, scrollThreshold) {
24
+ var MIN_THRESHOLD = 0;
25
+ var MAX_THRESHOLD = 1;
26
+ if (scrollThreshold < MIN_THRESHOLD) return MIN_THRESHOLD;
27
+ if (scrollThreshold > MAX_THRESHOLD) return MAX_THRESHOLD;
28
+ var scrollHeight = scrollableElement.scrollHeight,
29
+ clientHeight = scrollableElement.clientHeight;
28
30
  var offsetHeight = scrollHeight - clientHeight;
29
- var scrollThreshold = Math.round(scrollHeight * threshold);
31
+ var calculatedScrollThreshold = Math.round(scrollHeight * scrollThreshold);
30
32
  var maxScrollThreshold = Math.round(offsetHeight - offsetHeight * 0.3);
31
- return Math.min(scrollThreshold, maxScrollThreshold);
33
+ return Math.min(calculatedScrollThreshold, maxScrollThreshold);
32
34
  }
33
35
  var PanelContext = /*#__PURE__*/_react["default"].createContext({});
34
36
  var _default = exports["default"] = PanelContext;
@@ -6,7 +6,7 @@ export { default as SuccessPanel } from './SuccessPanel.js';
6
6
  export { default as InfoPanel } from './InfoPanel.js';
7
7
  export { default as PanelHeader } from './Header.js';
8
8
  export { default as PanelContent } from './Content.js';
9
- import '../types-PItfhaS-.js';
9
+ import '../types-exUmt06D.js';
10
10
  import 'react';
11
11
  import '../@types/PermissionAttr.js';
12
12
  import '../internals/colorStyles.js';
@@ -1,5 +1,5 @@
1
1
  import 'react';
2
- export { C as ContextProps, a as IPanelContentProps, b as IPanelHeaderProps, I as IPanelProps, c as IParameterFunction } from '../types-PItfhaS-.js';
2
+ export { A as AsyncFunc, C as ContextProps, F as Func, a as IPanelContentProps, b as IPanelHeaderProps, I as IPanelProps, c as IParameterFunction } from '../types-exUmt06D.js';
3
3
  import '../@types/PermissionAttr.js';
4
4
  import '../internals/colorStyles.js';
5
5
  import '../@types/Icon.js';
@@ -4,9 +4,11 @@ import ColorStyles from './internals/colorStyles.js';
4
4
  import { IconNames } from './@types/Icon.js';
5
5
 
6
6
  declare function numberAroundZeroAndOne({ props, propName, componentName }: IParameterFunction): number | Error | null;
7
- declare function getCurrentThreshold(element: HTMLDivElement, threshold: number): number;
7
+ declare function getCurrentThreshold(scrollableElement: HTMLDivElement, scrollThreshold: number): number;
8
8
  declare const PanelContext: React__default.Context<ContextProps>;
9
9
 
10
+ type Func = () => void;
11
+ type AsyncFunc = () => Promise<void>;
10
12
  interface IPanelProps extends Omit<ComponentPropsWithoutRef<'div'>, 'className'> {
11
13
  customClass?: string;
12
14
  startOpened?: boolean;
@@ -15,7 +17,7 @@ interface IPanelProps extends Omit<ComponentPropsWithoutRef<'div'>, 'className'>
15
17
  colorStyle?: typeof ColorStyles | string;
16
18
  gridCols?: string;
17
19
  title?: string;
18
- onEndReached?: () => void;
20
+ onEndReached?: Func | AsyncFunc;
19
21
  onEndReachedThreshold?: typeof numberAroundZeroAndOne | number;
20
22
  permissionAttr?: PermissionAttr | PermissionAttr[];
21
23
  }
@@ -36,7 +38,7 @@ type ContextProps = {
36
38
  handlerToggleable: () => void;
37
39
  opened: boolean;
38
40
  hideContent: boolean;
39
- onEndReached?: () => void;
41
+ onEndReached?: Func | AsyncFunc;
40
42
  onEndReachedThreshold: number;
41
43
  };
42
44
  interface IParameterFunction {
@@ -45,4 +47,4 @@ interface IParameterFunction {
45
47
  componentName: string;
46
48
  }
47
49
 
48
- export { type ContextProps as C, type IPanelProps as I, PanelContext as P, type IPanelContentProps as a, type IPanelHeaderProps as b, type IParameterFunction as c, getCurrentThreshold as g, numberAroundZeroAndOne as n };
50
+ export { type AsyncFunc as A, type ContextProps as C, type Func as F, type IPanelProps as I, PanelContext as P, type IPanelContentProps as a, type IPanelHeaderProps as b, type IParameterFunction as c, getCurrentThreshold as g, numberAroundZeroAndOne as n };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-react-components-ui",
3
- "version": "1.1.0-beta.0",
3
+ "version": "1.1.0-beta.2",
4
4
  "description": "Linear Sistemas ReactJs Components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.cjs",
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- var Header = function Header(props) {
11
- var title = props.title,
12
- customClass = props.customClass;
13
- return /*#__PURE__*/_react.default.createElement("div", {
14
- className: "treeviewheader ".concat(customClass)
15
- }, /*#__PURE__*/_react.default.createElement("div", {
16
- className: "title"
17
- }, title));
18
- };
19
- Header.defaultProps = {
20
- title: '',
21
- customClass: ''
22
- };
23
- Header.propTypes = {
24
- title: _propTypes.default.string,
25
- customClass: _propTypes.default.string
26
- };
27
- var _default = Header;
28
- exports.default = _default;
@@ -1,88 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _checkbox = _interopRequireDefault(require("../checkbox"));
10
- var _icons = _interopRequireDefault(require("../icons"));
11
- require("../assets/styles/treeview.scss");
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
16
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
18
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
20
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
21
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
22
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
23
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
24
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
25
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
26
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
28
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
29
- var TreeNode = /*#__PURE__*/function (_Component) {
30
- _inherits(TreeNode, _Component);
31
- var _super = _createSuper(TreeNode);
32
- function TreeNode(props) {
33
- var _this;
34
- _classCallCheck(this, TreeNode);
35
- _this = _super.call(this, props);
36
- _defineProperty(_assertThisInitialized(_this), "openCloseTree", function () {
37
- _this.setState({
38
- isVisible: !_this.state.isVisible
39
- });
40
- });
41
- _this.state = {
42
- isVisible: false
43
- };
44
- return _this;
45
- }
46
- _createClass(TreeNode, [{
47
- key: "render",
48
- value: function render() {
49
- var _this$props = this.props,
50
- node = _this$props.node,
51
- showCheckBox = _this$props.showCheckBox;
52
- var span = '';
53
- if (node.itens.length > 0) {
54
- span = /*#__PURE__*/_react.default.createElement("span", {
55
- onKeyPress: null,
56
- tabIndex: 0,
57
- role: "button",
58
- className: "opencloseicon",
59
- onClick: this.openCloseTree
60
- }, /*#__PURE__*/_react.default.createElement(_icons.default, {
61
- name: this.state.isVisible ? 'up' : 'down',
62
- size: 10
63
- }));
64
- }
65
- return /*#__PURE__*/_react.default.createElement("li", {
66
- className: "treeviewitem"
67
- }, span, showCheckBox ? /*#__PURE__*/_react.default.createElement(_checkbox.default, {
68
- id: node.id,
69
- label: node.titulo
70
- }) : node.titulo, /*#__PURE__*/_react.default.createElement("ul", {
71
- className: "nodelist"
72
- }, this.state.isVisible && this.props.children));
73
- }
74
- }]);
75
- return TreeNode;
76
- }(_react.Component);
77
- TreeNode.defaultProps = {
78
- showCheckBox: false,
79
- data: []
80
- };
81
- TreeNode.propTypes = {
82
- showCheckBox: _propTypes.default.bool,
83
- data: _propTypes.default.arrayOf(_propTypes.default.element),
84
- node: _propTypes.default.object.isRequired,
85
- children: _propTypes.default.arrayOf(_propTypes.default.element).isRequired
86
- };
87
- var _default = TreeNode;
88
- exports.default = _default;
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "TreeNode", {
7
- enumerable: true,
8
- get: function get() {
9
- return _Node.default;
10
- }
11
- });
12
- Object.defineProperty(exports, "TreeViewHeader", {
13
- enumerable: true,
14
- get: function get() {
15
- return _Header.default;
16
- }
17
- });
18
- exports.default = void 0;
19
- var _react = _interopRequireDefault(require("react"));
20
- var _propTypes = _interopRequireDefault(require("prop-types"));
21
- var _Node = _interopRequireDefault(require("./Node"));
22
- var _Header = _interopRequireDefault(require("./Header"));
23
- require("../assets/styles/treeview.scss");
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
- var TreeView = function TreeView(props) {
26
- var customClass = props.customClass,
27
- defaultBorder = props.defaultBorder;
28
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("ul", {
29
- className: "treeview-component ".concat(customClass, " ").concat(defaultBorder && '-defaultborder')
30
- }, props.children));
31
- };
32
- TreeView.defaultProps = {
33
- customClass: '',
34
- defaultBorder: true
35
- };
36
- TreeView.propTypes = {
37
- children: _propTypes.default.arrayOf(_propTypes.default.element).isRequired,
38
- customClass: _propTypes.default.string,
39
- defaultBorder: _propTypes.default.bool
40
- };
41
- var _default = TreeView;
42
- exports.default = _default;