@backstage/plugin-techdocs-module-addons-contrib 1.1.15 → 1.1.16-next.2

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,11 +1,40 @@
1
1
  # @backstage/plugin-techdocs-module-addons-contrib
2
2
 
3
- ## 1.1.15
3
+ ## 1.1.16-next.2
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - 720a2f9: Updated dependency `git-url-parse` to `^15.0.0`.
8
+ - e8b4966: Use more of the available space for the navigation sidebar.
7
9
  - Updated dependencies
8
- - @backstage/integration-react@1.1.32
10
+ - @backstage/integration@1.15.1-next.1
11
+ - @backstage/core-components@0.15.1-next.2
12
+ - @backstage/core-plugin-api@1.10.0-next.1
13
+ - @backstage/integration-react@1.2.0-next.2
14
+ - @backstage/plugin-techdocs-react@1.2.9-next.2
15
+
16
+ ## 1.1.16-next.1
17
+
18
+ ### Patch Changes
19
+
20
+ - e969dc7: Move `@types/react` to a peer dependency.
21
+ - Updated dependencies
22
+ - @backstage/core-components@0.15.1-next.1
23
+ - @backstage/integration-react@1.2.0-next.1
24
+ - @backstage/core-plugin-api@1.10.0-next.1
25
+ - @backstage/plugin-techdocs-react@1.2.9-next.1
26
+ - @backstage/integration@1.15.1-next.0
27
+
28
+ ## 1.1.15-next.0
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies
33
+ - @backstage/core-components@0.15.1-next.0
34
+ - @backstage/core-plugin-api@1.10.0-next.0
35
+ - @backstage/integration@1.15.0
36
+ - @backstage/integration-react@1.1.32-next.0
37
+ - @backstage/plugin-techdocs-react@1.2.9-next.0
9
38
 
10
39
  ## 1.1.14
11
40
 
