ag-common 0.0.797 → 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 (171) hide show
  1. package/dist/ui/components/DarkMode/Base.js +6 -36
  2. package/dist/ui/components/Markdown/index.js +4 -29
  3. package/dist/ui/components/index.d.ts +0 -33
  4. package/dist/ui/components/index.js +0 -33
  5. package/dist/ui/components/shadcn/button.d.ts +1 -1
  6. package/dist/ui/components/shadcn/dropdown-list.d.ts +13 -0
  7. package/dist/ui/components/shadcn/dropdown-list.js +57 -0
  8. package/dist/ui/components/shadcn/sheet.d.ts +1 -1
  9. package/dist/ui/icons/index.d.ts +1 -6
  10. package/dist/ui/icons/index.js +1 -4
  11. package/dist/ui/styles/common.d.ts +21 -14
  12. package/dist/ui/styles/common.js +44 -45
  13. package/dist/ui/styles/index.d.ts +0 -1
  14. package/dist/ui/styles/index.js +0 -1
  15. package/package.json +8 -13
  16. package/dist/ui/components/BarChart/Base.d.ts +0 -8
  17. package/dist/ui/components/BarChart/Base.js +0 -49
  18. package/dist/ui/components/BarChart/Item.d.ts +0 -12
  19. package/dist/ui/components/BarChart/Item.js +0 -38
  20. package/dist/ui/components/BarChart/Legend.d.ts +0 -8
  21. package/dist/ui/components/BarChart/Legend.js +0 -83
  22. package/dist/ui/components/BarChart/TooltipContent.d.ts +0 -8
  23. package/dist/ui/components/BarChart/TooltipContent.js +0 -51
  24. package/dist/ui/components/BarChart/getLegendItems.d.ts +0 -17
  25. package/dist/ui/components/BarChart/getLegendItems.js +0 -24
  26. package/dist/ui/components/BarChart/index.d.ts +0 -2
  27. package/dist/ui/components/BarChart/index.js +0 -17
  28. package/dist/ui/components/BarChart/types.d.ts +0 -9
  29. package/dist/ui/components/BarChart/types.js +0 -2
  30. package/dist/ui/components/BorderGradient/index.d.ts +0 -21
  31. package/dist/ui/components/BorderGradient/index.js +0 -77
  32. package/dist/ui/components/Chevron/index.d.ts +0 -12
  33. package/dist/ui/components/Chevron/index.js +0 -45
  34. package/dist/ui/components/Close/index.d.ts +0 -6
  35. package/dist/ui/components/Close/index.js +0 -41
  36. package/dist/ui/components/Confirm/Dialog.d.ts +0 -7
  37. package/dist/ui/components/Confirm/Dialog.js +0 -54
  38. package/dist/ui/components/Confirm/Modal.d.ts +0 -3
  39. package/dist/ui/components/Confirm/Modal.js +0 -53
  40. package/dist/ui/components/Confirm/index.d.ts +0 -3
  41. package/dist/ui/components/Confirm/index.js +0 -18
  42. package/dist/ui/components/Confirm/types.d.ts +0 -18
  43. package/dist/ui/components/Confirm/types.js +0 -2
  44. package/dist/ui/components/DropdownList/Base.d.ts +0 -3
  45. package/dist/ui/components/DropdownList/Base.js +0 -178
  46. package/dist/ui/components/DropdownList/Dialog.d.ts +0 -7
  47. package/dist/ui/components/DropdownList/Dialog.js +0 -54
  48. package/dist/ui/components/DropdownList/index.d.ts +0 -2
  49. package/dist/ui/components/DropdownList/index.js +0 -18
  50. package/dist/ui/components/DropdownList/types.d.ts +0 -37
  51. package/dist/ui/components/DropdownList/types.js +0 -2
  52. package/dist/ui/components/FlexColumn/index.d.ts +0 -3
  53. package/dist/ui/components/FlexColumn/index.js +0 -31
  54. package/dist/ui/components/FlexRow/index.d.ts +0 -3
  55. package/dist/ui/components/FlexRow/index.js +0 -37
  56. package/dist/ui/components/HorizontalScrollBar/index.d.ts +0 -5
  57. package/dist/ui/components/HorizontalScrollBar/index.js +0 -66
  58. package/dist/ui/components/Icon/index.d.ts +0 -31
  59. package/dist/ui/components/Icon/index.js +0 -69
  60. package/dist/ui/components/Image/index.d.ts +0 -13
  61. package/dist/ui/components/Image/index.js +0 -104
  62. package/dist/ui/components/InfiniteScroll/index.d.ts +0 -17
  63. package/dist/ui/components/InfiniteScroll/index.js +0 -99
  64. package/dist/ui/components/KebabDots/index.d.ts +0 -5
  65. package/dist/ui/components/KebabDots/index.js +0 -16
  66. package/dist/ui/components/LineChart/Base.d.ts +0 -3
  67. package/dist/ui/components/LineChart/Base.js +0 -121
  68. package/dist/ui/components/LineChart/LegendX.d.ts +0 -11
  69. package/dist/ui/components/LineChart/LegendX.js +0 -107
  70. package/dist/ui/components/LineChart/LegendY.d.ts +0 -7
  71. package/dist/ui/components/LineChart/LegendY.js +0 -44
  72. package/dist/ui/components/LineChart/TooltipContent.d.ts +0 -8
  73. package/dist/ui/components/LineChart/TooltipContent.js +0 -52
  74. package/dist/ui/components/LineChart/dateHelpers.d.ts +0 -3
  75. package/dist/ui/components/LineChart/dateHelpers.js +0 -36
  76. package/dist/ui/components/LineChart/getLegendItems.d.ts +0 -18
  77. package/dist/ui/components/LineChart/getLegendItems.js +0 -75
  78. package/dist/ui/components/LineChart/index.d.ts +0 -2
  79. package/dist/ui/components/LineChart/index.js +0 -17
  80. package/dist/ui/components/LineChart/interpolate.d.ts +0 -17
  81. package/dist/ui/components/LineChart/interpolate.js +0 -58
  82. package/dist/ui/components/LineChart/types.d.ts +0 -32
  83. package/dist/ui/components/LineChart/types.js +0 -2
  84. package/dist/ui/components/Loader/index.d.ts +0 -15
  85. package/dist/ui/components/Loader/index.js +0 -93
  86. package/dist/ui/components/MinSidebar/index.d.ts +0 -13
  87. package/dist/ui/components/MinSidebar/index.js +0 -93
  88. package/dist/ui/components/Modal/Dialog.d.ts +0 -8
  89. package/dist/ui/components/Modal/Dialog.js +0 -47
  90. package/dist/ui/components/Modal/Modal.d.ts +0 -7
  91. package/dist/ui/components/Modal/Modal.js +0 -178
  92. package/dist/ui/components/Modal/index.d.ts +0 -3
  93. package/dist/ui/components/Modal/index.js +0 -18
  94. package/dist/ui/components/Modal/types.d.ts +0 -16
  95. package/dist/ui/components/Modal/types.js +0 -2
  96. package/dist/ui/components/PieChart/index.d.ts +0 -11
  97. package/dist/ui/components/PieChart/index.js +0 -43
  98. package/dist/ui/components/ProgressBar/index.d.ts +0 -15
  99. package/dist/ui/components/ProgressBar/index.js +0 -96
  100. package/dist/ui/components/Prompt/Dialog.d.ts +0 -2
  101. package/dist/ui/components/Prompt/Dialog.js +0 -26
  102. package/dist/ui/components/Prompt/Modal.d.ts +0 -3
  103. package/dist/ui/components/Prompt/Modal.js +0 -111
  104. package/dist/ui/components/Prompt/index.d.ts +0 -3
  105. package/dist/ui/components/Prompt/index.js +0 -18
  106. package/dist/ui/components/Prompt/types.d.ts +0 -23
  107. package/dist/ui/components/Prompt/types.js +0 -2
  108. package/dist/ui/components/PulseRing/index.d.ts +0 -19
  109. package/dist/ui/components/PulseRing/index.js +0 -75
  110. package/dist/ui/components/RowOrColumn/index.d.ts +0 -15
  111. package/dist/ui/components/RowOrColumn/index.js +0 -46
  112. package/dist/ui/components/Search/AutoHideSearchBox.d.ts +0 -8
  113. package/dist/ui/components/Search/AutoHideSearchBox.js +0 -114
  114. package/dist/ui/components/Search/Dialog.d.ts +0 -7
  115. package/dist/ui/components/Search/Dialog.js +0 -60
  116. package/dist/ui/components/Search/Inline.d.ts +0 -3
  117. package/dist/ui/components/Search/Inline.js +0 -137
  118. package/dist/ui/components/Search/Modal.d.ts +0 -3
  119. package/dist/ui/components/Search/Modal.js +0 -28
  120. package/dist/ui/components/Search/SearchBox.d.ts +0 -16
  121. package/dist/ui/components/Search/SearchBox.js +0 -107
  122. package/dist/ui/components/Search/index.d.ts +0 -6
  123. package/dist/ui/components/Search/index.js +0 -21
  124. package/dist/ui/components/Search/types.d.ts +0 -49
  125. package/dist/ui/components/Search/types.js +0 -2
  126. package/dist/ui/components/Sidebar/index.d.ts +0 -11
  127. package/dist/ui/components/Sidebar/index.js +0 -194
  128. package/dist/ui/components/SparkLine/index.d.ts +0 -16
  129. package/dist/ui/components/SparkLine/index.js +0 -64
  130. package/dist/ui/components/TabBar/index.d.ts +0 -27
  131. package/dist/ui/components/TabBar/index.js +0 -100
  132. package/dist/ui/components/Table/index.d.ts +0 -11
  133. package/dist/ui/components/Table/index.js +0 -49
  134. package/dist/ui/components/TextEdit/CheckboxEdit.d.ts +0 -14
  135. package/dist/ui/components/TextEdit/CheckboxEdit.js +0 -104
  136. package/dist/ui/components/TextEdit/ColourEdit.d.ts +0 -5
  137. package/dist/ui/components/TextEdit/ColourEdit.js +0 -63
  138. package/dist/ui/components/TextEdit/LengthBox.d.ts +0 -5
  139. package/dist/ui/components/TextEdit/LengthBox.js +0 -28
  140. package/dist/ui/components/TextEdit/ListboxEdit.d.ts +0 -14
  141. package/dist/ui/components/TextEdit/ListboxEdit.js +0 -61
  142. package/dist/ui/components/TextEdit/TextEdit.d.ts +0 -3
  143. package/dist/ui/components/TextEdit/TextEdit.js +0 -145
  144. package/dist/ui/components/TextEdit/common.d.ts +0 -19
  145. package/dist/ui/components/TextEdit/common.js +0 -61
  146. package/dist/ui/components/TextEdit/index.d.ts +0 -5
  147. package/dist/ui/components/TextEdit/index.js +0 -20
  148. package/dist/ui/components/TextEdit/types.d.ts +0 -65
  149. package/dist/ui/components/TextEdit/types.js +0 -2
  150. package/dist/ui/components/TextWithButton/index.d.ts +0 -10
  151. package/dist/ui/components/TextWithButton/index.js +0 -89
  152. package/dist/ui/components/Timeline/index.d.ts +0 -22
  153. package/dist/ui/components/Timeline/index.js +0 -72
  154. package/dist/ui/components/TimelineChart/index.d.ts +0 -21
  155. package/dist/ui/components/TimelineChart/index.js +0 -63
  156. package/dist/ui/components/TreeChart/TooltipContent.d.ts +0 -7
  157. package/dist/ui/components/TreeChart/TooltipContent.js +0 -34
  158. package/dist/ui/components/TreeChart/base.d.ts +0 -3
  159. package/dist/ui/components/TreeChart/base.js +0 -144
  160. package/dist/ui/components/TreeChart/helpers.d.ts +0 -4
  161. package/dist/ui/components/TreeChart/helpers.js +0 -41
  162. package/dist/ui/components/TreeChart/index.d.ts +0 -2
  163. package/dist/ui/components/TreeChart/index.js +0 -17
  164. package/dist/ui/components/TreeChart/types.d.ts +0 -27
  165. package/dist/ui/components/TreeChart/types.js +0 -2
  166. package/dist/ui/components/UserImage/index.d.ts +0 -26
  167. package/dist/ui/components/UserImage/index.js +0 -109
  168. package/dist/ui/icons/CrossIcon.d.ts +0 -5
  169. package/dist/ui/icons/CrossIcon.js +0 -24
  170. package/dist/ui/styles/standaloneStyles.d.ts +0 -24
  171. package/dist/ui/styles/standaloneStyles.js +0 -69
