@teambit/sidebar 1.0.107 → 1.0.109

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.
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.ui-foundation/sidebar-preview"]=t():e["teambit.ui-foundation/sidebar-preview"]=t()}(self,(()=>(()=>{"use strict";var e={54137:(e,t,o)=>{var r={id:"teambit.ui-foundation/sidebar@1.0.109",homepage:"https://bit.cloud/teambit/ui-foundation/sidebar",exported:!0};function n(){const e=i(o(87363));return n=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,n.__bit_component=r,i.__bit_component=r;const a=()=>n().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},n().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/sidebar.svg"}));a.__bit_component=r,t.Logo=a},87363:e=>{e.exports=React}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{o.r(r),o.d(r,{compositions:()=>u,compositions_metadata:()=>l,overview:()=>f});var e={};o.r(e),o.d(e,{default:()=>d});var t=o(54137);o(87363);const n=MdxJsReact,i=TeambitMdxUiMdxScopeContext;var a=["components"];function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},s.apply(this,arguments)}var p={},c="wrapper";function d(e){var t=e.components,o=function(e,t){if(null==e)return{};var o,r,n=function(e,t){if(null==e)return{};var o,r,n={},i=Object.keys(e);for(r=0;r<i.length;r++)o=i[r],t.indexOf(o)>=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)o=i[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}(e,a);return(0,n.mdx)(c,s({},p,o,{components:t,mdxType:"MDXLayout"}),(0,n.mdx)(i.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"}))}d.isMDXComponent=!0;const u=[t],f=[e],l={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),r})()));
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.ui-foundation_sidebar@1.0.107/dist/sidebar.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.ui-foundation_sidebar@1.0.107/dist/sidebar.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.ui-foundation_sidebar@1.0.109/dist/sidebar.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.ui-foundation_sidebar@1.0.109/dist/sidebar.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -1,2 +1,2 @@
1
- import React from 'react';
2
- export declare const Logo: () => React.JSX.Element;
1
+ /// <reference types="react" />
2
+ export declare const Logo: () => JSX.Element;
@@ -1,17 +1,17 @@
1
1
  import { ComponentModel } from '@teambit/component';
2
2
  import { SlotRegistry } from '@teambit/harmony';
3
- import React, { ComponentType } from 'react';
3
+ import { ComponentType } from 'react';
4
4
  import type { DrawerType } from '@teambit/ui-foundation.ui.tree.drawer';
5
5
  import { SideBarProps } from './ui';
