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,15 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Button = exports.ButtonBase = void 0;
|
|
7
1
|
/* eslint-disable react/destructuring-assignment */
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
import { css } from '@emotion/react';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { colours } from '../../styles/colours';
|
|
6
|
+
export const ButtonBase = css `
|
|
13
7
|
text-decoration: none;
|
|
14
8
|
display: flex;
|
|
15
9
|
justify-content: center;
|
|
@@ -35,36 +29,34 @@ exports.ButtonBase = (0, react_1.css) `
|
|
|
35
29
|
}
|
|
36
30
|
|
|
37
31
|
&[data-theme='green'] {
|
|
38
|
-
background-color: ${
|
|
32
|
+
background-color: ${colours.darkGreen};
|
|
39
33
|
&[data-invert='true'] {
|
|
40
|
-
color: ${
|
|
34
|
+
color: ${colours.darkGreen};
|
|
41
35
|
background-color: white;
|
|
42
|
-
border: solid 1px ${
|
|
36
|
+
border: solid 1px ${colours.darkGreen};
|
|
43
37
|
}
|
|
44
38
|
}
|
|
45
39
|
|
|
46
40
|
&[data-theme='red'] {
|
|
47
|
-
background-color: ${
|
|
41
|
+
background-color: ${colours.orangeRed};
|
|
48
42
|
&[data-invert='true'] {
|
|
49
|
-
color: ${
|
|
43
|
+
color: ${colours.orangeRed};
|
|
50
44
|
background-color: white;
|
|
51
|
-
border: solid 1px ${
|
|
45
|
+
border: solid 1px ${colours.orangeRed};
|
|
52
46
|
}
|
|
53
47
|
}
|
|
54
48
|
`;
|
|
55
|
-
const BaseButton =
|
|
56
|
-
${
|
|
49
|
+
const BaseButton = styled.button `
|
|
50
|
+
${ButtonBase}
|
|
57
51
|
`;
|
|
58
|
-
const BaseA =
|
|
59
|
-
${
|
|
52
|
+
const BaseA = styled.a `
|
|
53
|
+
${ButtonBase}
|
|
60
54
|
`;
|
|
61
|
-
const Button = (props) => {
|
|
62
|
-
var _a;
|
|
55
|
+
export const Button = (props) => {
|
|
63
56
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
57
|
const Component = props.href
|
|
65
58
|
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
66
59
|
BaseA
|
|
67
60
|
: BaseButton;
|
|
68
|
-
return (
|
|
61
|
+
return (React.createElement(Component, { className: props.className, "data-invert": props.invert, "data-disabled": props.disabled ?? false, role: "button", title: props.title || undefined, "data-theme": props.colourTheme || 'green', ...props }, props.children));
|
|
69
62
|
};
|
|
70
|
-
exports.Button = Button;
|
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
exports.Chevron = void 0;
|
|
7
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const ChevronRight_1 = require("../../icons/ChevronRight");
|
|
10
|
-
const Icon_1 = require("../Icon");
|
|
11
|
-
const Base = styled_1.default.span `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ChevronRight } from '../../icons/ChevronRight';
|
|
4
|
+
import { Icon } from '../Icon';
|
|
5
|
+
const Base = styled.span `
|
|
12
6
|
font-size: 2rem;
|
|
13
7
|
display: flex;
|
|
14
8
|
justify-content: center;
|
|
15
9
|
align-items: center;
|
|
16
10
|
`;
|
|
17
|
-
const IconStyled = (
|
|
11
|
+
const IconStyled = styled(Icon) `
|
|
18
12
|
cursor: pointer;
|
|
19
13
|
margin: 0;
|
|
20
14
|
padding: 0;
|
|
21
15
|
`;
|
|
22
|
-
const Chevron = ({ width = '1.2rem', className, colour = 'black', onToggle, point = 'right', }) => {
|
|
16
|
+
export const Chevron = ({ width = '1.2rem', className, colour = 'black', onToggle, point = 'right', }) => {
|
|
23
17
|
let rotate = 0;
|
|
24
18
|
switch (point) {
|
|
25
19
|
case 'down': {
|
|
@@ -38,7 +32,6 @@ const Chevron = ({ width = '1.2rem', className, colour = 'black', onToggle, poin
|
|
|
38
32
|
rotate = 0;
|
|
39
33
|
}
|
|
40
34
|
}
|
|
41
|
-
return (
|
|
42
|
-
|
|
35
|
+
return (React.createElement(Base, { className: className, onClick: () => onToggle?.(), onTouchStart: () => onToggle?.(), onKeyDown: (e) => e.key === 'Enter' && onToggle?.() },
|
|
36
|
+
React.createElement(IconStyled, { rotate: rotate, fill: colour, width: width, height: width }, ChevronRight)));
|
|
43
37
|
};
|
|
44
|
-
exports.Chevron = Chevron;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Close = void 0;
|
|
7
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const dom_1 = require("../../helpers/dom");
|
|
10
|
-
const Base = styled_1.default.div `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { filterDataProps } from '../../helpers/dom';
|
|
4
|
+
const Base = styled.div `
|
|
11
5
|
position: absolute;
|
|
12
6
|
z-index: 1;
|
|
13
7
|
width: 32px;
|
|
@@ -36,7 +30,6 @@ const Base = styled_1.default.div `
|
|
|
36
30
|
transform: rotate(-45deg);
|
|
37
31
|
}
|
|
38
32
|
`;
|
|
39
|
-
const Close = (p) => {
|
|
40
|
-
return (
|
|
33
|
+
export const Close = (p) => {
|
|
34
|
+
return (React.createElement(Base, { ...filterDataProps(p), className: p.className, onClick: (e) => p.onClick?.(e) }));
|
|
41
35
|
};
|
|
42
|
-
exports.Close = Close;
|
|
@@ -1,38 +1,23 @@
|
|
|
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.ConfirmDialog = void 0;
|
|
16
|
-
const react_1 = __importDefault(require("react"));
|
|
17
|
-
const client_1 = require("react-dom/client");
|
|
18
|
-
const log_1 = require("../../../common/helpers/log");
|
|
19
|
-
const Modal_1 = require("./Modal");
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import { error } from '../../../common/helpers/log';
|
|
4
|
+
import { ConfirmModal } from './Modal';
|
|
20
5
|
/**
|
|
21
6
|
* opens a dialog programatically
|
|
22
7
|
* @param param0
|
|
23
8
|
* @returns
|
|
24
9
|
*/
|
|
25
|
-
const ConfirmDialog = ({ bottomText, topText, }) =>
|
|
10
|
+
export const ConfirmDialog = async ({ bottomText, topText, }) => {
|
|
26
11
|
return new Promise((res) => {
|
|
27
12
|
const idName = 'ag-confirm-dialog';
|
|
28
13
|
if (document.body.querySelectorAll('#' + idName).length !== 0) {
|
|
29
|
-
|
|
14
|
+
error('confirmDialog already open');
|
|
30
15
|
res(false);
|
|
31
16
|
return;
|
|
32
17
|
}
|
|
33
18
|
const wrapper = document.body.appendChild(document.createElement('div'));
|
|
34
19
|
wrapper.id = idName;
|
|
35
|
-
const root =
|
|
20
|
+
const root = createRoot(wrapper);
|
|
36
21
|
const onSubmit = (v) => {
|
|
37
22
|
try {
|
|
38
23
|
res(v);
|
|
@@ -42,7 +27,6 @@ const ConfirmDialog = ({ bottomText, topText, }) => __awaiter(void 0, void 0, vo
|
|
|
42
27
|
wrapper.remove();
|
|
43
28
|
}
|
|
44
29
|
};
|
|
45
|
-
root.render(
|
|
30
|
+
root.render(React.createElement(ConfirmModal, { bottomText: bottomText, topText: topText, onSubmit: onSubmit }));
|
|
46
31
|
});
|
|
47
|
-
}
|
|
48
|
-
exports.ConfirmDialog = ConfirmDialog;
|
|
32
|
+
};
|
|
@@ -1,51 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const Button_1 = require("../Button");
|
|
10
|
-
const FlexColumn_1 = require("../FlexColumn");
|
|
11
|
-
const FlexRow_1 = require("../FlexRow");
|
|
12
|
-
const Modal_1 = require("../Modal/Modal");
|
|
13
|
-
const Base = styled_1.default.div `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Button } from '../Button';
|
|
4
|
+
import { FlexColumn } from '../FlexColumn';
|
|
5
|
+
import { FlexRow } from '../FlexRow';
|
|
6
|
+
import { Modal } from '../Modal/Modal';
|
|
7
|
+
const Base = styled.div `
|
|
14
8
|
width: 95vw;
|
|
15
9
|
max-width: 30rem;
|
|
16
10
|
height: 50vh;
|
|
17
11
|
max-height: 15rem;
|
|
18
12
|
padding: 1rem;
|
|
19
13
|
`;
|
|
20
|
-
const Content = (
|
|
14
|
+
const Content = styled(FlexColumn) `
|
|
21
15
|
height: 100%;
|
|
22
16
|
`;
|
|
23
|
-
const TopText =
|
|
17
|
+
const TopText = styled.div `
|
|
24
18
|
font-weight: bold;
|
|
25
19
|
border-bottom: solid 1px #ccc;
|
|
26
20
|
padding-bottom: 0.25rem;
|
|
27
21
|
font-size: 1.5rem;
|
|
28
22
|
margin-bottom: 1rem;
|
|
29
23
|
`;
|
|
30
|
-
const BottomText =
|
|
24
|
+
const BottomText = styled.div `
|
|
31
25
|
padding-bottom: 0.25rem;
|
|
32
26
|
font-size: 1.1rem;
|
|
33
27
|
`;
|
|
34
|
-
const Bottom = (
|
|
28
|
+
const Bottom = styled(FlexRow) `
|
|
35
29
|
margin-top: auto;
|
|
36
30
|
justify-content: flex-end;
|
|
37
31
|
> button:first-of-type {
|
|
38
32
|
margin-right: 1rem;
|
|
39
33
|
}
|
|
40
34
|
`;
|
|
41
|
-
const ConfirmModal = ({ onSubmit, bottomText, topText, okText = 'OK', cancelText = 'Cancel', }) => {
|
|
42
|
-
return (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
topText &&
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
export const ConfirmModal = ({ onSubmit, bottomText, topText, okText = 'OK', cancelText = 'Cancel', }) => {
|
|
36
|
+
return (React.createElement(Modal, { position: "center", topPosition: "center", open: true, setOpen: () => onSubmit(false), showCloseButton: false, closeOnClickOutside: false },
|
|
37
|
+
React.createElement(Base, null,
|
|
38
|
+
React.createElement(Content, null,
|
|
39
|
+
topText && React.createElement(TopText, null, topText),
|
|
40
|
+
React.createElement(BottomText, null, bottomText),
|
|
41
|
+
React.createElement(Bottom, { noGrow: true },
|
|
42
|
+
React.createElement(Button, { onClick: () => onSubmit(true) }, okText),
|
|
43
|
+
React.createElement(Button, { invert: true, onClick: () => onSubmit(false) }, cancelText))))));
|
|
50
44
|
};
|
|
51
|
-
exports.ConfirmModal = ConfirmModal;
|
|
@@ -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 {};
|
|
@@ -1,40 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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.DropdownList = void 0;
|
|
30
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
31
|
-
const react_1 = __importStar(require("react"));
|
|
32
|
-
const dom_1 = require("../../helpers/dom");
|
|
33
|
-
const useOnClickOutside_1 = require("../../helpers/useOnClickOutside");
|
|
34
|
-
const colours_1 = require("../../styles/colours");
|
|
35
|
-
const common_1 = require("../../styles/common");
|
|
36
|
-
const KebabDots_1 = require("../KebabDots");
|
|
37
|
-
const Base = styled_1.default.div `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { convertRemToPixels } from '../../helpers/dom';
|
|
4
|
+
import { useOnClickOutside } from '../../helpers/useOnClickOutside';
|
|
5
|
+
import { colours } from '../../styles/colours';
|
|
6
|
+
import { bounce } from '../../styles/common';
|
|
7
|
+
import { KebabDots } from '../KebabDots';
|
|
8
|
+
const Base = styled.div `
|
|
38
9
|
display: flex;
|
|
39
10
|
flex-flow: row;
|
|
40
11
|
position: relative;
|
|
@@ -43,7 +14,7 @@ const Base = styled_1.default.div `
|
|
|
43
14
|
cursor: pointer;
|
|
44
15
|
flex-grow: 0;
|
|
45
16
|
`;
|
|
46
|
-
const DropItems =
|
|
17
|
+
const DropItems = styled.div `
|
|
47
18
|
flex-flow: column;
|
|
48
19
|
z-index: 5;
|
|
49
20
|
display: none;
|
|
@@ -56,9 +27,9 @@ const DropItems = styled_1.default.div `
|
|
|
56
27
|
&[data-open='true'] {
|
|
57
28
|
display: flex;
|
|
58
29
|
}
|
|
59
|
-
${
|
|
30
|
+
${bounce('data-bounced')}
|
|
60
31
|
`;
|
|
61
|
-
const ListItemStyle =
|
|
32
|
+
const ListItemStyle = styled.div `
|
|
62
33
|
z-index: 1;
|
|
63
34
|
font-weight: 500;
|
|
64
35
|
padding-left: 0.5rem;
|
|
@@ -72,12 +43,12 @@ const ListItemStyle = styled_1.default.div `
|
|
|
72
43
|
&[data-default='false'] {
|
|
73
44
|
&[data-selected='true'] {
|
|
74
45
|
opacity: 1 !important;
|
|
75
|
-
background-color: ${
|
|
46
|
+
background-color: ${colours.orangeRed} !important;
|
|
76
47
|
}
|
|
77
48
|
&[data-selected='false'] {
|
|
78
49
|
&:hover {
|
|
79
50
|
opacity: 0.9 !important;
|
|
80
|
-
background-color: ${
|
|
51
|
+
background-color: ${colours.orange} !important;
|
|
81
52
|
}
|
|
82
53
|
}
|
|
83
54
|
}
|
|
@@ -89,45 +60,44 @@ const ListItemStyle = styled_1.default.div `
|
|
|
89
60
|
background-color: rgba(0, 0, 0, 0.2);
|
|
90
61
|
}
|
|
91
62
|
`;
|
|
92
|
-
const ListItem = ({ render, onChange, selected, defaultV = false, }) => (
|
|
63
|
+
const ListItem = ({ render, onChange, selected, defaultV = false, }) => (React.createElement(ListItemStyle, { "data-selected": selected, "data-default": defaultV, onClick: (e) => {
|
|
93
64
|
if (!selected) {
|
|
94
|
-
onChange
|
|
65
|
+
onChange?.();
|
|
95
66
|
}
|
|
96
67
|
e.preventDefault();
|
|
97
68
|
} }, render));
|
|
98
|
-
function DropdownList(p) {
|
|
69
|
+
export function DropdownList(p) {
|
|
99
70
|
const { options, value, placeholder, className, renderF, shadow = '#555', maxHeight = '50vh', } = p;
|
|
100
|
-
const ref =
|
|
101
|
-
const [state, setState] =
|
|
102
|
-
const [open, setOpen] =
|
|
103
|
-
const [bounced, setBounced] =
|
|
104
|
-
|
|
71
|
+
const ref = useRef(null);
|
|
72
|
+
const [state, setState] = useState(value);
|
|
73
|
+
const [open, setOpen] = useState(p.open);
|
|
74
|
+
const [bounced, setBounced] = useState(false);
|
|
75
|
+
useOnClickOutside({ disabled: !open, ref, moveMouseOutside: false }, () => {
|
|
105
76
|
setOpen(false);
|
|
106
77
|
setBounced(false);
|
|
107
78
|
p.onChange(undefined, 0);
|
|
108
79
|
});
|
|
109
|
-
|
|
80
|
+
useEffect(() => {
|
|
110
81
|
const newv = value;
|
|
111
82
|
if (JSON.stringify(newv) !== JSON.stringify(value)) {
|
|
112
83
|
setState(newv);
|
|
113
84
|
}
|
|
114
85
|
}, [options, value]);
|
|
115
|
-
const [style, setStyle] =
|
|
116
|
-
|
|
117
|
-
var _a, _b, _c, _d;
|
|
86
|
+
const [style, setStyle] = useState({});
|
|
87
|
+
useEffect(() => {
|
|
118
88
|
const maxLen = 20;
|
|
119
89
|
const newStyle = {
|
|
120
90
|
minWidth: `calc(${maxLen}ch + 2rem)`,
|
|
121
91
|
};
|
|
122
|
-
const minPx =
|
|
123
|
-
const offsetLeft =
|
|
92
|
+
const minPx = convertRemToPixels(2 + maxLen / 2);
|
|
93
|
+
const offsetLeft = ref?.current?.offsetLeft ?? 0;
|
|
124
94
|
if (offsetLeft < minPx) {
|
|
125
95
|
newStyle.left = '0';
|
|
126
96
|
}
|
|
127
97
|
else {
|
|
128
98
|
newStyle.right = '0';
|
|
129
99
|
}
|
|
130
|
-
const b =
|
|
100
|
+
const b = ref?.current?.getBoundingClientRect() ?? { bottom: 0 };
|
|
131
101
|
const ih = typeof window !== 'undefined' ? window.innerHeight : 0;
|
|
132
102
|
//below screen
|
|
133
103
|
if (b.bottom + 50 > ih) {
|
|
@@ -142,20 +112,19 @@ function DropdownList(p) {
|
|
|
142
112
|
setStyle(newStyle);
|
|
143
113
|
}
|
|
144
114
|
}, [maxHeight, open, options, renderF, shadow, style]);
|
|
145
|
-
const defaultRender = !p.value ?
|
|
146
|
-
const openDisplay = p.children || (
|
|
147
|
-
|
|
115
|
+
const defaultRender = !p.value ? React.createElement(KebabDots, null) : React.createElement(React.Fragment, null, p.renderF(p.value));
|
|
116
|
+
const openDisplay = p.children || (React.createElement(ListItem, { selected: true, render: defaultRender, key: defaultRender.key, defaultV: !p.value }));
|
|
117
|
+
useEffect(() => {
|
|
148
118
|
if (!bounced && open) {
|
|
149
119
|
setBounced(true);
|
|
150
120
|
}
|
|
151
121
|
}, [bounced, open]);
|
|
152
|
-
return (
|
|
122
|
+
return (React.createElement(Base, { className: className, ref: ref, title: placeholder, onClick: (e) => {
|
|
153
123
|
e.stopPropagation();
|
|
154
124
|
e.preventDefault();
|
|
155
125
|
setOpen(!open);
|
|
156
126
|
} },
|
|
157
|
-
|
|
158
|
-
options.map((s, i) => (
|
|
127
|
+
React.createElement(DropItems, { "data-open": open, style: style, "data-bounced": bounced }, open &&
|
|
128
|
+
options.map((s, i) => (React.createElement(ListItem, { key: p.renderF(s).key, render: p.renderF(s), onChange: () => p.onChange(s, i), selected: s === state })))),
|
|
159
129
|
openDisplay));
|
|
160
130
|
}
|
|
161
|
-
exports.DropdownList = DropdownList;
|
|
@@ -1,22 +1,7 @@
|
|
|
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.DropdownListDialog = void 0;
|
|
16
|
-
const react_1 = __importDefault(require("react"));
|
|
17
|
-
const client_1 = require("react-dom/client");
|
|
18
|
-
const index_1 = require("./index");
|
|
19
|
-
const DropdownListDialog = (p) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import { DropdownList } from './index';
|
|
4
|
+
export const DropdownListDialog = async (p) => {
|
|
20
5
|
return new Promise((res) => {
|
|
21
6
|
const id = 'ag-common-ddld';
|
|
22
7
|
if (document.querySelectorAll('#' + id).length) {
|
|
@@ -28,12 +13,11 @@ const DropdownListDialog = (p) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
28
13
|
wrapper.style.position = 'absolute';
|
|
29
14
|
wrapper.style.top = `${p.position.y}px`;
|
|
30
15
|
wrapper.style.left = `${p.position.x}px`;
|
|
31
|
-
const root =
|
|
32
|
-
root.render(
|
|
16
|
+
const root = createRoot(wrapper);
|
|
17
|
+
root.render(React.createElement(DropdownList, { ...p, open: true, onChange: (v, i) => {
|
|
33
18
|
root.unmount();
|
|
34
19
|
wrapper.remove();
|
|
35
20
|
res(!v ? undefined : [v, i]);
|
|
36
|
-
} }
|
|
21
|
+
} }, "\u00A0"));
|
|
37
22
|
});
|
|
38
|
-
}
|
|
39
|
-
exports.DropdownListDialog = DropdownListDialog;
|
|
23
|
+
};
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
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("./Base"), exports);
|
|
18
|
-
__exportStar(require("./Dialog"), exports);
|
|
1
|
+
export * from './Base';
|
|
2
|
+
export * from './Dialog';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FlexColumn = void 0;
|
|
7
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const Base = styled_1.default.div `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
const Base = styled.div `
|
|
10
4
|
position: relative;
|
|
11
5
|
display: flex;
|
|
12
6
|
flex-flow: column;
|
|
@@ -24,8 +18,4 @@ const Base = styled_1.default.div `
|
|
|
24
18
|
max-width: 100%;
|
|
25
19
|
}
|
|
26
20
|
`;
|
|
27
|
-
const FlexColumn = (props) => {
|
|
28
|
-
var _a, _b, _c;
|
|
29
|
-
return (react_1.default.createElement(Base, Object.assign({ title: props.title, "data-nogrow": (_a = props.noGrow) !== null && _a !== void 0 ? _a : false, "data-center": (_b = props.center) !== null && _b !== void 0 ? _b : false, "data-enableoverflow": (_c = props.enableOverflow) !== null && _c !== void 0 ? _c : false }, props), props.children));
|
|
30
|
-
};
|
|
31
|
-
exports.FlexColumn = FlexColumn;
|
|
21
|
+
export const FlexColumn = (props) => (React.createElement(Base, { title: props.title, "data-nogrow": props.noGrow ?? false, "data-center": props.center ?? false, "data-enableoverflow": props.enableOverflow ?? false, ...props }, props.children));
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FlexRow = void 0;
|
|
7
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const Base = styled_1.default.div `
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
const Base = styled.div `
|
|
10
4
|
position: relative;
|
|
11
5
|
overflow: hidden;
|
|
12
6
|
display: flex;
|
|
@@ -34,8 +28,4 @@ const Base = styled_1.default.div `
|
|
|
34
28
|
overflow: visible;
|
|
35
29
|
}
|
|
36
30
|
`;
|
|
37
|
-
const FlexRow = (props) => {
|
|
38
|
-
var _a, _b, _c, _d;
|
|
39
|
-
return (react_1.default.createElement(Base, Object.assign({ title: props.title, "data-nowrap": (_a = props.noWrap) !== null && _a !== void 0 ? _a : false, "data-nogrow": (_b = props.noGrow) !== null && _b !== void 0 ? _b : false, "data-center": (_c = props.center) !== null && _c !== void 0 ? _c : false, "data-enableoverflow": (_d = props.enableOverflow) !== null && _d !== void 0 ? _d : false }, props), props.children));
|
|
40
|
-
};
|
|
41
|
-
exports.FlexRow = FlexRow;
|
|
31
|
+
export const FlexRow = (props) => (React.createElement(Base, { title: props.title, "data-nowrap": props.noWrap ?? false, "data-nogrow": props.noGrow ?? false, "data-center": props.center ?? false, "data-enableoverflow": props.enableOverflow ?? false, ...props }, props.children));
|