ag-common 0.0.798 → 0.0.799

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 (170) hide show
  1. package/dist/ui/components/DarkMode/Base.js +6 -36
  2. package/dist/ui/components/index.d.ts +0 -33
  3. package/dist/ui/components/index.js +0 -33
  4. package/dist/ui/components/shadcn/button.d.ts +1 -1
  5. package/dist/ui/components/shadcn/dropdown-list.d.ts +13 -0
  6. package/dist/ui/components/shadcn/dropdown-list.js +57 -0
  7. package/dist/ui/components/shadcn/sheet.d.ts +1 -1
  8. package/dist/ui/icons/index.d.ts +1 -6
  9. package/dist/ui/icons/index.js +1 -4
  10. package/dist/ui/styles/common.d.ts +21 -14
  11. package/dist/ui/styles/common.js +44 -45
  12. package/dist/ui/styles/index.d.ts +0 -1
  13. package/dist/ui/styles/index.js +0 -1
  14. package/package.json +8 -13
  15. package/dist/ui/components/BarChart/Base.d.ts +0 -8
  16. package/dist/ui/components/BarChart/Base.js +0 -49
  17. package/dist/ui/components/BarChart/Item.d.ts +0 -12
  18. package/dist/ui/components/BarChart/Item.js +0 -38
  19. package/dist/ui/components/BarChart/Legend.d.ts +0 -8
  20. package/dist/ui/components/BarChart/Legend.js +0 -83
  21. package/dist/ui/components/BarChart/TooltipContent.d.ts +0 -8
  22. package/dist/ui/components/BarChart/TooltipContent.js +0 -51
  23. package/dist/ui/components/BarChart/getLegendItems.d.ts +0 -17
  24. package/dist/ui/components/BarChart/getLegendItems.js +0 -24
  25. package/dist/ui/components/BarChart/index.d.ts +0 -2
  26. package/dist/ui/components/BarChart/index.js +0 -17
  27. package/dist/ui/components/BarChart/types.d.ts +0 -9
  28. package/dist/ui/components/BarChart/types.js +0 -2
  29. package/dist/ui/components/BorderGradient/index.d.ts +0 -21
  30. package/dist/ui/components/BorderGradient/index.js +0 -77
  31. package/dist/ui/components/Chevron/index.d.ts +0 -12
  32. package/dist/ui/components/Chevron/index.js +0 -45
  33. package/dist/ui/components/Close/index.d.ts +0 -6
  34. package/dist/ui/components/Close/index.js +0 -41
  35. package/dist/ui/components/Confirm/Dialog.d.ts +0 -7
  36. package/dist/ui/components/Confirm/Dialog.js +0 -54
  37. package/dist/ui/components/Confirm/Modal.d.ts +0 -3
  38. package/dist/ui/components/Confirm/Modal.js +0 -53
  39. package/dist/ui/components/Confirm/index.d.ts +0 -3
  40. package/dist/ui/components/Confirm/index.js +0 -18
  41. package/dist/ui/components/Confirm/types.d.ts +0 -18
  42. package/dist/ui/components/Confirm/types.js +0 -2
  43. package/dist/ui/components/DropdownList/Base.d.ts +0 -3
  44. package/dist/ui/components/DropdownList/Base.js +0 -178
  45. package/dist/ui/components/DropdownList/Dialog.d.ts +0 -7
  46. package/dist/ui/components/DropdownList/Dialog.js +0 -54
  47. package/dist/ui/components/DropdownList/index.d.ts +0 -2
  48. package/dist/ui/components/DropdownList/index.js +0 -18
  49. package/dist/ui/components/DropdownList/types.d.ts +0 -37
  50. package/dist/ui/components/DropdownList/types.js +0 -2
  51. package/dist/ui/components/FlexColumn/index.d.ts +0 -3
  52. package/dist/ui/components/FlexColumn/index.js +0 -31
  53. package/dist/ui/components/FlexRow/index.d.ts +0 -3
  54. package/dist/ui/components/FlexRow/index.js +0 -37
  55. package/dist/ui/components/HorizontalScrollBar/index.d.ts +0 -5
  56. package/dist/ui/components/HorizontalScrollBar/index.js +0 -66
  57. package/dist/ui/components/Icon/index.d.ts +0 -31
  58. package/dist/ui/components/Icon/index.js +0 -69
  59. package/dist/ui/components/Image/index.d.ts +0 -13
  60. package/dist/ui/components/Image/index.js +0 -104
  61. package/dist/ui/components/InfiniteScroll/index.d.ts +0 -17
  62. package/dist/ui/components/InfiniteScroll/index.js +0 -99
  63. package/dist/ui/components/KebabDots/index.d.ts +0 -5
  64. package/dist/ui/components/KebabDots/index.js +0 -16
  65. package/dist/ui/components/LineChart/Base.d.ts +0 -3
  66. package/dist/ui/components/LineChart/Base.js +0 -121
  67. package/dist/ui/components/LineChart/LegendX.d.ts +0 -11
  68. package/dist/ui/components/LineChart/LegendX.js +0 -107
  69. package/dist/ui/components/LineChart/LegendY.d.ts +0 -7
  70. package/dist/ui/components/LineChart/LegendY.js +0 -44
  71. package/dist/ui/components/LineChart/TooltipContent.d.ts +0 -8
  72. package/dist/ui/components/LineChart/TooltipContent.js +0 -52
  73. package/dist/ui/components/LineChart/dateHelpers.d.ts +0 -3
  74. package/dist/ui/components/LineChart/dateHelpers.js +0 -36
  75. package/dist/ui/components/LineChart/getLegendItems.d.ts +0 -18
  76. package/dist/ui/components/LineChart/getLegendItems.js +0 -75
  77. package/dist/ui/components/LineChart/index.d.ts +0 -2
  78. package/dist/ui/components/LineChart/index.js +0 -17
  79. package/dist/ui/components/LineChart/interpolate.d.ts +0 -17
  80. package/dist/ui/components/LineChart/interpolate.js +0 -58
  81. package/dist/ui/components/LineChart/types.d.ts +0 -32
  82. package/dist/ui/components/LineChart/types.js +0 -2
  83. package/dist/ui/components/Loader/index.d.ts +0 -15
  84. package/dist/ui/components/Loader/index.js +0 -93
  85. package/dist/ui/components/MinSidebar/index.d.ts +0 -13
  86. package/dist/ui/components/MinSidebar/index.js +0 -93
  87. package/dist/ui/components/Modal/Dialog.d.ts +0 -8
  88. package/dist/ui/components/Modal/Dialog.js +0 -47
  89. package/dist/ui/components/Modal/Modal.d.ts +0 -7
  90. package/dist/ui/components/Modal/Modal.js +0 -178
  91. package/dist/ui/components/Modal/index.d.ts +0 -3
  92. package/dist/ui/components/Modal/index.js +0 -18
  93. package/dist/ui/components/Modal/types.d.ts +0 -16
  94. package/dist/ui/components/Modal/types.js +0 -2
  95. package/dist/ui/components/PieChart/index.d.ts +0 -11
  96. package/dist/ui/components/PieChart/index.js +0 -43
  97. package/dist/ui/components/ProgressBar/index.d.ts +0 -15
  98. package/dist/ui/components/ProgressBar/index.js +0 -96
  99. package/dist/ui/components/Prompt/Dialog.d.ts +0 -2
  100. package/dist/ui/components/Prompt/Dialog.js +0 -26
  101. package/dist/ui/components/Prompt/Modal.d.ts +0 -3
  102. package/dist/ui/components/Prompt/Modal.js +0 -111
  103. package/dist/ui/components/Prompt/index.d.ts +0 -3
  104. package/dist/ui/components/Prompt/index.js +0 -18
  105. package/dist/ui/components/Prompt/types.d.ts +0 -23
  106. package/dist/ui/components/Prompt/types.js +0 -2
  107. package/dist/ui/components/PulseRing/index.d.ts +0 -19
  108. package/dist/ui/components/PulseRing/index.js +0 -75
  109. package/dist/ui/components/RowOrColumn/index.d.ts +0 -15
  110. package/dist/ui/components/RowOrColumn/index.js +0 -46
  111. package/dist/ui/components/Search/AutoHideSearchBox.d.ts +0 -8
  112. package/dist/ui/components/Search/AutoHideSearchBox.js +0 -114
  113. package/dist/ui/components/Search/Dialog.d.ts +0 -7
  114. package/dist/ui/components/Search/Dialog.js +0 -60
  115. package/dist/ui/components/Search/Inline.d.ts +0 -3
  116. package/dist/ui/components/Search/Inline.js +0 -137
  117. package/dist/ui/components/Search/Modal.d.ts +0 -3
  118. package/dist/ui/components/Search/Modal.js +0 -28
  119. package/dist/ui/components/Search/SearchBox.d.ts +0 -16
  120. package/dist/ui/components/Search/SearchBox.js +0 -107
  121. package/dist/ui/components/Search/index.d.ts +0 -6
  122. package/dist/ui/components/Search/index.js +0 -21
  123. package/dist/ui/components/Search/types.d.ts +0 -49
  124. package/dist/ui/components/Search/types.js +0 -2
  125. package/dist/ui/components/Sidebar/index.d.ts +0 -11
  126. package/dist/ui/components/Sidebar/index.js +0 -194
  127. package/dist/ui/components/SparkLine/index.d.ts +0 -16
  128. package/dist/ui/components/SparkLine/index.js +0 -64
  129. package/dist/ui/components/TabBar/index.d.ts +0 -27
  130. package/dist/ui/components/TabBar/index.js +0 -100
  131. package/dist/ui/components/Table/index.d.ts +0 -11
  132. package/dist/ui/components/Table/index.js +0 -49
  133. package/dist/ui/components/TextEdit/CheckboxEdit.d.ts +0 -14
  134. package/dist/ui/components/TextEdit/CheckboxEdit.js +0 -104
  135. package/dist/ui/components/TextEdit/ColourEdit.d.ts +0 -5
  136. package/dist/ui/components/TextEdit/ColourEdit.js +0 -63
  137. package/dist/ui/components/TextEdit/LengthBox.d.ts +0 -5
  138. package/dist/ui/components/TextEdit/LengthBox.js +0 -28
  139. package/dist/ui/components/TextEdit/ListboxEdit.d.ts +0 -14
  140. package/dist/ui/components/TextEdit/ListboxEdit.js +0 -61
  141. package/dist/ui/components/TextEdit/TextEdit.d.ts +0 -3
  142. package/dist/ui/components/TextEdit/TextEdit.js +0 -145
  143. package/dist/ui/components/TextEdit/common.d.ts +0 -19
  144. package/dist/ui/components/TextEdit/common.js +0 -61
  145. package/dist/ui/components/TextEdit/index.d.ts +0 -5
  146. package/dist/ui/components/TextEdit/index.js +0 -20
  147. package/dist/ui/components/TextEdit/types.d.ts +0 -65
  148. package/dist/ui/components/TextEdit/types.js +0 -2
  149. package/dist/ui/components/TextWithButton/index.d.ts +0 -10
  150. package/dist/ui/components/TextWithButton/index.js +0 -89
  151. package/dist/ui/components/Timeline/index.d.ts +0 -22
  152. package/dist/ui/components/Timeline/index.js +0 -72
  153. package/dist/ui/components/TimelineChart/index.d.ts +0 -21
  154. package/dist/ui/components/TimelineChart/index.js +0 -63
  155. package/dist/ui/components/TreeChart/TooltipContent.d.ts +0 -7
  156. package/dist/ui/components/TreeChart/TooltipContent.js +0 -34
  157. package/dist/ui/components/TreeChart/base.d.ts +0 -3
  158. package/dist/ui/components/TreeChart/base.js +0 -144
  159. package/dist/ui/components/TreeChart/helpers.d.ts +0 -4
  160. package/dist/ui/components/TreeChart/helpers.js +0 -41
  161. package/dist/ui/components/TreeChart/index.d.ts +0 -2
  162. package/dist/ui/components/TreeChart/index.js +0 -17
  163. package/dist/ui/components/TreeChart/types.d.ts +0 -27
  164. package/dist/ui/components/TreeChart/types.js +0 -2
  165. package/dist/ui/components/UserImage/index.d.ts +0 -26
  166. package/dist/ui/components/UserImage/index.js +0 -109
  167. package/dist/ui/icons/CrossIcon.d.ts +0 -5
  168. package/dist/ui/icons/CrossIcon.js +0 -24
  169. package/dist/ui/styles/standaloneStyles.d.ts +0 -24
  170. package/dist/ui/styles/standaloneStyles.js +0 -69
