ag-common 0.0.69 → 0.0.73
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/openApiHelpers.d.ts +9 -0
- package/dist/api/helpers/openApiHelpers.js +22 -23
- package/dist/api/types/index.d.ts +3 -1
- package/dist/ui/components/Button/index.d.ts +1 -3
- package/dist/ui/components/Button/index.js +1 -2
- package/dist/ui/components/Confirm/index.d.ts +4 -0
- package/dist/ui/components/Confirm/index.js +77 -0
- package/dist/ui/components/HeadersRaw/index.d.ts +3 -5
- package/dist/ui/components/HeadersRaw/index.js +5 -8
- package/dist/ui/components/LoginButton/index.d.ts +2 -5
- package/dist/ui/components/LoginButton/index.js +2 -4
- package/dist/ui/components/LogoutButton/index.d.ts +1 -3
- package/dist/ui/components/LogoutButton/index.js +2 -4
- package/dist/ui/components/Modal/index.d.ts +2 -1
- package/dist/ui/components/Modal/index.js +2 -2
- package/dist/ui/components/index.d.ts +1 -0
- package/dist/ui/components/index.js +1 -0
- package/dist/ui/helpers/useQueryString.d.ts +4 -4
- package/package.json +3 -3
- package/dist/ui/components/LoginButton/text.d.ts +0 -3
- package/dist/ui/components/LoginButton/text.js +0 -9
|
@@ -11,4 +11,13 @@ export declare const openApiImpl: (p: {
|
|
|
11
11
|
certificate: certmgr.ICertificate;
|
|
12
12
|
hostedZone: route53.IHostedZone;
|
|
13
13
|
shortStackName: string;
|
|
14
|
+
/**
|
|
15
|
+
* defaults:
|
|
16
|
+
* allowOrigins: apigw.Cors.ALL_ORIGINS,
|
|
17
|
+
allowHeaders: apigw.Cors.DEFAULT_HEADERS,
|
|
18
|
+
*/
|
|
19
|
+
cors?: {
|
|
20
|
+
allowOrigins: string[];
|
|
21
|
+
allowHeaders: string[];
|
|
22
|
+
};
|
|
14
23
|
}) => void;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.openApiImpl = void 0;
|
|
4
4
|
/* eslint-disable no-new */
|
|
5
5
|
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
6
|
+
const __1 = require("../..");
|
|
6
7
|
const distinctBy_1 = require("../../common/helpers/distinctBy");
|
|
7
8
|
const log_1 = require("../../common/helpers/log");
|
|
8
9
|
// eslint-disable-next-line
|
|
@@ -11,11 +12,12 @@ const getPaths = (schema) => Object.entries(schema.paths).map(([fullPath, verbs]
|
|
|
11
12
|
pathList: fullPath.split('/').filter((s) => s),
|
|
12
13
|
verbs: Object.keys(verbs),
|
|
13
14
|
}));
|
|
14
|
-
const setUpApiGw = ({ stack, NODE_ENV, baseUrl, certificate, hostedZone, shortStackName,
|
|
15
|
+
const setUpApiGw = ({ stack, NODE_ENV, baseUrl, certificate, hostedZone, shortStackName, cors = {
|
|
16
|
+
allowOrigins: aws_cdk_lib_1.aws_apigateway.Cors.ALL_ORIGINS,
|
|
17
|
+
allowHeaders: aws_cdk_lib_1.aws_apigateway.Cors.DEFAULT_HEADERS,
|
|
18
|
+
}, }) => {
|
|
15
19
|
const api = new aws_cdk_lib_1.aws_apigateway.RestApi(stack, `${shortStackName}-api-${NODE_ENV}`, {
|
|
16
|
-
defaultCorsPreflightOptions: {
|
|
17
|
-
allowOrigins: aws_cdk_lib_1.aws_apigateway.Cors.ALL_ORIGINS,
|
|
18
|
-
},
|
|
20
|
+
defaultCorsPreflightOptions: Object.assign({}, (cors || {})),
|
|
19
21
|
});
|
|
20
22
|
const dn = new aws_cdk_lib_1.aws_apigateway.DomainName(stack, 'domain', {
|
|
21
23
|
domainName: `api.${baseUrl}`,
|
|
@@ -33,7 +35,7 @@ const setUpApiGw = ({ stack, NODE_ENV, baseUrl, certificate, hostedZone, shortSt
|
|
|
33
35
|
return api;
|
|
34
36
|
};
|
|
35
37
|
const getDynamoPermissions = ({ lambdaPermissions, pathV, verb, seenPermissions, }) => {
|
|
36
|
-
const pathCompute = pathV + '
|
|
38
|
+
const pathCompute = pathV + '/' + verb;
|
|
37
39
|
const lp = lambdaPermissions === null || lambdaPermissions === void 0 ? void 0 : lambdaPermissions[pathCompute];
|
|
38
40
|
if (lp) {
|
|
39
41
|
seenPermissions[pathCompute] = true;
|
|
@@ -48,30 +50,25 @@ const getDynamoPermissions = ({ lambdaPermissions, pathV, verb, seenPermissions,
|
|
|
48
50
|
//
|
|
49
51
|
const readTables = (0, distinctBy_1.distinctBy)([...((def === null || def === void 0 ? void 0 : def.reads) || []), ...((lp === null || lp === void 0 ? void 0 : lp.reads) || [])], (s) => s.shortName);
|
|
50
52
|
const writeTables = (0, distinctBy_1.distinctBy)([...((def === null || def === void 0 ? void 0 : def.writes) || []), ...((lp === null || lp === void 0 ? void 0 : lp.writes) || [])], (s) => s.shortName);
|
|
53
|
+
const policies = [...(def.policies || []), ...((lp === null || lp === void 0 ? void 0 : lp.policies) || [])].filter(__1.notEmpty);
|
|
51
54
|
const tables = [...readTables, ...writeTables];
|
|
52
55
|
const environment = {};
|
|
53
56
|
Object.values(tables).forEach((v) => {
|
|
54
57
|
environment[v.shortName] = v.table.tableName;
|
|
55
58
|
});
|
|
56
|
-
return { environment, readTables, writeTables };
|
|
59
|
+
return { environment, readTables, writeTables, policies };
|
|
57
60
|
};
|
|
58
|
-
const addApiPaths = (api,
|
|
59
|
-
let
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
else {
|
|
66
|
-
apiPath = api.root.addResource(s);
|
|
67
|
-
apiRoots[s] = apiPath;
|
|
68
|
-
}
|
|
61
|
+
const addApiPaths = (api, pathList, apiRoots) => {
|
|
62
|
+
let pathBuild = '';
|
|
63
|
+
let apiPath = api.root;
|
|
64
|
+
pathList.forEach((path) => {
|
|
65
|
+
pathBuild += '/' + path;
|
|
66
|
+
if (apiRoots[pathBuild]) {
|
|
67
|
+
apiPath = apiRoots[pathBuild];
|
|
69
68
|
}
|
|
70
69
|
else {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
apiPath = apiPath.addResource(s);
|
|
70
|
+
apiRoots[pathBuild] = apiPath.addResource(path);
|
|
71
|
+
apiPath = apiRoots[pathBuild];
|
|
75
72
|
}
|
|
76
73
|
});
|
|
77
74
|
if (!apiPath) {
|
|
@@ -92,13 +89,14 @@ const openApiImpl = (p) => {
|
|
|
92
89
|
paths.forEach(({ fullPath, verbs, pathList }) => {
|
|
93
90
|
const apiPath = addApiPaths(api, pathList, apiRoots);
|
|
94
91
|
verbs.forEach((verb) => {
|
|
95
|
-
const { environment, readTables, writeTables } = getDynamoPermissions({
|
|
92
|
+
const { environment, readTables, writeTables, policies } = getDynamoPermissions({
|
|
96
93
|
lambdaPermissions,
|
|
97
94
|
pathV: fullPath,
|
|
98
95
|
verb,
|
|
99
96
|
seenPermissions,
|
|
100
97
|
});
|
|
101
98
|
const lambdaName = lambdaNameSafe(`${p.shortStackName}-${fullPath}-${verb}-${NODE_ENV}`);
|
|
99
|
+
const entry = `${endpointsBase}${fullPath}/${verb.toUpperCase()}.ts`;
|
|
102
100
|
const lambdaV = new aws_cdk_lib_1.aws_lambda_nodejs.NodejsFunction(stack, lambdaName, {
|
|
103
101
|
functionName: lambdaName,
|
|
104
102
|
runtime: aws_cdk_lib_1.aws_lambda.Runtime.NODEJS_14_X,
|
|
@@ -107,7 +105,7 @@ const openApiImpl = (p) => {
|
|
|
107
105
|
memorySize: 128,
|
|
108
106
|
timeout: aws_cdk_lib_1.Duration.seconds(30),
|
|
109
107
|
description: '(cdk)',
|
|
110
|
-
entry:
|
|
108
|
+
entry: entry,
|
|
111
109
|
bundling: {
|
|
112
110
|
externalModules: ['aws-sdk', 'aws-lambda'],
|
|
113
111
|
},
|
|
@@ -116,6 +114,7 @@ const openApiImpl = (p) => {
|
|
|
116
114
|
});
|
|
117
115
|
readTables.forEach((t) => t.table.grantReadData(lambdaV));
|
|
118
116
|
writeTables.forEach((t) => t.table.grantReadWriteData(lambdaV));
|
|
117
|
+
policies.forEach((p1) => lambdaV.addToRolePolicy(p1));
|
|
119
118
|
//
|
|
120
119
|
apiPath.addMethod(verb.toUpperCase(), new aws_cdk_lib_1.aws_apigateway.LambdaIntegration(lambdaV, {}));
|
|
121
120
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aws_dynamodb as dynamodb } from 'aws-cdk-lib';
|
|
1
|
+
import { aws_dynamodb as dynamodb, aws_iam as iam } from 'aws-cdk-lib';
|
|
2
2
|
import { Key } from './aws';
|
|
3
3
|
export interface DYNAMOKEYS {
|
|
4
4
|
type: string;
|
|
@@ -21,10 +21,12 @@ export interface ILambdaPermissions {
|
|
|
21
21
|
[pathHyphenVerb: string]: {
|
|
22
22
|
reads?: IGeneratedDynamoData[];
|
|
23
23
|
writes?: IGeneratedDynamoData[];
|
|
24
|
+
policies?: iam.PolicyStatement[];
|
|
24
25
|
} & {
|
|
25
26
|
default?: {
|
|
26
27
|
reads?: IGeneratedDynamoData[];
|
|
27
28
|
writes?: IGeneratedDynamoData[];
|
|
29
|
+
policies?: iam.PolicyStatement[];
|
|
28
30
|
};
|
|
29
31
|
};
|
|
30
32
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React, { KeyboardEventHandler, MouseEventHandler } from 'react';
|
|
2
|
-
import { TLang, TResource } from '../../../common/helpers/i18n';
|
|
3
2
|
export declare const ButtonBase: import("styled-components").FlattenSimpleInterpolation;
|
|
4
3
|
export declare const Button: React.FC<{
|
|
5
|
-
title?:
|
|
4
|
+
title?: string;
|
|
6
5
|
invert?: boolean;
|
|
7
6
|
disabled?: boolean;
|
|
8
|
-
lang: TLang;
|
|
9
7
|
className?: string;
|
|
10
8
|
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
11
9
|
onKeyPress?: KeyboardEventHandler<HTMLButtonElement>;
|
|
@@ -26,7 +26,6 @@ exports.Button = exports.ButtonBase = void 0;
|
|
|
26
26
|
/* eslint-disable react/destructuring-assignment */
|
|
27
27
|
const react_1 = __importDefault(require("react"));
|
|
28
28
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
29
|
-
const i18n_1 = require("../../../common/helpers/i18n");
|
|
30
29
|
const colours_1 = require("../../styles/colours");
|
|
31
30
|
exports.ButtonBase = (0, styled_components_1.css) `
|
|
32
31
|
text-decoration: none;
|
|
@@ -67,6 +66,6 @@ const Base = styled_components_1.default.button `
|
|
|
67
66
|
`;
|
|
68
67
|
const Button = (props) => {
|
|
69
68
|
var _a;
|
|
70
|
-
return (react_1.default.createElement(Base, Object.assign({ className: props.className, "data-invert": props.invert, "data-disabled": (_a = props.disabled) !== null && _a !== void 0 ? _a : false }, props, { role: "button", title:
|
|
69
|
+
return (react_1.default.createElement(Base, Object.assign({ className: props.className, "data-invert": props.invert, "data-disabled": (_a = props.disabled) !== null && _a !== void 0 ? _a : false }, props, { role: "button", title: props.title || undefined }), props.children));
|
|
71
70
|
};
|
|
72
71
|
exports.Button = Button;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
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.confirm = void 0;
|
|
16
|
+
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
17
|
+
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
18
|
+
const react_1 = __importDefault(require("react"));
|
|
19
|
+
const react_dom_1 = __importDefault(require("react-dom"));
|
|
20
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
21
|
+
const Button_1 = require("../Button");
|
|
22
|
+
const FlexColumn_1 = require("../FlexColumn");
|
|
23
|
+
const FlexRow_1 = require("../FlexRow");
|
|
24
|
+
const Modal_1 = require("../Modal");
|
|
25
|
+
const Base = styled_components_1.default.div `
|
|
26
|
+
width: 95vw;
|
|
27
|
+
max-width: 30rem;
|
|
28
|
+
height: 50vh;
|
|
29
|
+
max-height: 15rem;
|
|
30
|
+
padding: 1rem;
|
|
31
|
+
`;
|
|
32
|
+
const Content = (0, styled_components_1.default)(FlexColumn_1.FlexColumn) `
|
|
33
|
+
height: 100%;
|
|
34
|
+
`;
|
|
35
|
+
const TopText = styled_components_1.default.div `
|
|
36
|
+
font-weight: bold;
|
|
37
|
+
border-bottom: solid 1px #ccc;
|
|
38
|
+
padding-bottom: 0.25rem;
|
|
39
|
+
font-size: 1.5rem;
|
|
40
|
+
margin-bottom: 1rem;
|
|
41
|
+
`;
|
|
42
|
+
const BottomText = styled_components_1.default.div `
|
|
43
|
+
padding-bottom: 0.25rem;
|
|
44
|
+
font-size: 1.1rem;
|
|
45
|
+
`;
|
|
46
|
+
const Bottom = (0, styled_components_1.default)(FlexRow_1.FlexRow) `
|
|
47
|
+
margin-top: auto;
|
|
48
|
+
justify-content: flex-end;
|
|
49
|
+
> button:first-child {
|
|
50
|
+
margin-right: 1rem;
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
const ConfirmModal = ({ wrapper, res, bottomText, topText, okText = 'OK', cancelText = 'Cancel', }) => {
|
|
54
|
+
const ret = (v) => {
|
|
55
|
+
try {
|
|
56
|
+
res(v);
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
wrapper.remove();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return (react_1.default.createElement(Modal_1.Modal, { position: "center", topPosition: "center", open: true, setOpen: () => ret(false), showCloseButton: false, closeOnClickOutside: false },
|
|
63
|
+
react_1.default.createElement(Base, null,
|
|
64
|
+
react_1.default.createElement(Content, null,
|
|
65
|
+
topText && react_1.default.createElement(TopText, null, topText),
|
|
66
|
+
react_1.default.createElement(BottomText, null, bottomText),
|
|
67
|
+
react_1.default.createElement(Bottom, { noGrow: true },
|
|
68
|
+
react_1.default.createElement(Button_1.Button, { onClick: () => ret(true) }, okText),
|
|
69
|
+
react_1.default.createElement(Button_1.Button, { invert: true, onClick: () => ret(false) }, cancelText))))));
|
|
70
|
+
};
|
|
71
|
+
const confirm = ({ bottomText, topText, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
72
|
+
return new Promise((res) => {
|
|
73
|
+
const wrapper = document.body.appendChild(document.createElement('div'));
|
|
74
|
+
react_dom_1.default.render(react_1.default.createElement(ConfirmModal, { bottomText: bottomText, topText: topText, res: res, wrapper: wrapper }), wrapper);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
exports.confirm = confirm;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
title?: TResource | null | undefined;
|
|
2
|
+
export declare const HeadersRaw: ({ title, image, SiteShort, FullSiteUrl, siteDesc, }: {
|
|
3
|
+
title?: string | undefined;
|
|
5
4
|
image?: string | undefined;
|
|
6
|
-
lang: TLang;
|
|
7
5
|
SiteShort: string;
|
|
8
6
|
FullSiteUrl: string;
|
|
9
|
-
siteDesc:
|
|
7
|
+
siteDesc: string;
|
|
10
8
|
}) => JSX.Element[];
|
|
@@ -5,18 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.HeadersRaw = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const dt = (0, i18n_1.t)(siteDesc, lang);
|
|
11
|
-
const titleText = !title ? undefined : (0, i18n_1.t)(title, lang);
|
|
12
|
-
const fullTitle = `${title ? `${titleText} | ` : ''}${SiteShort} | ${dt}`;
|
|
8
|
+
const HeadersRaw = ({ title, image, SiteShort, FullSiteUrl, siteDesc, }) => {
|
|
9
|
+
const fullTitle = `${title ? `${title} | ` : ''}${SiteShort} | ${siteDesc}`;
|
|
13
10
|
const titleBlock = title === undefined
|
|
14
11
|
? []
|
|
15
12
|
: [
|
|
16
13
|
react_1.default.createElement("title", { key: "1" }, fullTitle),
|
|
17
|
-
react_1.default.createElement("meta", { key: "2", property: "og:title", content:
|
|
18
|
-
react_1.default.createElement("meta", { key: "3", name: "twitter:title", content:
|
|
19
|
-
react_1.default.createElement("meta", { key: "4", itemProp: "name", content:
|
|
14
|
+
react_1.default.createElement("meta", { key: "2", property: "og:title", content: title }),
|
|
15
|
+
react_1.default.createElement("meta", { key: "3", name: "twitter:title", content: title }),
|
|
16
|
+
react_1.default.createElement("meta", { key: "4", itemProp: "name", content: title }),
|
|
20
17
|
react_1.default.createElement("meta", { key: "5", name: "description", content: fullTitle }),
|
|
21
18
|
react_1.default.createElement("meta", { key: "6", itemProp: "description", content: fullTitle }),
|
|
22
19
|
react_1.default.createElement("meta", { key: "7", property: "og:description", content: fullTitle }),
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
export declare const LoginButton: ({ className, text, invert, title, savePath, lang, loginPath, }: {
|
|
4
|
-
title?: TResource | undefined;
|
|
2
|
+
export declare const LoginButton: ({ className, text, invert, savePath, loginPath, }: {
|
|
5
3
|
invert?: boolean | undefined;
|
|
6
|
-
text
|
|
4
|
+
text: string;
|
|
7
5
|
className?: string | undefined;
|
|
8
6
|
savePath?: boolean | undefined;
|
|
9
|
-
lang: TLang;
|
|
10
7
|
loginPath: (state?: Record<string, unknown> | undefined) => string;
|
|
11
8
|
}) => JSX.Element;
|
|
@@ -6,18 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.LoginButton = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
-
const i18n_1 = require("../../../common/helpers/i18n");
|
|
10
9
|
const Button_1 = require("../Button");
|
|
11
|
-
const text_1 = require("./text");
|
|
12
10
|
const Base = styled_components_1.default.a `
|
|
13
11
|
${Button_1.ButtonBase}
|
|
14
12
|
`;
|
|
15
|
-
const LoginButton = ({ className, text
|
|
13
|
+
const LoginButton = ({ className, text, invert, savePath = true, loginPath, }) => {
|
|
16
14
|
const lp = loginPath(!savePath || typeof window === 'undefined'
|
|
17
15
|
? undefined
|
|
18
16
|
: {
|
|
19
17
|
redirect: window.location.href.substring(window.location.origin.length),
|
|
20
18
|
});
|
|
21
|
-
return (react_1.default.createElement(Base, { href: lp,
|
|
19
|
+
return (react_1.default.createElement(Base, { href: lp, title: text, "data-invert": invert, "data-disabled": false, className: className }, text));
|
|
22
20
|
};
|
|
23
21
|
exports.LoginButton = LoginButton;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
export declare const LogoutButton: ({ className, invert, lang, logout, }: {
|
|
4
|
-
lang: TLang;
|
|
2
|
+
export declare const LogoutButton: ({ className, invert, logout, }: {
|
|
5
3
|
invert?: boolean | undefined;
|
|
6
4
|
className?: string | undefined;
|
|
7
5
|
logout: () => void;
|
|
@@ -24,8 +24,6 @@ const ButtonStyled = (0, styled_components_1.default)(Button_1.Button) `
|
|
|
24
24
|
fill: ${colours_1.colours.notificationBlue};
|
|
25
25
|
}
|
|
26
26
|
`;
|
|
27
|
-
const LogoutButton = ({ className, invert,
|
|
28
|
-
|
|
29
|
-
react_1.default.createElement(Icon, null, Door)));
|
|
30
|
-
};
|
|
27
|
+
const LogoutButton = ({ className, invert, logout, }) => (react_1.default.createElement(ButtonStyled, { invert: invert, className: className, onKeyPress: () => logout(), onClick: () => logout() },
|
|
28
|
+
react_1.default.createElement(Icon, null, Door)));
|
|
31
29
|
exports.LogoutButton = LogoutButton;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const ModalItem: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export declare const Modal: ({ open, setOpen, children, position, topPosition, showCloseButton, closeOnMoveMouseOutside, className, }: {
|
|
3
|
+
export declare const Modal: ({ open, setOpen, children, position, topPosition, showCloseButton, closeOnMoveMouseOutside, className, closeOnClickOutside, }: {
|
|
4
4
|
open: boolean;
|
|
5
5
|
setOpen: (b: boolean) => void;
|
|
6
6
|
children: JSX.Element | JSX.Element[];
|
|
@@ -9,6 +9,7 @@ export declare const Modal: ({ open, setOpen, children, position, topPosition, s
|
|
|
9
9
|
showCloseButton?: boolean | undefined;
|
|
10
10
|
closeOnMoveMouseOutside?: boolean | undefined;
|
|
11
11
|
className?: string | undefined;
|
|
12
|
+
closeOnClickOutside?: boolean | undefined;
|
|
12
13
|
}) => JSX.Element;
|
|
13
14
|
export declare const ModalDropList: (p: {
|
|
14
15
|
options: (string | JSX.Element)[];
|
|
@@ -67,10 +67,10 @@ exports.ModalItem = styled_components_1.default.div `
|
|
|
67
67
|
background-color: #eee;
|
|
68
68
|
}
|
|
69
69
|
`;
|
|
70
|
-
const Modal = ({ open, setOpen, children, position = 'left', topPosition = 'bottom', showCloseButton = true, closeOnMoveMouseOutside = false, className, }) => {
|
|
70
|
+
const Modal = ({ open, setOpen, children, position = 'left', topPosition = 'bottom', showCloseButton = true, closeOnMoveMouseOutside = false, className, closeOnClickOutside = true, }) => {
|
|
71
71
|
const ref = (0, react_1.useRef)(null);
|
|
72
72
|
(0, useOnClickOutside_1.useOnClickOutside)({ ref, moveMouseOutside: closeOnMoveMouseOutside }, () => {
|
|
73
|
-
if (open) {
|
|
73
|
+
if (closeOnClickOutside && open) {
|
|
74
74
|
setOpen(false);
|
|
75
75
|
}
|
|
76
76
|
});
|
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
__exportStar(require("./BorderGradient"), exports);
|
|
14
14
|
__exportStar(require("./Button"), exports);
|
|
15
15
|
__exportStar(require("./Chevron"), exports);
|
|
16
|
+
__exportStar(require("./Confirm"), exports);
|
|
16
17
|
__exportStar(require("./Dropdown"), exports);
|
|
17
18
|
__exportStar(require("./DropdownList"), exports);
|
|
18
19
|
__exportStar(require("./FlexColumn"), exports);
|
|
@@ -2,15 +2,15 @@ export declare const isServer: boolean;
|
|
|
2
2
|
export declare const useQueryStringRaw: <T>({ name, searchOverride, defaultValue, stringify, parse, }: {
|
|
3
3
|
name: string;
|
|
4
4
|
searchOverride?: string | undefined;
|
|
5
|
-
defaultValue: T
|
|
5
|
+
defaultValue: T;
|
|
6
6
|
stringify: (v: T) => string | undefined;
|
|
7
|
-
parse: (v: string | undefined) => T
|
|
8
|
-
}) => [T
|
|
7
|
+
parse: (v: string | undefined) => T;
|
|
8
|
+
}) => [T, (v: T) => void];
|
|
9
9
|
export declare const useQueryStringArray: ({ name, searchOverride, defaultValue, }: {
|
|
10
10
|
name: string;
|
|
11
11
|
searchOverride?: string | undefined;
|
|
12
12
|
defaultValue: string[];
|
|
13
|
-
}) => [string[]
|
|
13
|
+
}) => [string[], (v: string[]) => void];
|
|
14
14
|
export declare const useQueryStringSingle: ({ name, searchOverride, defaultValue, }: {
|
|
15
15
|
name: string;
|
|
16
16
|
searchOverride?: string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ag-common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.73",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"author": "Andrei Gec <@andreigec> (https://gec.dev/)",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"start": "tsc --watch"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"aws-cdk-lib": "2.
|
|
16
|
+
"aws-cdk-lib": "2.8.0",
|
|
17
17
|
"aws-sdk": "2.1058.0",
|
|
18
18
|
"axios": "0.24.0",
|
|
19
|
-
"constructs": "10.0.
|
|
19
|
+
"constructs": "10.0.36",
|
|
20
20
|
"jsonwebtoken": "8.5.1",
|
|
21
21
|
"jwks-rsa": "2.0.5",
|
|
22
22
|
"openapi-request-validator": "10.0.0",
|