ag-common 0.0.552 → 0.0.554
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.
- package/dist/ui/components/Accordion/index.d.ts +7 -6
- package/dist/ui/components/BorderGradient/index.d.ts +1 -1
- package/dist/ui/components/BorderGradient/index.js +1 -0
- package/dist/ui/components/Close/index.js +1 -3
- package/dist/ui/components/DropdownList/Base.js +4 -2
- package/dist/ui/components/FlexColumn/index.js +5 -7
- package/dist/ui/components/FlexRow/index.js +2 -6
- package/dist/ui/components/Icon/index.js +6 -2
- package/dist/ui/components/OpenApiCodeBlock/OpenApiCodeBlock.js +4 -3
- package/dist/ui/components/OpenApiCodeBlock/helpers/common.js +1 -2
- package/dist/ui/components/RadioGroup/Base.d.ts +16 -0
- package/dist/ui/components/{TextEdit/RadioGroup.js → RadioGroup/Base.js} +36 -19
- package/dist/ui/components/RadioGroup/DarkMode.d.ts +17 -0
- package/dist/ui/components/RadioGroup/DarkMode.js +98 -0
- package/dist/ui/components/RadioGroup/index.d.ts +2 -0
- package/dist/ui/components/RadioGroup/index.js +18 -0
- package/dist/ui/components/RowOrColumn/index.d.ts +3 -3
- package/dist/ui/components/RowOrColumn/index.js +11 -8
- package/dist/ui/components/Search/Dialog.d.ts +1 -1
- package/dist/ui/components/Search/Inline.d.ts +2 -7
- package/dist/ui/components/Search/Inline.js +120 -3
- package/dist/ui/components/Search/Modal.d.ts +2 -4
- package/dist/ui/components/Search/Modal.js +3 -3
- package/dist/ui/components/Search/SearchBox.js +1 -0
- package/dist/ui/components/Search/index.d.ts +0 -1
- package/dist/ui/components/Search/index.js +0 -1
- package/dist/ui/components/Search/types.d.ts +13 -6
- package/dist/ui/components/SparkLine/index.js +2 -3
- package/dist/ui/components/Table/index.js +2 -0
- package/dist/ui/components/TextEdit/CheckboxEdit.d.ts +6 -5
- package/dist/ui/components/TextEdit/CheckboxEdit.js +1 -1
- package/dist/ui/components/TextEdit/index.d.ts +0 -1
- package/dist/ui/components/TextEdit/index.js +0 -1
- package/dist/ui/components/TextWithButton/index.d.ts +6 -5
- package/dist/ui/components/TextWithButton/index.js +1 -0
- package/dist/ui/components/Timeline/index.d.ts +8 -9
- package/dist/ui/components/Timeline/index.js +2 -2
- package/dist/ui/components/TreeChart/base.js +2 -2
- package/dist/ui/components/index.d.ts +1 -0
- package/dist/ui/components/index.js +1 -0
- package/dist/ui/icons/Checkmark.js +1 -1
- package/dist/ui/icons/Circle.js +1 -1
- package/dist/ui/icons/Computer.d.ts +8 -0
- package/dist/ui/icons/Computer.js +10 -0
- package/dist/ui/icons/Magnify.js +1 -1
- package/dist/ui/icons/Moon.d.ts +8 -0
- package/dist/ui/icons/Moon.js +10 -0
- package/dist/ui/icons/Sun.d.ts +6 -0
- package/dist/ui/icons/Sun.js +19 -0
- package/dist/ui/icons/index.d.ts +3 -0
- package/dist/ui/icons/index.js +3 -0
- package/package.json +1 -1
- package/dist/ui/components/Search/Base.d.ts +0 -10
- package/dist/ui/components/Search/Base.js +0 -111
- package/dist/ui/components/TextEdit/RadioGroup.d.ts +0 -14
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export
|
|
2
|
+
export interface IAccordion {
|
|
3
3
|
children: string | JSX.Element | JSX.Element[];
|
|
4
4
|
title: string;
|
|
5
5
|
/** controlled component if provided */
|
|
6
|
-
open?: boolean
|
|
6
|
+
open?: boolean;
|
|
7
7
|
/** called when openness changes */
|
|
8
|
-
setOpen?: (
|
|
9
|
-
chevronColour?: string
|
|
10
|
-
className?: string
|
|
11
|
-
}
|
|
8
|
+
setOpen?: (open: boolean) => void;
|
|
9
|
+
chevronColour?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const Accordion: ({ title, children, open, setOpen, chevronColour, className, }: IAccordion) => React.JSX.Element;
|
|
@@ -9,7 +9,7 @@ export interface IBorderGradient {
|
|
|
9
9
|
radius?: string;
|
|
10
10
|
left?: string;
|
|
11
11
|
right?: string;
|
|
12
|
-
children:
|
|
12
|
+
children: React.ReactNode;
|
|
13
13
|
padding?: string;
|
|
14
14
|
onClick?: (e: IOnClick) => void;
|
|
15
15
|
href?: string;
|
|
@@ -11,6 +11,7 @@ const react_2 = __importDefault(require("react"));
|
|
|
11
11
|
const object_1 = require("../../../common/helpers/object");
|
|
12
12
|
const colours_1 = require("../../styles/colours");
|
|
13
13
|
const BGcss = (0, react_1.css) `
|
|
14
|
+
max-height: calc(100% - 6px);
|
|
14
15
|
display: flex;
|
|
15
16
|
border: 0;
|
|
16
17
|
padding: 3px;
|
|
@@ -37,7 +37,5 @@ const Base = styled_1.default.div `
|
|
|
37
37
|
transform: rotate(-45deg);
|
|
38
38
|
}
|
|
39
39
|
`;
|
|
40
|
-
const Close = (p) => {
|
|
41
|
-
return (react_1.default.createElement(Base, Object.assign({}, (0, dom_1.filterDataProps)(p), { className: p.className, onClick: (e) => { var _a; return (_a = p.onClick) === null || _a === void 0 ? void 0 : _a.call(p, e); } })));
|
|
42
|
-
};
|
|
40
|
+
const Close = (p) => (react_1.default.createElement(Base, Object.assign({}, (0, dom_1.filterDataProps)(p), { className: p.className, onClick: (e) => { var _a; return (_a = p.onClick) === null || _a === void 0 ? void 0 : _a.call(p, e); } })));
|
|
43
41
|
exports.Close = Close;
|
|
@@ -43,6 +43,7 @@ const Base = styled_1.default.div `
|
|
|
43
43
|
justify-content: space-between;
|
|
44
44
|
cursor: pointer;
|
|
45
45
|
flex-grow: 0;
|
|
46
|
+
max-height: 100%;
|
|
46
47
|
`;
|
|
47
48
|
const DropItems = styled_1.default.div `
|
|
48
49
|
flex-flow: column;
|
|
@@ -65,6 +66,7 @@ const ListItemStyle = styled_1.default.div `
|
|
|
65
66
|
padding-left: 0.5rem;
|
|
66
67
|
flex-grow: 1;
|
|
67
68
|
padding: 1rem;
|
|
69
|
+
height: calc(100% - 2rem);
|
|
68
70
|
cursor: pointer;
|
|
69
71
|
display: flex;
|
|
70
72
|
overflow: hidden;
|
|
@@ -120,6 +122,8 @@ function DropdownList(p) {
|
|
|
120
122
|
const maxLen = 20;
|
|
121
123
|
const newStyle = {
|
|
122
124
|
minWidth: `calc(${maxLen}ch + 2rem)`,
|
|
125
|
+
filter: `drop-shadow(1px 1px 0.5rem ${shadow})`,
|
|
126
|
+
maxHeight,
|
|
123
127
|
};
|
|
124
128
|
const minPx = (0, dom_1.convertRemToPixels)(2 + maxLen / 2);
|
|
125
129
|
const offsetLeft = (_b = (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.offsetLeft) !== null && _b !== void 0 ? _b : 0;
|
|
@@ -138,8 +142,6 @@ function DropdownList(p) {
|
|
|
138
142
|
else {
|
|
139
143
|
newStyle.top = '0';
|
|
140
144
|
}
|
|
141
|
-
newStyle.filter = `drop-shadow(1px 1px 0.5rem ${shadow})`;
|
|
142
|
-
newStyle.maxHeight = maxHeight;
|
|
143
145
|
if (JSON.stringify(style) !== JSON.stringify(newStyle)) {
|
|
144
146
|
setStyle(newStyle);
|
|
145
147
|
}
|
|
@@ -12,21 +12,19 @@ const Base = styled_1.default.div `
|
|
|
12
12
|
display: flex;
|
|
13
13
|
flex-flow: column;
|
|
14
14
|
flex-grow: 1;
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100%;
|
|
15
17
|
&[data-center='true'] {
|
|
16
18
|
justify-content: center;
|
|
17
19
|
align-items: center;
|
|
18
20
|
}
|
|
19
21
|
&[data-nogrow='true'] {
|
|
20
22
|
flex-grow: 0;
|
|
21
|
-
|
|
22
|
-
overflow: visible;
|
|
23
|
-
&[data-enableoverflow='false'] {
|
|
24
|
-
overflow: hidden;
|
|
25
|
-
max-width: 100%;
|
|
23
|
+
width: unset;
|
|
26
24
|
}
|
|
27
25
|
`;
|
|
28
26
|
const FlexColumn = (props) => {
|
|
29
|
-
var _a, _b
|
|
30
|
-
return (react_1.default.createElement(Base, Object.assign({
|
|
27
|
+
var _a, _b;
|
|
28
|
+
return (react_1.default.createElement(Base, Object.assign({ "data-nogrow": (_a = props.noGrow) !== null && _a !== void 0 ? _a : false, "data-center": (_b = props.center) !== null && _b !== void 0 ? _b : false }, props), props.children));
|
|
31
29
|
};
|
|
32
30
|
exports.FlexColumn = FlexColumn;
|
|
@@ -30,13 +30,9 @@ const Base = styled_1.default.div `
|
|
|
30
30
|
justify-content: center;
|
|
31
31
|
align-items: center;
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
&[data-enableoverflow='true'] {
|
|
35
|
-
overflow: visible;
|
|
36
|
-
}
|
|
37
33
|
`;
|
|
38
34
|
const FlexRow = (props) => {
|
|
39
|
-
var _a, _b, _c
|
|
40
|
-
return (react_1.default.createElement(Base, Object.assign({
|
|
35
|
+
var _a, _b, _c;
|
|
36
|
+
return (react_1.default.createElement(Base, Object.assign({ "data-nowrap": (_a = props.noWrap) !== null && _a !== void 0 ? _a : false, "data-nogrow": (_b = props.noGrow) !== null && _b !== void 0 ? _b : false, "data-center": (_c = props.center) !== null && _c !== void 0 ? _c : false }, props), props.children));
|
|
41
37
|
};
|
|
42
38
|
exports.FlexRow = FlexRow;
|
|
@@ -16,6 +16,10 @@ exports.IconF = styled_1.default.span `
|
|
|
16
16
|
align-items: center;
|
|
17
17
|
font-size: 2rem;
|
|
18
18
|
cursor: inherit;
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
padding: 0;
|
|
22
|
+
margin: unset;
|
|
19
23
|
&[data-chnd='true'] {
|
|
20
24
|
cursor: pointer;
|
|
21
25
|
&:hover {
|
|
@@ -53,7 +57,7 @@ const Icon = (pr) => {
|
|
|
53
57
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
54
58
|
const { className, children, disabled, onClick } = pr;
|
|
55
59
|
const CHND = pr.canHover && !pr.disabled;
|
|
56
|
-
const style = (0, object_1.removeUndefValuesFromObject)(Object.assign(Object.assign({}, ((_a = pr === null || pr === void 0 ? void 0 : pr.style) !== null && _a !== void 0 ? _a : {})), { '--fill': (_c = (_b = pr.style) === null || _b === void 0 ? void 0 : _b.fill) !== null && _c !== void 0 ? _c : null, width: (
|
|
57
|
-
return (react_1.default.createElement(exports.IconF, Object.assign({}, pr, { className: className, onClick: (e) => !disabled && (onClick === null || onClick === void 0 ? void 0 : onClick(e)), style: style, "data-chnd": CHND, "data-hasoutline": pr.outline, "data-hasfill": !!((_h = pr.style) === null || _h === void 0 ? void 0 : _h.fill) }), children));
|
|
60
|
+
const style = (0, object_1.removeUndefValuesFromObject)(Object.assign(Object.assign({}, ((_a = pr === null || pr === void 0 ? void 0 : pr.style) !== null && _a !== void 0 ? _a : {})), { '--fill': (_c = (_b = pr.style) === null || _b === void 0 ? void 0 : _b.fill) !== null && _c !== void 0 ? _c : null, width: (_d = pr.style) === null || _d === void 0 ? void 0 : _d.width, height: (_e = pr.style) === null || _e === void 0 ? void 0 : _e.height, padding: (_f = pr.style) === null || _f === void 0 ? void 0 : _f.padding, margin: (_g = pr.style) === null || _g === void 0 ? void 0 : _g.margin, transform: !pr.rotate ? null : `rotate(${pr.rotate || 0}deg)`, filter: !pr.disabled ? null : 'grayscale(1)', '--outlinecolour': pr.outline || null }));
|
|
61
|
+
return (react_1.default.createElement(exports.IconF, Object.assign({}, pr, { className: className, onClick: (e) => !disabled && (onClick === null || onClick === void 0 ? void 0 : onClick(e)), style: style, "data-chnd": CHND, "data-hasoutline": pr.outline, "data-hasfill": !!((_h = pr.style) === null || _h === void 0 ? void 0 : _h.fill), "data-type": "iconbox" }), children));
|
|
58
62
|
};
|
|
59
63
|
exports.Icon = Icon;
|
|
@@ -14,11 +14,12 @@ const common_1 = require("./helpers/common");
|
|
|
14
14
|
const Base = styled_1.default.div `
|
|
15
15
|
display: flex;
|
|
16
16
|
flex-flow: column;
|
|
17
|
-
width: calc(100% -
|
|
17
|
+
width: calc(100% - 2rem);
|
|
18
18
|
flex-grow: 1;
|
|
19
19
|
border: solid 1px #333;
|
|
20
|
-
margin: 1rem;
|
|
21
20
|
padding: 1rem;
|
|
21
|
+
overflow-y: auto;
|
|
22
|
+
max-height: calc(100% - 2rem);
|
|
22
23
|
`;
|
|
23
24
|
const Verb = styled_1.default.div `
|
|
24
25
|
background-color: #333;
|
|
@@ -49,7 +50,7 @@ const OpenApiCodeBlock = (p) => {
|
|
|
49
50
|
}
|
|
50
51
|
const { verb, operation, path } = ops;
|
|
51
52
|
return (react_1.default.createElement(Base, null,
|
|
52
|
-
react_1.default.createElement(FlexRow_1.FlexRow, { center: true },
|
|
53
|
+
react_1.default.createElement(FlexRow_1.FlexRow, { center: true, noGrow: true },
|
|
53
54
|
react_1.default.createElement(Verb, null, verb),
|
|
54
55
|
react_1.default.createElement(ApiName, null, (_a = operation.description) !== null && _a !== void 0 ? _a : path)),
|
|
55
56
|
react_1.default.createElement(BlockTitle, null, "Definition"),
|
|
@@ -8,7 +8,6 @@ exports.getSecurity = exports.getBodyJson = exports.getOperation = exports.Highl
|
|
|
8
8
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
9
9
|
exports.Highlight = styled_1.default.span `
|
|
10
10
|
color: green;
|
|
11
|
-
text-transform: capitalize;
|
|
12
11
|
`;
|
|
13
12
|
exports.Highlight2 = styled_1.default.span `
|
|
14
13
|
color: indianred;
|
|
@@ -29,7 +28,7 @@ const getApiUrl = (p) => {
|
|
|
29
28
|
const getFunctionName = (p) => {
|
|
30
29
|
let ret = p.funcF.toString();
|
|
31
30
|
const i1 = ret.indexOf('.') + 1;
|
|
32
|
-
const i2 =
|
|
31
|
+
const i2 = ret.indexOf('(', i1);
|
|
33
32
|
ret = ret.substring(i1, i2);
|
|
34
33
|
return ret;
|
|
35
34
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface IRadioGroup<T> {
|
|
4
|
+
/**
|
|
5
|
+
* can overload the render of the label. defaults to toString
|
|
6
|
+
*/
|
|
7
|
+
renderLabel?: (a: T, selected: boolean) => JSX.Element;
|
|
8
|
+
defaultIndex: number;
|
|
9
|
+
onSubmit: (val: T, index: number) => void;
|
|
10
|
+
values: T[];
|
|
11
|
+
className?: string;
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
/** default horiz */
|
|
14
|
+
mode?: 'vert' | 'horiz';
|
|
15
|
+
}
|
|
16
|
+
export declare const RadioGroup: <T>(p: IRadioGroup<T>) => React.JSX.Element;
|
|
@@ -31,25 +31,42 @@ exports.RadioGroup = void 0;
|
|
|
31
31
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
32
32
|
const react_1 = __importStar(require("react"));
|
|
33
33
|
const common_1 = require("../../styles/common");
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
34
|
+
const Base = styled_1.default.div `
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-flow: row;
|
|
37
|
+
&[data-mode='vert'] {
|
|
38
|
+
flex-flow: column;
|
|
39
|
+
}
|
|
40
|
+
border-radius: 2rem;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
justify-content: space-between;
|
|
43
|
+
`;
|
|
44
|
+
const Label = styled_1.default.label `
|
|
45
|
+
text-align: center;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
|
|
48
|
+
&[data-selected='true'] {
|
|
49
|
+
cursor: default;
|
|
50
|
+
}
|
|
51
|
+
&[data-selected='false'] {
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
const RadioGroup = (p) => {
|
|
56
|
+
var _a, _b;
|
|
50
57
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
const { renderLabel = (x) => x.toString() } = p;
|
|
59
|
+
const [index, setIndex] = (0, react_1.useState)((_a = p.defaultIndex) !== null && _a !== void 0 ? _a : 0);
|
|
60
|
+
return (react_1.default.createElement(Base, Object.assign({}, common_1.noDrag, { className: p.className, style: p.style, "data-mode": (_b = p.mode) !== null && _b !== void 0 ? _b : 'horiz' }), p.values.map((v, i) => (react_1.default.createElement(Label
|
|
61
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
62
|
+
, {
|
|
63
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
64
|
+
key: i.toString(), "data-selected": index === i, onClick: () => {
|
|
65
|
+
if (index === i) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
setIndex(i);
|
|
69
|
+
p.onSubmit(v, i);
|
|
70
|
+
} }, renderLabel(v, index === i))))));
|
|
54
71
|
};
|
|
55
72
|
exports.RadioGroup = RadioGroup;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare enum TDarkMode {
|
|
3
|
+
'dark' = 0,
|
|
4
|
+
'light' = 1,
|
|
5
|
+
'system' = 2
|
|
6
|
+
}
|
|
7
|
+
export interface IDarkMode {
|
|
8
|
+
/** default system */
|
|
9
|
+
default?: TDarkMode;
|
|
10
|
+
onSubmit: (p: TDarkMode) => void;
|
|
11
|
+
/** default horiz */
|
|
12
|
+
mode?: 'vert' | 'horiz';
|
|
13
|
+
/** default 2.5rem */
|
|
14
|
+
iconSize?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const DarkMode: (p: IDarkMode) => React.JSX.Element;
|
|
@@ -0,0 +1,98 @@
|
|
|
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 (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.DarkMode = exports.TDarkMode = void 0;
|
|
31
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
32
|
+
const react_1 = __importStar(require("react"));
|
|
33
|
+
const icons_1 = require("../../icons");
|
|
34
|
+
const FlexColumn_1 = require("../FlexColumn");
|
|
35
|
+
const Icon_1 = require("../Icon");
|
|
36
|
+
const Base_1 = require("./Base");
|
|
37
|
+
var TDarkMode;
|
|
38
|
+
(function (TDarkMode) {
|
|
39
|
+
TDarkMode[TDarkMode["dark"] = 0] = "dark";
|
|
40
|
+
TDarkMode[TDarkMode["light"] = 1] = "light";
|
|
41
|
+
TDarkMode[TDarkMode["system"] = 2] = "system";
|
|
42
|
+
})(TDarkMode || (exports.TDarkMode = TDarkMode = {}));
|
|
43
|
+
const IconStyled = (0, styled_1.default)(Icon_1.Icon) `
|
|
44
|
+
> svg {
|
|
45
|
+
height: 60%;
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
const Label = (0, styled_1.default)(FlexColumn_1.FlexColumn) `
|
|
49
|
+
border-radius: 50%;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
&[data-selected='true'] {
|
|
52
|
+
background-color: white;
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
const getColours = (p, vert) => {
|
|
56
|
+
const deg = vert ? '180deg' : '90deg';
|
|
57
|
+
switch (p) {
|
|
58
|
+
case TDarkMode.dark: {
|
|
59
|
+
const d1 = 'rgba(173,128,227,1)';
|
|
60
|
+
const d2 = 'rgba(106,44,181,1)';
|
|
61
|
+
return [d1, `linear-gradient(${deg}, ${d1} 0%, ${d2} 76%)`];
|
|
62
|
+
}
|
|
63
|
+
case TDarkMode.light: {
|
|
64
|
+
const l1 = 'rgba(255,169,54,1)';
|
|
65
|
+
const l2 = 'rgba(255,189,100,1)';
|
|
66
|
+
return [l1, `linear-gradient(${deg}, ${l1} 0%, ${l2} 76%)`];
|
|
67
|
+
}
|
|
68
|
+
case TDarkMode.system: {
|
|
69
|
+
return ['green', 'green'];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const v = [
|
|
74
|
+
{ mode: TDarkMode.dark, icon: icons_1.Moon },
|
|
75
|
+
{ mode: TDarkMode.system, icon: icons_1.Computer },
|
|
76
|
+
{ mode: TDarkMode.light, icon: icons_1.Sun },
|
|
77
|
+
];
|
|
78
|
+
const DarkMode = (p) => {
|
|
79
|
+
const { iconSize = '2.5rem' } = p;
|
|
80
|
+
let defaultIndex = v.findIndex((v2) => v2.mode === p.default);
|
|
81
|
+
if (defaultIndex === -1) {
|
|
82
|
+
defaultIndex = 1;
|
|
83
|
+
}
|
|
84
|
+
const [index, setIndex] = (0, react_1.useState)(defaultIndex);
|
|
85
|
+
const [fill, background] = getColours(v[index].mode, p.mode === 'vert');
|
|
86
|
+
const twCalc = `calc(${iconSize} + ${iconSize} + ${iconSize} + 20px)`;
|
|
87
|
+
return (react_1.default.createElement(Base_1.RadioGroup, { className: p.className, mode: p.mode, values: v, defaultIndex: index, onSubmit: (v, i) => {
|
|
88
|
+
setIndex(i);
|
|
89
|
+
p.onSubmit(v.mode);
|
|
90
|
+
}, style: Object.assign({ background, border: `solid 2px ${fill}`, width: twCalc, height: iconSize }, (p.mode === 'vert' && {
|
|
91
|
+
width: iconSize,
|
|
92
|
+
height: twCalc,
|
|
93
|
+
})), renderLabel: (v, selected) => {
|
|
94
|
+
return (react_1.default.createElement(Label, { "data-selected": selected, style: { width: iconSize, height: iconSize } },
|
|
95
|
+
react_1.default.createElement(IconStyled, null, v.icon({ style: { fill: selected ? fill : 'white' } }))));
|
|
96
|
+
} }));
|
|
97
|
+
};
|
|
98
|
+
exports.DarkMode = DarkMode;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Base"), exports);
|
|
18
|
+
__exportStar(require("./DarkMode"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export interface IRowOrColumn {
|
|
4
4
|
noGrow?: boolean;
|
|
@@ -6,8 +6,8 @@ export interface IRowOrColumn {
|
|
|
6
6
|
noWrap?: boolean;
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
className?: string;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
break?: 'small' | 'vsmall';
|
|
10
|
+
style?: CSSProperties;
|
|
11
11
|
}
|
|
12
12
|
export type IFlexColumn = IRowOrColumn;
|
|
13
13
|
export type IFlexRow = IRowOrColumn;
|
|
@@ -10,7 +10,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
10
10
|
const media_1 = require("../../styles/media");
|
|
11
11
|
const Base = styled_1.default.div `
|
|
12
12
|
display: flex;
|
|
13
|
-
flex-flow: row
|
|
13
|
+
flex-flow: row;
|
|
14
14
|
flex-grow: 1;
|
|
15
15
|
width: 100%;
|
|
16
16
|
@media ${media_1.bigScreen} {
|
|
@@ -18,10 +18,16 @@ const Base = styled_1.default.div `
|
|
|
18
18
|
flex-flow: row;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
+
&[data-break='small'] {
|
|
22
|
+
@media ${media_1.smallScreen} {
|
|
23
|
+
flex-flow: column;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
21
26
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
&[data-break='vsmall'] {
|
|
28
|
+
@media ${media_1.vSmallScreen} {
|
|
29
|
+
flex-flow: column;
|
|
30
|
+
}
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
&[data-center='true'] {
|
|
@@ -32,12 +38,9 @@ const Base = styled_1.default.div `
|
|
|
32
38
|
flex-grow: 0;
|
|
33
39
|
width: auto;
|
|
34
40
|
}
|
|
35
|
-
&[data-enableoverflow='true'] {
|
|
36
|
-
overflow: visible;
|
|
37
|
-
}
|
|
38
41
|
`;
|
|
39
42
|
const RowOrColumn = (props) => {
|
|
40
43
|
var _a, _b, _c, _d;
|
|
41
|
-
return (react_1.default.createElement(Base, Object.assign({
|
|
44
|
+
return (react_1.default.createElement(Base, Object.assign({ "data-nogrow": (_a = props.noGrow) !== null && _a !== void 0 ? _a : false, "data-center": (_b = props.center) !== null && _b !== void 0 ? _b : false, "data-nowrap": (_c = props.noWrap) !== null && _c !== void 0 ? _c : false }, props, { "data-break": (_d = props.break) !== null && _d !== void 0 ? _d : 'small' }), props.children));
|
|
42
45
|
};
|
|
43
46
|
exports.RowOrColumn = RowOrColumn;
|
|
@@ -4,4 +4,4 @@ import type { ISearchDialog, TSearchModalRes } from './types';
|
|
|
4
4
|
* @param p
|
|
5
5
|
* @returns
|
|
6
6
|
*/
|
|
7
|
-
export declare const SearchDialog: <T>(p: ISearchDialog<T>) => Promise<TSearchModalRes<T
|
|
7
|
+
export declare const SearchDialog: <T>(p: ISearchDialog<T>) => Promise<TSearchModalRes<T> | undefined>;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export declare const SearchInline: <T>(p: ISearchInline<T> & {
|
|
5
|
-
onSelectItem?: ((v: TSearchModalRes<T>) => void) | undefined;
|
|
6
|
-
onSearchTextChange?: ((v: string) => void) | undefined;
|
|
7
|
-
textBoxRef?: React.RefObject<IRefTextEdit> | undefined;
|
|
8
|
-
}) => React.JSX.Element;
|
|
2
|
+
import type { ISearchDialog } from './types';
|
|
3
|
+
export declare const SearchInline: <T>(p: ISearchDialog<T>) => React.JSX.Element;
|
|
@@ -1,10 +1,127 @@
|
|
|
1
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 (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
2
26
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
27
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
28
|
};
|
|
5
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
30
|
exports.SearchInline = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
31
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
32
|
+
const react_1 = __importStar(require("react"));
|
|
33
|
+
const array_1 = require("../../../common/helpers/array");
|
|
34
|
+
const styles_1 = require("../../styles");
|
|
35
|
+
const SearchBox_1 = require("./SearchBox");
|
|
36
|
+
const Base = styled_1.default.div `
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-flow: column;
|
|
39
|
+
flex-grow: 1;
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: calc(100% - 1rem);
|
|
42
|
+
@media ${styles_1.smallScreen} {
|
|
43
|
+
height: calc(100% - 0.5rem);
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
const Content = styled_1.default.div `
|
|
47
|
+
width: calc(100% - 2rem);
|
|
48
|
+
margin: auto;
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-flow: column;
|
|
51
|
+
justify-content: flex-start;
|
|
52
|
+
align-items: center;
|
|
53
|
+
max-height: 100%;
|
|
54
|
+
overflow-y: auto;
|
|
55
|
+
overflow-x: hidden;
|
|
56
|
+
|
|
57
|
+
flex-grow: 1;
|
|
58
|
+
&[data-hasitems='true'] {
|
|
59
|
+
padding-bottom: 0.5rem;
|
|
60
|
+
}
|
|
61
|
+
@media ${styles_1.smallScreen} {
|
|
62
|
+
margin: 0;
|
|
63
|
+
width: calc(100% - 0.5rem);
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
const RowCount = styled_1.default.div `
|
|
67
|
+
width: 100%;
|
|
68
|
+
text-align: center;
|
|
69
|
+
width: fit-content;
|
|
70
|
+
text-decoration-color: currentcolor;
|
|
71
|
+
text-decoration: underline;
|
|
72
|
+
|
|
73
|
+
&[data-top='true'] {
|
|
74
|
+
padding-bottom: 0.5rem;
|
|
75
|
+
}
|
|
76
|
+
&[data-top='false'] {
|
|
77
|
+
padding-top: 0.5rem;
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
const SearchInline = (p) => {
|
|
81
|
+
var _a, _b, _c, _d, _e, _f;
|
|
82
|
+
const { maxDisplayItems = 1000 } = p;
|
|
83
|
+
const rowCountOptDisplay = (_b = (_a = p === null || p === void 0 ? void 0 : p.rowCountOpt) === null || _a === void 0 ? void 0 : _a.display) !== null && _b !== void 0 ? _b : 'bottom';
|
|
84
|
+
const [searchText, setSearchText] = (0, react_1.useState)((_c = p.defaultValue) !== null && _c !== void 0 ? _c : '');
|
|
85
|
+
(0, react_1.useImperativeHandle)(p.textBoxRef, () => ({
|
|
86
|
+
setValue: (v) => {
|
|
87
|
+
var _a, _b;
|
|
88
|
+
const value = (_a = textBoxRef === null || textBoxRef === void 0 ? void 0 : textBoxRef.current) === null || _a === void 0 ? void 0 : _a.getValue();
|
|
89
|
+
if (v === value) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
(_b = textBoxRef === null || textBoxRef === void 0 ? void 0 : textBoxRef.current) === null || _b === void 0 ? void 0 : _b.setValue(v);
|
|
93
|
+
setSearchText(v);
|
|
94
|
+
},
|
|
95
|
+
focus: () => { var _a; return (_a = textBoxRef === null || textBoxRef === void 0 ? void 0 : textBoxRef.current) === null || _a === void 0 ? void 0 : _a.focus(); },
|
|
96
|
+
getValue: () => { var _a; return (_a = textBoxRef === null || textBoxRef === void 0 ? void 0 : textBoxRef.current) === null || _a === void 0 ? void 0 : _a.getValue(); },
|
|
97
|
+
}));
|
|
98
|
+
const textBoxRef = (0, react_1.useRef)(null);
|
|
99
|
+
const resWrap = (foundItem, target) => {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
if (!foundItem) {
|
|
102
|
+
(_a = p.onSelectItem) === null || _a === void 0 ? void 0 : _a.call(p, undefined);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
(_b = p.onSelectItem) === null || _b === void 0 ? void 0 : _b.call(p, { foundItem, searchText, target });
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const filteredItemsRaw = p.displayItems.filter((i) => p.willDisplayItem(searchText, i));
|
|
109
|
+
const { part: filteredItems } = (0, array_1.take)(filteredItemsRaw, maxDisplayItems < 0 ? filteredItemsRaw.length : maxDisplayItems);
|
|
110
|
+
const outdiff = filteredItems.length !== p.displayItems.length;
|
|
111
|
+
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
|
|
112
|
+
items`;
|
|
113
|
+
return (react_1.default.createElement(Base, { className: p.className },
|
|
114
|
+
react_1.default.createElement(SearchBox_1.SearchBox, Object.assign({}, p, { searchText: searchText, setSearchText: (t) => {
|
|
115
|
+
var _a;
|
|
116
|
+
setSearchText(t);
|
|
117
|
+
(_a = p.onSearchTextChange) === null || _a === void 0 ? void 0 : _a.call(p, t);
|
|
118
|
+
}, textBoxRef: textBoxRef })),
|
|
119
|
+
react_1.default.createElement(Content, { "data-hasitems": !!filteredItems.length, "data-type": "content" },
|
|
120
|
+
rowCountOptDisplay === 'top' && outdiff && (react_1.default.createElement(RowCount, { "data-top": "true" }, showText)),
|
|
121
|
+
filteredItems.map((item, index) => (0, react_1.cloneElement)(p.renderItem({ searchText, item, index }), {
|
|
122
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
123
|
+
onClick: (e) => resWrap(item, e.target),
|
|
124
|
+
})),
|
|
125
|
+
rowCountOptDisplay === 'bottom' && outdiff && (react_1.default.createElement(RowCount, { "data-top": "false" }, showText)))));
|
|
126
|
+
};
|
|
10
127
|
exports.SearchInline = SearchInline;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ISearchModal
|
|
3
|
-
export declare const SearchModal: <T>(p: ISearchModal<T>
|
|
4
|
-
onSelectItem: (v: TSearchModalRes<T>) => void;
|
|
5
|
-
}) => React.JSX.Element;
|
|
2
|
+
import type { ISearchModal } from './types';
|
|
3
|
+
export declare const SearchModal: <T>(p: ISearchModal<T>) => React.JSX.Element;
|
|
@@ -9,7 +9,7 @@ const styled_1 = __importDefault(require("@emotion/styled"));
|
|
|
9
9
|
const react_1 = __importDefault(require("react"));
|
|
10
10
|
const styles_1 = require("../../styles");
|
|
11
11
|
const Modal_1 = require("../Modal/Modal");
|
|
12
|
-
const
|
|
12
|
+
const Inline_1 = require("./Inline");
|
|
13
13
|
const ModalStyled = (0, styled_1.default)(Modal_1.Modal) `
|
|
14
14
|
display: flex;
|
|
15
15
|
flex-flow: column;
|
|
@@ -23,6 +23,6 @@ const ModalStyled = (0, styled_1.default)(Modal_1.Modal) `
|
|
|
23
23
|
max-width: 95vw;
|
|
24
24
|
}
|
|
25
25
|
`;
|
|
26
|
-
const SearchModal = (p) => (react_1.default.createElement(ModalStyled, { position: "center", topPosition: "center", open: true, setOpen: () => p.onSelectItem(undefined), showCloseButton: false, closeOnClickOutside: true },
|
|
27
|
-
react_1.default.createElement(
|
|
26
|
+
const SearchModal = (p) => (react_1.default.createElement(ModalStyled, { position: "center", topPosition: "center", open: true, setOpen: () => { var _a; return (_a = p === null || p === void 0 ? void 0 : 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
28
|
exports.SearchModal = SearchModal;
|
|
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./AutoHideSearchBox"), exports);
|
|
18
|
-
__exportStar(require("./Base"), exports);
|
|
19
18
|
__exportStar(require("./Dialog"), exports);
|
|
20
19
|
__exportStar(require("./Inline"), exports);
|
|
21
20
|
__exportStar(require("./Modal"), exports);
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import type { IRefTextEdit } from '../TextEdit/types';
|
|
3
|
+
export type TSearchModalRes<T> = {
|
|
4
|
+
foundItem: T;
|
|
5
|
+
searchText: string;
|
|
6
|
+
target: EventTarget;
|
|
7
|
+
};
|
|
2
8
|
export interface ISearchDialog<T> {
|
|
3
9
|
defaultValue?: string;
|
|
4
10
|
placeholderText?: string;
|
|
@@ -32,11 +38,12 @@ export interface ISearchDialog<T> {
|
|
|
32
38
|
*/
|
|
33
39
|
totalItems?: (showing: number, outof: number) => string;
|
|
34
40
|
};
|
|
41
|
+
onSearchTextChange?: (v: string) => void;
|
|
42
|
+
onSelectItem?: (v: TSearchModalRes<T> | undefined) => void;
|
|
43
|
+
textBoxRef?: React.RefObject<IRefTextEdit>;
|
|
44
|
+
rowCountOpt?: {
|
|
45
|
+
/** if provided will change position of row count when some lines are hidden. default bottom */
|
|
46
|
+
display?: 'bottom' | 'top' | 'off';
|
|
47
|
+
};
|
|
35
48
|
}
|
|
36
|
-
export type TSearchModalRes<T> = undefined | {
|
|
37
|
-
foundItem: T;
|
|
38
|
-
searchText: string;
|
|
39
|
-
target: EventTarget;
|
|
40
|
-
};
|
|
41
49
|
export type ISearchModal<T> = ISearchDialog<T>;
|
|
42
|
-
export type ISearchInline<T> = ISearchDialog<T>;
|
|
@@ -9,15 +9,14 @@ const styled_1 = __importDefault(require("@emotion/styled"));
|
|
|
9
9
|
const react_1 = __importDefault(require("react"));
|
|
10
10
|
const math_1 = require("../../../common/helpers/math");
|
|
11
11
|
const Base = styled_1.default.div `
|
|
12
|
-
width: calc(100% -
|
|
13
|
-
height: 100
|
|
12
|
+
width: calc(100% - 1rem - 2px);
|
|
13
|
+
height: calc(100% - 1rem - 2px);
|
|
14
14
|
border: solid 1px #666;
|
|
15
15
|
border-radius: 0.5rem;
|
|
16
16
|
padding: 0.5rem;
|
|
17
17
|
`;
|
|
18
18
|
const Points = styled_1.default.div `
|
|
19
19
|
position: relative;
|
|
20
|
-
|
|
21
20
|
width: 100%;
|
|
22
21
|
height: 100%;
|
|
23
22
|
`;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export
|
|
3
|
-
className?: string
|
|
2
|
+
export interface ICheckboxEdit {
|
|
3
|
+
className?: string;
|
|
4
4
|
defaultValue: boolean;
|
|
5
5
|
onSubmit: (val: boolean) => void;
|
|
6
|
-
noGrow?: boolean
|
|
6
|
+
noGrow?: boolean;
|
|
7
7
|
/**
|
|
8
8
|
* if true, will add undo button after changes. if false, will submit after every keypress. default true
|
|
9
9
|
*/
|
|
10
|
-
allowUndo?: boolean
|
|
10
|
+
allowUndo?: boolean;
|
|
11
11
|
/** display to right of CB */
|
|
12
12
|
rightSpan?: React.ReactNode;
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
|
+
export declare const CheckboxEdit: ({ defaultValue, onSubmit, noGrow, allowUndo, rightSpan, className, }: ICheckboxEdit) => React.JSX.Element;
|
|
@@ -78,7 +78,7 @@ allowUndo = true, rightSpan, className, }) => {
|
|
|
78
78
|
}
|
|
79
79
|
e.stopPropagation();
|
|
80
80
|
} }),
|
|
81
|
-
allowUndo && value !== defaultValue && (react_1.default.createElement(Icons, { center: true
|
|
81
|
+
allowUndo && value !== defaultValue && (react_1.default.createElement(Icons, { center: true },
|
|
82
82
|
react_1.default.createElement(common_2.IconD, { style: common_2.iconLeft, onClick: (e) => {
|
|
83
83
|
if (value !== defaultValue) {
|
|
84
84
|
onSubmit(value);
|
|
@@ -17,6 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./CheckboxEdit"), exports);
|
|
18
18
|
__exportStar(require("./ColourEdit"), exports);
|
|
19
19
|
__exportStar(require("./ListboxEdit"), exports);
|
|
20
|
-
__exportStar(require("./RadioGroup"), exports);
|
|
21
20
|
__exportStar(require("./TextEdit"), exports);
|
|
22
21
|
__exportStar(require("./types"), exports);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export
|
|
2
|
+
export interface ITextWithButton {
|
|
3
3
|
/** default "Submit" */
|
|
4
|
-
submitText?: string
|
|
5
|
-
placeholder?: string
|
|
4
|
+
submitText?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
6
|
/** if provided will validate and block submission accordingly */
|
|
7
|
-
validateF?: (
|
|
7
|
+
validateF?: (s: string) => boolean;
|
|
8
8
|
onSubmit: (s: string) => void;
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
|
+
export declare const TextWithButton: ({ submitText, placeholder, validateF, onSubmit, }: ITextWithButton) => React.JSX.Element;
|
|
@@ -8,16 +8,15 @@ export type ITimelineItem = {
|
|
|
8
8
|
checked: false;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
});
|
|
11
|
-
export
|
|
11
|
+
export interface ITimeline {
|
|
12
12
|
/** default min(5vw,3rem) */
|
|
13
|
-
maxCircleSize?: string
|
|
13
|
+
maxCircleSize?: string;
|
|
14
14
|
/** default #ccc */
|
|
15
|
-
lineColour?: string
|
|
15
|
+
lineColour?: string;
|
|
16
16
|
items: ITimelineItem[];
|
|
17
|
-
onClick?: (
|
|
18
|
-
className?: string
|
|
19
|
-
/** used for behind icons. default inherit */
|
|
20
|
-
bgColour?: string | undefined;
|
|
17
|
+
onClick?: (p: ITimelineItem) => void;
|
|
18
|
+
className?: string;
|
|
21
19
|
/** if true, will show titles under timeline. default true */
|
|
22
|
-
showTitles?: boolean
|
|
23
|
-
}
|
|
20
|
+
showTitles?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare const Timeline: ({ lineColour, items, onClick, maxCircleSize, className, showTitles, }: ITimeline) => React.JSX.Element;
|
|
@@ -46,7 +46,7 @@ const Item = styled_1.default.div `
|
|
|
46
46
|
const Title = styled_1.default.span `
|
|
47
47
|
text-align: center;
|
|
48
48
|
`;
|
|
49
|
-
const Timeline = ({ lineColour = '#ccc', items, onClick, maxCircleSize = 'min(5vw,3rem)', className,
|
|
49
|
+
const Timeline = ({ lineColour = '#ccc', items, onClick, maxCircleSize = 'min(5vw,3rem)', className, showTitles = true, }) => {
|
|
50
50
|
const firstFalse = items.findIndex((i) => !i.checked && !i.disabled);
|
|
51
51
|
const lastTrue = (0, array_1.findLastIndex)(items, (i) => i.checked);
|
|
52
52
|
return (react_1.default.createElement(Base, { className: className },
|
|
@@ -58,7 +58,7 @@ const Timeline = ({ lineColour = '#ccc', items, onClick, maxCircleSize = 'min(5v
|
|
|
58
58
|
react_1.default.createElement(Icon_1.Icon, { style: {
|
|
59
59
|
maxWidth: maxCircleSize,
|
|
60
60
|
cursor: enabled ? 'pointer' : 'default',
|
|
61
|
-
}, onClick: () => enabled && (onClick === null || onClick === void 0 ? void 0 : onClick(p)) }, p.checked ? (react_1.default.createElement(icons_1.Checkmark, { style: { fill: '#60b515', backgroundColor:
|
|
61
|
+
}, 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' } })))));
|
|
62
62
|
})),
|
|
63
63
|
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: {
|
|
64
64
|
width: `${100 / items.length}%`,
|
|
@@ -36,8 +36,8 @@ const common_1 = require("../../styles/common");
|
|
|
36
36
|
const helpers_1 = require("./helpers");
|
|
37
37
|
const Base = styled_1.default.div `
|
|
38
38
|
border: solid 1px #ccc;
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
max-height: 100%;
|
|
40
|
+
overflow-y: auto;
|
|
41
41
|
`;
|
|
42
42
|
const NodeChildren = styled_1.default.div `
|
|
43
43
|
display: flex;
|
|
@@ -35,6 +35,7 @@ __exportStar(require("./OpenApiCodeBlock"), exports);
|
|
|
35
35
|
__exportStar(require("./PieChart"), exports);
|
|
36
36
|
__exportStar(require("./ProgressBar"), exports);
|
|
37
37
|
__exportStar(require("./Prompt"), exports);
|
|
38
|
+
__exportStar(require("./RadioGroup"), exports);
|
|
38
39
|
__exportStar(require("./RowOrColumn"), exports);
|
|
39
40
|
__exportStar(require("./Search"), exports);
|
|
40
41
|
__exportStar(require("./Sidebar"), exports);
|
|
@@ -7,7 +7,7 @@ exports.Checkmark = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const Checkmark = ({ style, }) => {
|
|
9
9
|
var _a;
|
|
10
|
-
return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "2 2 20 20", style: Object.assign(
|
|
10
|
+
return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "2 2 20 20", style: Object.assign({}, style) },
|
|
11
11
|
react_1.default.createElement("path", { fill: "none", stroke: (_a = style === null || style === void 0 ? void 0 : style.fill) !== null && _a !== void 0 ? _a : '#000', strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M8 12.333 10.461 15 16 9m5 3a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" })));
|
|
12
12
|
};
|
|
13
13
|
exports.Checkmark = Checkmark;
|
package/dist/ui/icons/Circle.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.Circle = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const Circle = ({ style, dotted = false, }) => {
|
|
9
9
|
var _a;
|
|
10
|
-
return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "2 2 20 20", style: Object.assign(
|
|
10
|
+
return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "2 2 20 20", style: Object.assign({}, style) },
|
|
11
11
|
react_1.default.createElement("path", { fill: "none", stroke: (_a = style === null || style === void 0 ? void 0 : style.fill) !== null && _a !== void 0 ? _a : '#000', strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: !dotted ? '' : '4 4', strokeWidth: "2", d: "M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" })));
|
|
12
12
|
};
|
|
13
13
|
exports.Circle = Circle;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare const Computer: ({ style, }: {
|
|
4
|
+
style?: ({
|
|
5
|
+
/** change the colour of the icon. default black */
|
|
6
|
+
fill?: string | undefined;
|
|
7
|
+
} & CSSProperties) | undefined;
|
|
8
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Computer = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const Computer = ({ style, }) => (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: Object.assign({}, style) },
|
|
9
|
+
react_1.default.createElement("path", { fillRule: "evenodd", d: "M2 6a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-6v1h2a1 1 0 1 1 0 2H9a1 1 0 1 1 0-2h2v-1H5a3 3 0 0 1-3-3V6Zm3-1a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H5Z", clipRule: "evenodd" })));
|
|
10
|
+
exports.Computer = Computer;
|
package/dist/ui/icons/Magnify.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.Magnify = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const Magnify = ({ style, }) => {
|
|
9
9
|
var _a;
|
|
10
|
-
return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 490 490" },
|
|
10
|
+
return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 490 490", style: Object.assign({}, style) },
|
|
11
11
|
react_1.default.createElement("path", { fill: "none", stroke: (_a = style === null || style === void 0 ? void 0 : style.fill) !== null && _a !== void 0 ? _a : 'black', strokeWidth: "36", strokeLinecap: "round", d: "M280 278a153 153 0 1 0-2 2l170 170m-91-117 110 110-26 26-110-110" })));
|
|
12
12
|
};
|
|
13
13
|
exports.Magnify = Magnify;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare const Moon: ({ style, }: {
|
|
4
|
+
style?: ({
|
|
5
|
+
/** change the colour of the icon. default black */
|
|
6
|
+
fill?: string | undefined;
|
|
7
|
+
} & CSSProperties) | undefined;
|
|
8
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Moon = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const Moon = ({ style, }) => (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 35 35", style: Object.assign({}, style) },
|
|
9
|
+
react_1.default.createElement("path", { d: "M18.44 34.68a18.22 18.22 0 0 1-2.94-.24 18.18 18.18 0 0 1-15-20.86A18.06 18.06 0 0 1 9.59.63a2.42 2.42 0 0 1 2.61.16 2.39 2.39 0 0 1 1 2.41l-1.3-.1 1.23.22A15.66 15.66 0 0 0 23.34 21a15.82 15.82 0 0 0 8.47.53A2.44 2.44 0 0 1 34.47 25a18.18 18.18 0 0 1-16.03 9.68ZM10.67 2.89a15.67 15.67 0 0 0-5 22.77A15.66 15.66 0 0 0 32.18 24a18.49 18.49 0 0 1-9.65-.64A18.18 18.18 0 0 1 10.67 2.89Z" })));
|
|
10
|
+
exports.Moon = Moon;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Sun = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const Sun = (p) => {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
11
|
+
react_1.default.createElement("g", { stroke: (_b = (_a = p === null || p === void 0 ? void 0 : p.style) === null || _a === void 0 ? void 0 : _a.fill) !== null && _b !== void 0 ? _b : 'black', strokeMiterlimit: "10", strokeWidth: "1.5", clipPath: "url(#a)" },
|
|
12
|
+
react_1.default.createElement("path", { strokeLinecap: "round", d: "M5 12H1m22 0h-4M7.05 7.05 4.222 4.222m15.556 15.556L16.95 16.95m-9.9 0-2.828 2.828M19.778 4.222 16.95 7.05" }),
|
|
13
|
+
react_1.default.createElement("path", { fillOpacity: "0", d: "M12 16a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z" }),
|
|
14
|
+
react_1.default.createElement("path", { strokeLinecap: "round", d: "M12 19v4m0-22v4" })),
|
|
15
|
+
react_1.default.createElement("defs", null,
|
|
16
|
+
react_1.default.createElement("clipPath", { id: "a" },
|
|
17
|
+
react_1.default.createElement("path", { fill: "#fff", d: "M0 0h24v24H0z" })))));
|
|
18
|
+
};
|
|
19
|
+
exports.Sun = Sun;
|
package/dist/ui/icons/index.d.ts
CHANGED
|
@@ -2,13 +2,16 @@ export * from './Checkmark';
|
|
|
2
2
|
export * from './ChevronRight';
|
|
3
3
|
export * from './Circle';
|
|
4
4
|
export * from './CircleDot';
|
|
5
|
+
export * from './Computer';
|
|
5
6
|
export * from './CrossIcon';
|
|
6
7
|
export * from './Door';
|
|
7
8
|
export * from './Hamburger';
|
|
8
9
|
export * from './HorizontalDots';
|
|
9
10
|
export * from './Magnify';
|
|
11
|
+
export * from './Moon';
|
|
10
12
|
export * from './Pencil';
|
|
11
13
|
export * from './Save';
|
|
14
|
+
export * from './Sun';
|
|
12
15
|
export * from './Undo';
|
|
13
16
|
export * from './UserOutline';
|
|
14
17
|
export * from './Warning';
|
package/dist/ui/icons/index.js
CHANGED
|
@@ -18,13 +18,16 @@ __exportStar(require("./Checkmark"), exports);
|
|
|
18
18
|
__exportStar(require("./ChevronRight"), exports);
|
|
19
19
|
__exportStar(require("./Circle"), exports);
|
|
20
20
|
__exportStar(require("./CircleDot"), exports);
|
|
21
|
+
__exportStar(require("./Computer"), exports);
|
|
21
22
|
__exportStar(require("./CrossIcon"), exports);
|
|
22
23
|
__exportStar(require("./Door"), exports);
|
|
23
24
|
__exportStar(require("./Hamburger"), exports);
|
|
24
25
|
__exportStar(require("./HorizontalDots"), exports);
|
|
25
26
|
__exportStar(require("./Magnify"), exports);
|
|
27
|
+
__exportStar(require("./Moon"), exports);
|
|
26
28
|
__exportStar(require("./Pencil"), exports);
|
|
27
29
|
__exportStar(require("./Save"), exports);
|
|
30
|
+
__exportStar(require("./Sun"), exports);
|
|
28
31
|
__exportStar(require("./Undo"), exports);
|
|
29
32
|
__exportStar(require("./UserOutline"), exports);
|
|
30
33
|
__exportStar(require("./Warning"), exports);
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { IRefTextEdit } from '../TextEdit/types';
|
|
3
|
-
import type { ISearchDialog, TSearchModalRes } from './types';
|
|
4
|
-
type ISearchBase<T> = ISearchDialog<T> & {
|
|
5
|
-
onSearchTextChange?: (v: string) => void;
|
|
6
|
-
onSelectItem?: (v: TSearchModalRes<T>) => void;
|
|
7
|
-
textBoxRef?: React.RefObject<IRefTextEdit>;
|
|
8
|
-
};
|
|
9
|
-
export declare const SearchBase: <T>(p: ISearchBase<T>) => React.JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -1,111 +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 (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.SearchBase = void 0;
|
|
31
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
32
|
-
const react_1 = __importStar(require("react"));
|
|
33
|
-
const array_1 = require("../../../common/helpers/array");
|
|
34
|
-
const styles_1 = require("../../styles");
|
|
35
|
-
const SearchBox_1 = require("./SearchBox");
|
|
36
|
-
const Base = styled_1.default.div `
|
|
37
|
-
display: flex;
|
|
38
|
-
flex-flow: column;
|
|
39
|
-
flex-grow: 1;
|
|
40
|
-
width: 100%;
|
|
41
|
-
`;
|
|
42
|
-
const Content = styled_1.default.div `
|
|
43
|
-
width: calc(100% - 2rem);
|
|
44
|
-
margin: auto;
|
|
45
|
-
display: flex;
|
|
46
|
-
flex-flow: column;
|
|
47
|
-
justify-content: flex-start;
|
|
48
|
-
align-items: center;
|
|
49
|
-
max-height: calc(100vh - 20rem);
|
|
50
|
-
overflow-y: auto;
|
|
51
|
-
overflow-x: hidden;
|
|
52
|
-
|
|
53
|
-
flex-grow: 1;
|
|
54
|
-
&[data-hasitems='true'] {
|
|
55
|
-
padding-bottom: 0.5rem;
|
|
56
|
-
}
|
|
57
|
-
@media ${styles_1.smallScreen} {
|
|
58
|
-
margin: 0;
|
|
59
|
-
width: calc(100% - 0.5rem);
|
|
60
|
-
margin-top: 1rem;
|
|
61
|
-
}
|
|
62
|
-
`;
|
|
63
|
-
const Row = styled_1.default.div `
|
|
64
|
-
width: 100%;
|
|
65
|
-
`;
|
|
66
|
-
const SearchBase = (p) => {
|
|
67
|
-
var _a, _b, _c, _d;
|
|
68
|
-
const { maxDisplayItems = 1000 } = p;
|
|
69
|
-
const [searchText, setSearchText] = (0, react_1.useState)((_a = p.defaultValue) !== null && _a !== void 0 ? _a : '');
|
|
70
|
-
(0, react_1.useImperativeHandle)(p.textBoxRef, () => ({
|
|
71
|
-
setValue: (v) => {
|
|
72
|
-
var _a, _b;
|
|
73
|
-
const value = (_a = divRef === null || divRef === void 0 ? void 0 : divRef.current) === null || _a === void 0 ? void 0 : _a.getValue();
|
|
74
|
-
if (v === value) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
(_b = divRef === null || divRef === void 0 ? void 0 : divRef.current) === null || _b === void 0 ? void 0 : _b.setValue(v);
|
|
78
|
-
setSearchText(v);
|
|
79
|
-
},
|
|
80
|
-
focus: () => { var _a; return (_a = divRef === null || divRef === void 0 ? void 0 : divRef.current) === null || _a === void 0 ? void 0 : _a.focus(); },
|
|
81
|
-
getValue: () => { var _a; return (_a = divRef === null || divRef === void 0 ? void 0 : divRef.current) === null || _a === void 0 ? void 0 : _a.getValue(); },
|
|
82
|
-
}));
|
|
83
|
-
const divRef = (0, react_1.useRef)(null);
|
|
84
|
-
const resWrap = (foundItem, target) => {
|
|
85
|
-
var _a, _b;
|
|
86
|
-
if (!foundItem) {
|
|
87
|
-
(_a = p.onSelectItem) === null || _a === void 0 ? void 0 : _a.call(p, undefined);
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
(_b = p.onSelectItem) === null || _b === void 0 ? void 0 : _b.call(p, { foundItem, searchText, target });
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
const filteredItemsRaw = p.displayItems.filter((i) => p.willDisplayItem(searchText, i));
|
|
94
|
-
const { part: filteredItems } = (0, array_1.take)(filteredItemsRaw, maxDisplayItems < 0 ? filteredItemsRaw.length : maxDisplayItems);
|
|
95
|
-
const outdiff = filteredItems.length !== p.displayItems.length;
|
|
96
|
-
const showText = (_d = (_c = (_b = p.texts) === null || _b === void 0 ? void 0 : _b.totalItems) === null || _c === void 0 ? void 0 : _c.call(_b, filteredItems.length, p.displayItems.length)) !== null && _d !== void 0 ? _d : `Showing ${filteredItems.length} out of ${p.displayItems.length} total
|
|
97
|
-
items`;
|
|
98
|
-
return (react_1.default.createElement(Base, { className: p.className },
|
|
99
|
-
react_1.default.createElement(SearchBox_1.SearchBox, Object.assign({}, p, { searchText: searchText, setSearchText: (t) => {
|
|
100
|
-
var _a;
|
|
101
|
-
setSearchText(t);
|
|
102
|
-
(_a = p.onSearchTextChange) === null || _a === void 0 ? void 0 : _a.call(p, t);
|
|
103
|
-
}, textBoxRef: divRef })),
|
|
104
|
-
react_1.default.createElement(Content, { "data-hasitems": !!filteredItems.length, "data-type": "content" },
|
|
105
|
-
filteredItems.map((item, index) => (0, react_1.cloneElement)(p.renderItem({ searchText, item, index }), {
|
|
106
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
107
|
-
onClick: (e) => resWrap(item, e.target),
|
|
108
|
-
})),
|
|
109
|
-
outdiff && react_1.default.createElement(Row, null, showText))));
|
|
110
|
-
};
|
|
111
|
-
exports.SearchBase = SearchBase;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare const RadioGroup: <T>({ defaultValue, onSubmit, values, renderLabel, renderValue, }: {
|
|
3
|
-
/**
|
|
4
|
-
* can overload the render of the label. defaults to toString
|
|
5
|
-
*/
|
|
6
|
-
renderLabel?: ((a: T) => string) | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* render the value from the generic T. defaults to toString
|
|
9
|
-
*/
|
|
10
|
-
renderValue?: ((a: T) => string) | undefined;
|
|
11
|
-
defaultValue: T;
|
|
12
|
-
onSubmit: (val: T) => void;
|
|
13
|
-
values: T[];
|
|
14
|
-
}) => React.JSX.Element;
|