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,28 +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.TextEditLengthBox = 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
- /* position: absolute;
12
- bottom: 0.5rem;
13
- right: 0.5rem; */
14
- `;
15
- const TextEditLengthBox = ({ min, max, }) => {
16
- let color = 'black';
17
- if (min / max > 0.55) {
18
- color = 'indianred';
19
- }
20
- if (min === max) {
21
- color = 'red';
22
- }
23
- return (react_1.default.createElement(Base, { style: { color } },
24
- min,
25
- "/",
26
- max));
27
- };
28
- exports.TextEditLengthBox = TextEditLengthBox;
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- export declare const ListboxEdit: <T>({ defaultValue, onSubmit, values, canEdit, renderLabel, }: {
3
- defaultValue: T;
4
- onSubmit: (val: T) => void;
5
- values: T[];
6
- /**
7
- * if true can revert or explicit save. default true
8
- */
9
- canEdit?: boolean;
10
- /**
11
- * can overload the render of the label. defaults to toString
12
- */
13
- renderLabel?: (a: T) => string;
14
- }) => React.JSX.Element;
@@ -1,61 +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
- Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.ListboxEdit = void 0;
38
- const react_1 = __importStar(require("react"));
39
- const Save_1 = require("../../icons/Save");
40
- const Undo_1 = require("../../icons/Undo");
41
- const common_1 = require("../../styles/common");
42
- const common_2 = require("./common");
43
- const ListboxEdit = ({ defaultValue, onSubmit, values, canEdit = true, renderLabel = (e) => e.toString(), }) => {
44
- const [value, setValue] = (0, react_1.useState)(defaultValue);
45
- (0, react_1.useEffect)(() => {
46
- setValue(defaultValue);
47
- }, [defaultValue]);
48
- return (react_1.default.createElement(common_2.ValueBox, Object.assign({}, common_1.noDrag),
49
- react_1.default.createElement("select", { size: 5, value: value.toString(), onChange: (v) => {
50
- const selected = values[v.target.selectedIndex];
51
- if (!selected) {
52
- return;
53
- }
54
- return canEdit ? setValue(selected) : onSubmit(selected);
55
- } }, values.map((v) => (react_1.default.createElement("option", { key: v.toString(), value: v.toString() }, renderLabel(v))))),
56
- canEdit && value !== defaultValue && (react_1.default.createElement(common_2.IconD, { style: common_2.iconLeft, onClick: () => value !== defaultValue && onSubmit(value) },
57
- react_1.default.createElement(Save_1.Save, null))),
58
- canEdit && value !== defaultValue && (react_1.default.createElement(common_2.IconD, { style: Object.assign(Object.assign({}, common_2.iconRight), { fill: '#134563' }), onClick: () => setValue(defaultValue) },
59
- react_1.default.createElement(Undo_1.Undo, null)))));
60
- };
61
- exports.ListboxEdit = ListboxEdit;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import type { IRefTextEdit, ITextEdit } from './types';
3
- export declare const TextEdit: React.ForwardRefExoticComponent<ITextEdit & React.RefAttributes<IRefTextEdit>>;
@@ -1,145 +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
- Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.TextEdit = void 0;
38
- const react_1 = __importStar(require("react"));
39
- const dom_1 = require("../../helpers/dom");
40
- const useOnClickOutside_1 = require("../../helpers/useOnClickOutside");
41
- const utils_1 = require("../../helpers/utils");
42
- const Pencil_1 = require("../../icons/Pencil");
43
- const Save_1 = require("../../icons/Save");
44
- const Undo_1 = require("../../icons/Undo");
45
- const button_1 = require("../shadcn/button");
46
- const card_1 = require("../shadcn/card");
47
- const input_1 = require("../shadcn/input");
48
- const textarea_1 = require("../shadcn/textarea");
49
- const LengthBox_1 = require("./LengthBox");
50
- // Removed styled components - now using Tailwind classes and shadcn components
51
- exports.TextEdit = react_1.default.forwardRef((p, ref) => {
52
- var _a, _b;
53
- const { defaultValue = '', defaultEditing, disableEdit = false, singleLine = false, noGrow = false, allowUndo = true, } = p;
54
- const divRef = (0, react_1.useRef)(null);
55
- const taref = (0, react_1.useRef)(null);
56
- const [value, setValue] = (0, react_1.useState)(defaultValue);
57
- const [editing, setEditingRaw] = (0, react_1.useState)(!!defaultEditing);
58
- const valueChange = value !== defaultValue;
59
- (0, react_1.useImperativeHandle)(ref, () => ({
60
- setValue: (v) => {
61
- if (v === value) {
62
- return;
63
- }
64
- setValue(v);
65
- },
66
- focus: () => { var _a; return (_a = taref.current) === null || _a === void 0 ? void 0 : _a.focus(); },
67
- getValue: () => { var _a; return (_a = taref.current) === null || _a === void 0 ? void 0 : _a.value; },
68
- }));
69
- (0, useOnClickOutside_1.useOnClickOutside)({
70
- disabled: p.onClickOutsideWithNoValue === null || disableEdit,
71
- ref: divRef,
72
- moveMouseOutside: false,
73
- }, () => {
74
- if (valueChange) {
75
- p.onSubmit(value, false);
76
- return;
77
- }
78
- if (!disableEdit && p.onClickOutsideWithNoValue) {
79
- p.onClickOutsideWithNoValue();
80
- }
81
- if (!disableEdit && editing && defaultEditing) {
82
- return;
83
- }
84
- if (editing) {
85
- setEditingRaw(false);
86
- }
87
- });
88
- const setEditing = (0, react_1.useCallback)((b) => {
89
- setEditingRaw(b);
90
- if (p.onEditingChange) {
91
- p.onEditingChange(b);
92
- }
93
- }, [p]);
94
- (0, react_1.useEffect)(() => {
95
- if ((defaultEditing === null || defaultEditing === void 0 ? void 0 : defaultEditing.focus) && taref.current) {
96
- taref.current.focus();
97
- }
98
- }, [defaultEditing === null || defaultEditing === void 0 ? void 0 : defaultEditing.focus]);
99
- if (!editing || disableEdit) {
100
- return (react_1.default.createElement(card_1.Card, Object.assign({ className: (0, utils_1.cn)('flex items-center relative bg-transparent justify-start flex-grow border-transparent p-2', p.onClickNotEditing && 'cursor-pointer', noGrow && 'flex-grow-0', p.className), "data-editing": "false", onClick: () => { var _a; return (_a = p.onClickNotEditing) === null || _a === void 0 ? void 0 : _a.call(p); }, "data-pointer": p.onClickNotEditing ? 'true' : 'false', "data-nogrow": noGrow }, (0, dom_1.filterDataProps)(p)), (_a = p.leftContent) !== null && _a !== void 0 ? _a : null,
101
- react_1.default.createElement("div", { className: "w-full h-full p-0 break-all text-inherit font-inherit flex-[1_1_calc(100%-3rem)]" }, value || react_1.default.createElement("span", { className: "text-gray-400" }, p.placeholder)),
102
- react_1.default.createElement("div", { className: "flex flex-row items-center" }, !disableEdit && (react_1.default.createElement(button_1.Button, { variant: "ghost", size: "icon", className: "w-6 h-6 hover:brightness-150", onClick: (e) => {
103
- e.stopPropagation();
104
- setEditing(true);
105
- } },
106
- react_1.default.createElement(Pencil_1.Pencil, null))))));
107
- }
108
- const InputComponent = !singleLine ? textarea_1.Textarea : input_1.Input;
109
- return (react_1.default.createElement(card_1.Card, Object.assign({ className: (0, utils_1.cn)('flex items-center relative bg-transparent justify-start flex-grow border-gray-300 p-2', noGrow && 'flex-grow-0', p.className), "data-editing": "true", tabIndex: -1, "data-nogrow": noGrow }, (0, dom_1.filterDataProps)(p)), (_b = p.leftContent) !== null && _b !== void 0 ? _b : null,
110
- react_1.default.createElement("div", { className: "flex-1 flex items-center gap-2" },
111
- react_1.default.createElement(InputComponent
112
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
113
- , {
114
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
115
- tabIndex: editing ? 0 : undefined, "data-editing": "true", "data-valuechange": valueChange.toString(),
116
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
117
- ref: taref, "data-type": "text", value: value, onChange: (v) => {
118
- setValue(v.currentTarget.value);
119
- if (!allowUndo) {
120
- p.onSubmit(v.currentTarget.value, false);
121
- }
122
- }, placeholder: p.placeholder, rows: singleLine ? 1 : undefined, maxLength: p.maxLength, className: (0, utils_1.cn)('flex-1 p-0 break-all font-inherit resize-none overflow-hidden bg-white text-black border border-black rounded', !singleLine && 'min-h-[5rem]'), onKeyDown: (e) => {
123
- var _a;
124
- if (((_a = p.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(p, e)) ===
125
- false) {
126
- e.preventDefault();
127
- return;
128
- }
129
- if (singleLine && e.code.endsWith('Enter')) {
130
- p.onSubmit(value, true);
131
- }
132
- } }),
133
- react_1.default.createElement("div", { className: "flex items-center gap-1" },
134
- p.maxLength && (react_1.default.createElement("div", { className: "text-sm text-black" },
135
- react_1.default.createElement(LengthBox_1.TextEditLengthBox, { min: value.length, max: p.maxLength }))),
136
- allowUndo && (react_1.default.createElement(react_1.default.Fragment, null,
137
- valueChange && (react_1.default.createElement(button_1.Button, { variant: "ghost", size: "icon", className: "w-6 h-6 hover:brightness-150 p-0", onClick: () => p.onSubmit(value, false) },
138
- react_1.default.createElement(Save_1.Save, null))),
139
- (valueChange || editing !== !!defaultEditing) && (react_1.default.createElement(button_1.Button, { variant: "ghost", size: "icon", className: "w-6 h-6 hover:brightness-150 text-[#134563] p-0", onClick: () => {
140
- setEditing(!!defaultEditing);
141
- setValue(defaultValue);
142
- } },
143
- react_1.default.createElement(Undo_1.Undo, null)))))))));
144
- });
145
- exports.TextEdit.displayName = 'TextEdit';
@@ -1,19 +0,0 @@
1
- export declare const ValueBox: import("@emotion/styled").StyledComponent<{
2
- theme?: import("@emotion/react").Theme;
3
- as?: React.ElementType;
4
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
5
- export declare const valueCss: import("@emotion/react").SerializedStyles;
6
- export declare const ValueInputCB: import("@emotion/styled").StyledComponent<{
7
- theme?: import("@emotion/react").Theme;
8
- as?: React.ElementType;
9
- }, import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, {}>;
10
- export declare const IconD: import("@emotion/styled").StyledComponent<{
11
- theme?: import("@emotion/react").Theme;
12
- as?: React.ElementType;
13
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
14
- export declare const iconRight: {
15
- right: string;
16
- };
17
- export declare const iconLeft: {
18
- right: string;
19
- };
@@ -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>;