@codeleap/web 2.0.1 → 2.3.13
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/dist/components/ActivityIndicator/index.d.ts +12 -12
- package/dist/components/ActivityIndicator/index.js +60 -60
- package/dist/components/ActivityIndicator/styles.d.ts +53 -53
- package/dist/components/ActivityIndicator/styles.js +21 -21
- package/dist/components/Button.d.ts +18 -18
- package/dist/components/Button.js +66 -66
- package/dist/components/CenterWrapper.d.ts +7 -7
- package/dist/components/CenterWrapper.js +27 -27
- package/dist/components/Checkbox/index.d.ts +12 -12
- package/dist/components/Checkbox/index.js +61 -61
- package/dist/components/Checkbox/styles.d.ts +53 -53
- package/dist/components/Checkbox/styles.js +63 -63
- package/dist/components/Collapse.d.ts +20 -20
- package/dist/components/Collapse.js +67 -67
- package/dist/components/ContentView.d.ts +10 -10
- package/dist/components/ContentView.js +51 -51
- package/dist/components/Drawer.d.ts +23 -23
- package/dist/components/Drawer.js +72 -72
- package/dist/components/FileInput.d.ts +8 -8
- package/dist/components/FileInput.js +72 -72
- package/dist/components/HorizontalScroll.d.ts +3 -3
- package/dist/components/HorizontalScroll.js +41 -41
- package/dist/components/Icon.d.ts +8 -8
- package/dist/components/Icon.js +54 -54
- package/dist/components/Link.d.ts +7 -7
- package/dist/components/Link.js +62 -62
- package/dist/components/List.d.ts +18 -18
- package/dist/components/List.js +51 -51
- package/dist/components/Modal/index.d.ts +21 -21
- package/dist/components/Modal/index.js +119 -119
- package/dist/components/Modal/styles.d.ts +56 -56
- package/dist/components/Modal/styles.js +35 -35
- package/dist/components/Overlay.d.ts +10 -10
- package/dist/components/Overlay.js +40 -40
- package/dist/components/RadioInput/index.d.ts +21 -21
- package/dist/components/RadioInput/index.js +54 -54
- package/dist/components/RadioInput/styles.d.ts +54 -54
- package/dist/components/RadioInput/styles.js +43 -43
- package/dist/components/RouterPage/Menu.d.ts +10 -10
- package/dist/components/RouterPage/Menu.js +35 -35
- package/dist/components/RouterPage/MenuItem.d.ts +12 -12
- package/dist/components/RouterPage/MenuItem.js +41 -41
- package/dist/components/RouterPage/Router.d.ts +8 -8
- package/dist/components/RouterPage/Router.js +26 -26
- package/dist/components/RouterPage/index.d.ts +29 -29
- package/dist/components/RouterPage/index.js +88 -88
- package/dist/components/RouterPage/styles.d.ts +54 -54
- package/dist/components/RouterPage/styles.js +86 -86
- package/dist/components/Scroll.d.ts +5 -5
- package/dist/components/Scroll.js +23 -23
- package/dist/components/Select/Custom.d.ts +8 -8
- package/dist/components/Select/Custom.js +103 -103
- package/dist/components/Select/Multi.d.ts +3 -3
- package/dist/components/Select/Multi.js +104 -104
- package/dist/components/Select/Native.d.ts +17 -17
- package/dist/components/Select/Native.js +43 -43
- package/dist/components/Select/index.d.ts +12 -12
- package/dist/components/Select/index.js +43 -43
- package/dist/components/Select/styles.d.ts +5 -5
- package/dist/components/Select/styles.js +56 -56
- package/dist/components/Select/types.d.ts +49 -49
- package/dist/components/Select/types.js +2 -2
- package/dist/components/Slider.d.ts +5 -5
- package/dist/components/Slider.js +35 -35
- package/dist/components/Text.d.ts +9 -9
- package/dist/components/Text.js +40 -40
- package/dist/components/TextInput.d.ts +150 -150
- package/dist/components/TextInput.js +124 -124
- package/dist/components/Tooltip.d.ts +12 -12
- package/dist/components/Tooltip.js +121 -121
- package/dist/components/Touchable.d.ts +15 -15
- package/dist/components/Touchable.js +51 -51
- package/dist/components/View.d.ts +10 -10
- package/dist/components/View.js +61 -61
- package/dist/components/index.d.ts +24 -24
- package/dist/components/index.js +40 -40
- package/dist/index.d.ts +6 -6
- package/dist/index.js +28 -28
- package/dist/lib/OSAlert.d.ts +21 -21
- package/dist/lib/OSAlert.js +139 -139
- package/dist/lib/Toast.d.ts +13 -13
- package/dist/lib/Toast.js +31 -31
- package/dist/lib/hooks.d.ts +28 -28
- package/dist/lib/hooks.js +182 -182
- package/dist/lib/logger.d.ts +2 -2
- package/dist/lib/logger.js +15 -15
- package/dist/lib/utils/cookies.d.ts +6 -6
- package/dist/lib/utils/cookies.js +14 -14
- package/dist/lib/utils/index.d.ts +4 -4
- package/dist/lib/utils/index.js +26 -26
- package/dist/lib/utils/pollyfils/scroll.d.ts +1 -1
- package/dist/lib/utils/pollyfils/scroll.js +65 -65
- package/dist/lib/utils/stopPropagation.d.ts +1 -1
- package/dist/lib/utils/stopPropagation.js +19 -19
- package/dist/types/utility.d.ts +2 -2
- package/dist/types/utility.js +2 -2
- package/package.json +47 -47
package/dist/components/Icon.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.Icon = void 0;
|
|
26
|
-
var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
27
|
-
var common_1 = require("@codeleap/common");
|
|
28
|
-
var View_1 = require("./View");
|
|
29
|
-
var Icon = function (_a) {
|
|
30
|
-
var _b, _c, _d;
|
|
31
|
-
var name = _a.name, style = _a.style, variants = _a.variants, renderEmptySpace = _a.renderEmptySpace, otherProps = __rest(_a, ["name", "style", "variants", "renderEmptySpace"]);
|
|
32
|
-
var _e = (0, common_1.useCodeleapContext)(), Theme = _e.Theme, logger = _e.logger;
|
|
33
|
-
var Component = (_b = Theme === null || Theme === void 0 ? void 0 : Theme.icons) === null || _b === void 0 ? void 0 : _b[name];
|
|
34
|
-
var variantStyles = (0, common_1.useDefaultComponentStyle)('Icon', {
|
|
35
|
-
variants: variants,
|
|
36
|
-
styles: {
|
|
37
|
-
icon: style,
|
|
38
|
-
},
|
|
39
|
-
rootElement: 'icon',
|
|
40
|
-
});
|
|
41
|
-
if (!name) {
|
|
42
|
-
var iconStyle = variantStyles.icon;
|
|
43
|
-
return renderEmptySpace ? (0, jsx_runtime_1.jsx)(View_1.View, { css: {
|
|
44
|
-
height: (_c = iconStyle.size) !== null && _c !== void 0 ? _c : iconStyle.height,
|
|
45
|
-
width: (_d = iconStyle.size) !== null && _d !== void 0 ? _d : iconStyle.width,
|
|
46
|
-
} }) : null;
|
|
47
|
-
}
|
|
48
|
-
if (!Component) {
|
|
49
|
-
logger.warn("Icon: No icon found in theme for name \"".concat(name, "\"."), { props: { style: style, name: name, variants: variants, variantStyles: variantStyles } }, 'Component');
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
return (0, jsx_runtime_1.jsx)(Component, __assign({}, otherProps, { style: variantStyles.icon }));
|
|
53
|
-
};
|
|
54
|
-
exports.Icon = Icon;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.Icon = void 0;
|
|
26
|
+
var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
27
|
+
var common_1 = require("@codeleap/common");
|
|
28
|
+
var View_1 = require("./View");
|
|
29
|
+
var Icon = function (_a) {
|
|
30
|
+
var _b, _c, _d;
|
|
31
|
+
var name = _a.name, style = _a.style, variants = _a.variants, renderEmptySpace = _a.renderEmptySpace, otherProps = __rest(_a, ["name", "style", "variants", "renderEmptySpace"]);
|
|
32
|
+
var _e = (0, common_1.useCodeleapContext)(), Theme = _e.Theme, logger = _e.logger;
|
|
33
|
+
var Component = (_b = Theme === null || Theme === void 0 ? void 0 : Theme.icons) === null || _b === void 0 ? void 0 : _b[name];
|
|
34
|
+
var variantStyles = (0, common_1.useDefaultComponentStyle)('Icon', {
|
|
35
|
+
variants: variants,
|
|
36
|
+
styles: {
|
|
37
|
+
icon: style,
|
|
38
|
+
},
|
|
39
|
+
rootElement: 'icon',
|
|
40
|
+
});
|
|
41
|
+
if (!name) {
|
|
42
|
+
var iconStyle = variantStyles.icon;
|
|
43
|
+
return renderEmptySpace ? (0, jsx_runtime_1.jsx)(View_1.View, { css: {
|
|
44
|
+
height: (_c = iconStyle.size) !== null && _c !== void 0 ? _c : iconStyle.height,
|
|
45
|
+
width: (_d = iconStyle.size) !== null && _d !== void 0 ? _d : iconStyle.width,
|
|
46
|
+
} }) : null;
|
|
47
|
+
}
|
|
48
|
+
if (!Component) {
|
|
49
|
+
logger.warn("Icon: No icon found in theme for name \"".concat(name, "\"."), { props: { style: style, name: name, variants: variants, variantStyles: variantStyles } }, 'Component');
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return (0, jsx_runtime_1.jsx)(Component, __assign({}, otherProps, { style: variantStyles.icon }));
|
|
53
|
+
};
|
|
54
|
+
exports.Icon = Icon;
|
|
55
55
|
//# sourceMappingURL=Icon.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ElementType } from 'react';
|
|
2
|
-
import { TextProps } from './Text';
|
|
3
|
-
export declare type LinkProps<T extends ElementType> = TextProps<T> & {
|
|
4
|
-
openNewTab?: boolean;
|
|
5
|
-
onScroll?: (to: string) => any;
|
|
6
|
-
};
|
|
7
|
-
export declare const Link: <T extends ElementType<any> = "a">(linkProps: LinkProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { ElementType } from 'react';
|
|
2
|
+
import { TextProps } from './Text';
|
|
3
|
+
export declare type LinkProps<T extends ElementType> = TextProps<T> & {
|
|
4
|
+
openNewTab?: boolean;
|
|
5
|
+
onScroll?: (to: string) => any;
|
|
6
|
+
};
|
|
7
|
+
export declare const Link: <T extends ElementType<any> = "a">(linkProps: LinkProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
package/dist/components/Link.js
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.Link = void 0;
|
|
26
|
-
var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
27
|
-
var common_1 = require("@codeleap/common");
|
|
28
|
-
var scroll_1 = require("../lib/utils/pollyfils/scroll");
|
|
29
|
-
var stopPropagation_1 = require("../lib/utils/stopPropagation");
|
|
30
|
-
var Text_1 = require("./Text");
|
|
31
|
-
var Link = function (linkProps) {
|
|
32
|
-
var _a;
|
|
33
|
-
var to = linkProps.to, openNewTab = linkProps.openNewTab, _b = linkProps.component, component = _b === void 0 ? 'a' : _b, _c = linkProps.onScroll, onScroll = _c === void 0 ? null : _c, props = __rest(linkProps, ["to", "openNewTab", "component", "onScroll"]);
|
|
34
|
-
var isExternal = ['http', 'tel', 'mailto'].some(function (start) { return to.startsWith(start); });
|
|
35
|
-
var Component = isExternal ? 'a' : component;
|
|
36
|
-
var logger = (0, common_1.useCodeleapContext)().logger;
|
|
37
|
-
function handleClick(event) {
|
|
38
|
-
var _a;
|
|
39
|
-
logger.log('Link pressed', { to: to, text: linkProps.text }, 'Component');
|
|
40
|
-
if (to) {
|
|
41
|
-
if (to.startsWith('#')) {
|
|
42
|
-
event.preventDefault();
|
|
43
|
-
(0, stopPropagation_1.stopPropagation)(event);
|
|
44
|
-
if (onScroll) {
|
|
45
|
-
onScroll(to);
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
(0, scroll_1.scrollToElem)(to);
|
|
49
|
-
}
|
|
50
|
-
if (openNewTab) {
|
|
51
|
-
event.preventDefault();
|
|
52
|
-
(_a = window === null || window === void 0 ? void 0 : window.open) === null || _a === void 0 ? void 0 : _a.call(window, to, '_blank');
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
var linkPropOverride = (_a = {},
|
|
58
|
-
_a[isExternal ? 'href' : 'to'] = to,
|
|
59
|
-
_a);
|
|
60
|
-
return ((0, jsx_runtime_1.jsx)(Text_1.Text, __assign({ component: Component }, props, linkPropOverride, { onClick: handleClick })));
|
|
61
|
-
};
|
|
62
|
-
exports.Link = Link;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.Link = void 0;
|
|
26
|
+
var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
27
|
+
var common_1 = require("@codeleap/common");
|
|
28
|
+
var scroll_1 = require("../lib/utils/pollyfils/scroll");
|
|
29
|
+
var stopPropagation_1 = require("../lib/utils/stopPropagation");
|
|
30
|
+
var Text_1 = require("./Text");
|
|
31
|
+
var Link = function (linkProps) {
|
|
32
|
+
var _a;
|
|
33
|
+
var to = linkProps.to, openNewTab = linkProps.openNewTab, _b = linkProps.component, component = _b === void 0 ? 'a' : _b, _c = linkProps.onScroll, onScroll = _c === void 0 ? null : _c, props = __rest(linkProps, ["to", "openNewTab", "component", "onScroll"]);
|
|
34
|
+
var isExternal = ['http', 'tel', 'mailto'].some(function (start) { return to.startsWith(start); });
|
|
35
|
+
var Component = isExternal ? 'a' : component;
|
|
36
|
+
var logger = (0, common_1.useCodeleapContext)().logger;
|
|
37
|
+
function handleClick(event) {
|
|
38
|
+
var _a;
|
|
39
|
+
logger.log('Link pressed', { to: to, text: linkProps.text }, 'Component');
|
|
40
|
+
if (to) {
|
|
41
|
+
if (to.startsWith('#')) {
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
(0, stopPropagation_1.stopPropagation)(event);
|
|
44
|
+
if (onScroll) {
|
|
45
|
+
onScroll(to);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
(0, scroll_1.scrollToElem)(to);
|
|
49
|
+
}
|
|
50
|
+
if (openNewTab) {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
(_a = window === null || window === void 0 ? void 0 : window.open) === null || _a === void 0 ? void 0 : _a.call(window, to, '_blank');
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
var linkPropOverride = (_a = {},
|
|
58
|
+
_a[isExternal ? 'href' : 'to'] = to,
|
|
59
|
+
_a);
|
|
60
|
+
return ((0, jsx_runtime_1.jsx)(Text_1.Text, __assign({ component: Component }, props, linkPropOverride, { onClick: handleClick })));
|
|
61
|
+
};
|
|
62
|
+
exports.Link = Link;
|
|
63
63
|
//# sourceMappingURL=Link.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { VariableSizeList as VirtualList } from 'react-window';
|
|
2
|
-
import { ComponentProps, CSSProperties, ReactElement } from 'react';
|
|
3
|
-
import { ComponentVariants, ViewComposition, ViewStyles } from '@codeleap/common';
|
|
4
|
-
import { StylesOf } from '../types/utility';
|
|
5
|
-
import { CSSObject } from '@emotion/react';
|
|
6
|
-
export declare type ListRender<T> = (itemProps: {
|
|
7
|
-
item: T;
|
|
8
|
-
index: number;
|
|
9
|
-
style: CSSProperties;
|
|
10
|
-
}) => ReactElement;
|
|
11
|
-
export declare type ListProps<T> = {
|
|
12
|
-
styles?: StylesOf<ViewComposition>;
|
|
13
|
-
css?: CSSObject;
|
|
14
|
-
data: T[];
|
|
15
|
-
getSize: (i: T, idx: number) => number;
|
|
16
|
-
renderItem: ListRender<T>;
|
|
17
|
-
} & Omit<ComponentProps<typeof VirtualList>, 'itemCount' | 'itemSize' | 'itemData' | 'itemHeight' | 'width' | 'height' | 'children'> & ComponentVariants<typeof ViewStyles>;
|
|
18
|
-
export declare const List: <T extends unknown>(listProps: ListProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { VariableSizeList as VirtualList } from 'react-window';
|
|
2
|
+
import { ComponentProps, CSSProperties, ReactElement } from 'react';
|
|
3
|
+
import { ComponentVariants, ViewComposition, ViewStyles } from '@codeleap/common';
|
|
4
|
+
import { StylesOf } from '../types/utility';
|
|
5
|
+
import { CSSObject } from '@emotion/react';
|
|
6
|
+
export declare type ListRender<T> = (itemProps: {
|
|
7
|
+
item: T;
|
|
8
|
+
index: number;
|
|
9
|
+
style: CSSProperties;
|
|
10
|
+
}) => ReactElement;
|
|
11
|
+
export declare type ListProps<T> = {
|
|
12
|
+
styles?: StylesOf<ViewComposition>;
|
|
13
|
+
css?: CSSObject;
|
|
14
|
+
data: T[];
|
|
15
|
+
getSize: (i: T, idx: number) => number;
|
|
16
|
+
renderItem: ListRender<T>;
|
|
17
|
+
} & Omit<ComponentProps<typeof VirtualList>, 'itemCount' | 'itemSize' | 'itemData' | 'itemHeight' | 'width' | 'height' | 'children'> & ComponentVariants<typeof ViewStyles>;
|
|
18
|
+
export declare const List: <T extends unknown>(listProps: ListProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
package/dist/components/List.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.List = void 0;
|
|
29
|
-
var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
30
|
-
var react_window_1 = require("react-window");
|
|
31
|
-
var react_virtualized_auto_sizer_1 = __importDefault(require("react-virtualized-auto-sizer"));
|
|
32
|
-
var common_1 = require("@codeleap/common");
|
|
33
|
-
var List = function (listProps) {
|
|
34
|
-
var variants = listProps.variants, responsiveVariants = listProps.responsiveVariants, styles = listProps.styles, data = listProps.data, getSize = listProps.getSize, Item = listProps.renderItem, viewProps = __rest(listProps, ["variants", "responsiveVariants", "styles", "data", "getSize", "renderItem"]);
|
|
35
|
-
var variantStyles = (0, common_1.useDefaultComponentStyle)('View', {
|
|
36
|
-
variants: variants,
|
|
37
|
-
responsiveVariants: responsiveVariants,
|
|
38
|
-
styles: styles,
|
|
39
|
-
});
|
|
40
|
-
return ((0, jsx_runtime_1.jsx)(react_virtualized_auto_sizer_1.default, { children: function (_a) {
|
|
41
|
-
var height = _a.height, width = _a.width;
|
|
42
|
-
return ((0, jsx_runtime_1.jsx)(react_window_1.VariableSizeList, __assign({ height: height, width: width, itemCount: data.length, itemData: data, itemSize: function (idx) { return getSize(data[idx], idx); }, css: variantStyles.wrapper }, viewProps, { children: function (_a) {
|
|
43
|
-
var style = _a.style, index = _a.index;
|
|
44
|
-
return ((0, jsx_runtime_1.jsx)(Item, { item: data[index], style: style, index: index }));
|
|
45
|
-
} })));
|
|
46
|
-
} }));
|
|
47
|
-
// return <View {...viewProps}>
|
|
48
|
-
// {data.map((item, idx) => <Component item={item} idx={idx} key={idx}/>)}
|
|
49
|
-
// </View>
|
|
50
|
-
};
|
|
51
|
-
exports.List = List;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.List = void 0;
|
|
29
|
+
var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
30
|
+
var react_window_1 = require("react-window");
|
|
31
|
+
var react_virtualized_auto_sizer_1 = __importDefault(require("react-virtualized-auto-sizer"));
|
|
32
|
+
var common_1 = require("@codeleap/common");
|
|
33
|
+
var List = function (listProps) {
|
|
34
|
+
var variants = listProps.variants, responsiveVariants = listProps.responsiveVariants, styles = listProps.styles, data = listProps.data, getSize = listProps.getSize, Item = listProps.renderItem, viewProps = __rest(listProps, ["variants", "responsiveVariants", "styles", "data", "getSize", "renderItem"]);
|
|
35
|
+
var variantStyles = (0, common_1.useDefaultComponentStyle)('View', {
|
|
36
|
+
variants: variants,
|
|
37
|
+
responsiveVariants: responsiveVariants,
|
|
38
|
+
styles: styles,
|
|
39
|
+
});
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(react_virtualized_auto_sizer_1.default, { children: function (_a) {
|
|
41
|
+
var height = _a.height, width = _a.width;
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)(react_window_1.VariableSizeList, __assign({ height: height, width: width, itemCount: data.length, itemData: data, itemSize: function (idx) { return getSize(data[idx], idx); }, css: variantStyles.wrapper }, viewProps, { children: function (_a) {
|
|
43
|
+
var style = _a.style, index = _a.index;
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(Item, { item: data[index], style: style, index: index }));
|
|
45
|
+
} })));
|
|
46
|
+
} }));
|
|
47
|
+
// return <View {...viewProps}>
|
|
48
|
+
// {data.map((item, idx) => <Component item={item} idx={idx} key={idx}/>)}
|
|
49
|
+
// </View>
|
|
50
|
+
};
|
|
51
|
+
exports.List = List;
|
|
52
52
|
//# sourceMappingURL=List.js.map
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { AnyFunction, ComponentVariants, ModalComposition } from '@codeleap/common';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
import { StylesOf } from '../../types/utility';
|
|
4
|
-
import { WebModalStyles as ModalStyles } from './styles';
|
|
5
|
-
export * from './styles';
|
|
6
|
-
export declare type ModalProps = {
|
|
7
|
-
visible: boolean;
|
|
8
|
-
title?: React.ReactNode;
|
|
9
|
-
toggle: AnyFunction;
|
|
10
|
-
styles?: StylesOf<ModalComposition>;
|
|
11
|
-
accessible?: boolean;
|
|
12
|
-
showClose?: boolean;
|
|
13
|
-
closable?: boolean;
|
|
14
|
-
scroll?: boolean;
|
|
15
|
-
footer?: ReactNode;
|
|
16
|
-
debugName?: string;
|
|
17
|
-
} & ComponentVariants<typeof ModalStyles>;
|
|
18
|
-
export declare const ModalContent: React.FC<ModalProps & {
|
|
19
|
-
id: string;
|
|
20
|
-
}>;
|
|
21
|
-
export declare const Modal: React.FC<ModalProps>;
|
|
1
|
+
import { AnyFunction, ComponentVariants, ModalComposition } from '@codeleap/common';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { StylesOf } from '../../types/utility';
|
|
4
|
+
import { WebModalStyles as ModalStyles } from './styles';
|
|
5
|
+
export * from './styles';
|
|
6
|
+
export declare type ModalProps = {
|
|
7
|
+
visible: boolean;
|
|
8
|
+
title?: React.ReactNode;
|
|
9
|
+
toggle: AnyFunction;
|
|
10
|
+
styles?: StylesOf<ModalComposition>;
|
|
11
|
+
accessible?: boolean;
|
|
12
|
+
showClose?: boolean;
|
|
13
|
+
closable?: boolean;
|
|
14
|
+
scroll?: boolean;
|
|
15
|
+
footer?: ReactNode;
|
|
16
|
+
debugName?: string;
|
|
17
|
+
} & ComponentVariants<typeof ModalStyles>;
|
|
18
|
+
export declare const ModalContent: React.FC<ModalProps & {
|
|
19
|
+
id: string;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const Modal: React.FC<ModalProps>;
|