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.
Files changed (179) hide show
  1. package/dist/api/helpers/api.js +34 -35
  2. package/dist/api/helpers/aws.js +9 -13
  3. package/dist/api/helpers/cloudfront.js +7 -24
  4. package/dist/api/helpers/dynamo.js +85 -134
  5. package/dist/api/helpers/dynamoInfra.js +14 -19
  6. package/dist/api/helpers/enforceDynamoProvisionCap.js +14 -18
  7. package/dist/api/helpers/index.js +14 -30
  8. package/dist/api/helpers/openApiHelpers.d.ts +2 -3
  9. package/dist/api/helpers/openApiHelpers.js +34 -37
  10. package/dist/api/helpers/s3.js +81 -126
  11. package/dist/api/helpers/ses.js +9 -28
  12. package/dist/api/helpers/sqs.js +9 -26
  13. package/dist/api/helpers/ssm.js +8 -14
  14. package/dist/api/helpers/sts.js +16 -34
  15. package/dist/api/helpers/validateOpenApi.js +92 -103
  16. package/dist/api/helpers/validations.js +29 -46
  17. package/dist/api/index.js +2 -18
  18. package/dist/api/openapi-prefix.js +25 -38
  19. package/dist/api/types/aws.js +1 -2
  20. package/dist/api/types/index.js +1 -17
  21. package/dist/common/const.js +2 -5
  22. package/dist/common/helpers/array.js +8 -19
  23. package/dist/common/helpers/async.js +10 -28
  24. package/dist/common/helpers/binary.js +5 -10
  25. package/dist/common/helpers/date.js +14 -25
  26. package/dist/common/helpers/email.js +5 -11
  27. package/dist/common/helpers/func.js +3 -7
  28. package/dist/common/helpers/generator.js +9 -24
  29. package/dist/common/helpers/groupBy.js +3 -9
  30. package/dist/common/helpers/hashCode.js +3 -9
  31. package/dist/common/helpers/i18n.js +9 -17
  32. package/dist/common/helpers/index.js +18 -34
  33. package/dist/common/helpers/log.js +16 -28
  34. package/dist/common/helpers/math.js +9 -21
  35. package/dist/common/helpers/memo.js +3 -7
  36. package/dist/common/helpers/object.js +20 -35
  37. package/dist/common/helpers/random.js +4 -10
  38. package/dist/common/helpers/secondsInNearest.js +2 -7
  39. package/dist/common/helpers/sleep.js +1 -5
  40. package/dist/common/helpers/string/base64.js +2 -7
  41. package/dist/common/helpers/string/chunk.js +1 -5
  42. package/dist/common/helpers/string/contains.js +2 -7
  43. package/dist/common/helpers/string/getExtendedStringSegment.js +5 -9
  44. package/dist/common/helpers/string/index.js +10 -26
  45. package/dist/common/helpers/string/json.js +1 -5
  46. package/dist/common/helpers/string/object.js +1 -5
  47. package/dist/common/helpers/string/surround.js +1 -5
  48. package/dist/common/helpers/string/trim.js +2 -7
  49. package/dist/common/helpers/string/truncate.js +1 -5
  50. package/dist/common/helpers/string/url.js +4 -9
  51. package/dist/common/index.js +2 -18
  52. package/dist/index.js +3 -19
  53. package/dist/ui/components/BorderGradient/index.js +18 -25
  54. package/dist/ui/components/Button/index.js +17 -25
  55. package/dist/ui/components/Chevron/index.js +9 -16
  56. package/dist/ui/components/Close/index.js +6 -13
  57. package/dist/ui/components/Confirm/Dialog.js +9 -25
  58. package/dist/ui/components/Confirm/Modal.js +20 -27
  59. package/dist/ui/components/Confirm/index.js +3 -19
  60. package/dist/ui/components/Confirm/types.js +1 -2
  61. package/dist/ui/components/DropdownList/Base.js +33 -64
  62. package/dist/ui/components/DropdownList/Dialog.js +8 -24
  63. package/dist/ui/components/DropdownList/index.js +2 -18
  64. package/dist/ui/components/DropdownList/types.js +1 -2
  65. package/dist/ui/components/FlexColumn/index.js +4 -14
  66. package/dist/ui/components/FlexRow/index.js +4 -14
  67. package/dist/ui/components/HeadersRaw/index.js +20 -27
  68. package/dist/ui/components/HorizontalScrollBar/index.js +6 -34
  69. package/dist/ui/components/Icon/index.js +9 -16
  70. package/dist/ui/components/Image/index.js +10 -28
  71. package/dist/ui/components/InfiniteScroll/index.js +18 -50
  72. package/dist/ui/components/KebabDots/index.js +6 -13
  73. package/dist/ui/components/Loader/index.js +9 -39
  74. package/dist/ui/components/Modal/Dialog.js +7 -23
  75. package/dist/ui/components/Modal/Modal.js +19 -49
  76. package/dist/ui/components/Modal/index.js +3 -19
  77. package/dist/ui/components/Modal/types.js +1 -2
  78. package/dist/ui/components/OpenApiCodeBlock/OpenApiCodeBlock.js +26 -34
  79. package/dist/ui/components/OpenApiCodeBlock/curl/helpers/body.js +12 -19
  80. package/dist/ui/components/OpenApiCodeBlock/curl/helpers/getCurlLines.js +6 -11
  81. package/dist/ui/components/OpenApiCodeBlock/curl/helpers/security.js +8 -15
  82. package/dist/ui/components/OpenApiCodeBlock/curl/index.js +14 -21
  83. package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/call.js +8 -15
  84. package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/getFetchLines.js +3 -8
  85. package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/req.js +27 -34
  86. package/dist/ui/components/OpenApiCodeBlock/fetch/index.js +11 -18
  87. package/dist/ui/components/OpenApiCodeBlock/helpers/common.js +7 -17
  88. package/dist/ui/components/OpenApiCodeBlock/helpers/joinJsx.js +6 -15
  89. package/dist/ui/components/OpenApiCodeBlock/index.js +2 -18
  90. package/dist/ui/components/OpenApiCodeBlock/types.js +1 -2
  91. package/dist/ui/components/PieChart/index.js +11 -18
  92. package/dist/ui/components/ProgressBar/index.js +15 -45
  93. package/dist/ui/components/Prompt/Dialog.js +7 -23
  94. package/dist/ui/components/Prompt/Modal.js +25 -55
  95. package/dist/ui/components/Prompt/index.js +2 -18
  96. package/dist/ui/components/RowOrColumn/index.js +7 -17
  97. package/dist/ui/components/Search/AutoHideSearchBox.js +24 -56
  98. package/dist/ui/components/Search/Base.js +21 -52
  99. package/dist/ui/components/Search/Dialog.js +10 -26
  100. package/dist/ui/components/Search/Inline.js +3 -10
  101. package/dist/ui/components/Search/Modal.js +10 -17
  102. package/dist/ui/components/Search/SearchBox.js +26 -58
  103. package/dist/ui/components/Search/index.js +7 -23
  104. package/dist/ui/components/Search/types.js +1 -2
  105. package/dist/ui/components/Sidebar/index.js +18 -25
  106. package/dist/ui/components/SparkLine/index.js +17 -27
  107. package/dist/ui/components/Table/index.js +15 -22
  108. package/dist/ui/components/TextEdit/CheckboxEdit.js +21 -51
  109. package/dist/ui/components/TextEdit/ColourEdit.js +17 -44
  110. package/dist/ui/components/TextEdit/LengthBox.js +5 -12
  111. package/dist/ui/components/TextEdit/ListboxEdit.js +15 -42
  112. package/dist/ui/components/TextEdit/RadioGroup.js +13 -43
  113. package/dist/ui/components/TextEdit/TextEdit.js +48 -78
  114. package/dist/ui/components/TextEdit/common.js +11 -17
  115. package/dist/ui/components/TextEdit/index.js +6 -22
  116. package/dist/ui/components/TextEdit/types.js +1 -2
  117. package/dist/ui/components/TextWithButton/index.js +10 -40
  118. package/dist/ui/components/TimelineChart/index.js +14 -24
  119. package/dist/ui/components/Toast/Cross.js +9 -16
  120. package/dist/ui/components/Toast/Tick.js +4 -11
  121. package/dist/ui/components/Toast/Warning.js +8 -15
  122. package/dist/ui/components/Toast/base.js +33 -65
  123. package/dist/ui/components/Toast/index.js +2 -18
  124. package/dist/ui/components/Toast/types.js +1 -2
  125. package/dist/ui/components/UserImage/index.js +17 -48
  126. package/dist/ui/components/index.js +30 -46
  127. package/dist/ui/helpers/axiosHelper.js +25 -39
  128. package/dist/ui/helpers/browserHelpers.js +7 -22
  129. package/dist/ui/helpers/callOpenApi/cached.js +18 -37
  130. package/dist/ui/helpers/callOpenApi/direct.js +46 -59
  131. package/dist/ui/helpers/callOpenApi/helpers.js +25 -40
  132. package/dist/ui/helpers/callOpenApi/hook.js +47 -36
  133. package/dist/ui/helpers/callOpenApi/index.js +5 -21
  134. package/dist/ui/helpers/callOpenApi/types.js +1 -2
  135. package/dist/ui/helpers/cognito.js +1 -2
  136. package/dist/ui/helpers/cookie/const.js +2 -5
  137. package/dist/ui/helpers/cookie/get.js +13 -14
  138. package/dist/ui/helpers/cookie/index.js +5 -21
  139. package/dist/ui/helpers/cookie/raw.js +9 -16
  140. package/dist/ui/helpers/cookie/set.js +10 -15
  141. package/dist/ui/helpers/cookie/use.js +23 -16
  142. package/dist/ui/helpers/date.js +10 -15
  143. package/dist/ui/helpers/debounce.js +5 -10
  144. package/dist/ui/helpers/dom.js +6 -13
  145. package/dist/ui/helpers/extractAttributes.js +2 -7
  146. package/dist/ui/helpers/index.js +25 -41
  147. package/dist/ui/helpers/jwt.js +1 -2
  148. package/dist/ui/helpers/plural.js +1 -5
  149. package/dist/ui/helpers/routes.js +17 -24
  150. package/dist/ui/helpers/serviceWorker.js +8 -23
  151. package/dist/ui/helpers/useContextMenu.js +9 -14
  152. package/dist/ui/helpers/useElementAttribute.js +3 -7
  153. package/dist/ui/helpers/useGranularHook.js +5 -10
  154. package/dist/ui/helpers/useInterval.js +8 -12
  155. package/dist/ui/helpers/useLocalStorage.js +24 -32
  156. package/dist/ui/helpers/useLockBodyScroll.js +3 -7
  157. package/dist/ui/helpers/useOnClickOutside.js +7 -12
  158. package/dist/ui/helpers/useOnScroll.js +15 -21
  159. package/dist/ui/helpers/useOverloadPageSearch.js +3 -7
  160. package/dist/ui/helpers/useQueryString.js +14 -20
  161. package/dist/ui/helpers/useResize.js +8 -12
  162. package/dist/ui/helpers/useTimeout.js +5 -9
  163. package/dist/ui/icons/ChevronRight.js +3 -9
  164. package/dist/ui/icons/CrossIcon.js +5 -12
  165. package/dist/ui/icons/Door.js +4 -10
  166. package/dist/ui/icons/HorizontalDots.js +3 -9
  167. package/dist/ui/icons/Magnify.js +3 -10
  168. package/dist/ui/icons/Pencil.js +5 -12
  169. package/dist/ui/icons/Save.js +4 -11
  170. package/dist/ui/icons/Undo.js +5 -12
  171. package/dist/ui/icons/UserOutline.js +3 -9
  172. package/dist/ui/icons/index.js +9 -25
  173. package/dist/ui/index.js +4 -20
  174. package/dist/ui/styles/colours.js +7 -12
  175. package/dist/ui/styles/common.js +14 -22
  176. package/dist/ui/styles/index.js +4 -20
  177. package/dist/ui/styles/media.js +7 -10
  178. package/dist/ui/styles/standaloneStyles.js +10 -16
  179. package/package.json +18 -17
