@desynova-digital/components 9.2.22 → 9.2.24

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.
@@ -41,7 +41,7 @@ var CommonStyles = exports.CommonStyles = (0, _styledComponents.css)(_templateOb
41
41
  var DivStyles = exports.DivStyles = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n ", ";\n"])), CommonStyles);
42
42
  var BaseParaStyles = exports.BaseParaStyles = _styledComponents["default"].p(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: SFUIText-Regular;\n ", ";\n"])), CommonStyles);
43
43
  var BaseButtonStyles = exports.BaseButtonStyles = _styledComponents["default"].button(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: SFUIText-Regular;\n ", ";\n"])), CommonStyles);
44
- var CardStyles = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n border-radius: 8px;\n overflow: hidden;\n width: ", ";\n\n border: 1px solid transparent;\n box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.18);\n\n /* \u2705 Center pop baseline */\n transform: scale(1);\n transform-origin: 50% 50%;\n\n /* \u2705 Make it pop above siblings */\n z-index: 0;\n isolation: isolate;\n\n transition:\n transform 240ms cubic-bezier(0.16, 1, 0.3, 1),\n box-shadow 240ms cubic-bezier(0.16, 1, 0.3, 1),\n border-color 240ms cubic-bezier(0.16, 1, 0.3, 1);\n\n will-change: transform;\n\n /* \uD83D\uDD25 Glow Layer */\n &::after {\n content: '';\n position: absolute;\n inset: -2px;\n border-radius: 10px;\n pointer-events: none;\n opacity: 0;\n transition: all 0.4s ease-out;\n\n box-shadow: ", ";\n }\n\n /* \u2705 Hover = pop from center (NO translate) */\n &:hover {\n transform: scale(1.035);\n z-index: 5;\nborder-color: ", ";\n }\n box-shadow: 0 22px 60px rgba(0, 0, 0, 0.6);\n }\n\n &:hover::after {\n opacity: 1;\n }\n"])), function (_ref2) {
44
+ var CardStyles = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n border-radius: 8px;\n overflow: hidden;\n width: ", ";\n\n border: 1px solid transparent;\n box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.18);\n\n /* \u2705 Center pop baseline */\n transform: scale(1);\n transform-origin: 50% 50%;\n\n /* \u2705 Make it pop above siblings */\n z-index: 0;\n isolation: isolate;\n\n transition:\n transform 240ms cubic-bezier(0.16, 1, 0.3, 1),\n box-shadow 240ms cubic-bezier(0.16, 1, 0.3, 1),\n border-color 240ms cubic-bezier(0.16, 1, 0.3, 1);\n\n will-change: transform;\n\n /* \uD83D\uDD25 Glow Layer */\n &::after {\n content: '';\n position: absolute;\n inset: -2px;\n border-radius: 10px;\n pointer-events: none;\n opacity: 0;\n transition: all 0.4s ease-out;\n\n box-shadow: ", ";\n }\n\n /* \u2705 Hover = pop from center (NO translate) */\n &:hover {\n transform: scale(1.035);\n z-index: 5;\n border-color: ", ";\n box-shadow: 0 22px 60px rgba(0, 0, 0, 0.6);\n }\n\n &:hover::after {\n opacity: 1;\n }\n"])), function (_ref2) {
45
45
  var width = _ref2.width;
46
46
  return width === 'sm' ? 'auto' : width === 'md' ? '125px' : '222px';
