ag-common 0.0.798 → 0.0.800

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 +9 -14
  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,27 +0,0 @@
1
- import type { CSSProperties } from 'react';
2
- import type { JSX } from 'react';
3
- export interface ITabBar {
4
- onChangeIndex: (i: number) => void;
5
- className?: string;
6
- cookieDocument: string;
7
- style?: CSSProperties;
8
- items: {
9
- text: string;
10
- icon: (p: {
11
- style: {
12
- fill?: string;
13
- };
14
- }) => JSX.Element;
15
- }[];
16
- theme?: {
17
- /** default black */
18
- front?: string;
19
- /** default blue */
20
- frontSelected?: string;
21
- /** default #eee */
22
- back?: string;
23
- };
24
- /** default 0 */
25
- defaultSelectedIndex?: number;
26
- }
27
- export declare const TabBar: (p: ITabBar) => JSX.Element;
@@ -1,100 +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.TabBar = void 0;
41
- const styled_1 = __importDefault(require("@emotion/styled"));
42
- const react_1 = __importStar(require("react"));
43
- const Icon_1 = require("../Icon");
44
- const Base = styled_1.default.div `
45
- display: flex;
46
- flex-flow: row;
47
- &[data-mode='vert'] {
48
- flex-flow: column;
49
- }
50
- overflow: hidden;
51
- justify-content: space-around;
52
- width: 100%;
53
- margin: auto;
54
- `;
55
- const Item = styled_1.default.div `
56
- display: flex;
57
- flex-flow: column;
58
- align-items: center;
59
- border-radius: 2rem;
60
- justify-content: center;
61
- height: calc(100% - 1rem);
62
- padding-left: 1rem;
63
- padding-right: 1rem;
64
- width: 10rem;
65
- &[data-selected='false'] {
66
- opacity: 0.8;
67
- cursor: pointer;
68
- }
69
- `;
70
- const IconStyled = (0, styled_1.default)(Icon_1.Icon) `
71
- height: 1.5rem;
72
- max-height: 80%;
73
- max-width: fit-content;
74
- `;
75
- const Text = styled_1.default.div `
76
- max-height: 50%;
77
- overflow: hidden;
78
- `;
79
- const TabBar = (p) => {
80
- var _a;
81
- const { defaultSelectedIndex = 0, theme: { back = '#eee', frontSelected = '#4d76ff', front = 'black' }, } = Object.assign(Object.assign({}, p), { theme: (_a = p.theme) !== null && _a !== void 0 ? _a : {} });
82
- const [index, setIndex] = (0, react_1.useState)(defaultSelectedIndex);
83
- return (react_1.default.createElement(Base, { className: p.className, style: p.style }, p.items.map((v, i) => {
84
- const selected = index === i;
85
- return (react_1.default.createElement(Item, { style: Object.assign(Object.assign({ backgroundColor: back, color: front }, (selected && { color: frontSelected })), { maxWidth: `${100 / p.items.length}%` }), "data-selected": selected,
86
- // eslint-disable-next-line react/no-array-index-key
87
- key: i.toString(), onClick: () => {
88
- if (index === i) {
89
- return;
90
- }
91
- setIndex(i);
92
- p.onChangeIndex(i);
93
- } },
94
- react_1.default.createElement(IconStyled, { style: { width: '50%' } }, v.icon({
95
- style: Object.assign({}, (selected && { fill: frontSelected })),
96
- })),
97
- react_1.default.createElement(Text, { "data-type": "text" }, v.text)));
98
- })));
99
- };
100
- exports.TabBar = TabBar;
@@ -1,11 +0,0 @@
1
- import type { JSX } from 'react';
2
- export interface ITableItem {
3
- content: JSX.Element;
4
- groupTitle?: string;
5
- }
6
- export interface ITable {
7
- children: ITableItem[];
8
- className?: string;
9
- headerRow?: JSX.Element;
10
- }
11
- export declare const Table: ({ children, className, headerRow }: ITable) => JSX.Element;
@@ -1,49 +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.Table = void 0;
8
- const styled_1 = __importDefault(require("@emotion/styled"));
9
- const react_1 = __importDefault(require("react"));
10
- const groupBy_1 = require("../../../common/helpers/groupBy");
11
- const Base = styled_1.default.div `
12
- display: flex;
13
- flex-flow: column;
14
- width: 100%;
15
- max-height: 100%;
16
- overflow-y: auto;
17
- `;
18
- const TableRow = styled_1.default.div `
19
- display: flex;
20
- border: solid 1px #ccc;
21
- &[data-header='true'] {
22
- border-bottom: solid 1px #888;
23
- }
24
- &:not(:first-of-type) {
25
- border-top: 0;
26
- }
27
- `;
28
- const Group = styled_1.default.div `
29
- display: flex;
30
- flex-flow: column;
31
- width: 100%;
32
- `;
33
- const GroupTitle = styled_1.default.div `
34
- font-size: 1.5rem;
35
- `;
36
- const GroupWrap = styled_1.default.div `
37
- display: flex;
38
- flex-flow: column;
39
- width: 100%;
40
- `;
41
- const Table = ({ children, className, headerRow }) => {
42
- const grouped = (0, groupBy_1.groupByList)(children, (s) => s.groupTitle);
43
- return (react_1.default.createElement(Base, { className: className }, grouped.map((group) => (react_1.default.createElement(GroupWrap, { key: 'gk' + group.key },
44
- group.key && (react_1.default.createElement(GroupTitle, { key: `gt${group.key}` }, group.key)),
45
- react_1.default.createElement(Group, { key: `g${group.key}` },
46
- headerRow && (react_1.default.createElement(TableRow, { "data-header": "true", key: `headrow${group.key}` }, headerRow)),
47
- group.items.map((item) => (react_1.default.createElement(TableRow, { key: item.content.key }, item.content)))))))));
48
- };
49
- exports.Table = Table;
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- export interface ICheckboxEdit {
3
- className?: string;
4
- defaultValue: boolean;
5
- onSubmit: (val: boolean) => void;
6
- noGrow?: boolean;
7
- /**
8
- * if true, will add undo button after changes. if false, will submit after every keypress. default false
9
- */
10
- allowUndo?: boolean;
11
- /** display to right of CB */
12
- rightSpan?: React.ReactNode;
13
- }
14
- export declare const CheckboxEdit: ({ defaultValue, onSubmit, noGrow, allowUndo, rightSpan, className, }: ICheckboxEdit) => React.JSX.Element;
@@ -1,104 +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.CheckboxEdit = void 0;
41
- const styled_1 = __importDefault(require("@emotion/styled"));
42
- const react_1 = __importStar(require("react"));
43
- const useOnClickOutside_1 = require("../../helpers/useOnClickOutside");
44
- const Save_1 = require("../../icons/Save");
45
- const Undo_1 = require("../../icons/Undo");
46
- const common_1 = require("../../styles/common");
47
- const FlexRow_1 = require("../FlexRow");
48
- const common_2 = require("./common");
49
- const Icons = (0, styled_1.default)(FlexRow_1.FlexRow) `
50
- position: absolute;
51
- top: 0;
52
- right: -2rem;
53
- `;
54
- const CheckboxEdit = ({ defaultValue, onSubmit, noGrow = false, allowUndo = false, rightSpan, className, }) => {
55
- const ref = (0, react_1.useRef)(null);
56
- const [value, setValue] = (0, react_1.useState)(defaultValue);
57
- (0, react_1.useEffect)(() => {
58
- setValue(defaultValue);
59
- }, [defaultValue]);
60
- const valueChange = value !== defaultValue;
61
- (0, useOnClickOutside_1.useOnClickOutside)({ ref, moveMouseOutside: false }, () => {
62
- if (valueChange) {
63
- onSubmit(value);
64
- }
65
- });
66
- return (react_1.default.createElement(common_2.ValueBox, Object.assign({}, common_1.noDrag, { className: className, style: { cursor: 'pointer', width: 'fit-content', flexGrow: 0 }, ref: ref, "data-nogrow": noGrow, onClick: (e) => {
67
- if (allowUndo) {
68
- setValue(!value);
69
- }
70
- else {
71
- onSubmit(!value);
72
- }
73
- e.stopPropagation();
74
- } }),
75
- react_1.default.createElement(common_2.ValueInputCB, { type: "checkbox", "data-type": "checkbox", checked: value, onKeyDown: (e) => {
76
- if (e.key === 'Enter' && value !== defaultValue) {
77
- onSubmit(value);
78
- }
79
- e.stopPropagation();
80
- }, onChange: (e) => {
81
- if (allowUndo) {
82
- setValue(!value);
83
- }
84
- else {
85
- onSubmit(!value);
86
- }
87
- e.stopPropagation();
88
- } }),
89
- allowUndo && value !== defaultValue && (react_1.default.createElement(Icons, { center: true },
90
- react_1.default.createElement(common_2.IconD, { style: common_2.iconLeft, onClick: (e) => {
91
- if (value !== defaultValue) {
92
- onSubmit(value);
93
- }
94
- e.stopPropagation();
95
- } },
96
- react_1.default.createElement(Save_1.Save, null)),
97
- react_1.default.createElement(common_2.IconD, { style: Object.assign(Object.assign({}, common_2.iconRight), { fill: '#134563' }), onClick: (e) => {
98
- setValue(defaultValue);
99
- e.stopPropagation();
100
- } },
101
- react_1.default.createElement(Undo_1.Undo, null)))),
102
- !rightSpan ? '' : rightSpan));
103
- };
104
- exports.CheckboxEdit = CheckboxEdit;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export declare const ColourEdit: ({ defaultValue, onSubmit, }: {
3
- defaultValue: string;
4
- onSubmit: (val: string) => void;
5
- }) => React.JSX.Element;
@@ -1,63 +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.ColourEdit = void 0;
38
- const react_1 = __importStar(require("react"));
39
- const useOnClickOutside_1 = require("../../helpers/useOnClickOutside");
40
- const Save_1 = require("../../icons/Save");
41
- const Undo_1 = require("../../icons/Undo");
42
- const common_1 = require("../../styles/common");
43
- const common_2 = require("./common");
44
- const ColourEdit = ({ defaultValue, onSubmit, }) => {
45
- const ref = (0, react_1.useRef)(null);
46
- const [value, setValue] = (0, react_1.useState)(defaultValue);
47
- (0, react_1.useEffect)(() => {
48
- setValue(defaultValue);
49
- }, [defaultValue]);
50
- const valueChange = value !== defaultValue;
51
- (0, useOnClickOutside_1.useOnClickOutside)({ ref, moveMouseOutside: false }, () => {
52
- if (valueChange) {
53
- onSubmit(value);
54
- }
55
- });
56
- return (react_1.default.createElement(common_2.ValueBox, Object.assign({}, common_1.noDrag, { ref: ref }),
57
- react_1.default.createElement("input", { type: "color", size: 5, value: value, onChange: (v) => setValue(v.target.value) }),
58
- value !== defaultValue && (react_1.default.createElement(common_2.IconD, { style: common_2.iconLeft, onClick: () => valueChange && onSubmit(value.trim()) },
59
- react_1.default.createElement(Save_1.Save, null))),
60
- valueChange && (react_1.default.createElement(common_2.IconD, { style: Object.assign(Object.assign({}, common_2.iconRight), { fill: '#134563' }), onClick: () => setValue(defaultValue) },
61
- react_1.default.createElement(Undo_1.Undo, null)))));
62
- };
63
- exports.ColourEdit = ColourEdit;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export declare const TextEditLengthBox: ({ min, max, }: {
3
- min: number;
4
- max: number;
5
- }) => React.JSX.Element;
@@ -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
- };