6
- export declare type ComponentTypeProps = {
6
+ export type ComponentTypeProps = {
7
7
  component: ComponentModel;
8
8
  };
9
- export declare type SidebarItem = {
9
+ export type SidebarItem = {
10
10
  weight?: number;
11
11
  component?: ComponentType;
12
12
  };
13
- export declare type SidebarItemSlot = SlotRegistry<SidebarItem[]>;
14
- export declare type DrawerSlot = SlotRegistry<DrawerType[]>;
13
+ export type SidebarItemSlot = SlotRegistry<SidebarItem[]>;
14
+ export type DrawerSlot = SlotRegistry<DrawerType[]>;
15
15
  export declare class SidebarUI {
16
16
  private drawerSlot;
17
17
  constructor(drawerSlot: DrawerSlot);
@@ -22,9 +22,9 @@ export declare class SidebarUI {
22
22
  /**
23
23
  * render the sidebar.
24
24
  */
25
- render: (props: Partial<SideBarProps>) => React.JSX.Element;
25
+ render: (props: Partial<SideBarProps>) => JSX.Element;
26
26
  static runtime: import("@teambit/harmony").RuntimeDefinition;
27
27
  static slots: ((registerFn: () => string) => SlotRegistry<DrawerType>)[];
28
- static dependencies: never[];
28
+ static dependencies: any[];
29
29
  static provider(deps: any, config: any, [drawerSlot]: [DrawerSlot]): Promise<SidebarUI>;
30
30
  }
@@ -1,7 +1,7 @@
1
1
  import React, { ComponentType } from 'react';
2
2
  import { DrawerType } from '@teambit/ui-foundation.ui.tree.drawer';
3
3
  import { DrawerSlot } from '../../sidebar.ui.runtime';
4
- export declare type SideBarProps = {
4
+ export type SideBarProps = {
5
5
  /**
6
6
  * slot of registered drawers.
7
7
  */
@@ -18,4 +18,4 @@ export declare type SideBarProps = {
18
18
  /**
19
19
  * side bar component.
20
20
  */
21
- export declare function SideBar({ drawerSlot, items, overrideDrawerSlot, ...rest }: SideBarProps): React.JSX.Element;
21
+ export declare function SideBar({ drawerSlot, items, overrideDrawerSlot, ...rest }: SideBarProps): JSX.Element;
@@ -63,10 +63,7 @@ function SideBar(_ref) {
63
63
  overrideDrawerSlot
64
64
  } = _ref,
65
65
  rest = _objectWithoutProperties(_ref, _excluded);
66
- const drawers = (overrideDrawerSlot || (0, _lodash().flatten)(drawerSlot.values())).filter(drawer => {
67
- var _drawer$isHidden;
68
- return !(drawer !== null && drawer !== void 0 && (_drawer$isHidden = drawer.isHidden) !== null && _drawer$isHidden !== void 0 && _drawer$isHidden.call(drawer));
69
- }).sort(sortFn);
66
+ const drawers = (overrideDrawerSlot || (0, _lodash().flatten)(drawerSlot.values())).filter(drawer => !drawer?.isHidden?.()).sort(sortFn);
70
67
  const [openDrawerList, onToggleDrawer] = (0, _react().useState)(drawers.map(drawer => drawer.id));
71
68
  const handleDrawerToggle = id => {
72
69
  const isDrawerOpen = openDrawerList.includes(id);
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","_interopRequireWildcard","require","_lodash","_classnames","_interopRequireDefault","_designUiSurfacesMenu","_uiFoundationUiTree","_sideBarModule","_excluded","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","SideBar","_ref","drawerSlot","items","overrideDrawerSlot","rest","drawers","flatten","values","filter","drawer","_drawer$isHidden","isHidden","sort","sortFn","openDrawerList","onToggleDrawer","useState","map","id","handleDrawerToggle","isDrawerOpen","includes","list","concat","createElement","className","styles","sidebar","MenuSection","name","isOpen","DrawerUI","classNames","sidebarDrawer","open","onToggle","Widgets","widgets","Context","render","first","second","order"],"sources":["side-bar.tsx"],"sourcesContent":["import React, { useState, ComponentType } 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 } 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 items?: ComponentType[];\n /**\n * override register drawers from the slot\n */\n overrideDrawerSlot?: DrawerType[];\n} & React.HTMLAttributes<HTMLDivElement>;\n\n/**\n * side bar component.\n */\nexport function SideBar({ drawerSlot, items = [], overrideDrawerSlot, ...rest }: SideBarProps) {\n const drawers = (overrideDrawerSlot || 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\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"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,C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AM,EAAEA,MAAO;MACfK,QAAQ,EAAEA,CAAA,KAAMhB,kBAAkB,CAACV,MAAM,CAACS,EAAE,CAAE;MAC9C9B,GAAG,EAAEqB,MAAM,CAACS,EAAG;MACfW,IAAI,EAAEpB,MAAM,CAACoB,IAAK;MAClBO,OAAO,EAAE3B,MAAM,CAAC4B,OAAQ;MACxBC,OAAO,EAAE7B,MAAM,CAAC6B;IAAQ,gBAExB1F,MAAA,GAAAa,OAAA,CAAA+D,aAAA,CAACf,MAAM,CAAC8B,MAAM,MAAE,CACR,CAAC;EAEf,CAAC,CACE,CAAC;AAEV;AACA,SAAS1B,MAAMA,CAAC2B,KAAiB,EAAEC,MAAkB,EAAE;EACrD;EACA;EACA;;EAEA,OAAO,CAACD,KAAK,CAACE,KAAK,IAAI,CAAC,KAAKD,MAAM,CAACC,KAAK,IAAI,CAAC,CAAC;AACjD"}
1
+ {"version":3,"names":["_react","data","_interopRequireWildcard","require","_lodash","_classnames","_interopRequireDefault","_designUiSurfacesMenu","_uiFoundationUiTree","_sideBarModule","_excluded","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","SideBar","_ref","drawerSlot","items","overrideDrawerSlot","rest","drawers","flatten","values","filter","drawer","isHidden","sort","sortFn","openDrawerList","onToggleDrawer","useState","map","id","handleDrawerToggle","isDrawerOpen","includes","list","concat","createElement","className","styles","sidebar","MenuSection","name","isOpen","DrawerUI","classNames","sidebarDrawer","open","onToggle","Widgets","widgets","Context","render","first","second","order"],"sources":["side-bar.tsx"],"sourcesContent":["import React, { useState, ComponentType } 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 } 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 items?: ComponentType[];\n /**\n * override register drawers from the slot\n */\n overrideDrawerSlot?: DrawerType[];\n} & React.HTMLAttributes<HTMLDivElement>;\n\n/**\n * side bar component.\n */\nexport function SideBar({ drawerSlot, items = [], overrideDrawerSlot, ...rest }: SideBarProps) {\n const drawers = (overrideDrawerSlot || 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\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"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,C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Q,EAAG;MACfW,IAAI,EAAEnB,MAAM,CAACmB,IAAK;MAClBO,OAAO,EAAE1B,MAAM,CAAC2B,OAAQ;MACxBC,OAAO,EAAE5B,MAAM,CAAC4B;IAAQ,gBAExBzF,MAAA,GAAAa,OAAA,CAAA8D,aAAA,CAACd,MAAM,CAAC6B,MAAM,MAAE,CACR,CAAC;EAEf,CAAC,CACE,CAAC;AAEV;AACA,SAAS1B,MAAMA,CAAC2B,KAAiB,EAAEC,MAAkB,EAAE;EACrD;EACA;EACA;;EAEA,OAAO,CAACD,KAAK,CAACE,KAAK,IAAI,CAAC,KAAKD,MAAM,CAACC,KAAK,IAAI,CAAC,CAAC;AACjD"}
package/package.json CHANGED
@@ -1,38 +1,34 @@
1
1
  {
2
2
  "name": "@teambit/sidebar",
3
- "version": "1.0.107",
3
+ "version": "1.0.109",
4
4
  "homepage": "https://bit.cloud/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": "1.0.107"
9
+ "version": "1.0.109"
10
10
  },
11
11
  "dependencies": {
12
12
  "classnames": "2.2.6",
13
13
  "lodash": "4.17.21",
14
- "core-js": "^3.0.0",
15
- "@babel/runtime": "7.20.0",
16
14
  "@teambit/harmony": "0.4.6",
17
15
  "@teambit/ui-foundation.ui.tree.drawer": "0.0.517",
18
16
  "@teambit/design.ui.surfaces.menu.section": "0.0.357",
19
- "@teambit/component": "1.0.107",
20
- "@teambit/ui": "1.0.107"
17
+ "@teambit/component": "1.0.109",
18
+ "@teambit/ui": "1.0.109"
21
19
  },
22
20
  "devDependencies": {
23
- "@types/react": "^17.0.8",
24
21
  "@types/classnames": "2.2.11",
25
22
  "@types/lodash": "4.14.165",
26
23
  "@types/mocha": "9.1.0",
27
- "@types/node": "12.20.4",
28
- "@types/react-dom": "^17.0.5",
29
- "@types/jest": "^26.0.0",
30
- "@types/testing-library__jest-dom": "5.9.5"
24
+ "@types/jest": "^29.2.2",
25
+ "@types/testing-library__jest-dom": "^5.9.5",
26
+ "@teambit/harmony.envs.core-aspect-env": "0.0.14"
31
27
  },
32
28
  "peerDependencies": {
33
- "@teambit/legacy": "1.0.624",
34
- "react": "^16.8.0 || ^17.0.0",
35
- "react-dom": "^16.8.0 || ^17.0.0"
29
+ "react": "^17.0.0 || ^18.0.0",
30
+ "@types/react": "^18.2.12",
31
+ "@teambit/legacy": "1.0.624"
36
32
  },
37
33
  "license": "Apache-2.0",
38
34
  "optionalDependencies": {},
@@ -46,7 +42,7 @@
46
42
  },
47
43
  "private": false,
48
44
  "engines": {
49
- "node": ">=12.22.0"
45
+ "node": ">=16.0.0"
50
46
  },
51
47
  "repository": {
52
48
  "type": "git",
@@ -55,12 +51,9 @@
55
51
  "keywords": [
56
52
  "bit",
57
53
  "bit-aspect",
54
+ "bit-core-aspect",
58
55
  "components",
59
56
  "collaboration",
60
- "web",
61
- "react",
62
- "react-components",
63
- "angular",
64
- "angular-components"
57
+ "web"
65
58
  ]
66
59
  }
package/tsconfig.json CHANGED
@@ -1,38 +1,33 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "lib": [
4
- "es2019",
5
- "DOM",
6
- "ES6",
7
- "DOM.Iterable",
8
- "ScriptHost"
4
+ "esnext",
5
+ "dom",
6
+ "dom.Iterable"
9
7
  ],
10
- "target": "es2015",
11
- "module": "CommonJS",
12
- "jsx": "react",
13
- "allowJs": true,
14
- "composite": true,
8
+ "target": "es2020",
9
+ "module": "es2020",
10
+ "jsx": "react-jsx",
15
11
  "declaration": true,
16
12
  "sourceMap": true,
17
- "skipLibCheck": true,
18
13
  "experimentalDecorators": true,
19
- "outDir": "dist",
14
+ "skipLibCheck": true,
20
15
  "moduleResolution": "node",
21
16
  "esModuleInterop": true,
22
- "rootDir": ".",
23
17
  "resolveJsonModule": true,
24
- "emitDeclarationOnly": true,
25
- "emitDecoratorMetadata": true,
26
- "allowSyntheticDefaultImports": true,
27
- "strictPropertyInitialization": false,
28
- "strict": true,
29
- "noImplicitAny": false,
30
- "preserveConstEnums": true
18
+ "allowJs": true,
19
+ "outDir": "dist",
20
+ "emitDeclarationOnly": true
31
21
  },
32
22
  "exclude": [
23
+ "artifacts",
24
+ "public",
33
25
  "dist",
26
+ "node_modules",
27
+ "package.json",
34
28
  "esm.mjs",
35
- "package.json"
29
+ "**/*.cjs",
30
+ "./dist"
36
31
  ],
37
32
  "include": [
38
33
  "**/*",
package/types/asset.d.ts CHANGED
@@ -5,12 +5,12 @@ declare module '*.png' {
5
5
  declare module '*.svg' {
6
6
  import type { FunctionComponent, SVGProps } from 'react';
7
7
 
8
- export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
8
+ export const ReactComponent: FunctionComponent<
9
+ SVGProps<SVGSVGElement> & { title?: string }
10
+ >;
9
11
  const src: string;
10
12
  export default src;
11
13
  }
12
-
13
- // @TODO Gilad
14
14
  declare module '*.jpg' {
15
15
  const value: any;
16
16
  export = value;
@@ -27,3 +27,15 @@ declare module '*.bmp' {
27
27
  const value: any;
28
28
  export = value;
29
29
  }
30
+ declare module '*.otf' {
31
+ const value: any;
32
+ export = value;
33
+ }
34
+ declare module '*.woff' {
35
+ const value: any;
36
+ export = value;
37
+ }
38
+ declare module '*.woff2' {
39
+ const value: any;
40
+ export = value;
41
+ }