@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.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import * as DashReact from '@trops/dash-react';
3
- import { isObject, ThemeContext, deepCopy, MainSection, getUUID, getStylesForItem, themeObjects, Heading, SearchInput, ButtonIcon, SubHeading3, InputText, Button, FontAwesomeIcon, Tag, Modal, Sidebar, Paragraph, Panel, Stepper, Tag2, Tag3, Card2, Card3, Heading3, MenuItem3, FormLabel, SelectMenu, Switch, SelectInput, CodeEditorInline, SettingsModal, SubHeading2, tailwindHeightFractions, Menu3, Panel3, DropdownPanel, MenuItem2, ButtonIcon2, DragComponent, ConfirmationModal, DropComponent, getStyleName, capitalizeFirstLetter, colorTypes, getCSSStyleForClassname, Panel2, Heading2, SubHeading, Paragraph2, Paragraph3, Button2, Button3, MenuItem, ButtonIcon3, DashPanel, colorNames, shades, themeVariants, Tabs3, DataList, Checkbox, StatCard, Card, Tabs, Accordion, Alert, Toast, ProgressBar, Toggle, Breadcrumbs, Tabs2, Accordion2, Alert2, Toast2, ProgressBar2, Toggle2, Breadcrumbs2, Accordion3, Alert3, Toast3, ProgressBar3, Toggle3, Breadcrumbs3, ThemeFromUrlPane, TextArea, Icon2, AlgoliaSearchBox, CommandPalette, EmptyState, Navbar, withRouter, Menu as Menu$1 } from '@trops/dash-react';
3
+ import { isObject, ThemeContext, deepCopy, MainSection, getUUID, getStylesForItem, themeObjects, Heading, SearchInput, ButtonIcon, SubHeading3, InputText, Button, FontAwesomeIcon, Tag, Modal, Sidebar, Paragraph, Panel, Stepper, Tag2, Tag3, Card2, Card3, Heading3, MenuItem3, FormLabel, SelectMenu, Switch, SelectInput, CodeEditorInline, SettingsModal, SubHeading2, tailwindHeightFractions, Menu3, Panel3, DropdownPanel, MenuItem2, ButtonIcon2, DragComponent, ConfirmationModal, DropComponent, getStyleName, capitalizeFirstLetter, colorTypes, getCSSStyleForClassname, Panel2, Heading2, SubHeading, Paragraph2, Paragraph3, Button2, Button3, MenuItem, ButtonIcon3, DashPanel, colorNames, shades, themeVariants, Tabs3, DataList, Checkbox, StatCard, Card, Tabs, Accordion, Alert, Toast, ProgressBar, Toggle, Breadcrumbs, Tabs2, Accordion2, Alert2, Toast2, ProgressBar2, Toggle2, Breadcrumbs2, Accordion3, Alert3, Toast3, ProgressBar3, Toggle3, Breadcrumbs3, ThemeFromUrlPane, TextArea, Icon2, AlgoliaSearchBox, CommandPalette, useSidebar, EmptyState, Navbar, withRouter, Menu as Menu$1 } from '@trops/dash-react';
4
4
  export * from '@trops/dash-react';
5
5
  export { ThemeContext } from '@trops/dash-react';
6
6
  import _typeof from '@babel/runtime/helpers/typeof';
@@ -47968,27 +47968,33 @@ var DashTabBar = function DashTabBar(_ref) {
47968
47968
  });
47969
47969
  };
47970
47970
 
