@trops/dash-core 0.1.277 → 0.1.279

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';
@@ -29428,15 +29428,10 @@ var ComponentManager = {
29428
29428
  var tempComponentMap = this.componentMap();
29429
29429
  // Handle both module exports (widgetConfig.default) and direct config objects
29430
29430
  var config = widgetConfig["default"] || widgetConfig;
29431
- // Use scoped id if available (e.g., "trops.clock.AnalogClockWidget"),
29432
- // otherwise fall back to the provided widgetKey for backward compatibility
29431
+ // Register under a single canonical key: config.id (scoped widget ID) if
29432
+ // available, otherwise the provided widgetKey. No aliases — one widget, one key.
29433
29433
  var registrationKey = config.id || widgetKey;
29434
29434
  tempComponentMap[registrationKey] = ComponentConfigModel(config);
29435
- // Also register under plain component name for backward compat
29436
- // (dashboards may reference "SlackWidget" instead of "trops.slack.SlackWidget")
29437
- if (config.id && config.id !== widgetKey && !tempComponentMap[widgetKey]) {
29438
- tempComponentMap[widgetKey] = tempComponentMap[registrationKey];
29439
- }
29440
29435
  this.setComponentMap(tempComponentMap);
29441
29436
  },
29442
29437
  /**
@@ -33771,8 +33766,10 @@ function extractWidgetConfigs(bundleExports) {
33771
33766
 
33772
33767
  // Must have a component function and a recognized type
33773
33768
  if (typeof entry.component === "function" && (entry.type === "widget" || entry.type === "workspace")) {
33769
+ // Use the canonical widget ID from config if available,
33770
+ // otherwise fall back to the CJS export key
33774
33771
  configs.push({
33775
- key: key,
33772
+ key: entry.id || key,
33776
33773
  config: entry
33777
33774
  });
33778
33775
  }
@@ -47968,27 +47965,33 @@ var DashTabBar = function DashTabBar(_ref) {
47968
47965
  });
47969
47966
  };
47970
47967
 
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;
47968
+ var CollapsibleContent = function CollapsibleContent(_ref) {
47969
+ var children = _ref.children;
47970
+ var _useSidebar = useSidebar(),
47971
+ collapsed = _useSidebar.collapsed;
47972
+ return collapsed ? null : children;
47973
+ };
47974
+ var DashSidebar = function DashSidebar(_ref2) {
47975
+ var collapsed = _ref2.collapsed,
47976
+ onCollapsedChange = _ref2.onCollapsedChange,
47977
+ _ref2$workspaces = _ref2.workspaces,
47978
+ workspaces = _ref2$workspaces === void 0 ? [] : _ref2$workspaces,
47979
+ _ref2$menuItems = _ref2.menuItems,
47980
+ menuItems = _ref2$menuItems === void 0 ? [] : _ref2$menuItems,
47981
+ _ref2$activeTabId = _ref2.activeTabId,
47982
+ activeTabId = _ref2$activeTabId === void 0 ? null : _ref2$activeTabId,
47983
+ _ref2$recentDashboard = _ref2.recentDashboards,
47984
+ recentDashboards = _ref2$recentDashboard === void 0 ? [] : _ref2$recentDashboard,
47985
+ _ref2$authStatus = _ref2.authStatus,
47986
+ authStatus = _ref2$authStatus === void 0 ? "loading" : _ref2$authStatus,
47987
+ _ref2$authProfile = _ref2.authProfile,
47988
+ authProfile = _ref2$authProfile === void 0 ? null : _ref2$authProfile,
47989
+ onOpenWorkspace = _ref2.onOpenWorkspace,
47990
+ onNewDashboard = _ref2.onNewDashboard,
47991
+ onOpenSettings = _ref2.onOpenSettings,
47992
+ onOpenCommandPalette = _ref2.onOpenCommandPalette,
47993
+ onSignIn = _ref2.onSignIn,
47994
+ onSignOut = _ref2.onSignOut;
47992
47995
  var _useContext = useContext(ThemeContext),
47993
47996
  themeVariant = _useContext.themeVariant,
47994
47997
  changeThemeVariant = _useContext.changeThemeVariant;
@@ -48018,9 +48021,11 @@ var DashSidebar = function DashSidebar(_ref) {
48018
48021
  children: [/*#__PURE__*/jsx(Sidebar.Header, {
48019
48022
  children: /*#__PURE__*/jsxs("div", {
48020
48023
  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."
48024
+ children: [/*#__PURE__*/jsx(CollapsibleContent, {
48025
+ children: /*#__PURE__*/jsx("span", {
48026
+ className: "font-bold text-lg tracking-tight opacity-80",
48027
+ children: "Dash."
48028
+ })
48024
48029
  }), /*#__PURE__*/jsx(Sidebar.Trigger, {})]
48025
48030
  })
48026
48031
  }), /*#__PURE__*/jsxs(Sidebar.Content, {
@@ -48031,25 +48036,27 @@ var DashSidebar = function DashSidebar(_ref) {
48031
48036
  }),
48032
48037
  onClick: onOpenCommandPalette,
48033
48038
  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);
