@trops/dash-core 0.1.373 → 0.1.375

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
@@ -2,7 +2,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
2
  import _typeof from '@babel/runtime/helpers/typeof';
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import * as DashReact from '@trops/dash-react';
5
- 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';
5
+ import { isObject, ThemeContext, deepCopy, MainSection, getUUID, getStylesForItem, themeObjects, Heading, SearchInput, ButtonIcon, SubHeading3, InputText, Button, FontAwesomeIcon, Tag, Modal, Paragraph, Sidebar, 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';
6
6
  export * from '@trops/dash-react';
7
7
  export { ThemeContext } from '@trops/dash-react';
8
8
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
@@ -4702,6 +4702,31 @@ var RegistryDashboardDetail = function RegistryDashboardDetail(_ref) {
4702
4702
  });
4703
4703
  };
4704
4704
 
4705
+ function RegistrySignInBanner(_ref) {
4706
+ var visible = _ref.visible,
4707
+ onSignIn = _ref.onSignIn,
4708
+ _ref$noun = _ref.noun,
4709
+ noun = _ref$noun === void 0 ? "package" : _ref$noun;
4710
+ if (!visible) return null;
4711
+ return /*#__PURE__*/jsxs("div", {
4712
+ className: "flex-shrink-0 mx-4 mb-2 px-3 py-2 rounded-lg bg-amber-900/15 border border-amber-700/30 flex items-center gap-3",
4713
+ children: [/*#__PURE__*/jsx("div", {
4714
+ className: "flex-1 min-w-0",
4715
+ children: /*#__PURE__*/jsxs(Paragraph, {
4716
+ className: "text-xs text-amber-200 leading-snug",
4717
+ children: ["Sign in to the registry to also see your private ", noun, "s and ones granted to you."]
4718
+ })
4719
+ }), /*#__PURE__*/jsx(Button, {
4720
+ title: "Sign in",
4721
+ bgColor: "bg-indigo-600",
4722
+ hoverBackgroundColor: "hover:bg-indigo-500",
4723
+ textSize: "text-xs",
4724
+ padding: "py-1 px-3",
4725
+ onClick: onSignIn
4726
+ })]
4727
+ });
4728
+ }
4729
+
4705
4730
  var DiscoverDashboardsDetail = function DiscoverDashboardsDetail(_ref) {
4706
4731
  var onBack = _ref.onBack,
4707
4732
  appId = _ref.appId,
@@ -4893,27 +4918,12 @@ var DiscoverDashboardsDetail = function DiscoverDashboardsDetail(_ref) {
4893
4918
  })]
4894
4919
  });