@@ -1,75 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getLegendItems = void 0;
4
- const array_1 = require("../../../common/helpers/array");
5
- const math_1 = require("../../../common/helpers/math");
6
- const object_1 = require("../../../common/helpers/object");
7
- const shownResults = 4;
8
- const getTopItems = ({ data, colours, }) => {
9
- const val = {};
10
- data.forEach((d) => {
11
- var _a;
12
- const key = (_a = d.legendName) !== null && _a !== void 0 ? _a : d.name;
13
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
14
- if (!val[key]) {
15
- val[key] = { colour: colours[d.name], name: key, value: d.y };
16
- }
17
- else {
18
- val[key].value += d.y;
19
- }
20
- });
21
- const values = Object.values(val).sort((a, b) => a.value < b.value ? 1 : -1);
22
- const legendItems = (0, array_1.take)(values, shownResults).part.map((v) => ({
23
- colour: v.colour,
24
- name: v.name,
25
- y: v.value,
26
- x: 0,
27
- }));
28
- return legendItems;
29
- };
30
- const getLegendItems = (p) => {
31
- var _a;
32
- const dataSource = (_a = p.legendData) !== null && _a !== void 0 ? _a : p.data;
33
- let values = [];
34
- if (p.selectedXs && p.selectedXs.length > 0) {
35
- const sx = p.selectedXs[0].x;
36
- const grouped = {};
37
- dataSource
38
- .filter((d) => d.x === sx)
39
- .forEach((d) => {
40
- var _a;
41
- const key = (_a = d.legendName) !== null && _a !== void 0 ? _a : d.name;
42
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
43
- if (!grouped[key]) {
44
- grouped[key] = {
45
- value: d.y,
46
- colour: p.colours[d.name],
47
- name: key,
48
- };
49
- }
50
- else {
51
- grouped[key].value += d.y;
52
- }
53
- });
54
- values = Object.values(grouped).map((g) => ({
55
- colour: g.colour,
56
- name: g.name,
57
- y: g.value,
58
- x: sx,
59
- }));
60
- }
61
- if (p.fixed || values.length === 0) {
62
- values = getTopItems({ data: dataSource, colours: p.colours });
63
- }
64
- const total = (0, math_1.sumArray)(values.map((a) => a.y));
65
- const min = total * 0.1;
66
- let part = values.sort((a, b) => (a.y < b.y ? 1 : -1));
67
- let rest = [];
68
- if (part.length > shownResults) {
69
- part = (0, array_1.take)(part.filter((r) => r.y > min), shownResults).part;
70
- rest = (0, object_1.copy)(values).filter((r) => !part.find((p) => p.name === r.name));
71
- }
72
- const restTotal = (0, math_1.sumArray)(rest.map((s) => s.y));
73
- return { part, rest, restTotal, total };
74
- };
75
- exports.getLegendItems = getLegendItems;
@@ -1,2 +0,0 @@
1
- export * from './Base';
2
- export type * from './types';
@@ -1,17 +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("./Base"), exports);
@@ -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';