@@ -1,61 +0,0 @@
1
- "use strict";
2
- 'use client';
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.iconLeft = exports.iconRight = exports.IconD = exports.ValueInputCB = exports.valueCss = exports.ValueBox = void 0;
8
- const react_1 = require("@emotion/react");
9
- const styled_1 = __importDefault(require("@emotion/styled"));
10
- const colours_1 = require("../../styles/colours");
11
- exports.ValueBox = styled_1.default.div `
12
- padding: 0.5rem;
13
-
14
- display: flex;
15
- position: relative;
16
- align-items: center;
17
- background-color: transparent;
18
-
19
- justify-content: flex-start;
20
- flex-grow: 1;
21
- width: calc(100% - 1rem - 2px); //padding + border
22
- border: solid 1px transparent;
23
-
24
- &[data-pointer='true'] {
25
- cursor: pointer;
26
- }
27
- &[data-nogrow='true'] {
28
- flex-grow: 0;
29
- }
30
- `;
31
- exports.valueCss = (0, react_1.css) `
32
- width: 100%;
33
- height: 100%;
34
- padding: 0;
35
- word-break: break-all;
36
- font-size: inherit;
37
- font-weight: inherit;
38
- font-family: inherit;
39
-
40
- &[data-type='checkbox'] {
41
- cursor: pointer;
42
- width: 1.5rem;
43
- height: 1.5rem;
44
- }
45
- `;
46
- exports.ValueInputCB = styled_1.default.input `
47
- ${exports.valueCss};
48
- `;
49
- exports.IconD = styled_1.default.div `
50
- z-index: 1;
51
- font-size: 1rem;
52
- width: 1.5rem;
53
- height: 1.5rem;
54
- position: absolute;
55
- cursor: pointer;
56
- svg {
57
- fill: ${colours_1.colours.notificationBlue};
58
- }
59
- `;
60
- exports.iconRight = { right: '0' };
61
- exports.iconLeft = { right: '1.5rem' };
@@ -1,5 +0,0 @@
1
- export * from './CheckboxEdit';
2
- export * from './ColourEdit';
3
- export * from './ListboxEdit';
4
- export * from './TextEdit';
5
- export type * from './types';
@@ -1,20 +0,0 @@
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("./CheckboxEdit"), exports);
18
- __exportStar(require("./ColourEdit"), exports);
19
- __exportStar(require("./ListboxEdit"), exports);
20
- __exportStar(require("./TextEdit"), exports);
@@ -1,65 +0,0 @@
1
- import type React from 'react';
2
- import type { JSX } from 'react';
3
- export interface IRefTextEdit {
4
- /** Set the internal value of the typed string. Can be used to clear externally */
5
- setValue: React.Dispatch<React.SetStateAction<string>>;
6
- getValue: () => string | undefined;
7
- focus: () => void;
8
- }
9
- export interface ITextEdit {
10
- /**
11
- * forces single row input style. will also enable 'Enter' to auto submit
12
- */
13
- singleLine?: boolean;
14
- className?: string;
15
- /**
16
- * default value of field. default empty
17
- */
18
- defaultValue?: string;
19
- /**
20
- * if truthy will enable text edit mode by default. if focus is true, will also focus on open
21
- */
22
- defaultEditing?: {
23
- focus?: boolean;
24
- };
25
- onSubmit: (val: string,
26
- /**
27
- * if true, was passed by pressing Enter
28
- */
29
- enterPressed: boolean) => void;
30
- /**
31
- * disable edit text functionality
32
- */
33
- disableEdit?: boolean;
34
- placeholder?: string;
35
- /**
36
- * when the user edits or unselects edit
37
- */
38
- onEditingChange?: (editing: boolean) => void;
39
- /**
40
- * if null will disable click outside
41
- */
42
- onClickOutsideWithNoValue?: (() => void) | null;
43
- onClickNotEditing?: () => void;
44
- /**
45
- * if true, will not grow. default false
46
- */
47
- noGrow?: boolean;
48
- /**
49
- * will set these attributes directly on element. can put data-* here
50
- */
51
- attributes?: Record<string, string | number | boolean>;
52
- /**
53
- * optional content at the left of the box
54
- */
55
- leftContent?: JSX.Element;
56
- /**
57
- * if true, will add undo button after changes. if false, will submit after every keypress. default true
58
- */
59
- allowUndo?: boolean;
60
- maxLength?: number;
61
- /**
62
- * if provided and return false, will cancel keydown
63
- */
64
- onKeyDown?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => boolean;
65
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- export interface ITextWithButton {
3
- /** default "Submit" */
4
- submitText?: string;
5
- placeholder?: string;
6
- /** if provided will validate and block submission accordingly */
7
- validateF?: (s: string) => boolean;
8
- onSubmit: (s: string) => void;
9
- }
10
- export declare const TextWithButton: ({ submitText, placeholder, validateF, onSubmit, }: ITextWithButton) => React.JSX.Element;
@@ -1,89 +0,0 @@
1
- "use strict";
2
- 'use client';
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || (function () {
20
- var ownKeys = function(o) {
21
- ownKeys = Object.getOwnPropertyNames || function (o) {
22
- var ar = [];
23
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
- return ar;
25
- };
26
- return ownKeys(o);
27
- };
28
- return function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
35
- })();
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.TextWithButton = void 0;
41
- const styled_1 = __importDefault(require("@emotion/styled"));
42
- const react_1 = __importStar(require("react"));
43
- const Base = styled_1.default.div `
44
- display: flex;
45
- flex-flow: row;
46
- max-height: 100%;
47
- `;
48
- const Input = styled_1.default.input `
49
- flex-grow: 1;
50
- border: solid 3px #ccc;
51
- border-right: 0;
52
- padding-left: 0.5rem;
53
- border-radius: 0.5rem 0 0 0.5rem;
54
- overflow: hidden;
55
- font-size: 1.2rem;
56
- &[data-valid='false'] {
57
- border-color: indianred;
58
- }
59
- outline: 0;
60
- `;
61
- const Button = styled_1.default.button `
62
- padding: 2rem;
63
- padding-top: 1rem;
64
- padding-bottom: 1rem;
65
- border: 0;
66
- display: flex;
67
- justify-content: center;
68
- align-items: center;
69
- background-color: rgb(136 119 227);
70
- color: white;
71
- font-weight: bold;
72
- border-radius: 0 0.5rem 0.5rem 0;
73
- overflow: hidden;
74
- user-select: none;
75
- cursor: pointer;
76
- &[data-valid='false'] {
77
- cursor: not-allowed;
78
- border-color: indianred;
79
- background-color: #ccc;
80
- }
81
- `;
82
- const TextWithButton = ({ submitText = 'Submit', placeholder, validateF, onSubmit, }) => {
83
- const [value, setValue] = (0, react_1.useState)('');
84
- const valid = !validateF ? true : validateF(value);
85
- return (react_1.default.createElement(Base, null,
86
- react_1.default.createElement(Input, { "data-type": "input", "data-valid": valid, placeholder: placeholder, value: value, onChange: (s) => setValue(s.target.value), onKeyDown: (e) => e.key === 'Enter' && valid && onSubmit(value) }),
87
- react_1.default.createElement(Button, { "data-type": "button", "data-valid": valid, disabled: !valid, onClick: () => valid && onSubmit(value) }, submitText)));
88
- };
89
- exports.TextWithButton = TextWithButton;
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- export type ITimelineItem = {
3
- key: string;
4
- title?: string;
5
- } & ({
6
- checked: true;
7
- } | {
8
- checked: false;
9
- disabled?: boolean;
10
- });
11
- export interface ITimeline {
12
- /** default min(5vw,3rem) */
13
- maxCircleSize?: string;
14
- /** default #ccc */
15
- lineColour?: string;
16
- items: ITimelineItem[];
17
- onClick?: (p: ITimelineItem) => void;
18
- className?: string;
19
- /** if true, will show titles under timeline. default true */
20
- showTitles?: boolean;
21
- }
22
- export declare const Timeline: ({ lineColour, items, onClick, maxCircleSize, className, showTitles, }: ITimeline) => React.JSX.Element;
@@ -1,72 +0,0 @@
1
- "use strict";
2
- 'use client';
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.Timeline = void 0;
8
- const styled_1 = __importDefault(require("@emotion/styled"));
9
- const react_1 = __importDefault(require("react"));
10
- const array_1 = require("../../../common/helpers/array");
11
- const icons_1 = require("../../icons");
12
- const Circle_1 = require("../../icons/Circle");
13
- const Icon_1 = require("../Icon");
14
- const Base = styled_1.default.div `
15
- width: 100%;
16
- overflow: hidden;
17
- background-color: inherit;
18
- `;
19
- const Row = styled_1.default.div `
20
- display: flex;
21
- flex-flow: row;
22
- align-items: center;
23
- justify-content: space-between;
24
- align-items: flex-start;
25
- position: relative;
26
- width: 100%;
27
- height: 100%;
28
- background-color: inherit;
29
- z-index: 0;
30
- `;
31
- const Line = styled_1.default.div `
32
- position: absolute;
33
- top: 45%;
34
- height: 10%;
35
- left: 1px;
36
- right: 1px;
37
- z-index: -1;
38
- `;
39
- const Item = styled_1.default.div `
40
- background-color: inherit;
41
- width: fit-content;
42
- height: 100%;
43
- display: flex;
44
- flex-flow: column;
45
- `;
46
- const Title = styled_1.default.span `
47
- text-align: center;
48
- `;
49
- const Timeline = ({ lineColour = '#ccc', items, onClick, maxCircleSize = 'min(5vw,3rem)', className, showTitles = true, }) => {
50
- const firstFalse = items.findIndex((i) => !i.checked && !i.disabled);
51
- const lastTrue = (0, array_1.findLastIndex)(items, (i) => i.checked);
52
- return (react_1.default.createElement(Base, { className: className },
53
- react_1.default.createElement(Row, null,
54
- react_1.default.createElement(Line, { style: { backgroundColor: lineColour } }),
55
- items.map((p, index) => {
56
- const enabled = index === lastTrue || index === firstFalse;
57
- let cursor = enabled ? 'pointer' : 'default';
58
- if (p.checked) {
59
- cursor = '';
60
- }
61
- return (react_1.default.createElement(Item, { key: p.key, title: p.title },
62
- react_1.default.createElement(Icon_1.Icon, { style: {
63
- maxWidth: maxCircleSize,
64
- cursor,
65
- }, onClick: () => enabled && (onClick === null || onClick === void 0 ? void 0 : onClick(p)) }, p.checked ? (react_1.default.createElement(icons_1.Checkmark, { style: { fill: '#60b515', backgroundColor: 'inherit' } })) : index !== firstFalse ? (react_1.default.createElement(Circle_1.Circle, { style: { fill: '#007cbb', backgroundColor: 'inherit' }, dotted: p.disabled })) : (react_1.default.createElement(icons_1.CircleDot, { style: { fill: '#007cbb', backgroundColor: 'inherit' } })))));
66
- })),
67
- showTitles && items.find((i) => i.title) && (react_1.default.createElement(Row, { style: { marginTop: '1rem' } }, items.map(({ title, key }) => (react_1.default.createElement(Title, { key: key, style: {
68
- width: `${100 / items.length}%`,
69
- maxWidth: maxCircleSize,
70
- } }, title || '')))))));
71
- };
72
- exports.Timeline = Timeline;
@@ -1,21 +0,0 @@
1
- import type { FC } from 'react';
2
- export interface ITimelineChartSeries {
3
- data: {
4
- x: number;
5
- y: number;
6
- }[];
7
- /** shown on page */
8
- label?: string;
9
- key: string;
10
- color: string;
11
- /** optional onclick href */
12
- onClick?: () => void;
13
- /** hover text */
14
- title?: string;
15
- }
16
- export interface ITimelineChart {
17
- series: ITimelineChartSeries[];
18
- strokeWidth?: number;
19
- className?: string;
20
- }
21
- export declare const TimelineChart: FC<ITimelineChart>;
@@ -1,63 +0,0 @@
1
- "use strict";
2
- 'use client';
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.TimelineChart = void 0;
8
- const styled_1 = __importDefault(require("@emotion/styled"));
9
- const react_1 = __importDefault(require("react"));
10
- const Base = styled_1.default.div `
11
- display: flex;
12
- flex-flow: column;
13
- justify-content: center;
14
- align-items: center;
15
- width: 100%;
16
- height: 100%;
17
- svg {
18
- overflow: initial;
19
- }
20
- `;
21
- const TimelineChart = ({ series, strokeWidth = 3, className, }) => {
22
- if (series.length === 0) {
23
- return react_1.default.createElement(Base, null);
24
- }
25
- const width = 600;
26
- const height = 200;
27
- const xValues = series.flatMap((s) => s.data.map((d) => d.x));
28
- const yValues = series.flatMap((s) => s.data.map((d) => d.y));
29
- const xMin = Math.min(...xValues);
30
- const xMax = Math.max(...xValues);
31
- const yMin = Math.min(...yValues);
32
- const yMax = Math.max(...yValues);
33
- const xScale = (x) => Math.ceil(width * ((x - xMin) / (xMax - xMin)));
34
- const yScale = (y) => {
35
- let ret = Math.ceil(height * ((yMax - y) / (yMax - yMin)));
36
- if (isNaN(ret)) {
37
- ret = y;
38
- }
39
- return ret;
40
- };
41
- const getPathData = ({ data }) => {
42
- const pd1 = data
43
- .sort((a, b) => (a.x < b.x ? -1 : 1))
44
- .map(({ x, y }) => {
45
- const xScaled = xScale(x);
46
- const yScaled = yScale(y);
47
- return { xScaled, yScaled };
48
- });
49
- const pathData = pd1.map(({ xScaled, yScaled }, i) => i === 0 ? `M${xScaled} ${yScaled}` : ` L${xScaled} ${yScaled}`);
50
- return pathData.join('\n');
51
- };
52
- return (react_1.default.createElement(Base, { className: className },
53
- react_1.default.createElement("svg", { viewBox: `0 -10 ${width} ${height + 20}` }, series.map(({ color, data, label, key, onClick, title }) => {
54
- var _a, _b, _c, _d;
55
- return (react_1.default.createElement("g", { key: key },
56
- react_1.default.createElement("title", null, title || label),
57
- react_1.default.createElement("path", { d: getPathData({ color, data, label, key }), fill: "none", stroke: color, strokeWidth: strokeWidth, onClick: () => onClick === null || onClick === void 0 ? void 0 : onClick(), style: { cursor: onClick ? 'pointer' : 'default' } }),
58
- label && (react_1.default.createElement(react_1.default.Fragment, null,
59
- react_1.default.createElement("text", { x: xScale((_a = data[0]) === null || _a === void 0 ? void 0 : _a.x) + strokeWidth * 2, y: yScale((_b = data[data.length - 1]) === null || _b === void 0 ? void 0 : _b.y), fontSize: "12", textAnchor: "middle", dominantBaseline: "middle", stroke: "white", strokeWidth: '3px' }, label),
60
- react_1.default.createElement("text", { x: xScale((_c = data[0]) === null || _c === void 0 ? void 0 : _c.x) + strokeWidth * 2, y: yScale((_d = data[data.length - 1]) === null || _d === void 0 ? void 0 : _d.y), fontSize: "12", textAnchor: "middle", dominantBaseline: "middle", fill: "black" }, label)))));
61
- }))));
62
- };
63
- exports.TimelineChart = TimelineChart;
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import type { TreeNodeData, TreeNodeOut } from './types';
3
- export declare const TooltipContent: ({ data, node, head, }: {
4
- data: TreeNodeData;
5
- node: TreeNodeOut;
6
- head: TreeNodeOut;
7
- }) => React.JSX.Element;
@@ -1,34 +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.TooltipContent = void 0;
7
- const styled_1 = __importDefault(require("@emotion/styled"));
8
- const react_1 = __importDefault(require("react"));
9
- const Base = styled_1.default.div `
10
- padding: 0.5rem;
11
- border: solid 1px black;
12
- background-color: white;
13
- color: black;
14
- `;
15
- const Title = styled_1.default.div `
16
- font-weight: bold;
17
- `;
18
- const TooltipContent = ({ data, node, head, }) => {
19
- var _a;
20
- let rows = [];
21
- let n = node;
22
- while (n) {
23
- const t = ((_a = data.titleFn) === null || _a === void 0 ? void 0 : _a.call(data, {
24
- path: n.name,
25
- pathCount: n.size,
26
- fullCount: head.size,
27
- })) || `${n.name} (${n.size}/${head.size})`;
28
- rows = [t, ...rows];
29
- n = n.parent;
30
- }
31
- return (react_1.default.createElement(Base, null,
32
- react_1.default.createElement(Title, null, rows.map((r, i) => (react_1.default.createElement("div", { key: r, style: { marginLeft: `${i * 2}px` } }, r))))));
33
- };
34
- exports.TooltipContent = TooltipContent;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import type { TreeNodeData } from './types';
3
- export declare const TreeChart: (tnd: TreeNodeData) => React.JSX.Element;
@@ -1,144 +0,0 @@
1
- "use strict";
2
- 'use client';
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || (function () {
20
- var ownKeys = function(o) {
21
- ownKeys = Object.getOwnPropertyNames || function (o) {
22
- var ar = [];
23
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
- return ar;
25
- };
26
- return ownKeys(o);
27
- };
28
- return function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
35
- })();
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.TreeChart = void 0;
41
- const styled_1 = __importDefault(require("@emotion/styled"));
42
- const react_1 = __importStar(require("react"));
43
- const useResize_1 = require("../../helpers/useResize");
44
- const useTooltip_1 = require("../../helpers/useTooltip");
45
- const styles_1 = require("../../styles");
46
- const common_1 = require("../../styles/common");
47
- const helpers_1 = require("./helpers");
48
- const TooltipContent_1 = require("./TooltipContent");
49
- const Base = styled_1.default.div `
50
- border: solid 1px #ccc;
51
- max-height: 100%;
52
- overflow-y: auto;
53
- `;
54
- const NodeChildren = styled_1.default.div `
55
- display: flex;
56
- flex-flow: row wrap;
57
- justify-content: center;
58
- `;
59
- const Node = styled_1.default.div `
60
- margin: 1px;
61
- padding: 2px;
62
- display: flex;
63
- flex-flow: column;
64
- height: min-content;
65
- overflow: hidden;
66
- &[data-leaf='true'] {
67
- width: 100%;
68
- height: 100%;
69
- min-height: 1rem;
70
- min-width: 1rem;
71
- max-width: 10rem;
72
- max-height: 10rem;
73
- }
74
- `;
75
- const Title = styled_1.default.div `
76
- color: white;
77
- word-break: break-all;
78
- ${(0, common_1.HardOutline)('black')};
79
- ${(0, common_1.TextOverflowEllipsis)(1)};
80
- min-height: 1rem;
81
- line-height: 1rem;
82
- `;
83
- const Render = ({ n, depth, head, headDim, tnd, UT, }) => {
84
- const children = Object.values(n.children);
85
- const leaf = children.length === 0;
86
- const sizeMult = n.size / head.size;
87
- const biggerDim = Math.max(headDim.width, headDim.height);
88
- const nodeSize = Math.floor(biggerDim * sizeMult).toString();
89
- return (react_1.default.createElement(Node, { "data-treenode": true, "data-leaf": leaf.toString(), style: Object.assign({ backgroundColor: (0, styles_1.getColourWheel)(depth) }, (leaf &&
90
- nodeSize && {
91
- width: nodeSize + 'px',
92
- height: nodeSize + 'px',
93
- })), key: n.name, "data-ch": n.children.length, "data-size": n.size, onMouseLeave: () => UT.setPos(undefined), onMouseMove: (element) => {
94
- UT.setPos({
95
- element,
96
- parent: null,
97
- data: { data: tnd, node: n, head },
98
- });
99
- element.preventDefault();
100
- element.stopPropagation();
101
- } },
102
- n.name && react_1.default.createElement(Title, null, n.name),
103
- children.length > 0 && (react_1.default.createElement(NodeChildren, { "data-type": "nc" }, children.map((c) => Render({
104
- UT,
105
- n: c,
106
- depth: depth + 1,
107
- head,
108
- headDim,
109
- tnd,
110
- }))))));
111
- };
112
- const TreeChart = (tnd) => {
113
- const UT = (0, useTooltip_1.useTooltip)();
114
- const head = (0, helpers_1.convertToRaw)({ tnd });
115
- const pd = (0, useResize_1.useResize)();
116
- const [headDim, setHeadDim] = (0, react_1.useState)();
117
- const r = (0, react_1.useRef)(null);
118
- (0, react_1.useEffect)(() => {
119
- if (!r.current) {
120
- return;
121
- }
122
- const width = r.current.clientWidth;
123
- const height = r.current.clientHeight || r.current.clientWidth;
124
- setHeadDim({
125
- width,
126
- height,
127
- });
128
- }, [pd]);
129
- if (head.size === 0) {
130
- return react_1.default.createElement("div", null);
131
- }
132
- return (react_1.default.createElement(Base, { ref: r, className: tnd.className, style: tnd.style },
133
- react_1.default.createElement(UT.Comp, { pos: UT.pos }, ({ data }) => react_1.default.createElement(TooltipContent_1.TooltipContent, Object.assign({}, data))),
134
- headDim &&
135
- Render({
136
- UT,
137
- tnd,
138
- n: head,
139
- depth: 0,
140
- head,
141
- headDim,
142
- })));
143
- };
144
- exports.TreeChart = TreeChart;
@@ -1,4 +0,0 @@
1
- import type { TreeNodeData, TreeNodeOut } from './types';
2
- export declare const convertToRaw: ({ tnd: { data, pathDelimiter }, }: {
3
- tnd: TreeNodeData;
4
- }) => TreeNodeOut;