ag-common 0.0.515 → 0.0.517
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,9 +8,9 @@ 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, }: {
|
|
12
|
+
/** default 3rem */
|
|
13
|
+
maxCircleSize?: string | undefined;
|
|
14
14
|
/** default #ccc */
|
|
15
15
|
lineColour?: string | undefined;
|
|
16
16
|
items: ITimelineItem[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
'use client';
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
@@ -41,17 +42,20 @@ const Item = styled_1.default.div `
|
|
|
41
42
|
const Title = styled_1.default.span `
|
|
42
43
|
text-align: center;
|
|
43
44
|
`;
|
|
44
|
-
const Timeline = ({ lineColour = '#ccc',
|
|
45
|
-
const cs = Object.assign({ maxWidth: '5rem' }, (circleSize && { width: circleSize, maxWidth: circleSize }));
|
|
45
|
+
const Timeline = ({ lineColour = '#ccc', items, onClick, maxCircleSize = '3rem', }) => {
|
|
46
46
|
const firstFalse = items.findIndex((i) => !i.checked && !i.disabled);
|
|
47
|
+
const maxWidth = `min(5vw,${maxCircleSize})`;
|
|
47
48
|
return (react_1.default.createElement(Base, null,
|
|
48
49
|
react_1.default.createElement(Row, null,
|
|
49
50
|
react_1.default.createElement(Line, { style: { backgroundColor: lineColour } }),
|
|
50
51
|
items.map((p, index) => {
|
|
51
52
|
const enabled = p.checked || index === firstFalse;
|
|
52
53
|
return (react_1.default.createElement(Item, { key: p.key, title: p.title },
|
|
53
|
-
react_1.default.createElement(Icon_1.Icon, { style:
|
|
54
|
+
react_1.default.createElement(Icon_1.Icon, { style: {
|
|
55
|
+
maxWidth,
|
|
56
|
+
cursor: enabled ? 'pointer' : 'default',
|
|
57
|
+
}, 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' } })))));
|
|
54
58
|
})),
|
|
55
|
-
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
|
+
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: { width: `${100 / items.length}%`, maxWidth } }, title || '')))))));
|
|
56
60
|
};
|
|
57
61
|
exports.Timeline = Timeline;
|
package/package.json
CHANGED