@@ -1,27 +1,20 @@
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.SearchModal = void 0;
7
- const styled_1 = __importDefault(require("@emotion/styled"));
8
- const react_1 = __importDefault(require("react"));
9
- const styles_1 = require("../../styles");
10
- const Modal_1 = require("../Modal/Modal");
11
- const Base_1 = require("./Base");
12
- const ModalStyled = (0, styled_1.default)(Modal_1.Modal) `
1
+ import styled from '@emotion/styled';
2
+ import React from 'react';
3
+ import { bigScreen, smallScreen } from '../../styles';
4
+ import { Modal } from '../Modal/Modal';
5
+ import { SearchBase } from './Base';
6
+ const ModalStyled = styled(Modal) `
13
7
  display: flex;
14
8
  flex-flow: column;
15
9
  top: 10rem;
16
- @media ${styles_1.bigScreen} {
10
+ @media ${bigScreen} {
17
11
  width: 50vw;
18
12
  max-width: 60rem;
19
13
  }
20
- @media ${styles_1.smallScreen} {
14
+ @media ${smallScreen} {
21
15
  width: 100%;
22
16
  max-width: 95vw;
23
17
  }
24
18
  `;
25
- const SearchModal = (p) => (react_1.default.createElement(ModalStyled, { position: "center", topPosition: "center", open: true, setOpen: () => p.onSelectItem(undefined), showCloseButton: false, closeOnClickOutside: true },
26
- react_1.default.createElement(Base_1.SearchBase, Object.assign({}, p))));
27
- exports.SearchModal = SearchModal;
19
+ export const SearchModal = (p) => (React.createElement(ModalStyled, { position: "center", topPosition: "center", open: true, setOpen: () => p.onSelectItem(undefined), showCloseButton: false, closeOnClickOutside: true },
20
+ React.createElement(SearchBase, { ...p })));
@@ -1,40 +1,11 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
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 __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.SearchBox = 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 icons_1 = require("../../icons");
35
- const styles_1 = require("../../styles");
36
- const TextEdit_1 = require("../TextEdit");
37
- const Base = styled_1.default.div `
1
+ import styled from '@emotion/styled';
2
+ import React, { createRef, forwardRef, useEffect, useImperativeHandle, } from 'react';
3
+ import { debounce } from '../../helpers/debounce';
4
+ import { filterDataProps } from '../../helpers/dom';
5
+ import { CrossIcon, Magnify } from '../../icons';
6
+ import { bigScreen, smallScreen } from '../../styles';
7
+ import { TextEdit } from '../TextEdit';
8
+ const Base = styled.div `
38
9
  padding: 1rem;
39
10
  display: flex;
40
11
  flex-flow: row;
@@ -44,52 +15,49 @@ const Base = styled_1.default.div `
44
15
  margin: auto;
45
16
  position: relative;
46
17
 
47
- @media ${styles_1.smallScreen} {
18
+ @media ${smallScreen} {
48
19
  margin: 0;
49
20
  padding: 0;
50
21
  padding-top: 0.5rem;
51
22
  width: 100%;
52
23
  }
53
24
  `;
54
- const MagnifyIcon = styled_1.default.div `
25
+ const MagnifyIcon = styled.div `
55
26
  width: 1.5rem;
56
27
  height: 1.5rem;
57
28
  margin-right: 0.5rem;
58
29
  cursor: pointer;
59
30
  `;
60
- const CrossIconStyled = (0, styled_1.default)(icons_1.CrossIcon) `
31
+ const CrossIconStyled = styled(CrossIcon) `
61
32
  position: absolute;
62
33
  right: 1rem;
63
- @media ${styles_1.bigScreen} {
34
+ @media ${bigScreen} {
64
35
  right: 2rem;
65
36
  }
66
37
  `;
67
- exports.SearchBox = (0, react_1.forwardRef)((p, ref) => {
68
- const textEditRef = (0, react_1.createRef)();
69
- (0, react_1.useImperativeHandle)(ref, () => ({
38
+ export const SearchBox = forwardRef((p, ref) => {
39
+ const textEditRef = createRef();
40
+ useImperativeHandle(ref, () => ({
70
41
  setValue: (v) => {
71
- var _a, _b;
72
- const value = (_a = textEditRef.current) === null || _a === void 0 ? void 0 : _a.getValue();
42
+ const value = textEditRef.current?.getValue();
73
43
  if (v === value) {
74
44
  return;
75
45
  }
76
- (_b = textEditRef.current) === null || _b === void 0 ? void 0 : _b.setValue(v);
46
+ textEditRef.current?.setValue(v);
77
47
  },
78
- focus: () => { var _a; return (_a = textEditRef.current) === null || _a === void 0 ? void 0 : _a.focus(); },
79
- getValue: () => { var _a; return (_a = textEditRef.current) === null || _a === void 0 ? void 0 : _a.getValue(); },
48
+ focus: () => textEditRef.current?.focus(),
49
+ getValue: () => textEditRef.current?.getValue(),
80
50
  }));
81
- (0, react_1.useEffect)(() => {
82
- var _a;
83
- (_a = textEditRef === null || textEditRef === void 0 ? void 0 : textEditRef.current) === null || _a === void 0 ? void 0 : _a.setValue(p.searchText);
51
+ useEffect(() => {
52
+ textEditRef?.current?.setValue(p.searchText);
84
53
  }, [p.searchText, textEditRef]);
85
- return (react_1.default.createElement(Base, Object.assign({ "data-type": "search", className: p.className }, (0, dom_1.filterDataProps)(p)),
86
- react_1.default.createElement(TextEdit_1.TextEdit, { ref: textEditRef, placeholder: p.placeholderText, defaultEditing: { focus: true }, singleLine: true, leftContent: react_1.default.createElement(MagnifyIcon, { onClick: () => { var _a; return p.setSearchText(((_a = textEditRef === null || textEditRef === void 0 ? void 0 : textEditRef.current) === null || _a === void 0 ? void 0 : _a.getValue()) || '', true); } },
87
- react_1.default.createElement(icons_1.Magnify, null)), noGrow: true, allowUndo: false, onClickOutsideWithNoValue: null, onSubmit: (v, enterPressed) => (0, debounce_1.debounce)(() => {
54
+ return (React.createElement(Base, { "data-type": "search", className: p.className, ...filterDataProps(p) },
55
+ React.createElement(TextEdit, { ref: textEditRef, placeholder: p.placeholderText, defaultEditing: { focus: true }, singleLine: true, leftContent: React.createElement(MagnifyIcon, { onClick: () => p.setSearchText(textEditRef?.current?.getValue() || '', true) },
56
+ React.createElement(Magnify, null)), noGrow: true, allowUndo: false, onClickOutsideWithNoValue: null, onSubmit: (v, enterPressed) => debounce(() => {
88
57
  p.setSearchText(v, enterPressed);
89
58
  }, { key: 'pagesearch', time: 200 }), defaultValue: p.defaultValue }),
90
- p.searchText && (react_1.default.createElement(CrossIconStyled, { onClick: () => {
91
- var _a;
92
- (_a = textEditRef.current) === null || _a === void 0 ? void 0 : _a.setValue('');
59
+ p.searchText && (React.createElement(CrossIconStyled, { onClick: () => {
60
+ textEditRef.current?.setValue('');
93
61
  p.setSearchText('', true);
94
62
  } }))));
95
63
  });
@@ -1,23 +1,7 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
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("./AutoHideSearchBox"), exports);
18
- __exportStar(require("./Base"), exports);
19
- __exportStar(require("./Dialog"), exports);
20
- __exportStar(require("./Inline"), exports);
21
- __exportStar(require("./Modal"), exports);
22
- __exportStar(require("./SearchBox"), exports);
23
- __exportStar(require("./types"), exports);
1
+ export * from './AutoHideSearchBox';
2
+ export * from './Base';
3
+ export * from './Dialog';
4
+ export * from './Inline';
5
+ export * from './Modal';
6
+ export * from './SearchBox';
7
+ export * from './types';
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -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.Sidebar = void 0;
7
- const styled_1 = __importDefault(require("@emotion/styled"));
8
- const react_1 = __importDefault(require("react"));
9
- const use_1 = require("../../helpers/cookie/use");
10
- const common_1 = require("../../styles/common");
11
- const Chevron_1 = require("../Chevron");
12
- const Base = styled_1.default.div `
1
+ import styled from '@emotion/styled';
2
+ import React from 'react';
3
+ import { useCookieBoolean } from '../../helpers/cookie/use';
4
+ import { NoTextSelect } from '../../styles/common';
5
+ import { Chevron } from '../Chevron';
6
+ const Base = styled.div `
13
7
  position: relative;
14
8
  transition: all 200ms;
15
9
  border-right: solid 1px #ccc;
@@ -28,7 +22,7 @@ const Base = styled_1.default.div `
28
22
  border-right: solid 1px #999;
29
23
  }
30
24
  }
31
- ${common_1.NoTextSelect};
25
+ ${NoTextSelect};
32
26
 
33
27
  &:hover {
34
28
  [data-content] {
@@ -36,7 +30,7 @@ const Base = styled_1.default.div `
36
30
  }
37
31
  }
38
32
  `;
39
- const ContentBlock = styled_1.default.div `
33
+ const ContentBlock = styled.div `
40
34
  left: -18rem;
41
35
  transition: left 200ms;
42
36
  &[data-open='false'] {
@@ -46,7 +40,7 @@ const ContentBlock = styled_1.default.div `
46
40
  //width set in style
47
41
  }
48
42
  `;
49
- const Content = styled_1.default.div `
43
+ const Content = styled.div `
50
44
  display: flex;
51
45
  flex-flow: column;
52
46
  width: 100%;
@@ -60,7 +54,7 @@ const Content = styled_1.default.div `
60
54
  border-radius: 1rem;
61
55
  }
62
56
  `;
63
- const Hamburger = styled_1.default.div `
57
+ const Hamburger = styled.div `
64
58
  position: absolute;
65
59
  transition: all 200ms;
66
60
  &[data-open='false'] {
@@ -84,23 +78,22 @@ const Hamburger = styled_1.default.div `
84
78
  border: solid 1px rgba(0, 0, 0, 0.5);
85
79
  cursor: pointer;
86
80
  `;
87
- const ChevronStyled = (0, styled_1.default)(Chevron_1.Chevron) `
81
+ const ChevronStyled = styled(Chevron) `
88
82
  svg {
89
83
  fill: #555;
90
84
  }
91
85
  `;
92
- const Sidebar = ({ children, className, key = 'sidebar', cookieDocument, width = '15rem', }) => {
93
- const [open, setOpen] = (0, use_1.useCookieBoolean)({
86
+ export const Sidebar = ({ children, className, key = 'sidebar', cookieDocument, width = '15rem', }) => {
87
+ const [open, setOpen] = useCookieBoolean({
94
88
  name: key,
95
89
  defaultValue: false,
96
90
  cookieDocument: cookieDocument,
97
91
  });
98
- return (react_1.default.createElement(Base, { className: className, "data-open": open, onClick: () => !open && setOpen(true), "data-hover": true, style: { width: !open ? '0.5rem' : width } },
99
- react_1.default.createElement(Hamburger, { "data-open": open, onClick: () => setOpen(!open), "data-hover": true },
100
- react_1.default.createElement(ChevronStyled, { point: open ? 'left' : 'right', width: "100%" })),
101
- react_1.default.createElement(ContentBlock, { "data-content": true, "data-open": open, style: { width: !open ? width : undefined } },
102
- react_1.default.createElement(Content, { "data-open": open, onClick: (e) => {
92
+ return (React.createElement(Base, { className: className, "data-open": open, onClick: () => !open && setOpen(true), "data-hover": true, style: { width: !open ? '0.5rem' : width } },
93
+ React.createElement(Hamburger, { "data-open": open, onClick: () => setOpen(!open), "data-hover": true },
94
+ React.createElement(ChevronStyled, { point: open ? 'left' : 'right', width: "100%" })),
95
+ React.createElement(ContentBlock, { "data-content": true, "data-open": open, style: { width: !open ? width : undefined } },
96
+ React.createElement(Content, { "data-open": open, onClick: (e) => {
103
97
  e.stopPropagation();
104
98
  } }, children))));
105
99
  };
106
- exports.Sidebar = Sidebar;
@@ -1,60 +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.SparkLine = void 0;
7
- const styled_1 = __importDefault(require("@emotion/styled"));
8
- const react_1 = __importDefault(require("react"));
9
- const math_1 = require("../../../common/helpers/math");
10
- const Base = styled_1.default.div `
1
+ import styled from '@emotion/styled';
2
+ import React from 'react';
3
+ import { rangePercentage } from '../../../common/helpers/math';
4
+ const Base = styled.div `
11
5
  width: calc(100% - 2px - 1rem);
12
6
  height: 100%;
13
7
  border: solid 1px #666;
14
8
  border-radius: 0.5rem;
15
9
  padding: 0.5rem;
16
10
  `;
17
- const Points = styled_1.default.div `
11
+ const Points = styled.div `
18
12
  position: relative;
19
13
 
20
14
  width: 100%;
21
15
  height: 100%;
22
16
  `;
23
- const Point = styled_1.default.div `
17
+ const Point = styled.div `
24
18
  position: absolute;
25
19
  border-width: 2px;
26
20
  border-style: solid;
27
21
  width: 1px;
28
22
  `;
29
- const SparkLine = (p) => {
23
+ export const SparkLine = (p) => {
30
24
  const { data: raw, pointColour = '#4d76ff' } = p;
31
25
  const xMin = Math.min(...raw.map((d) => d.x));
32
26
  const xMax = Math.max(...raw.map((d) => d.x));
33
27
  const yMin = Math.min(...raw.map((d) => d.y));
34
28
  const yMax = Math.max(...raw.map((d) => d.y));
35
29
  const data = raw.map((orig) => ({
36
- x: (0, math_1.rangePercentage)({
30
+ x: rangePercentage({
37
31
  value: orig.x,
38
32
  min: xMin,
39
33
  max: xMax,
40
34
  }) * 100,
41
- y: (0, math_1.rangePercentage)({
35
+ y: rangePercentage({
42
36
  value: orig.y,
43
37
  min: yMin,
44
38
  max: yMax,
45
39
  }) * 100,
46
40
  orig,
47
41
  }));
48
- return (react_1.default.createElement(Base, { className: p.className, title: p.title },
49
- react_1.default.createElement(Points, null, data.map((pt) => {
50
- var _a, _b;
51
- return (react_1.default.createElement(Point, { title: (_b = (_a = p.pointTitleF) === null || _a === void 0 ? void 0 : _a.call(p, pt.orig)) !== null && _b !== void 0 ? _b : '', key: pt.x + ' ' + pt.y, style: {
52
- backgroundColor: pointColour,
53
- borderColor: pointColour,
54
- left: pt.x + '%',
55
- bottom: 0,
56
- height: pt.y + '%',
57
- } }));
58
- }))));
42
+ return (React.createElement(Base, { className: p.className, title: p.title },
43
+ React.createElement(Points, null, data.map((pt) => (React.createElement(Point, { title: p.pointTitleF?.(pt.orig) ?? '', key: pt.x + ' ' + pt.y, style: {
44
+ backgroundColor: pointColour,
45
+ borderColor: pointColour,
46
+ left: pt.x + '%',
47
+ bottom: 0,
48
+ height: pt.y + '%',
49
+ } }))))));
59
50
  };
60
- exports.SparkLine = SparkLine;
@@ -1,18 +1,12 @@
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.Table = void 0;
7
- const styled_1 = __importDefault(require("@emotion/styled"));
8
- const react_1 = __importDefault(require("react"));
9
- const groupBy_1 = require("../../../common/helpers/groupBy");
10
- const Base = styled_1.default.div `
1
+ import styled from '@emotion/styled';
2
+ import React from 'react';
3
+ import { groupByList } from '../../../common/helpers/groupBy';
4
+ const Base = styled.div `
11
5
  display: flex;
12
6
  flex-flow: column;
13
7
  width: 100%;
14
8
  `;
15
- const TableRow = styled_1.default.div `
9
+ const TableRow = styled.div `
16
10
  display: flex;
17
11
  border: solid 1px #ccc;
18
12
  &[data-header='true'] {
@@ -22,24 +16,23 @@ const TableRow = styled_1.default.div `
22
16
  border-top: 0;
23
17
  }
24
18
  `;
25
- const Group = styled_1.default.div `
19
+ const Group = styled.div `
26
20
  display: flex;
27
21
  flex-flow: column;
28
22
  width: 100%;
29
23
  `;
30
- const GroupTitle = styled_1.default.div `
24
+ const GroupTitle = styled.div `
31
25
  font-size: 1.5rem;
32
26
  `;
33
- const GroupWrap = styled_1.default.div `
27
+ const GroupWrap = styled.div `
34
28
  display: flex;
35
29
  flex-flow: column;
36
30
  `;
37
- const Table = ({ children, className, headerRow }) => {
38
- const grouped = (0, groupBy_1.groupByList)(children, (s) => s.groupTitle);
39
- return (react_1.default.createElement(Base, { className: className }, grouped.map((group) => (react_1.default.createElement(GroupWrap, { key: 'gk' + group.key },
40
- group.key && (react_1.default.createElement(GroupTitle, { key: `gt${group.key}` }, group.key)),
41
- react_1.default.createElement(Group, { key: `g${group.key}` },
42
- headerRow && (react_1.default.createElement(TableRow, { "data-header": "true", key: `headrow${group.key}` }, headerRow)),
43
- group.items.map((item) => (react_1.default.createElement(TableRow, { key: item.content.key }, item.content)))))))));
31
+ export const Table = ({ children, className, headerRow }) => {
32
+ const grouped = groupByList(children, (s) => s.groupTitle);
33
+ return (React.createElement(Base, { className: className }, grouped.map((group) => (React.createElement(GroupWrap, { key: 'gk' + group.key },
34
+ group.key && (React.createElement(GroupTitle, { key: `gt${group.key}` }, group.key)),
35
+ React.createElement(Group, { key: `g${group.key}` },
36
+ headerRow && (React.createElement(TableRow, { "data-header": "true", key: `headrow${group.key}` }, headerRow)),
37
+ group.items.map((item) => (React.createElement(TableRow, { key: item.content.key }, item.content)))))))));
44
38
  };
45
- exports.Table = Table;
@@ -1,59 +1,30 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
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 __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.CheckboxEdit = 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 Save_1 = require("../../icons/Save");
34
- const Undo_1 = require("../../icons/Undo");
35
- const common_1 = require("../../styles/common");
36
- const FlexRow_1 = require("../FlexRow");
37
- const common_2 = require("./common");
38
- const Icons = (0, styled_1.default)(FlexRow_1.FlexRow) `
1
+ import styled from '@emotion/styled';
2
+ import React, { useEffect, useRef, useState } from 'react';
3
+ import { useOnClickOutside } from '../../helpers/useOnClickOutside';
4
+ import { Save } from '../../icons/Save';
5
+ import { Undo } from '../../icons/Undo';
6
+ import { noDrag } from '../../styles/common';
7
+ import { FlexRow } from '../FlexRow';
8
+ import { IconD as Icon, iconLeft, iconRight, ValueBox, ValueInputCB, } from './common';
9
+ const Icons = styled(FlexRow) `
39
10
  position: absolute;
40
11
  top: 0;
41
12
  right: -2rem;
42
13
  `;
43
- const CheckboxEdit = ({ defaultValue, onSubmit, noGrow = false, allowUndo = true, }) => {
44
- const ref = (0, react_1.useRef)(null);
45
- const [value, setValue] = (0, react_1.useState)(defaultValue);
46
- (0, react_1.useEffect)(() => {
14
+ export const CheckboxEdit = ({ defaultValue, onSubmit, noGrow = false, allowUndo = true, }) => {
15
+ const ref = useRef(null);
16
+ const [value, setValue] = useState(defaultValue);
17
+ useEffect(() => {
47
18
  setValue(defaultValue);
48
19
  }, [defaultValue]);
49
20
  const valueChange = value !== defaultValue;
50
- (0, useOnClickOutside_1.useOnClickOutside)({ ref, moveMouseOutside: false }, () => {
21
+ useOnClickOutside({ ref, moveMouseOutside: false }, () => {
51
22
  if (valueChange) {
52
23
  onSubmit(value);
53
24
  }
54
25
  });
55
- return (react_1.default.createElement(common_2.ValueBox, Object.assign({}, common_1.noDrag, { ref: ref, "data-nogrow": noGrow }),
56
- react_1.default.createElement(common_2.ValueInputCB, { type: "checkbox", "data-type": "checkbox", checked: value, onChange: () => {
26
+ return (React.createElement(ValueBox, { ...noDrag, ref: ref, "data-nogrow": noGrow },
27
+ React.createElement(ValueInputCB, { type: "checkbox", "data-type": "checkbox", checked: value, onChange: () => {
57
28
  if (allowUndo) {
58
29
  setValue(!value);
59
30
  }
@@ -61,10 +32,9 @@ const CheckboxEdit = ({ defaultValue, onSubmit, noGrow = false, allowUndo = true
61
32
  onSubmit(!value);
62
33
  }
63
34
  }, onKeyDown: (e) => e.key === 'Enter' && value !== defaultValue && onSubmit(value) }),
64
- allowUndo && value !== defaultValue && (react_1.default.createElement(Icons, { center: true, enableOverflow: true },
65
- react_1.default.createElement(common_2.IconD, { style: common_2.iconLeft, onClick: () => value !== defaultValue && onSubmit(value) },
66
- react_1.default.createElement(Save_1.Save, null)),
67
- react_1.default.createElement(common_2.IconD, { style: common_2.iconRight, onClick: () => setValue(defaultValue) },
68
- react_1.default.createElement(Undo_1.Undo, null))))));
35
+ allowUndo && value !== defaultValue && (React.createElement(Icons, { center: true, enableOverflow: true },
36
+ React.createElement(Icon, { style: iconLeft, onClick: () => value !== defaultValue && onSubmit(value) },
37
+ React.createElement(Save, null)),
38
+ React.createElement(Icon, { style: iconRight, onClick: () => setValue(defaultValue) },
39
+ React.createElement(Undo, null))))));
69
40
  };
70
- exports.CheckboxEdit = CheckboxEdit;
@@ -1,52 +1,25 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
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 __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.ColourEdit = void 0;
27
- const react_1 = __importStar(require("react"));
28
- const useOnClickOutside_1 = require("../../helpers/useOnClickOutside");
29
- const Save_1 = require("../../icons/Save");
30
- const Undo_1 = require("../../icons/Undo");
31
- const common_1 = require("../../styles/common");
32
- const common_2 = require("./common");
33
- const ColourEdit = ({ defaultValue, onSubmit, }) => {
34
- const ref = (0, react_1.useRef)(null);
35
- const [value, setValue] = (0, react_1.useState)(defaultValue);
36
- (0, react_1.useEffect)(() => {
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import { useOnClickOutside } from '../../helpers/useOnClickOutside';
3
+ import { Save } from '../../icons/Save';
4
+ import { Undo } from '../../icons/Undo';
5
+ import { noDrag } from '../../styles/common';
6
+ import { IconD as Icon, iconLeft, iconRight, ValueBox } from './common';
7
+ export const ColourEdit = ({ defaultValue, onSubmit, }) => {
8
+ const ref = useRef(null);
9
+ const [value, setValue] = useState(defaultValue);
10
+ useEffect(() => {
37
11
  setValue(defaultValue);
38
12
  }, [defaultValue]);
39
13
  const valueChange = value !== defaultValue;
40
- (0, useOnClickOutside_1.useOnClickOutside)({ ref, moveMouseOutside: false }, () => {
14
+ useOnClickOutside({ ref, moveMouseOutside: false }, () => {
41
15
  if (valueChange) {
42
16
  onSubmit(value);
43
17
  }
44
18
  });
45
- return (react_1.default.createElement(common_2.ValueBox, Object.assign({}, common_1.noDrag, { ref: ref }),
46
- react_1.default.createElement("input", { type: "color", size: 5, value: value, onChange: (v) => setValue(v.target.value) }),
47
- value !== defaultValue && (react_1.default.createElement(common_2.IconD, { style: common_2.iconLeft, onClick: () => valueChange && onSubmit(value.trim()) },
48
- react_1.default.createElement(Save_1.Save, null))),
49
- valueChange && (react_1.default.createElement(common_2.IconD, { style: common_2.iconRight, onClick: () => setValue(defaultValue) },
50
- react_1.default.createElement(Undo_1.Undo, null)))));
19
+ return (React.createElement(ValueBox, { ...noDrag, ref: ref },
20
+ React.createElement("input", { type: "color", size: 5, value: value, onChange: (v) => setValue(v.target.value) }),
21
+ value !== defaultValue && (React.createElement(Icon, { style: iconLeft, onClick: () => valueChange && onSubmit(value.trim()) },
22
+ React.createElement(Save, null))),
23
+ valueChange && (React.createElement(Icon, { style: iconRight, onClick: () => setValue(defaultValue) },
24
+ React.createElement(Undo, null)))));
51
25
  };
52
- exports.ColourEdit = ColourEdit;
@@ -1,17 +1,11 @@
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.TextEditLengthBox = 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: absolute;
11
5
  bottom: 0.5rem;
12
6
  right: 0.5rem; */
13
7
  `;
14
- const TextEditLengthBox = ({ min, max, }) => {
8
+ export const TextEditLengthBox = ({ min, max, }) => {
15
9
  let color = 'black';
16
10
  if (min / max > 0.55) {
17
11
  color = 'indianred';
@@ -19,9 +13,8 @@ const TextEditLengthBox = ({ min, max, }) => {
19
13
  if (min === max) {
20
14
  color = 'red';
21
15
  }
22
- return (react_1.default.createElement(Base, { style: { color } },
16
+ return (React.createElement(Base, { style: { color } },
23
17
  min,
24
18
  "/",
25
19
  max));
26
20
  };
27
- exports.TextEditLengthBox = TextEditLengthBox;