@synerise/ds-step-card 1.2.39 → 1.2.40
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/CHANGELOG.md +4 -0
- package/dist/StepCard.d.ts +2 -2
- package/dist/StepCard.js +109 -139
- package/dist/StepCard.styles.d.ts +20 -20
- package/dist/StepCard.styles.js +62 -62
- package/dist/StepCard.types.d.ts +2 -2
- package/dist/StepCard.types.js +1 -1
- package/dist/hooks/useDefaultTexts.d.ts +1 -1
- package/dist/hooks/useDefaultTexts.js +53 -51
- package/dist/index.js +4 -1
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.2.40](https://github.com/Synerise/synerise-design/compare/@synerise/ds-step-card@1.2.39...@synerise/ds-step-card@1.2.40) (2026-03-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-step-card
|
|
9
|
+
|
|
6
10
|
## [1.2.39](https://github.com/Synerise/synerise-design/compare/@synerise/ds-step-card@1.2.38...@synerise/ds-step-card@1.2.39) (2026-03-20)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @synerise/ds-step-card
|
package/dist/StepCard.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { StepCardProps } from './StepCard.types';
|
|
3
3
|
export declare const REORDER_THROTTLE = 1000;
|
|
4
4
|
declare const StepCard: React.ForwardRefExoticComponent<StepCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
5
|
export default StepCard;
|
package/dist/StepCard.js
CHANGED
|
@@ -1,114 +1,91 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { InlineAlert } from
|
|
4
|
-
import Cruds from
|
|
5
|
-
import { DragHandleM } from
|
|
6
|
-
import { Matching } from
|
|
7
|
-
import { Title } from
|
|
8
|
-
import
|
|
9
|
-
import { useDefaultTexts } from
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var timeoutMovedRef = useRef(null);
|
|
48
|
-
var _useState2 = useState(expressionMoved),
|
|
49
|
-
recentlyMoved = _useState2[0],
|
|
50
|
-
setRecentlyMoved = _useState2[1];
|
|
51
|
-
var spinnerRef = /*#__PURE__*/createRef();
|
|
52
|
-
var countDownSpinnerElement = /*#__PURE__*/React.createElement(S.CountDownWrapper, null, /*#__PURE__*/React.createElement("svg", {
|
|
53
|
-
viewBox: "0 0 24 24"
|
|
54
|
-
}, /*#__PURE__*/React.createElement(S.CountDownSpinner, {
|
|
55
|
-
"data-test": moveByOffset,
|
|
56
|
-
duration: REORDER_THROTTLE / 1000,
|
|
57
|
-
"stroke-dashoffset": "40",
|
|
58
|
-
"stroke-linecap": "butt"
|
|
59
|
-
}, /*#__PURE__*/React.createElement("circle", {
|
|
60
|
-
ref: spinnerRef,
|
|
61
|
-
r: "5",
|
|
62
|
-
cx: "12",
|
|
63
|
-
cy: "12",
|
|
64
|
-
fill: "transparent",
|
|
65
|
-
transform: "rotate(-90,12,12)"
|
|
66
|
-
}))));
|
|
67
|
-
var resetAnimation = function resetAnimation() {
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useState, useRef, createRef, useEffect } from "react";
|
|
3
|
+
import { InlineAlert } from "@synerise/ds-alert";
|
|
4
|
+
import Cruds from "@synerise/ds-cruds";
|
|
5
|
+
import { DragHandleM } from "@synerise/ds-icon";
|
|
6
|
+
import { Matching } from "@synerise/ds-logic";
|
|
7
|
+
import { Title } from "@synerise/ds-typography";
|
|
8
|
+
import { Container, DragPlaceholder, DragPlaceholderContent, DragPlaceholderTag, Content, Header, LeftSide, DragIcon, StepCardTitle, Middle, RightSide, Body, AdditionalFields, Footer, CrudsWrapper, MoveByOffset, MoveByOffsetLabel, RecentlyMoved, CountDownWrapper, CountDownSpinner } from "./StepCard.styles.js";
|
|
9
|
+
import { useDefaultTexts } from "./hooks/useDefaultTexts.js";
|
|
10
|
+
const REORDER_THROTTLE = 1e3;
|
|
11
|
+
const MOVE_SUCCESS_FEEDBACK_DURATION = 2e3;
|
|
12
|
+
const StepCard = forwardRef(({
|
|
13
|
+
children,
|
|
14
|
+
onDelete,
|
|
15
|
+
onDuplicate,
|
|
16
|
+
onMove,
|
|
17
|
+
expressionIndex,
|
|
18
|
+
expressionMoved,
|
|
19
|
+
expressionCount,
|
|
20
|
+
footer,
|
|
21
|
+
matching,
|
|
22
|
+
onChangeMatching,
|
|
23
|
+
texts,
|
|
24
|
+
headerRightSide,
|
|
25
|
+
renderHeaderRightSide,
|
|
26
|
+
isHeaderVisible = true,
|
|
27
|
+
readOnly = false,
|
|
28
|
+
singleStepCondition = false,
|
|
29
|
+
getMoveByLabel,
|
|
30
|
+
isDraggable = true,
|
|
31
|
+
isDragged,
|
|
32
|
+
isDragOverlay,
|
|
33
|
+
dragIndex,
|
|
34
|
+
dropLabel,
|
|
35
|
+
dragHandleProps,
|
|
36
|
+
additionalFields
|
|
37
|
+
}, ref) => {
|
|
38
|
+
const allTexts = useDefaultTexts(texts);
|
|
39
|
+
const [moveByOffset, setMoveByOffset] = useState(0);
|
|
40
|
+
const moveUpInactive = expressionIndex + moveByOffset <= 0;
|
|
41
|
+
const moveDownInactive = expressionIndex + moveByOffset >= expressionCount - 1;
|
|
42
|
+
const timeoutMovedRef = useRef(null);
|
|
43
|
+
const [recentlyMoved, setRecentlyMoved] = useState(expressionMoved);
|
|
44
|
+
const spinnerRef = createRef();
|
|
45
|
+
const countDownSpinnerElement = /* @__PURE__ */ jsx(CountDownWrapper, { children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx(CountDownSpinner, { "data-test": moveByOffset, duration: REORDER_THROTTLE / 1e3, "stroke-dashoffset": "40", "stroke-linecap": "butt", children: /* @__PURE__ */ jsx("circle", { ref: spinnerRef, r: "5", cx: "12", cy: "12", fill: "transparent", transform: "rotate(-90,12,12)" }) }) }) });
|
|
46
|
+
const resetAnimation = () => {
|
|
68
47
|
if (spinnerRef.current && spinnerRef.current.parentElement) {
|
|
69
|
-
|
|
70
|
-
svgGroupElem.style.transitionProperty =
|
|
71
|
-
svgGroupElem.style.strokeDashoffset =
|
|
48
|
+
const svgGroupElem = spinnerRef.current.parentElement;
|
|
49
|
+
svgGroupElem.style.transitionProperty = "none";
|
|
50
|
+
svgGroupElem.style.strokeDashoffset = "75";
|
|
72
51
|
}
|
|
73
52
|
};
|
|
74
|
-
|
|
53
|
+
const startAnimation = () => {
|
|
75
54
|
if (spinnerRef.current && spinnerRef.current.parentElement) {
|
|
76
|
-
|
|
77
|
-
svgGroupElem.style.transitionDuration = REORDER_THROTTLE /
|
|
78
|
-
svgGroupElem.style.transitionProperty =
|
|
79
|
-
svgGroupElem.style.strokeDashoffset =
|
|
55
|
+
const svgGroupElem = spinnerRef.current.parentElement;
|
|
56
|
+
svgGroupElem.style.transitionDuration = `${REORDER_THROTTLE / 1e3}s`;
|
|
57
|
+
svgGroupElem.style.transitionProperty = "stroke-dashoffset";
|
|
58
|
+
svgGroupElem.style.strokeDashoffset = "40";
|
|
80
59
|
}
|
|
81
60
|
};
|
|
82
|
-
|
|
61
|
+
const onMoveUp = () => {
|
|
83
62
|
if (!moveUpInactive) {
|
|
84
63
|
resetAnimation();
|
|
85
64
|
setMoveByOffset(moveByOffset - 1);
|
|
86
65
|
}
|
|
87
66
|
};
|
|
88
|
-
|
|
67
|
+
const onMoveDown = () => {
|
|
89
68
|
if (!moveDownInactive) {
|
|
90
69
|
resetAnimation();
|
|
91
70
|
setMoveByOffset(moveByOffset + 1);
|
|
92
71
|
}
|
|
93
72
|
};
|
|
94
|
-
useEffect(
|
|
73
|
+
useEffect(() => {
|
|
95
74
|
if (expressionMoved) {
|
|
96
75
|
setRecentlyMoved(expressionMoved);
|
|
97
|
-
timeoutMovedRef.current = setTimeout(
|
|
98
|
-
return setRecentlyMoved(false);
|
|
99
|
-
}, MOVE_SUCCESS_FEEDBACK_DURATION);
|
|
76
|
+
timeoutMovedRef.current = setTimeout(() => setRecentlyMoved(false), MOVE_SUCCESS_FEEDBACK_DURATION);
|
|
100
77
|
}
|
|
101
78
|
return resetMoveSuccess;
|
|
102
79
|
}, [expressionMoved, expressionIndex]);
|
|
103
|
-
|
|
80
|
+
const resetMoveSuccess = () => {
|
|
104
81
|
timeoutMovedRef.current && clearTimeout(timeoutMovedRef.current);
|
|
105
82
|
setRecentlyMoved(false);
|
|
106
83
|
};
|
|
107
|
-
useEffect(
|
|
108
|
-
|
|
109
|
-
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
let timer;
|
|
86
|
+
let timer2;
|
|
110
87
|
if (moveByOffset !== 0) {
|
|
111
|
-
timer = setTimeout(
|
|
88
|
+
timer = setTimeout(() => {
|
|
112
89
|
onMove(expressionIndex, moveByOffset);
|
|
113
90
|
setMoveByOffset(0);
|
|
114
91
|
}, REORDER_THROTTLE);
|
|
@@ -117,62 +94,55 @@ var StepCard = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
117
94
|
if (moveByOffset) {
|
|
118
95
|
timer2 = setTimeout(startAnimation, 0);
|
|
119
96
|
}
|
|
120
|
-
return
|
|
97
|
+
return () => {
|
|
121
98
|
timer && clearTimeout(timer);
|
|
122
99
|
timer2 && clearTimeout(timer2);
|
|
123
100
|
};
|
|
124
101
|
});
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
onDuplicate: onDuplicate
|
|
140
|
-
})), recentlyMoved && /*#__PURE__*/React.createElement(S.RecentlyMoved, {
|
|
141
|
-
duration: MOVE_SUCCESS_FEEDBACK_DURATION
|
|
142
|
-
}, /*#__PURE__*/React.createElement(InlineAlert, {
|
|
143
|
-
type: "success",
|
|
144
|
-
message: "Moved"
|
|
145
|
-
})), renderHeaderRightSide ? renderHeaderRightSide(dragIndex != null ? dragIndex : expressionIndex) : headerRightSide);
|
|
102
|
+
const moveByOffsetLabel = getMoveByLabel ? getMoveByLabel(moveByOffset) : `Move ${Math.abs(moveByOffset)} ${moveByOffset < 0 ? "up" : "down"}...`;
|
|
103
|
+
const renderRightSide = () => {
|
|
104
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
105
|
+
!readOnly && /* @__PURE__ */ jsxs(CrudsWrapper, { children: [
|
|
106
|
+
/* @__PURE__ */ jsxs(MoveByOffset, { offset: moveByOffset, children: [
|
|
107
|
+
countDownSpinnerElement,
|
|
108
|
+
" ",
|
|
109
|
+
/* @__PURE__ */ jsx(MoveByOffsetLabel, { children: moveByOffsetLabel })
|
|
110
|
+
] }),
|
|
111
|
+
/* @__PURE__ */ jsx(Cruds, { onMoveUp, moveUpTooltip: allTexts.moveUpTooltip, moveUpInactive, onMoveDown, moveDownTooltip: allTexts.moveDownTooltip, moveDownInactive, deleteTooltip: allTexts.deleteTooltip, onDelete, duplicateTooltip: allTexts.duplicateTooltip, onDuplicate })
|
|
112
|
+
] }),
|
|
113
|
+
recentlyMoved && /* @__PURE__ */ jsx(RecentlyMoved, { duration: MOVE_SUCCESS_FEEDBACK_DURATION, children: /* @__PURE__ */ jsx(InlineAlert, { type: "success", message: "Moved" }) }),
|
|
114
|
+
renderHeaderRightSide ? renderHeaderRightSide(dragIndex ?? expressionIndex) : headerRightSide
|
|
115
|
+
] });
|
|
146
116
|
};
|
|
147
|
-
return
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}, renderRightSide())), /*#__PURE__*/React.createElement(S.Body, {
|
|
175
|
-
singleStepCondition: singleStepCondition
|
|
176
|
-
}, children), additionalFields && /*#__PURE__*/React.createElement(S.AdditionalFields, null, additionalFields), footer && /*#__PURE__*/React.createElement(S.Footer, null, footer)));
|
|
117
|
+
return /* @__PURE__ */ jsxs(Container, { isDragged, isDragOverlay, ref, children: [
|
|
118
|
+
/* @__PURE__ */ jsxs(DragPlaceholder, { children: [
|
|
119
|
+
dropLabel && /* @__PURE__ */ jsx(DragPlaceholderContent, { children: dropLabel }),
|
|
120
|
+
/* @__PURE__ */ jsx(DragPlaceholderTag, { children: renderHeaderRightSide && dragIndex !== void 0 ? renderHeaderRightSide(dragIndex, {
|
|
121
|
+
placeholder: true
|
|
122
|
+
}) : headerRightSide })
|
|
123
|
+
] }),
|
|
124
|
+
/* @__PURE__ */ jsxs(Content, { children: [
|
|
125
|
+
isHeaderVisible && /* @__PURE__ */ jsxs(Header, { isDraggable: !readOnly && isDraggable, onMouseOver: resetMoveSuccess, onFocus: resetMoveSuccess, children: [
|
|
126
|
+
/* @__PURE__ */ jsxs(LeftSide, { isDraggable: !readOnly && isDraggable, children: [
|
|
127
|
+
!readOnly && isDraggable && /* @__PURE__ */ jsx(DragIcon, { component: /* @__PURE__ */ jsx(DragHandleM, {}), ...!readOnly && isDraggable ? dragHandleProps : {} }),
|
|
128
|
+
matching !== void 0 && onChangeMatching && /* @__PURE__ */ jsxs(StepCardTitle, { children: [
|
|
129
|
+
/* @__PURE__ */ jsx(Matching, { matching, onChange: onChangeMatching, texts: {
|
|
130
|
+
matching: allTexts.matching,
|
|
131
|
+
notMatching: allTexts.notMatching
|
|
132
|
+
}, readOnly }),
|
|
133
|
+
/* @__PURE__ */ jsx(Title, { withoutMargin: true, level: 4, children: matching ? allTexts.conditionType : allTexts.notConditionType })
|
|
134
|
+
] })
|
|
135
|
+
] }),
|
|
136
|
+
!readOnly && isDraggable && /* @__PURE__ */ jsx(Middle, { ...dragHandleProps }),
|
|
137
|
+
(!readOnly || headerRightSide || renderHeaderRightSide) && /* @__PURE__ */ jsx(RightSide, { className: "step-card-right-side", children: renderRightSide() })
|
|
138
|
+
] }),
|
|
139
|
+
/* @__PURE__ */ jsx(Body, { singleStepCondition, children }),
|
|
140
|
+
additionalFields && /* @__PURE__ */ jsx(AdditionalFields, { children: additionalFields }),
|
|
141
|
+
footer && /* @__PURE__ */ jsx(Footer, { children: footer })
|
|
142
|
+
] })
|
|
143
|
+
] });
|
|
177
144
|
});
|
|
178
|
-
export
|
|
145
|
+
export {
|
|
146
|
+
REORDER_THROTTLE,
|
|
147
|
+
StepCard as default
|
|
148
|
+
};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const DragPlaceholder: import(
|
|
3
|
-
export declare const DragPlaceholderContent: import(
|
|
4
|
-
export declare const DragPlaceholderTag: import(
|
|
5
|
-
export declare const Content: import(
|
|
6
|
-
export declare const Container: import(
|
|
1
|
+
import { StyledIcon } from '@synerise/ds-icon';
|
|
2
|
+
export declare const DragPlaceholder: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const DragPlaceholderContent: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export declare const DragPlaceholderTag: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
5
|
+
export declare const Content: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
6
|
+
export declare const Container: import('styled-components').StyledComponent<"div", any, {
|
|
7
7
|
isDragged?: boolean;
|
|
8
8
|
isDragOverlay?: boolean;
|
|
9
9
|
}, never>;
|
|
10
|
-
export declare const RecentlyMoved: import(
|
|
10
|
+
export declare const RecentlyMoved: import('styled-components').StyledComponent<"span", any, {
|
|
11
11
|
duration: number;
|
|
12
12
|
}, never>;
|
|
13
|
-
export declare const CountDownWrapper: import(
|
|
14
|
-
export declare const MoveByOffsetLabel: import(
|
|
15
|
-
export declare const CountDownSpinner: import(
|
|
13
|
+
export declare const CountDownWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
14
|
+
export declare const MoveByOffsetLabel: import('styled-components').StyledComponent<"span", any, {}, never>;
|
|
15
|
+
export declare const CountDownSpinner: import('styled-components').StyledComponent<"g", any, {
|
|
16
16
|
duration: number;
|
|
17
17
|
}, never>;
|
|
18
|
-
export declare const MoveByOffset: import(
|
|
18
|
+
export declare const MoveByOffset: import('styled-components').StyledComponent<"span", any, {
|
|
19
19
|
offset: number;
|
|
20
20
|
}, never>;
|
|
21
|
-
export declare const CrudsWrapper: import(
|
|
21
|
+
export declare const CrudsWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
22
22
|
export declare const DragIcon: StyledIcon;
|
|
23
|
-
export declare const Header: import(
|
|
23
|
+
export declare const Header: import('styled-components').StyledComponent<"div", any, {
|
|
24
24
|
isDraggable?: boolean;
|
|
25
25
|
}, never>;
|
|
26
|
-
export declare const StepCardTitle: import(
|
|
27
|
-
export declare const Middle: import(
|
|
28
|
-
export declare const LeftSide: import(
|
|
26
|
+
export declare const StepCardTitle: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
27
|
+
export declare const Middle: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
28
|
+
export declare const LeftSide: import('styled-components').StyledComponent<"div", any, {
|
|
29
29
|
isDraggable?: boolean;
|
|
30
30
|
}, never>;
|
|
31
|
-
export declare const RightSide: import(
|
|
32
|
-
export declare const Body: import(
|
|
31
|
+
export declare const RightSide: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
32
|
+
export declare const Body: import('styled-components').StyledComponent<"div", any, {
|
|
33
33
|
singleStepCondition: boolean;
|
|
34
34
|
}, never>;
|
|
35
|
-
export declare const AdditionalFields: import(
|
|
36
|
-
export declare const Footer: import(
|
|
35
|
+
export declare const AdditionalFields: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
36
|
+
export declare const Footer: import('styled-components').StyledComponent<"div", any, {}, never>;
|
package/dist/StepCard.styles.js
CHANGED
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
import styled, { css, keyframes } from
|
|
2
|
-
import Icon from
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import styled, { css, keyframes } from "styled-components";
|
|
2
|
+
import Icon from "@synerise/ds-icon";
|
|
3
|
+
const fadeout = /* @__PURE__ */ keyframes(["from{opacity:1}to{opacity:0;}"]);
|
|
4
|
+
const DragPlaceholder = /* @__PURE__ */ styled.div.withConfig({
|
|
5
5
|
displayName: "StepCardstyles__DragPlaceholder",
|
|
6
6
|
componentId: "sc-45dbps-0"
|
|
7
7
|
})(["opacity:0;pointer-events:none;visibility:hidden;display:none;align-items:center;"]);
|
|
8
|
-
|
|
8
|
+
const DragPlaceholderContent = /* @__PURE__ */ styled.div.withConfig({
|
|
9
9
|
displayName: "StepCardstyles__DragPlaceholderContent",
|
|
10
10
|
componentId: "sc-45dbps-1"
|
|
11
|
-
})(["position:absolute;left:0;top:0;width:100%;height:calc(100% - 24px);display:flex;align-items:center;justify-content:center;color:", ";"],
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
export var DragPlaceholderTag = styled.div.withConfig({
|
|
11
|
+
})(["position:absolute;left:0;top:0;width:100%;height:calc(100% - 24px);display:flex;align-items:center;justify-content:center;color:", ";"], (props) => props.theme.palette["blue-600"]);
|
|
12
|
+
const DragPlaceholderTag = /* @__PURE__ */ styled.div.withConfig({
|
|
15
13
|
displayName: "StepCardstyles__DragPlaceholderTag",
|
|
16
14
|
componentId: "sc-45dbps-2"
|
|
17
15
|
})(["position:absolute;right:24px;top:22px;opacity:0.4;"]);
|
|
18
|
-
|
|
16
|
+
const Content = /* @__PURE__ */ styled.div.withConfig({
|
|
19
17
|
displayName: "StepCardstyles__Content",
|
|
20
18
|
componentId: "sc-45dbps-3"
|
|
21
|
-
})(["display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;background-color:", ";box-shadow:0 4px 12px 0 #2329360a;border-radius:3px;"],
|
|
22
|
-
|
|
23
|
-
});
|
|
24
|
-
export var Container = styled.div.withConfig({
|
|
19
|
+
})(["display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;background-color:", ";box-shadow:0 4px 12px 0 #2329360a;border-radius:3px;"], (props) => props.theme.palette.white);
|
|
20
|
+
const Container = /* @__PURE__ */ styled.div.withConfig({
|
|
25
21
|
displayName: "StepCardstyles__Container",
|
|
26
22
|
componentId: "sc-45dbps-4"
|
|
27
|
-
})(["width:100%;min-width:594px;", ""],
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
export var RecentlyMoved = styled.span.withConfig({
|
|
23
|
+
})(["width:100%;min-width:594px;", ""], (props) => (props.isDragged || props.isDragOverlay) && css(["cursor:grabbing;width:100%;opacity:1 !important;padding:0;", " ", " ", "", "{visibility:visible;opacity:1;}", "{position:absolute;opacity:0;height:0;}", "{display:none;}"], props.isDragged && // dragged item - blue placeholder
|
|
24
|
+
css(["height:100px;", "", "{visibility:visible;opacity:1;display:block;}", "{visibility:hidden;opacity:0;}"], DragPlaceholder, DragPlaceholder, Content), props.isDragOverlay && // grabbed item on top layer
|
|
25
|
+
css(["", "{height:76px;margin-bottom:24px;display:flex;align-items:center;justify-content:center;}", "{display:none;}"], Content, RightSide), DragIcon, DragIcon, Body, Footer));
|
|
26
|
+
const RecentlyMoved = /* @__PURE__ */ styled.span.withConfig({
|
|
33
27
|
displayName: "StepCardstyles__RecentlyMoved",
|
|
34
28
|
componentId: "sc-45dbps-5"
|
|
35
|
-
})(["animation:", " 0.1s linear ", "s 1 forwards;"], fadeout,
|
|
36
|
-
|
|
37
|
-
});
|
|
38
|
-
export var CountDownWrapper = styled.div.withConfig({
|
|
29
|
+
})(["animation:", " 0.1s linear ", "s 1 forwards;"], fadeout, (props) => (props.duration - 200) / 1e3);
|
|
30
|
+
const CountDownWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
39
31
|
displayName: "StepCardstyles__CountDownWrapper",
|
|
40
32
|
componentId: "sc-45dbps-6"
|
|
41
33
|
})(["vertical-align:middle;display:inline-block;width:24px;height:24px;color:inherit;"]);
|
|
42
|
-
|
|
34
|
+
const MoveByOffsetLabel = /* @__PURE__ */ styled.span.withConfig({
|
|
43
35
|
displayName: "StepCardstyles__MoveByOffsetLabel",
|
|
44
36
|
componentId: "sc-45dbps-7"
|
|
45
37
|
})([""]);
|
|
46
|
-
|
|
38
|
+
const CountDownSpinner = /* @__PURE__ */ styled.g.withConfig({
|
|
47
39
|
displayName: "StepCardstyles__CountDownSpinner",
|
|
48
40
|
componentId: "sc-45dbps-8"
|
|
49
|
-
})(["stroke:", ";stroke-width:2px;stroke-dasharray:75;transition:stroke-dashoffset ", "s linear;"],
|
|
50
|
-
|
|
51
|
-
}, function (props) {
|
|
52
|
-
return props.duration;
|
|
53
|
-
});
|
|
54
|
-
export var MoveByOffset = styled.span.withConfig({
|
|
41
|
+
})(["stroke:", ";stroke-width:2px;stroke-dasharray:75;transition:stroke-dashoffset ", "s linear;"], (props) => props.theme.palette["grey-500"], (props) => props.duration);
|
|
42
|
+
const MoveByOffset = /* @__PURE__ */ styled.span.withConfig({
|
|
55
43
|
displayName: "StepCardstyles__MoveByOffset",
|
|
56
44
|
componentId: "sc-45dbps-9"
|
|
57
|
-
})(["display:flex;align-items:center;gap:2px;", "{display:", ";}"], MoveByOffsetLabel,
|
|
58
|
-
|
|
59
|
-
});
|
|
60
|
-
export var CrudsWrapper = styled.div.withConfig({
|
|
45
|
+
})(["display:flex;align-items:center;gap:2px;", "{display:", ";}"], MoveByOffsetLabel, (props) => props.offset === 0 ? "none" : "block");
|
|
46
|
+
const CrudsWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
61
47
|
displayName: "StepCardstyles__CrudsWrapper",
|
|
62
48
|
componentId: "sc-45dbps-10"
|
|
63
49
|
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-end;opacity:0;visibility:hidden;"]);
|
|
64
|
-
|
|
50
|
+
const DragIcon = /* @__PURE__ */ styled(Icon).withConfig({
|
|
65
51
|
displayName: "StepCardstyles__DragIcon",
|
|
66
52
|
componentId: "sc-45dbps-11"
|
|
67
53
|
})(["visibility:hidden;opacity:0;"]);
|
|
68
|
-
|
|
54
|
+
const Header = /* @__PURE__ */ styled.div.withConfig({
|
|
69
55
|
displayName: "StepCardstyles__Header",
|
|
70
56
|
componentId: "sc-45dbps-12"
|
|
71
|
-
})(["display:flex;flex-direction:row;align-items:stretch;justify-content:space-between;padding:22px 0;margin:0 24px 0 0;width:100%;max-width:calc(100% - 24px);position:relative;cursor:", ";&:hover{", "{display:none;}", "{opacity:1;visibility:visible;}", "{visibility:visible;opacity:1;}}"],
|
|
72
|
-
|
|
73
|
-
}, RecentlyMoved, CrudsWrapper, DragIcon);
|
|
74
|
-
export var StepCardTitle = styled.div.withConfig({
|
|
57
|
+
})(["display:flex;flex-direction:row;align-items:stretch;justify-content:space-between;padding:22px 0;margin:0 24px 0 0;width:100%;max-width:calc(100% - 24px);position:relative;cursor:", ";&:hover{", "{display:none;}", "{opacity:1;visibility:visible;}", "{visibility:visible;opacity:1;}}"], (props) => props.isDraggable ? "grab" : "default", RecentlyMoved, CrudsWrapper, DragIcon);
|
|
58
|
+
const StepCardTitle = /* @__PURE__ */ styled.div.withConfig({
|
|
75
59
|
displayName: "StepCardstyles__StepCardTitle",
|
|
76
60
|
componentId: "sc-45dbps-13"
|
|
77
61
|
})(["display:flex;gap:8px;"]);
|
|
78
|
-
|
|
62
|
+
const Middle = /* @__PURE__ */ styled.div.withConfig({
|
|
79
63
|
displayName: "StepCardstyles__Middle",
|
|
80
64
|
componentId: "sc-45dbps-14"
|
|
81
65
|
})(["flex-grow:1;"]);
|
|
82
|
-
|
|
66
|
+
const LeftSide = /* @__PURE__ */ styled.div.withConfig({
|
|
83
67
|
displayName: "StepCardstyles__LeftSide",
|
|
84
68
|
componentId: "sc-45dbps-15"
|
|
85
|
-
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;padding-left:", ";"],
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
export var RightSide = styled.div.withConfig({
|
|
69
|
+
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;padding-left:", ";"], ({
|
|
70
|
+
isDraggable
|
|
71
|
+
}) => isDraggable ? "0" : "24px");
|
|
72
|
+
const RightSide = /* @__PURE__ */ styled.div.withConfig({
|
|
90
73
|
displayName: "StepCardstyles__RightSide",
|
|
91
74
|
componentId: "sc-45dbps-16"
|
|
92
75
|
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;> *{margin-left:8px;}"]);
|
|
93
|
-
|
|
76
|
+
const Body = /* @__PURE__ */ styled.div.withConfig({
|
|
94
77
|
displayName: "StepCardstyles__Body",
|
|
95
78
|
componentId: "sc-45dbps-17"
|
|
96
|
-
})(["padding:", ";width:100%;.ds-conditions{&:first-of-type{padding-top:0;}&:last-of-type{padding-bottom:0;}}"],
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
export var AdditionalFields = styled.div.withConfig({
|
|
79
|
+
})(["padding:", ";width:100%;.ds-conditions{&:first-of-type{padding-top:0;}&:last-of-type{padding-bottom:0;}}"], ({
|
|
80
|
+
singleStepCondition
|
|
81
|
+
}) => singleStepCondition ? "0" : "0 0 24px");
|
|
82
|
+
const AdditionalFields = /* @__PURE__ */ styled.div.withConfig({
|
|
101
83
|
displayName: "StepCardstyles__AdditionalFields",
|
|
102
84
|
componentId: "sc-45dbps-18"
|
|
103
|
-
})(["width:100%;padding:24px 24px 12px;border-top:1px solid ", ";"],
|
|
104
|
-
|
|
105
|
-
});
|
|
106
|
-
export var Footer = styled.div.withConfig({
|
|
85
|
+
})(["width:100%;padding:24px 24px 12px;border-top:1px solid ", ";"], (props) => props.theme.palette["grey-200"]);
|
|
86
|
+
const Footer = /* @__PURE__ */ styled.div.withConfig({
|
|
107
87
|
displayName: "StepCardstyles__Footer",
|
|
108
88
|
componentId: "sc-45dbps-19"
|
|
109
|
-
})(["background-color:rgba(249,250,251,0.6);border-top:1px solid ", ";padding:16px 24px;display:flex;flex-direction:row;align-items:center;justify-content:flex-end;width:100%;> *{margin-left:8px;}"],
|
|
110
|
-
|
|
111
|
-
|
|
89
|
+
})(["background-color:rgba(249,250,251,0.6);border-top:1px solid ", ";padding:16px 24px;display:flex;flex-direction:row;align-items:center;justify-content:flex-end;width:100%;> *{margin-left:8px;}"], (props) => props.theme.palette["grey-100"]);
|
|
90
|
+
export {
|
|
91
|
+
AdditionalFields,
|
|
92
|
+
Body,
|
|
93
|
+
Container,
|
|
94
|
+
Content,
|
|
95
|
+
CountDownSpinner,
|
|
96
|
+
CountDownWrapper,
|
|
97
|
+
CrudsWrapper,
|
|
98
|
+
DragIcon,
|
|
99
|
+
DragPlaceholder,
|
|
100
|
+
DragPlaceholderContent,
|
|
101
|
+
DragPlaceholderTag,
|
|
102
|
+
Footer,
|
|
103
|
+
Header,
|
|
104
|
+
LeftSide,
|
|
105
|
+
Middle,
|
|
106
|
+
MoveByOffset,
|
|
107
|
+
MoveByOffsetLabel,
|
|
108
|
+
RecentlyMoved,
|
|
109
|
+
RightSide,
|
|
110
|
+
StepCardTitle
|
|
111
|
+
};
|
package/dist/StepCard.types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { DragHandlePropType } from '@synerise/ds-sortable';
|
|
3
3
|
export type StepCardTexts = {
|
|
4
4
|
matching: string;
|
|
5
5
|
notMatching: string;
|
package/dist/StepCard.types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StepCardTexts } from '../StepCard.types';
|
|
2
2
|
export declare const useDefaultTexts: (texts?: Partial<StepCardTexts>) => StepCardTexts;
|
|
@@ -1,52 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}, [formatMessage, texts]);
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { useIntl } from "react-intl";
|
|
3
|
+
const useDefaultTexts = (texts) => {
|
|
4
|
+
const {
|
|
5
|
+
formatMessage
|
|
6
|
+
} = useIntl();
|
|
7
|
+
const allTexts = useMemo(() => ({
|
|
8
|
+
matching: formatMessage({
|
|
9
|
+
id: "DS.MATCHING.PERFORMED",
|
|
10
|
+
defaultMessage: "Performed"
|
|
11
|
+
}),
|
|
12
|
+
notMatching: formatMessage({
|
|
13
|
+
id: "DS.MATCHING.NOT-PERFORMED",
|
|
14
|
+
defaultMessage: "Not performed"
|
|
15
|
+
}),
|
|
16
|
+
conditionType: formatMessage({
|
|
17
|
+
id: "DS.STEP-CARD.CONDITION-TYPE",
|
|
18
|
+
defaultMessage: "event"
|
|
19
|
+
}),
|
|
20
|
+
notConditionType: formatMessage({
|
|
21
|
+
id: "DS.STEP-CARD.NOT-CONDITION-TYPE",
|
|
22
|
+
defaultMessage: "event"
|
|
23
|
+
}),
|
|
24
|
+
namePlaceholder: formatMessage({
|
|
25
|
+
id: "DS.STEP-CARD.NAME-PLACEHOLDER",
|
|
26
|
+
defaultMessage: "Name"
|
|
27
|
+
}),
|
|
28
|
+
moveTooltip: formatMessage({
|
|
29
|
+
id: "DS.STEP-CARD.MOVE",
|
|
30
|
+
defaultMessage: "Move"
|
|
31
|
+
}),
|
|
32
|
+
moveUpTooltip: formatMessage({
|
|
33
|
+
id: "DS.STEP-CARD.MOVE-UP",
|
|
34
|
+
defaultMessage: "Move Up"
|
|
35
|
+
}),
|
|
36
|
+
moveDownTooltip: formatMessage({
|
|
37
|
+
id: "DS.STEP-CARD.MOVE-DOWN",
|
|
38
|
+
defaultMessage: "Move Down"
|
|
39
|
+
}),
|
|
40
|
+
deleteTooltip: formatMessage({
|
|
41
|
+
id: "DS.STEP-CARD.DELETE",
|
|
42
|
+
defaultMessage: "Delete"
|
|
43
|
+
}),
|
|
44
|
+
duplicateTooltip: formatMessage({
|
|
45
|
+
id: "DS.STEP-CARD.DUPLICATE",
|
|
46
|
+
defaultMessage: "Duplicate"
|
|
47
|
+
}),
|
|
48
|
+
...texts || {}
|
|
49
|
+
}), [formatMessage, texts]);
|
|
51
50
|
return allTexts;
|
|
52
|
-
};
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
useDefaultTexts
|
|
54
|
+
};
|
package/dist/index.js
CHANGED
package/dist/modules.d.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-step-card",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.40",
|
|
4
4
|
"description": "StepCard UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "
|
|
19
|
+
"build": "vite build",
|
|
20
20
|
"build:css": "node ../../../scripts/style/less.js",
|
|
21
21
|
"build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
|
|
22
|
-
"build:watch": "
|
|
22
|
+
"build:watch": "vite build --watch",
|
|
23
23
|
"defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
|
|
24
24
|
"pack:ci": "pnpm pack --pack-destination ../../storybook/storybook-static/static",
|
|
25
25
|
"prepublish": "pnpm run build",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
],
|
|
36
36
|
"types": "dist/index.d.ts",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@synerise/ds-alert": "^1.1.
|
|
39
|
-
"@synerise/ds-cruds": "^1.1.
|
|
40
|
-
"@synerise/ds-icon": "^1.15.
|
|
41
|
-
"@synerise/ds-logic": "^1.1.
|
|
42
|
-
"@synerise/ds-typography": "^1.1.
|
|
38
|
+
"@synerise/ds-alert": "^1.1.45",
|
|
39
|
+
"@synerise/ds-cruds": "^1.1.2",
|
|
40
|
+
"@synerise/ds-icon": "^1.15.1",
|
|
41
|
+
"@synerise/ds-logic": "^1.1.32",
|
|
42
|
+
"@synerise/ds-typography": "^1.1.13"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@synerise/ds-sortable": "^1.3.
|
|
45
|
+
"@synerise/ds-sortable": "^1.3.14"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@synerise/ds-core": "*",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
51
51
|
"styled-components": "^5.3.3"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "e4ecca8944fc9b41c1b9d59c8bcad5e5e2013225"
|
|
54
54
|
}
|