@desynova-digital/components 9.2.1 → 9.2.3
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/atoms/cardV2/cardV2.js +10 -5
- package/atoms/cardV2/content.js +94 -150
- package/atoms/cardV2/contentV2.js +287 -0
- package/atoms/cardV2/thumbnail.js +58 -61
- package/atoms/cardV2/thumbnailV2.js +251 -0
- package/atoms/icon/icon.story.js +230 -203
- package/atoms/timeCodeInput/timeCodeMSInput.js +6 -4
- package/atoms/timeCodeInput/timeCodeMainInput.js +6 -4
- package/atoms/timeCodeInput/timeCodeStandardInput.js +6 -4
- package/molecules/richTextInputV2/RichTextInputV2.js +10 -2
- package/package.json +2 -2
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _tokens = require("@desynova-digital/tokens");
|
|
15
|
+
var _icon = _interopRequireDefault(require("../../atoms/icon"));
|
|
16
|
+
var _tokens2 = require("../../../tokens");
|
|
17
|
+
var _cardV = require("./cardV2");
|
|
18
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9; // atoms
|
|
19
|
+
// tokens
|
|
20
|
+
// styles
|
|
21
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
23
|
+
var OverlayBackgroundStyles = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n background: rgba(0, 0, 0, 0.5);\n"])));
|
|
24
|
+
var assetStyles = {
|
|
25
|
+
folder: {
|
|
26
|
+
backgroundColor: '#2f3031',
|
|
27
|
+
backgroundSize: 'inherit'
|
|
28
|
+
},
|
|
29
|
+
asset: {
|
|
30
|
+
backgroundColor: 'inherit',
|
|
31
|
+
backgroundSize: 'cover'
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var HoverActionButton = _styledComponents["default"].button(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n ", ";\n border: none;\n cursor: pointer;\n width: 26px;\n height: 26px;\n border-radius: 15px;\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: 0;\n transition: opacity 200ms ease;\n"])), OverlayBackgroundStyles);
|
|
35
|
+
var ThumbnailStyles = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n background: ", ";\n background-color: ", ";\n background-size: ", ";\n width: ", ";\n height: ", ";\n border-radius: 8px 8px 0 0;\n overflow: hidden;\n\n .iframe-image-block {\n cursor: ", ";\n background: #000;\n opacity: 0;\n &:hover {\n opacity: 1;\n }\n .hover-pointer {\n position: absolute;\n width: 1px;\n height: 100%;\n top: 0;\n background: #fff;\n pointer-events: none;\n z-index: 1;\n }\n }\n .background-block {\n position: absolute;\n z-index: 1;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n overflow: hidden;\n .circle {\n width: 40px;\n height: 40px;\n border-radius: 50%;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n background-color: #15212f;\n }\n i {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n img {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: auto;\n }\n }\n .thumbnail-image-block {\n cursor: pointer;\n background: linear-gradient(359deg, #182738 19.98%, #182738 48.97%, rgba(24, 39, 56, 0.42) 99.47%);\n }\n\n &:hover ", " {\n opacity: 1;\n }\n"])), function (_ref) {
|
|
36
|
+
var thumbnail = _ref.thumbnail;
|
|
37
|
+
return "url(".concat(thumbnail, ") no-repeat 50%");
|
|
38
|
+
}, function (_ref2) {
|
|
39
|
+
var data_type = _ref2.data_type;
|
|
40
|
+
return assetStyles[data_type] && assetStyles[data_type].backgroundColor ? assetStyles[data_type].backgroundColor : 'inherit';
|
|
41
|
+
}, function (_ref3) {
|
|
42
|
+
var data_type = _ref3.data_type;
|
|
43
|
+
return assetStyles[data_type] && assetStyles[data_type].backgroundSize ? assetStyles[data_type].backgroundSize : 'cover';
|
|
44
|
+
}, function (_ref4) {
|
|
45
|
+
var width = _ref4.width;
|
|
46
|
+
return width === 'sm' ? '90px' : width === 'md' ? '125px' : '222px';
|
|
47
|
+
}, function (_ref5) {
|
|
48
|
+
var width = _ref5.width;
|
|
49
|
+
return width === 'sm' ? '50px' : width === 'md' ? '70px' : '110px';
|
|
50
|
+
}, function (_ref6) {
|
|
51
|
+
var isClickPrevented = _ref6.isClickPrevented;
|
|
52
|
+
return !isClickPrevented ? 'pointer' : 'default';
|
|
53
|
+
}, HoverActionButton);
|
|
54
|
+
var UploadTypeContainer = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n z-index: 2;\n cursor: pointer;\n .uploadWrapper {\n border-radius: 50%;\n background: ", ";\n\n color: ", ";\n width: 25px;\n height: 25px;\n display: flex;\n justify-content: center;\n align-items: center;\n .wrapper {\n font-size: 10px;\n font-family: 'SFUIText-Regular';\n line-height: 1.1;\n text-transform: uppercase;\n }\n }\n"])), function (props) {
|
|
55
|
+
return props.upload_type === 'rc' ? '#FF6327' : _tokens.colors[props.theme].card.themeColor;
|
|
56
|
+
}, function (props) {
|
|
57
|
+
return props.upload_type === 'rc' ? '#FFFFFF' : '#15212F';
|
|
58
|
+
});
|
|
59
|
+
var HoverActionContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n margin-left: 6px;\n"])));
|
|
60
|
+
var StatusBoxStyles = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n padding: 5px 8px;\n width: fit-content;\n border-radius: 15px;\n margin-right: 5px;\n display: flex;\n align-items: center;\n ", ";\n\n .status-color {\n height: 6px;\n width: 6px;\n border-radius: 100%;\n background-color: ", ";\n margin-right: 5px;\n }\n\n .status-text {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n -webkit-line-clamp: 1;\n height: 10px;\n }\n"])), OverlayBackgroundStyles, function (_ref7) {
|
|
61
|
+
var hex = _ref7.hex;
|
|
62
|
+
return hex.background;
|
|
63
|
+
});
|
|
64
|
+
var IconButtonStyles = (0, _styledComponents["default"])(function (props) {
|
|
65
|
+
return /*#__PURE__*/_react["default"].createElement(_cardV.BaseButtonStyles, props);
|
|
66
|
+
})(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n ", ";\n\n .tooltip {\n position: absolute;\n bottom: 130%;\n left: 30%;\n transform: translateX(-50%);\n padding: 5px 9px;\n box-sizing: border-box;\n background: #000000;\n color: #fff;\n border-radius: 10px;\n visibility: hidden;\n opacity: 0;\n z-index: 10;\n transition: all 350ms ease-in-out 0s;\n &:after {\n content: '';\n position: absolute;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-top: 5px solid #000;\n bottom: -5px;\n left: 50%;\n }\n .details-header {\n color: #666666;\n font-family: 'SFUIText-Regular';\n text-transform: none;\n margin-bottom: 8px;\n }\n .details-value {\n color: #999999;\n font-family: 'SFUIText-Light';\n text-transform: none;\n font-size: 10px;\n }\n }\n\n &:hover {\n background-color: ", ";\n .tooltip {\n opacity: 1;\n visibility: visible;\n }\n }\n &:active,\n &:focus {\n outline: none;\n }\n"])), OverlayBackgroundStyles, function (props) {
|
|
67
|
+
return _tokens.colors[props.theme].card.themeColor;
|
|
68
|
+
});
|
|
69
|
+
var CardHeader = _styledComponents["default"].div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n padding: 10px;\n"])));
|
|
70
|
+
var BottomActionContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n bottom: 8px;\n right: 1px;\n transform: translateX(-50%);\n display: flex;\n align-items: center;\n gap: 6px;\n z-index: 3;\n opacity: 1;\n"])));
|
|
71
|
+
var ThumbnailV2 = function ThumbnailV2(props) {
|
|
72
|
+
var theme = props.theme,
|
|
73
|
+
width = props.width,
|
|
74
|
+
thumbnail = props.thumbnail,
|
|
75
|
+
iframeurl = props.iframeurl,
|
|
76
|
+
card_status = props.card_status,
|
|
77
|
+
actions = props.actions,
|
|
78
|
+
ingest_db_id = props.ingest_db_id,
|
|
79
|
+
actionClick = props.actionClick,
|
|
80
|
+
upload_status = props.upload_status,
|
|
81
|
+
upload_type = props.upload_type,
|
|
82
|
+
file_type = props.file_type,
|
|
83
|
+
data_type = props.data_type,
|
|
84
|
+
onUploadTypeClick = props.onUploadTypeClick,
|
|
85
|
+
showPointer = props.showPointer;
|
|
86
|
+
var _useState = (0, _react.useState)(null),
|
|
87
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
88
|
+
statusIndex = _useState2[0],
|
|
89
|
+
setStatusIndex = _useState2[1];
|
|
90
|
+
var _useState3 = (0, _react.useState)(false),
|
|
91
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
92
|
+
isClickPrevented = _useState4[0],
|
|
93
|
+
setClickPreventation = _useState4[1];
|
|
94
|
+
var iframeImageBlockRef = (0, _react.useRef)(null);
|
|
95
|
+
var iframeImageRef = (0, _react.useRef)(null);
|
|
96
|
+
var hoverPointerRef = (0, _react.useRef)(null);
|
|
97
|
+
(0, _react.useEffect)(function () {
|
|
98
|
+
if (actions && actions.length > 0 && actions.some(function (item) {
|
|
99
|
+
return item.field === 'upload' || item.field === 'phupload_ingest';
|
|
100
|
+
}) // can add multiple condition in future to prevent click
|
|
101
|
+
) {
|
|
102
|
+
setClickPreventation(true);
|
|
103
|
+
}
|
|
104
|
+
}, [actions && JSON.stringify(actions).length > 0]);
|
|
105
|
+
(0, _react.useEffect)(function () {
|
|
106
|
+
/**
|
|
107
|
+
* will return the hex based status passed
|
|
108
|
+
* eg. status = In Progress -> will format to "in_progress"
|
|
109
|
+
* then it will find its index in CARD_ASSET_STATUS which will
|
|
110
|
+
* return hex
|
|
111
|
+
* @const
|
|
112
|
+
*/
|
|
113
|
+
var index = _tokens2.CARD_ASSET_STATUS.findIndex(function (label) {
|
|
114
|
+
return label.code.includes(card_status || upload_status ? (card_status || upload_status).toLowerCase().split(' ').join('_') : []);
|
|
115
|
+
});
|
|
116
|
+
setStatusIndex(index);
|
|
117
|
+
}, [upload_status, card_status]);
|
|
118
|
+
var handleMouseMove = (0, _react.useCallback)(function () {
|
|
119
|
+
if (iframeImageBlockRef && hoverPointerRef && iframeImageRef) {
|
|
120
|
+
var iframeBlockHeight = iframeImageBlockRef.current.offsetHeight;
|
|
121
|
+
var iframeOgHeight = 120;
|
|
122
|
+
var ogHeight = iframeImageRef.current.naturalHeight;
|
|
123
|
+
var offsetHeight = iframeImageRef.current.offsetHeight;
|
|
124
|
+
var offsetWidth = iframeImageRef.current.offsetWidth;
|
|
125
|
+
var iframeCount = ogHeight / iframeOgHeight;
|
|
126
|
+
var iframeOffsetHeight = offsetHeight / iframeCount;
|
|
127
|
+
var imageChangePoint = offsetWidth / iframeCount;
|
|
128
|
+
var offsetTop = Math.abs(iframeBlockHeight - iframeOffsetHeight) / 2;
|
|
129
|
+
hoverPointerRef.current.style.left = event.offsetX + 'px';
|
|
130
|
+
var imageNum = parseInt(event.offsetX / imageChangePoint) || 1;
|
|
131
|
+
var imageTop = iframeOffsetHeight * imageNum + offsetTop;
|
|
132
|
+
if (imageTop > offsetHeight) {
|
|
133
|
+
imageTop = offsetHeight + offsetTop - iframeOffsetHeight;
|
|
134
|
+
}
|
|
135
|
+
iframeImageRef.current.style.top = '-' + imageTop + 'px';
|
|
136
|
+
}
|
|
137
|
+
}, [iframeImageBlockRef, hoverPointerRef, iframeImageRef]);
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* will decide thumbnail click based on its condition
|
|
141
|
+
* eg. if task_type === upload then prevent click
|
|
142
|
+
* @function
|
|
143
|
+
*/
|
|
144
|
+
var handleThumbnailClick = (0, _react.useCallback)(function (e) {
|
|
145
|
+
if (!isClickPrevented) {
|
|
146
|
+
actionClick(e, 'play', ingest_db_id);
|
|
147
|
+
} else {
|
|
148
|
+
e.preventDefault();
|
|
149
|
+
}
|
|
150
|
+
}, [isClickPrevented]);
|
|
151
|
+
var handleActionIconClick = (0, _react.useCallback)(function (e, item) {
|
|
152
|
+
e.stopPropagation();
|
|
153
|
+
actionClick(e, item.field);
|
|
154
|
+
}, [actionClick]);
|
|
155
|
+
var handleUploadTypeClick = (0, _react.useCallback)(function (e) {
|
|
156
|
+
e.stopPropagation();
|
|
157
|
+
if (onUploadTypeClick) {
|
|
158
|
+
onUploadTypeClick();
|
|
159
|
+
}
|
|
160
|
+
}, [onUploadTypeClick]);
|
|
161
|
+
return /*#__PURE__*/_react["default"].createElement(ThumbnailStyles, {
|
|
162
|
+
width: width,
|
|
163
|
+
thumbnail: thumbnail,
|
|
164
|
+
isClickPrevented: isClickPrevented,
|
|
165
|
+
onClick: handleThumbnailClick,
|
|
166
|
+
theme: props.theme,
|
|
167
|
+
data_type: data_type
|
|
168
|
+
}, /*#__PURE__*/_react["default"].createElement(CardHeader, null, /*#__PURE__*/_react["default"].createElement(_cardV.DivStyles, {
|
|
169
|
+
theme: props.theme,
|
|
170
|
+
className: "asset-card-thumbnail-head",
|
|
171
|
+
display: "flex",
|
|
172
|
+
justify: "flex-end",
|
|
173
|
+
align: "center",
|
|
174
|
+
position: "relative",
|
|
175
|
+
zIndex: "2",
|
|
176
|
+
marginLeft: "auto"
|
|
177
|
+
}, ingest_db_id && /*#__PURE__*/_react["default"].createElement(HoverActionContainer, null, /*#__PURE__*/_react["default"].createElement(HoverActionButton, {
|
|
178
|
+
type: "button",
|
|
179
|
+
onClick: handleUploadTypeClick,
|
|
180
|
+
title: "Info"
|
|
181
|
+
}, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
|
|
182
|
+
name: "info",
|
|
183
|
+
width: 14,
|
|
184
|
+
height: 14,
|
|
185
|
+
theme: props.theme
|
|
186
|
+
}))))), actions && actions.length && /*#__PURE__*/_react["default"].createElement(BottomActionContainer, null, actions.map(function (item, i) {
|
|
187
|
+
return item.icon && /*#__PURE__*/_react["default"].createElement(IconButtonStyles, {
|
|
188
|
+
theme: props.theme,
|
|
189
|
+
className: "asset-card-thumbnail-icon-button",
|
|
190
|
+
type: "button",
|
|
191
|
+
key: i,
|
|
192
|
+
position: "relative",
|
|
193
|
+
border: "none",
|
|
194
|
+
cursor: "pointer",
|
|
195
|
+
borderRadius: "15px",
|
|
196
|
+
height: "26px",
|
|
197
|
+
padding: "0px",
|
|
198
|
+
width: "26px",
|
|
199
|
+
margin: "0",
|
|
200
|
+
onClick: function onClick(e) {
|
|
201
|
+
return handleActionIconClick(e, item);
|
|
202
|
+
}
|
|
203
|
+
}, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
|
|
204
|
+
name: item.icon,
|
|
205
|
+
width: 22,
|
|
206
|
+
height: 24,
|
|
207
|
+
theme: props.theme
|
|
208
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
209
|
+
className: "tooltip"
|
|
210
|
+
}, item.title));
|
|
211
|
+
})) || null, file_type && !thumbnail ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
212
|
+
className: "thumbnail-image-block background-block"
|
|
213
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
214
|
+
className: "circle"
|
|
215
|
+
}, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
|
|
216
|
+
name: "".concat(file_type, "-icon"),
|
|
217
|
+
width: 20,
|
|
218
|
+
height: 20
|
|
219
|
+
}))) : null, iframeurl && /*#__PURE__*/_react["default"].createElement("div", {
|
|
220
|
+
onMouseMove: handleMouseMove,
|
|
221
|
+
className: "iframe-image-block background-block",
|
|
222
|
+
ref: iframeImageBlockRef
|
|
223
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
224
|
+
className: "hover-pointer",
|
|
225
|
+
ref: hoverPointerRef
|
|
226
|
+
}), /*#__PURE__*/_react["default"].createElement("img", {
|
|
227
|
+
ref: iframeImageRef,
|
|
228
|
+
className: "iframe-image",
|
|
229
|
+
src: iframeurl
|
|
230
|
+
})) || null);
|
|
231
|
+
};
|
|
232
|
+
ThumbnailV2.propTypes = {
|
|
233
|
+
theme: _propTypes["default"].oneOf(['light', 'dark', 'nexc']),
|
|
234
|
+
width: _propTypes["default"].string,
|
|
235
|
+
thumbnail: _propTypes["default"].string,
|
|
236
|
+
file_type: _propTypes["default"].string,
|
|
237
|
+
iframeurl: _propTypes["default"].string,
|
|
238
|
+
upload_status: _propTypes["default"].string,
|
|
239
|
+
card_status: _propTypes["default"].string,
|
|
240
|
+
ingest_db_id: _propTypes["default"].string,
|
|
241
|
+
actions: _propTypes["default"].instanceOf(Array),
|
|
242
|
+
actionClick: _propTypes["default"].func,
|
|
243
|
+
onUploadTypeClick: _propTypes["default"].func
|
|
244
|
+
};
|
|
245
|
+
ThumbnailV2.defaultProps = {
|
|
246
|
+
theme: 'dark',
|
|
247
|
+
width: 'lg',
|
|
248
|
+
thumbnail: 'https://thumbnail.desynova.com/default_placeholder/Contido_Placeholder_Image.png',
|
|
249
|
+
iframeurl: ''
|
|
250
|
+
};
|
|
251
|
+
var _default = exports["default"] = ThumbnailV2;
|