ag-common 0.0.418 → 0.0.419
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/api/helpers/api.js +34 -35
- package/dist/api/helpers/aws.js +9 -13
- package/dist/api/helpers/cloudfront.js +7 -24
- package/dist/api/helpers/dynamo.js +85 -134
- package/dist/api/helpers/dynamoInfra.js +14 -19
- package/dist/api/helpers/enforceDynamoProvisionCap.js +14 -18
- package/dist/api/helpers/index.js +14 -30
- package/dist/api/helpers/openApiHelpers.d.ts +2 -3
- package/dist/api/helpers/openApiHelpers.js +34 -37
- package/dist/api/helpers/s3.js +81 -126
- package/dist/api/helpers/ses.js +9 -28
- package/dist/api/helpers/sqs.js +9 -26
- package/dist/api/helpers/ssm.js +8 -14
- package/dist/api/helpers/sts.js +16 -34
- package/dist/api/helpers/validateOpenApi.js +92 -103
- package/dist/api/helpers/validations.js +29 -46
- package/dist/api/index.js +2 -18
- package/dist/api/openapi-prefix.js +25 -38
- package/dist/api/types/aws.js +1 -2
- package/dist/api/types/index.js +1 -17
- package/dist/common/const.js +2 -5
- package/dist/common/helpers/array.js +8 -19
- package/dist/common/helpers/async.js +10 -28
- package/dist/common/helpers/binary.js +5 -10
- package/dist/common/helpers/date.js +14 -25
- package/dist/common/helpers/email.js +5 -11
- package/dist/common/helpers/func.js +3 -7
- package/dist/common/helpers/generator.js +9 -24
- package/dist/common/helpers/groupBy.js +3 -9
- package/dist/common/helpers/hashCode.js +3 -9
- package/dist/common/helpers/i18n.js +9 -17
- package/dist/common/helpers/index.js +18 -34
- package/dist/common/helpers/log.js +16 -28
- package/dist/common/helpers/math.js +9 -21
- package/dist/common/helpers/memo.js +3 -7
- package/dist/common/helpers/object.js +20 -35
- package/dist/common/helpers/random.js +4 -10
- package/dist/common/helpers/secondsInNearest.js +2 -7
- package/dist/common/helpers/sleep.js +1 -5
- package/dist/common/helpers/string/base64.js +2 -7
- package/dist/common/helpers/string/chunk.js +1 -5
- package/dist/common/helpers/string/contains.js +2 -7
- package/dist/common/helpers/string/getExtendedStringSegment.js +5 -9
- package/dist/common/helpers/string/index.js +10 -26
- package/dist/common/helpers/string/json.js +1 -5
- package/dist/common/helpers/string/object.js +1 -5
- package/dist/common/helpers/string/surround.js +1 -5
- package/dist/common/helpers/string/trim.js +2 -7
- package/dist/common/helpers/string/truncate.js +1 -5
- package/dist/common/helpers/string/url.js +4 -9
- package/dist/common/index.js +2 -18
- package/dist/index.js +3 -19
- package/dist/ui/components/BorderGradient/index.js +18 -25
- package/dist/ui/components/Button/index.js +17 -25
- package/dist/ui/components/Chevron/index.js +9 -16
- package/dist/ui/components/Close/index.js +6 -13
- package/dist/ui/components/Confirm/Dialog.js +9 -25
- package/dist/ui/components/Confirm/Modal.js +20 -27
- package/dist/ui/components/Confirm/index.js +3 -19
- package/dist/ui/components/Confirm/types.js +1 -2
- package/dist/ui/components/DropdownList/Base.js +33 -64
- package/dist/ui/components/DropdownList/Dialog.js +8 -24
- package/dist/ui/components/DropdownList/index.js +2 -18
- package/dist/ui/components/DropdownList/types.js +1 -2
- package/dist/ui/components/FlexColumn/index.js +4 -14
- package/dist/ui/components/FlexRow/index.js +4 -14
- package/dist/ui/components/HeadersRaw/index.js +20 -27
- package/dist/ui/components/HorizontalScrollBar/index.js +6 -34
- package/dist/ui/components/Icon/index.js +9 -16
- package/dist/ui/components/Image/index.js +10 -28
- package/dist/ui/components/InfiniteScroll/index.js +18 -50
- package/dist/ui/components/KebabDots/index.js +6 -13
- package/dist/ui/components/Loader/index.js +9 -39
- package/dist/ui/components/Modal/Dialog.js +7 -23
- package/dist/ui/components/Modal/Modal.js +19 -49
- package/dist/ui/components/Modal/index.js +3 -19
- package/dist/ui/components/Modal/types.js +1 -2
- package/dist/ui/components/OpenApiCodeBlock/OpenApiCodeBlock.js +26 -34
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/body.js +12 -19
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/getCurlLines.js +6 -11
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/security.js +8 -15
- package/dist/ui/components/OpenApiCodeBlock/curl/index.js +14 -21
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/call.js +8 -15
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/getFetchLines.js +3 -8
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/req.js +27 -34
- package/dist/ui/components/OpenApiCodeBlock/fetch/index.js +11 -18
- package/dist/ui/components/OpenApiCodeBlock/helpers/common.js +7 -17
- package/dist/ui/components/OpenApiCodeBlock/helpers/joinJsx.js +6 -15
- package/dist/ui/components/OpenApiCodeBlock/index.js +2 -18
- package/dist/ui/components/OpenApiCodeBlock/types.js +1 -2
- package/dist/ui/components/PieChart/index.js +11 -18
- package/dist/ui/components/ProgressBar/index.js +15 -45
- package/dist/ui/components/Prompt/Dialog.js +7 -23
- package/dist/ui/components/Prompt/Modal.js +25 -55
- package/dist/ui/components/Prompt/index.js +2 -18
- package/dist/ui/components/RowOrColumn/index.js +7 -17
- package/dist/ui/components/Search/AutoHideSearchBox.js +24 -56
- package/dist/ui/components/Search/Base.js +21 -52
- package/dist/ui/components/Search/Dialog.js +10 -26
- package/dist/ui/components/Search/Inline.js +3 -10
- package/dist/ui/components/Search/Modal.js +10 -17
- package/dist/ui/components/Search/SearchBox.js +26 -58
- package/dist/ui/components/Search/index.js +7 -23
- package/dist/ui/components/Search/types.js +1 -2
- package/dist/ui/components/Sidebar/index.js +18 -25
- package/dist/ui/components/SparkLine/index.js +17 -27
- package/dist/ui/components/Table/index.js +15 -22
- package/dist/ui/components/TextEdit/CheckboxEdit.js +21 -51
- package/dist/ui/components/TextEdit/ColourEdit.js +17 -44
- package/dist/ui/components/TextEdit/LengthBox.js +5 -12
- package/dist/ui/components/TextEdit/ListboxEdit.js +15 -42
- package/dist/ui/components/TextEdit/RadioGroup.js +13 -43
- package/dist/ui/components/TextEdit/TextEdit.js +48 -78
- package/dist/ui/components/TextEdit/common.js +11 -17
- package/dist/ui/components/TextEdit/index.js +6 -22
- package/dist/ui/components/TextEdit/types.js +1 -2
- package/dist/ui/components/TextWithButton/index.js +10 -40
- package/dist/ui/components/TimelineChart/index.js +14 -24
- package/dist/ui/components/Toast/Cross.js +9 -16
- package/dist/ui/components/Toast/Tick.js +4 -11
- package/dist/ui/components/Toast/Warning.js +8 -15
- package/dist/ui/components/Toast/base.js +33 -65
- package/dist/ui/components/Toast/index.js +2 -18
- package/dist/ui/components/Toast/types.js +1 -2
- package/dist/ui/components/UserImage/index.js +17 -48
- package/dist/ui/components/index.js +30 -46
- package/dist/ui/helpers/axiosHelper.js +25 -39
- package/dist/ui/helpers/browserHelpers.js +7 -22
- package/dist/ui/helpers/callOpenApi/cached.js +18 -37
- package/dist/ui/helpers/callOpenApi/direct.js +46 -59
- package/dist/ui/helpers/callOpenApi/helpers.js +25 -40
- package/dist/ui/helpers/callOpenApi/hook.js +47 -36
- package/dist/ui/helpers/callOpenApi/index.js +5 -21
- package/dist/ui/helpers/callOpenApi/types.js +1 -2
- package/dist/ui/helpers/cognito.js +1 -2
- package/dist/ui/helpers/cookie/const.js +2 -5
- package/dist/ui/helpers/cookie/get.js +13 -14
- package/dist/ui/helpers/cookie/index.js +5 -21
- package/dist/ui/helpers/cookie/raw.js +9 -16
- package/dist/ui/helpers/cookie/set.js +10 -15
- package/dist/ui/helpers/cookie/use.js +23 -16
- package/dist/ui/helpers/date.js +10 -15
- package/dist/ui/helpers/debounce.js +5 -10
- package/dist/ui/helpers/dom.js +6 -13
- package/dist/ui/helpers/extractAttributes.js +2 -7
- package/dist/ui/helpers/index.js +25 -41
- package/dist/ui/helpers/jwt.js +1 -2
- package/dist/ui/helpers/plural.js +1 -5
- package/dist/ui/helpers/routes.js +17 -24
- package/dist/ui/helpers/serviceWorker.js +8 -23
- package/dist/ui/helpers/useContextMenu.js +9 -14
- package/dist/ui/helpers/useElementAttribute.js +3 -7
- package/dist/ui/helpers/useGranularHook.js +5 -10
- package/dist/ui/helpers/useInterval.js +8 -12
- package/dist/ui/helpers/useLocalStorage.js +24 -32
- package/dist/ui/helpers/useLockBodyScroll.js +3 -7
- package/dist/ui/helpers/useOnClickOutside.js +7 -12
- package/dist/ui/helpers/useOnScroll.js +15 -21
- package/dist/ui/helpers/useOverloadPageSearch.js +3 -7
- package/dist/ui/helpers/useQueryString.js +14 -20
- package/dist/ui/helpers/useResize.js +8 -12
- package/dist/ui/helpers/useTimeout.js +5 -9
- package/dist/ui/icons/ChevronRight.js +3 -9
- package/dist/ui/icons/CrossIcon.js +5 -12
- package/dist/ui/icons/Door.js +4 -10
- package/dist/ui/icons/HorizontalDots.js +3 -9
- package/dist/ui/icons/Magnify.js +3 -10
- package/dist/ui/icons/Pencil.js +5 -12
- package/dist/ui/icons/Save.js +4 -11
- package/dist/ui/icons/Undo.js +5 -12
- package/dist/ui/icons/UserOutline.js +3 -9
- package/dist/ui/icons/index.js +9 -25
- package/dist/ui/index.js +4 -20
- package/dist/ui/styles/colours.js +7 -12
- package/dist/ui/styles/common.js +14 -22
- package/dist/ui/styles/index.js +4 -20
- package/dist/ui/styles/media.js +7 -10
- package/dist/ui/styles/standaloneStyles.js +10 -16
- package/package.json +18 -17
|
@@ -1,40 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.HeadersRaw = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const HeadersRaw = ({ title, image, SiteShort, FullSiteUrl, siteDesc, }) => {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const HeadersRaw = ({ title, image, SiteShort, FullSiteUrl, siteDesc, }) => {
|
|
9
3
|
const fullTitle = `${title ? `${title} | ` : ''}${SiteShort} | ${siteDesc}`;
|
|
10
4
|
const titleFallback = title || fullTitle;
|
|
11
5
|
const titleBlock = [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
React.createElement("title", { key: "1" }, fullTitle),
|
|
7
|
+
React.createElement("meta", { key: "2", property: "og:title", content: titleFallback }),
|
|
8
|
+
React.createElement("meta", { key: "3", name: "twitter:title", content: titleFallback }),
|
|
9
|
+
React.createElement("meta", { key: "4", itemProp: "name", content: titleFallback }),
|
|
10
|
+
React.createElement("meta", { key: "5", name: "description", content: fullTitle }),
|
|
11
|
+
React.createElement("meta", { key: "6", itemProp: "description", content: fullTitle }),
|
|
12
|
+
React.createElement("meta", { key: "7", property: "og:description", content: fullTitle }),
|
|
13
|
+
React.createElement("meta", { key: "8", name: "twitter:description", content: fullTitle }),
|
|
20
14
|
];
|
|
21
15
|
const imagearr = !image
|
|
22
16
|
? []
|
|
23
17
|
: [
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
React.createElement("meta", { key: "9", property: "og:image", content: image }),
|
|
19
|
+
React.createElement("meta", { key: "10", name: "twitter:image", content: image }),
|
|
26
20
|
];
|
|
27
21
|
return [
|
|
28
|
-
|
|
22
|
+
React.createElement("meta", { key: "11", charSet: "utf-8" }),
|
|
29
23
|
...titleBlock,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
React.createElement("meta", { key: "12", property: "og:site_name", content: SiteShort }),
|
|
25
|
+
React.createElement("meta", { key: "13", property: "og:url", content: FullSiteUrl }),
|
|
26
|
+
React.createElement("meta", { key: "14", itemProp: "url", content: FullSiteUrl }),
|
|
27
|
+
React.createElement("meta", { key: "15", name: "twitter:url", content: FullSiteUrl }),
|
|
28
|
+
React.createElement("meta", { key: "16", property: "og:type", content: "website" }),
|
|
29
|
+
React.createElement("meta", { key: "17", name: "twitter:card", content: "summary_large_image" }),
|
|
30
|
+
React.createElement("meta", { key: "18", name: "robots", content: "index, follow" }),
|
|
37
31
|
...imagearr,
|
|
38
32
|
];
|
|
39
33
|
};
|
|
40
|
-
exports.HeadersRaw = HeadersRaw;
|
|
@@ -1,33 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.HorizontalScrollBar = void 0;
|
|
27
|
-
const react_1 = __importStar(require("react"));
|
|
28
|
-
const HorizontalScrollBar = ({ children, className, }) => {
|
|
29
|
-
const scrollRef = (0, react_1.useRef)(null);
|
|
30
|
-
(0, react_1.useEffect)(() => {
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
export const HorizontalScrollBar = ({ children, className, }) => {
|
|
3
|
+
const scrollRef = useRef(null);
|
|
4
|
+
useEffect(() => {
|
|
31
5
|
if (!scrollRef.current)
|
|
32
6
|
return;
|
|
33
7
|
const handleScroll = (e) => {
|
|
@@ -39,11 +13,9 @@ const HorizontalScrollBar = ({ children, className, }) => {
|
|
|
39
13
|
};
|
|
40
14
|
scrollRef.current.addEventListener('wheel', handleScroll);
|
|
41
15
|
return () => {
|
|
42
|
-
var _a, _b;
|
|
43
16
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
44
|
-
|
|
17
|
+
scrollRef.current?.removeEventListener?.('wheel', handleScroll);
|
|
45
18
|
};
|
|
46
19
|
}, [scrollRef]);
|
|
47
|
-
return (
|
|
20
|
+
return (React.createElement("div", { ref: scrollRef, style: { overflowX: 'scroll' }, className: className }, children));
|
|
48
21
|
};
|
|
49
|
-
exports.HorizontalScrollBar = HorizontalScrollBar;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
exports.Icon = exports.IconF = void 0;
|
|
7
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const object_1 = require("../../../common/helpers/object");
|
|
10
|
-
const common_1 = require("../../styles/common");
|
|
11
|
-
exports.IconF = styled_1.default.span `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { removeUndefValuesFromObject } from '../../../common/helpers/object';
|
|
4
|
+
import { HardOutline } from '../../styles/common';
|
|
5
|
+
export const IconF = styled.span `
|
|
12
6
|
transition: all 200ms;
|
|
13
7
|
display: flex;
|
|
14
8
|
justify-content: center;
|
|
@@ -40,7 +34,7 @@ exports.IconF = styled_1.default.span `
|
|
|
40
34
|
}
|
|
41
35
|
|
|
42
36
|
&[data-hasoutline='true'] {
|
|
43
|
-
${
|
|
37
|
+
${HardOutline}
|
|
44
38
|
}
|
|
45
39
|
|
|
46
40
|
svg {
|
|
@@ -48,10 +42,10 @@ exports.IconF = styled_1.default.span `
|
|
|
48
42
|
height: 100%;
|
|
49
43
|
}
|
|
50
44
|
`;
|
|
51
|
-
const Icon = (pr) => {
|
|
45
|
+
export const Icon = (pr) => {
|
|
52
46
|
const { className, children, disabled, onClick } = pr;
|
|
53
47
|
const CHND = pr.canHover && !pr.disabled;
|
|
54
|
-
const style =
|
|
48
|
+
const style = removeUndefValuesFromObject({
|
|
55
49
|
'--fill': pr.fill || null,
|
|
56
50
|
width: pr.width || '100%',
|
|
57
51
|
height: pr.height || '100%',
|
|
@@ -61,6 +55,5 @@ const Icon = (pr) => {
|
|
|
61
55
|
filter: !pr.disabled ? null : 'grayscale(1)',
|
|
62
56
|
'--outlinecolour': pr.outline || null,
|
|
63
57
|
});
|
|
64
|
-
return (
|
|
58
|
+
return (React.createElement(IconF, { ...pr, className: className, onClick: (e) => !disabled && onClick?.(e), style: style, "data-chnd": CHND, "data-hasoutline": pr.outline, "data-hasfill": !!pr.fill }, children));
|
|
65
59
|
};
|
|
66
|
-
exports.Icon = Icon;
|
|
@@ -1,35 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Image = void 0;
|
|
18
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
-
const react_1 = __importDefault(require("react"));
|
|
20
|
-
const media_1 = require("../../styles/media");
|
|
21
|
-
const Base = styled_1.default.img `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { bigScreen, smallScreen } from '../../styles/media';
|
|
4
|
+
const Base = styled.img `
|
|
22
5
|
object-fit: contain;
|
|
23
6
|
min-height: 5rem;
|
|
24
7
|
min-width: 5rem;
|
|
25
8
|
max-width: 100%;
|
|
26
9
|
|
|
27
10
|
&[data-smalltop='true'] {
|
|
28
|
-
@media ${
|
|
11
|
+
@media ${smallScreen} {
|
|
29
12
|
order: -1;
|
|
30
13
|
}
|
|
31
14
|
}
|
|
32
|
-
@media ${
|
|
15
|
+
@media ${smallScreen} {
|
|
33
16
|
width: 90vw;
|
|
34
17
|
|
|
35
18
|
&[data-bigonly='true'] {
|
|
@@ -41,7 +24,7 @@ const Base = styled_1.default.img `
|
|
|
41
24
|
}
|
|
42
25
|
}
|
|
43
26
|
|
|
44
|
-
@media ${
|
|
27
|
+
@media ${bigScreen} {
|
|
45
28
|
width: 100%;
|
|
46
29
|
max-width: 50rem;
|
|
47
30
|
&[data-smallonly='true'] {
|
|
@@ -53,8 +36,7 @@ const Base = styled_1.default.img `
|
|
|
53
36
|
}
|
|
54
37
|
}
|
|
55
38
|
`;
|
|
56
|
-
const Image = (p) => {
|
|
57
|
-
const { smalltop, bigonly, smallonly, small
|
|
58
|
-
return (
|
|
39
|
+
export const Image = (p) => {
|
|
40
|
+
const { smalltop, bigonly, smallonly, small, ...p1 } = p;
|
|
41
|
+
return (React.createElement(Base, { ...p1, "data-smalltop": smalltop, "data-bigonly": bigonly, "data-smallonly": smallonly, "data-small": small }));
|
|
59
42
|
};
|
|
60
|
-
exports.Image = Image;
|
|
@@ -1,37 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.InfiniteScroll = void 0;
|
|
30
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
31
|
-
const react_1 = __importStar(require("react"));
|
|
32
|
-
const debounce_1 = require("../../helpers/debounce");
|
|
33
|
-
const dom_1 = require("../../helpers/dom");
|
|
34
|
-
const Base = styled_1.default.div `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React, { createRef, useEffect, useState } from 'react';
|
|
3
|
+
import { debounce } from '../../helpers/debounce';
|
|
4
|
+
import { filterDataProps } from '../../helpers/dom';
|
|
5
|
+
const Base = styled.div `
|
|
35
6
|
overflow-y: auto;
|
|
36
7
|
height: 100%;
|
|
37
8
|
width: 100%;
|
|
@@ -40,17 +11,16 @@ const Base = styled_1.default.div `
|
|
|
40
11
|
}
|
|
41
12
|
`;
|
|
42
13
|
//if we see this, then we havent shown user enough items - allow click to load more
|
|
43
|
-
const LoadMore =
|
|
14
|
+
const LoadMore = styled.div `
|
|
44
15
|
cursor: pointer;
|
|
45
16
|
text-decoration: underline;
|
|
46
17
|
`;
|
|
47
|
-
const InfiniteScroll = (p) => {
|
|
48
|
-
var _a, _b;
|
|
18
|
+
export const InfiniteScroll = (p) => {
|
|
49
19
|
const { incrementNumber = 10, scrollDisabled = false } = p;
|
|
50
|
-
const ref =
|
|
51
|
-
const [startIndex] =
|
|
52
|
-
const [endIndex, setEndIndex] =
|
|
53
|
-
const [startScrollTop, setStartScrollTop] =
|
|
20
|
+
const ref = createRef();
|
|
21
|
+
const [startIndex] = useState(p.startIndex ?? 0);
|
|
22
|
+
const [endIndex, setEndIndex] = useState((startIndex ?? 0) + incrementNumber);
|
|
23
|
+
const [startScrollTop, setStartScrollTop] = useState(0);
|
|
54
24
|
const handleScrollTop = (e) => {
|
|
55
25
|
const { scrollTop, clientHeight, scrollHeight } = e.currentTarget;
|
|
56
26
|
const hasReachedEnd = scrollTop + clientHeight === scrollHeight;
|
|
@@ -58,32 +28,30 @@ const InfiniteScroll = (p) => {
|
|
|
58
28
|
setEndIndex(endIndex + incrementNumber);
|
|
59
29
|
}
|
|
60
30
|
};
|
|
61
|
-
|
|
31
|
+
useEffect(() => {
|
|
62
32
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
63
33
|
setStartScrollTop(ref.current.scrollTop);
|
|
64
34
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
65
35
|
}, []);
|
|
66
36
|
const sliced = p.children.slice(0, endIndex);
|
|
67
37
|
const lastDisplayIndex = Math.min(p.children.length, endIndex);
|
|
68
|
-
const renderResultsLine =
|
|
69
|
-
return (
|
|
38
|
+
const renderResultsLine = p.renderResultsLine?.(lastDisplayIndex, p.children.length);
|
|
39
|
+
return (React.createElement(Base, { "data-no-scroll": scrollDisabled, ref: ref, className: p.className, onScroll: (e) => {
|
|
70
40
|
if (scrollDisabled) {
|
|
71
41
|
return;
|
|
72
42
|
}
|
|
73
43
|
const { scrollTop } = e.currentTarget;
|
|
74
44
|
handleScrollTop(e);
|
|
75
45
|
//
|
|
76
|
-
|
|
77
|
-
var _a;
|
|
46
|
+
debounce(() => {
|
|
78
47
|
setStartScrollTop(scrollTop);
|
|
79
|
-
|
|
48
|
+
p?.onScroll?.({ scrollTop, isDown: startScrollTop < scrollTop });
|
|
80
49
|
}, {
|
|
81
50
|
key: 'in-scr',
|
|
82
51
|
time: 50,
|
|
83
52
|
});
|
|
84
|
-
}
|
|
53
|
+
}, ...filterDataProps(p) },
|
|
85
54
|
sliced,
|
|
86
55
|
renderResultsLine,
|
|
87
|
-
lastDisplayIndex < p.children.length && (
|
|
56
|
+
lastDisplayIndex < p.children.length && (React.createElement(LoadMore, { onClick: () => setEndIndex(endIndex + incrementNumber) }, "Load More?"))));
|
|
88
57
|
};
|
|
89
|
-
exports.InfiniteScroll = InfiniteScroll;
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
exports.KebabDots = void 0;
|
|
7
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const HorizontalDots_1 = require("../../icons/HorizontalDots");
|
|
10
|
-
const Icon_1 = require("../Icon");
|
|
11
|
-
const IconStyled = (0, styled_1.default)(Icon_1.Icon) `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { HorizontalDots } from '../../icons/HorizontalDots';
|
|
4
|
+
import { Icon } from '../Icon';
|
|
5
|
+
const IconStyled = styled(Icon) `
|
|
12
6
|
position: absolute;
|
|
13
7
|
`;
|
|
14
|
-
const KebabDots = ({ onClick }) => (
|
|
15
|
-
exports.KebabDots = KebabDots;
|
|
8
|
+
export const KebabDots = ({ onClick }) => (React.createElement(IconStyled, { width: "2rem", height: "2rem", onClick: () => onClick?.(), "data-icon": "kebab" }, HorizontalDots));
|
|
@@ -1,35 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.Loader = void 0;
|
|
30
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
31
|
-
const react_1 = __importStar(require("react"));
|
|
32
|
-
const Base = styled_1.default.div `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
const Base = styled.div `
|
|
33
4
|
border: 16px solid #f3f3f3; /* Light grey */
|
|
34
5
|
border-top: 16px solid #3498db; /* Blue */
|
|
35
6
|
border-radius: 50%;
|
|
@@ -46,7 +17,7 @@ const Base = styled_1.default.div `
|
|
|
46
17
|
}
|
|
47
18
|
}
|
|
48
19
|
`;
|
|
49
|
-
const LoadingBack =
|
|
20
|
+
const LoadingBack = styled.div `
|
|
50
21
|
position: absolute;
|
|
51
22
|
top: 0;
|
|
52
23
|
left: 0;
|
|
@@ -63,12 +34,11 @@ const LoadingBack = styled_1.default.div `
|
|
|
63
34
|
}
|
|
64
35
|
transition: opacity 5s;
|
|
65
36
|
`;
|
|
66
|
-
const Loader = ({ name, height = '2rem', width = '2rem' }) => {
|
|
67
|
-
const [trans, setTrans] =
|
|
68
|
-
|
|
37
|
+
export const Loader = ({ name, height = '2rem', width = '2rem' }) => {
|
|
38
|
+
const [trans, setTrans] = useState(true);
|
|
39
|
+
useEffect(() => {
|
|
69
40
|
setTrans(false);
|
|
70
41
|
}, []);
|
|
71
|
-
return (
|
|
72
|
-
|
|
42
|
+
return (React.createElement(LoadingBack, { "data-loading": name, "data-transparent": trans },
|
|
43
|
+
React.createElement(Base, { style: { height: height, width: width } })));
|
|
73
44
|
};
|
|
74
|
-
exports.Loader = Loader;
|
|
@@ -1,26 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.ModalDialog = void 0;
|
|
16
|
-
const react_1 = __importDefault(require("react"));
|
|
17
|
-
const client_1 = require("react-dom/client");
|
|
18
|
-
const Modal_1 = require("./Modal");
|
|
19
|
-
const ModalDialog = (content) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import { Modal } from './Modal';
|
|
4
|
+
export const ModalDialog = async (content) => {
|
|
20
5
|
return new Promise((res) => {
|
|
21
6
|
const wrapper = document.body.appendChild(document.createElement('div'));
|
|
22
|
-
const root =
|
|
23
|
-
root.render(
|
|
7
|
+
const root = createRoot(wrapper);
|
|
8
|
+
root.render(React.createElement(Modal, { open: true, setOpen: (o) => {
|
|
24
9
|
if (!o) {
|
|
25
10
|
root.unmount();
|
|
26
11
|
wrapper.remove();
|
|
@@ -28,5 +13,4 @@ const ModalDialog = (content) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
28
13
|
res('ok');
|
|
29
14
|
}, topPosition: "center", position: "center" }, content));
|
|
30
15
|
});
|
|
31
|
-
}
|
|
32
|
-
exports.ModalDialog = ModalDialog;
|
|
16
|
+
};
|
|
@@ -1,38 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.Modal = exports.ModalItem = void 0;
|
|
30
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
31
|
-
const react_1 = __importStar(require("react"));
|
|
32
|
-
const useOnClickOutside_1 = require("../../helpers/useOnClickOutside");
|
|
33
|
-
const styles_1 = require("../../styles");
|
|
34
|
-
const Close_1 = require("../Close");
|
|
35
|
-
const FixedBackground = styled_1.default.div `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { useOnClickOutside } from '../../helpers/useOnClickOutside';
|
|
4
|
+
import { bounce } from '../../styles';
|
|
5
|
+
import { Close } from '../Close';
|
|
6
|
+
const FixedBackground = styled.div `
|
|
36
7
|
position: fixed;
|
|
37
8
|
top: 0;
|
|
38
9
|
left: 0;
|
|
@@ -44,7 +15,7 @@ const FixedBackground = styled_1.default.div `
|
|
|
44
15
|
justify-content: center;
|
|
45
16
|
align-items: center;
|
|
46
17
|
`;
|
|
47
|
-
const ModalBase =
|
|
18
|
+
const ModalBase = styled.div `
|
|
48
19
|
display: flex;
|
|
49
20
|
position: absolute;
|
|
50
21
|
z-index: 1;
|
|
@@ -66,9 +37,9 @@ const ModalBase = styled_1.default.div `
|
|
|
66
37
|
&[data-topposition='bottom'] {
|
|
67
38
|
bottom: 0;
|
|
68
39
|
}
|
|
69
|
-
${
|
|
40
|
+
${bounce('data-bounced')}
|
|
70
41
|
`;
|
|
71
|
-
|
|
42
|
+
export const ModalItem = styled.div `
|
|
72
43
|
display: flex;
|
|
73
44
|
padding: 1rem;
|
|
74
45
|
|
|
@@ -76,13 +47,13 @@ exports.ModalItem = styled_1.default.div `
|
|
|
76
47
|
background-color: #eee;
|
|
77
48
|
}
|
|
78
49
|
`;
|
|
79
|
-
const CloseStyled = (
|
|
50
|
+
const CloseStyled = styled(Close) `
|
|
80
51
|
z-index: 1;
|
|
81
52
|
`;
|
|
82
|
-
const Modal = ({ open, setOpen, children, position = 'left', topPosition = 'top', showCloseButton = true, closeOnMoveMouseOutside = false, className, closeOnClickOutside = true, }) => {
|
|
83
|
-
const [bounced, setBounced] =
|
|
84
|
-
const ref =
|
|
85
|
-
|
|
53
|
+
export const Modal = ({ open, setOpen, children, position = 'left', topPosition = 'top', showCloseButton = true, closeOnMoveMouseOutside = false, className, closeOnClickOutside = true, }) => {
|
|
54
|
+
const [bounced, setBounced] = useState(false);
|
|
55
|
+
const ref = useRef(null);
|
|
56
|
+
useOnClickOutside({
|
|
86
57
|
disabled: !open,
|
|
87
58
|
ref,
|
|
88
59
|
moveMouseOutside: closeOnMoveMouseOutside,
|
|
@@ -92,17 +63,16 @@ const Modal = ({ open, setOpen, children, position = 'left', topPosition = 'top'
|
|
|
92
63
|
setBounced(false);
|
|
93
64
|
}
|
|
94
65
|
});
|
|
95
|
-
|
|
66
|
+
useEffect(() => {
|
|
96
67
|
if (!bounced && open) {
|
|
97
68
|
setBounced(true);
|
|
98
69
|
}
|
|
99
70
|
}, [open, bounced]);
|
|
100
71
|
if (!open) {
|
|
101
|
-
return
|
|
72
|
+
return React.createElement(React.Fragment, null);
|
|
102
73
|
}
|
|
103
|
-
return (
|
|
104
|
-
|
|
105
|
-
showCloseButton && (
|
|
74
|
+
return (React.createElement(FixedBackground, null,
|
|
75
|
+
React.createElement(ModalBase, { "data-bounced": bounced, "data-position": position, "data-topposition": topPosition, ref: ref, className: className },
|
|
76
|
+
showCloseButton && (React.createElement(CloseStyled, { "data-type": "modal-close", onClick: () => setOpen(false) })),
|
|
106
77
|
children)));
|
|
107
78
|
};
|
|
108
|
-
exports.Modal = Modal;
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Dialog"), exports);
|
|
18
|
-
__exportStar(require("./Modal"), exports);
|
|
19
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
export * from './Dialog';
|
|
2
|
+
export * from './Modal';
|
|
3
|
+
export * from './types';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|