47971
- var DashSidebar = function DashSidebar(_ref) {
47972
- var collapsed = _ref.collapsed,
47973
- onCollapsedChange = _ref.onCollapsedChange,
47974
- _ref$workspaces = _ref.workspaces,
47975
- workspaces = _ref$workspaces === void 0 ? [] : _ref$workspaces,
47976
- _ref$menuItems = _ref.menuItems,
47977
- menuItems = _ref$menuItems === void 0 ? [] : _ref$menuItems,
47978
- _ref$activeTabId = _ref.activeTabId,
47979
- activeTabId = _ref$activeTabId === void 0 ? null : _ref$activeTabId,
47980
- _ref$recentDashboards = _ref.recentDashboards,
47981
- recentDashboards = _ref$recentDashboards === void 0 ? [] : _ref$recentDashboards,
47982
- _ref$authStatus = _ref.authStatus,
47983
- authStatus = _ref$authStatus === void 0 ? "loading" : _ref$authStatus,
47984
- _ref$authProfile = _ref.authProfile,
47985
- authProfile = _ref$authProfile === void 0 ? null : _ref$authProfile,
47986
- onOpenWorkspace = _ref.onOpenWorkspace,
47987
- onNewDashboard = _ref.onNewDashboard,
47988
- onOpenSettings = _ref.onOpenSettings,
47989
- onOpenCommandPalette = _ref.onOpenCommandPalette,
47990
- onSignIn = _ref.onSignIn,
47991
- onSignOut = _ref.onSignOut;
47971
+ var CollapsibleContent = function CollapsibleContent(_ref) {
47972
+ var children = _ref.children;
47973
+ var _useSidebar = useSidebar(),
47974
+ collapsed = _useSidebar.collapsed;
47975
+ return collapsed ? null : children;
47976
+ };
47977
+ var DashSidebar = function DashSidebar(_ref2) {
47978
+ var collapsed = _ref2.collapsed,
47979
+ onCollapsedChange = _ref2.onCollapsedChange,
47980
+ _ref2$workspaces = _ref2.workspaces,
47981
+ workspaces = _ref2$workspaces === void 0 ? [] : _ref2$workspaces,
47982
+ _ref2$menuItems = _ref2.menuItems,
47983
+ menuItems = _ref2$menuItems === void 0 ? [] : _ref2$menuItems,
47984
+ _ref2$activeTabId = _ref2.activeTabId,
47985
+ activeTabId = _ref2$activeTabId === void 0 ? null : _ref2$activeTabId,
47986
+ _ref2$recentDashboard = _ref2.recentDashboards,
47987
+ recentDashboards = _ref2$recentDashboard === void 0 ? [] : _ref2$recentDashboard,
47988
+ _ref2$authStatus = _ref2.authStatus,
47989
+ authStatus = _ref2$authStatus === void 0 ? "loading" : _ref2$authStatus,
47990
+ _ref2$authProfile = _ref2.authProfile,
47991
+ authProfile = _ref2$authProfile === void 0 ? null : _ref2$authProfile,
47992
+ onOpenWorkspace = _ref2.onOpenWorkspace,
47993
+ onNewDashboard = _ref2.onNewDashboard,
47994
+ onOpenSettings = _ref2.onOpenSettings,
47995
+ onOpenCommandPalette = _ref2.onOpenCommandPalette,
47996
+ onSignIn = _ref2.onSignIn,
47997
+ onSignOut = _ref2.onSignOut;
47992
47998
  var _useContext = useContext(ThemeContext),
47993
47999
  themeVariant = _useContext.themeVariant,
47994
48000
  changeThemeVariant = _useContext.changeThemeVariant;
@@ -48018,9 +48024,11 @@ var DashSidebar = function DashSidebar(_ref) {
48018
48024
  children: [/*#__PURE__*/jsx(Sidebar.Header, {
48019
48025
  children: /*#__PURE__*/jsxs("div", {
48020
48026
  className: "flex items-center justify-between",
48021
- children: [!collapsed && /*#__PURE__*/jsx("span", {
48022
- className: "font-bold text-lg tracking-tight opacity-80",
48023
- children: "Dash."
48027
+ children: [/*#__PURE__*/jsx(CollapsibleContent, {
48028
+ children: /*#__PURE__*/jsx("span", {
48029
+ className: "font-bold text-lg tracking-tight opacity-80",
48030
+ children: "Dash."
48031
+ })
48024
48032
  }), /*#__PURE__*/jsx(Sidebar.Trigger, {})]
48025
48033
  })
48026
48034
  }), /*#__PURE__*/jsxs(Sidebar.Content, {
@@ -48031,25 +48039,27 @@ var DashSidebar = function DashSidebar(_ref) {
48031
48039
  }),
48032
48040
  onClick: onOpenCommandPalette,
48033
48041
  children: "Search"
48034
- }), !collapsed && visibleRecents.length > 0 && /*#__PURE__*/jsx(Sidebar.Group, {
48035
- label: "Recents",
48036
- children: visibleRecents.map(function (recent) {
48037
- var ws = workspaces.find(function (w) {
48038
- return w.id === recent.workspaceId;
48039
- });
48040
- return /*#__PURE__*/jsx(Sidebar.Item, {
48041
- icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
48042
- icon: "clock-rotate-left",
48043
- className: "h-3.5 w-3.5"
48044
- }),
48045
- active: recent.workspaceId === activeTabId,
48046
- onClick: function onClick() {
48047
- return ws && onOpenWorkspace(ws);
48048
- },
48049
- children: (recent.name || "Untitled").replace(/^./, function (c) {
48050
- return c.toUpperCase();
48051
- })
48052
- }, recent.workspaceId);
48042
+ }), /*#__PURE__*/jsx(CollapsibleContent, {
48043
+ children: visibleRecents.length > 0 && /*#__PURE__*/jsx(Sidebar.Group, {
48044
+ label: "Recents",
48045
+ children: visibleRecents.map(function (recent) {
48046
+ var ws = workspaces.find(function (w) {
48047
+ return w.id === recent.workspaceId;
48048
+ });
48049
+ return /*#__PURE__*/jsx(Sidebar.Item, {
48050
+ icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
48051
+ icon: "clock-rotate-left",
48052
+ className: "h-3.5 w-3.5"
48053
+ }),
48054
+ active: recent.workspaceId === activeTabId,
48055
+ onClick: function onClick() {
48056
+ return ws && onOpenWorkspace(ws);
48057
+ },
48058
+ children: (recent.name || "Untitled").replace(/^./, function (c) {
48059
+ return c.toUpperCase();
48060
+ })
48061
+ }, recent.workspaceId);
48062
+ })
48053
48063
  })
48054
48064
  }), /*#__PURE__*/jsx(Sidebar.Group, {
48055
48065
  label: "Dashboards",
@@ -48061,7 +48071,7 @@ var DashSidebar = function DashSidebar(_ref) {
48061
48071
  onClick: onNewDashboard,
48062
48072
  children: "New Dashboard"
48063
48073
  })
48064
- }), !collapsed && /*#__PURE__*/jsxs(Fragment, {
48074
+ }), /*#__PURE__*/jsxs(CollapsibleContent, {
48065
48075
  children: [menuItems.map(function (menuItem) {
48066
48076
  var folderWorkspaces = workspacesForFolder(menuItem.id);
48067
48077
  var folderIcon = menuItem.icon || menuItem.folder || "folder";
@@ -48117,15 +48127,15 @@ var DashSidebar = function DashSidebar(_ref) {
48117
48127
  })]
48118
48128
  });
48119
48129
  };
48120
- var FooterPopover = function FooterPopover(_ref2) {
48121
- var collapsed = _ref2.collapsed,
48122
- themeVariant = _ref2.themeVariant,
48123
- changeThemeVariant = _ref2.changeThemeVariant,
48124
- authStatus = _ref2.authStatus,
48125
- authProfile = _ref2.authProfile,
48126
- onOpenSettings = _ref2.onOpenSettings,
48127
- onSignIn = _ref2.onSignIn,
48128
- onSignOut = _ref2.onSignOut;
48130
+ var FooterPopover = function FooterPopover(_ref3) {
48131
+ var collapsed = _ref3.collapsed,
48132
+ themeVariant = _ref3.themeVariant,
48133
+ changeThemeVariant = _ref3.changeThemeVariant,
48134
+ authStatus = _ref3.authStatus,
48135
+ authProfile = _ref3.authProfile,
48136
+ onOpenSettings = _ref3.onOpenSettings,
48137
+ onSignIn = _ref3.onSignIn,
48138
+ onSignOut = _ref3.onSignOut;
48129
48139
  var buttonRef = useRef(null);
48130
48140
  var _useState = useState(false),
48131
48141
  _useState2 = _slicedToArray(_useState, 2),
@@ -48169,10 +48179,10 @@ var FooterPopover = function FooterPopover(_ref2) {
48169
48179
  }
48170
48180
  return /*#__PURE__*/jsx(Popover, {
48171
48181
  className: "relative",
48172
- children: function children(_ref3) {
48182
+ children: function children(_ref4) {
48173
48183
  var _rect$left;
48174
- var open = _ref3.open,
48175
- close = _ref3.close;
48184
+ var open = _ref4.open,
48185
+ close = _ref4.close;
48176
48186
  var rect = open && buttonRef.current ? buttonRef.current.getBoundingClientRect() : null;
48177
48187
  return /*#__PURE__*/jsxs(Fragment, {
48178
48188
  children: [/*#__PURE__*/jsxs(Popover.Button, {
@@ -48253,12 +48263,12 @@ var FooterPopover = function FooterPopover(_ref2) {
48253
48263
  }
48254
48264
  });
48255
48265
  };
48256
- var PopoverItem = function PopoverItem(_ref4) {
48257
- var icon = _ref4.icon,
48258
- label = _ref4.label,
48259
- onClick = _ref4.onClick,
48260
- _ref4$active = _ref4.active,
48261
- active = _ref4$active === void 0 ? false : _ref4$active;
48266
+ var PopoverItem = function PopoverItem(_ref5) {
48267
+ var icon = _ref5.icon,
48268
+ label = _ref5.label,
48269
+ onClick = _ref5.onClick,
48270
+ _ref5$active = _ref5.active,
48271
+ active = _ref5$active === void 0 ? false : _ref5$active;
48262
48272
  return /*#__PURE__*/jsxs("button", {
48263
48273
  type: "button",
48264
48274
  onClick: onClick,