@backstage/plugin-home 0.7.3 → 0.7.4-next.1

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.
Files changed (142) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/alpha/package.json +1 -1
  3. package/dist/alpha.esm.js +1 -1
  4. package/dist/alpha.esm.js.map +1 -1
  5. package/dist/api/VisitsApi.esm.js +11 -0
  6. package/dist/api/VisitsApi.esm.js.map +1 -0
  7. package/dist/api/VisitsStorageApi.esm.js +118 -0
  8. package/dist/api/VisitsStorageApi.esm.js.map +1 -0
  9. package/dist/api/VisitsWebStorageApi.esm.js +15 -0
  10. package/dist/api/VisitsWebStorageApi.esm.js.map +1 -0
  11. package/dist/api/config.esm.js +37 -0
  12. package/dist/api/config.esm.js.map +1 -0
  13. package/dist/assets/TemplateBackstageLogo.esm.js +22 -0
  14. package/dist/assets/TemplateBackstageLogo.esm.js.map +1 -0
  15. package/dist/assets/TemplateBackstageLogoIcon.esm.js +33 -0
  16. package/dist/assets/TemplateBackstageLogoIcon.esm.js.map +1 -0
  17. package/dist/{esm/index-BNfZuEhy.esm.js → componentRenderers/ComponentAccordion.esm.js} +2 -26
  18. package/dist/componentRenderers/ComponentAccordion.esm.js.map +1 -0
  19. package/dist/componentRenderers/ComponentTabs/ComponentTab.esm.js +9 -0
  20. package/dist/componentRenderers/ComponentTabs/ComponentTab.esm.js.map +1 -0
  21. package/dist/componentRenderers/ComponentTabs/ComponentTabs.esm.js +23 -0
  22. package/dist/componentRenderers/ComponentTabs/ComponentTabs.esm.js.map +1 -0
  23. package/dist/componentRenderers/index.esm.js +4 -0
  24. package/dist/componentRenderers/index.esm.js.map +1 -0
  25. package/dist/components/CustomHomepage/AddWidgetDialog.esm.js +45 -0
  26. package/dist/components/CustomHomepage/AddWidgetDialog.esm.js.map +1 -0
  27. package/dist/components/CustomHomepage/CustomHomepageButtons.esm.js +90 -0
  28. package/dist/components/CustomHomepage/CustomHomepageButtons.esm.js.map +1 -0
  29. package/dist/components/CustomHomepage/CustomHomepageGrid.esm.js +319 -0
  30. package/dist/components/CustomHomepage/CustomHomepageGrid.esm.js.map +1 -0
  31. package/dist/components/CustomHomepage/WidgetSettingsOverlay.esm.js +88 -0
  32. package/dist/components/CustomHomepage/WidgetSettingsOverlay.esm.js.map +1 -0
  33. package/dist/components/CustomHomepage/types.esm.js +48 -0
  34. package/dist/components/CustomHomepage/types.esm.js.map +1 -0
  35. package/dist/components/HomepageCompositionRoot.esm.js +12 -0
  36. package/dist/components/HomepageCompositionRoot.esm.js.map +1 -0
  37. package/dist/components/StarredEntityListItem/StarredEntityListItem.esm.js +31 -0
  38. package/dist/components/StarredEntityListItem/StarredEntityListItem.esm.js.map +1 -0
  39. package/dist/components/VisitList/ItemCategory.esm.js +63 -0
  40. package/dist/components/VisitList/ItemCategory.esm.js.map +1 -0
  41. package/dist/components/VisitList/ItemDetail.esm.js +26 -0
  42. package/dist/components/VisitList/ItemDetail.esm.js.map +1 -0
  43. package/dist/components/VisitList/ItemName.esm.js +27 -0
  44. package/dist/components/VisitList/ItemName.esm.js.map +1 -0
  45. package/dist/components/VisitList/VisitList.esm.js +46 -0
  46. package/dist/components/VisitList/VisitList.esm.js.map +1 -0
  47. package/dist/components/VisitList/VisitListEmpty.esm.js +7 -0
  48. package/dist/components/VisitList/VisitListEmpty.esm.js.map +1 -0
  49. package/dist/components/VisitList/VisitListFew.esm.js +7 -0
  50. package/dist/components/VisitList/VisitListFew.esm.js.map +1 -0
  51. package/dist/components/VisitList/VisitListItem.esm.js +31 -0
  52. package/dist/components/VisitList/VisitListItem.esm.js.map +1 -0
  53. package/dist/components/VisitList/VisitListSkeleton.esm.js +39 -0
  54. package/dist/components/VisitList/VisitListSkeleton.esm.js.map +1 -0
  55. package/dist/components/VisitListener.esm.js +62 -0
  56. package/dist/components/VisitListener.esm.js.map +1 -0
  57. package/dist/components/index.esm.js +4 -0
  58. package/dist/components/index.esm.js.map +1 -0
  59. package/dist/deprecated.esm.js +7 -0
  60. package/dist/deprecated.esm.js.map +1 -0
  61. package/dist/{esm/index-FqRX6ImF.esm.js → homePageComponents/CompanyLogo/CompanyLogo.esm.js} +1 -1
  62. package/dist/{esm/index-FqRX6ImF.esm.js.map → homePageComponents/CompanyLogo/CompanyLogo.esm.js.map} +1 -1
  63. package/dist/homePageComponents/CompanyLogo/index.esm.js +2 -0
  64. package/dist/homePageComponents/CompanyLogo/index.esm.js.map +1 -0
  65. package/dist/{esm/index-D7JTE1IL.esm.js → homePageComponents/FeaturedDocsCard/Content.esm.js} +1 -1
  66. package/dist/homePageComponents/FeaturedDocsCard/Content.esm.js.map +1 -0
  67. package/dist/homePageComponents/FeaturedDocsCard/index.esm.js +2 -0
  68. package/dist/homePageComponents/FeaturedDocsCard/index.esm.js.map +1 -0
  69. package/dist/{esm/index-BvvJGS3L.esm.js → homePageComponents/HeaderWorldClock/HeaderWorldClock.esm.js} +1 -1
  70. package/dist/homePageComponents/HeaderWorldClock/HeaderWorldClock.esm.js.map +1 -0
  71. package/dist/homePageComponents/HeaderWorldClock/index.esm.js +2 -0
  72. package/dist/homePageComponents/HeaderWorldClock/index.esm.js.map +1 -0
  73. package/dist/homePageComponents/RandomJoke/Actions.esm.js +11 -0
  74. package/dist/homePageComponents/RandomJoke/Actions.esm.js.map +1 -0
  75. package/dist/homePageComponents/RandomJoke/Content.esm.js +13 -0
  76. package/dist/homePageComponents/RandomJoke/Content.esm.js.map +1 -0
  77. package/dist/homePageComponents/RandomJoke/Context.esm.js +48 -0
  78. package/dist/homePageComponents/RandomJoke/Context.esm.js.map +1 -0
  79. package/dist/homePageComponents/RandomJoke/Settings.esm.js +33 -0
  80. package/dist/homePageComponents/RandomJoke/Settings.esm.js.map +1 -0
  81. package/dist/homePageComponents/RandomJoke/index.esm.js +5 -0
  82. package/dist/homePageComponents/RandomJoke/index.esm.js.map +1 -0
  83. package/dist/{esm/index-SfHoDIi1.esm.js → homePageComponents/StarredEntities/Content.esm.js} +4 -27
  84. package/dist/homePageComponents/StarredEntities/Content.esm.js.map +1 -0
  85. package/dist/homePageComponents/StarredEntities/index.esm.js +2 -0
  86. package/dist/homePageComponents/StarredEntities/index.esm.js.map +1 -0
  87. package/dist/{esm/index-CeXFfTX2.esm.js → homePageComponents/Toolkit/Content.esm.js} +4 -17
  88. package/dist/homePageComponents/Toolkit/Content.esm.js.map +1 -0
  89. package/dist/homePageComponents/Toolkit/Context.esm.js +18 -0
  90. package/dist/homePageComponents/Toolkit/Context.esm.js.map +1 -0
  91. package/dist/homePageComponents/Toolkit/index.esm.js +3 -0
  92. package/dist/homePageComponents/Toolkit/index.esm.js.map +1 -0
  93. package/dist/homePageComponents/VisitedByType/Actions.esm.js +18 -0
  94. package/dist/homePageComponents/VisitedByType/Actions.esm.js.map +1 -0
  95. package/dist/homePageComponents/VisitedByType/Content.esm.js +68 -0
  96. package/dist/homePageComponents/VisitedByType/Content.esm.js.map +1 -0
  97. package/dist/homePageComponents/VisitedByType/Context.esm.js +77 -0
  98. package/dist/homePageComponents/VisitedByType/Context.esm.js.map +1 -0
  99. package/dist/homePageComponents/VisitedByType/RecentlyVisited.esm.js +9 -0
  100. package/dist/homePageComponents/VisitedByType/RecentlyVisited.esm.js.map +1 -0
  101. package/dist/homePageComponents/VisitedByType/TopVisited.esm.js +9 -0
  102. package/dist/homePageComponents/VisitedByType/TopVisited.esm.js.map +1 -0
  103. package/dist/homePageComponents/VisitedByType/VisitedByType.esm.js +21 -0
  104. package/dist/homePageComponents/VisitedByType/VisitedByType.esm.js.map +1 -0
  105. package/dist/homePageComponents/WelcomeTitle/WelcomeTitle.esm.js +27 -0
  106. package/dist/homePageComponents/WelcomeTitle/WelcomeTitle.esm.js.map +1 -0
  107. package/dist/homePageComponents/WelcomeTitle/index.esm.js +2 -0
  108. package/dist/homePageComponents/WelcomeTitle/index.esm.js.map +1 -0
  109. package/dist/homePageComponents/WelcomeTitle/locales/goodAfternoon.locales.json.esm.js +256 -0
  110. package/dist/homePageComponents/WelcomeTitle/locales/goodAfternoon.locales.json.esm.js.map +1 -0
  111. package/dist/homePageComponents/WelcomeTitle/locales/goodEvening.locales.json.esm.js +196 -0
  112. package/dist/homePageComponents/WelcomeTitle/locales/goodEvening.locales.json.esm.js.map +1 -0
  113. package/dist/homePageComponents/WelcomeTitle/locales/goodMorning.locales.json.esm.js +131 -0
  114. package/dist/homePageComponents/WelcomeTitle/locales/goodMorning.locales.json.esm.js.map +1 -0
  115. package/dist/homePageComponents/WelcomeTitle/timeUtil.esm.js +41 -0
  116. package/dist/homePageComponents/WelcomeTitle/timeUtil.esm.js.map +1 -0
  117. package/dist/index.esm.js +10 -352
  118. package/dist/index.esm.js.map +1 -1
  119. package/dist/plugin.esm.js +144 -0
  120. package/dist/plugin.esm.js.map +1 -0
  121. package/dist/routes.esm.js +8 -0
  122. package/dist/routes.esm.js.map +1 -0
  123. package/package.json +16 -16
  124. package/dist/esm/Content-Quo42yad.esm.js +0 -396
  125. package/dist/esm/Content-Quo42yad.esm.js.map +0 -1
  126. package/dist/esm/RecentlyVisited-qOUgoCVu.esm.js +0 -48
  127. package/dist/esm/RecentlyVisited-qOUgoCVu.esm.js.map +0 -1
  128. package/dist/esm/TopVisited-B_KhSJit.esm.js +0 -48
  129. package/dist/esm/TopVisited-B_KhSJit.esm.js.map +0 -1
  130. package/dist/esm/VisitListener-dDLtFiIW.esm.js +0 -627
  131. package/dist/esm/VisitListener-dDLtFiIW.esm.js.map +0 -1
  132. package/dist/esm/index-BMySa_Iw.esm.js +0 -638
  133. package/dist/esm/index-BMySa_Iw.esm.js.map +0 -1
  134. package/dist/esm/index-BNfZuEhy.esm.js.map +0 -1
  135. package/dist/esm/index-BvvJGS3L.esm.js.map +0 -1
  136. package/dist/esm/index-Bzg5mDMo.esm.js +0 -45
  137. package/dist/esm/index-Bzg5mDMo.esm.js.map +0 -1
  138. package/dist/esm/index-CeXFfTX2.esm.js.map +0 -1
  139. package/dist/esm/index-D7JTE1IL.esm.js.map +0 -1
  140. package/dist/esm/index-Dg9lslkf.esm.js +0 -90
  141. package/dist/esm/index-Dg9lslkf.esm.js.map +0 -1
  142. package/dist/esm/index-SfHoDIi1.esm.js.map +0 -1
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { useOutlet } from 'react-router-dom';
3
+
4
+ const HomepageCompositionRoot = (props) => {
5
+ var _a;
6
+ const outlet = useOutlet();
7
+ const children = (_a = props.children) != null ? _a : outlet;
8
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
9
+ };
10
+
11
+ export { HomepageCompositionRoot };
12
+ //# sourceMappingURL=HomepageCompositionRoot.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HomepageCompositionRoot.esm.js","sources":["../../src/components/HomepageCompositionRoot.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ReactNode } from 'react';\nimport { useOutlet } from 'react-router-dom';\n\nexport const HomepageCompositionRoot = (props: {\n title?: string;\n children?: ReactNode;\n}) => {\n const outlet = useOutlet();\n const children = props.children ?? outlet;\n return <>{children}</>;\n};\n"],"names":[],"mappings":";;;AAmBa,MAAA,uBAAA,GAA0B,CAAC,KAGlC,KAAA;AAtBN,EAAA,IAAA,EAAA,CAAA;AAuBE,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,QAAA,GAAA,CAAW,EAAM,GAAA,KAAA,CAAA,QAAA,KAAN,IAAkB,GAAA,EAAA,GAAA,MAAA,CAAA;AACnC,EAAA,iEAAU,QAAS,CAAA,CAAA;AACrB;;;;"}
@@ -0,0 +1,31 @@
1
+ import { stringifyEntityRef } from '@backstage/catalog-model';
2
+ import { entityRouteRef, entityRouteParams } from '@backstage/plugin-catalog-react';
3
+ import ListItem from '@material-ui/core/ListItem';
4
+ import ListItemIcon from '@material-ui/core/ListItemIcon';
5
+ import Tooltip from '@material-ui/core/Tooltip';
6
+ import IconButton from '@material-ui/core/IconButton';
7
+ import ListItemText from '@material-ui/core/ListItemText';
8
+ import React from 'react';
9
+ import { Link } from 'react-router-dom';
10
+ import { useRouteRef } from '@backstage/core-plugin-api';
11
+ import StarIcon from '@material-ui/icons/Star';
12
+
13
+ const StarredEntityListItem = ({
14
+ entity,
15
+ onToggleStarredEntity
16
+ }) => {
17
+ var _a;
18
+ const catalogEntityRoute = useRouteRef(entityRouteRef);
19
+ return /* @__PURE__ */ React.createElement(ListItem, { key: stringifyEntityRef(entity) }, /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(Tooltip, { title: "Remove from starred" }, /* @__PURE__ */ React.createElement(
20
+ IconButton,
21
+ {
22
+ edge: "end",
23
+ "aria-label": "unstar",
24
+ onClick: () => onToggleStarredEntity(entity)
25
+ },
26
+ /* @__PURE__ */ React.createElement(StarIcon, { style: { color: "#f3ba37" } })
27
+ ))), /* @__PURE__ */ React.createElement(Link, { to: catalogEntityRoute(entityRouteParams(entity)) }, /* @__PURE__ */ React.createElement(ListItemText, { primary: (_a = entity.metadata.title) != null ? _a : entity.metadata.name })));
28
+ };
29
+
30
+ export { StarredEntityListItem };
31
+ //# sourceMappingURL=StarredEntityListItem.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StarredEntityListItem.esm.js","sources":["../../../src/components/StarredEntityListItem/StarredEntityListItem.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { entityRouteParams } from '@backstage/plugin-catalog-react';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport IconButton from '@material-ui/core/IconButton';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport React from 'react';\nimport { Link } from 'react-router-dom';\nimport { entityRouteRef } from '@backstage/plugin-catalog-react';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport StarIcon from '@material-ui/icons/Star';\n\ntype EntityListItemProps = {\n entity: Entity;\n onToggleStarredEntity: (entity: Entity) => void;\n};\n\nexport const StarredEntityListItem = ({\n entity,\n onToggleStarredEntity,\n}: EntityListItemProps) => {\n const catalogEntityRoute = useRouteRef(entityRouteRef);\n\n return (\n <ListItem key={stringifyEntityRef(entity)}>\n <ListItemIcon>\n <Tooltip title=\"Remove from starred\">\n <IconButton\n edge=\"end\"\n aria-label=\"unstar\"\n onClick={() => onToggleStarredEntity(entity)}\n >\n <StarIcon style={{ color: '#f3ba37' }} />\n </IconButton>\n </Tooltip>\n </ListItemIcon>\n <Link to={catalogEntityRoute(entityRouteParams(entity))}>\n <ListItemText primary={entity.metadata.title ?? entity.metadata.name} />\n </Link>\n </ListItem>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAiCO,MAAM,wBAAwB,CAAC;AAAA,EACpC,MAAA;AAAA,EACA,qBAAA;AACF,CAA2B,KAAA;AApC3B,EAAA,IAAA,EAAA,CAAA;AAqCE,EAAM,MAAA,kBAAA,GAAqB,YAAY,cAAc,CAAA,CAAA;AAErD,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,GAAA,EAAK,kBAAmB,CAAA,MAAM,CACtC,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,YACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,EAAA,KAAA,EAAM,qBACb,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,KAAA;AAAA,MACL,YAAW,EAAA,QAAA;AAAA,MACX,OAAA,EAAS,MAAM,qBAAA,CAAsB,MAAM,CAAA;AAAA,KAAA;AAAA,wCAE1C,QAAS,EAAA,EAAA,KAAA,EAAO,EAAE,KAAA,EAAO,WAAa,EAAA,CAAA;AAAA,GAE3C,CACF,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,EAAI,EAAA,kBAAA,CAAmB,iBAAkB,CAAA,MAAM,CAAC,CAAA,EAAA,sCACnD,YAAa,EAAA,EAAA,OAAA,EAAA,CAAS,YAAO,QAAS,CAAA,KAAA,KAAhB,YAAyB,MAAO,CAAA,QAAA,CAAS,IAAM,EAAA,CACxE,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import Chip from '@material-ui/core/Chip';
3
+ import { makeStyles } from '@material-ui/core/styles';
4
+ import { colorVariants } from '@backstage/theme';
5
+ import { parseEntityRef } from '@backstage/catalog-model';
6
+
7
+ const useStyles = makeStyles((theme) => ({
8
+ chip: {
9
+ color: theme.palette.common.white,
10
+ fontWeight: "bold",
11
+ margin: 0
12
+ }
13
+ }));
14
+ const maybeEntity = (visit) => {
15
+ var _a;
16
+ try {
17
+ return parseEntityRef((_a = visit == null ? void 0 : visit.entityRef) != null ? _a : "");
18
+ } catch (e) {
19
+ return void 0;
20
+ }
21
+ };
22
+ const getColorByIndex = (index) => {
23
+ const variants = Object.keys(colorVariants);
24
+ const variantIndex = index % variants.length;
25
+ return colorVariants[variants[variantIndex]][0];
26
+ };
27
+ const getChipColor = (entity) => {
28
+ const defaultColor = getColorByIndex(0);
29
+ if (!entity)
30
+ return defaultColor;
31
+ const entityKinds = [
32
+ "component",
33
+ "template",
34
+ "api",
35
+ "group",
36
+ "user",
37
+ "resource",
38
+ "system",
39
+ "domain",
40
+ "location"
41
+ ];
42
+ const foundIndex = entityKinds.indexOf(
43
+ entity.kind.toLocaleLowerCase("en-US")
44
+ );
45
+ return foundIndex === -1 ? defaultColor : getColorByIndex(foundIndex + 1);
46
+ };
47
+ const ItemCategory = ({ visit }) => {
48
+ var _a;
49
+ const classes = useStyles();
50
+ const entity = maybeEntity(visit);
51
+ return /* @__PURE__ */ React.createElement(
52
+ Chip,
53
+ {
54
+ size: "small",
55
+ className: classes.chip,
56
+ label: ((_a = entity == null ? void 0 : entity.kind) != null ? _a : "Other").toLocaleLowerCase("en-US"),
57
+ style: { background: getChipColor(entity) }
58
+ }
59
+ );
60
+ };
61
+
62
+ export { ItemCategory };
63
+ //# sourceMappingURL=ItemCategory.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ItemCategory.esm.js","sources":["../../../src/components/VisitList/ItemCategory.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport Chip from '@material-ui/core/Chip';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { colorVariants } from '@backstage/theme';\nimport { Visit } from '../../api/VisitsApi';\nimport { CompoundEntityRef, parseEntityRef } from '@backstage/catalog-model';\n\nconst useStyles = makeStyles(theme => ({\n chip: {\n color: theme.palette.common.white,\n fontWeight: 'bold',\n margin: 0,\n },\n}));\nconst maybeEntity = (visit: Visit): CompoundEntityRef | undefined => {\n try {\n return parseEntityRef(visit?.entityRef ?? '');\n } catch (e) {\n return undefined;\n }\n};\nconst getColorByIndex = (index: number) => {\n const variants = Object.keys(colorVariants);\n const variantIndex = index % variants.length;\n return colorVariants[variants[variantIndex]][0];\n};\nconst getChipColor = (entity: CompoundEntityRef | undefined): string => {\n const defaultColor = getColorByIndex(0);\n if (!entity) return defaultColor;\n\n // IDEA: Use or replicate useAllKinds hook thus supporting all software catalog\n // registered kinds. See:\n // plugins/catalog-react/src/components/EntityKindPicker/kindFilterUtils.ts\n // Provide extension point to register your own color code.\n const entityKinds = [\n 'component',\n 'template',\n 'api',\n 'group',\n 'user',\n 'resource',\n 'system',\n 'domain',\n 'location',\n ];\n const foundIndex = entityKinds.indexOf(\n entity.kind.toLocaleLowerCase('en-US'),\n );\n return foundIndex === -1 ? defaultColor : getColorByIndex(foundIndex + 1);\n};\n\nexport const ItemCategory = ({ visit }: { visit: Visit }) => {\n const classes = useStyles();\n const entity = maybeEntity(visit);\n\n return (\n <Chip\n size=\"small\"\n className={classes.chip}\n label={(entity?.kind ?? 'Other').toLocaleLowerCase('en-US')}\n style={{ background: getChipColor(entity) }}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAuBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,KAAA;AAAA,IAC5B,UAAY,EAAA,MAAA;AAAA,IACZ,MAAQ,EAAA,CAAA;AAAA,GACV;AACF,CAAE,CAAA,CAAA,CAAA;AACF,MAAM,WAAA,GAAc,CAAC,KAAgD,KAAA;AA9BrE,EAAA,IAAA,EAAA,CAAA;AA+BE,EAAI,IAAA;AACF,IAAA,OAAO,cAAe,CAAA,CAAA,EAAA,GAAA,KAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,KAAA,CAAO,SAAP,KAAA,I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IAAC,IAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,OAAA;AAAA,MACL,WAAW,OAAQ,CAAA,IAAA;AAAA,MACnB,SAAQ,EAAQ,GAAA,MAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,MAAA,CAAA,IAAA,KAAR,IAAgB,GAAA,EAAA,GAAA,OAAA,EAAS,kBAAkB,OAAO,CAAA;AAAA,MAC1D,KAAO,EAAA,EAAE,UAAY,EAAA,YAAA,CAAa,MAAM,CAAE,EAAA;AAAA,KAAA;AAAA,GAC5C,CAAA;AAEJ;;;;"}
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import Typography from '@material-ui/core/Typography';
3
+ import { DateTime } from 'luxon';
4
+
5
+ const ItemDetailHits = ({ visit }) => /* @__PURE__ */ React.createElement(Typography, { component: "span", variant: "caption", color: "textSecondary" }, visit.hits, " time", visit.hits > 1 ? "s" : "");
6
+ const ItemDetailTimeAgo = ({ visit }) => {
7
+ var _a;
8
+ const visitDate = DateTime.fromMillis(visit.timestamp);
9
+ return /* @__PURE__ */ React.createElement(
10
+ Typography,
11
+ {
12
+ component: "time",
13
+ variant: "caption",
14
+ color: "textSecondary",
15
+ dateTime: (_a = visitDate.toISO()) != null ? _a : void 0
16
+ },
17
+ visitDate.toRelative()
18
+ );
19
+ };
20
+ const ItemDetail = ({
21
+ visit,
22
+ type
23
+ }) => type === "time-ago" ? /* @__PURE__ */ React.createElement(ItemDetailTimeAgo, { visit }) : /* @__PURE__ */ React.createElement(ItemDetailHits, { visit });
24
+
25
+ export { ItemDetail };
26
+ //# sourceMappingURL=ItemDetail.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ItemDetail.esm.js","sources":["../../../src/components/VisitList/ItemDetail.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport Typography from '@material-ui/core/Typography';\nimport { Visit } from '../../api/VisitsApi';\nimport { DateTime } from 'luxon';\n\nconst ItemDetailHits = ({ visit }: { visit: Visit }) => (\n <Typography component=\"span\" variant=\"caption\" color=\"textSecondary\">\n {visit.hits} time{visit.hits > 1 ? 's' : ''}\n </Typography>\n);\n\nconst ItemDetailTimeAgo = ({ visit }: { visit: Visit }) => {\n const visitDate = DateTime.fromMillis(visit.timestamp);\n\n return (\n <Typography\n component=\"time\"\n variant=\"caption\"\n color=\"textSecondary\"\n dateTime={visitDate.toISO() ?? undefined}\n >\n {visitDate.toRelative()}\n </Typography>\n );\n};\n\nexport type ItemDetailType = 'time-ago' | 'hits';\n\nexport const ItemDetail = ({\n visit,\n type,\n}: {\n visit: Visit;\n type: ItemDetailType;\n}) =>\n type === 'time-ago' ? (\n <ItemDetailTimeAgo visit={visit} />\n ) : (\n <ItemDetailHits visit={visit} />\n );\n"],"names":[],"mappings":";;;;AAqBA,MAAM,cAAA,GAAiB,CAAC,EAAE,KAAA,uBACvB,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,WAAU,MAAO,EAAA,OAAA,EAAQ,WAAU,KAAM,EAAA,eAAA,EAAA,EAClD,MAAM,IAAK,EAAA,OAAA,EAAM,MAAM,IAAO,GAAA,CAAA,GAAI,MAAM,EAC3C,CAAA,CAAA;AAGF,MAAM,iBAAoB,GAAA,CAAC,EAAE,KAAA,EAA8B,KAAA;AA3B3D,EAAA,IAAA,EAAA,CAAA;AA4BE,EAAA,MAAM,SAAY,GAAA,QAAA,CAAS,UAAW,CAAA,KAAA,CAAM,SAAS,CAAA,CAAA;AAErD,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,SAAU,EAAA,MAAA;AAAA,MACV,OAAQ,EAAA,SAAA;AAAA,MACR,KAAM,EAAA,eAAA;AAAA,MACN,QAAU,EAAA,CAAA,EAAA,GAAA,SAAA,CAAU,KAAM,EAAA,KAAhB,IAAqB,GAAA,EAAA,GAAA,KAAA,CAAA;AAAA,KAAA;AAAA,IAE9B,UAAU,UAAW,EAAA;AAAA,GACxB,CAAA;AAEJ,CAAA,CAAA;AAIO,MAAM,aAAa,CAAC;AAAA,EACzB,KAAA;AAAA,EACA,IAAA;AACF,CAIE,KAAA,IAAA,KAAS,6BACN,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAkB,OAAc,CAEjC,mBAAA,KAAA,CAAA,aAAA,CAAC,kBAAe,KAAc,EAAA;;;;"}
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import Typography from '@material-ui/core/Typography';
3
+ import { makeStyles } from '@material-ui/core/styles';
4
+ import { Link } from '@backstage/core-components';
5
+
6
+ const useStyles = makeStyles((_theme) => ({
7
+ name: {
8
+ marginLeft: "0.8rem",
9
+ marginRight: "0.8rem"
10
+ }
11
+ }));
12
+ const ItemName = ({ visit }) => {
13
+ const classes = useStyles();
14
+ return /* @__PURE__ */ React.createElement(
15
+ Typography,
16
+ {
17
+ component: Link,
18
+ to: visit.pathname,
19
+ noWrap: true,
20
+ className: classes.name
21
+ },
22
+ visit.name
23
+ );
24
+ };
25
+
26
+ export { ItemName };
27
+ //# sourceMappingURL=ItemName.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ItemName.esm.js","sources":["../../../src/components/VisitList/ItemName.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Visit } from '../../api/VisitsApi';\nimport { Link } from '@backstage/core-components';\n\nconst useStyles = makeStyles(_theme => ({\n name: {\n marginLeft: '0.8rem',\n marginRight: '0.8rem',\n },\n}));\nexport const ItemName = ({ visit }: { visit: Visit }) => {\n const classes = useStyles();\n\n return (\n <Typography\n component={Link}\n to={visit.pathname}\n noWrap\n className={classes.name}\n >\n {visit.name}\n </Typography>\n );\n};\n"],"names":[],"mappings":";;;;;AAsBA,MAAM,SAAA,GAAY,WAAW,CAAW,MAAA,MAAA;AAAA,EACtC,IAAM,EAAA;AAAA,IACJ,UAAY,EAAA,QAAA;AAAA,IACZ,WAAa,EAAA,QAAA;AAAA,GACf;AACF,CAAE,CAAA,CAAA,CAAA;AACK,MAAM,QAAW,GAAA,CAAC,EAAE,KAAA,EAA8B,KAAA;AACvD,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAE1B,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,IAAA;AAAA,MACX,IAAI,KAAM,CAAA,QAAA;AAAA,MACV,MAAM,EAAA,IAAA;AAAA,MACN,WAAW,OAAQ,CAAA,IAAA;AAAA,KAAA;AAAA,IAElB,KAAM,CAAA,IAAA;AAAA,GACT,CAAA;AAEJ;;;;"}
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import Collapse from '@material-ui/core/Collapse';
3
+ import List from '@material-ui/core/List';
4
+ import { VisitListItem } from './VisitListItem.esm.js';
5
+ import { VisitListEmpty } from './VisitListEmpty.esm.js';
6
+ import { VisitListFew } from './VisitListFew.esm.js';
7
+ import { VisitListSkeleton } from './VisitListSkeleton.esm.js';
8
+
9
+ const VisitList = ({
10
+ detailType,
11
+ visits = [],
12
+ numVisitsOpen = 3,
13
+ numVisitsTotal = 8,
14
+ collapsed = true,
15
+ loading = false,
16
+ title = ""
17
+ }) => {
18
+ let listBody = /* @__PURE__ */ React.createElement(React.Fragment, null);
19
+ if (loading) {
20
+ listBody = /* @__PURE__ */ React.createElement(
21
+ VisitListSkeleton,
22
+ {
23
+ numVisitsOpen,
24
+ numVisitsTotal,
25
+ collapsed
26
+ }
27
+ );
28
+ } else if (visits.length === 0) {
29
+ listBody = /* @__PURE__ */ React.createElement(VisitListEmpty, null);
30
+ } else if (visits.length < numVisitsOpen) {
31
+ listBody = /* @__PURE__ */ React.createElement(React.Fragment, null, visits.map((visit, index) => /* @__PURE__ */ React.createElement(VisitListItem, { visit, key: index, detailType })), /* @__PURE__ */ React.createElement(VisitListFew, null));
32
+ } else {
33
+ listBody = /* @__PURE__ */ React.createElement(React.Fragment, null, visits.slice(0, numVisitsOpen).map((visit, index) => /* @__PURE__ */ React.createElement(VisitListItem, { visit, key: index, detailType })), visits.length > numVisitsOpen && /* @__PURE__ */ React.createElement(Collapse, { in: !collapsed }, visits.slice(numVisitsOpen, numVisitsTotal).map((visit, index) => /* @__PURE__ */ React.createElement(
34
+ VisitListItem,
35
+ {
36
+ visit,
37
+ key: index,
38
+ detailType
39
+ }
40
+ ))));
41
+ }
42
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, title && /* @__PURE__ */ React.createElement("h5", null, title), /* @__PURE__ */ React.createElement(List, { dense: true, disablePadding: true }, listBody));
43
+ };
44
+
45
+ export { VisitList };
46
+ //# sourceMappingURL=VisitList.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VisitList.esm.js","sources":["../../../src/components/VisitList/VisitList.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport Collapse from '@material-ui/core/Collapse';\nimport List from '@material-ui/core/List';\nimport { Visit } from '../../api/VisitsApi';\nimport { VisitListItem } from './VisitListItem';\nimport { ItemDetailType } from './ItemDetail';\nimport { VisitListEmpty } from './VisitListEmpty';\nimport { VisitListFew } from './VisitListFew';\nimport { VisitListSkeleton } from './VisitListSkeleton';\n\nexport const VisitList = ({\n detailType,\n visits = [],\n numVisitsOpen = 3,\n numVisitsTotal = 8,\n collapsed = true,\n loading = false,\n title = '',\n}: {\n detailType: ItemDetailType;\n visits?: Visit[];\n numVisitsOpen?: number;\n numVisitsTotal?: number;\n collapsed?: boolean;\n loading?: boolean;\n title?: string;\n}) => {\n let listBody: React.ReactElement = <></>;\n if (loading) {\n listBody = (\n <VisitListSkeleton\n numVisitsOpen={numVisitsOpen}\n numVisitsTotal={numVisitsTotal}\n collapsed={collapsed}\n />\n );\n } else if (visits.length === 0) {\n listBody = <VisitListEmpty />;\n } else if (visits.length < numVisitsOpen) {\n listBody = (\n <>\n {visits.map((visit, index) => (\n <VisitListItem visit={visit} key={index} detailType={detailType} />\n ))}\n <VisitListFew />\n </>\n );\n } else {\n listBody = (\n <>\n {visits.slice(0, numVisitsOpen).map((visit, index) => (\n <VisitListItem visit={visit} key={index} detailType={detailType} />\n ))}\n {visits.length > numVisitsOpen && (\n <Collapse in={!collapsed}>\n {visits.slice(numVisitsOpen, numVisitsTotal).map((visit, index) => (\n <VisitListItem\n visit={visit}\n key={index}\n detailType={detailType}\n />\n ))}\n </Collapse>\n )}\n </>\n );\n }\n\n return (\n <>\n {title && <h5>{title}</h5>}\n <List dense disablePadding>\n {listBody}\n </List>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA0BO,MAAM,YAAY,CAAC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AA,aAAA,CAAA,QAAA,EAAA,EAAS,IAAI,CAAC,SAAA,EAAA,EACZ,MAAO,CAAA,KAAA,CAAM,eAAe,cAAc,CAAA,CAAE,GAAI,CAAA,CAAC,OAAO,KACvD,qBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACC,KAAA;AAAA,QACA,GAAK,EAAA,KAAA;AAAA,QACL,UAAA;AAAA,OAAA;AAAA,KAEH,CACH,CAEJ,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAA,uBAEK,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAA,KAAA,oBAAU,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,IAAA,EAAI,KAAM,CAAA,kBACpB,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,KAAK,EAAA,IAAA,EAAC,cAAc,EAAA,IAAA,EAAA,EACvB,QACH,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import Typography from '@material-ui/core/Typography';
3
+
4
+ const VisitListEmpty = () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "body2", color: "textSecondary" }, "There are no visits to show yet."), /* @__PURE__ */ React.createElement(Typography, { variant: "body2", color: "textSecondary" }, "Once you start using Backstage, your visits will appear here as a quick link to carry on where you left off."));
5
+
6
+ export { VisitListEmpty };
7
+ //# sourceMappingURL=VisitListEmpty.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VisitListEmpty.esm.js","sources":["../../../src/components/VisitList/VisitListEmpty.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport Typography from '@material-ui/core/Typography';\n\nexport const VisitListEmpty = () => (\n <>\n <Typography variant=\"body2\" color=\"textSecondary\">\n There are no visits to show yet.\n </Typography>\n <Typography variant=\"body2\" color=\"textSecondary\">\n Once you start using Backstage, your visits will appear here as a quick\n link to carry on where you left off.\n </Typography>\n </>\n);\n"],"names":[],"mappings":";;;AAmBO,MAAM,iBAAiB,sBAC5B,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,sCACG,UAAW,EAAA,EAAA,OAAA,EAAQ,SAAQ,KAAM,EAAA,eAAA,EAAA,EAAgB,kCAElD,CAAA,sCACC,UAAW,EAAA,EAAA,OAAA,EAAQ,SAAQ,KAAM,EAAA,eAAA,EAAA,EAAgB,8GAGlD,CACF;;;;"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import Typography from '@material-ui/core/Typography';
3
+
4
+ const VisitListFew = () => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "body2", color: "textSecondary" }, "The more pages you visit, the more pages will appear here."));
5
+
6
+ export { VisitListFew };
7
+ //# sourceMappingURL=VisitListFew.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VisitListFew.esm.js","sources":["../../../src/components/VisitList/VisitListFew.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport Typography from '@material-ui/core/Typography';\n\nexport const VisitListFew = () => (\n <>\n <Typography variant=\"body2\" color=\"textSecondary\">\n The more pages you visit, the more pages will appear here.\n </Typography>\n </>\n);\n"],"names":[],"mappings":";;;AAmBa,MAAA,YAAA,GAAe,sBAC1B,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBACG,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAQ,OAAQ,EAAA,KAAA,EAAM,eAAgB,EAAA,EAAA,4DAElD,CACF;;;;"}
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import ListItem from '@material-ui/core/ListItem';
3
+ import ListItemAvatar from '@material-ui/core/ListItemAvatar';
4
+ import ListItemText from '@material-ui/core/ListItemText';
5
+ import { makeStyles } from '@material-ui/core/styles';
6
+ import { ItemName } from './ItemName.esm.js';
7
+ import { ItemDetail } from './ItemDetail.esm.js';
8
+ import { ItemCategory } from './ItemCategory.esm.js';
9
+
10
+ const useStyles = makeStyles((_theme) => ({
11
+ avatar: {
12
+ minWidth: 0
13
+ }
14
+ }));
15
+ const VisitListItem = ({
16
+ visit,
17
+ detailType
18
+ }) => {
19
+ const classes = useStyles();
20
+ return /* @__PURE__ */ React.createElement(ListItem, { disableGutters: true }, /* @__PURE__ */ React.createElement(ListItemAvatar, { className: classes.avatar }, /* @__PURE__ */ React.createElement(ItemCategory, { visit })), /* @__PURE__ */ React.createElement(
21
+ ListItemText,
22
+ {
23
+ primary: /* @__PURE__ */ React.createElement(ItemName, { visit }),
24
+ secondary: /* @__PURE__ */ React.createElement(ItemDetail, { visit, type: detailType }),
25
+ disableTypography: true
26
+ }
27
+ ));
28
+ };
29
+
30
+ export { VisitListItem };
31
+ //# sourceMappingURL=VisitListItem.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VisitListItem.esm.js","sources":["../../../src/components/VisitList/VisitListItem.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemAvatar from '@material-ui/core/ListItemAvatar';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Visit } from '../../api/VisitsApi';\nimport { ItemName } from './ItemName';\nimport { ItemDetail, ItemDetailType } from './ItemDetail';\nimport { ItemCategory } from './ItemCategory';\n\nconst useStyles = makeStyles(_theme => ({\n avatar: {\n minWidth: 0,\n },\n}));\nexport const VisitListItem = ({\n visit,\n detailType,\n}: {\n visit: Visit;\n detailType: ItemDetailType;\n}) => {\n const classes = useStyles();\n\n return (\n <ListItem disableGutters>\n <ListItemAvatar className={classes.avatar}>\n <ItemCategory visit={visit} />\n </ListItemAvatar>\n <ListItemText\n primary={<ItemName visit={visit} />}\n secondary={<ItemDetail visit={visit} type={detailType} />}\n disableTypography\n />\n </ListItem>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA0BA,MAAM,SAAA,GAAY,WAAW,CAAW,MAAA,MAAA;AAAA,EACtC,MAAQ,EAAA;AAAA,IACN,QAAU,EAAA,CAAA;AAAA,GACZ;AACF,CAAE,CAAA,CAAA,CAAA;AACK,MAAM,gBAAgB,CAAC;AAAA,EAC5B,KAAA;AAAA,EACA,UAAA;AACF,CAGM,KAAA;AACJ,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAE1B,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,cAAc,EAAA,IAAA,EAAA,kBACrB,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,EAAe,SAAW,EAAA,OAAA,CAAQ,MACjC,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,EAAA,KAAA,EAAc,CAC9B,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,OAAA,kBAAU,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,KAAc,EAAA,CAAA;AAAA,MACjC,SAAW,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAc,MAAM,UAAY,EAAA,CAAA;AAAA,MACvD,iBAAiB,EAAA,IAAA;AAAA,KAAA;AAAA,GAErB,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import Collapse from '@material-ui/core/Collapse';
3
+ import ListItem from '@material-ui/core/ListItem';
4
+ import ListItemAvatar from '@material-ui/core/ListItemAvatar';
5
+ import ListItemText from '@material-ui/core/ListItemText';
6
+ import { makeStyles } from '@material-ui/core/styles';
7
+ import Skeleton from '@material-ui/lab/Skeleton';
8
+
9
+ const useStyles = makeStyles((_theme) => ({
10
+ skeleton: {
11
+ borderRadius: 30
12
+ }
13
+ }));
14
+ const VisitListItemSkeleton = () => {
15
+ const classes = useStyles();
16
+ return /* @__PURE__ */ React.createElement(ListItem, { disableGutters: true }, /* @__PURE__ */ React.createElement(ListItemAvatar, null, /* @__PURE__ */ React.createElement(
17
+ Skeleton,
18
+ {
19
+ className: classes.skeleton,
20
+ variant: "rect",
21
+ width: 50,
22
+ height: 24
23
+ }
24
+ )), /* @__PURE__ */ React.createElement(
25
+ ListItemText,
26
+ {
27
+ primary: /* @__PURE__ */ React.createElement(Skeleton, { variant: "text", width: "100%", height: 28 }),
28
+ disableTypography: true
29
+ }
30
+ ));
31
+ };
32
+ const VisitListSkeleton = ({
33
+ numVisitsOpen,
34
+ numVisitsTotal,
35
+ collapsed
36
+ }) => /* @__PURE__ */ React.createElement(React.Fragment, null, Array(numVisitsOpen).fill(null).map((_e, index) => /* @__PURE__ */ React.createElement(VisitListItemSkeleton, { key: index })), numVisitsTotal > numVisitsOpen && /* @__PURE__ */ React.createElement(Collapse, { in: !collapsed }, Array(numVisitsTotal - numVisitsOpen).fill(null).map((_e, index) => /* @__PURE__ */ React.createElement(VisitListItemSkeleton, { key: index }))));
37
+
38
+ export { VisitListSkeleton };
39
+ //# sourceMappingURL=VisitListSkeleton.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VisitListSkeleton.esm.js","sources":["../../../src/components/VisitList/VisitListSkeleton.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport Collapse from '@material-ui/core/Collapse';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemAvatar from '@material-ui/core/ListItemAvatar';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Skeleton from '@material-ui/lab/Skeleton';\n\nconst useStyles = makeStyles(_theme => ({\n skeleton: {\n borderRadius: 30,\n },\n}));\n\nconst VisitListItemSkeleton = () => {\n const classes = useStyles();\n\n return (\n <ListItem disableGutters>\n <ListItemAvatar>\n <Skeleton\n className={classes.skeleton}\n variant=\"rect\"\n width={50}\n height={24}\n />\n </ListItemAvatar>\n <ListItemText\n primary={<Skeleton variant=\"text\" width=\"100%\" height={28} />}\n disableTypography\n />\n </ListItem>\n );\n};\n\nexport const VisitListSkeleton = ({\n numVisitsOpen,\n numVisitsTotal,\n collapsed,\n}: {\n numVisitsOpen: number;\n numVisitsTotal: number;\n collapsed: boolean;\n}) => (\n <>\n {Array(numVisitsOpen)\n .fill(null)\n .map((_e, index) => (\n <VisitListItemSkeleton key={index} />\n ))}\n {numVisitsTotal > numVisitsOpen && (\n <Collapse in={!collapsed}>\n {Array(numVisitsTotal - numVisitsOpen)\n .fill(null)\n .map((_e, index) => (\n <VisitListItemSkeleton key={index} />\n ))}\n </Collapse>\n )}\n </>\n);\n"],"names":[],"mappings":";;;;;;;;AAwBA,MAAM,SAAA,GAAY,WAAW,CAAW,MAAA,MAAA;AAAA,EACtC,QAAU,EAAA;AAAA,IACR,YAAc,EAAA,EAAA;AAAA,GAChB;AACF,CAAE,CAAA,CAAA,CAAA;AAEF,MAAM,wBAAwB,MAAM;AAClC,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAE1B,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,cAAc,EAAA,IAAA,EAAA,sCACrB,cACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,WAAW,OAAQ,CAAA,QAAA;AAAA,MACnB,OAAQ,EAAA,MAAA;AAAA,MACR,KAAO,EAAA,EAAA;AAAA,MACP,MAAQ,EAAA,EAAA;AAAA,KAAA;AAAA,GAEZ,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,OAAA,sCAAU,QAAS,EAAA,EAAA,OAAA,EAAQ,QAAO,KAAM,EAAA,MAAA,EAAO,QAAQ,EAAI,EAAA,CAAA;AAAA,MAC3D,iBAAiB,EAAA,IAAA;AAAA,KAAA;AAAA,GAErB,CAAA,CAAA;AAEJ,CAAA,CAAA;AAEO,MAAM,oBAAoB,CAAC;AAAA,EAChC,aAAA;AAAA,EACA,cAAA;AAAA,EACA,SAAA;AACF,CAAA,+DAMK,KAAM,CAAA,aAAa,EACjB,IAAK,CAAA,IAAI,EACT,GAAI,CAAA,CAAC,EAAI,EAAA,KAAA,yCACP,qBAAsB,EAAA,EAAA,GAAA,EAAK,OAAO,CACpC,CAAA,EACF,iBAAiB,aAChB,oBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,EAAA,EAAI,CAAC,SACZ,EAAA,EAAA,KAAA,CAAM,iBAAiB,aAAa,CAAA,CAClC,KAAK,IAAI,CAAA,CACT,IAAI,CAAC,EAAA,EAAI,0BACP,KAAA,CAAA,aAAA,CAAA,qBAAA,EAAA,EAAsB,KAAK,KAAO,EAAA,CACpC,CACL,CAEJ;;;;"}
@@ -0,0 +1,62 @@
1
+ import React, { useEffect } from 'react';
2
+ import { useLocation } from 'react-router-dom';
3
+ import '@backstage/core-app-api';
4
+ import { visitsApiRef } from '../api/VisitsApi.esm.js';
5
+ import { useApi } from '@backstage/core-plugin-api';
6
+ import { stringifyEntityRef } from '@backstage/catalog-model';
7
+
8
+ const getToEntityRef = ({
9
+ rootPath = "catalog",
10
+ stringifyEntityRefImpl = stringifyEntityRef
11
+ } = {}) => ({ pathname }) => {
12
+ const regex = new RegExp(
13
+ `^/${rootPath}/(?<namespace>[^/]+)/(?<kind>[^/]+)/(?<name>[^/]+)`
14
+ );
15
+ const result = regex.exec(pathname);
16
+ if (!result || !(result == null ? void 0 : result.groups))
17
+ return void 0;
18
+ const entity = {
19
+ namespace: result.groups.namespace,
20
+ kind: result.groups.kind,
21
+ name: result.groups.name
22
+ };
23
+ return stringifyEntityRefImpl(entity);
24
+ };
25
+ const getVisitName = ({ rootPath = "catalog", document = global.document } = {}) => ({ pathname }) => {
26
+ const regex = new RegExp(
27
+ `^/${rootPath}/(?<namespace>[^/]+)/(?<kind>[^/]+)/(?<name>[^/]+)`
28
+ );
29
+ let result = regex.exec(pathname);
30
+ if (result && (result == null ? void 0 : result.groups))
31
+ return result.groups.name;
32
+ result = /^\/(?<name>[^\/]+)$/.exec(pathname);
33
+ if (result && (result == null ? void 0 : result.groups))
34
+ return result.groups.name;
35
+ return document.title;
36
+ };
37
+ const VisitListener = ({
38
+ children,
39
+ toEntityRef,
40
+ visitName
41
+ }) => {
42
+ const visitsApi = useApi(visitsApiRef);
43
+ const { pathname } = useLocation();
44
+ const toEntityRefImpl = toEntityRef != null ? toEntityRef : getToEntityRef();
45
+ const visitNameImpl = visitName != null ? visitName : getVisitName();
46
+ useEffect(() => {
47
+ const requestId = requestAnimationFrame(() => {
48
+ visitsApi.save({
49
+ visit: {
50
+ name: visitNameImpl({ pathname }),
51
+ pathname,
52
+ entityRef: toEntityRefImpl({ pathname })
53
+ }
54
+ });
55
+ });
56
+ return () => cancelAnimationFrame(requestId);
57
+ }, [visitsApi, pathname, toEntityRefImpl, visitNameImpl]);
58
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
59
+ };
60
+
61
+ export { VisitListener };
62
+ //# sourceMappingURL=VisitListener.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VisitListener.esm.js","sources":["../../src/components/VisitListener.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useEffect } from 'react';\n\nimport { useLocation } from 'react-router-dom';\n\nimport { visitsApiRef } from '../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\n\n/**\n * This function returns an implementation of toEntityRef which is responsible\n * for receiving a pathname and maybe returning an entityRef compatible with the\n * catalog-model.\n * By default this function uses the url root \"/catalog\" and the\n * stringifyEntityRef implementation from catalog-model.\n * Example:\n * const toEntityRef = getToEntityRef();\n * toEntityRef(\\{ pathname: \"/catalog/default/component/playback-order\" \\})\n * // returns \"component:default/playback-order\"\n */\nconst getToEntityRef =\n ({\n rootPath = 'catalog',\n stringifyEntityRefImpl = stringifyEntityRef,\n } = {}) =>\n ({ pathname }: { pathname: string }): string | undefined => {\n const regex = new RegExp(\n `^\\/${rootPath}\\/(?<namespace>[^\\/]+)\\/(?<kind>[^\\/]+)\\/(?<name>[^\\/]+)`,\n );\n const result = regex.exec(pathname);\n if (!result || !result?.groups) return undefined;\n const entity = {\n namespace: result.groups.namespace,\n kind: result.groups.kind,\n name: result.groups.name,\n };\n return stringifyEntityRefImpl(entity);\n };\n\n/**\n * @internal\n * This function returns an implementation of visitName which is responsible\n * for receiving a pathname and returning a string (name).\n */\nconst getVisitName =\n ({ rootPath = 'catalog', document = global.document } = {}) =>\n ({ pathname }: { pathname: string }) => {\n // If it is a catalog entity, get the name from the path\n const regex = new RegExp(\n `^\\/${rootPath}\\/(?<namespace>[^\\/]+)\\/(?<kind>[^\\/]+)\\/(?<name>[^\\/]+)`,\n );\n let result = regex.exec(pathname);\n if (result && result?.groups) return result.groups.name;\n\n // If it is a root pathname, get the name from there\n result = /^\\/(?<name>[^\\/]+)$/.exec(pathname);\n if (result && result?.groups) return result.groups.name;\n\n // Fallback to document title\n return document.title;\n };\n\n/**\n * @public\n * Component responsible for listening to location changes and calling\n * the visitsApi to save visits.\n */\nexport const VisitListener = ({\n children,\n toEntityRef,\n visitName,\n}: {\n children?: React.ReactNode;\n toEntityRef?: ({ pathname }: { pathname: string }) => string | undefined;\n visitName?: ({ pathname }: { pathname: string }) => string;\n}): JSX.Element => {\n const visitsApi = useApi(visitsApiRef);\n const { pathname } = useLocation();\n const toEntityRefImpl = toEntityRef ?? getToEntityRef();\n const visitNameImpl = visitName ?? getVisitName();\n useEffect(() => {\n // Wait for the browser to finish with paint with the assumption react\n // has finished with dom reconciliation.\n const requestId = requestAnimationFrame(() => {\n visitsApi.save({\n visit: {\n name: visitNameImpl({ pathname }),\n pathname,\n entityRef: toEntityRefImpl({ pathname }),\n },\n });\n });\n return () => cancelAnimationFrame(requestId);\n }, [visitsApi, pathname, toEntityRefImpl, visitNameImpl]);\n\n return <>{children}</>;\n};\n"],"names":[],"mappings":";;;;;;;AAkCA,MAAM,iBACJ,CAAC;AAAA,EACC,QAAW,GAAA,SAAA;AAAA,EACX,sBAAyB,GAAA,kBAAA;AAC3B,CAAA,GAAI,EAAC,KACL,CAAC,EAAE,UAAyD,KAAA;AAC1D,EAAA,MAAM,QAAQ,IAAI,MAAA;AAAA,IAChB,KAAM,QAAQ,CAAA,kDAAA,CAAA;AAAA,GAChB,CAAA;AACA,EAAM,MAAA,MAAA,GAAS,KAAM,CAAA,IAAA,CAAK,QAAQ,CAAA,CAAA;AAClC,EAAI,IAAA,CAAC,MAAU,IAAA,EAAC,MAAQ,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,MAAA,CAAA,MAAA,CAAA;AAAQ,IAAO,OAAA,KAAA,CAAA,CAAA;AACvC,EAAA,MAAM,MAAS,GAAA;AAAA,IACb,SAAA,EAAW,OAAO,MAAO,CAAA,SAAA;AAAA,IACzB,IAAA,EAAM,OAAO,MAAO,CAAA,IAAA;AAAA,IACpB,IAAA,EAAM,OAAO,MAAO,CAAA,IAAA;AAAA,GACtB,CAAA;AACA,EAAA,OAAO,uBAAuB,MAAM,CAAA,CAAA;AACtC,CAAA,CAAA;AAOF,MAAM,YACJ,GAAA,CAAC,EAAE,QAAA,GAAW,WAAW,QAAW,GAAA,MAAA,CAAO,QAAS,EAAA,GAAI,EAAC,KACzD,CAAC,EAAE,UAAqC,KAAA;AAEtC,EAAA,MAAM,QAAQ,IAAI,MAAA;AAAA,IAChB,KAAM,QAAQ,CAAA,kDAAA,CAAA;AAAA,GAChB,CAAA;AACA,EAAI,IAAA,MAAA,GAAS,KAAM,CAAA,IAAA,CAAK,QAAQ,CAAA,CAAA;AAChC,EAAA,IAAI,WAAU,MAAQ,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,MAAA,CAAA,MAAA,CA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omepageGrid } from './CustomHomepage/CustomHomepageGrid.esm.js';
3
+ export { VisitListener } from './VisitListener.esm.js';
4
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,7 @@
1
+ import { createCardExtension as createCardExtension$1, SettingsModal as SettingsModal$1 } from '@backstage/plugin-home-react';
2
+
3
+ const createCardExtension = createCardExtension$1;
4
+ const SettingsModal = SettingsModal$1;
5
+
6
+ export { SettingsModal, createCardExtension };
7
+ //# sourceMappingURL=deprecated.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecated.esm.js","sources":["../src/deprecated.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createCardExtension as homeReactCreateCardExtension,\n CardConfig as homeReactCardConfig,\n CardExtensionProps as homeReactCardExtensionProps,\n CardLayout as homeReactCardLayout,\n CardSettings as homeReactCardSettings,\n ComponentParts as homeReactComponentParts,\n ComponentRenderer as homeReactComponentRenderer,\n RendererProps as homeReactRendererProps,\n SettingsModal as homeReactSettingsModal,\n} from '@backstage/plugin-home-react';\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport const createCardExtension = homeReactCreateCardExtension;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type CardExtensionProps<T> = homeReactCardExtensionProps<T>;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type CardLayout = homeReactCardLayout;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type CardSettings = homeReactCardSettings;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type CardConfig = homeReactCardConfig;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type ComponentParts = homeReactComponentParts;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type ComponentRenderer = homeReactComponentRenderer;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport type RendererProps = homeReactRendererProps;\n\n/**\n * @public\n * @deprecated Import from `@backstage/plugin-home-react` instead\n */\nexport const SettingsModal = homeReactSettingsModal;\n"],"names":["homeReactCreateCardExtension","homeReactSettingsModal"],"mappings":";;AAgCO,MAAM,mBAAsB,GAAAA,sBAAA;AAgD5B,MAAM,aAAgB,GAAAC;;;;"}
@@ -9,4 +9,4 @@ const CompanyLogo = (props) => {
9
9
  };
