ag-common 0.0.516 → 0.0.518
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.
|
@@ -8,11 +8,12 @@ export type ITimelineItem = {
|
|
|
8
8
|
checked: false;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
});
|
|
11
|
-
export declare const Timeline: ({ lineColour,
|
|
12
|
-
/** default
|
|
13
|
-
|
|
11
|
+
export declare const Timeline: ({ lineColour, items, onClick, maxCircleSize, className, }: {
|
|
12
|
+
/** default min(5vw,3rem) */
|
|
13
|
+
maxCircleSize?: string | undefined;
|
|
14
14
|
/** default #ccc */
|
|
15
15
|
lineColour?: string | undefined;
|
|
16
16
|
items: ITimelineItem[];
|
|
17
17
|
onClick?: ((p: ITimelineItem) => void) | undefined;
|
|
18
|
+
className?: string | undefined;
|
|
18
19
|
}) => React.JSX.Element;
|
|
@@ -42,17 +42,22 @@ const Item = styled_1.default.div `
|
|
|
42
42
|
const Title = styled_1.default.span `
|
|
43
43
|
text-align: center;
|
|
44
44
|
`;
|
|
45
|
-
const Timeline = ({ lineColour = '#ccc',
|
|
46
|
-
const cs = Object.assign({ maxWidth: '5rem' }, (circleSize && { width: circleSize, maxWidth: circleSize }));
|
|
45
|
+
const Timeline = ({ lineColour = '#ccc', items, onClick, maxCircleSize = 'min(5vw,3rem)', className, }) => {
|
|
47
46
|
const firstFalse = items.findIndex((i) => !i.checked && !i.disabled);
|
|
48
|
-
return (react_1.default.createElement(Base,
|
|
47
|
+
return (react_1.default.createElement(Base, { className: className },
|
|
49
48
|
react_1.default.createElement(Row, null,
|
|
50
49
|
react_1.default.createElement(Line, { style: { backgroundColor: lineColour } }),
|
|
51
50
|
items.map((p, index) => {
|
|
52
51
|
const enabled = p.checked || index === firstFalse;
|
|
53
52
|
return (react_1.default.createElement(Item, { key: p.key, title: p.title },
|
|
54
|
-
react_1.default.createElement(Icon_1.Icon, { style:
|
|
53
|
+
react_1.default.createElement(Icon_1.Icon, { style: {
|
|
54
|
+
maxWidth: maxCircleSize,
|
|
55
|
+
cursor: enabled ? 'pointer' : 'default',
|
|
56
|
+
}, onClick: () => enabled && (onClick === null || onClick === void 0 ? void 0 : onClick(p)) }, p.checked ? (react_1.default.createElement(icons_1.Checkmark, { style: { fill: '#60b515' } })) : index !== firstFalse ? (react_1.default.createElement(Circle_1.Circle, { style: { fill: '#007cbb' }, dotted: p.disabled })) : (react_1.default.createElement(icons_1.CircleDot, { style: { fill: '#007cbb' } })))));
|
|
55
57
|
})),
|
|
56
|
-
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:
|
|
58
|
+
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: {
|
|
59
|
+
width: `${100 / items.length}%`,
|
|
60
|
+
maxWidth: maxCircleSize,
|
|
61
|
+
} }, title || '')))))));
|
|
57
62
|
};
|
|
58
63
|
exports.Timeline = Timeline;
|
package/package.json
CHANGED