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,114 +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.AutoHideSearchBox = void 0;
41
- const styled_1 = __importDefault(require("@emotion/styled"));
42
- const react_1 = __importStar(require("react"));
43
- const useGranularHook_1 = require("../../helpers/useGranularHook");
44
- const icons_1 = require("../../icons");
45
- const styles_1 = require("../../styles");
46
- const SearchBox_1 = require("./SearchBox");
47
- const Base = styled_1.default.div `
48
- display: flex;
49
- flex-flow: row;
50
- align-items: center;
51
- margin-left: 1rem;
52
-
53
- @media ${styles_1.bigScreen} {
54
- width: 20rem;
55
- }
56
- `;
57
- const Icon = styled_1.default.div `
58
- display: flex;
59
- margin-right: 0.5rem;
60
- > svg {
61
- width: 1.2rem;
62
- height: 1.2rem;
63
- fill: white;
64
- }
65
- `;
66
- const SearchBoxStyled = (0, styled_1.default)(SearchBox_1.SearchBox) `
67
- transition: width 200ms ease-in-out;
68
-
69
- overflow: hidden;
70
- padding: 0;
71
- &[data-open='false'] {
72
- width: 0;
73
- padding: 0;
74
- }
75
- @media ${styles_1.smallScreen} {
76
- padding: 0;
77
- }
78
- `;
79
- const AutoHideSearchBox = (p) => {
80
- const [open, setOpen] = (0, react_1.useState)(!!p.searchText);
81
- const textEditRef = (0, react_1.createRef)();
82
- (0, useGranularHook_1.useGranularEffect)(() => {
83
- var _a;
84
- const newOpen = !!p.searchText;
85
- if (newOpen !== open) {
86
- setOpen(!open);
87
- (_a = p.onOpenToggle) === null || _a === void 0 ? void 0 : _a.call(p, !open);
88
- }
89
- }, [p.searchText], [open]);
90
- return (react_1.default.createElement(Base, { className: p.className, "data-open": open },
91
- react_1.default.createElement(Icon, { style: { cursor: 'pointer' }, onClick: () => {
92
- var _a;
93
- if (open) {
94
- p.setSearchText('', false);
95
- }
96
- setOpen(!open);
97
- (_a = p.onOpenToggle) === null || _a === void 0 ? void 0 : _a.call(p, !open);
98
- if (!open) {
99
- setTimeout(() => { var _a; return (_a = textEditRef.current) === null || _a === void 0 ? void 0 : _a.focus(); }, 100);
100
- }
101
- } },
102
- open && react_1.default.createElement(icons_1.CrossIcon, null),
103
- !open && react_1.default.createElement(icons_1.Magnify, { style: { fill: 'white' } })),
104
- react_1.default.createElement(SearchBoxStyled, Object.assign({ textBoxRef: textEditRef }, p, { "data-open": open, setSearchText: (val, enter) => {
105
- //we dont want empty enters to do anything
106
- if (val === '' && enter) {
107
- p.setSearchText(val, false);
108
- }
109
- else {
110
- p.setSearchText(val, enter);
111
- }
112
- } }))));
113
- };
114
- exports.AutoHideSearchBox = AutoHideSearchBox;
@@ -1,7 +0,0 @@
1
- import type { ISearchDialog, TSearchModalRes } from './types';
2
- /**
3
- * opens a searchmodal programatically, and resolves to either undefined, or the selected item
4
- * @param p
5
- * @returns
6
- */
7
- export declare const SearchDialog: <T>(p: ISearchDialog<T>) => Promise<TSearchModalRes<T> | undefined>;
@@ -1,60 +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.SearchDialog = void 0;
16
- const react_1 = __importDefault(require("react"));
17
- const client_1 = require("react-dom/client");
18
- const log_1 = require("../../../common/helpers/log");
19
- const Modal_1 = require("./Modal");
20
- /**
21
- * opens a searchmodal programatically, and resolves to either undefined, or the selected item
22
- * @param p
23
- * @returns
24
- */
25
- const SearchDialog = (p) => __awaiter(void 0, void 0, void 0, function* () {
26
- const placeholderText = p.placeholderText || '';
27
- let originalStyle;
28
- return new Promise((res) => {
29
- const idName = 'ag-search-dialog';
30
- if (document.body.querySelectorAll('#' + idName).length !== 0) {
31
- (0, log_1.error)('searchDialog already open');
32
- res(undefined);
33
- return;
34
- }
35
- const wrapper = document.body.appendChild(document.createElement('div'));
36
- wrapper.id = idName;
37
- if (originalStyle === undefined) {
38
- originalStyle = window.getComputedStyle(document.body).overflow || '';
39
- document.body.style.overflow = 'hidden';
40
- }
41
- const root = (0, client_1.createRoot)(wrapper);
42
- root.render(react_1.default.createElement(Modal_1.SearchModal, Object.assign({}, p, { placeholderText: placeholderText, onSelectItem: (f) => {
43
- try {
44
- document.body.style.overflow = originalStyle || '';
45
- res(f);
46
- }
47
- finally {
48
- try {
49
- root.unmount();
50
- wrapper.remove();
51
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
52
- }
53
- catch (e) {
54
- //
55
- }
56
- }
57
- } })));
58
- });
59
- });
60
- exports.SearchDialog = SearchDialog;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import type { ISearchDialog } from './types';
3
- export declare const SearchInline: <T>(p: ISearchDialog<T>) => React.JSX.Element;
@@ -1,137 +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.SearchInline = void 0;
41
- const styled_1 = __importDefault(require("@emotion/styled"));
42
- const react_1 = __importStar(require("react"));
43
- const array_1 = require("../../../common/helpers/array");
44
- const styles_1 = require("../../styles");
45
- const SearchBox_1 = require("./SearchBox");
46
- const Base = styled_1.default.div `
47
- display: flex;
48
- flex-flow: column;
49
- flex-grow: 1;
50
- width: 100%;
51
- height: calc(100% - 1rem);
52
- @media ${styles_1.smallScreen} {
53
- height: calc(100% - 0.5rem);
54
- }
55
- `;
56
- const Content = styled_1.default.div `
57
- width: calc(100% - 2rem);
58
- margin: auto;
59
- display: flex;
60
- flex-flow: column;
61
- justify-content: flex-start;
62
- align-items: center;
63
- max-height: 100%;
64
- overflow-y: auto;
65
- overflow-x: hidden;
66
-
67
- flex-grow: 1;
68
- &[data-hasitems='true'] {
69
- padding-bottom: 0.5rem;
70
- }
71
- @media ${styles_1.smallScreen} {
72
- margin: 0;
73
- width: calc(100% - 0.5rem);
74
- }
75
- `;
76
- const RowCount = styled_1.default.div `
77
- width: 100%;
78
- text-align: center;
79
- width: fit-content;
80
- text-decoration-color: currentcolor;
81
- text-decoration: underline;
82
-
83
- &[data-top='true'] {
84
- padding-bottom: 0.5rem;
85
- }
86
- &[data-top='false'] {
87
- padding-top: 0.5rem;
88
- }
89
- `;
90
- const SearchInline = (p) => {
91
- var _a, _b, _c, _d, _e, _f;
92
- const { maxDisplayItems = 1000 } = p;
93
- const rowCountOptDisplay = (_b = (_a = p.rowCountOpt) === null || _a === void 0 ? void 0 : _a.display) !== null && _b !== void 0 ? _b : 'bottom';
94
- const [searchText, setSearchText] = (0, react_1.useState)((_c = p.defaultValue) !== null && _c !== void 0 ? _c : '');
95
- (0, react_1.useImperativeHandle)(p.textBoxRef, () => ({
96
- setValue: (v) => {
97
- var _a, _b;
98
- const value = (_a = textBoxRef.current) === null || _a === void 0 ? void 0 : _a.getValue();
99
- if (v === value) {
100
- return;
101
- }
102
- (_b = textBoxRef.current) === null || _b === void 0 ? void 0 : _b.setValue(v);
103
- setSearchText(v);
104
- },
105
- focus: () => { var _a; return (_a = textBoxRef.current) === null || _a === void 0 ? void 0 : _a.focus(); },
106
- getValue: () => { var _a; return (_a = textBoxRef.current) === null || _a === void 0 ? void 0 : _a.getValue(); },
107
- }));
108
- const textBoxRef = (0, react_1.useRef)(null);
109
- const resWrap = (foundItem, target) => {
110
- var _a, _b;
111
- if (!foundItem) {
112
- (_a = p.onSelectItem) === null || _a === void 0 ? void 0 : _a.call(p, undefined);
113
- }
114
- else {
115
- (_b = p.onSelectItem) === null || _b === void 0 ? void 0 : _b.call(p, { foundItem, searchText, target });
116
- }
117
- };
118
- const filteredItemsRaw = p.displayItems.filter((i) => p.willDisplayItem(searchText, i));
119
- const { part: filteredItems } = (0, array_1.take)(filteredItemsRaw, maxDisplayItems < 0 ? filteredItemsRaw.length : maxDisplayItems);
120
- const outdiff = filteredItems.length !== p.displayItems.length;
121
- const showText = (_f = (_e = (_d = p.texts) === null || _d === void 0 ? void 0 : _d.totalItems) === null || _e === void 0 ? void 0 : _e.call(_d, filteredItems.length, p.displayItems.length)) !== null && _f !== void 0 ? _f : `Showing ${filteredItems.length} out of ${p.displayItems.length} total
122
- items`;
123
- return (react_1.default.createElement(Base, { className: p.className },
124
- react_1.default.createElement(SearchBox_1.SearchBox, Object.assign({}, p, { searchText: searchText, setSearchText: (t) => {
125
- var _a;
126
- setSearchText(t);
127
- (_a = p.onSearchTextChange) === null || _a === void 0 ? void 0 : _a.call(p, t);
128
- }, textBoxRef: textBoxRef })),
129
- react_1.default.createElement(Content, { "data-hasitems": !!filteredItems.length, "data-type": "content" },
130
- rowCountOptDisplay === 'top' && outdiff && (react_1.default.createElement(RowCount, { "data-top": "true" }, showText)),
131
- filteredItems.map((item, index) => (0, react_1.cloneElement)(p.renderItem({ searchText, item, index }), {
132
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
133
- onClick: (e) => resWrap(item, e.target),
134
- })),
135
- rowCountOptDisplay === 'bottom' && outdiff && (react_1.default.createElement(RowCount, { "data-top": "false" }, showText)))));
136
- };
137
- exports.SearchInline = SearchInline;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import type { ISearchModal } from './types';
3
- export declare const SearchModal: <T>(p: ISearchModal<T>) => 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.SearchModal = void 0;
8
- const styled_1 = __importDefault(require("@emotion/styled"));
9
- const react_1 = __importDefault(require("react"));
10
- const styles_1 = require("../../styles");
11
- const Modal_1 = require("../Modal/Modal");
12
- const Inline_1 = require("./Inline");
13
- const ModalStyled = (0, styled_1.default)(Modal_1.Modal) `
14
- display: flex;
15
- flex-flow: column;
16
- top: 10rem;
17
- @media ${styles_1.bigScreen} {
18
- width: 50vw;
19
- max-width: 60rem;
20
- }
21
- @media ${styles_1.smallScreen} {
22
- width: 100%;
23
- max-width: 95vw;
24
- }
25
- `;
26
- const SearchModal = (p) => (react_1.default.createElement(ModalStyled, { position: "center", topPosition: "center", open: true, setOpen: () => { var _a; return (_a = p.onSelectItem) === null || _a === void 0 ? void 0 : _a.call(p, undefined); }, showCloseButton: false, closeOnClickOutside: true },
27
- react_1.default.createElement(Inline_1.SearchInline, Object.assign({}, p))));
28
- exports.SearchModal = SearchModal;
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import type { IRefTextEdit } from '../TextEdit';
3
- export interface ISearchBox {
4
- placeholderText?: string;
5
- searchText: string;
6
- setSearchText: (val: string, enterPressed: boolean) => void;
7
- className?: string;
8
- textBoxRef?: React.RefObject<IRefTextEdit | null>;
9
- /**
10
- * if truthy will enable text edit mode by default. if focus is true, will also focus on open
11
- */
12
- defaultEditing?: {
13
- focus?: boolean;
14
- };
15
- }
16
- export declare const SearchBox: (p: ISearchBox) => React.JSX.Element;
@@ -1,107 +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.SearchBox = void 0;
41
- const styled_1 = __importDefault(require("@emotion/styled"));
42
- const react_1 = __importStar(require("react"));
43
- const debounce_1 = require("../../helpers/debounce");
44
- const dom_1 = require("../../helpers/dom");
45
- const icons_1 = require("../../icons");
46
- const styles_1 = require("../../styles");
47
- const TextEdit_1 = require("../TextEdit");
48
- const Base = styled_1.default.div `
49
- padding: 1rem;
50
- display: flex;
51
- flex-flow: row;
52
- justify-content: center;
53
- align-items: center;
54
- width: calc(100% - 2rem);
55
- margin: auto;
56
- position: relative;
57
-
58
- @media ${styles_1.smallScreen} {
59
- padding: 0.5rem;
60
- margin: 0;
61
- width: calc(100% - 1rem);
62
- max-height: calc(100% - 1rem);
63
- }
64
- `;
65
- const MagnifyIcon = styled_1.default.div `
66
- width: 1.5rem;
67
- height: 1.5rem;
68
- margin-right: 0.5rem;
69
- cursor: pointer;
70
- margin-left: 0.5rem;
71
- `;
72
- const CrossIconStyled = (0, styled_1.default)(icons_1.CrossIcon) `
73
- position: absolute;
74
- right: 1rem;
75
- @media ${styles_1.bigScreen} {
76
- right: 2rem;
77
- }
78
- `;
79
- const TextEditStyled = (0, styled_1.default)(TextEdit_1.TextEdit) `
80
- padding: 0;
81
- height: 2.5rem;
82
- background-color: white;
83
- `;
84
- const SearchBox = (p) => {
85
- const ur = (0, react_1.useRef)(p.textBoxRef);
86
- const cr = (0, react_1.createRef)();
87
- const textBoxRef = (!p.textBoxRef ? cr : ur);
88
- (0, react_1.useEffect)(() => {
89
- if (!(textBoxRef === null || textBoxRef === void 0 ? void 0 : textBoxRef.current) ||
90
- textBoxRef.current.getValue() === p.searchText) {
91
- return;
92
- }
93
- textBoxRef.current.setValue(p.searchText);
94
- p.setSearchText(p.searchText, true);
95
- }, [p, textBoxRef]);
96
- return (react_1.default.createElement(Base, Object.assign({ "data-type": "search", className: p.className }, (0, dom_1.filterDataProps)(p)),
97
- react_1.default.createElement(TextEditStyled, { ref: textBoxRef, defaultValue: p.searchText, placeholder: p.placeholderText, defaultEditing: Object.assign({ focus: true }, p.defaultEditing), singleLine: true, leftContent: react_1.default.createElement(MagnifyIcon, { onClick: () => { var _a; return p.setSearchText(((_a = textBoxRef === null || textBoxRef === void 0 ? void 0 : textBoxRef.current) === null || _a === void 0 ? void 0 : _a.getValue()) || '', true); } },
98
- react_1.default.createElement(icons_1.Magnify, null)), allowUndo: false, onClickOutsideWithNoValue: null, onSubmit: (v, enterPressed) => (0, debounce_1.debounce)(() => {
99
- p.setSearchText(v, enterPressed);
100
- }, { key: 'pagesearch', time: 200 }) }),
101
- p.searchText && (react_1.default.createElement(CrossIconStyled, { onClick: () => {
102
- var _a;
103
- (_a = textBoxRef === null || textBoxRef === void 0 ? void 0 : textBoxRef.current) === null || _a === void 0 ? void 0 : _a.setValue('');
104
- p.setSearchText('', true);
105
- } }))));
106
- };
107
- exports.SearchBox = SearchBox;
@@ -1,6 +0,0 @@
1
- export * from './AutoHideSearchBox';
2
- export * from './Dialog';
3
- export * from './Inline';
4
- export * from './Modal';
5
- export * from './SearchBox';
6
- export type * from './types';
@@ -1,21 +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("./AutoHideSearchBox"), exports);
18
- __exportStar(require("./Dialog"), exports);
19
- __exportStar(require("./Inline"), exports);
20
- __exportStar(require("./Modal"), exports);
21
- __exportStar(require("./SearchBox"), exports);
@@ -1,49 +0,0 @@
1
- import type { JSX } from 'react';
2
- import type { IRefTextEdit } from '../TextEdit/types';
3
- export type TSearchModalRes<T> = {
4
- foundItem: T;
5
- searchText: string;
6
- target: EventTarget;
7
- };
8
- export interface ISearchDialog<T> {
9
- defaultValue?: string;
10
- placeholderText?: string;
11
- /**
12
- * method run to render each filtered item
13
- * will inject onClick handler
14
- */
15
- renderItem: ({ searchText, item, index, }: {
16
- searchText: string;
17
- item: T;
18
- index: number;
19
- }) => JSX.Element;
20
- /**
21
- * all potential items
22
- */
23
- displayItems: T[];
24
- /**
25
- * run to filter items by search text
26
- */
27
- willDisplayItem: (searchText: string, item: T) => boolean;
28
- /** how many search items to return at most. default 1000. if -1 will return all */
29
- maxDisplayItems?: number;
30
- /**
31
- * get unique render key
32
- */
33
- getKeyF: (i: T) => string;
34
- className?: string;
35
- texts?: {
36
- /**
37
- * default if not provided: "showing X out of Y total items"
38
- */
39
- totalItems?: (showing: number, outof: number) => string;
40
- };
41
- onSearchTextChange?: (v: string) => void;
42
- onSelectItem?: (v: TSearchModalRes<T> | undefined) => void;
43
- textBoxRef?: React.RefObject<IRefTextEdit | null>;
44
- rowCountOpt?: {
45
- /** if provided will change position of row count when some lines are hidden. default bottom */
46
- display?: 'bottom' | 'top' | 'off';
47
- };
48
- }
49
- export type ISearchModal<T> = ISearchDialog<T>;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- export interface ISidebar {
3
- children: React.ReactNode;
4
- className?: string;
5
- /** default:defaultClosed
6
- * defaultClosed: always closed by default.
7
- * fixedOpen: always open on bigscreen. cant close if bigscreen
8
- */
9
- mode?: 'defaultClosed' | 'fixedOpen';
10
- }
11
- export declare const Sidebar: ({ children, className, mode, }: ISidebar) => React.JSX.Element;