tw-react-components 0.0.149 → 0.0.150

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/index.esm.js CHANGED
@@ -16,7 +16,6 @@ import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, close
16
16
  import { restrictToFirstScrollableAncestor } from '@dnd-kit/modifiers';
17
17
  import { sortableKeyboardCoordinates, SortableContext, verticalListSortingStrategy, useSortable } from '@dnd-kit/sortable';
18
18
  import { CSS } from '@dnd-kit/utilities';
19
- import { useLocation, Link } from 'react-router-dom';
20
19
  import { Slot } from '@radix-ui/react-slot';
21
20
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
22
21
  import * as PopoverPrimitive from '@radix-ui/react-popover';
@@ -2039,14 +2038,14 @@ const Sidebar = Object.assign($Sidebar, {
2039
2038
  const Navbar = ({ className, sidebarTriggerClassName, leftSlot, rightSlot, }) => (jsx(Block, { className: cn('border-b p-3 dark:border-slate-700', className), fullWidth: true, children: jsxs(Flex, { align: "center", justify: "between", children: [jsxs(Flex, { align: "center", children: [jsx(Sidebar.Trigger, { className: sidebarTriggerClassName }), leftSlot] }), rightSlot] }) }));
2040
2039
 
2041
2040
  const Layout = (_a) => {
2042
- var { children, className } = _a, _b = _a.sidebarProps, { basePath, header, items, extraContent, footer } = _b, sidebarProps = __rest(_b, ["basePath", "header", "items", "extraContent", "footer"]), { navbarProps } = _a;
2041
+ var { children, className } = _a, _b = _a.sidebarProps, { basePath, header, items, extraContent, footer } = _b, sidebarProps = __rest(_b, ["basePath", "header", "items", "extraContent", "footer"]), { navbarProps, Link, useLocation } = _a;
2043
2042
  return (jsxs(Flex, { className: "h-screen w-screen gap-0 text-black dark:bg-slate-900 dark:text-white", children: [jsxs(Sidebar, Object.assign({ collapsible: "icon" }, sidebarProps, { children: [header && (jsx(Sidebar.Header, { children: jsx(Sidebar.Menu, { children: jsx(Sidebar.MenuItem, { children: header }) }) })), jsxs(Sidebar.Content, { className: "gap-0", children: [items
2044
2043
  .filter((item) => !item.hidden)
2045
- .map((item, index) => item.type === 'item' ? (jsx(Sidebar.Group, { children: jsx(Sidebar.Menu, { children: jsx(RenderSideBarItem, Object.assign({ basePath: basePath }, item)) }) }, index)) : (jsxs(Sidebar.Group, { children: [item.title && jsx(Sidebar.GroupLabel, { children: item.title }), jsx(Sidebar.GroupContent, { children: jsx(Sidebar.Menu, { children: item.items
2044
+ .map((item, index) => item.type === 'item' ? (jsx(Sidebar.Group, { children: jsx(Sidebar.Menu, { children: jsx(RenderSideBarItem, Object.assign({ basePath: basePath, Link: Link, useLocation: useLocation }, item)) }) }, index)) : (jsxs(Sidebar.Group, { children: [item.title && jsx(Sidebar.GroupLabel, { children: item.title }), jsx(Sidebar.GroupContent, { children: jsx(Sidebar.Menu, { children: item.items
2046
2045
  .filter((subItem) => !subItem.hidden)
2047
- .map((subItem, index) => (jsx(RenderSideBarItem, Object.assign({ basePath: basePath }, subItem), index))) }) })] }, index))), extraContent] }), footer && (jsx(Sidebar.Footer, { children: jsx(Sidebar.Menu, { children: jsx(Sidebar.MenuItem, { children: footer }) }) })), jsx(Sidebar.Rail, {})] })), jsxs(Flex, { className: "gap-0 overflow-hidden", direction: "column", fullHeight: true, fullWidth: true, children: [navbarProps && jsx(Navbar, Object.assign({}, navbarProps)), jsx(Flex, { className: cn('overflow-hidden p-3', className), direction: "column", fullWidth: true, fullHeight: true, children: children })] })] }));
2046
+ .map((subItem, index) => (jsx(RenderSideBarItem, Object.assign({ basePath: basePath, Link: Link, useLocation: useLocation }, subItem), index))) }) })] }, index))), extraContent] }), footer && (jsx(Sidebar.Footer, { children: jsx(Sidebar.Menu, { children: jsx(Sidebar.MenuItem, { children: footer }) }) })), jsx(Sidebar.Rail, {})] })), jsxs(Flex, { className: "gap-0 overflow-hidden", direction: "column", fullHeight: true, fullWidth: true, children: [navbarProps && jsx(Navbar, Object.assign({}, navbarProps)), jsx(Flex, { className: cn('overflow-hidden p-3', className), direction: "column", fullWidth: true, fullHeight: true, children: children })] })] }));
2048
2047
  };
2049
- const RenderSideBarItem = ({ basePath = '/', pathname, title, Icon, items, }) => {
2048
+ const RenderSideBarItem = ({ basePath = '/', pathname, title, Icon, items, Link, useLocation }) => {
2050
2049
  const location = useLocation();
2051
2050
  const { open } = useSidebar();
2052
2051
  const currentPath = useMemo(() => location.pathname.replace(basePath, '').replace(/^\/*/, ''), [basePath, location.pathname]);
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "tw-react-components",
3
3
  "description": "A set of React components build with TailwindCSS to make a nice dashboard.",
4
- "version": "0.0.149",
4
+ "version": "0.0.150",
5
5
  "license": "MIT",
6
6
  "homepage": "https://bacali95.github.io/tw-react-components",
7
+ "type": "module",
7
8
  "author": {
8
9
  "name": "Nasreddine Bac Ali",
9
10
  "email": "nasreddine.bacali95@gmail.com",
@@ -18,10 +19,8 @@
18
19
  },
19
20
  "exports": {
20
21
  ".": {
21
- "module": "./index.esm.js",
22
- "types": "./index.esm.d.ts",
23
- "import": "./index.cjs.mjs",
24
- "default": "./index.cjs.js"
22
+ "import": "./index.esm.js",
23
+ "types": "./index.esm.d.ts"
25
24
  },
26
25
  "./css": {
27
26
  "default": "./index.css"
@@ -32,6 +31,6 @@
32
31
  "./package.json": "./package.json"
33
32
  },
34
33
  "module": "./index.esm.js",
35
- "main": "./index.cjs.js",
34
+ "main": "./index.esm.js",
36
35
  "types": "./index.esm.d.ts"
37
36
  }
@@ -1,5 +1,6 @@
1
1
  import { LucideIcon } from 'lucide-react';
2
2
  import { ComponentProps, FC, PropsWithChildren, ReactNode } from 'react';
3
+ import type { LinkProps, useLocation } from 'react-router-dom';
3
4
  import { NavbarProps } from '../Navbar';
4
5
  import { Sidebar } from '../Sidebar';
5
6
  export type SidebarItem = {
@@ -27,6 +28,8 @@ type Props = {
27
28
  className?: string;
28
29
  sidebarProps: SidebarProps;
29
30
  navbarProps?: NavbarProps;
31
+ Link: FC<LinkProps>;
32
+ useLocation: typeof useLocation;
30
33
  };
31
34
  export declare const Layout: FC<PropsWithChildren<Props>>;
32
35
  export {};
package/index.cjs.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./src/index";
@@ -1 +0,0 @@
1
- exports._default = require('./index.cjs.js').default;