@alxgrn/telefrag-ui 0.0.46 → 0.0.47

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.
@@ -35,7 +35,8 @@ import l from "../../ui/block/Block.js";
35
35
  /* empty css */
36
36
  /* empty css */
37
37
  /* empty css */
38
- const Ee = ({
38
+ import "../../../index.es-CZnvHQxj.js";
39
+ const Ie = ({
39
40
  info: d,
40
41
  error: k,
41
42
  success: b,
@@ -162,6 +163,6 @@ const Ee = ({
162
163
  ] });
163
164
  };
164
165
  export {
165
- Ee as Form,
166
- Ee as default
166
+ Ie as Form,
167
+ Ie as default
167
168
  };
@@ -33,7 +33,8 @@ import j from "../../icons/Trash.js";
33
33
  /* empty css */
34
34
  /* empty css */
35
35
  /* empty css */
36
- const cr = ({
36
+ import "../../../index.es-CZnvHQxj.js";
37
+ const gr = ({
37
38
  id: u,
38
39
  value: o,
39
40
  text: l,
@@ -100,6 +101,6 @@ const cr = ({
100
101
  ) });
101
102
  };
102
103
  export {
103
- cr as Image,
104
- cr as default
104
+ gr as Image,
105
+ gr as default
105
106
  };
@@ -29,8 +29,9 @@ import "react-dom";
29
29
  import { Sidebar as c } from "../ui/sidebar/Sidebar.js";
30
30
  /* empty css */
31
31
  /* empty css */
32
+ import "../../index.es-CZnvHQxj.js";
32
33
  import b from "./MainMenu.js";
33
- const X = ({ children: p, mainMenu: m, userMenu: e, onLogoClick: s, onMenuClick: r }) => {
34
+ const Y = ({ children: p, mainMenu: m, userMenu: e, onLogoClick: s, onMenuClick: r }) => {
34
35
  const [a, t] = n(!1);
35
36
  return /* @__PURE__ */ f("div", { className: "Layout", children: [
36
37
  /* @__PURE__ */ o(
@@ -62,5 +63,5 @@ const X = ({ children: p, mainMenu: m, userMenu: e, onLogoClick: s, onMenuClick:
62
63
  ] });
63
64
  };
64
65
  export {
65
- X as default
66
+ Y as default
66
67
  };
@@ -30,7 +30,8 @@ import { Sidebar as n } from "../ui/sidebar/Sidebar.js";
30
30
  /* empty css */
31
31
  /* empty css */
32
32
  /* empty css */
33
- const L = ({ header: t, children: p, sidebar: r, isSidebarVisible: e = !1, onSidebarClose: m }) => /* @__PURE__ */ o("div", { className: "Page", children: [
33
+ import "../../index.es-CZnvHQxj.js";
34
+ const M = ({ header: t, children: p, sidebar: r, isSidebarVisible: e = !1, onSidebarClose: m }) => /* @__PURE__ */ o("div", { className: "Page", children: [
34
35
  t && /* @__PURE__ */ i(a, { children: t }),
35
36
  /* @__PURE__ */ o("div", { className: "PageBody", children: [
36
37
  /* @__PURE__ */ i("div", { className: "PageContent", children: p }),
@@ -49,5 +50,5 @@ const L = ({ header: t, children: p, sidebar: r, isSidebarVisible: e = !1, onSid
49
50
  )
50
51
  ] });
51
52
  export {
52
- L as default
53
+ M as default
53
54
  };
@@ -0,0 +1,13 @@
1
+ import { FC, PropsWithChildren, ReactNode } from 'react';
2
+ type Props = {
3
+ dataLength: number;
4
+ loadMore: () => void;
5
+ hasMore: boolean;
6
+ loader?: ReactNode;
7
+ endMessage?: ReactNode;
8
+ scrollThreshold?: number | string;
9
+ className?: string;
10
+ style?: object;
11
+ };
12
+ export declare const MyInfiniteScroll: FC<PropsWithChildren<Props>>;
13
+ export default MyInfiniteScroll;
@@ -0,0 +1,30 @@
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { I as s } from "../../../index.es-CZnvHQxj.js";
3
+ const c = ({
4
+ dataLength: o,
5
+ children: t,
6
+ loadMore: r,
7
+ hasMore: i,
8
+ loader: n,
9
+ endMessage: e,
10
+ scrollThreshold: f = "200px",
11
+ className: l,
12
+ style: m
13
+ }) => /* @__PURE__ */ p(
14
+ s,
15
+ {
16
+ dataLength: o,
17
+ next: r,
18
+ hasMore: i,
19
+ loader: n,
20
+ endMessage: e,
21
+ className: l,
22
+ style: m,
23
+ scrollThreshold: f,
24
+ children: t
25
+ }
26
+ );
27
+ export {
28
+ c as MyInfiniteScroll,
29
+ c as default
30
+ };
@@ -0,0 +1,176 @@
1
+ import h, { Component as T } from "react";
2
+ /*! *****************************************************************************
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
5
+ this file except in compliance with the License. You may obtain a copy of the
6
+ License at http://www.apache.org/licenses/LICENSE-2.0
7
+
8
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
9
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
10
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
11
+ MERCHANTABLITY OR NON-INFRINGEMENT.
12
+
13
+ See the Apache Version 2.0 License for specific language governing permissions
14
+ and limitations under the License.
15
+ ***************************************************************************** */
16
+ var u = function(o, r) {
17
+ return u = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, e) {
18
+ t.__proto__ = e;
19
+ } || function(t, e) {
20
+ for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
21
+ }, u(o, r);
22
+ };
23
+ function S(o, r) {
24
+ u(o, r);
25
+ function t() {
26
+ this.constructor = o;
27
+ }
28
+ o.prototype = r === null ? Object.create(r) : (t.prototype = r.prototype, new t());
29
+ }
30
+ var a = function() {
31
+ return a = Object.assign || function(r) {
32
+ for (var t, e = 1, n = arguments.length; e < n; e++) {
33
+ t = arguments[e];
34
+ for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && (r[i] = t[i]);
35
+ }
36
+ return r;
37
+ }, a.apply(this, arguments);
38
+ };
39
+ function _(o, r, t, e) {
40
+ var n, i = !1, s = 0;
41
+ function p() {
42
+ n && clearTimeout(n);
43
+ }
44
+ function g() {
45
+ p(), i = !0;
46
+ }
47
+ typeof r != "boolean" && (e = t, t = r, r = void 0);
48
+ function f() {
49
+ var w = this, d = Date.now() - s, E = arguments;
50
+ if (i)
51
+ return;
52
+ function c() {
53
+ s = Date.now(), t.apply(w, E);
54
+ }
55
+ function y() {
56
+ n = void 0;
57
+ }
58
+ e && !n && c(), p(), e === void 0 && d > o ? c() : r !== !0 && (n = setTimeout(e ? y : c, e === void 0 ? o - d : o));
59
+ }
60
+ return f.cancel = g, f;
61
+ }
62
+ var l = {
63
+ Pixel: "Pixel",
64
+ Percent: "Percent"
65
+ }, m = {
66
+ unit: l.Percent,
67
+ value: 0.8
68
+ };
69
+ function v(o) {
70
+ return typeof o == "number" ? {
71
+ unit: l.Percent,
72
+ value: o * 100
73
+ } : typeof o == "string" ? o.match(/^(\d*(\.\d+)?)px$/) ? {
74
+ unit: l.Pixel,
75
+ value: parseFloat(o)
76
+ } : o.match(/^(\d*(\.\d+)?)%$/) ? {
77
+ unit: l.Percent,
78
+ value: parseFloat(o)
79
+ } : (console.warn('scrollThreshold format is invalid. Valid formats: "120px", "50%"...'), m) : (console.warn("scrollThreshold should be string or number"), m);
80
+ }
81
+ var D = (
82
+ /** @class */
83
+ function(o) {
84
+ S(r, o);
85
+ function r(t) {
86
+ var e = o.call(this, t) || this;
87
+ return e.lastScrollTop = 0, e.actionTriggered = !1, e.startY = 0, e.currentY = 0, e.dragging = !1, e.maxPullDownDistance = 0, e.getScrollableTarget = function() {
88
+ return e.props.scrollableTarget instanceof HTMLElement ? e.props.scrollableTarget : typeof e.props.scrollableTarget == "string" ? document.getElementById(e.props.scrollableTarget) : (e.props.scrollableTarget === null && console.warn(`You are trying to pass scrollableTarget but it is null. This might
89
+ happen because the element may not have been added to DOM yet.
90
+ See https://github.com/ankeetmaini/react-infinite-scroll-component/issues/59 for more info.
91
+ `), null);
92
+ }, e.onStart = function(n) {
93
+ e.lastScrollTop || (e.dragging = !0, n instanceof MouseEvent ? e.startY = n.pageY : n instanceof TouchEvent && (e.startY = n.touches[0].pageY), e.currentY = e.startY, e._infScroll && (e._infScroll.style.willChange = "transform", e._infScroll.style.transition = "transform 0.2s cubic-bezier(0,0,0.31,1)"));
94
+ }, e.onMove = function(n) {
95
+ e.dragging && (n instanceof MouseEvent ? e.currentY = n.pageY : n instanceof TouchEvent && (e.currentY = n.touches[0].pageY), !(e.currentY < e.startY) && (e.currentY - e.startY >= Number(e.props.pullDownToRefreshThreshold) && e.setState({
96
+ pullToRefreshThresholdBreached: !0
97
+ }), !(e.currentY - e.startY > e.maxPullDownDistance * 1.5) && e._infScroll && (e._infScroll.style.overflow = "visible", e._infScroll.style.transform = "translate3d(0px, " + (e.currentY - e.startY) + "px, 0px)")));
98
+ }, e.onEnd = function() {
99
+ e.startY = 0, e.currentY = 0, e.dragging = !1, e.state.pullToRefreshThresholdBreached && (e.props.refreshFunction && e.props.refreshFunction(), e.setState({
100
+ pullToRefreshThresholdBreached: !1
101
+ })), requestAnimationFrame(function() {
102
+ e._infScroll && (e._infScroll.style.overflow = "auto", e._infScroll.style.transform = "none", e._infScroll.style.willChange = "unset");
103
+ });
104
+ }, e.onScrollListener = function(n) {
105
+ typeof e.props.onScroll == "function" && setTimeout(function() {
106
+ return e.props.onScroll && e.props.onScroll(n);
107
+ }, 0);
108
+ var i = e.props.height || e._scrollableNode ? n.target : document.documentElement.scrollTop ? document.documentElement : document.body;
109
+ if (!e.actionTriggered) {
110
+ var s = e.props.inverse ? e.isElementAtTop(i, e.props.scrollThreshold) : e.isElementAtBottom(i, e.props.scrollThreshold);
111
+ s && e.props.hasMore && (e.actionTriggered = !0, e.setState({ showLoader: !0 }), e.props.next && e.props.next()), e.lastScrollTop = i.scrollTop;
112
+ }
113
+ }, e.state = {
114
+ showLoader: !1,
115
+ pullToRefreshThresholdBreached: !1,
116
+ prevDataLength: t.dataLength
117
+ }, e.throttledOnScrollListener = _(150, e.onScrollListener).bind(e), e.onStart = e.onStart.bind(e), e.onMove = e.onMove.bind(e), e.onEnd = e.onEnd.bind(e), e;
118
+ }
119
+ return r.prototype.componentDidMount = function() {
120
+ if (typeof this.props.dataLength > "u")
121
+ throw new Error('mandatory prop "dataLength" is missing. The prop is needed when loading more content. Check README.md for usage');
122
+ if (this._scrollableNode = this.getScrollableTarget(), this.el = this.props.height ? this._infScroll : this._scrollableNode || window, this.el && this.el.addEventListener("scroll", this.throttledOnScrollListener), typeof this.props.initialScrollY == "number" && this.el && this.el instanceof HTMLElement && this.el.scrollHeight > this.props.initialScrollY && this.el.scrollTo(0, this.props.initialScrollY), this.props.pullDownToRefresh && this.el && (this.el.addEventListener("touchstart", this.onStart), this.el.addEventListener("touchmove", this.onMove), this.el.addEventListener("touchend", this.onEnd), this.el.addEventListener("mousedown", this.onStart), this.el.addEventListener("mousemove", this.onMove), this.el.addEventListener("mouseup", this.onEnd), this.maxPullDownDistance = this._pullDown && this._pullDown.firstChild && this._pullDown.firstChild.getBoundingClientRect().height || 0, this.forceUpdate(), typeof this.props.refreshFunction != "function"))
123
+ throw new Error(`Mandatory prop "refreshFunction" missing.
124
+ Pull Down To Refresh functionality will not work
125
+ as expected. Check README.md for usage'`);
126
+ }, r.prototype.componentWillUnmount = function() {
127
+ this.el && (this.el.removeEventListener("scroll", this.throttledOnScrollListener), this.props.pullDownToRefresh && (this.el.removeEventListener("touchstart", this.onStart), this.el.removeEventListener("touchmove", this.onMove), this.el.removeEventListener("touchend", this.onEnd), this.el.removeEventListener("mousedown", this.onStart), this.el.removeEventListener("mousemove", this.onMove), this.el.removeEventListener("mouseup", this.onEnd)));
128
+ }, r.prototype.componentDidUpdate = function(t) {
129
+ this.props.dataLength !== t.dataLength && (this.actionTriggered = !1, this.setState({
130
+ showLoader: !1
131
+ }));
132
+ }, r.getDerivedStateFromProps = function(t, e) {
133
+ var n = t.dataLength !== e.prevDataLength;
134
+ return n ? a(a({}, e), { prevDataLength: t.dataLength }) : null;
135
+ }, r.prototype.isElementAtTop = function(t, e) {
136
+ e === void 0 && (e = 0.8);
137
+ var n = t === document.body || t === document.documentElement ? window.screen.availHeight : t.clientHeight, i = v(e);
138
+ return i.unit === l.Pixel ? t.scrollTop <= i.value + n - t.scrollHeight + 1 : t.scrollTop <= i.value / 100 + n - t.scrollHeight + 1;
139
+ }, r.prototype.isElementAtBottom = function(t, e) {
140
+ e === void 0 && (e = 0.8);
141
+ var n = t === document.body || t === document.documentElement ? window.screen.availHeight : t.clientHeight, i = v(e);
142
+ return i.unit === l.Pixel ? t.scrollTop + n >= t.scrollHeight - i.value : t.scrollTop + n >= i.value / 100 * t.scrollHeight;
143
+ }, r.prototype.render = function() {
144
+ var t = this, e = a({ height: this.props.height || "auto", overflow: "auto", WebkitOverflowScrolling: "touch" }, this.props.style), n = this.props.hasChildren || !!(this.props.children && this.props.children instanceof Array && this.props.children.length), i = this.props.pullDownToRefresh && this.props.height ? { overflow: "auto" } : {};
145
+ return h.createElement(
146
+ "div",
147
+ { style: i, className: "infinite-scroll-component__outerdiv" },
148
+ h.createElement(
149
+ "div",
150
+ { className: "infinite-scroll-component " + (this.props.className || ""), ref: function(s) {
151
+ return t._infScroll = s;
152
+ }, style: e },
153
+ this.props.pullDownToRefresh && h.createElement(
154
+ "div",
155
+ { style: { position: "relative" }, ref: function(s) {
156
+ return t._pullDown = s;
157
+ } },
158
+ h.createElement("div", { style: {
159
+ position: "absolute",
160
+ left: 0,
161
+ right: 0,
162
+ top: -1 * this.maxPullDownDistance
163
+ } }, this.state.pullToRefreshThresholdBreached ? this.props.releaseToRefreshContent : this.props.pullDownToRefreshContent)
164
+ ),
165
+ this.props.children,
166
+ !this.state.showLoader && !n && this.props.hasMore && this.props.loader,
167
+ this.state.showLoader && this.props.hasMore && this.props.loader,
168
+ !this.props.hasMore && this.props.endMessage
169
+ )
170
+ );
171
+ }, r;
172
+ }(T)
173
+ );
174
+ export {
175
+ D as I
176
+ };
package/dist/main.d.ts CHANGED
@@ -32,6 +32,7 @@ import { default as Layout } from './components/layout/Layout';
32
32
  import { MainMenuItem } from './components/layout/MainMenu';
33
33
  import { default as Page } from './components/layout/Page';
34
34
  import { default as PageHeader } from './components/layout/PageHeader';
35
+ import { MyInfiniteScroll as InfiniteScroll } from './components/ui/infinitescroll/InfiniteScroll';
35
36
  import * as Icons from './components/icons';
36
- export { Form, Date, Time, Files, Image, Input, Label, RadioList, Button, Select, Hidden, Checkbox, CheckboxList, Fieldset, FormRow, FormCol, DatePicker, Menu, Block, Panel, Modal, Overlay, Popup, Portal, Message, Alert, Confirm, Prompt, Sidebar, Editable, Layout, Page, PageHeader, Icons, };
37
+ export { Form, Date, Time, Files, Image, Input, Label, RadioList, Button, Select, Hidden, Checkbox, CheckboxList, Fieldset, FormRow, FormCol, DatePicker, Menu, Block, Panel, Modal, Overlay, Popup, Portal, Message, Alert, Confirm, Prompt, Sidebar, Editable, Layout, Page, PageHeader, Icons, InfiniteScroll, };
37
38
  export type { FormData, MainMenuItem, MenuItem, ModalProps, ButtonType, CheckboxListOption, RadioListOption, RadioListValue, SelectOption, };
package/dist/main.js CHANGED
@@ -2,18 +2,18 @@ import './assets/Page.css';/* empty css */
2
2
  import { Form as t } from "./components/form/form/Form.js";
3
3
  import { default as f } from "./components/form/form/FormRow.js";
4
4
  import { default as p } from "./components/form/form/FormCol.js";
5
- import { default as l } from "./components/form/date/Date.js";
6
- import { default as s } from "./components/form/date/DatePicker.js";
5
+ import { default as x } from "./components/form/date/Date.js";
6
+ import { default as d } from "./components/form/date/DatePicker.js";
7
7
  import { default as i } from "./components/form/time/Time.js";
8
- import { Files as P } from "./components/form/files/Files.js";
8
+ import { Files as c } from "./components/form/files/Files.js";
9
9
  import { Image as b } from "./components/form/image/Image.js";
10
- import { default as g } from "./components/form/input/Input.js";
11
- import { default as C } from "./components/form/label/Label.js";
12
- import { RadioList as I } from "./components/form/radio/RadioList.js";
13
- import { Button as h } from "./components/form/button/Button.js";
14
- import { Select as B } from "./components/form/select/Select.js";
15
- import { default as H } from "./components/form/hidden/Hidden.js";
16
- import { default as S } from "./components/form/checkbox/Checkbox.js";
10
+ import { default as I } from "./components/form/input/Input.js";
11
+ import { default as k } from "./components/form/label/Label.js";
12
+ import { RadioList as L } from "./components/form/radio/RadioList.js";
13
+ import { Button as S } from "./components/form/button/Button.js";
14
+ import { Select as h } from "./components/form/select/Select.js";
15
+ import { default as D } from "./components/form/hidden/Hidden.js";
16
+ import { default as R } from "./components/form/checkbox/Checkbox.js";
17
17
  import { CheckboxList as w } from "./components/form/checkbox/CheckboxList.js";
18
18
  import { default as E } from "./components/form/fieldset/Fieldset.js";
19
19
  import { Menu as T } from "./components/ui/menu/Menu.js";
@@ -29,31 +29,33 @@ import { default as eo } from "./components/ui/confirm/Confirm.js";
29
29
  import { default as to } from "./components/ui/prompt/Prompt.js";
30
30
  import { Sidebar as fo } from "./components/ui/sidebar/Sidebar.js";
31
31
  import { default as po } from "./components/ui/editable/Editable.js";
32
- import { default as lo } from "./components/layout/Layout.js";
32
+ import { default as xo } from "./components/layout/Layout.js";
33
33
  import { default as uo } from "./components/layout/Page.js";
34
34
  import { default as no } from "./components/layout/PageHeader.js";
35
- import { i as co } from "./index-2Dtbwxm_.js";
35
+ import { i as Po } from "./index-2Dtbwxm_.js";
36
+ import { MyInfiniteScroll as Fo } from "./components/ui/infinitescroll/InfiniteScroll.js";
36
37
  export {
37
38
  $ as Alert,
38
39
  q as Block,
39
- h as Button,
40
- S as Checkbox,
40
+ S as Button,
41
+ R as Checkbox,
41
42
  w as CheckboxList,
42
43
  eo as Confirm,
43
- l as Date,
44
- s as DatePicker,
44
+ x as Date,
45
+ d as DatePicker,
45
46
  po as Editable,
46
47
  E as Fieldset,
47
- P as Files,
48
+ c as Files,
48
49
  t as Form,
49
50
  p as FormCol,
50
51
  f as FormRow,
51
- H as Hidden,
52
- co as Icons,
52
+ D as Hidden,
53
+ Po as Icons,
53
54
  b as Image,
54
- g as Input,
55
- C as Label,
56
- lo as Layout,
55
+ Fo as InfiniteScroll,
56
+ I as Input,
57
+ k as Label,
58
+ xo as Layout,
57
59
  T as Menu,
58
60
  Z as Message,
59
61
  K as Modal,
@@ -64,8 +66,8 @@ export {
64
66
  V as Popup,
65
67
  X as Portal,
66
68
  to as Prompt,
67
- I as RadioList,
68
- B as Select,
69
+ L as RadioList,
70
+ h as Select,
69
71
  fo as Sidebar,
70
72
  i as Time
71
73
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alxgrn/telefrag-ui",
3
3
  "description": "UI library for The Daily Telefrag project",
4
- "version": "0.0.46",
4
+ "version": "0.0.47",
5
5
  "private": false,
6
6
  "author": "Alexander Fedorov <alex@molner.ru>",
7
7
  "license": "Apache-2.0",
@@ -31,6 +31,7 @@
31
31
  "react": "^19.0.0",
32
32
  "react-children-utilities": "^2.10.0",
33
33
  "react-dom": "^19.0.0",
34
+ "react-infinite-scroll-component": "^6.1.0",
34
35
  "react-transition-group": "^4.4.5"
35
36
  },
36
37
  "devDependencies": {