@trops/dash-core 0.1.372 → 0.1.374

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,
@@ -4715,7 +4740,10 @@ var DiscoverDashboardsDetail = function DiscoverDashboardsDetail(_ref) {
4715
4740
  _useState2 = _slicedToArray(_useState, 2),
4716
4741
  packages = _useState2[0],
4717
4742
  setPackages = _useState2[1];
4718
- var _useState3 = useState(false),
4743
+ // Start in the loading state so the empty UI doesn't flash while the
4744
+ // initial debounce is pending — otherwise the sign-in nudge appears
4745
+ // briefly then disappears as soon as the registry returns results.
4746
+ var _useState3 = useState(true),
4719
4747
  _useState4 = _slicedToArray(_useState3, 2),
4720
4748
  isLoading = _useState4[0],
4721
4749
  setIsLoading = _useState4[1];
@@ -4890,27 +4918,12 @@ var DiscoverDashboardsDetail = function DiscoverDashboardsDetail(_ref) {
4890
4918
  })]
4891
4919
  });
4892
4920
  } else if (packages.length === 0) {
4893
- listBody = /*#__PURE__*/jsxs("div", {
4894
- className: "px-4 py-8 text-center space-y-3",
4895
- children: [/*#__PURE__*/jsx(Paragraph, {
4921
+ listBody = /*#__PURE__*/jsx("div", {
4922
+ className: "px-4 py-8 text-center",
4923
+ children: /*#__PURE__*/jsx(Paragraph, {
4896
4924
  className: "text-sm opacity-50",
4897
4925
  children: searchQuery ? "No dashboards match your search." : "No dashboard packages available."
4898
- }), registryAuthed === false && /*#__PURE__*/jsxs("div", {
4899
- className: "inline-flex flex-col items-center gap-2 px-4 py-3 rounded-lg bg-amber-900/15 border border-amber-700/30",
4900
- children: [/*#__PURE__*/jsx(Paragraph, {
4901
- className: "text-xs text-amber-200",
4902
- children: "Sign in to the registry to see your private dashboards."
4903
- }), /*#__PURE__*/jsx(Button, {
4904
- title: "Sign in to Registry",
4905
- bgColor: "bg-indigo-600",
4906
- hoverBackgroundColor: "hover:bg-indigo-500",
4907
- textSize: "text-sm",
4908
- padding: "py-1 px-3",
4909
- onClick: function onClick() {
4910
- return setShowAuthFromEmpty(true);
4911
- }
4912
- })]
4913
- })]
4926
+ })
4914
4927
  });
4915
4928
  } else {
4916
4929
  listBody = /*#__PURE__*/jsx("div", {
@@ -4954,6 +4967,12 @@ var DiscoverDashboardsDetail = function DiscoverDashboardsDetail(_ref) {
4954
4967
  placeholder: "Search dashboards...",
4955
4968
  inputClassName: "py-1.5 text-xs"
4956
4969
  })
4970
+ }), /*#__PURE__*/jsx(RegistrySignInBanner, {
4971
+ visible: registryAuthed === false,
4972
+ onSignIn: function onSignIn() {
4973
+ return setShowAuthFromEmpty(true);
4974
+ },
4975
+ noun: "dashboard"
4957
4976
  }), /*#__PURE__*/jsx("div", {
4958
4977
  className: "flex-1 min-h-0 overflow-y-auto px-2",
4959
4978
  children: listBody
@@ -6226,7 +6245,10 @@ var useRegistrySearch = function useRegistrySearch() {
6226
6245
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
6227
6246
  _ref$filterByCapabili = _ref.filterByCapabilities,
6228
6247
  filterByCapabilities = _ref$filterByCapabili === void 0 ? true : _ref$filterByCapabili;
6229
- var _useState = useState(false),
6248
+ // Start in the loading state so consumers don't briefly render an
6249
+ // empty-list state during the initial debounce window before the first
6250
+ // search fires.
6251
+ var _useState = useState(true),
6230
6252
  _useState2 = _slicedToArray(_useState, 2),
6231
6253
  isLoading = _useState2[0],
6232
6254
  setIsLoading = _useState2[1];
@@ -38284,7 +38306,9 @@ var DiscoverThemesDetail = function DiscoverThemesDetail(_ref) {
38284
38306
  _useState2 = _slicedToArray(_useState, 2),
38285
38307
  packages = _useState2[0],
38286
38308
  setPackages = _useState2[1];
38287
- var _useState3 = useState(false),
38309
+ // Start loading so the empty state with sign-in nudge doesn't flash
38310
+ // before the first fetch resolves.
38311
+ var _useState3 = useState(true),
38288
38312
  _useState4 = _slicedToArray(_useState3, 2),
38289
38313
  isLoading = _useState4[0],
38290
38314
  setIsLoading = _useState4[1];
@@ -38458,27 +38482,12 @@ var DiscoverThemesDetail = function DiscoverThemesDetail(_ref) {
38458
38482
  })]
38459
38483
  });
38460
38484
  } else if (packages.length === 0) {
38461
- listBody = /*#__PURE__*/jsxs("div", {
38462
- className: "px-4 py-8 text-center space-y-3",
38463
- children: [/*#__PURE__*/jsx(Paragraph, {
38485
+ listBody = /*#__PURE__*/jsx("div", {
38486
+ className: "px-4 py-8 text-center",
38487
+ children: /*#__PURE__*/jsx(Paragraph, {
38464
38488
  className: "text-sm opacity-50",
38465
38489
  children: searchQuery ? "No themes match your search." : "No theme packages available."
38466
- }), registryAuthed === false && /*#__PURE__*/jsxs("div", {
38467
- className: "inline-flex flex-col items-center gap-2 px-4 py-3 rounded-lg bg-amber-900/15 border border-amber-700/30",
38468
- children: [/*#__PURE__*/jsx(Paragraph, {
38469
- className: "text-xs text-amber-200",
38470
- children: "Sign in to the registry to see your private themes."
38471
- }), /*#__PURE__*/jsx(Button, {
38472
- title: "Sign in to Registry",
38473
- bgColor: "bg-indigo-600",
38474
- hoverBackgroundColor: "hover:bg-indigo-500",
38475
- textSize: "text-sm",
38476
- padding: "py-1 px-3",
38477
- onClick: function onClick() {
38478
- return setShowAuthFromEmpty(true);
38479
- }
38480
- })]
38481
- })]
38490
+ })
38482
38491
  });
38483
38492
  } else {
38484
38493
  listBody = /*#__PURE__*/jsx("div", {
@@ -38524,6 +38533,12 @@ var DiscoverThemesDetail = function DiscoverThemesDetail(_ref) {
38524
38533
  placeholder: "Search themes...",
38525
38534
  inputClassName: "py-1.5 text-xs"
38526
38535
  })
38536
+ }), /*#__PURE__*/jsx(RegistrySignInBanner, {
38537
+ visible: registryAuthed === false,
38538
+ onSignIn: function onSignIn() {
38539
+ return setShowAuthFromEmpty(true);
38540
+ },
38541
+ noun: "theme"
38527
38542
  }), /*#__PURE__*/jsx("div", {
38528
38543
  className: "flex-1 min-h-0 overflow-y-auto px-2",
38529
38544
  children: listBody
@@ -47435,27 +47450,12 @@ var DiscoverWidgetsDetail = function DiscoverWidgetsDetail(_ref) {
47435
47450
  })]
47436
47451
  });
47437
47452
  } else if (packages.length === 0) {
47438
- listBody = /*#__PURE__*/jsxs("div", {
47439
- className: "px-4 py-8 text-center space-y-3",
47440
- children: [/*#__PURE__*/jsx(Paragraph, {
47453
+ listBody = /*#__PURE__*/jsx("div", {
47454
+ className: "px-4 py-8 text-center",
47455
+ children: /*#__PURE__*/jsx(Paragraph, {
47441
47456
  className: "text-sm opacity-50",
47442
47457
  children: searchQuery ? "No packages match your search." : "No packages available."
47443
- }), registryAuthed === false && /*#__PURE__*/jsxs("div", {
47444
- className: "inline-flex flex-col items-center gap-2 px-4 py-3 rounded-lg bg-amber-900/15 border border-amber-700/30",
47445
- children: [/*#__PURE__*/jsx(Paragraph, {
47446
- className: "text-xs text-amber-200",
47447
- children: "Sign in to the registry to see your private packages."
47448
- }), /*#__PURE__*/jsx(Button, {
47449
- title: "Sign in to Registry",
47450
- bgColor: "bg-indigo-600",
47451
- hoverBackgroundColor: "hover:bg-indigo-500",
47452
- textSize: "text-sm",
47453
- padding: "py-1 px-3",
47454
- onClick: function onClick() {
47455
- return setShowAuthFromEmpty(true);
47456
- }
47457
- })]
47458
- })]
47458
+ })
47459
47459
  });
47460
47460
  } else {
47461
47461
  listBody = /*#__PURE__*/jsx("div", {
@@ -47522,6 +47522,12 @@ var DiscoverWidgetsDetail = function DiscoverWidgetsDetail(_ref) {
47522
47522
  className: "rounded"
47523
47523
  }), "Show all packages"]
47524
47524
  })]
47525
+ }), /*#__PURE__*/jsx(RegistrySignInBanner, {
47526
+ visible: registryAuthed === false,
47527
+ onSignIn: function onSignIn() {
47528
+ return setShowAuthFromEmpty(true);
47529
+ },
47530
+ noun: "widget"
47525
47531
  }), /*#__PURE__*/jsx("div", {
47526
47532
  className: "flex-1 min-h-0 overflow-y-auto px-2",
47527
47533
  children: listBody