4895
4920
  } else if (packages.length === 0) {
4896
- listBody = /*#__PURE__*/jsxs("div", {
4897
- className: "px-4 py-8 text-center space-y-3",
4898
- children: [/*#__PURE__*/jsx(Paragraph, {
4921
+ listBody = /*#__PURE__*/jsx("div", {
4922
+ className: "px-4 py-8 text-center",
4923
+ children: /*#__PURE__*/jsx(Paragraph, {
4899
4924
  className: "text-sm opacity-50",
4900
4925
  children: searchQuery ? "No dashboards match your search." : "No dashboard packages available."
4901
- }), registryAuthed === false && /*#__PURE__*/jsxs("div", {
4902
- className: "inline-flex flex-col items-center gap-2 px-4 py-3 rounded-lg bg-amber-900/15 border border-amber-700/30",
4903
- children: [/*#__PURE__*/jsx(Paragraph, {
4904
- className: "text-xs text-amber-200",
4905
- children: "Sign in to the registry to see your private dashboards."
4906
- }), /*#__PURE__*/jsx(Button, {
4907
- title: "Sign in to Registry",
4908
- bgColor: "bg-indigo-600",
4909
- hoverBackgroundColor: "hover:bg-indigo-500",
4910
- textSize: "text-sm",
4911
- padding: "py-1 px-3",
4912
- onClick: function onClick() {
4913
- return setShowAuthFromEmpty(true);
4914
- }
4915
- })]
4916
- })]
4926
+ })
4917
4927
  });
4918
4928
  } else {
4919
4929
  listBody = /*#__PURE__*/jsx("div", {
@@ -4957,6 +4967,12 @@ var DiscoverDashboardsDetail = function DiscoverDashboardsDetail(_ref) {
4957
4967
  placeholder: "Search dashboards...",
4958
4968
  inputClassName: "py-1.5 text-xs"
4959
4969
  })
4970
+ }), /*#__PURE__*/jsx(RegistrySignInBanner, {
4971
+ visible: registryAuthed === false,
4972
+ onSignIn: function onSignIn() {
4973
+ return setShowAuthFromEmpty(true);
4974
+ },
4975
+ noun: "dashboard"
4960
4976
  }), /*#__PURE__*/jsx("div", {
4961
4977
  className: "flex-1 min-h-0 overflow-y-auto px-2",
4962
4978
  children: listBody
@@ -4966,11 +4982,32 @@ var DiscoverDashboardsDetail = function DiscoverDashboardsDetail(_ref) {
4966
4982
  }), /*#__PURE__*/jsx(RegistryAuthModal, {
4967
4983
  isOpen: showAuthFromEmpty,
4968
4984
  setIsOpen: setShowAuthFromEmpty,
4969
- onAuthenticated: function onAuthenticated() {
4970
- setShowAuthFromEmpty(false);
4971
- setRegistryAuthed(true);
4972
- search(searchQuery);
4973
- },
4985
+ onAuthenticated: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
4986
+ var _window$mainApi3, _window$mainApi3$fetc;
4987
+ return _regeneratorRuntime.wrap(function (_context3) {
4988
+ while (1) switch (_context3.prev = _context3.next) {
4989
+ case 0:
4990
+ setShowAuthFromEmpty(false);
4991
+ setRegistryAuthed(true);
4992
+ // Force-refresh the cached registry index so the now-
4993
+ // authenticated user immediately sees their private packages.
4994
+ _context3.prev = 1;
4995
+ _context3.next = 2;
4996
+ return (_window$mainApi3 = window.mainApi) === null || _window$mainApi3 === void 0 || (_window$mainApi3 = _window$mainApi3.registry) === null || _window$mainApi3 === void 0 || (_window$mainApi3$fetc = _window$mainApi3.fetchIndex) === null || _window$mainApi3$fetc === void 0 ? void 0 : _window$mainApi3$fetc.call(_window$mainApi3, true);
4997
+ case 2:
4998
+ _context3.next = 4;
4999
+ break;
5000
+ case 3:
5001
+ _context3.prev = 3;
5002
+ _context3["catch"](1);
5003
+ case 4:
5004
+ search(searchQuery);
5005
+ case 5:
5006
+ case "end":
5007
+ return _context3.stop();
5008
+ }
5009
+ }, _callee3, null, [[1, 3]]);
5010
+ })),
4974
5011
  onCancel: function onCancel() {
4975
5012
  return setShowAuthFromEmpty(false);
4976
5013
  },
@@ -38466,27 +38503,12 @@ var DiscoverThemesDetail = function DiscoverThemesDetail(_ref) {
38466
38503
  })]
38467
38504
  });