47
47
  }, function (_ref3) {
@@ -94,7 +94,9 @@ CardV2.propTypes = {
94
94
  theme: _propTypes["default"].oneOf(['light', 'dark', 'nexc']),
95
95
  type: _propTypes["default"].oneOf(['asset', 'search']),
96
96
  bgColor: _propTypes["default"].oneOf(['primary', 'secondary']),
97
- isCardv2: _propTypes["default"].bool
97
+ isCardv2: _propTypes["default"].bool,
98
+ nestedDropdownData: _propTypes["default"].arrayOf(_propTypes["default"].object),
99
+ onNestedDropdownSelect: _propTypes["default"].func
98
100
  };
99
101
  CardV2.defaultProps = {
100
102
  isSegment: false,
@@ -94,7 +94,8 @@ var ContentV2 = function ContentV2(props) {
94
94
  h1 = props.h1,
95
95
  creation = props.creation,
96
96
  extension = props.extension,
97
- season_id = props.season_id;
97
+ season_id = props.season_id,
98
+ isAdobe = props.isAdobe;
98
99
  var ICON_DIMENSION_MAP = {
99
100
  snp_edit: {
100
101
  width: 10,
@@ -195,7 +196,7 @@ var ContentV2 = function ContentV2(props) {
195
196
  }, /*#__PURE__*/_react["default"].createElement("span", {
196
197
  className: "title-text",
197
198
  title: title || h1
198
- }, title || h1), episode_label ? /*#__PURE__*/_react["default"].createElement(SeasonEpisodeContainer, null, episode_label) : null, show_page_id && asset_type !== 'sports' ? /*#__PURE__*/_react["default"].createElement("span", {
199
+ }, title || h1), episode_label ? /*#__PURE__*/_react["default"].createElement(SeasonEpisodeContainer, null, episode_label) : null, show_page_id && asset_type !== 'sports' && !isAdobe ? /*#__PURE__*/_react["default"].createElement("span", {
199
200
  title: "Open Page",
200
201
  className: "files-associated-icon",
201
202
  onMouseEnter: function onMouseEnter() {
@@ -299,10 +300,12 @@ ContentV2.propTypes = {
299
300
  width: _propTypes["default"].string,
300
301
  type: _propTypes["default"].string,
301
302
  titleClick: _propTypes["default"].func,
302
- theme: _propTypes["default"].oneOf(['light', 'dark', 'nexc'])
303
+ theme: _propTypes["default"].oneOf(['light', 'dark', 'nexc']),
304
+ isAdobe: _propTypes["default"].bool
303
305
  };
304
306
  ContentV2.defaultProps = {
305
307
  theme: 'dark',
306
- isSegment: false
308
+ isSegment: false,
309
+ isAdobe: false
307
310
  };
308
311
  var _default = exports["default"] = ContentV2;
@@ -9,13 +9,14 @@ exports["default"] = void 0;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
11
  var _react = _interopRequireWildcard(require("react"));
12
+ var _reactDom = require("react-dom");
12
13
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
13
14
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
15
  var _tokens = require("@desynova-digital/tokens");
15
16
  var _icon = _interopRequireDefault(require("../../atoms/icon"));
16
17
  var _tokens2 = require("../../../tokens");
17
18
  var _cardV = require("./cardV2");
18
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9; // atoms
19
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17; // atoms
19
20
  // tokens
20
21
  // styles
21
22
  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); }
@@ -23,51 +24,148 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
23
24
  var OverlayBackgroundStyles = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n background: rgba(0, 0, 0, 0.5);\n"])));
24
25
  var assetStyles = {
25
26
  folder: {
26
- backgroundColor: '#121D29',
27
- backgroundSize: 'inherit'
27
+ backgroundColor: "#121D29",
28
+ backgroundSize: "inherit"
28
29
  },
29
30
  asset: {
30
- backgroundColor: 'inherit',
31
- backgroundSize: 'cover'
31
+ backgroundColor: "inherit",
32
+ backgroundSize: "cover"
32
33
  }
33
34
  };
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\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 svg path {\n fill: #AFB2BA;\n }\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) {
35
+ 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\n /* Add rotation only when the 'rotate-icon' class is present */\n &.rotate-icon svg,\n &.rotate-icon i {\n transform: rotate(90deg);\n }\n"])), OverlayBackgroundStyles);
36
+ 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\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 svg path {\n fill: #afb2ba;\n }\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(\n 359deg,\n #182738 19.98%,\n #182738 48.97%,\n rgba(24, 39, 56, 0.42) 99.47%\n );\n }\n\n &:hover ", " {\n opacity: 1;\n }\n"])), function (_ref) {
36
37
  var thumbnail = _ref.thumbnail;
37
38
  return "url(".concat(thumbnail, ") no-repeat 50%");
38
39
  }, function (_ref2) {
39
40
  var data_type = _ref2.data_type;
40
- return assetStyles[data_type] && assetStyles[data_type].backgroundColor ? assetStyles[data_type].backgroundColor : 'inherit';
41
+ return assetStyles[data_type] && assetStyles[data_type].backgroundColor ? assetStyles[data_type].backgroundColor : "inherit";
41
42
  }, function (_ref3) {
42
43
  var data_type = _ref3.data_type;
43
- return assetStyles[data_type] && assetStyles[data_type].backgroundSize ? assetStyles[data_type].backgroundSize : 'cover';
44
+ return assetStyles[data_type] && assetStyles[data_type].backgroundSize ? assetStyles[data_type].backgroundSize : "cover";
44
45
  }, function (_ref4) {
45
46
  var width = _ref4.width;
46
- return width === 'sm' ? '90px' : width === 'md' ? '125px' : '222px';
47
+ return width === "sm" ? "90px" : width === "md" ? "125px" : "222px";
47
48
  }, function (_ref5) {
48
49
  var width = _ref5.width;
49
- return width === 'sm' ? '50px' : width === 'md' ? '70px' : '110px';
50
+ return width === "sm" ? "50px" : width === "md" ? "70px" : "110px";
50
51
  }, function (_ref6) {
51
52
  var isClickPrevented = _ref6.isClickPrevented;
52
- return !isClickPrevented ? 'pointer' : 'default';
53
+ return !isClickPrevented ? "pointer" : "default";
53
54
  }, 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;
55
+ 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) {
56
+ return props.upload_type === "rc" ? "#FF6327" : _tokens.colors[props.theme].card.themeColor;
56
57
  }, function (props) {
57
- return props.upload_type === 'rc' ? '#FFFFFF' : '#15212F';
58
+ return props.upload_type === "rc" ? "#FFFFFF" : "#15212F";
58
59
  });
59
60
  var HoverActionContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n margin-left: 6px;\n"])));
60
61
  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
62
  var hex = _ref7.hex;
62
63
  return hex.background;
63
64
  });
65
+
66
+ // ---------- New styled components for nested dropdown ----------
67
+ var TopRightMenuContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n position: fixed;\n z-index: 99999;\n"])));
68
+ var DropdownContainer = _styledComponents["default"].div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n display: inline-block;\n"])));
69
+ var Menu = _styledComponents["default"].ul(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n list-style: none;\n margin: 0;\n padding: 4px 0;\n width: max-content;\n background: #182738;\n border-radius: 4px;\n min-width: 100px;\n box-shadow: 0px 6px 16px rgba(0, 0, 0, 0.25);\n"])));
70
+ var MenuItemWrapper = _styledComponents["default"].li(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n font-family: \"SFUIText-Regular\";\n display: flex;\n flex-direction: column;\n\n &:last-child hr {\n display: none;\n }\n"])));
71
+ var MenuItem = _styledComponents["default"].div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n color: #ffffff;\n padding: 8px 12px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n white-space: nowrap;\n font-size: 14px;\n transition: background 0.2s ease;\n\n &:hover {\n background: #1c2d44;\n }\n\n & svg {\n width: 14px;\n height: 14px;\n color: #fff;\n margin-left: 8px;\n }\n"])));
72
+ var Divider = _styledComponents["default"].hr(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n border: none;\n border-top: 1px solid rgba(255, 255, 255, 0.1);\n margin: 0;\n"])));
73
+ var SubMenu = _styledComponents["default"].div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n top: 0;\n left: calc(100% - 2px);\n margin-left: 0;\n z-index: 100;\n"])));
74
+ var RightArrow = _styledComponents["default"].span(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-block;\n width: 0;\n height: 0;\n border-top: 4px solid transparent;\n border-bottom: 4px solid transparent;\n border-left: 5px solid #fff;\n margin-left: 8px;\n opacity: 0.8;\n"])));
75
+ // ----------------------------------------------------------------
76
+
77
+ // NestedDropdown and DropdownItem components
78
+ var NestedDropdown = function NestedDropdown(_ref8) {
79
+ var data = _ref8.data,
80
+ onSelect = _ref8.onSelect;
81
+ return /*#__PURE__*/_react["default"].createElement(DropdownContainer, null, /*#__PURE__*/_react["default"].createElement(Menu, null, (data || []).map(function (item, index) {
82
+ return /*#__PURE__*/_react["default"].createElement(_DropdownItem, {
83
+ key: "".concat(item.label || item.value || index, "-").concat(index),
84
+ item: item,
85
+ onSelect: onSelect
86
+ });
87
+ })));
88
+ };
89
+ var _DropdownItem = function DropdownItem(_ref9) {
90
+ var item = _ref9.item,
91
+ onSelect = _ref9.onSelect;
92
+ var _useState = (0, _react.useState)(false),
93
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
94
+ open = _useState2[0],
95
+ setOpen = _useState2[1];
96
+ var handleClick = function handleClick(e) {
97
+ e.stopPropagation();
98
+ if (item.children && item.children.length) {
99
+ setOpen(function (prev) {
100
+ return !prev;
101
+ });
102
+ return;
103
+ }
104
+ if (onSelect) {
105
+ onSelect(item);
106
+ }
107
+ };
108
+ return /*#__PURE__*/_react["default"].createElement(MenuItemWrapper, {
109
+ onClick: handleClick,
110
+ onMouseEnter: function onMouseEnter() {
111
+ return setOpen(true);
112
+ },
113
+ onMouseLeave: function onMouseLeave() {
114
+ return setOpen(false);
115
+ }
116
+ }, /*#__PURE__*/_react["default"].createElement(MenuItem, null, /*#__PURE__*/_react["default"].createElement("span", null, item.label), item.children && item.children.length ? /*#__PURE__*/_react["default"].createElement(RightArrow, null) : null), item.children && open ? /*#__PURE__*/_react["default"].createElement(SubMenu, null, /*#__PURE__*/_react["default"].createElement(Menu, null, item.children.map(function (child, i) {
117
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
118
+ key: "".concat(child.label || child.value || i, "-").concat(i)
119
+ }, /*#__PURE__*/_react["default"].createElement(_DropdownItem, {
120
+ item: child,
121
+ onSelect: onSelect
122
+ }), /*#__PURE__*/_react["default"].createElement(Divider, null));
123
+ }))) : null, /*#__PURE__*/_react["default"].createElement(Divider, null));
124
+ };
125
+ var DropdownPortal = function DropdownPortal(_ref10) {
126
+ var open = _ref10.open,
127
+ anchorRef = _ref10.anchorRef,
128
+ children = _ref10.children,
129
+ onMouseEnter = _ref10.onMouseEnter,
130
+ onMouseLeave = _ref10.onMouseLeave;
131
+ var _useState3 = (0, _react.useState)({}),
132
+ _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
133
+ style = _useState4[0],
134
+ setStyle = _useState4[1];
135
+ (0, _react.useLayoutEffect)(function () {
136
+ if (!open || !anchorRef.current) return;
137
+ var updatePosition = function updatePosition() {
138
+ var rect = anchorRef.current.getBoundingClientRect();
139
+ setStyle({
140
+ top: rect.bottom + 2,
141
+ left: rect.right - 140
142
+ });
143
+ };
144
+ updatePosition();
145
+ window.addEventListener("scroll", updatePosition, true);
146
+ window.addEventListener("resize", updatePosition);
147
+ return function () {
148
+ window.removeEventListener("scroll", updatePosition, true);
149
+ window.removeEventListener("resize", updatePosition);
150
+ };
151
+ }, [open, anchorRef]);
152
+ if (!open) return null;
153
+ return /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react["default"].createElement(TopRightMenuContainer, {
154
+ style: style,
155
+ onMouseEnter: onMouseEnter /* Fixed: use passed prop instead of undefined openMenu */,
156
+ onMouseLeave: onMouseLeave /* Fixed: use passed prop instead of undefined closeMenu */,
157
+ onClick: function onClick(e) {
158
+ return e.stopPropagation();
159
+ }
160
+ }, children), document.body);
161
+ };
64
162
  var IconButtonStyles = (0, _styledComponents["default"])(function (props) {
65
163
  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 right: 0;\n transform: translateX(0);\n padding: 5px 9px;\n box-sizing: border-box;\n background: #000000;\n color: #fff;\n border-radius: 10px;\n width: max-content;\n max-width: 200px;\n white-space: normal;\n overflow-wrap: break-word;\n text-align: center;\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) {
164
+ })(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["\n ", ";\n\n .tooltip {\n position: absolute;\n bottom: 130%;\n right: 0;\n transform: translateX(0);\n padding: 5px 9px;\n box-sizing: border-box;\n background: #000000;\n color: #fff;\n border-radius: 10px;\n width: max-content;\n max-width: 200px;\n white-space: normal;\n overflow-wrap: break-word;\n text-align: center;\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
165
  return _tokens.colors[props.theme].card.themeColor;
68
166
  });
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: 8px;\n display: flex;\n align-items: center;\n gap: 6px;\n z-index: 3;\n opacity: 1;\n"])));
167
+ var CardHeader = _styledComponents["default"].div(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n padding: 10px;\n"])));
168
+ var BottomActionContainer = _styledComponents["default"].div(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n bottom: 8px;\n right: 8px;\n display: flex;\n align-items: center;\n gap: 6px;\n z-index: 3;\n opacity: 1;\n"])));
71
169
  var ThumbnailV2 = function ThumbnailV2(props) {
72
170
  var theme = props.theme,
73
171
  width = props.width,
@@ -83,39 +181,62 @@ var ThumbnailV2 = function ThumbnailV2(props) {
83
181
  data_type = props.data_type,
84
182
  onUploadTypeClick = props.onUploadTypeClick,
85
183
  showPointer = props.showPointer,
86
- value = props.value;
87
- var _useState = (0, _react.useState)(null),
88
- _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
89
- statusIndex = _useState2[0],
90
- setStatusIndex = _useState2[1];
91
- var _useState3 = (0, _react.useState)(false),
92
- _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
93
- isClickPrevented = _useState4[0],
94
- setClickPreventation = _useState4[1];
184
+ value = props.value,
185
+ nestedDropdownData = props.nestedDropdownData,
186
+ onNestedDropdownSelect = props.onNestedDropdownSelect,
187
+ _props$isAdobe = props.isAdobe,
188
+ isAdobe = _props$isAdobe === void 0 ? false : _props$isAdobe;
189
+ var _useState5 = (0, _react.useState)(null),
190
+ _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
191
+ statusIndex = _useState6[0],
192
+ setStatusIndex = _useState6[1];
193
+ var _useState7 = (0, _react.useState)(false),
194
+ _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
195
+ isClickPrevented = _useState8[0],
196
+ setClickPreventation = _useState8[1];
197
+ var _useState9 = (0, _react.useState)(false),
198
+ _useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
199
+ showTopRightAction = _useState10[0],
200
+ setShowTopRightAction = _useState10[1];
95
201
  var iframeImageBlockRef = (0, _react.useRef)(null);
96
202
  var iframeImageRef = (0, _react.useRef)(null);
97
203
  var hoverPointerRef = (0, _react.useRef)(null);
204
+ var menuAnchorRef = (0, _react.useRef)(null);
205
+ var closeTimer = (0, _react.useRef)(null);
206
+ var openMenu = function openMenu() {
207
+ clearTimeout(closeTimer.current);
208
+ setShowTopRightAction(true);
209
+ };
210
+ var closeMenu = function closeMenu() {
211
+ closeTimer.current = setTimeout(function () {
212
+ setShowTopRightAction(false);
213
+ }, 150);
214
+ };
98
215
  (0, _react.useEffect)(function () {
99
216
  if (actions && actions.length > 0 && actions.some(function (item) {
100
- return item.field === 'upload' || item.field === 'phupload_ingest';
101
- }) // can add multiple condition in future to prevent click
102
- ) {
217
+ return item.field === "upload" || item.field === "phupload_ingest";
218
+ })) {
103
219
  setClickPreventation(true);
104
220
  }
105
221
  }, [actions && JSON.stringify(actions).length > 0]);
106
222
  (0, _react.useEffect)(function () {
107
- /**
108
- * will return the hex based status passed
109
- * eg. status = In Progress -> will format to "in_progress"
110
- * then it will find its index in CARD_ASSET_STATUS which will
111
- * return hex
112
- * @const
113
- */
114
223
  var index = _tokens2.CARD_ASSET_STATUS.findIndex(function (label) {
115
- return label.code.includes(card_status || upload_status ? (card_status || upload_status).toLowerCase().split(' ').join('_') : []);
224
+ return label.code.includes(card_status || upload_status ? (card_status || upload_status).toLowerCase().split(" ").join("_") : []);
116
225
  });
117
226
  setStatusIndex(index);
118
227
  }, [upload_status, card_status]);
228
+ (0, _react.useEffect)(function () {
229
+ if (!showTopRightAction) return;
230
+ var handleClick = function handleClick(e) {
231
+ if (menuAnchorRef.current && !menuAnchorRef.current.contains(e.target)) {
232
+ setShowTopRightAction(false);
233
+ }
234
+ };
235
+ document.addEventListener("mousedown", handleClick);
236
+ return function () {
237
+ return document.removeEventListener("mousedown", handleClick);
238
+ };
239
+ }, [showTopRightAction]);
119
240
  var handleMouseMove = (0, _react.useCallback)(function () {
120
241
  if (iframeImageBlockRef && hoverPointerRef && iframeImageRef) {
121
242
  var iframeBlockHeight = iframeImageBlockRef.current.offsetHeight;
@@ -127,24 +248,18 @@ var ThumbnailV2 = function ThumbnailV2(props) {
127
248
  var iframeOffsetHeight = offsetHeight / iframeCount;
128
249
  var imageChangePoint = offsetWidth / iframeCount;
129
250
  var offsetTop = Math.abs(iframeBlockHeight - iframeOffsetHeight) / 2;
130
- hoverPointerRef.current.style.left = event.offsetX + 'px';
251
+ hoverPointerRef.current.style.left = event.offsetX + "px";
131
252
  var imageNum = parseInt(event.offsetX / imageChangePoint) || 1;
132
253
  var imageTop = iframeOffsetHeight * imageNum + offsetTop;
133
254
  if (imageTop > offsetHeight) {
134
255
  imageTop = offsetHeight + offsetTop - iframeOffsetHeight;
135
256
  }
136
- iframeImageRef.current.style.top = '-' + imageTop + 'px';
257
+ iframeImageRef.current.style.top = "-" + imageTop + "px";
137
258
  }
138
259
  }, [iframeImageBlockRef, hoverPointerRef, iframeImageRef]);
139
-
140
- /**
141
- * will decide thumbnail click based on its condition
142
- * eg. if task_type === upload then prevent click
143
- * @function
144
- */
145
260
  var handleThumbnailClick = (0, _react.useCallback)(function (e) {
146
261
  if (!isClickPrevented) {
147
- actionClick(e, 'play', ingest_db_id);
262
+ actionClick(e, "play", ingest_db_id);
148
263
  } else {
149
264
  e.preventDefault();
150
265
  }
@@ -155,10 +270,22 @@ var ThumbnailV2 = function ThumbnailV2(props) {
155
270
  }, [actionClick]);
156
271
  var handleUploadTypeClick = (0, _react.useCallback)(function (e) {
157
272
  e.stopPropagation();
273
+ if (nestedDropdownData && nestedDropdownData.length) {
274
+ setShowTopRightAction(function (prev) {
275
+ return !prev;
276
+ });
277
+ return;
278
+ }
158
279
  if (onUploadTypeClick) {
159
280
  onUploadTypeClick();
160
281
  }
161
- }, [onUploadTypeClick]);
282
+ }, [onUploadTypeClick, nestedDropdownData]);
283
+ var handleNestedSelect = (0, _react.useCallback)(function (item) {
284
+ setShowTopRightAction(false);
285
+ if (onNestedDropdownSelect) {
286
+ onNestedDropdownSelect(item);
287
+ }
288
+ }, [onNestedDropdownSelect]);
162
289
  return /*#__PURE__*/_react["default"].createElement(ThumbnailStyles, {
163
290
  width: width,
164
291
  thumbnail: thumbnail,
@@ -175,7 +302,31 @@ var ThumbnailV2 = function ThumbnailV2(props) {
175
302
  position: "relative",
176
303
  zIndex: "2",
177
304
  marginLeft: "auto"
178
- }, ingest_db_id && /*#__PURE__*/_react["default"].createElement(HoverActionContainer, null, /*#__PURE__*/_react["default"].createElement(HoverActionButton, {
305
+ }, ingest_db_id && /*#__PURE__*/_react["default"].createElement(HoverActionContainer, null, nestedDropdownData && nestedDropdownData.length && isAdobe ? /*#__PURE__*/_react["default"].createElement("div", {
306
+ ref: menuAnchorRef,
307
+ style: {
308
+ position: "relative"
309
+ },
310
+ onMouseEnter: openMenu,
311
+ onMouseLeave: closeMenu
312
+ }, /*#__PURE__*/_react["default"].createElement(HoverActionButton, {
313
+ className: "rotate-icon",
314
+ type: "button",
315
+ title: "More"
316
+ }, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
317
+ name: "dots",
318
+ width: 14,
319
+ height: 14,
320
+ theme: props.theme
321
+ })), /*#__PURE__*/_react["default"].createElement(DropdownPortal, {
322
+ open: showTopRightAction,
323
+ anchorRef: menuAnchorRef,
324
+ onMouseEnter: openMenu,
325
+ onMouseLeave: closeMenu
326
+ }, /*#__PURE__*/_react["default"].createElement(NestedDropdown, {
327
+ data: nestedDropdownData,
328
+ onSelect: handleNestedSelect
329
+ }))) : !isAdobe && /*#__PURE__*/_react["default"].createElement(HoverActionButton, {
179
330
  type: "button",
180
331
  onClick: handleUploadTypeClick,
181
332
  title: "Info"
@@ -214,7 +365,7 @@ var ThumbnailV2 = function ThumbnailV2(props) {
214
365
  }, /*#__PURE__*/_react["default"].createElement("div", {
215
366
  className: "circle"
216
367
  }, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
217
- name: file_type == 'video' && value == 'collateral' ? 'video-icon' : "".concat(file_type, "-icon"),
368
+ name: file_type == "video" && value == "collateral" ? "video-icon" : "".concat(file_type, "-icon"),
218
369
  width: 15,
219
370
  height: 15
220
371
  }))) : null, iframeurl && /*#__PURE__*/_react["default"].createElement("div", {
@@ -231,7 +382,7 @@ var ThumbnailV2 = function ThumbnailV2(props) {
231
382
  })) || null);
232
383
  };
233
384
  ThumbnailV2.propTypes = {
234
- theme: _propTypes["default"].oneOf(['light', 'dark', 'nexc']),
385
+ theme: _propTypes["default"].oneOf(["light", "dark", "nexc"]),
235
386
  width: _propTypes["default"].string,
236
387
  thumbnail: _propTypes["default"].string,
237
388
  file_type: _propTypes["default"].string,
@@ -241,12 +392,16 @@ ThumbnailV2.propTypes = {
241
392
  ingest_db_id: _propTypes["default"].string,
242
393
  actions: _propTypes["default"].instanceOf(Array),
243
394
  actionClick: _propTypes["default"].func,
244
- onUploadTypeClick: _propTypes["default"].func
395
+ onUploadTypeClick: _propTypes["default"].func,
396
+ nestedDropdownData: _propTypes["default"].arrayOf(_propTypes["default"].object),
397
+ onNestedDropdownSelect: _propTypes["default"].func,
398
+ isAdobe: _propTypes["default"].bool
245
399
  };
246
400
  ThumbnailV2.defaultProps = {
247
- theme: 'dark',
248
- width: 'lg',
249
- thumbnail: 'https://thumbnail.desynova.com/default_placeholder/Contido_Placeholder_Image.png',
250
- iframeurl: ''
401
+ theme: "dark",
402
+ width: "lg",
403
+ thumbnail: "https://thumbnail.desynova.com/default_placeholder/Contido_Placeholder_Image.png",
404
+ iframeurl: "",
405
+ isAdobe: false
251
406
  };
252
407
  var _default = exports["default"] = ThumbnailV2;
@@ -1981,6 +1981,13 @@
1981
1981
  "paths": ["M.006 10.286L12 5.143.006 0 0 4l8.571 1.143L0 6.286z"],
1982
1982
  "width": 12,
1983
1983
  "height": 11
1984
+ },
1985
+ "notes-comment":{
1986
+ "paths": [
1987
+ "M0 10V1C0 0.725 0.0979167 0.489583 0.29375 0.29375C0.489583 0.0979167 0.725 0 1 0H9C9.275 0 9.51042 0.0979167 9.70625 0.29375C9.90208 0.489583 10 0.725 10 1V7C10 7.275 9.90208 7.51042 9.70625 7.70625C9.51042 7.90208 9.275 8 9 8H2L0 10ZM2 6H6V5H2V6ZM2 4.5H8V3.5H2V4.5ZM2 3H8V2H2V3Z"
1988
+ ],
1989
+ "width": 10,
1990
+ "height": 10
1984
1991
  }
1985
1992
  }
1986
- }
1993
+ }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@desynova-digital/components",
3
- "version": "9.2.22",
3
+ "version": "9.2.24",
4
4
  "description": "Components for Desynova Digital",
5
5
  "main": "index.js",
6
6
  "author": "desynova-digital",
7
7
  "license": "MIT",
8
8
  "repository": "desynova-digital",
9
9
  "dependencies": {
10
- "@desynova-digital/tokens": "9.2.22",
10
+ "@desynova-digital/tokens": "9.2.24",
11
11
  "prop-types": "^15.7.2",
12
12
  "styled-components": "^4.3.2"
13
13
  },