@@ -10,8 +10,10 @@ const EXPANDABLE_NAVIGATION_LOCAL_STORAGE = "@backstage/techdocs-addons/nav-expa
10
10
  const StyledButton = withStyles({
11
11
  root: {
12
12
  position: "absolute",
13
- left: "220px",
13
+ left: "13.7rem",
14
+ // Sidebar inner width (15.1em) minus the different margins/paddings
14
15
  top: "19px",
16
+ zIndex: 2,
15
17
  padding: 0,
16
18
  minWidth: 0
17
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ExpandableNavigation.esm.js","sources":["../../src/ExpandableNavigation/ExpandableNavigation.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, { useEffect, useCallback, useState } from 'react';\nimport { useLocalStorageValue } from '@react-hookz/web';\nimport { Button, withStyles } from '@material-ui/core';\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\n\nimport { useShadowRootElements } from '@backstage/plugin-techdocs-react';\n\nconst NESTED_LIST_TOGGLE = '.md-nav__item--nested .md-toggle';\n\nconst EXPANDABLE_NAVIGATION_LOCAL_STORAGE =\n '@backstage/techdocs-addons/nav-expanded';\n\nconst StyledButton = withStyles({\n root: {\n position: 'absolute',\n left: '220px',\n top: '19px',\n padding: 0,\n minWidth: 0,\n },\n})(Button);\n\nconst CollapsedIcon = withStyles({\n root: {\n height: '20px',\n width: '20px',\n },\n})(ChevronRightIcon);\n\nconst ExpandedIcon = withStyles({\n root: {\n height: '20px',\n width: '20px',\n },\n})(ExpandMoreIcon);\n\ntype expandableNavigationLocalStorage = {\n expandAllNestedNavs: boolean;\n};\n\n/**\n * Show expand/collapse navigation button next to site name in main\n * navigation menu if documentation site has nested navigation.\n */\nexport const ExpandableNavigationAddon = () => {\n const defaultValue = { expandAllNestedNavs: false };\n const { value: expanded, set: setExpanded } =\n useLocalStorageValue<expandableNavigationLocalStorage>(\n EXPANDABLE_NAVIGATION_LOCAL_STORAGE,\n { defaultValue },\n );\n const [hasNavSubLevels, setHasNavSubLevels] = useState<boolean>(false);\n\n const [...checkboxToggles] = useShadowRootElements<HTMLInputElement>([\n NESTED_LIST_TOGGLE,\n ]);\n\n const shouldToggle = useCallback(\n (item: HTMLInputElement) => {\n const isExpanded = item.checked;\n const shouldExpand = expanded?.expandAllNestedNavs;\n\n // Is collapsed but should expand\n if (shouldExpand && !isExpanded) {\n return true;\n }\n\n // Is expanded but should collapse\n if (!shouldExpand && isExpanded) {\n return true;\n }\n\n return false;\n },\n [expanded],\n );\n\n useEffect(() => {\n // There is no nested navs\n if (!checkboxToggles?.length) return;\n\n setHasNavSubLevels(true);\n checkboxToggles.forEach(item => {\n if (shouldToggle(item)) item.click();\n });\n }, [expanded, shouldToggle, checkboxToggles]);\n\n const handleState = () => {\n setExpanded(prevState => ({\n expandAllNestedNavs: !prevState?.expandAllNestedNavs,\n }));\n };\n\n return (\n <>\n {hasNavSubLevels ? (\n <StyledButton\n size=\"small\"\n onClick={handleState}\n aria-label={\n expanded?.expandAllNestedNavs ? 'collapse-nav' : 'expand-nav'\n }\n >\n {expanded?.expandAllNestedNavs ? <ExpandedIcon /> : <CollapsedIcon />}\n </StyledButton>\n ) : null}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAwBA,MAAM,kBAAqB,GAAA,kCAAA,CAAA;AAE3B,MAAM,mCACJ,GAAA,yCAAA,CAAA;AAEF,MAAM,eAAe,UAAW,CAAA;AAAA,EAC9B,IAAM,EAAA;AAAA,IACJ,QAAU,EAAA,UAAA;AAAA,IACV,IAAM,EAAA,OAAA;AAAA,IACN,GAAK,EAAA,MAAA;AAAA,IACL,OAAS,EAAA,CAAA;AAAA,IACT,QAAU,EAAA,CAAA;AAAA,GACZ;AACF,CAAC,EAAE,MAAM,CAAA,CAAA;AAET,MAAM,gBAAgB,UAAW,CAAA;AAAA,EAC/B,IAAM,EAAA;AAAA,IACJ,MAAQ,EAAA,MAAA;AAAA,IACR,KAAO,EAA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QAAQ,CAAQ,IAAA,KAAA;AAC9B,MAAA,IAAI,YAAa,CAAA,IAAI,CAAG,EAAA,IAAA,CAAK,KAAM,EAAA,CAAA;AAAA,KACpC,CAAA,CAAA;AAAA,GACA,EAAA,CAAC,QAAU,EAAA,YAAA,EAAc,eAAe,CAAC,CAAA,CAAA;AAE5C,EAAA,MAAM,cAAc,MAAM;AACxB,IAAA,WAAA,CAAY,CAAc,SAAA,MAAA;AAAA,MACxB,mBAAA,EAAqB,CAAC,SAAW,EAAA,mBAAA;AAAA,KACjC,CAAA,CAAA,CAAA;AAAA,GACJ,CAAA;AAEA,EAAA,iEAEK,eACC,mBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,OAAA;AAAA,MACL,OAAS,EAAA,WAAA;AAAA,MACT,YAAA,EACE,QAAU,EAAA,mBAAA,GAAsB,cAAiB,GAAA,YAAA;AAAA,KAAA;AAAA,IAGlD,UAAU,mBAAsB,mBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,IAAA,CAAA,uCAAM,aAAc,EAAA,IAAA,CAAA;AAAA,MAEnE,IACN,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ExpandableNavigation.esm.js","sources":["../../src/ExpandableNavigation/ExpandableNavigation.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, { useEffect, useCallback, useState } from 'react';\nimport { useLocalStorageValue } from '@react-hookz/web';\nimport { Button, withStyles } from '@material-ui/core';\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\n\nimport { useShadowRootElements } from '@backstage/plugin-techdocs-react';\n\nconst NESTED_LIST_TOGGLE = '.md-nav__item--nested .md-toggle';\n\nconst EXPANDABLE_NAVIGATION_LOCAL_STORAGE =\n '@backstage/techdocs-addons/nav-expanded';\n\nconst StyledButton = withStyles({\n root: {\n position: 'absolute',\n left: '13.7rem', // Sidebar inner width (15.1em) minus the different margins/paddings\n top: '19px',\n zIndex: 2,\n padding: 0,\n minWidth: 0,\n },\n})(Button);\n\nconst CollapsedIcon = withStyles({\n root: {\n height: '20px',\n width: '20px',\n },\n})(ChevronRightIcon);\n\nconst ExpandedIcon = withStyles({\n root: {\n height: '20px',\n width: '20px',\n },\n})(ExpandMoreIcon);\n\ntype expandableNavigationLocalStorage = {\n expandAllNestedNavs: boolean;\n};\n\n/**\n * Show expand/collapse navigation button next to site name in main\n * navigation menu if documentation site has nested navigation.\n */\nexport const ExpandableNavigationAddon = () => {\n const defaultValue = { expandAllNestedNavs: false };\n const { value: expanded, set: setExpanded } =\n useLocalStorageValue<expandableNavigationLocalStorage>(\n EXPANDABLE_NAVIGATION_LOCAL_STORAGE,\n { defaultValue },\n );\n const [hasNavSubLevels, setHasNavSubLevels] = useState<boolean>(false);\n\n const [...checkboxToggles] = useShadowRootElements<HTMLInputElement>([\n NESTED_LIST_TOGGLE,\n ]);\n\n const shouldToggle = useCallback(\n (item: HTMLInputElement) => {\n const isExpanded = item.checked;\n const shouldExpand = expanded?.expandAllNestedNavs;\n\n // Is collapsed but should expand\n if (shouldExpand && !isExpanded) {\n return true;\n }\n\n // Is expanded but should collapse\n if (!shouldExpand && isExpanded) {\n return true;\n }\n\n return false;\n },\n [expanded],\n );\n\n useEffect(() => {\n // There is no nested navs\n if (!checkboxToggles?.length) return;\n\n setHasNavSubLevels(true);\n checkboxToggles.forEach(item => {\n if (shouldToggle(item)) item.click();\n });\n }, [expanded, shouldToggle, checkboxToggles]);\n\n const handleState = () => {\n setExpanded(prevState => ({\n expandAllNestedNavs: !prevState?.expandAllNestedNavs,\n }));\n };\n\n return (\n <>\n {hasNavSubLevels ? (\n <StyledButton\n size=\"small\"\n onClick={handleState}\n aria-label={\n expanded?.expandAllNestedNavs ? 'collapse-nav' : 'expand-nav'\n }\n >\n {expanded?.expandAllNestedNavs ? <ExpandedIcon /> : <CollapsedIcon />}\n </StyledButton>\n ) : null}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAwBA,MAAM,kBAAqB,GAAA,kCAAA,CAAA;AAE3B,MAAM,mCACJ,GAAA,yCAAA,CAAA;AAEF,MAAM,eAAe,UAAW,CAAA;AAAA,EAC9B,IAAM,EAAA;AAAA,IACJ,QAAU,EAAA,UAAA;AAAA,IACV,IAAM,EAAA,SAAA;AAAA;AAAA,IACN,GAAK,EAAA,MAAA;AAAA,IACL,MAAQ,EAAA,CAAA;AAAA,IACR,OAAS,EAAA,CAAA;AAAA,IACT,QAAU,EAAA,CAAA;AAAA,GACZ;AACF,CAAC,EAAE,MAAM,CAAA,CAAA;AAET,MAAM,gBAAgB,UAAW,CAAA;AAAA,EAC/B,IAAM,EAAA;AAAA,IACJ,MAAQ,EAAA,MAAA;AAAA,IACR,KAAO,EAAA,MAAA;AAAA,GACT;AACF,CAAC,EAAE,gBAAgB,CAAA,CAAA;AAEnB,MAAM,eAAe,UAAW,CAAA;AAAA,EAC9B,IAAM,EAAA;AAAA,IACJ,MAAQ,EAAA,MAAA;AAAA,IACR,KAAO,EAAA,MAAA;AAAA,GACT;AACF,CAAC,EAAE,cAAc,CAAA,CAAA;AAUV,MAAM,4BAA4B,MAAM;AAC7C,EAAM,MAAA,YAAA,GAAe,EAAE,mBAAA,EAAqB,KAAM,EAAA,CAAA;AAClD,EAAA,MAAM,EAAE,KAAA,EAAO,QAAU,EAAA,GAAA,EAAK,aAC5B,GAAA,oBAAA;AAAA,IACE,mCAAA;AAAA,IACA,EAAE,YAAa,EAAA;AAAA,GACjB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AAAA,MACC,IAAK,EAAA,OAAA;AAAA,MACL,OAAS,EAAA,WAAA;AAAA,MACT,YAAA,EACE,QAAU,EAAA,mBAAA,GAAsB,cAAiB,GAAA,YAAA;AAAA,KAAA;AAAA,IAGlD,UAAU,mBAAsB,mBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,IAAA,CAAA,uCAAM,aAAc,EAAA,IAAA,CAAA;AAAA,MAEnE,IACN,CAAA,CAAA;AAEJ;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-techdocs-module-addons-contrib",
3
- "version": "1.1.15",
3
+ "version": "1.1.16-next.2",
4
4
  "description": "Plugin module for contributed TechDocs Addons",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin-module",
@@ -39,30 +39,39 @@
39
39
  "test": "backstage-cli package test"
40
40
  },
41
41
  "dependencies": {
42
- "@backstage/core-components": "^0.15.0",
43
- "@backstage/core-plugin-api": "^1.9.4",
44
- "@backstage/integration": "^1.15.0",
45
- "@backstage/integration-react": "^1.1.32",
46
- "@backstage/plugin-techdocs-react": "^1.2.8",
42
+ "@backstage/core-components": "0.15.1-next.2",
43
+ "@backstage/core-plugin-api": "1.10.0-next.1",
44
+ "@backstage/integration": "1.15.1-next.1",
45
+ "@backstage/integration-react": "1.2.0-next.2",
46
+ "@backstage/plugin-techdocs-react": "1.2.9-next.2",
47
47
  "@material-ui/core": "^4.12.2",
48
48
  "@material-ui/icons": "^4.9.1",
49
49
  "@react-hookz/web": "^24.0.0",
50
- "git-url-parse": "^14.0.0",
50
+ "git-url-parse": "^15.0.0",
51
51
  "photoswipe": "^5.3.7"
52
52
  },
53
53
  "devDependencies": {
54
- "@backstage/cli": "^0.27.1",
55
- "@backstage/plugin-techdocs-addons-test-utils": "^1.0.39",
56
- "@backstage/test-utils": "^1.6.0",
54
+ "@backstage/cli": "0.28.0-next.2",
55
+ "@backstage/plugin-techdocs-addons-test-utils": "1.0.40-next.2",
56
+ "@backstage/test-utils": "1.6.1-next.2",
57
57
  "@testing-library/dom": "^10.0.0",
58
58
  "@testing-library/jest-dom": "^6.0.0",
59
59
  "@testing-library/react": "^16.0.0",
60
- "@types/react": "^16.13.1 || ^17.0.0"
60
+ "@types/react": "^18.0.0",
61
+ "react": "^18.0.2",
62
+ "react-dom": "^18.0.2",
63
+ "react-router-dom": "^6.3.0"
61
64
  },
62
65
  "peerDependencies": {
66
+ "@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
63
67
  "react": "^16.13.1 || ^17.0.0 || ^18.0.0",
64
68
  "react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
65
69
  "react-router-dom": "6.0.0-beta.0 || ^6.3.0"
66
70
  },
71
+ "peerDependenciesMeta": {
72
+ "@types/react": {
73
+ "optional": true
74
+ }
75
+ },
67
76
  "module": "./dist/index.esm.js"
68
77
  }