48039
+ }), /*#__PURE__*/jsx(CollapsibleContent, {
48040
+ children: visibleRecents.length > 0 && /*#__PURE__*/jsx(Sidebar.Group, {
48041
+ label: "Recents",
48042
+ children: visibleRecents.map(function (recent) {
48043
+ var ws = workspaces.find(function (w) {
48044
+ return w.id === recent.workspaceId;
48045
+ });
48046
+ return /*#__PURE__*/jsx(Sidebar.Item, {
48047
+ icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
48048
+ icon: "clock-rotate-left",
48049
+ className: "h-3.5 w-3.5"
48050
+ }),
48051
+ active: recent.workspaceId === activeTabId,
48052
+ onClick: function onClick() {
48053
+ return ws && onOpenWorkspace(ws);
48054
+ },
48055
+ children: (recent.name || "Untitled").replace(/^./, function (c) {
48056
+ return c.toUpperCase();
48057
+ })
48058
+ }, recent.workspaceId);
48059
+ })
48053
48060
  })
48054
48061
  }), /*#__PURE__*/jsx(Sidebar.Group, {
48055
48062
  label: "Dashboards",
@@ -48061,7 +48068,7 @@ var DashSidebar = function DashSidebar(_ref) {
48061
48068
  onClick: onNewDashboard,
48062
48069
  children: "New Dashboard"
48063
48070
  })
48064
- }), !collapsed && /*#__PURE__*/jsxs(Fragment, {
48071
+ }), /*#__PURE__*/jsxs(CollapsibleContent, {
48065
48072
  children: [menuItems.map(function (menuItem) {
48066
48073
  var folderWorkspaces = workspacesForFolder(menuItem.id);
48067
48074
  var folderIcon = menuItem.icon || menuItem.folder || "folder";
@@ -48117,15 +48124,15 @@ var DashSidebar = function DashSidebar(_ref) {
48117
48124
  })]
48118
48125
  });
48119
48126
  };
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;
48127
+ var FooterPopover = function FooterPopover(_ref3) {
48128
+ var collapsed = _ref3.collapsed,
48129
+ themeVariant = _ref3.themeVariant,
48130
+ changeThemeVariant = _ref3.changeThemeVariant,
48131
+ authStatus = _ref3.authStatus,
48132
+ authProfile = _ref3.authProfile,
48133
+ onOpenSettings = _ref3.onOpenSettings,
48134
+ onSignIn = _ref3.onSignIn,
48135
+ onSignOut = _ref3.onSignOut;
48129
48136
  var buttonRef = useRef(null);
48130
48137
  var _useState = useState(false),
48131
48138
  _useState2 = _slicedToArray(_useState, 2),
@@ -48169,10 +48176,10 @@ var FooterPopover = function FooterPopover(_ref2) {
48169
48176
  }
48170
48177
  return /*#__PURE__*/jsx(Popover, {
48171
48178
  className: "relative",
48172
- children: function children(_ref3) {
48179
+ children: function children(_ref4) {
48173
48180
  var _rect$left;
48174
- var open = _ref3.open,
48175
- close = _ref3.close;
48181
+ var open = _ref4.open,
48182
+ close = _ref4.close;
48176
48183
  var rect = open && buttonRef.current ? buttonRef.current.getBoundingClientRect() : null;
48177
48184
  return /*#__PURE__*/jsxs(Fragment, {
48178
48185
  children: [/*#__PURE__*/jsxs(Popover.Button, {
@@ -48253,12 +48260,12 @@ var FooterPopover = function FooterPopover(_ref2) {
48253
48260
  }
48254
48261
  });
48255
48262
  };
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;
48263
+ var PopoverItem = function PopoverItem(_ref5) {
48264
+ var icon = _ref5.icon,
48265
+ label = _ref5.label,
48266
+ onClick = _ref5.onClick,
48267
+ _ref5$active = _ref5.active,
48268
+ active = _ref5$active === void 0 ? false : _ref5$active;
48262
48269
  return /*#__PURE__*/jsxs("button", {
48263
48270
  type: "button",
48264
48271
  onClick: onClick,