38468
38505
  } else if (packages.length === 0) {
38469
- listBody = /*#__PURE__*/jsxs("div", {
38470
- className: "px-4 py-8 text-center space-y-3",
38471
- children: [/*#__PURE__*/jsx(Paragraph, {
38506
+ listBody = /*#__PURE__*/jsx("div", {
38507
+ className: "px-4 py-8 text-center",
38508
+ children: /*#__PURE__*/jsx(Paragraph, {
38472
38509
  className: "text-sm opacity-50",
38473
38510
  children: searchQuery ? "No themes match your search." : "No theme packages available."
38474
- }), registryAuthed === false && /*#__PURE__*/jsxs("div", {
38475
- className: "inline-flex flex-col items-center gap-2 px-4 py-3 rounded-lg bg-amber-900/15 border border-amber-700/30",
38476
- children: [/*#__PURE__*/jsx(Paragraph, {
38477
- className: "text-xs text-amber-200",
38478
- children: "Sign in to the registry to see your private themes."
38479
- }), /*#__PURE__*/jsx(Button, {
38480
- title: "Sign in to Registry",
38481
- bgColor: "bg-indigo-600",
38482
- hoverBackgroundColor: "hover:bg-indigo-500",
38483
- textSize: "text-sm",
38484
- padding: "py-1 px-3",
38485
- onClick: function onClick() {
38486
- return setShowAuthFromEmpty(true);
38487
- }
38488
- })]
38489
- })]
38511
+ })
38490
38512
  });
38491
38513
  } else {
38492
38514
  listBody = /*#__PURE__*/jsx("div", {
@@ -38532,6 +38554,12 @@ var DiscoverThemesDetail = function DiscoverThemesDetail(_ref) {
38532
38554
  placeholder: "Search themes...",
38533
38555
  inputClassName: "py-1.5 text-xs"
38534
38556
  })
38557
+ }), /*#__PURE__*/jsx(RegistrySignInBanner, {
38558
+ visible: registryAuthed === false,
38559
+ onSignIn: function onSignIn() {
38560
+ return setShowAuthFromEmpty(true);
38561
+ },
38562
+ noun: "theme"
38535
38563
  }), /*#__PURE__*/jsx("div", {
38536
38564
  className: "flex-1 min-h-0 overflow-y-auto px-2",
38537
38565
  children: listBody
@@ -38541,11 +38569,32 @@ var DiscoverThemesDetail = function DiscoverThemesDetail(_ref) {
38541
38569
  }), /*#__PURE__*/jsx(RegistryAuthModal, {
38542
38570
  isOpen: showAuthFromEmpty,
38543
38571
  setIsOpen: setShowAuthFromEmpty,
38544
- onAuthenticated: function onAuthenticated() {
38545
- setShowAuthFromEmpty(false);
38546
- setRegistryAuthed(true);
38547
- search(searchQuery);
38548
- },
38572
+ onAuthenticated: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
38573
+ var _window$mainApi3, _window$mainApi3$fetc;
38574
+ return _regeneratorRuntime.wrap(function (_context3) {
38575
+ while (1) switch (_context3.prev = _context3.next) {
38576
+ case 0:
38577
+ setShowAuthFromEmpty(false);
38578
+ setRegistryAuthed(true);
38579
+ // Force-refresh the cached registry index so the now-
38580
+ // authenticated user immediately sees their private packages.
38581
+ _context3.prev = 1;
38582
+ _context3.next = 2;
38583
+ return (_window$mainApi3 = window.mainApi) === null || _window$mainApi3 === void 0 || (_window$mainApi3 = _window$mainApi3.registry) === null || _window$mainApi3 === void 0 || (_window$mainApi3$fetc = _window$mainApi3.fetchIndex) === null || _window$mainApi3$fetc === void 0 ? void 0 : _window$mainApi3$fetc.call(_window$mainApi3, true);
38584
+ case 2:
38585
+ _context3.next = 4;
38586
+ break;
38587
+ case 3:
38588
+ _context3.prev = 3;
38589
+ _context3["catch"](1);
38590
+ case 4:
38591
+ search(searchQuery);
38592
+ case 5:
38593
+ case "end":
38594
+ return _context3.stop();
38595
+ }
38596
+ }, _callee3, null, [[1, 3]]);
38597
+ })),
38549
38598
  onCancel: function onCancel() {
38550
38599
  return setShowAuthFromEmpty(false);
38551
38600
  },
@@ -47443,27 +47492,12 @@ var DiscoverWidgetsDetail = function DiscoverWidgetsDetail(_ref) {
47443
47492
  })]
47444
47493
  });
