ag-common 0.0.316 → 0.0.319
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/dynamo.d.ts +8 -3
- package/dist/api/helpers/dynamo.js +31 -7
- package/dist/api/helpers/s3.d.ts +2 -2
- package/dist/api/helpers/s3.js +3 -3
- package/dist/api/helpers/ses.d.ts +2 -2
- package/dist/api/helpers/ses.js +3 -3
- package/dist/api/helpers/sqs.d.ts +2 -2
- package/dist/api/helpers/sqs.js +3 -3
- package/dist/api/helpers/validateOpenApi.d.ts +2 -0
- package/dist/ui/components/Chevron/index.d.ts +7 -6
- package/dist/ui/components/Close/index.d.ts +5 -4
- package/dist/ui/components/Confirm/Dialog.d.ts +7 -5
- package/dist/ui/components/Confirm/Dialog.js +5 -0
- package/dist/ui/components/Confirm/Modal.d.ts +2 -7
- package/dist/ui/components/Confirm/index.d.ts +1 -0
- package/dist/ui/components/Confirm/index.js +1 -0
- package/dist/ui/components/Confirm/types.d.ts +15 -0
- package/dist/ui/components/Confirm/types.js +2 -0
- package/dist/ui/components/FlexColumn/index.d.ts +2 -2
- package/dist/ui/components/FlexRow/index.d.ts +2 -2
- package/dist/ui/components/Icon/index.d.ts +2 -2
- package/dist/ui/components/KebabDots/index.d.ts +4 -3
- package/dist/ui/components/Loader/index.d.ts +5 -4
- package/dist/ui/components/Loader/index.js +1 -1
- package/dist/ui/components/Modal/types.d.ts +0 -6
- package/dist/ui/components/ProgressBar/index.d.ts +12 -0
- package/dist/ui/components/ProgressBar/index.js +50 -0
- package/dist/ui/components/Prompt/Dialog.d.ts +2 -2
- package/dist/ui/components/Prompt/Modal.d.ts +11 -8
- package/dist/ui/components/Prompt/Modal.js +4 -2
- package/dist/ui/components/RowOrColumn/index.d.ts +2 -0
- package/dist/ui/components/Search/Inline.d.ts +2 -2
- package/dist/ui/components/Search/Modal.d.ts +2 -2
- package/dist/ui/components/Search/types.d.ts +2 -0
- package/dist/ui/components/Sidebar/index.d.ts +7 -6
- package/dist/ui/components/Table/index.d.ts +5 -4
- package/dist/ui/components/Table/index.js +1 -1
- package/dist/ui/components/UserImage/index.d.ts +12 -9
- package/dist/ui/components/UserImage/index.js +1 -1
- package/dist/ui/components/index.d.ts +4 -4
- package/dist/ui/components/index.js +4 -4
- package/package.json +1 -1
- package/dist/ui/components/LogoutButton/index.d.ts +0 -6
- package/dist/ui/components/LogoutButton/index.js +0 -27
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IQueryDynamo, Key } from '../types';
|
|
2
|
-
import
|
|
3
|
-
export declare let dynamoDb:
|
|
1
|
+
import { DYNAMOKEYS, IQueryDynamo, Key } from '../types';
|
|
2
|
+
import DynamoDB from 'aws-sdk/clients/dynamodb';
|
|
3
|
+
export declare let dynamoDb: DynamoDB.DocumentClient;
|
|
4
4
|
export declare const setDynamo: (region: string) => void;
|
|
5
5
|
export declare const putDynamo: <T>(item: T, tableName: string) => Promise<{
|
|
6
6
|
error?: string | undefined;
|
|
@@ -44,3 +44,8 @@ export declare const getDynamoTtl: (days: number) => number;
|
|
|
44
44
|
export declare const wipeTable: (tableName: string) => Promise<{
|
|
45
45
|
errors?: string[] | undefined;
|
|
46
46
|
}>;
|
|
47
|
+
export declare const getDynamoUpdates: (items: DYNAMOKEYS) => {
|
|
48
|
+
UpdateExpression: string;
|
|
49
|
+
ExpressionAttributeNames: Record<string, string>;
|
|
50
|
+
ExpressionAttributeValues: Record<string, string | number>;
|
|
51
|
+
};
|
|
@@ -12,16 +12,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.wipeTable = exports.getDynamoTtl = exports.queryDynamo = exports.getItemsDynamo = exports.getItemDynamo = exports.scan = exports.batchDelete = exports.batchWrite = exports.putDynamo = exports.setDynamo = exports.dynamoDb = void 0;
|
|
15
|
+
exports.getDynamoUpdates = exports.wipeTable = exports.getDynamoTtl = exports.queryDynamo = exports.getItemsDynamo = exports.getItemDynamo = exports.scan = exports.batchDelete = exports.batchWrite = exports.putDynamo = exports.setDynamo = exports.dynamoDb = void 0;
|
|
16
16
|
const log_1 = require("../../common/helpers/log");
|
|
17
17
|
const array_1 = require("../../common/helpers/array");
|
|
18
18
|
const sleep_1 = require("../../common/helpers/sleep");
|
|
19
19
|
const async_1 = require("../../common/helpers/async");
|
|
20
|
-
const
|
|
20
|
+
const dynamodb_1 = __importDefault(require("aws-sdk/clients/dynamodb"));
|
|
21
21
|
// eslint-disable-next-line import/no-mutable-exports
|
|
22
|
-
exports.dynamoDb = new
|
|
22
|
+
exports.dynamoDb = new dynamodb_1.default.DocumentClient();
|
|
23
23
|
const setDynamo = (region) => {
|
|
24
|
-
exports.dynamoDb = new
|
|
24
|
+
exports.dynamoDb = new dynamodb_1.default.DocumentClient({ region });
|
|
25
25
|
};
|
|
26
26
|
exports.setDynamo = setDynamo;
|
|
27
27
|
const putDynamo = (item, tableName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -194,11 +194,11 @@ const getItemsDynamo = ({ tableName, items, }) => __awaiter(void 0, void 0, void
|
|
|
194
194
|
},
|
|
195
195
|
},
|
|
196
196
|
};
|
|
197
|
-
const dbRaw = new
|
|
197
|
+
const dbRaw = new dynamodb_1.default({ apiVersion: '2012-10-08' });
|
|
198
198
|
try {
|
|
199
199
|
const res = yield dbRaw.batchGetItem(params).promise();
|
|
200
200
|
(0, log_1.debug)(`got dynamo getitems=${JSON.stringify(res, null, 2)}`);
|
|
201
|
-
let ret = ((_f = (_e = res.Responses) === null || _e === void 0 ? void 0 : _e[tableName]) === null || _f === void 0 ? void 0 : _f.map((s) =>
|
|
201
|
+
let ret = ((_f = (_e = res.Responses) === null || _e === void 0 ? void 0 : _e[tableName]) === null || _f === void 0 ? void 0 : _f.map((s) => dynamodb_1.default.Converter.unmarshall(s))) || [];
|
|
202
202
|
return ret;
|
|
203
203
|
}
|
|
204
204
|
catch (e) {
|
|
@@ -312,7 +312,7 @@ const getDynamoTtl = (days) => Math.ceil(new Date().getTime() / 1000) + days * 8
|
|
|
312
312
|
exports.getDynamoTtl = getDynamoTtl;
|
|
313
313
|
const wipeTable = (tableName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
314
314
|
var _j;
|
|
315
|
-
const dbRaw = new
|
|
315
|
+
const dbRaw = new dynamodb_1.default({ apiVersion: '2012-10-08' });
|
|
316
316
|
let infoV = yield dbRaw
|
|
317
317
|
.describeTable({
|
|
318
318
|
TableName: tableName,
|
|
@@ -354,3 +354,27 @@ const wipeTable = (tableName) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
354
354
|
return {};
|
|
355
355
|
});
|
|
356
356
|
exports.wipeTable = wipeTable;
|
|
357
|
+
const getDynamoUpdates = (items) => {
|
|
358
|
+
const cleanedKeys = Object.keys(items).filter((r) => r !== 'PK');
|
|
359
|
+
let UpdateExpression = '';
|
|
360
|
+
const ExpressionAttributeNames = {};
|
|
361
|
+
const ExpressionAttributeValues = {};
|
|
362
|
+
cleanedKeys.forEach((key) => {
|
|
363
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
364
|
+
const v = items[key];
|
|
365
|
+
if (v) {
|
|
366
|
+
UpdateExpression += `${!UpdateExpression ? '' : ','} #${key} = :${key}`;
|
|
367
|
+
ExpressionAttributeNames[`#${key}`] = key;
|
|
368
|
+
ExpressionAttributeValues[`:${key}`] = v;
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
(0, log_1.warn)(`no value for key:${key}`);
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
return {
|
|
375
|
+
UpdateExpression,
|
|
376
|
+
ExpressionAttributeNames,
|
|
377
|
+
ExpressionAttributeValues,
|
|
378
|
+
};
|
|
379
|
+
};
|
|
380
|
+
exports.getDynamoUpdates = getDynamoUpdates;
|
package/dist/api/helpers/s3.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Blob } from 'aws-sdk/lib/dynamodb/document_client';
|
|
3
|
-
import
|
|
3
|
+
import S3 from 'aws-sdk/clients/s3';
|
|
4
4
|
export declare const setS3: (region: string) => void;
|
|
5
5
|
export declare const getS3Object: ({ fileurl, }: {
|
|
6
6
|
fileurl: {
|
|
7
7
|
Bucket: string;
|
|
8
8
|
Key: string;
|
|
9
9
|
};
|
|
10
|
-
}) => Promise<import("aws-sdk/lib/request").PromiseResult<
|
|
10
|
+
}) => Promise<import("aws-sdk/lib/request").PromiseResult<S3.GetObjectOutput, import("aws-sdk/lib/error").AWSError>>;
|
|
11
11
|
export declare const putS3Object: ({ Body, Bucket, Key, ContentType, }: {
|
|
12
12
|
ContentType?: string | undefined;
|
|
13
13
|
Body: string | Blob;
|
package/dist/api/helpers/s3.js
CHANGED
|
@@ -13,10 +13,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.deleteFile = exports.uploadFile = exports.putS3Object = exports.getS3Object = exports.setS3 = void 0;
|
|
16
|
-
const
|
|
17
|
-
let s3 = new
|
|
16
|
+
const s3_1 = __importDefault(require("aws-sdk/clients/s3"));
|
|
17
|
+
let s3 = new s3_1.default();
|
|
18
18
|
const setS3 = (region) => {
|
|
19
|
-
s3 = new
|
|
19
|
+
s3 = new s3_1.default({ region });
|
|
20
20
|
};
|
|
21
21
|
exports.setS3 = setS3;
|
|
22
22
|
const getS3Object = ({ fileurl, }) => __awaiter(void 0, void 0, void 0, function* () {
|
package/dist/api/helpers/ses.js
CHANGED
|
@@ -13,10 +13,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.sendEmails = exports.sendEmail = exports.setSes = exports.ses = void 0;
|
|
16
|
-
const
|
|
17
|
-
exports.ses = new
|
|
16
|
+
const ses_1 = __importDefault(require("aws-sdk/clients/ses"));
|
|
17
|
+
exports.ses = new ses_1.default();
|
|
18
18
|
const setSes = (region) => {
|
|
19
|
-
exports.ses = new
|
|
19
|
+
exports.ses = new ses_1.default({ region });
|
|
20
20
|
};
|
|
21
21
|
exports.setSes = setSes;
|
|
22
22
|
const sendEmail = ({ to, message, subject, sourceArn, from, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare let sqs:
|
|
1
|
+
import SQS from 'aws-sdk/clients/sqs';
|
|
2
|
+
export declare let sqs: SQS;
|
|
3
3
|
export declare const setSqs: (region: string) => void;
|
|
4
4
|
export declare const sendMessages: <T>(items: T[], queueUrl: string) => Promise<void>;
|
package/dist/api/helpers/sqs.js
CHANGED
|
@@ -14,11 +14,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.sendMessages = exports.setSqs = exports.sqs = void 0;
|
|
16
16
|
const common_1 = require("../../common");
|
|
17
|
-
const
|
|
17
|
+
const sqs_1 = __importDefault(require("aws-sdk/clients/sqs"));
|
|
18
18
|
// eslint-disable-next-line import/no-mutable-exports
|
|
19
|
-
exports.sqs = new
|
|
19
|
+
exports.sqs = new sqs_1.default();
|
|
20
20
|
const setSqs = (region) => {
|
|
21
|
-
exports.sqs = new
|
|
21
|
+
exports.sqs = new sqs_1.default({ region });
|
|
22
22
|
};
|
|
23
23
|
exports.setSqs = setSqs;
|
|
24
24
|
const sendMessages = (items, queueUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -12,9 +12,11 @@ export declare type NextType<T> = ({ event, body, params, userProfile, lang, }:
|
|
|
12
12
|
export declare function validateOpenApi<T>({ event, next, authorized, schema, COGNITO_USER_POOL_ID, jwksRegion, getAndValidateTokenOverride, }: {
|
|
13
13
|
getAndValidateTokenOverride?: TGetAndValidateToken;
|
|
14
14
|
COGNITO_USER_POOL_ID: string;
|
|
15
|
+
/** pass in openapi schema. eg require('common/openapi.generated').default; */
|
|
15
16
|
schema: any;
|
|
16
17
|
event: APIGatewayEvent;
|
|
17
18
|
next: NextType<T>;
|
|
19
|
+
/** default false */
|
|
18
20
|
authorized?: true | false | 'optional';
|
|
19
21
|
/**
|
|
20
22
|
* default ap-southeast-2
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export
|
|
2
|
+
export interface IChevron {
|
|
3
3
|
/**
|
|
4
4
|
* default right
|
|
5
5
|
*/
|
|
6
6
|
point: 'up' | 'down' | 'left' | 'right';
|
|
7
|
-
colour?: string
|
|
8
|
-
className?: string
|
|
9
|
-
width?: string
|
|
10
|
-
onToggle?: (
|
|
11
|
-
}
|
|
7
|
+
colour?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
width?: string;
|
|
10
|
+
onToggle?: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const Chevron: ({ width, className, colour, onToggle, point, }: IChevron) => JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export
|
|
3
|
-
onClick?: (
|
|
4
|
-
className?: string
|
|
5
|
-
}
|
|
2
|
+
export interface IClose {
|
|
3
|
+
onClick?: (ev: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const Close: (p: IClose) => JSX.Element;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { IConfirmDialog } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* opens a dialog programatically
|
|
4
|
+
* @param param0
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export declare const ConfirmDialog: ({ bottomText, topText, }: IConfirmDialog) => Promise<boolean>;
|
|
@@ -17,6 +17,11 @@ const Modal_1 = require("./Modal");
|
|
|
17
17
|
const log_1 = require("../../../common/helpers/log");
|
|
18
18
|
const react_dom_1 = __importDefault(require("react-dom"));
|
|
19
19
|
const react_1 = __importDefault(require("react"));
|
|
20
|
+
/**
|
|
21
|
+
* opens a dialog programatically
|
|
22
|
+
* @param param0
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
20
25
|
const ConfirmDialog = ({ bottomText, topText, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
26
|
return new Promise((res) => {
|
|
22
27
|
const idName = 'ag-confirm-dialog';
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
topText?: string | undefined;
|
|
5
|
-
bottomText: string;
|
|
6
|
-
okText?: string | undefined;
|
|
7
|
-
cancelText?: string | undefined;
|
|
8
|
-
}) => JSX.Element;
|
|
2
|
+
import { IConfirmModal } from './types';
|
|
3
|
+
export declare const ConfirmModal: ({ onSubmit, bottomText, topText, okText, cancelText, }: IConfirmModal) => JSX.Element;
|
|
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
17
18
|
__exportStar(require("./Dialog"), exports);
|
|
18
19
|
__exportStar(require("./Modal"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface IConfirmDialog {
|
|
2
|
+
/** default (undefined) */
|
|
3
|
+
topText?: string;
|
|
4
|
+
bottomText: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IConfirmModal {
|
|
7
|
+
onSubmit: (v: boolean) => void;
|
|
8
|
+
/** default (undefined) */
|
|
9
|
+
topText?: string;
|
|
10
|
+
bottomText: string;
|
|
11
|
+
/** default OK */
|
|
12
|
+
okText?: string;
|
|
13
|
+
/** default Cancel */
|
|
14
|
+
cancelText?: string;
|
|
15
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
export declare const FlexColumn: (props:
|
|
2
|
+
import { IFlexColumn } from '../RowOrColumn';
|
|
3
|
+
export declare const FlexColumn: (props: IFlexColumn) => JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
export declare const FlexRow: (props:
|
|
2
|
+
import { IFlexRow } from '../RowOrColumn';
|
|
3
|
+
export declare const FlexRow: (props: IFlexRow) => JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
export interface
|
|
2
|
+
export interface IIcon {
|
|
3
3
|
disabled?: boolean;
|
|
4
4
|
fill?: string;
|
|
5
5
|
outline?: string;
|
|
@@ -21,4 +21,4 @@ export interface IIconProps {
|
|
|
21
21
|
className?: string;
|
|
22
22
|
}
|
|
23
23
|
export declare const IconF: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
24
|
-
export declare const Icon: (pr:
|
|
24
|
+
export declare const Icon: (pr: IIcon) => JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export
|
|
3
|
-
onClick?: (
|
|
4
|
-
}
|
|
2
|
+
export interface IKebabDots {
|
|
3
|
+
onClick?: () => Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
export declare const KebabDots: ({ onClick }: IKebabDots) => JSX.Element;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export
|
|
2
|
+
export interface ILoader {
|
|
3
3
|
/**
|
|
4
4
|
* default 2rem
|
|
5
5
|
*/
|
|
6
|
-
width?: string | null
|
|
6
|
+
width?: string | null;
|
|
7
7
|
/**
|
|
8
8
|
* default 2rem
|
|
9
9
|
*/
|
|
10
|
-
height?: string | null
|
|
10
|
+
height?: string | null;
|
|
11
11
|
name: string;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
|
+
export declare const Loader: ({ name, height, width }: ILoader) => JSX.Element;
|
|
@@ -63,7 +63,7 @@ const LoadingBack = styled_components_1.default.div `
|
|
|
63
63
|
}
|
|
64
64
|
transition: opacity 5s;
|
|
65
65
|
`;
|
|
66
|
-
const Loader = ({ name, height = '2rem', width = '2rem'
|
|
66
|
+
const Loader = ({ name, height = '2rem', width = '2rem' }) => {
|
|
67
67
|
const [trans, setTrans] = (0, react_1.useState)(true);
|
|
68
68
|
(0, react_1.useEffect)(() => {
|
|
69
69
|
setTrans(false);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface IProgressBar {
|
|
3
|
+
min: number;
|
|
4
|
+
max: number;
|
|
5
|
+
/** default #4d76ff */
|
|
6
|
+
frontColour?: string;
|
|
7
|
+
/** default #eee */
|
|
8
|
+
backColour?: string;
|
|
9
|
+
/** default 25,50,75 */
|
|
10
|
+
dotPercentages?: number[] | null;
|
|
11
|
+
}
|
|
12
|
+
export declare const ProgressBar: (p: IProgressBar) => JSX.Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
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.ProgressBar = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const styles_1 = require("../../styles");
|
|
10
|
+
const Base = styled_components_1.default.div `
|
|
11
|
+
position: relative;
|
|
12
|
+
min-width: 5rem;
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 2rem;
|
|
15
|
+
border-radius: 1rem;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
`;
|
|
18
|
+
const Bar = styled_components_1.default.div `
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: 0;
|
|
21
|
+
bottom: 0;
|
|
22
|
+
left: 0;
|
|
23
|
+
transition: width 0.2s ease;
|
|
24
|
+
`;
|
|
25
|
+
const Dot = styled_components_1.default.div `
|
|
26
|
+
position: absolute;
|
|
27
|
+
top: calc(50% - 0.25rem);
|
|
28
|
+
width: 0.5rem;
|
|
29
|
+
height: 0.5rem;
|
|
30
|
+
background-color: #aaa;
|
|
31
|
+
z-index: 1;
|
|
32
|
+
border-radius: 50%;
|
|
33
|
+
&[data-invert='true'] {
|
|
34
|
+
background-color: #333;
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
const ProgressBar = (p) => {
|
|
38
|
+
const { min, max, frontColour = styles_1.colours.notificationBlue, backColour = '#eee', dotPercentages = [25, 50, 75], } = p;
|
|
39
|
+
const barWidth = (min / max) * 100;
|
|
40
|
+
return (react_1.default.createElement(Base, { style: { backgroundColor: backColour } },
|
|
41
|
+
react_1.default.createElement(Bar, { style: {
|
|
42
|
+
width: `${barWidth}%`,
|
|
43
|
+
backgroundColor: frontColour,
|
|
44
|
+
} }),
|
|
45
|
+
(dotPercentages === null || dotPercentages === void 0 ? void 0 : dotPercentages.map) &&
|
|
46
|
+
dotPercentages.map((v) => {
|
|
47
|
+
return (react_1.default.createElement(Dot, { key: v, style: { left: `calc(${v}% - 0.25rem)` }, "data-invert": v > barWidth }));
|
|
48
|
+
})));
|
|
49
|
+
};
|
|
50
|
+
exports.ProgressBar = ProgressBar;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface IPromptDialog {
|
|
2
2
|
topText?: string;
|
|
3
3
|
bottomText: string;
|
|
4
4
|
defaultValue?: string;
|
|
5
5
|
placeholder?: string;
|
|
6
6
|
}
|
|
7
|
-
export declare const PromptDialog: (p:
|
|
7
|
+
export declare const PromptDialog: (p: IPromptDialog) => Promise<string | undefined>;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export
|
|
3
|
-
defaultValue?: string
|
|
4
|
-
placeholder?: string
|
|
2
|
+
export interface IPromptModal {
|
|
3
|
+
defaultValue?: string;
|
|
4
|
+
placeholder?: string;
|
|
5
5
|
res: (v: string | undefined) => void;
|
|
6
|
-
wrapper
|
|
7
|
-
topText?: string
|
|
6
|
+
wrapper?: HTMLDivElement;
|
|
7
|
+
topText?: string;
|
|
8
8
|
bottomText: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
/** default 'OK' */
|
|
10
|
+
okText?: string;
|
|
11
|
+
/** default "cancel" */
|
|
12
|
+
cancelText?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const PromptModal: ({ wrapper, res, bottomText, topText, okText, cancelText, defaultValue, placeholder, }: IPromptModal) => JSX.Element;
|
|
@@ -70,8 +70,10 @@ const PromptModal = ({ wrapper, res, bottomText, topText, okText = 'OK', cancelT
|
|
|
70
70
|
res(v);
|
|
71
71
|
}
|
|
72
72
|
finally {
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
if (wrapper) {
|
|
74
|
+
react_dom_1.default.unmountComponentAtNode(wrapper);
|
|
75
|
+
wrapper.remove();
|
|
76
|
+
}
|
|
75
77
|
}
|
|
76
78
|
};
|
|
77
79
|
return (react_1.default.createElement(Modal_1.Modal, { position: "center", topPosition: "center", open: true, setOpen: () => ret(undefined), showCloseButton: false, closeOnClickOutside: false },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
export declare const SearchInline: <T>(p:
|
|
2
|
+
import { ISearchInline, TSearchModalRes } from './types';
|
|
3
|
+
export declare const SearchInline: <T>(p: ISearchInline<T> & {
|
|
4
4
|
onSelectItem?: ((v: TSearchModalRes<T>) => void) | undefined;
|
|
5
5
|
onSearchTextChange?: ((v: string) => void) | undefined;
|
|
6
6
|
}) => JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
export declare const SearchModal: <T>(p:
|
|
2
|
+
import { ISearchModal, TSearchModalRes } from './types';
|
|
3
|
+
export declare const SearchModal: <T>(p: ISearchModal<T> & {
|
|
4
4
|
onSelectItem: (v: TSearchModalRes<T>) => void;
|
|
5
5
|
}) => JSX.Element;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export
|
|
2
|
+
export interface ISidebar {
|
|
3
3
|
children: any;
|
|
4
|
-
className?: string
|
|
4
|
+
className?: string;
|
|
5
5
|
/**
|
|
6
6
|
* used for localstorage. default 'sidebar'
|
|
7
7
|
*/
|
|
8
|
-
key?: string
|
|
8
|
+
key?: string;
|
|
9
9
|
/**
|
|
10
10
|
* optionally pass in SSR cookiedocument
|
|
11
11
|
*/
|
|
12
|
-
cookieDocument?: string
|
|
12
|
+
cookieDocument?: string;
|
|
13
13
|
/**
|
|
14
14
|
* default 15rem
|
|
15
15
|
*/
|
|
16
|
-
width?: string
|
|
17
|
-
}
|
|
16
|
+
width?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const Sidebar: ({ children, className, key, cookieDocument, width, }: ISidebar) => JSX.Element;
|
|
@@ -3,8 +3,9 @@ export interface TableItem {
|
|
|
3
3
|
content: JSX.Element;
|
|
4
4
|
groupTitle: string;
|
|
5
5
|
}
|
|
6
|
-
export
|
|
6
|
+
export interface ITable {
|
|
7
7
|
children: TableItem[];
|
|
8
|
-
className?: string
|
|
9
|
-
headerRow?: JSX.Element
|
|
10
|
-
}
|
|
8
|
+
className?: string;
|
|
9
|
+
headerRow?: JSX.Element;
|
|
10
|
+
}
|
|
11
|
+
export declare const Table: ({ children, className, headerRow }: ITable) => JSX.Element;
|
|
@@ -34,7 +34,7 @@ const GroupWrap = styled_components_1.default.div `
|
|
|
34
34
|
display: flex;
|
|
35
35
|
flex-flow: column;
|
|
36
36
|
`;
|
|
37
|
-
const Table = ({ children, className, headerRow
|
|
37
|
+
const Table = ({ children, className, headerRow }) => {
|
|
38
38
|
const grouped = (0, groupBy_1.groupByList)(children, (s) => s.groupTitle);
|
|
39
39
|
return (react_1.default.createElement(Base, { className: className }, grouped.map((group) => (react_1.default.createElement(GroupWrap, { key: 'gk' + group.key },
|
|
40
40
|
group.key && (react_1.default.createElement(GroupTitle, { key: `gt${group.key}` }, group.key)),
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { User } from '../../helpers/jwt';
|
|
3
|
-
export
|
|
4
|
-
image?: string
|
|
5
|
-
className?: string
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
export interface IUserImage {
|
|
4
|
+
image?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
/** default "user image" */
|
|
7
|
+
title?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const UserImage: ({ image, className, title, }: IUserImage) => JSX.Element;
|
|
10
|
+
export interface IUserProfileImage {
|
|
11
|
+
className?: string;
|
|
12
|
+
user?: Pick<User, 'picture' | 'fullname' | 'userId'>;
|
|
13
|
+
}
|
|
14
|
+
export declare const UserProfileImage: ({ className, user }: IUserProfileImage) => JSX.Element;
|
|
@@ -54,7 +54,7 @@ const UserImage = ({ image, className, title = 'user image', }) => {
|
|
|
54
54
|
(!image || fallback) && UserOutline_1.UserOutline));
|
|
55
55
|
};
|
|
56
56
|
exports.UserImage = UserImage;
|
|
57
|
-
const UserProfileImage = ({ className, user
|
|
57
|
+
const UserProfileImage = ({ className, user }) => {
|
|
58
58
|
const image = user === null || user === void 0 ? void 0 : user.picture;
|
|
59
59
|
if (image) {
|
|
60
60
|
if (!images.domains.find((i) => image.includes(i))) {
|
|
@@ -2,8 +2,7 @@ export * from './BorderGradient';
|
|
|
2
2
|
export * from './Button';
|
|
3
3
|
export * from './Chevron';
|
|
4
4
|
export * from './Close';
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './Confirm/Dialog';
|
|
5
|
+
export * from './Confirm';
|
|
7
6
|
export * from './DropdownList';
|
|
8
7
|
export * from './FlexColumn';
|
|
9
8
|
export * from './FlexRow';
|
|
@@ -11,8 +10,9 @@ export * from './HeadersRaw';
|
|
|
11
10
|
export * from './Icon';
|
|
12
11
|
export * from './KebabDots';
|
|
13
12
|
export * from './Loader';
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './
|
|
13
|
+
export * from './Modal';
|
|
14
|
+
export * from './OpenApiCodeBlock';
|
|
15
|
+
export * from './ProgressBar';
|
|
16
16
|
export * from './Prompt';
|
|
17
17
|
export * from './RowOrColumn';
|
|
18
18
|
export * from './Search';
|
|
@@ -18,8 +18,7 @@ __exportStar(require("./BorderGradient"), exports);
|
|
|
18
18
|
__exportStar(require("./Button"), exports);
|
|
19
19
|
__exportStar(require("./Chevron"), exports);
|
|
20
20
|
__exportStar(require("./Close"), exports);
|
|
21
|
-
__exportStar(require("./
|
|
22
|
-
__exportStar(require("./Confirm/Dialog"), exports);
|
|
21
|
+
__exportStar(require("./Confirm"), exports);
|
|
23
22
|
__exportStar(require("./DropdownList"), exports);
|
|
24
23
|
__exportStar(require("./FlexColumn"), exports);
|
|
25
24
|
__exportStar(require("./FlexRow"), exports);
|
|
@@ -27,8 +26,9 @@ __exportStar(require("./HeadersRaw"), exports);
|
|
|
27
26
|
__exportStar(require("./Icon"), exports);
|
|
28
27
|
__exportStar(require("./KebabDots"), exports);
|
|
29
28
|
__exportStar(require("./Loader"), exports);
|
|
30
|
-
__exportStar(require("./
|
|
31
|
-
__exportStar(require("./
|
|
29
|
+
__exportStar(require("./Modal"), exports);
|
|
30
|
+
__exportStar(require("./OpenApiCodeBlock"), exports);
|
|
31
|
+
__exportStar(require("./ProgressBar"), exports);
|
|
32
32
|
__exportStar(require("./Prompt"), exports);
|
|
33
33
|
__exportStar(require("./RowOrColumn"), exports);
|
|
34
34
|
__exportStar(require("./Search"), exports);
|
package/package.json
CHANGED
|
@@ -1,27 +0,0 @@
|
|
|
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.LogoutButton = void 0;
|
|
7
|
-
const colours_1 = require("../../styles/colours");
|
|
8
|
-
const Button_1 = require("../Button");
|
|
9
|
-
const react_1 = __importDefault(require("react"));
|
|
10
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
11
|
-
const Door_1 = require("../../icons/Door");
|
|
12
|
-
const Icon = styled_components_1.default.div `
|
|
13
|
-
width: 1.5rem;
|
|
14
|
-
height: 1.5rem;
|
|
15
|
-
`;
|
|
16
|
-
const ButtonStyled = (0, styled_components_1.default)(Button_1.Button) `
|
|
17
|
-
padding: 0;
|
|
18
|
-
margin: 0;
|
|
19
|
-
border: 0;
|
|
20
|
-
background-color: transparent;
|
|
21
|
-
svg {
|
|
22
|
-
fill: ${colours_1.colours.notificationBlue};
|
|
23
|
-
}
|
|
24
|
-
`;
|
|
25
|
-
const LogoutButton = ({ className, invert, logout, }) => (react_1.default.createElement(ButtonStyled, { invert: invert, className: className, onKeyPress: () => logout(), onClick: () => logout() },
|
|
26
|
-
react_1.default.createElement(Icon, null, Door_1.Door)));
|
|
27
|
-
exports.LogoutButton = LogoutButton;
|