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,17 +0,0 @@
1
- import type { ILineChartItemRaw } from './types';
2
- interface ILineChartItemComp {
3
- x1: number;
4
- x2: number;
5
- y1: number;
6
- y2: number;
7
- name: string;
8
- origX: number;
9
- origY: number;
10
- isToday: boolean;
11
- isLast: boolean;
12
- }
13
- export declare const interpolate: (raw: ILineChartItemRaw[]) => {
14
- points: ILineChartItemComp[];
15
- xTime: boolean;
16
- };
17
- export {};
@@ -1,58 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.interpolate = void 0;
4
- const common_1 = require("../../../common");
5
- const math_1 = require("../../../common/helpers/math");
6
- const date_1 = require("../../helpers/date");
7
- const dateHelpers_1 = require("./dateHelpers");
8
- const interpolate = (raw) => {
9
- const points = [];
10
- const xs = raw.map((r) => r.x);
11
- const ys = raw.map((r) => r.y);
12
- const xMin = Math.min(...xs);
13
- const xMax = Math.max(...xs);
14
- const yMin = Math.min(...ys);
15
- const yMax = Math.max(...ys);
16
- let xTime = true;
17
- (0, common_1.groupByList)(raw.sort((a, b) => (a.x < b.x ? -1 : 1)), (a) => a.name).map(({ items }) => {
18
- const p = items.map((p, i) => {
19
- if (xTime && !(0, date_1.isDate)(p.x)) {
20
- xTime = false;
21
- }
22
- const x1 = (0, math_1.rangePercentage)({
23
- value: i === 0 ? p.x : items[i - 1].x,
24
- min: xMin,
25
- max: xMax,
26
- }) * 100;
27
- const x2 = (0, math_1.rangePercentage)({
28
- value: p.x,
29
- min: xMin,
30
- max: xMax,
31
- }) * 100;
32
- const y1 = (0, math_1.rangePercentage)({
33
- value: i === 0 ? p.y : items[i - 1].y,
34
- min: yMin,
35
- max: yMax,
36
- }) * 100;
37
- const y2 = (0, math_1.rangePercentage)({
38
- value: p.y,
39
- min: yMin,
40
- max: yMax,
41
- }) * 100;
42
- return {
43
- x1,
44
- x2,
45
- y1,
46
- y2,
47
- name: p.name,
48
- origX: p.x,
49
- origY: p.y,
50
- isToday: (0, dateHelpers_1.isToday)(p.x),
51
- isLast: i === items.length - 1,
52
- };
53
- });
54
- points.push(...(0, common_1.distinctBy)(p, (s) => JSON.stringify(s)));
55
- });
56
- return { points, xTime };
57
- };
58
- exports.interpolate = interpolate;
@@ -1,32 +0,0 @@
1
- import type { IVarStyles } from '../../styles/common';
2
- export type ILineChartItemRaw = {
3
- x: number;
4
- y: number;
5
- name: string;
6
- /** Optional display name used for legend/tooltip grouping */
7
- legendName?: string;
8
- };
9
- export interface ILineChartState {
10
- selectedPoints?: {
11
- x: number;
12
- y: number;
13
- }[];
14
- selectedXs?: ILineChartItemRaw[];
15
- }
16
- export interface ILineChartTooltip extends ILineChartState {
17
- tt: (a: number) => string;
18
- lt: (a: number) => string;
19
- data: ILineChartItemRaw[];
20
- colours: Record<string, string>;
21
- }
22
- export interface ILineChart {
23
- data: ILineChartItemRaw[];
24
- /** Optional dataset used only for legend/tooltip calculations */
25
- legendData?: ILineChartItemRaw[];
26
- className?: string;
27
- /** name -> colour */
28
- colours: Record<string, string>;
29
- tooltipTitle?: (a: number) => string;
30
- legendTitle?: (a: number) => string;
31
- style?: Partial<IVarStyles>;
32
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- export interface ILoader {
3
- /**
4
- * default 2rem
5
- */
6
- width?: string | null;
7
- /**
8
- * default 2rem
9
- */
10
- height?: string | null;
11
- name: string;
12
- /** position for loader. default full page takeover */
13
- position?: 'abs' | 'br';
14
- }
15
- export declare const Loader: ({ name, height, width, position, }: ILoader) => React.JSX.Element;
@@ -1,93 +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.Loader = 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
- border: 16px solid #f3f3f3; /* Light grey */
45
- border-top: 16px solid #3498db; /* Blue */
46
- border-radius: 50%;
47
- animation: spin 2s linear infinite;
48
- padding: 2px;
49
- overflow: hidden;
50
-
51
- @keyframes spin {
52
- 0% {
53
- transform: rotate(0deg);
54
- }
55
- 100% {
56
- transform: rotate(360deg);
57
- }
58
- }
59
- `;
60
- const LoadingBack = styled_1.default.div `
61
- position: absolute;
62
- &[data-type='abs'] {
63
- top: 0;
64
- left: 0;
65
- right: 0;
66
- bottom: 0;
67
- }
68
- &[data-type='br'] {
69
- bottom: 1rem;
70
- right: 1rem;
71
- top: auto;
72
- }
73
-
74
- display: flex;
75
- justify-content: center;
76
- align-items: center;
77
- z-index: 100;
78
- background-color: transparent;
79
- opacity: 1;
80
- &[data-transparent='true'] {
81
- opacity: 0.1;
82
- }
83
- transition: opacity 5s;
84
- `;
85
- const Loader = ({ name, height = '2rem', width = '2rem', position = 'abs', }) => {
86
- const [trans, setTrans] = (0, react_1.useState)(true);
87
- (0, react_1.useEffect)(() => {
88
- setTrans(false);
89
- }, []);
90
- return (react_1.default.createElement(LoadingBack, { "data-loading": name, "data-transparent": trans, "data-type": position },
91
- react_1.default.createElement(Base, { style: { height: height, width: width } })));
92
- };
93
- exports.Loader = Loader;
@@ -1,13 +0,0 @@
1
- import type { CSSProperties } from 'react';
2
- import React from 'react';
3
- export interface IMinSidebar {
4
- children: ({ open, }: {
5
- /** can make sidebar contents smaller when open=false */
6
- open: boolean;
7
- }) => React.ReactNode;
8
- className?: string;
9
- /** default white */
10
- chevronColour?: string;
11
- style?: CSSProperties;
12
- }
13
- export declare const MinSidebar: ({ chevronColour, children, className, style, }: IMinSidebar) => React.JSX.Element;
@@ -1,93 +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.MinSidebar = void 0;
41
- const styled_1 = __importDefault(require("@emotion/styled"));
42
- const react_1 = __importStar(require("react"));
43
- const helpers_1 = require("../../helpers");
44
- const common_1 = require("../../styles/common");
45
- const media_1 = require("../../styles/media");
46
- const Chevron_1 = require("../Chevron");
47
- const Icon_1 = require("../Icon");
48
- const Base = styled_1.default.div `
49
- position: sticky;
50
- top: 0;
51
- border-right: solid 1px #ccc;
52
- height: 100%;
53
- ${common_1.NoTextSelect};
54
- width: fit-content;
55
- `;
56
- const Content = styled_1.default.div `
57
- display: flex;
58
- flex-flow: column;
59
- width: 100%;
60
- height: 100%;
61
- > div {
62
- flex-basis: 100%;
63
- }
64
- `;
65
- const OpenIcon = (0, styled_1.default)(Icon_1.Icon) `
66
- width: 2rem;
67
- height: 2rem;
68
- margin: 0.5rem;
69
- margin-left: auto;
70
- `;
71
- const ChevronStyled = (0, styled_1.default)(Chevron_1.Chevron) `
72
- svg {
73
- fill: #555;
74
- }
75
- `;
76
- const MinSidebar = ({ chevronColour, children, className, style, }) => {
77
- const ref = (0, react_1.useRef)(null);
78
- const [open, setOpen] = (0, react_1.useState)(false);
79
- (0, helpers_1.useOnClickOutside)({ ref, disabled: () => !open || window.innerWidth > media_1.smallScreenPx }, () => {
80
- setOpen(false);
81
- });
82
- return (react_1.default.createElement(Base, { style: style, "data-type": "sidebar", className: className, "data-open": open, onClick: () => !open && setOpen(true), ref: ref },
83
- react_1.default.createElement(Content, { "data-type": "content", "data-open": open, onClick: (e) => {
84
- e.stopPropagation();
85
- } },
86
- react_1.default.createElement(OpenIcon, { onClick: (e) => {
87
- e.stopPropagation();
88
- setOpen(!open);
89
- } },
90
- react_1.default.createElement(ChevronStyled, { "data-open": open, point: open ? 'left' : 'right', width: "100%", colour: chevronColour !== null && chevronColour !== void 0 ? chevronColour : 'white' })),
91
- children({ open }))));
92
- };
93
- exports.MinSidebar = MinSidebar;
@@ -1,8 +0,0 @@
1
- import type { CSSProperties } from 'react';
2
- import React from 'react';
3
- export declare const ModalDialog: (content: React.ReactNode | ((p: {
4
- close: () => void;
5
- }) => React.ReactNode), opt?: {
6
- style?: CSSProperties;
7
- portalId?: string;
8
- }) => Promise<string | undefined>;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.ModalDialog = void 0;
16
- const react_1 = __importDefault(require("react"));
17
- const client_1 = require("react-dom/client");
18
- const Modal_1 = require("./Modal");
19
- const ModalDialog = (content, opt) => __awaiter(void 0, void 0, void 0, function* () {
20
- return new Promise((res) => {
21
- const wrapper = document.body.appendChild(document.createElement('div'));
22
- const root = (0, client_1.createRoot)(wrapper);
23
- const onClose = () => {
24
- try {
25
- root.unmount();
26
- wrapper.remove();
27
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
28
- }
29
- catch (e) {
30
- //
31
- }
32
- };
33
- root.render(react_1.default.createElement(Modal_1.Modal, { open: true, setOpen: (o) => {
34
- if (!o) {
35
- onClose();
36
- }
37
- res('ok');
38
- }, topPosition: "center", position: "center", style: opt === null || opt === void 0 ? void 0 : opt.style }, typeof content !== 'function'
39
- ? content
40
- : content({
41
- close: () => {
42
- onClose();
43
- },
44
- })));
45
- });
46
- });
47
- exports.ModalDialog = ModalDialog;
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import type { IModal } from './types';
3
- export declare const ModalItem: import("@emotion/styled").StyledComponent<{
4
- theme?: import("@emotion/react").Theme;
5
- as?: React.ElementType;
6
- }, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
7
- export declare const Modal: (p: IModal) => React.JSX.Element | null;
@@ -1,178 +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.Modal = exports.ModalItem = void 0;
41
- const styled_1 = __importDefault(require("@emotion/styled"));
42
- const react_1 = __importStar(require("react"));
43
- const react_dom_1 = require("react-dom");
44
- const dom_1 = require("../../helpers/dom");
45
- const useLockBodyScroll_1 = require("../../helpers/useLockBodyScroll");
46
- const useOnClickOutside_1 = require("../../helpers/useOnClickOutside");
47
- const styles_1 = require("../../styles");
48
- const Close_1 = require("../Close");
49
- const globalId = 'ag-modal-portal';
50
- const FixedBackground = styled_1.default.div `
51
- position: fixed;
52
- top: 0;
53
- left: 0;
54
- width: 100%;
55
- height: 100%;
56
- background-color: rgba(0, 0, 0, 0.5);
57
- z-index: 2;
58
- display: flex;
59
- justify-content: center;
60
- align-items: center;
61
- `;
62
- const ModalBase = styled_1.default.div `
63
- display: flex;
64
- position: absolute;
65
- z-index: 1;
66
- background-color: white;
67
- border: solid 1px transparent;
68
- border-radius: 0.5rem;
69
- box-shadow:
70
- 0 1px 10px 0 rgba(0, 0, 0, 0.6),
71
- 0 2px 15px 0 rgba(0, 0, 0, 0.05);
72
- max-width: 95vw;
73
- max-height: 95vh;
74
- overflow: hidden;
75
- &[data-position='left'] {
76
- left: 0;
77
- }
78
- &[data-position='right'] {
79
- right: 0;
80
- }
81
- &[data-topposition='top'] {
82
- top: 0;
83
- }
84
- &[data-topposition='bottom'] {
85
- bottom: 0;
86
- }
87
- ${(0, styles_1.bounce)('data-bounced')}
88
- `;
89
- exports.ModalItem = styled_1.default.div `
90
- display: flex;
91
- padding: 1rem;
92
-
93
- &:hover {
94
- background-color: #eee;
95
- }
96
- `;
97
- const CloseStyled = (0, styled_1.default)(Close_1.Close) `
98
- z-index: 1;
99
- `;
100
- const Modal = (p) => {
101
- const { open, setOpen, children, position = 'left', topPosition = 'top', showCloseButton = true, closeOnMoveMouseOutside = false, className, closeOnClickOutside = true, portalId: pidraw, style, } = p;
102
- let portalId = pidraw;
103
- if (portalId === undefined) {
104
- portalId = globalId;
105
- }
106
- (0, useLockBodyScroll_1.useLockBodyScroll)(p.open);
107
- const [portalElem, setPortalElem] = (0, react_1.useState)();
108
- (0, react_1.useEffect)(() => {
109
- if (portalId === null ||
110
- document.querySelectorAll(`#${portalId}`).length > 0) {
111
- return;
112
- }
113
- const d = document.createElement('div');
114
- d.id = portalId;
115
- d.style.position = 'fixed';
116
- d.style.zIndex = '10';
117
- document.body.appendChild(d);
118
- return () => {
119
- var _a;
120
- try {
121
- (_a = document.querySelector(`#${portalId}`)) === null || _a === void 0 ? void 0 : _a.remove();
122
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
123
- }
124
- catch (e) {
125
- //
126
- }
127
- };
128
- // eslint-disable-next-line react-hooks/exhaustive-deps
129
- }, []);
130
- const [bounced, setBounced] = (0, react_1.useState)(false);
131
- const ref = (0, react_1.useRef)(null);
132
- (0, useOnClickOutside_1.useOnClickOutside)({
133
- disabled: !open,
134
- ref,
135
- moveMouseOutside: closeOnMoveMouseOutside,
136
- }, (e) => {
137
- var _a;
138
- //there might be multiple models open, only close the last one on the stack
139
- if (portalElem) {
140
- const myid = Array.prototype.indexOf.call(portalElem.children,
141
- //parent because fixed background is first
142
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.parentElement);
143
- const childcount = portalElem.children.length;
144
- if (myid + 1 !== childcount) {
145
- return;
146
- }
147
- }
148
- if (closeOnClickOutside && open) {
149
- setOpen(false, e);
150
- setBounced(false);
151
- }
152
- });
153
- (0, react_1.useEffect)(() => {
154
- if (!bounced && open) {
155
- setBounced(true);
156
- }
157
- }, [open, bounced]);
158
- (0, react_1.useEffect)(() => {
159
- if (portalElem === undefined && portalId) {
160
- setPortalElem(document.getElementById(portalId));
161
- }
162
- }, [portalElem, portalId]);
163
- if (!open) {
164
- return react_1.default.createElement(react_1.default.Fragment, null);
165
- }
166
- const Content = (react_1.default.createElement(FixedBackground, null,
167
- react_1.default.createElement(ModalBase, Object.assign({}, (0, dom_1.filterDataProps)(p), { "data-bounced": bounced, "data-position": position, "data-topposition": topPosition, ref: ref, className: className, style: style }),
168
- showCloseButton && (react_1.default.createElement(CloseStyled, { "data-type": "modal-close", onClick: (e) => setOpen(false, e) })),
169
- children)));
170
- if (portalId && portalElem === undefined) {
171
- return null;
172
- }
173
- if (portalId && portalElem) {
174
- return (0, react_dom_1.createPortal)(Content, portalElem);
175
- }
176
- return Content;
177
- };
178
- exports.Modal = Modal;
@@ -1,3 +0,0 @@
1
- export * from './Dialog';
2
- export * from './Modal';
3
- export type * from './types';
@@ -1,18 +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("./Dialog"), exports);
18
- __exportStar(require("./Modal"), exports);
@@ -1,16 +0,0 @@
1
- import type { CSSProperties } from 'react';
2
- export interface IModal {
3
- open: boolean;
4
- setOpen: (b: boolean, e: Event) => void;
5
- children: React.ReactNode;
6
- position?: 'left' | 'right' | 'center';
7
- topPosition?: 'bottom' | 'top' | 'center';
8
- showCloseButton?: boolean;
9
- closeOnMoveMouseOutside?: boolean;
10
- className?: string;
11
- closeOnClickOutside?: boolean;
12
- /** if provided, will create inside this #id. default "ag-modal-portal". if null, wont use global id */
13
- portalId?: string | null;
14
- /**applied to modal inside fixed */
15
- style?: CSSProperties;
16
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- export interface IPieChartData {
3
- label: string;
4
- value: number;
5
- color: string;
6
- }
7
- export interface IPieChart {
8
- data: IPieChartData[];
9
- className?: string;
10
- }
11
- export declare const PieChart: React.FC<IPieChart>;
@@ -1,43 +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.PieChart = 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
- width: 100%;
12
- height: 100%;
13
- `;
14
- const PieChart = ({ data, className }) => {
15
- const total = data.reduce((sum, { value }) => sum + value, 0);
16
- const width = 500;
17
- const height = 500;
18
- const centerX = width / 2;
19
- const centerY = height / 2;
20
- const radius = Math.min(width, height) / 2;
21
- let cumulativeAngle = 0;
22
- return (react_1.default.createElement(Base, { className: className },
23
- react_1.default.createElement("svg", { viewBox: `0 0 ${width} ${height}` }, data.map(({ label, value, color }) => {
24
- const angle = (value / total) * 360;
25
- const startX = centerX + radius * Math.cos((cumulativeAngle * Math.PI) / 180);
26
- const startY = centerY + radius * Math.sin((cumulativeAngle * Math.PI) / 180);
27
- const endX = centerX +
28
- radius * Math.cos(((cumulativeAngle + angle) * Math.PI) / 180);
29
- const endY = centerY +
30
- radius * Math.sin(((cumulativeAngle + angle) * Math.PI) / 180);
31
- const largeArcFlag = angle > 180 ? 1 : 0;
32
- const midAngle = cumulativeAngle + angle / 2;
33
- const midX = centerX + radius * 0.75 * Math.cos((midAngle * Math.PI) / 180);
34
- const midY = centerY + radius * 0.75 * Math.sin((midAngle * Math.PI) / 180);
35
- cumulativeAngle += angle;
36
- return (react_1.default.createElement("g", { key: label },
37
- react_1.default.createElement("title", null, `${label}: ${value}`),
38
- react_1.default.createElement("path", { d: `M ${startX} ${startY} A ${radius} ${radius} 0 ${largeArcFlag} 1 ${endX} ${endY} L ${centerX} ${centerY} Z`, fill: color }),
39
- react_1.default.createElement("text", { x: midX, y: midY, textAnchor: "middle", alignmentBaseline: "middle", stroke: "white", strokeWidth: "6px" }, label),
40
- react_1.default.createElement("text", { x: midX, y: midY, textAnchor: "middle", alignmentBaseline: "middle", fill: "black" }, label)));
41
- }))));
42
- };
43
- exports.PieChart = PieChart;