@bigbinary/neeto-folders-frontend 2.0.24 → 2.0.25

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/README.md CHANGED
@@ -266,6 +266,30 @@ import * as components from "@bigbinary/neeto-folders-frontend/components";
266
266
  />;
267
267
  ```
268
268
 
269
+ 5. `AddEditPane`: This component can be used in host applications to add or edit folders.
270
+
271
+ ##### Props:
272
+
273
+ - `config`: A config object to customize the folders behavior.
274
+
275
+ - `onClose()`: Callback invoked when the pane is closed.
276
+
277
+ - `folderSid`: It is optional. The SID of the parent folder where new folder should be created. If not provided, uses the active folder from URL.
278
+
279
+ - `setFocusField`: Ref callback to set focus on the name input field when pane opens.
280
+
281
+ Sample usage:
282
+
283
+ ```jsx
284
+ import { AddEditPane } from "@bigbinary/neeto-folders-frontend/components";
285
+ // ....
286
+ <AddEditPane
287
+ {...{ setFocusField, onClose }}
288
+ config={foldersConfig}
289
+ folderSid={selectedFolderSid}
290
+ />;
291
+ ```
292
+
269
293
  #### Hooks
270
294
 
271
295
  ```js
@@ -206,7 +206,8 @@ var AddEditPane = function AddEditPane(_ref) {
206
206
  var _config$addEditValida;
207
207
  var setFocusField = _ref.setFocusField,
208
208
  config = _ref.config,
209
- onClose = _ref.onClose;
209
+ onClose = _ref.onClose,
210
+ folderSid = _ref.folderSid;
210
211
  var _useTranslation = useTranslation(config),
211
212
  t = _useTranslation.t;
212
213
  var _useFolderStore = useFolderActions.useFolderStore(function (store) {
@@ -225,7 +226,7 @@ var AddEditPane = function AddEditPane(_ref) {
225
226
  var _useUpdateFolder = useFolderActions.useUpdateFolder(config),
226
227
  updateFolder = _useUpdateFolder.mutateAsync;
227
228
  var isEditing = type === "edit" && item;
228
- var activeFolderSid = internal.getActiveFolderId(config);
229
+ var activeFolderSid = folderSid || internal.getActiveFolderId(config);
229
230
  var extraAttributes = config.extraAttributes;
230
231
  var filteredExtraAttributes = React.useMemo(function () {
231
232
  return filterExtraAttributes(extraAttributes, isEditing);
@@ -333,6 +334,7 @@ var AddEditPane = function AddEditPane(_ref) {
333
334
  config: config,
334
335
  allowClear: true,
335
336
  showSearch: true,
337
+ initialValue: folderSid,
336
338
  label: t("createFolder.parentTitle"),
337
339
  name: "parentId"
338
340
  }), /*#__PURE__*/jsxRuntime.jsx(Typography, {
@@ -1433,7 +1435,7 @@ var Node = function Node(_ref) {
1433
1435
  })
1434
1436
  })]
1435
1437
  }), hasAnyActions && /*#__PURE__*/jsxRuntime.jsxs("div", {
1436
- className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",
1438
+ className: "flex items-center gap-1",
1437
1439
  onClick: function onClick(e) {
1438
1440
  e.preventDefault();
1439
1441
  e.stopPropagation();
@@ -1448,13 +1450,15 @@ var Node = function Node(_ref) {
1448
1450
  tooltipProps: {
1449
1451
  content: "Add",
1450
1452
  position: "top"
1451
- }
1453
+ },
1454
+ className: "opacity-0 group-hover:opacity-100 transition-opacity"
1452
1455
  }
1453
1456
  }), hasMoreActions && /*#__PURE__*/jsxRuntime.jsx(MoreDropdown, {
1457
+ menuItems: moreActions,
1454
1458
  dropdownButtonProps: {
1455
- size: "small"
1456
- },
1457
- menuItems: moreActions
1459
+ size: "small",
1460
+ className: "opacity-0 group-hover:opacity-100 transition-opacity"
1461
+ }
1458
1462
  })]
1459
1463
  })]
1460
1464
  })
@@ -1608,7 +1612,7 @@ var createFolderOptions = function createFolderOptions(foldersMap, config) {
1608
1612
  });
1609
1613
  };
1610
1614
 
1611
- var _excluded = ["label", "name", "placeholder", "disabled", "loading", "required", "showSearch", "size", "fieldNames", "config"];
1615
+ var _excluded = ["label", "name", "placeholder", "disabled", "loading", "required", "showSearch", "size", "fieldNames", "config", "initialValue"];
1612
1616
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1613
1617
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1614
1618
  var TreeSelect = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
@@ -1630,6 +1634,7 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
1630
1634
  size = _ref$size === void 0 ? "middle" : _ref$size,