10
10
 
11
11
  export { CompanyLogo };
12
- //# sourceMappingURL=index-FqRX6ImF.esm.js.map
12
+ //# sourceMappingURL=CompanyLogo.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-FqRX6ImF.esm.js","sources":["../../src/homePageComponents/CompanyLogo/CompanyLogo.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Typography from '@material-ui/core/Typography';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport React from 'react';\n\ntype CompanyLogoProps = {\n logo?: React.ReactNode;\n className?: string;\n};\n\n/**\n * A component to display a company logo for the user.\n *\n * @public\n */\nexport const CompanyLogo = (props: CompanyLogoProps) => {\n const { logo, className } = props;\n const configApi = useApi(configApiRef);\n\n return (\n <div className={className}>\n {logo ? (\n <>{logo}</>\n ) : (\n <Typography variant=\"h1\">{configApi.getString('app.title')}</Typography>\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;AA6Ba,MAAA,WAAA,GAAc,CAAC,KAA4B,KAAA;AACtD,EAAM,MAAA,EAAE,IAAM,EAAA,SAAA,EAAc,GAAA,KAAA,CAAA;AAC5B,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA,CAAA;AAErC,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,SACF,EAAA,EAAA,IAAA,6DACI,IAAK,CAAA,mBAEP,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAQ,IAAM,EAAA,EAAA,SAAA,CAAU,SAAU,CAAA,WAAW,CAAE,CAE/D,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"CompanyLogo.esm.js","sources":["../../../src/homePageComponents/CompanyLogo/CompanyLogo.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Typography from '@material-ui/core/Typography';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport React from 'react';\n\ntype CompanyLogoProps = {\n logo?: React.ReactNode;\n className?: string;\n};\n\n/**\n * A component to display a company logo for the user.\n *\n * @public\n */\nexport const CompanyLogo = (props: CompanyLogoProps) => {\n const { logo, className } = props;\n const configApi = useApi(configApiRef);\n\n return (\n <div className={className}>\n {logo ? (\n <>{logo}</>\n ) : (\n <Typography variant=\"h1\">{configApi.getString('app.title')}</Typography>\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;AA6Ba,MAAA,WAAA,GAAc,CAAC,KAA4B,KAAA;AACtD,EAAM,MAAA,EAAE,IAAM,EAAA,SAAA,EAAc,GAAA,KAAA,CAAA;AAC5B,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA,CAAA;AAErC,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,SACF,EAAA,EAAA,IAAA,6DACI,IAAK,CAAA,mBAEP,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAQ,IAAM,EAAA,EAAA,SAAA,CAAU,SAAU,CAAA,WAAW,CAAE,CAE/D,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,2 @@
1
+ export { CompanyLogo } from './CompanyLogo.esm.js';
2
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -94,4 +94,4 @@ const Content = (props) => {
94
94
  };
