@trops/dash-core 0.1.277 → 0.1.278

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/index.js CHANGED
@@ -47986,27 +47986,33 @@ var DashTabBar = function DashTabBar(_ref) {
47986
47986
  });
47987
47987
  };
47988
47988
 
47989
- var DashSidebar = function DashSidebar(_ref) {
47990
- var collapsed = _ref.collapsed,
47991
- onCollapsedChange = _ref.onCollapsedChange,
47992
- _ref$workspaces = _ref.workspaces,
47993
- workspaces = _ref$workspaces === void 0 ? [] : _ref$workspaces,
47994
- _ref$menuItems = _ref.menuItems,
47995
- menuItems = _ref$menuItems === void 0 ? [] : _ref$menuItems,
47996
- _ref$activeTabId = _ref.activeTabId,
47997
- activeTabId = _ref$activeTabId === void 0 ? null : _ref$activeTabId,
47998
- _ref$recentDashboards = _ref.recentDashboards,
47999
- recentDashboards = _ref$recentDashboards === void 0 ? [] : _ref$recentDashboards,
48000
- _ref$authStatus = _ref.authStatus,
48001
- authStatus = _ref$authStatus === void 0 ? "loading" : _ref$authStatus,
48002
- _ref$authProfile = _ref.authProfile,
48003
- authProfile = _ref$authProfile === void 0 ? null : _ref$authProfile,
48004
- onOpenWorkspace = _ref.onOpenWorkspace,
48005
- onNewDashboard = _ref.onNewDashboard,
48006
- onOpenSettings = _ref.onOpenSettings,
48007
- onOpenCommandPalette = _ref.onOpenCommandPalette,
48008
- onSignIn = _ref.onSignIn,
48009
- onSignOut = _ref.onSignOut;
47989
+ var CollapsibleContent = function CollapsibleContent(_ref) {
47990
+ var children = _ref.children;
47991
+ var _useSidebar = DashReact.useSidebar(),
47992
+ collapsed = _useSidebar.collapsed;
47993
+ return collapsed ? null : children;
47994
+ };
47995
+ var DashSidebar = function DashSidebar(_ref2) {
47996
+ var collapsed = _ref2.collapsed,
47997
+ onCollapsedChange = _ref2.onCollapsedChange,
47998
+ _ref2$workspaces = _ref2.workspaces,
47999
+ workspaces = _ref2$workspaces === void 0 ? [] : _ref2$workspaces,
48000
+ _ref2$menuItems = _ref2.menuItems,
48001
+ menuItems = _ref2$menuItems === void 0 ? [] : _ref2$menuItems,
48002
+ _ref2$activeTabId = _ref2.activeTabId,
48003
+ activeTabId = _ref2$activeTabId === void 0 ? null : _ref2$activeTabId,
48004
+ _ref2$recentDashboard = _ref2.recentDashboards,
48005
+ recentDashboards = _ref2$recentDashboard === void 0 ? [] : _ref2$recentDashboard,
48006
+ _ref2$authStatus = _ref2.authStatus,
48007
+ authStatus = _ref2$authStatus === void 0 ? "loading" : _ref2$authStatus,
48008
+ _ref2$authProfile = _ref2.authProfile,
48009
+ authProfile = _ref2$authProfile === void 0 ? null : _ref2$authProfile,
48010
+ onOpenWorkspace = _ref2.onOpenWorkspace,
48011
+ onNewDashboard = _ref2.onNewDashboard,
48012
+ onOpenSettings = _ref2.onOpenSettings,
48013
+ onOpenCommandPalette = _ref2.onOpenCommandPalette,
48014
+ onSignIn = _ref2.onSignIn,
48015
+ onSignOut = _ref2.onSignOut;
48010
48016
  var _useContext = React.useContext(DashReact.ThemeContext),
48011
48017
  themeVariant = _useContext.themeVariant,
48012
48018
  changeThemeVariant = _useContext.changeThemeVariant;
@@ -48036,9 +48042,11 @@ var DashSidebar = function DashSidebar(_ref) {
48036
48042
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Sidebar.Header, {
48037
48043
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
48038
48044
  className: "flex items-center justify-between",
48039
- children: [!collapsed && /*#__PURE__*/jsxRuntime.jsx("span", {
48040
- className: "font-bold text-lg tracking-tight opacity-80",
48041
- children: "Dash."
48045
+ children: [/*#__PURE__*/jsxRuntime.jsx(CollapsibleContent, {
48046
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
48047
+ className: "font-bold text-lg tracking-tight opacity-80",
48048
+ children: "Dash."
48049
+ })
48042
48050
  }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Sidebar.Trigger, {})]
48043
48051
  })
48044
48052
  }), /*#__PURE__*/jsxRuntime.jsxs(DashReact.Sidebar.Content, {
@@ -48049,25 +48057,27 @@ var DashSidebar = function DashSidebar(_ref) {
48049
48057
  }),
48050
48058
  onClick: onOpenCommandPalette,
48051
48059
  children: "Search"
48052
- }), !collapsed && visibleRecents.length > 0 && /*#__PURE__*/jsxRuntime.jsx(DashReact.Sidebar.Group, {
48053
- label: "Recents",
48054
- children: visibleRecents.map(function (recent) {
48055
- var ws = workspaces.find(function (w) {
48056
- return w.id === recent.workspaceId;
48057
- });
48058
- return /*#__PURE__*/jsxRuntime.jsx(DashReact.Sidebar.Item, {
48059
- icon: /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
48060
- icon: "clock-rotate-left",
48061
- className: "h-3.5 w-3.5"
48062
- }),
48063
- active: recent.workspaceId === activeTabId,
48064
- onClick: function onClick() {
48065
- return ws && onOpenWorkspace(ws);
48066
- },
48067
- children: (recent.name || "Untitled").replace(/^./, function (c) {
48068
- return c.toUpperCase();
48069
- })
48070
- }, recent.workspaceId);
48060
+ }), /*#__PURE__*/jsxRuntime.jsx(CollapsibleContent, {
48061
+ children: visibleRecents.length > 0 && /*#__PURE__*/jsxRuntime.jsx(DashReact.Sidebar.Group, {
48062
+ label: "Recents",
48063
+ children: visibleRecents.map(function (recent) {
48064
+ var ws = workspaces.find(function (w) {
48065
+ return w.id === recent.workspaceId;
48066
+ });
48067
+ return /*#__PURE__*/jsxRuntime.jsx(DashReact.Sidebar.Item, {
48068
+ icon: /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
48069
+ icon: "clock-rotate-left",
48070
+ className: "h-3.5 w-3.5"
48071
+ }),
48072
+ active: recent.workspaceId === activeTabId,
48073
+ onClick: function onClick() {
48074
+ return ws && onOpenWorkspace(ws);
48075
+ },
48076
+ children: (recent.name || "Untitled").replace(/^./, function (c) {
48077
+ return c.toUpperCase();
48078
+ })
48079
+ }, recent.workspaceId);
48080
+ })
48071
48081
  })
