@teambit/sidebar 0.0.684 → 0.0.687
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/ui/side-bar/side-bar.js +1 -2
- package/dist/ui/side-bar/side-bar.js.map +1 -1
- package/package-tar/teambit-sidebar-0.0.687.tgz +0 -0
- package/package.json +7 -7
- package/{preview-1647973488567.js → preview-1648130327832.js} +0 -0
- package/ui/side-bar/side-bar.tsx +0 -1
- package/package-tar/teambit-sidebar-0.0.684.tgz +0 -0
|
@@ -138,8 +138,7 @@ function SideBar(_ref) {
|
|
|
138
138
|
key: drawer.id,
|
|
139
139
|
name: drawer.name,
|
|
140
140
|
Widgets: drawer.widgets,
|
|
141
|
-
Context: drawer.Context
|
|
142
|
-
Filters: drawer.Filters
|
|
141
|
+
Context: drawer.Context
|
|
143
142
|
}, /*#__PURE__*/_react().default.createElement(drawer.render, null));
|
|
144
143
|
}));
|
|
145
144
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["side-bar.tsx"],"names":["SideBar","drawerSlot","itemSlot","rest","drawers","values","filter","drawer","isHidden","sort","sortFn","openDrawerList","onToggleDrawer","map","id","items","handleDrawerToggle","isDrawerOpen","includes","list","concat","styles","sidebar","name","isOpen","sidebarDrawer","open","widgets","Context","
|
|
1
|
+
{"version":3,"sources":["side-bar.tsx"],"names":["SideBar","drawerSlot","itemSlot","rest","drawers","values","filter","drawer","isHidden","sort","sortFn","openDrawerList","onToggleDrawer","map","id","items","handleDrawerToggle","isDrawerOpen","includes","list","concat","styles","sidebar","name","isOpen","sidebarDrawer","open","widgets","Context","first","second","order"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA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AACS,GAAR,CAAaN,MAAD,IAAY;AACvB,QAAI,CAACA,MAAD,IAAW,CAACA,MAAM,CAACgB,IAAvB,EAA6B,OAAO,IAAP,CADN,CAEvB;;AACA,UAAMC,MAAM,GAAGb,cAAc,CAACO,QAAf,CAAwBX,MAAM,CAACO,EAA/B,CAAf;AAEA,wBACE,+BAAC,8BAAD;AACE,MAAA,SAAS,EAAE,2BAAWO,yBAAOI,aAAlB,EAAiCD,MAAM,IAAIH,yBAAOK,IAAlD,CADb;AAEE,MAAA,MAAM,EAAEF,MAFV;AAGE,MAAA,QAAQ,EAAE,MAAMR,kBAAkB,CAACT,MAAM,CAACO,EAAR,CAHpC;AAIE,MAAA,GAAG,EAAEP,MAAM,CAACO,EAJd;AAKE,MAAA,IAAI,EAAEP,MAAM,CAACgB,IALf;AAME,MAAA,OAAO,EAAEhB,MAAM,CAACoB,OANlB;AAOE,MAAA,OAAO,EAAEpB,MAAM,CAACqB;AAPlB,oBASE,+BAAC,MAAD,CAAQ,MAAR,OATF,CADF;AAaD,GAlBA,CAFH,CADF;AAwBD;;AACD,SAASlB,MAAT,CAAgBmB,KAAhB,EAAmCC,MAAnC,EAAuD;AAAA;;AACrD;AACA;AACA;AAEA,SAAO,iBAACD,KAAK,CAACE,KAAP,uDAAgB,CAAhB,sBAAsBD,MAAM,CAACC,KAA7B,yDAAsC,CAAtC,CAAP;AACD","sourcesContent":["import React, { useState, useMemo } from 'react';\nimport { flatten } from 'lodash';\nimport classNames from 'classnames';\nimport { MenuSection } from '@teambit/design.ui.surfaces.menu.section';\nimport { DrawerType, DrawerUI } from '@teambit/ui-foundation.ui.tree.drawer';\nimport { DrawerSlot, SidebarItemSlot } from '../../sidebar.ui.runtime';\nimport styles from './side-bar.module.scss';\n\nexport type SideBarProps = {\n /**\n * slot of registered drawers.\n */\n drawerSlot: DrawerSlot;\n /**\n * slot of registered items to the main section at the top.\n */\n itemSlot?: SidebarItemSlot;\n} & React.HTMLAttributes<HTMLDivElement>;\n\n/**\n * side bar component.\n */\nexport function SideBar({ drawerSlot, itemSlot, ...rest }: SideBarProps) {\n const drawers = flatten(drawerSlot.values())\n .filter((drawer) => !drawer?.isHidden?.())\n .sort(sortFn);\n\n const [openDrawerList, onToggleDrawer] = useState<(string | undefined)[]>(drawers.map((drawer) => drawer.id));\n const items = useMemo(() => flatten(itemSlot?.values()), [itemSlot]);\n\n const handleDrawerToggle = (id: string) => {\n const isDrawerOpen = openDrawerList.includes(id);\n if (isDrawerOpen) {\n onToggleDrawer((list) => list.filter((drawer) => drawer !== id));\n return;\n }\n onToggleDrawer((list) => list.concat(id));\n };\n\n return (\n <div {...rest} className={styles.sidebar}>\n <MenuSection items={items} />\n {drawers.map((drawer) => {\n if (!drawer || !drawer.name) return null;\n // consider passing collapse all as a prop so each drawer collapses itself\n const isOpen = openDrawerList.includes(drawer.id);\n\n return (\n <DrawerUI\n className={classNames(styles.sidebarDrawer, isOpen && styles.open)}\n isOpen={isOpen}\n onToggle={() => handleDrawerToggle(drawer.id)}\n key={drawer.id}\n name={drawer.name}\n Widgets={drawer.widgets}\n Context={drawer.Context}\n >\n <drawer.render />\n </DrawerUI>\n );\n })}\n </div>\n );\n}\nfunction sortFn(first: DrawerType, second: DrawerType) {\n // 0 - equal\n // <0 - first < second\n // >0 - first > second\n\n return (first.order ?? 0) - (second.order ?? 0);\n}\n"]}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/sidebar",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.687",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/ui-foundation/sidebar",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.ui-foundation",
|
|
8
8
|
"name": "sidebar",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.687"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@teambit/harmony": "0.2.11",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"@teambit/base-ui.routing.nav-link": "1.0.0",
|
|
18
18
|
"@teambit/documenter.ui.separator": "4.1.1",
|
|
19
19
|
"@teambit/evangelist.elements.icon": "1.0.2",
|
|
20
|
-
"@teambit/component": "0.0.
|
|
21
|
-
"@teambit/ui-foundation.ui.tree.drawer": "0.0.
|
|
22
|
-
"@teambit/ui": "0.0.
|
|
20
|
+
"@teambit/component": "0.0.687",
|
|
21
|
+
"@teambit/ui-foundation.ui.tree.drawer": "0.0.497",
|
|
22
|
+
"@teambit/ui": "0.0.687",
|
|
23
23
|
"@teambit/design.ui.surfaces.menu.section": "0.0.347"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@types/node": "12.20.4"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@teambit/legacy": "1.0.
|
|
36
|
+
"@teambit/legacy": "1.0.239",
|
|
37
37
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
38
38
|
"react": "^16.8.0 || ^17.0.0"
|
|
39
39
|
},
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"react": "-"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@teambit/legacy": "1.0.
|
|
64
|
+
"@teambit/legacy": "1.0.239",
|
|
65
65
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
66
66
|
"react": "^16.8.0 || ^17.0.0"
|
|
67
67
|
}
|
|
File without changes
|
package/ui/side-bar/side-bar.tsx
CHANGED
|
Binary file
|