95
95
 
96
96
  export { Content };
97
- //# sourceMappingURL=index-D7JTE1IL.esm.js.map
97
+ //# sourceMappingURL=Content.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Content.esm.js","sources":["../../../src/homePageComponents/FeaturedDocsCard/Content.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport {\n LinkButton,\n EmptyState,\n Link,\n Progress,\n ErrorPanel,\n} from '@backstage/core-components';\nimport {\n catalogApiRef,\n CatalogApi,\n EntityDisplayName,\n} from '@backstage/plugin-catalog-react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { EntityFilterQuery } from '@backstage/catalog-client';\n\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\n\n/**\n * Props customizing the <FeaturedDocsCard/> component.\n *\n * @public\n */\nexport type FeaturedDocsCardProps = {\n /** The entity filter used to display only the intended item/s */\n filter: EntityFilterQuery;\n /** An optional ReactNode for empty states */\n emptyState?: React.JSX.Element;\n /** An optional linkDestination to set for the Featured Doc */\n linkDestination?: string;\n /** An optional limit to set for link destination */\n responseLimit?: number;\n /** An optional string to customize sublink text */\n subLinkText?: string;\n};\n\nconst useStyles = makeStyles(\n theme => ({\n docDescription: {\n fontSize: theme.typography.body1.fontSize,\n fontWeight: theme.typography.body1.fontWeight,\n marginBottom: theme.spacing(2),\n marginTop: theme.spacing(2),\n },\n docSubLink: {\n fontSize: theme.typography.subtitle1.fontSize,\n fontWeight: theme.typography.subtitle1.fontWeight,\n lineHeight: theme.typography.subtitle1.lineHeight,\n },\n docsTitleLink: {\n fontSize: theme.typography.h6.fontSize,\n fontWeight: theme.typography.h6.fontWeight,\n lineHeight: theme.typography.h6.lineHeight,\n },\n }),\n { name: 'HomeFeaturedDocsCard' },\n);\n\n/**\n * A component to display specific Featured Docs.\n *\n * @public\n */\nexport const Content = (props: FeaturedDocsCardProps): JSX.Element => {\n const { emptyState, filter, linkDestination, responseLimit, subLinkText } =\n props;\n const linkText = subLinkText || 'LEARN MORE';\n const styles = useStyles();\n const catalogApi: CatalogApi = useApi(catalogApiRef);\n const {\n value: entities,\n loading,\n error,\n } = useAsync(async () => {\n const response = await catalogApi.getEntities({\n filter: filter,\n limit: responseLimit || 10,\n });\n return response.items;\n });\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n return entities?.length ? (\n <>\n {entities.map(d => (\n <div\n key={`${d.metadata.name}-${d.kind}-${d.metadata.namespace}`}\n data-testid=\"docs-card-content\"\n >\n <Link\n className={styles.docsTitleLink}\n data-testid=\"docs-card-title\"\n to={\n linkDestination ||\n `/docs/${d.metadata.namespace || 'default'}/${d.kind}/${\n d.metadata.name\n }/`\n }\n >\n <EntityDisplayName entityRef={stringifyEntityRef(d)} />\n </Link>\n {d.metadata.description && (\n <Typography className={styles.docDescription}>\n {d.metadata.description}\n </Typography>\n )}\n <Link\n className={styles.docSubLink}\n data-testid=\"docs-card-sub-link\"\n to={\n linkDestination ||\n `/docs/${d.metadata.namespace || 'default'}/${d.kind}/${\n d.metadata.name\n }/`\n }\n >\n {linkText}\n </Link>\n </div>\n ))}\n </>\n ) : (\n emptyState || (\n <EmptyState\n missing=\"data\"\n title=\"No documents to show\"\n description=\"Create your own document. Check out our Getting Started Information\"\n action={\n <LinkButton\n to=\"https://backstage.io/docs/features/techdocs/getting-started\"\n variant=\"contained\"\n >\n DOCS\n </LinkButton>\n }\n />\n )\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAuDA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,cAAgB,EAAA;AAAA,MACd,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,KAAM,CAAA,QAAA;AAAA,MACjC,UAAA,EAAY,KAAM,CAAA,UAAA,CAAW,KAAM,CAAA,UAAA;AAAA,MACnC,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MAC7B,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,KAC5B;AAAA,IACA,UAAY,EAAA;AAAA,MACV,QAAA,EAAU,KAAM,CAAA,UAAA,CAAW,SAAU,CAAA,QAAA;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A,IACA,CAAS,MAAA,EAAA,CAAA,CAAE,QAAS,CAAA,SAAA,IAAa,SAAS,CAAA,CAAA,EAAI,CAAE,CAAA,IAAI,CAClD,CAAA,EAAA,CAAA,CAAE,SAAS,IACb,CAAA,CAAA,CAAA;AAAA,OAAA;AAAA,MAGD,QAAA;AAAA,KACH;AAAA,GAEH,CACH,CAAA,GAEA,UACE,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,MAAA;AAAA,MACR,KAAM,EAAA,sBAAA;AAAA,MACN,WAAY,EAAA,qEAAA;AAAA,MACZ,MACE,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,EAAG,EAAA,6DAAA;AAAA,UACH,OAAQ,EAAA,WAAA;AAAA,SAAA;AAAA,QACT,MAAA;AAAA,OAED;AAAA,KAAA;AAAA,GAEJ,CAAA;AAGN;;;;"}
@@ -0,0 +1,2 @@
1
+ export { Content } from './Content.esm.js';
2
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -65,4 +65,4 @@ const HeaderWorldClock = (props) => {
65
65
  };