48072
48082
  }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Sidebar.Group, {
48073
48083
  label: "Dashboards",
@@ -48079,7 +48089,7 @@ var DashSidebar = function DashSidebar(_ref) {
48079
48089
  onClick: onNewDashboard,
48080
48090
  children: "New Dashboard"
48081
48091
  })
48082
- }), !collapsed && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
48092
+ }), /*#__PURE__*/jsxRuntime.jsxs(CollapsibleContent, {
48083
48093
  children: [menuItems.map(function (menuItem) {
48084
48094
  var folderWorkspaces = workspacesForFolder(menuItem.id);
48085
48095
  var folderIcon = menuItem.icon || menuItem.folder || "folder";
@@ -48135,15 +48145,15 @@ var DashSidebar = function DashSidebar(_ref) {
48135
48145
  })]
48136
48146
  });
48137
48147
  };
48138
- var FooterPopover = function FooterPopover(_ref2) {
48139
- var collapsed = _ref2.collapsed,
48140
- themeVariant = _ref2.themeVariant,
48141
- changeThemeVariant = _ref2.changeThemeVariant,
48142
- authStatus = _ref2.authStatus,
48143
- authProfile = _ref2.authProfile,
48144
- onOpenSettings = _ref2.onOpenSettings,
48145
- onSignIn = _ref2.onSignIn,
48146
- onSignOut = _ref2.onSignOut;
48148
+ var FooterPopover = function FooterPopover(_ref3) {
48149
+ var collapsed = _ref3.collapsed,
48150
+ themeVariant = _ref3.themeVariant,
48151
+ changeThemeVariant = _ref3.changeThemeVariant,
48152
+ authStatus = _ref3.authStatus,
48153
+ authProfile = _ref3.authProfile,
48154
+ onOpenSettings = _ref3.onOpenSettings,
48155
+ onSignIn = _ref3.onSignIn,
48156
+ onSignOut = _ref3.onSignOut;
48147
48157
  var buttonRef = React.useRef(null);
48148
48158
  var _useState = React.useState(false),
48149
48159
  _useState2 = _slicedToArray(_useState, 2),
@@ -48187,10 +48197,10 @@ var FooterPopover = function FooterPopover(_ref2) {
48187
48197
  }
48188
48198
  return /*#__PURE__*/jsxRuntime.jsx(react.Popover, {
48189
48199
  className: "relative",
48190
- children: function children(_ref3) {
48200
+ children: function children(_ref4) {
48191
48201
  var _rect$left;
48192
- var open = _ref3.open,
48193
- close = _ref3.close;
48202
+ var open = _ref4.open,
48203
+ close = _ref4.close;
48194
48204
  var rect = open && buttonRef.current ? buttonRef.current.getBoundingClientRect() : null;
48195
48205
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
48196
48206
  children: [/*#__PURE__*/jsxRuntime.jsxs(react.Popover.Button, {
@@ -48271,12 +48281,12 @@ var FooterPopover = function FooterPopover(_ref2) {
48271
48281
  }
48272
48282
  });
48273
48283
  };
48274
- var PopoverItem = function PopoverItem(_ref4) {
48275
- var icon = _ref4.icon,
48276
- label = _ref4.label,
48277
- onClick = _ref4.onClick,
48278
- _ref4$active = _ref4.active,
48279
- active = _ref4$active === void 0 ? false : _ref4$active;
48284
+ var PopoverItem = function PopoverItem(_ref5) {
48285
+ var icon = _ref5.icon,
48286
+ label = _ref5.label,
48287
+ onClick = _ref5.onClick,
48288
+ _ref5$active = _ref5.active,
48289
+ active = _ref5$active === void 0 ? false : _ref5$active;
48280
48290
  return /*#__PURE__*/jsxRuntime.jsxs("button", {
48281
48291
  type: "button",
48282
48292
  onClick: onClick,