47445
47494
  } else if (packages.length === 0) {
47446
- listBody = /*#__PURE__*/jsxs("div", {
47447
- className: "px-4 py-8 text-center space-y-3",
47448
- children: [/*#__PURE__*/jsx(Paragraph, {
47495
+ listBody = /*#__PURE__*/jsx("div", {
47496
+ className: "px-4 py-8 text-center",
47497
+ children: /*#__PURE__*/jsx(Paragraph, {
47449
47498
  className: "text-sm opacity-50",
47450
47499
  children: searchQuery ? "No packages match your search." : "No packages available."
47451
- }), registryAuthed === false && /*#__PURE__*/jsxs("div", {
47452
- className: "inline-flex flex-col items-center gap-2 px-4 py-3 rounded-lg bg-amber-900/15 border border-amber-700/30",
47453
- children: [/*#__PURE__*/jsx(Paragraph, {
47454
- className: "text-xs text-amber-200",
47455
- children: "Sign in to the registry to see your private packages."
47456
- }), /*#__PURE__*/jsx(Button, {
47457
- title: "Sign in to Registry",
47458
- bgColor: "bg-indigo-600",
47459
- hoverBackgroundColor: "hover:bg-indigo-500",
47460
- textSize: "text-sm",
47461
- padding: "py-1 px-3",
47462
- onClick: function onClick() {
47463
- return setShowAuthFromEmpty(true);
47464
- }
47465
- })]
47466
- })]
47500
+ })
47467
47501
  });
47468
47502
  } else {
47469
47503
  listBody = /*#__PURE__*/jsx("div", {
@@ -47530,6 +47564,12 @@ var DiscoverWidgetsDetail = function DiscoverWidgetsDetail(_ref) {
47530
47564
  className: "rounded"
47531
47565
  }), "Show all packages"]
47532
47566
  })]
47567
+ }), /*#__PURE__*/jsx(RegistrySignInBanner, {
47568
+ visible: registryAuthed === false,
47569
+ onSignIn: function onSignIn() {
47570
+ return setShowAuthFromEmpty(true);
47571
+ },
47572
+ noun: "widget"
47533
47573
  }), /*#__PURE__*/jsx("div", {
47534
47574
  className: "flex-1 min-h-0 overflow-y-auto px-2",
47535
47575
  children: listBody
@@ -47550,6 +47590,40 @@ var DiscoverWidgetsDetail = function DiscoverWidgetsDetail(_ref) {
47550
47590
  onCancel: function onCancel() {
47551
47591
  return setToolConflictWarning(null);
47552
47592
  }
47593
+ }), /*#__PURE__*/jsx(RegistryAuthModal, {
47594
+ isOpen: showAuthFromEmpty,
47595
+ setIsOpen: setShowAuthFromEmpty,
47596
+ onAuthenticated: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
47597
+ var _window$mainApi2, _window$mainApi2$fetc;
47598
+ return _regeneratorRuntime.wrap(function (_context3) {
47599
+ while (1) switch (_context3.prev = _context3.next) {
47600
+ case 0:
47601
+ setShowAuthFromEmpty(false);
47602
+ setRegistryAuthed(true);
47603
+ // Force-refresh the cached registry index so the now-
47604
+ // authenticated user immediately sees their private packages
47605
+ // (the previous anon-cache fetch otherwise lingers for 5 min).
47606
+ _context3.prev = 1;
47607
+ _context3.next = 2;
47608
+ return (_window$mainApi2 = window.mainApi) === null || _window$mainApi2 === void 0 || (_window$mainApi2 = _window$mainApi2.registry) === null || _window$mainApi2 === void 0 || (_window$mainApi2$fetc = _window$mainApi2.fetchIndex) === null || _window$mainApi2$fetc === void 0 ? void 0 : _window$mainApi2$fetc.call(_window$mainApi2, true);
47609
+ case 2:
47610
+ _context3.next = 4;
47611
+ break;
47612
+ case 3:
47613
+ _context3.prev = 3;
47614
+ _context3["catch"](1);
47615
+ case 4:
47616
+ retry();
47617
+ case 5:
47618
+ case "end":
47619
+ return _context3.stop();
47620
+ }
47621
+ }, _callee3, null, [[1, 3]]);
47622
+ })),
47623
+ onCancel: function onCancel() {
47624
+ return setShowAuthFromEmpty(false);
47625
+ },
47626
+ message: "Sign in to see your private widgets and ones granted to you."
47553
47627
  })]
47554
47628
  });
47555
47629
  };