1631
1635
  fieldNames = _ref.fieldNames,
1632
1636
  config = _ref.config,
1637
+ initialValue = _ref.initialValue,
1633
1638
  otherProps = _objectWithoutProperties(_ref, _excluded);
1634
1639
  var _useFetchFolders = useFolderActions.useFetchFolders(config),
1635
1640
  folders = _useFetchFolders.data;
@@ -1639,7 +1644,7 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
1639
1644
  var foldersMap = React.useMemo(function () {
1640
1645
  return folders ? utils.treeToMap(folders, "sid") : null;
1641
1646
  }, [folders]);
1642
- var activeFolderSid = internal.getActiveFolderId(config);
1647
+ var activeFolderSid = initialValue || internal.getActiveFolderId(config);
1643
1648
  var activeFolder = foldersMap[activeFolderSid];
1644
1649
  var isValidParent = (activeFolder === null || activeFolder === void 0 ? void 0 : activeFolder.meta.depth) < config.maxDepth;
1645
1650
  var parentId = isValidParent ? activeFolder.id : null;
@@ -1675,6 +1680,7 @@ var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r
1675
1680
  var css = ".neeto-sidebar-folders-tree__folder-node{color:inherit!important}.neeto-sidebar-folders-tree.ant-tree .ant-tree-node-content-wrapper{min-width:0;padding-inline:6px!important}.neeto-sidebar-folders-tree.ant-tree .ant-tree-node-content-wrapper.ant-tree-node-selected{background-color:rgb(var(--neeto-ui-white));color:rgb(var(--neeto-ui-accent-800))!important;font-weight:500}.neeto-sidebar-folders-tree.ant-tree .ant-tree-switcher .ant-tree-switcher-icon{position:relative}.neeto-folders-grid-view-wrapper{grid-template-columns:repeat(auto-fill,minmax(256px,1fr))}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3NyYy9jb21wb25lbnRzL25lZXRvLWZvbGRlcnMtbmFuby5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLHlDQUNFLHVCQUNGLENBRUEsb0VBRUUsV0FBQSxDQURBLDRCQUVGLENBRUEsMkZBR0UsMkNBQUEsQ0FEQSwrQ0FBQSxDQUVBLGVBQUYsQ0FHQSxnRkFHRSxpQkFGRixDQUtBLGlDQUNFLHlEQUZGIiwic291cmNlc0NvbnRlbnQiOlsiLm5lZXRvLXNpZGViYXItZm9sZGVycy10cmVlX19mb2xkZXItbm9kZSB7XG4gIGNvbG9yOiBpbmhlcml0ICFpbXBvcnRhbnQ7XG59XG5cbi5uZWV0by1zaWRlYmFyLWZvbGRlcnMtdHJlZS5hbnQtdHJlZSAuYW50LXRyZWUtbm9kZS1jb250ZW50LXdyYXBwZXIge1xuICBwYWRkaW5nLWlubGluZTogNnB4ICFpbXBvcnRhbnQ7XG4gIG1pbi13aWR0aDogMDtcbn1cblxuLm5lZXRvLXNpZGViYXItZm9sZGVycy10cmVlLmFudC10cmVlXG4gIC5hbnQtdHJlZS1ub2RlLWNvbnRlbnQtd3JhcHBlci5hbnQtdHJlZS1ub2RlLXNlbGVjdGVkIHtcbiAgY29sb3I6IHJnYih2YXIoLS1uZWV0by11aS1hY2NlbnQtODAwKSkgIWltcG9ydGFudDtcbiAgYmFja2dyb3VuZC1jb2xvcjogcmdiKHZhcigtLW5lZXRvLXVpLXdoaXRlKSk7XG4gIGZvbnQtd2VpZ2h0OiA1MDA7XG59XG5cbi5uZWV0by1zaWRlYmFyLWZvbGRlcnMtdHJlZS5hbnQtdHJlZVxuICAuYW50LXRyZWUtc3dpdGNoZXJcbiAgLmFudC10cmVlLXN3aXRjaGVyLWljb24ge1xuICBwb3NpdGlvbjogcmVsYXRpdmU7XG59XG5cbi5uZWV0by1mb2xkZXJzLWdyaWQtdmlldy13cmFwcGVyIHtcbiAgZ3JpZC10ZW1wbGF0ZS1jb2x1bW5zOiByZXBlYXQoYXV0by1maWxsLCBtaW5tYXgoMjU2cHgsIDFmcikpO1xufVxuIl19 */";
1676
1681
  n(css,{});
1677
1682
 
1683
+ exports.AddEditPane = AddEditPane;
1678
1684
  exports.FoldersContext = FoldersContext;
1679
1685
  exports.FoldersList = FoldersList;
1680
1686
  exports.FoldersTree = FoldersTree;