@bigbinary/neeto-molecules 1.0.77-beta → 1.0.78-beta
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/dist/Sidebar.cjs.js +41 -65
- package/dist/Sidebar.cjs.js.map +1 -1
- package/dist/Sidebar.js +42 -66
- package/dist/Sidebar.js.map +1 -1
- package/package.json +1 -1
- package/types/EmailForm.d.ts +7 -1
- package/types/EmailFormProvider.d.ts +10 -4
- package/types/PublishBlock.d.ts +2 -1
package/dist/Sidebar.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useRef, useCallback, useEffect, Children, isValidElement, cloneElement, forwardRef, useState } from 'react';
|
|
2
|
-
import { NeetoIcon, Close, Search, AppSwitcher as AppSwitcher$1, ChatEmpty, Book, Gift, Keyboard, User, Settings, LeftArrow, Help, Down, SidebarOpen, SidebarClose } from '@bigbinary/neeto-icons';
|
|
3
2
|
import { Typography, Button, Input, Spinner, Avatar, Tooltip } from '@bigbinary/neetoui';
|
|
4
3
|
import { toLower, mergeDeepLeft, all, curry, is, includes, __, not } from 'ramda';
|
|
5
4
|
import { useTranslation } from 'react-i18next';
|
|
6
5
|
import { Link, useLocation, NavLink } from 'react-router-dom';
|
|
7
6
|
import { useFetchNeetoApps } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
8
|
-
import {
|
|
7
|
+
import { NeetoIcon, Close, Search, AppSwitcher as AppSwitcher$1, ChatEmpty, Book, Gift, Keyboard, User, Settings, LeftArrow, Help, Down } from '@bigbinary/neeto-icons';
|
|
8
|
+
import { capitalize, truncate, findBy, isNotPresent } from '@bigbinary/neeto-commons-frontend/pure';
|
|
9
9
|
import * as AppIcons from '@bigbinary/neeto-icons/app-icons';
|
|
10
10
|
import { t as t$1 } from 'i18next';
|
|
11
11
|
import { resetAuthTokens } from '@bigbinary/neeto-commons-frontend/utils';
|
|
@@ -31717,7 +31717,18 @@ var AppSwitcher = function AppSwitcher(_ref) {
|
|
|
31717
31717
|
})))));
|
|
31718
31718
|
};
|
|
31719
31719
|
|
|
31720
|
-
var
|
|
31720
|
+
var Chevron = function Chevron() {
|
|
31721
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
31722
|
+
height: "16",
|
|
31723
|
+
viewBox: "0 0 16 16",
|
|
31724
|
+
width: "16"
|
|
31725
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
31726
|
+
d: "M7.07031 13.8887C7.2207 14.0391 7.40527 14.1211 7.62402 14.1211C8.06836 14.1211 8.41699 13.7725 8.41699 13.3281C8.41699 13.1094 8.32812 12.9043 8.17773 12.7539L3.37207 8.05762L8.17773 3.375C8.32812 3.21777 8.41699 3.0127 8.41699 2.80078C8.41699 2.35645 8.06836 2.00781 7.62402 2.00781C7.40527 2.00781 7.2207 2.08984 7.07031 2.24023L1.73828 7.44922C1.56055 7.62012 1.46484 7.8252 1.46484 8.06445C1.46484 8.29688 1.55371 8.49512 1.73828 8.67969L7.07031 13.8887ZM13.1748 13.8887C13.3252 14.0391 13.5098 14.1211 13.7354 14.1211C14.1797 14.1211 14.5283 13.7725 14.5283 13.3281C14.5283 13.1094 14.4395 12.9043 14.2891 12.7539L9.4834 8.05762L14.2891 3.375C14.4395 3.21777 14.5283 3.0127 14.5283 2.80078C14.5283 2.35645 14.1797 2.00781 13.7354 2.00781C13.5098 2.00781 13.3252 2.08984 13.1748 2.24023L7.84961 7.44922C7.66504 7.62012 7.57617 7.8252 7.56934 8.06445C7.56934 8.29688 7.66504 8.49512 7.84961 8.67969L13.1748 13.8887Z",
|
|
31727
|
+
fill: "currentColor"
|
|
31728
|
+
}));
|
|
31729
|
+
};
|
|
31730
|
+
|
|
31731
|
+
var css = ":root{--neeto-molecules-sidebar-width:240px;--neeto-molecules-sidebar-z-index:99998}.neeto-molecules-sidebar__wrapper{display:flex;max-width:240px;max-width:var(--neeto-molecules-sidebar-width);position:relative;transition:all .15s;width:240px;width:var(--neeto-molecules-sidebar-width)}.neeto-molecules-sidebar__wrapper--collapsed{max-width:0;width:0}.neeto-molecules-sidebar__wrapper--collapsed .neeto-molecules-sidebar__toggler{transform:scale(-1)}.neeto-molecules-sidebar{background-color:rgb(var(--neeto-ui-gray-100));border-right:1px solid rgb(var(--neeto-ui-gray-100));height:100vh;padding:24px 0;width:100%;z-index:99998;z-index:var(--neeto-molecules-sidebar-z-index)}.neeto-molecules-sidebar__no-shrinkable{max-width:240px;max-width:var(--neeto-molecules-sidebar-width);width:240px;width:var(--neeto-molecules-sidebar-width)}.neeto-molecules-sidebar::-webkit-scrollbar{height:0;width:0}.neeto-molecules-sidebar::-webkit-scrollbar-thumb{background:rgb(var(--neeto-ui-gray-300));border-radius:50px}.neeto-molecules-sidebar::-webkit-scrollbar-track{background:\"transparent\"}.neeto-molecules-sidebar__toggler{left:calc(100% + 4px);position:absolute;top:32px;z-index:99996;z-index:calc(var(--neeto-molecules-sidebar-z-index) - 2)}.neeto-molecules-sidebar__header{margin:12px 0 28px;padding:0 24px}.neeto-molecules-sidebar__logo svg{height:20px;max-width:100%;width:auto}.neeto-molecules-sidebar__links{margin-bottom:40px}.neeto-molecules-sidebar__link{color:rgb(var(--neeto-ui-gray-800));gap:10px;padding:8px 24px;position:relative;text-decoration:none!important;transition:var(--neeto-ui-transition);width:100%}.neeto-molecules-sidebar__link:not(:first-child){margin-top:10px}.neeto-molecules-sidebar__link-icon{flex-shrink:0;transition:var(--neeto-ui-transition)}.neeto-molecules-sidebar__link-icon svg path{vector-effect:non-scaling-stroke}.neeto-molecules-sidebar__link-icon--rotate{transform:scale(-1)}.neeto-molecules-sidebar__link-label,.neeto-molecules-sidebar__link-sub-label{flex-grow:1;text-align:left}.neeto-molecules-sidebar__link:hover{background-color:rgb(var(--neeto-ui-gray-200));color:rgb(var(--neeto-ui-black))}.neeto-molecules-sidebar__link:focus,.neeto-molecules-sidebar__link:focus-visible,.neeto-molecules-sidebar__link[aria-expanded=true]{background-color:rgb(var(--neeto-ui-gray-200));color:rgb(var(--neeto-ui-black));outline:none}.neeto-molecules-sidebar__link.active{background-color:rgb(var(--neeto-ui-white));color:rgb(var(--neeto-ui-black))}.neeto-molecules-sidebar__link.active .neeto-molecules-sidebar__link-label{font-weight:var(--neeto-ui-font-medium)}.neeto-molecules-sidebar__link--button:focus{background-color:transparent}.neeto-molecules-sidebar__link--button:focus-visible{background-color:rgb(var(--neeto-ui-gray-200));color:rgb(var(--neeto-ui-gray-800))}.neeto-molecules-sidebar__link--change-log{outline:none!important}.neeto-molecules-sidebar__sublink-wrapper{background-color:rgb(var(--neeto-ui-white));padding:4px 0}.neeto-molecules-sidebar__sublink{background-color:rgb(var(--neeto-ui-white));color:rgb(var(--neeto-ui-gray-700));cursor:pointer;gap:8px;padding:8px 24px 8px 58px;text-decoration:none;transition:all .3s}.neeto-molecules-sidebar__sublink:not(:last-child){margin-bottom:4px}.neeto-molecules-sidebar__sublink .neeto-molecules-sidebar__link-sub-count{opacity:.75}.neeto-molecules-sidebar__sublink:hover{color:rgb(var(--neeto-ui-gray-800));text-decoration:none}.neeto-molecules-sidebar__sublink:hover .neeto-molecules-sidebar__link-sub-count{opacity:1}.neeto-molecules-sidebar__sublink:focus,.neeto-molecules-sidebar__sublink:focus-visible{color:rgb(var(--neeto-ui-gray-800));outline:none;text-decoration:none}.neeto-molecules-sidebar__sublink:focus .neeto-molecules-sidebar__link-sub-count,.neeto-molecules-sidebar__sublink:focus-visible .neeto-molecules-sidebar__link-sub-count{opacity:1}.neeto-molecules-sidebar__sublink.active,.neeto-molecules-sidebar__sublink:active{color:rgb(var(--neeto-ui-black));font-weight:var(--neeto-ui-font-medium);text-decoration:none}.neeto-molecules-sidebar__sublink.active .neeto-molecules-sidebar__link-sub-count,.neeto-molecules-sidebar__sublink:active .neeto-molecules-sidebar__link-sub-count{opacity:1}.neeto-molecules-sidebar__footer{margin-top:auto}.neeto-molecules-sidebar__footer .neeto-molecules-sidebar__profile-name{flex-grow:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.neeto-molecules-sidebar__footer .neeto-molecules-sidebar__profile:hover{background-color:rgb(var(--neeto-ui-gray-200));color:rgb(var(--neeto-ui-black));text-decoration:none}.neeto-molecules-sidebar__footer .neeto-molecules-sidebar__profile:focus,.neeto-molecules-sidebar__footer .neeto-molecules-sidebar__profile:focus-visible,.neeto-molecules-sidebar__footer .neeto-molecules-sidebar__profile[aria-expanded=true]{background-color:rgb(var(--neeto-ui-gray-200));color:rgb(var(--neeto-ui-black));outline:none;text-decoration:none}.sidebar-featured-tooltip__content{border-radius:8px!important;box-shadow:var(--neeto-ui-shadow-sm)!important}.sidebar-featured-tooltip__content .tippy-content{padding:0}.sidebar-featured-tooltip{padding:12px;width:150px}.sidebar-featured-tooltip__icon-wrap{background-color:rgb(var(--neeto-ui-gray-100));border-radius:8px;height:40px;margin-bottom:8px;margin-left:auto;margin-right:auto;width:40px}.sidebar-featured-tooltip__title{margin-bottom:4px}.neeto-molecules-help-popup-wrapper,.neeto-molecules-profile-popup-wrapper{border:1px solid rgb(var(--neeto-ui-gray-400));border-radius:var(--neeto-ui-rounded)!important;box-shadow:var(--neeto-ui-shadow-xs)!important}.neeto-molecules-help-popup-wrapper .tippy-content,.neeto-molecules-profile-popup-wrapper .tippy-content{padding:0}.neeto-molecules-help-popup-wrapper .tippy-svg-arrow,.neeto-molecules-profile-popup-wrapper .tippy-svg-arrow{display:none!important}.neeto-molecules-profile-sublist{border-top:1px solid rgb(var(--neeto-ui-gray-400))}.neeto-molecules-help-sublist,.neeto-molecules-profile-sublist{list-style:none;margin:0;padding:4px 0}.neeto-molecules-help-sublist__item,.neeto-molecules-profile-sublist__item{width:100%}.neeto-molecules-help-sublist__item-btn,.neeto-molecules-profile-sublist__item-btn{border-radius:0;justify-content:flex-end!important}.neeto-molecules-help-sublist__item-btn.active,.neeto-molecules-profile-sublist__item-btn.active{background-color:rgb(var(--neeto-ui-gray-800));color:rgb(var(--neeto-ui-white))}.neeto-molecules-help-sublist__item-btn-icon svg path,.neeto-molecules-profile-sublist__item-btn-icon svg path{vector-effect:non-scaling-stroke}";
|
|
31721
31732
|
n(css,{});
|
|
31722
31733
|
|
|
31723
31734
|
var AppSwitcherButton = function AppSwitcherButton(_ref) {
|
|
@@ -32134,15 +32145,6 @@ var Header = function Header() {
|
|
|
32134
32145
|
};
|
|
32135
32146
|
var Header$1 = /*#__PURE__*/React.memo(Header);
|
|
32136
32147
|
|
|
32137
|
-
var getMaxLabelLength = function getMaxLabelLength(_ref) {
|
|
32138
|
-
var isSubItem = _ref.isSubItem,
|
|
32139
|
-
hasSubItems = _ref.hasSubItems,
|
|
32140
|
-
hasCount = _ref.hasCount;
|
|
32141
|
-
if (hasCount) return 14;
|
|
32142
|
-
if (isSubItem) return 20;
|
|
32143
|
-
if (hasSubItems) return 16;
|
|
32144
|
-
return 20;
|
|
32145
|
-
};
|
|
32146
32148
|
var isSubRouteActive = function isSubRouteActive(subRoute, location) {
|
|
32147
32149
|
var currentBrowserUrl = new URL(location.pathname + location.search, window.location.origin);
|
|
32148
32150
|
var targetUrl = new URL(subRoute, window.location.origin);
|
|
@@ -32155,30 +32157,6 @@ var isSubRouteActive = function isSubRouteActive(subRoute, location) {
|
|
|
32155
32157
|
return currentBrowserUrl.searchParams.get(key) === targetSearchParams.get(key);
|
|
32156
32158
|
}, targetSearchKeys);
|
|
32157
32159
|
};
|
|
32158
|
-
var optimizeLabel = function optimizeLabel(_ref2) {
|
|
32159
|
-
var _ref2$label = _ref2.label,
|
|
32160
|
-
label = _ref2$label === void 0 ? "" : _ref2$label,
|
|
32161
|
-
_ref2$hasSubItems = _ref2.hasSubItems,
|
|
32162
|
-
hasSubItems = _ref2$hasSubItems === void 0 ? false : _ref2$hasSubItems,
|
|
32163
|
-
_ref2$isSubItem = _ref2.isSubItem,
|
|
32164
|
-
isSubItem = _ref2$isSubItem === void 0 ? false : _ref2$isSubItem,
|
|
32165
|
-
_ref2$hasCount = _ref2.hasCount,
|
|
32166
|
-
hasCount = _ref2$hasCount === void 0 ? false : _ref2$hasCount;
|
|
32167
|
-
var maxLength = getMaxLabelLength({
|
|
32168
|
-
isSubItem: isSubItem,
|
|
32169
|
-
hasSubItems: hasSubItems,
|
|
32170
|
-
hasCount: hasCount
|
|
32171
|
-
});
|
|
32172
|
-
if (label.length <= maxLength) return {
|
|
32173
|
-
label: label,
|
|
32174
|
-
isLabelPristine: true
|
|
32175
|
-
};
|
|
32176
|
-
var optimizedLabel = label.substring(0, maxLength).trim();
|
|
32177
|
-
return {
|
|
32178
|
-
label: "".concat(optimizedLabel, "..."),
|
|
32179
|
-
isLabelPristine: false
|
|
32180
|
-
};
|
|
32181
|
-
};
|
|
32182
32160
|
|
|
32183
32161
|
var _excluded = ["label", "to", "icon", "items"],
|
|
32184
32162
|
_excluded2 = ["label", "to", "count"];
|
|
@@ -32187,6 +32165,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
32187
32165
|
var Links = function Links(_ref) {
|
|
32188
32166
|
var navLinks = _ref.navLinks;
|
|
32189
32167
|
var location = useLocation();
|
|
32168
|
+
var _useState = useState(true),
|
|
32169
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32170
|
+
isActiveLinkExpanded = _useState2[0],
|
|
32171
|
+
setIsActiveLinkExpanded = _useState2[1];
|
|
32190
32172
|
var filterByPermissions = curry(function (_ref2) {
|
|
32191
32173
|
var permissions = _ref2.permissions;
|
|
32192
32174
|
if (permissions) {
|
|
@@ -32194,6 +32176,15 @@ var Links = function Links(_ref) {
|
|
|
32194
32176
|
}
|
|
32195
32177
|
return true;
|
|
32196
32178
|
});
|
|
32179
|
+
var handleNavLinkClick = function handleNavLinkClick(event, isActive, items) {
|
|
32180
|
+
if (isNotPresent(items)) return;
|
|
32181
|
+
if (isActive()) {
|
|
32182
|
+
setIsActiveLinkExpanded(not);
|
|
32183
|
+
event.preventDefault();
|
|
32184
|
+
return;
|
|
32185
|
+
}
|
|
32186
|
+
setIsActiveLinkExpanded(true);
|
|
32187
|
+
};
|
|
32197
32188
|
return /*#__PURE__*/React.createElement("div", {
|
|
32198
32189
|
className: "neeto-molecules-sidebar__links neeto-molecules-sidebar__no-shrinkable"
|
|
32199
32190
|
}, navLinks.filter(filterByPermissions).map(function (_ref3, mainIndex) {
|
|
@@ -32207,67 +32198,52 @@ var Links = function Links(_ref) {
|
|
|
32207
32198
|
var isActive = function isActive() {
|
|
32208
32199
|
return is(Function, otherProps.isActive) ? otherProps.isActive() : location.pathname.startsWith(url.pathname);
|
|
32209
32200
|
};
|
|
32210
|
-
var
|
|
32211
|
-
label: label,
|
|
32212
|
-
hasSubItems: isPresent(items) && isNotEmpty(items)
|
|
32213
|
-
}),
|
|
32214
|
-
optimizedLabel = _optimizeLabel.label,
|
|
32215
|
-
isLabelPristine = _optimizeLabel.isLabelPristine;
|
|
32201
|
+
var isMenuExpanded = isActive() && isActiveLinkExpanded;
|
|
32216
32202
|
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
32217
32203
|
key: mainIndex
|
|
32218
32204
|
}, /*#__PURE__*/React.createElement(NavLink, _extends({
|
|
32219
32205
|
activeClassName: "active",
|
|
32220
|
-
className: "neeto-ui-flex neeto-ui-items-center neeto-ui-no-underline neeto-ui-select-none neeto-molecules-sidebar__link"
|
|
32206
|
+
className: "neeto-ui-flex neeto-ui-items-center neeto-ui-no-underline neeto-ui-select-none neeto-molecules-sidebar__link",
|
|
32207
|
+
onClick: function onClick(event) {
|
|
32208
|
+
return handleNavLinkClick(event, isActive, items);
|
|
32209
|
+
}
|
|
32221
32210
|
}, _objectSpread({
|
|
32222
32211
|
isActive: isActive,
|
|
32223
32212
|
to: to
|
|
32224
32213
|
}, otherProps)), icon && /*#__PURE__*/React.createElement("span", {
|
|
32225
32214
|
className: "neeto-molecules-sidebar__link-icon",
|
|
32226
32215
|
"data-testid": label
|
|
32227
|
-
}, /*#__PURE__*/React.createElement(IconSVG, null)), /*#__PURE__*/React.createElement(
|
|
32228
|
-
content: label,
|
|
32229
|
-
disabled: isLabelPristine
|
|
32230
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
32216
|
+
}, /*#__PURE__*/React.createElement(IconSVG, null)), /*#__PURE__*/React.createElement(Typography, {
|
|
32231
32217
|
className: "neeto-molecules-sidebar__link-label",
|
|
32232
32218
|
component: "span",
|
|
32233
32219
|
style: "body2",
|
|
32234
32220
|
weight: "normal"
|
|
32235
|
-
},
|
|
32221
|
+
}, label), items && /*#__PURE__*/React.createElement("span", {
|
|
32236
32222
|
className: classnames("neeto-molecules-sidebar__link-icon", {
|
|
32237
|
-
"neeto-molecules-sidebar__link-icon--rotate":
|
|
32223
|
+
"neeto-molecules-sidebar__link-icon--rotate": isMenuExpanded
|
|
32238
32224
|
})
|
|
32239
32225
|
}, /*#__PURE__*/React.createElement(Down, {
|
|
32240
32226
|
size: 16
|
|
32241
|
-
}))), items &&
|
|
32227
|
+
}))), items && isMenuExpanded && /*#__PURE__*/React.createElement("div", {
|
|
32242
32228
|
className: "neeto-molecules-sidebar__sublink-wrapper"
|
|
32243
32229
|
}, items.filter(filterByPermissions).map(function (_ref4, subIndex) {
|
|
32244
32230
|
var subLabel = _ref4.label,
|
|
32245
32231
|
subRoute = _ref4.to,
|
|
32246
32232
|
count = _ref4.count,
|
|
32247
32233
|
otherProps = _objectWithoutProperties(_ref4, _excluded2);
|
|
32248
|
-
var _optimizeLabel2 = optimizeLabel({
|
|
32249
|
-
label: subLabel,
|
|
32250
|
-
isSubItem: true,
|
|
32251
|
-
hasCount: isPresent(count)
|
|
32252
|
-
}),
|
|
32253
|
-
optimizedLabel = _optimizeLabel2.label,
|
|
32254
|
-
isSubLabelPristine = _optimizeLabel2.isLabelPristine;
|
|
32255
32234
|
return /*#__PURE__*/React.createElement(NavLink, _extends({
|
|
32256
32235
|
activeClassName: "active",
|
|
32257
32236
|
className: "neeto-molecules-sidebar__sublink neeto-ui-flex neeto-ui-items-center neeto-ui-select-none",
|
|
32258
|
-
key: subIndex,
|
|
32259
|
-
to: subRoute,
|
|
32260
32237
|
isActive: function isActive() {
|
|
32261
32238
|
return isSubRouteActive(subRoute, location);
|
|
32262
|
-
}
|
|
32263
|
-
|
|
32264
|
-
|
|
32265
|
-
|
|
32266
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
32239
|
+
},
|
|
32240
|
+
key: subIndex,
|
|
32241
|
+
to: subRoute
|
|
32242
|
+
}, otherProps), /*#__PURE__*/React.createElement(Typography, {
|
|
32267
32243
|
className: "neeto-molecules-sidebar__link-sub-label neeto-ui-flex-grow",
|
|
32268
32244
|
component: "span",
|
|
32269
32245
|
style: "body2"
|
|
32270
|
-
},
|
|
32246
|
+
}, subLabel), /*#__PURE__*/React.createElement(Typography, {
|
|
32271
32247
|
className: "neeto-molecules-sidebar__link-sub-count neeto-ui-flex-shrink-0",
|
|
32272
32248
|
component: "span",
|
|
32273
32249
|
style: "body2"
|
|
@@ -32321,7 +32297,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
32321
32297
|
}
|
|
32322
32298
|
})), /*#__PURE__*/React.createElement(Button, {
|
|
32323
32299
|
className: "neeto-molecules-sidebar__toggler",
|
|
32324
|
-
icon:
|
|
32300
|
+
icon: Chevron,
|
|
32325
32301
|
style: "text",
|
|
32326
32302
|
tooltipProps: {
|
|
32327
32303
|
content: isSidebarCollapsed ? t("neetoMolecules.sidebar.showMenu") : t("neetoMolecules.sidebar.hideMenu"),
|