ag-common 0.0.551 → 0.0.553
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/OpenApiCodeBlock/OpenApiCodeBlock.js +4 -3
- package/dist/ui/components/OpenApiCodeBlock/helpers/common.js +1 -2
- package/dist/ui/components/Search/Base.d.ts +2 -7
- package/dist/ui/components/Search/Base.js +23 -7
- 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 +1 -1
- package/dist/ui/components/Search/Modal.d.ts +2 -4
- package/dist/ui/components/Search/Modal.js +1 -1
- 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 +14 -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/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/package.json +2 -2
|
@@ -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
|
}
|
|
@@ -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
|
};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
type ISearchBase<T> = ISearchDialog<T> & {
|
|
5
|
-
onSearchTextChange?: (v: string) => void;
|
|
6
|
-
onSelectItem?: (v: TSearchModalRes<T>) => void;
|
|
7
|
-
textBoxRef?: React.RefObject<IRefTextEdit>;
|
|
8
|
-
};
|
|
2
|
+
import type { ISearchDialog } from './types';
|
|
3
|
+
type ISearchBase<T> = ISearchDialog<T>;
|
|
9
4
|
export declare const SearchBase: <T>(p: ISearchBase<T>) => React.JSX.Element;
|
|
10
5
|
export {};
|
|
@@ -38,6 +38,10 @@ const Base = styled_1.default.div `
|
|
|
38
38
|
flex-flow: column;
|
|
39
39
|
flex-grow: 1;
|
|
40
40
|
width: 100%;
|
|
41
|
+
height: calc(100% - 1rem);
|
|
42
|
+
@media ${styles_1.smallScreen} {
|
|
43
|
+
height: calc(100% - 0.5rem);
|
|
44
|
+
}
|
|
41
45
|
`;
|
|
42
46
|
const Content = styled_1.default.div `
|
|
43
47
|
width: calc(100% - 2rem);
|
|
@@ -46,7 +50,7 @@ const Content = styled_1.default.div `
|
|
|
46
50
|
flex-flow: column;
|
|
47
51
|
justify-content: flex-start;
|
|
48
52
|
align-items: center;
|
|
49
|
-
max-height:
|
|
53
|
+
max-height: 100%;
|
|
50
54
|
overflow-y: auto;
|
|
51
55
|
overflow-x: hidden;
|
|
52
56
|
|
|
@@ -57,16 +61,27 @@ const Content = styled_1.default.div `
|
|
|
57
61
|
@media ${styles_1.smallScreen} {
|
|
58
62
|
margin: 0;
|
|
59
63
|
width: calc(100% - 0.5rem);
|
|
60
|
-
margin-top: 1rem;
|
|
61
64
|
}
|
|
62
65
|
`;
|
|
63
|
-
const
|
|
66
|
+
const RowCount = styled_1.default.div `
|
|
64
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
|
+
}
|
|
65
79
|
`;
|
|
66
80
|
const SearchBase = (p) => {
|
|
67
|
-
var _a, _b, _c, _d;
|
|
81
|
+
var _a, _b, _c, _d, _e, _f;
|
|
68
82
|
const { maxDisplayItems = 1000 } = p;
|
|
69
|
-
const
|
|
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 : '');
|
|
70
85
|
(0, react_1.useImperativeHandle)(p.textBoxRef, () => ({
|
|
71
86
|
setValue: (v) => {
|
|
72
87
|
var _a, _b;
|
|
@@ -93,7 +108,7 @@ const SearchBase = (p) => {
|
|
|
93
108
|
const filteredItemsRaw = p.displayItems.filter((i) => p.willDisplayItem(searchText, i));
|
|
94
109
|
const { part: filteredItems } = (0, array_1.take)(filteredItemsRaw, maxDisplayItems < 0 ? filteredItemsRaw.length : maxDisplayItems);
|
|
95
110
|
const outdiff = filteredItems.length !== p.displayItems.length;
|
|
96
|
-
const showText = (
|
|
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
|
|
97
112
|
items`;
|
|
98
113
|
return (react_1.default.createElement(Base, { className: p.className },
|
|
99
114
|
react_1.default.createElement(SearchBox_1.SearchBox, Object.assign({}, p, { searchText: searchText, setSearchText: (t) => {
|
|
@@ -102,10 +117,11 @@ const SearchBase = (p) => {
|
|
|
102
117
|
(_a = p.onSearchTextChange) === null || _a === void 0 ? void 0 : _a.call(p, t);
|
|
103
118
|
}, textBoxRef: divRef })),
|
|
104
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)),
|
|
105
121
|
filteredItems.map((item, index) => (0, react_1.cloneElement)(p.renderItem({ searchText, item, index }), {
|
|
106
122
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
107
123
|
onClick: (e) => resWrap(item, e.target),
|
|
108
124
|
})),
|
|
109
|
-
outdiff && react_1.default.createElement(
|
|
125
|
+
rowCountOptDisplay === 'bottom' && outdiff && (react_1.default.createElement(RowCount, { "data-top": "false" }, showText)))));
|
|
110
126
|
};
|
|
111
127
|
exports.SearchBase = SearchBase;
|
|
@@ -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 { ISearchInline } from './types';
|
|
3
|
+
export declare const SearchInline: <T>(p: ISearchInline<T>) => React.JSX.Element;
|
|
@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.SearchInline = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const Base_1 = require("./Base");
|
|
9
|
-
const SearchInline = (p) => react_1.default.createElement(Base_1.SearchBase, Object.assign({}, p));
|
|
9
|
+
const SearchInline = (p) => (react_1.default.createElement(Base_1.SearchBase, Object.assign({}, p)));
|
|
10
10
|
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;
|
|
@@ -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 },
|
|
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
27
|
react_1.default.createElement(Base_1.SearchBase, Object.assign({}, p))));
|
|
28
28
|
exports.SearchModal = SearchModal;
|
|
@@ -19,5 +19,4 @@ __exportStar(require("./Base"), exports);
|
|
|
19
19
|
__exportStar(require("./Dialog"), exports);
|
|
20
20
|
__exportStar(require("./Inline"), exports);
|
|
21
21
|
__exportStar(require("./Modal"), exports);
|
|
22
|
-
__exportStar(require("./SearchBox"), exports);
|
|
23
22
|
__exportStar(require("./types"), 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,13 @@ 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
|
-
export type ISearchModal<T> = ISearchDialog<T>;
|
|
42
49
|
export type ISearchInline<T> = ISearchDialog<T>;
|
|
50
|
+
export type ISearchModal<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;
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.553",
|
|
3
3
|
"name": "ag-common",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@types/react": "18.2.34",
|
|
59
59
|
"@types/react-dom": "18.2.14",
|
|
60
60
|
"cross-env": "7.0.3",
|
|
61
|
-
"eslint-config-e7npm": "0.0.
|
|
61
|
+
"eslint-config-e7npm": "0.0.51",
|
|
62
62
|
"jest": "29.7.0",
|
|
63
63
|
"rimraf": "5.0.5",
|
|
64
64
|
"storybook": "7.5.2",
|