66
66
 
67
67
  export { HeaderWorldClock };
68
- //# sourceMappingURL=index-BvvJGS3L.esm.js.map
68
+ //# sourceMappingURL=HeaderWorldClock.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeaderWorldClock.esm.js","sources":["../../../src/homePageComponents/HeaderWorldClock/HeaderWorldClock.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { HeaderLabel } from '@backstage/core-components';\n\nconst timeFormat: Intl.DateTimeFormatOptions = {\n hour: '2-digit',\n minute: '2-digit',\n};\n\ntype TimeObj = {\n label: string;\n value: string;\n dateTime: string;\n};\n\n/** @public */\nexport type ClockConfig = {\n label: string;\n timeZone: string;\n};\n\nfunction getTimes(\n clockConfigs: ClockConfig[],\n customTimeFormat?: Intl.DateTimeFormatOptions,\n) {\n const d = new Date();\n const lang = window.navigator.language;\n\n const clocks: TimeObj[] = [];\n\n if (!clockConfigs) {\n return clocks;\n }\n\n for (const clockConfig of clockConfigs) {\n let label = clockConfig.label;\n\n const options: Intl.DateTimeFormatOptions = {\n timeZone: clockConfig.timeZone,\n ...(customTimeFormat ?? timeFormat),\n };\n\n try {\n new Date().toLocaleString(lang, options);\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn(\n `The timezone ${options.timeZone} is invalid. Defaulting to GMT`,\n );\n options.timeZone = 'GMT';\n label = 'GMT';\n }\n\n const value = d.toLocaleTimeString(lang, options);\n const dateTime = d.toLocaleTimeString(lang, {\n timeZone: options.timeZone,\n hour: '2-digit',\n minute: '2-digit',\n hour12: false,\n });\n clocks.push({ label, value, dateTime });\n }\n\n return clocks;\n}\n\n/**\n * A component to display a configurable list of clocks for various time zones.\n *\n * @example\n * Here's a simple example:\n * ```\n * // This will give you a clock for the time zone that Stockholm is in\n * // you can add more than one but keep in mind space may be limited\n * const clockConfigs: ClockConfig[] = [\n * {\n * label: 'STO',\n * timeZone: 'Europe/Stockholm',\n * },\n * ];\n *\n * // Setting hour12 to false will make all the clocks show in the 24hr format\n * const timeFormat: Intl.DateTimeFormatOptions = {\n * hour: '2-digit',\n * minute: '2-digit',\n * hour12: false,\n * };\n *\n * // Here is the component in use:\n * <HeaderWorldClock\n * clockConfigs={clockConfigs}\n * customTimeFormat={timeFormat}\n * />\n * ```\n *\n * @public\n */\nexport const HeaderWorldClock = (props: {\n clockConfigs: ClockConfig[];\n customTimeFormat?: Intl.DateTimeFormatOptions;\n}) => {\n const { clockConfigs, customTimeFormat } = props;\n\n const defaultTimes: TimeObj[] = [];\n const [clocks, setTimes] = React.useState(defaultTimes);\n\n React.useEffect(() => {\n setTimes(getTimes(clockConfigs, customTimeFormat));\n\n const intervalId = setInterval(() => {\n setTimes(getTimes(clockConfigs, customTimeFormat));\n }, 1000);\n\n return () => {\n clearInterval(intervalId);\n };\n }, [clockConfigs, customTimeFormat]);\n\n if (clocks.length !== 0) {\n return (\n <>\n {clocks.map(clock => (\n <HeaderLabel\n key={clock.label}\n label={clock.label}\n value={<time dateTime={clock.dateTime}>{clock.value}</time>}\n />\n ))}\n </>\n );\n }\n return null;\n};\n"],"names":[],"mappings":";;;AAmBA,MAAM,UAAyC,GAAA;AAAA,EAC7C,IAAM,EAAA,SAAA;AAAA,EACN,MAAQ,EAAA,SAAA;AACV,CAAA,CAAA;AAcA,SAAS,QAAA,CACP,cACA,gBACA,EAAA;AACA,EAAM,MAAA,CAAA,uBAAQ,IAAK,EAAA,CAAA;AACnB,EAAM,MAAA,IAAA,GAAO,OAAO,SAAU,CAAA,QAAA,CAAA;AAE9B,EAAA,MAAM,SAAoB,EAAC,CAAA;AAE3B,EAAA,IAAI,CAAC,YAAc,EAAA;AACjB,IAAO,OAAA,MAAA,CAAA;AAAA,GACT;AAEA,EAAA,KAAA,MAAW,eAAe,YAAc,EAAA;AACtC,IAAA,IAAI,QAAQ,WAAY,CAAA,KAAA,CAAA;AAExB,IAAA,MAAM,OAAsC,GAAA;AAAA,MAC1C,UAAU,WAAY,CAAA,QAAA;AAAA,MACtB,GAAI,gBAAoB,IAAA,IAAA,GAAA,gBAAA,GAAA,UAAA;AAAA,KAC1B,CAAA;AAEA,IAAI,IAAA;AACF,MAAA,iBAAA,IAAI,IAAK,EAAA,EAAE,cAAe,CAAA,IAAA,EAAM,OAAO,CAAA,CAAA;AAA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,CAAA,CAAA;AAAA,KAC1B,CAAA;AAAA,GACC,EAAA,CAAC,YAAc,EAAA,gBAAgB,CAAC,CAAA,CAAA;AAEnC,EAAI,IAAA,MAAA,CAAO,WAAW,CAAG,EAAA;AACvB,IACE,uBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EACG,MAAO,CAAA,GAAA,CAAI,CACV,KAAA,qBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,KAAK,KAAM,CAAA,KAAA;AAAA,QACX,OAAO,KAAM,CAAA,KAAA;AAAA,QACb,uBAAQ,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAK,UAAU,KAAM,CAAA,QAAA,EAAA,EAAW,MAAM,KAAM,CAAA;AAAA,OAAA;AAAA,KAEvD,CACH,CAAA,CAAA;AAAA,GAEJ;AACA,EAAO,OAAA,IAAA,CAAA;AACT;;;;"}
@@ -0,0 +1,2 @@
1
+ export { HeaderWorldClock } from './HeaderWorldClock.esm.js';
2
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import Button from '@material-ui/core/Button';
3
+ import { useRandomJoke } from './Context.esm.js';
4
+
5
+ const Actions = () => {
6
+ const { rerollJoke } = useRandomJoke();
7
+ return /* @__PURE__ */ React.createElement(Button, { variant: "contained", color: "primary", onClick: () => rerollJoke() }, "Reroll");
8
+ };
9
+
10
+ export { Actions };
11
+ //# sourceMappingURL=Actions.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Actions.esm.js","sources":["../../../src/homePageComponents/RandomJoke/Actions.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\n\nimport Button from '@material-ui/core/Button';\nimport { useRandomJoke } from './Context';\n\nexport const Actions = () => {\n const { rerollJoke } = useRandomJoke();\n return (\n <Button variant=\"contained\" color=\"primary\" onClick={() => rerollJoke()}>\n Reroll\n </Button>\n );\n};\n"],"names":[],"mappings":";;;;AAqBO,MAAM,UAAU,MAAM;AAC3B,EAAM,MAAA,EAAE,UAAW,EAAA,GAAI,aAAc,EAAA,CAAA;AACrC,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,MAAO,EAAA,EAAA,OAAA,EAAQ,WAAY,EAAA,KAAA,EAAM,WAAU,OAAS,EAAA,MAAM,UAAW,EAAA,EAAA,EAAG,QAEzE,CAAA,CAAA;AAEJ;;;;"}