@synerise/ds-step-card 1.0.10 → 1.2.0
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 +22 -0
- package/dist/StepCard.js +28 -56
- package/dist/StepCard.styles.d.ts +14 -3
- package/dist/StepCard.styles.js +53 -21
- package/dist/StepCard.types.d.ts +11 -2
- package/dist/hooks/useDefaultTexts.d.ts +2 -0
- package/dist/hooks/useDefaultTexts.js +52 -0
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
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.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-step-card@1.1.0...@synerise/ds-step-card@1.2.0) (2025-06-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **condition:** sortable lib ([8cbc3f5](https://github.com/Synerise/synerise-design/commit/8cbc3f5956ce9138f1a6b0a5eb0e7cd85bb7f4e7))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [1.1.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-step-card@1.0.10...@synerise/ds-step-card@1.1.0) (2025-06-05)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **filter:** change dnd lib and update ux ([f5a979e](https://github.com/Synerise/synerise-design/commit/f5a979e6c9e5d9c8251c3f57da8ce57c416dadab))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [1.0.10](https://github.com/Synerise/synerise-design/compare/@synerise/ds-step-card@1.0.9...@synerise/ds-step-card@1.0.10) (2025-06-03)
|
|
7
29
|
|
|
8
30
|
**Note:** Version bump only for package @synerise/ds-step-card
|
package/dist/StepCard.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useRef, forwardRef, useEffect,
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
2
|
+
import React, { useRef, forwardRef, useEffect, useState, createRef } from 'react';
|
|
4
3
|
import { Matching } from '@synerise/ds-logic';
|
|
5
4
|
import Cruds from '@synerise/ds-cruds';
|
|
6
5
|
import { InlineAlert } from '@synerise/ds-alert';
|
|
7
6
|
import { DragHandleM } from '@synerise/ds-icon';
|
|
8
7
|
import { Title } from '@synerise/ds-typography';
|
|
9
8
|
import * as S from './StepCard.styles';
|
|
9
|
+
import { useDefaultTexts } from './hooks/useDefaultTexts';
|
|
10
10
|
export var REORDER_THROTTLE = 1000;
|
|
11
11
|
var MOVE_SUCCESS_FEEDBACK_DURATION = 2000;
|
|
12
12
|
var StepCard = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
@@ -22,6 +22,7 @@ var StepCard = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
22
22
|
onChangeMatching = _ref.onChangeMatching,
|
|
23
23
|
texts = _ref.texts,
|
|
24
24
|
headerRightSide = _ref.headerRightSide,
|
|
25
|
+
renderHeaderRightSide = _ref.renderHeaderRightSide,
|
|
25
26
|
_ref$isHeaderVisible = _ref.isHeaderVisible,
|
|
26
27
|
isHeaderVisible = _ref$isHeaderVisible === void 0 ? true : _ref$isHeaderVisible,
|
|
27
28
|
_ref$readOnly = _ref.readOnly,
|
|
@@ -31,46 +32,13 @@ var StepCard = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
31
32
|
getMoveByLabel = _ref.getMoveByLabel,
|
|
32
33
|
_ref$isDraggable = _ref.isDraggable,
|
|
33
34
|
isDraggable = _ref$isDraggable === void 0 ? true : _ref$isDraggable,
|
|
35
|
+
isDragged = _ref.isDragged,
|
|
36
|
+
isDragOverlay = _ref.isDragOverlay,
|
|
37
|
+
dragIndex = _ref.dragIndex,
|
|
38
|
+
dropLabel = _ref.dropLabel,
|
|
39
|
+
dragHandleProps = _ref.dragHandleProps,
|
|
34
40
|
additionalFields = _ref.additionalFields;
|
|
35
|
-
var
|
|
36
|
-
formatMessage = _useIntl.formatMessage;
|
|
37
|
-
var text = useMemo(function () {
|
|
38
|
-
return _extends({
|
|
39
|
-
matching: formatMessage({
|
|
40
|
-
id: 'DS.MATCHING.PERFORMED'
|
|
41
|
-
}),
|
|
42
|
-
notMatching: formatMessage({
|
|
43
|
-
id: 'DS.MATCHING.NOT-PERFORMED'
|
|
44
|
-
}),
|
|
45
|
-
conditionType: formatMessage({
|
|
46
|
-
id: 'DS.STEP-CARD.CONDITION-TYPE'
|
|
47
|
-
}),
|
|
48
|
-
notConditionType: formatMessage({
|
|
49
|
-
id: 'DS.STEP-CARD.NOT-CONDITION-TYPE'
|
|
50
|
-
}),
|
|
51
|
-
namePlaceholder: formatMessage({
|
|
52
|
-
id: 'DS.STEP-CARD.NAME-PLACEHOLDER'
|
|
53
|
-
}),
|
|
54
|
-
moveTooltip: formatMessage({
|
|
55
|
-
id: 'DS.STEP-CARD.MOVE',
|
|
56
|
-
defaultMessage: 'Move'
|
|
57
|
-
}),
|
|
58
|
-
moveUpTooltip: formatMessage({
|
|
59
|
-
id: 'DS.STEP-CARD.MOVE-UP',
|
|
60
|
-
defaultMessage: 'Move Up'
|
|
61
|
-
}),
|
|
62
|
-
moveDownTooltip: formatMessage({
|
|
63
|
-
id: 'DS.STEP-CARD.MOVE-DOWN',
|
|
64
|
-
defaultMessage: 'Move Down'
|
|
65
|
-
}),
|
|
66
|
-
deleteTooltip: formatMessage({
|
|
67
|
-
id: 'DS.STEP-CARD.DELETE'
|
|
68
|
-
}),
|
|
69
|
-
duplicateTooltip: formatMessage({
|
|
70
|
-
id: 'DS.STEP-CARD.DUPLICATE'
|
|
71
|
-
})
|
|
72
|
-
}, texts);
|
|
73
|
-
}, [formatMessage, texts]);
|
|
41
|
+
var allTexts = useDefaultTexts(texts);
|
|
74
42
|
var _useState = useState(0),
|
|
75
43
|
moveByOffset = _useState[0],
|
|
76
44
|
setMoveByOffset = _useState[1];
|
|
@@ -160,47 +128,51 @@ var StepCard = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
160
128
|
offset: moveByOffset
|
|
161
129
|
}, countDownSpinnerElement, " ", /*#__PURE__*/React.createElement(S.MoveByOffsetLabel, null, moveByOffsetLabel)), /*#__PURE__*/React.createElement(Cruds, {
|
|
162
130
|
onMoveUp: onMoveUp,
|
|
163
|
-
moveUpTooltip:
|
|
131
|
+
moveUpTooltip: allTexts.moveUpTooltip,
|
|
164
132
|
moveUpInactive: moveUpInactive,
|
|
165
133
|
onMoveDown: onMoveDown,
|
|
166
|
-
moveDownTooltip:
|
|
134
|
+
moveDownTooltip: allTexts.moveDownTooltip,
|
|
167
135
|
moveDownInactive: moveDownInactive,
|
|
168
|
-
deleteTooltip:
|
|
136
|
+
deleteTooltip: allTexts.deleteTooltip,
|
|
169
137
|
onDelete: onDelete,
|
|
170
|
-
duplicateTooltip:
|
|
138
|
+
duplicateTooltip: allTexts.duplicateTooltip,
|
|
171
139
|
onDuplicate: onDuplicate
|
|
172
140
|
})), recentlyMoved && /*#__PURE__*/React.createElement(S.RecentlyMoved, {
|
|
173
141
|
duration: MOVE_SUCCESS_FEEDBACK_DURATION
|
|
174
142
|
}, /*#__PURE__*/React.createElement(InlineAlert, {
|
|
175
143
|
type: "success",
|
|
176
144
|
message: "Moved"
|
|
177
|
-
})), headerRightSide);
|
|
145
|
+
})), renderHeaderRightSide ? renderHeaderRightSide(dragIndex != null ? dragIndex : expressionIndex) : headerRightSide);
|
|
178
146
|
};
|
|
179
147
|
return /*#__PURE__*/React.createElement(S.Container, {
|
|
148
|
+
isDragged: isDragged,
|
|
149
|
+
isDragOverlay: isDragOverlay,
|
|
180
150
|
ref: ref
|
|
181
|
-
},
|
|
151
|
+
}, /*#__PURE__*/React.createElement(S.DragPlaceholder, null, dropLabel && /*#__PURE__*/React.createElement(S.DragPlaceholderContent, null, dropLabel), /*#__PURE__*/React.createElement(S.DragPlaceholderTag, null, renderHeaderRightSide && dragIndex !== undefined ? renderHeaderRightSide(dragIndex, {
|
|
152
|
+
placeholder: true
|
|
153
|
+
}) : headerRightSide)), /*#__PURE__*/React.createElement(S.Content, null, isHeaderVisible && /*#__PURE__*/React.createElement(S.Header, {
|
|
154
|
+
isDraggable: !readOnly && isDraggable,
|
|
182
155
|
onMouseOver: resetMoveSuccess,
|
|
183
|
-
onFocus: resetMoveSuccess
|
|
184
|
-
className: "step-card-drag-handler"
|
|
156
|
+
onFocus: resetMoveSuccess
|
|
185
157
|
}, /*#__PURE__*/React.createElement(S.LeftSide, {
|
|
186
|
-
|
|
187
|
-
}, !readOnly && isDraggable && /*#__PURE__*/React.createElement(S.DragIcon, {
|
|
158
|
+
isDraggable: !readOnly && isDraggable
|
|
159
|
+
}, !readOnly && isDraggable && /*#__PURE__*/React.createElement(S.DragIcon, _extends({
|
|
188
160
|
component: /*#__PURE__*/React.createElement(DragHandleM, null)
|
|
189
|
-
}), matching !== undefined && onChangeMatching && /*#__PURE__*/React.createElement(
|
|
161
|
+
}, !readOnly && isDraggable ? dragHandleProps : {})), matching !== undefined && onChangeMatching && /*#__PURE__*/React.createElement(S.StepCardTitle, null, /*#__PURE__*/React.createElement(Matching, {
|
|
190
162
|
matching: matching,
|
|
191
163
|
onChange: onChangeMatching,
|
|
192
164
|
texts: {
|
|
193
|
-
matching:
|
|
194
|
-
notMatching:
|
|
165
|
+
matching: allTexts.matching,
|
|
166
|
+
notMatching: allTexts.notMatching
|
|
195
167
|
},
|
|
196
168
|
readOnly: readOnly
|
|
197
169
|
}), /*#__PURE__*/React.createElement(Title, {
|
|
198
170
|
withoutMargin: true,
|
|
199
171
|
level: 4
|
|
200
|
-
}, matching ?
|
|
172
|
+
}, matching ? allTexts.conditionType : allTexts.notConditionType))), !readOnly && isDraggable && /*#__PURE__*/React.createElement(S.Middle, dragHandleProps), (!readOnly || headerRightSide || renderHeaderRightSide) && /*#__PURE__*/React.createElement(S.RightSide, {
|
|
201
173
|
className: "step-card-right-side"
|
|
202
174
|
}, renderRightSide())), /*#__PURE__*/React.createElement(S.Body, {
|
|
203
175
|
singleStepCondition: singleStepCondition
|
|
204
|
-
}, children), additionalFields && /*#__PURE__*/React.createElement(S.AdditionalFields, null, additionalFields), footer && /*#__PURE__*/React.createElement(S.Footer, null, footer));
|
|
176
|
+
}, children), additionalFields && /*#__PURE__*/React.createElement(S.AdditionalFields, null, additionalFields), footer && /*#__PURE__*/React.createElement(S.Footer, null, footer)));
|
|
205
177
|
});
|
|
206
178
|
export default StepCard;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const
|
|
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
|
+
isDragged?: boolean | undefined;
|
|
8
|
+
isDragOverlay?: boolean | undefined;
|
|
9
|
+
}, never>;
|
|
3
10
|
export declare const RecentlyMoved: import("styled-components").StyledComponent<"span", any, {
|
|
4
11
|
duration: number;
|
|
5
12
|
}, never>;
|
|
@@ -13,9 +20,13 @@ export declare const MoveByOffset: import("styled-components").StyledComponent<"
|
|
|
13
20
|
}, never>;
|
|
14
21
|
export declare const CrudsWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
15
22
|
export declare const DragIcon: import("styled-components").StyledComponent<({ name, component, className, ...rest }: import("@synerise/ds-icon").IconProps) => import("react").JSX.Element, any, {}, never>;
|
|
16
|
-
export declare const Header: import("styled-components").StyledComponent<"div", any, {
|
|
23
|
+
export declare const Header: import("styled-components").StyledComponent<"div", any, {
|
|
24
|
+
isDraggable?: boolean | undefined;
|
|
25
|
+
}, never>;
|
|
26
|
+
export declare const StepCardTitle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
27
|
+
export declare const Middle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
17
28
|
export declare const LeftSide: import("styled-components").StyledComponent<"div", any, {
|
|
18
|
-
|
|
29
|
+
isDraggable?: boolean | undefined;
|
|
19
30
|
}, never>;
|
|
20
31
|
export declare const RightSide: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
21
32
|
export declare const Body: import("styled-components").StyledComponent<"div", any, {
|
package/dist/StepCard.styles.js
CHANGED
|
@@ -1,29 +1,51 @@
|
|
|
1
|
-
import styled, { keyframes } from 'styled-components';
|
|
1
|
+
import styled, { css, keyframes } from 'styled-components';
|
|
2
2
|
import Icon from '@synerise/ds-icon';
|
|
3
3
|
var fadeout = keyframes(["from{opacity:1}to{opacity:0;}"]);
|
|
4
|
-
export var
|
|
5
|
-
displayName: "
|
|
4
|
+
export var DragPlaceholder = styled.div.withConfig({
|
|
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
|
+
export var DragPlaceholderContent = styled.div.withConfig({
|
|
9
|
+
displayName: "StepCardstyles__DragPlaceholderContent",
|
|
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:", ";;"], function (props) {
|
|
12
|
+
return props.theme.palette['blue-600'];
|
|
13
|
+
});
|
|
14
|
+
export var DragPlaceholderTag = styled.div.withConfig({
|
|
15
|
+
displayName: "StepCardstyles__DragPlaceholderTag",
|
|
16
|
+
componentId: "sc-45dbps-2"
|
|
17
|
+
})(["position:absolute;right:24px;top:22px;opacity:0.4;"]);
|
|
18
|
+
export var Content = styled.div.withConfig({
|
|
19
|
+
displayName: "StepCardstyles__Content",
|
|
20
|
+
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;"], function (props) {
|
|
8
22
|
return props.theme.palette.white;
|
|
9
23
|
});
|
|
24
|
+
export var Container = styled.div.withConfig({
|
|
25
|
+
displayName: "StepCardstyles__Container",
|
|
26
|
+
componentId: "sc-45dbps-4"
|
|
27
|
+
})(["width:100%;min-width:594px;", ""], function (props) {
|
|
28
|
+
return (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
|
|
29
|
+
css(["height:100px;", "", "{visibility:visible;opacity:1;display:block;}", "{visibility:hidden;opacity:0;}"], DragPlaceholder, DragPlaceholder, Content), props.isDragOverlay && // grabbed item on top layer
|
|
30
|
+
css(["", "{height:76px;margin-bottom:24px;display:flex;align-items:center;justify-content:center;}", "{display:none;}"], Content, RightSide), DragIcon, DragIcon, Body, Footer);
|
|
31
|
+
});
|
|
10
32
|
export var RecentlyMoved = styled.span.withConfig({
|
|
11
33
|
displayName: "StepCardstyles__RecentlyMoved",
|
|
12
|
-
componentId: "sc-45dbps-
|
|
34
|
+
componentId: "sc-45dbps-5"
|
|
13
35
|
})(["animation:", " 0.1s linear ", "s 1 forwards;"], fadeout, function (props) {
|
|
14
36
|
return (props.duration - 200) / 1000;
|
|
15
37
|
});
|
|
16
38
|
export var CountDownWrapper = styled.div.withConfig({
|
|
17
39
|
displayName: "StepCardstyles__CountDownWrapper",
|
|
18
|
-
componentId: "sc-45dbps-
|
|
40
|
+
componentId: "sc-45dbps-6"
|
|
19
41
|
})(["vertical-align:middle;display:inline-block;width:24px;height:24px;color:inherit;"]);
|
|
20
42
|
export var MoveByOffsetLabel = styled.span.withConfig({
|
|
21
43
|
displayName: "StepCardstyles__MoveByOffsetLabel",
|
|
22
|
-
componentId: "sc-45dbps-
|
|
44
|
+
componentId: "sc-45dbps-7"
|
|
23
45
|
})([""]);
|
|
24
46
|
export var CountDownSpinner = styled.g.withConfig({
|
|
25
47
|
displayName: "StepCardstyles__CountDownSpinner",
|
|
26
|
-
componentId: "sc-45dbps-
|
|
48
|
+
componentId: "sc-45dbps-8"
|
|
27
49
|
})(["stroke:", ";stroke-width:2px;stroke-dasharray:75;transition:stroke-dashoffset ", "s linear;"], function (props) {
|
|
28
50
|
return props.theme.palette['grey-500'];
|
|
29
51
|
}, function (props) {
|
|
@@ -31,49 +53,59 @@ export var CountDownSpinner = styled.g.withConfig({
|
|
|
31
53
|
});
|
|
32
54
|
export var MoveByOffset = styled.span.withConfig({
|
|
33
55
|
displayName: "StepCardstyles__MoveByOffset",
|
|
34
|
-
componentId: "sc-45dbps-
|
|
56
|
+
componentId: "sc-45dbps-9"
|
|
35
57
|
})(["display:flex;align-items:center;gap:2px;", "{display:", ";}"], MoveByOffsetLabel, function (props) {
|
|
36
58
|
return props.offset === 0 ? 'none' : 'block';
|
|
37
59
|
});
|
|
38
60
|
export var CrudsWrapper = styled.div.withConfig({
|
|
39
61
|
displayName: "StepCardstyles__CrudsWrapper",
|
|
40
|
-
componentId: "sc-45dbps-
|
|
62
|
+
componentId: "sc-45dbps-10"
|
|
41
63
|
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-end;opacity:0;visibility:hidden;"]);
|
|
42
64
|
export var DragIcon = styled(Icon).withConfig({
|
|
43
65
|
displayName: "StepCardstyles__DragIcon",
|
|
44
|
-
componentId: "sc-45dbps-
|
|
66
|
+
componentId: "sc-45dbps-11"
|
|
45
67
|
})(["visibility:hidden;opacity:0;"]);
|
|
46
68
|
export var Header = styled.div.withConfig({
|
|
47
69
|
displayName: "StepCardstyles__Header",
|
|
48
|
-
componentId: "sc-45dbps-
|
|
49
|
-
})(["display:flex;flex-direction:row;align-items:
|
|
70
|
+
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;}}"], function (props) {
|
|
72
|
+
return props.isDraggable ? 'grab' : 'default';
|
|
73
|
+
}, RecentlyMoved, CrudsWrapper, DragIcon);
|
|
74
|
+
export var StepCardTitle = styled.div.withConfig({
|
|
75
|
+
displayName: "StepCardstyles__StepCardTitle",
|
|
76
|
+
componentId: "sc-45dbps-13"
|
|
77
|
+
})(["display:flex;gap:8px;"]);
|
|
78
|
+
export var Middle = styled.div.withConfig({
|
|
79
|
+
displayName: "StepCardstyles__Middle",
|
|
80
|
+
componentId: "sc-45dbps-14"
|
|
81
|
+
})(["flex-grow:1;"]);
|
|
50
82
|
export var LeftSide = styled.div.withConfig({
|
|
51
83
|
displayName: "StepCardstyles__LeftSide",
|
|
52
|
-
componentId: "sc-45dbps-
|
|
53
|
-
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;padding-left:", "
|
|
54
|
-
var
|
|
55
|
-
return
|
|
84
|
+
componentId: "sc-45dbps-15"
|
|
85
|
+
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;padding-left:", ";"], function (_ref) {
|
|
86
|
+
var isDraggable = _ref.isDraggable;
|
|
87
|
+
return isDraggable ? '0' : '24px';
|
|
56
88
|
});
|
|
57
89
|
export var RightSide = styled.div.withConfig({
|
|
58
90
|
displayName: "StepCardstyles__RightSide",
|
|
59
|
-
componentId: "sc-45dbps-
|
|
91
|
+
componentId: "sc-45dbps-16"
|
|
60
92
|
})(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;> *{margin-left:8px;}"]);
|
|
61
93
|
export var Body = styled.div.withConfig({
|
|
62
94
|
displayName: "StepCardstyles__Body",
|
|
63
|
-
componentId: "sc-45dbps-
|
|
95
|
+
componentId: "sc-45dbps-17"
|
|
64
96
|
})(["padding:", ";width:100%;.ds-conditions{&:first-of-type{padding-top:0;}&:last-of-type{padding-bottom:0;}}"], function (_ref2) {
|
|
65
97
|
var singleStepCondition = _ref2.singleStepCondition;
|
|
66
98
|
return singleStepCondition ? '0' : '0 0 24px';
|
|
67
99
|
});
|
|
68
100
|
export var AdditionalFields = styled.div.withConfig({
|
|
69
101
|
displayName: "StepCardstyles__AdditionalFields",
|
|
70
|
-
componentId: "sc-45dbps-
|
|
102
|
+
componentId: "sc-45dbps-18"
|
|
71
103
|
})(["width:100%;padding:24px 24px 12px;border-top:1px solid ", ";"], function (props) {
|
|
72
104
|
return props.theme.palette['grey-200'];
|
|
73
105
|
});
|
|
74
106
|
export var Footer = styled.div.withConfig({
|
|
75
107
|
displayName: "StepCardstyles__Footer",
|
|
76
|
-
componentId: "sc-45dbps-
|
|
108
|
+
componentId: "sc-45dbps-19"
|
|
77
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;}"], function (props) {
|
|
78
110
|
return props.theme.palette['grey-100'];
|
|
79
111
|
});
|
package/dist/StepCard.types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { DragHandlePropType } from '@synerise/ds-sortable';
|
|
2
3
|
export type StepCardTexts = {
|
|
3
4
|
matching: string;
|
|
4
5
|
notMatching: string;
|
|
@@ -24,12 +25,20 @@ export type StepCardProps = {
|
|
|
24
25
|
expressionIndex: number;
|
|
25
26
|
expressionCount: number;
|
|
26
27
|
expressionMoved?: boolean;
|
|
27
|
-
texts?: StepCardTexts
|
|
28
|
+
texts?: Partial<StepCardTexts>;
|
|
28
29
|
isHeaderVisible?: boolean;
|
|
29
30
|
isDraggable?: boolean;
|
|
30
31
|
readOnly?: boolean;
|
|
31
32
|
singleStepCondition?: boolean;
|
|
32
33
|
headerRightSide?: ReactNode;
|
|
34
|
+
dropLabel?: ReactNode;
|
|
35
|
+
renderHeaderRightSide?: (index: number, options?: {
|
|
36
|
+
placeholder?: boolean;
|
|
37
|
+
}) => ReactNode;
|
|
33
38
|
getMoveByLabel?: (moveByOffset: number) => string;
|
|
34
39
|
additionalFields?: JSX.Element;
|
|
40
|
+
dragHandleProps?: DragHandlePropType;
|
|
41
|
+
isDragged?: boolean;
|
|
42
|
+
isDragOverlay?: boolean;
|
|
43
|
+
dragIndex?: number;
|
|
35
44
|
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { useIntl } from 'react-intl';
|
|
4
|
+
export var useDefaultTexts = function useDefaultTexts(texts) {
|
|
5
|
+
var _useIntl = useIntl(),
|
|
6
|
+
formatMessage = _useIntl.formatMessage;
|
|
7
|
+
var allTexts = useMemo(function () {
|
|
8
|
+
return _extends({
|
|
9
|
+
matching: formatMessage({
|
|
10
|
+
id: 'DS.MATCHING.PERFORMED',
|
|
11
|
+
defaultMessage: 'Performed'
|
|
12
|
+
}),
|
|
13
|
+
notMatching: formatMessage({
|
|
14
|
+
id: 'DS.MATCHING.NOT-PERFORMED',
|
|
15
|
+
defaultMessage: 'Not performed'
|
|
16
|
+
}),
|
|
17
|
+
conditionType: formatMessage({
|
|
18
|
+
id: 'DS.STEP-CARD.CONDITION-TYPE',
|
|
19
|
+
defaultMessage: 'event'
|
|
20
|
+
}),
|
|
21
|
+
notConditionType: formatMessage({
|
|
22
|
+
id: 'DS.STEP-CARD.NOT-CONDITION-TYPE',
|
|
23
|
+
defaultMessage: 'event'
|
|
24
|
+
}),
|
|
25
|
+
namePlaceholder: formatMessage({
|
|
26
|
+
id: 'DS.STEP-CARD.NAME-PLACEHOLDER',
|
|
27
|
+
defaultMessage: 'Name'
|
|
28
|
+
}),
|
|
29
|
+
moveTooltip: formatMessage({
|
|
30
|
+
id: 'DS.STEP-CARD.MOVE',
|
|
31
|
+
defaultMessage: 'Move'
|
|
32
|
+
}),
|
|
33
|
+
moveUpTooltip: formatMessage({
|
|
34
|
+
id: 'DS.STEP-CARD.MOVE-UP',
|
|
35
|
+
defaultMessage: 'Move Up'
|
|
36
|
+
}),
|
|
37
|
+
moveDownTooltip: formatMessage({
|
|
38
|
+
id: 'DS.STEP-CARD.MOVE-DOWN',
|
|
39
|
+
defaultMessage: 'Move Down'
|
|
40
|
+
}),
|
|
41
|
+
deleteTooltip: formatMessage({
|
|
42
|
+
id: 'DS.STEP-CARD.DELETE',
|
|
43
|
+
defaultMessage: 'Delete'
|
|
44
|
+
}),
|
|
45
|
+
duplicateTooltip: formatMessage({
|
|
46
|
+
id: 'DS.STEP-CARD.DUPLICATE',
|
|
47
|
+
defaultMessage: 'Duplicate'
|
|
48
|
+
})
|
|
49
|
+
}, texts || {});
|
|
50
|
+
}, [formatMessage, texts]);
|
|
51
|
+
return allTexts;
|
|
52
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-step-card",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "StepCard UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
],
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-alert": "^1.1.
|
|
38
|
-
"@synerise/ds-cruds": "^1.0.
|
|
39
|
-
"@synerise/ds-icon": "^1.5.
|
|
40
|
-
"@synerise/ds-logic": "^1.
|
|
41
|
-
"@synerise/ds-typography": "^1.0.
|
|
42
|
-
"@synerise/ds-utils": "^1.
|
|
37
|
+
"@synerise/ds-alert": "^1.1.5",
|
|
38
|
+
"@synerise/ds-cruds": "^1.0.11",
|
|
39
|
+
"@synerise/ds-icon": "^1.5.3",
|
|
40
|
+
"@synerise/ds-logic": "^1.1.1",
|
|
41
|
+
"@synerise/ds-typography": "^1.0.11",
|
|
42
|
+
"@synerise/ds-utils": "^1.3.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@synerise/ds-core": "*",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
48
48
|
"styled-components": "^5.3.3"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "f2713cd35cfe22f63a159f05144585834897a132"
|
|
51
51
|
}
|