tw-react-components 0.0.184 → 0.0.185
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 +1 -11
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -1964,7 +1964,7 @@ const SidebarContextProvider = (_a) => {
|
|
|
1964
1964
|
var { defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children } = _a, props = __rest(_a, ["defaultOpen", "open", "onOpenChange", "className", "style", "children"]);
|
|
1965
1965
|
const isMobile = useIsMobile();
|
|
1966
1966
|
const [openMobile, setOpenMobile] = useState(false);
|
|
1967
|
-
|
|
1967
|
+
useRef(typeof document === 'undefined' ? null : document.documentElement);
|
|
1968
1968
|
// This is the internal state of the sidebar.
|
|
1969
1969
|
// We use openProp and setOpenProp for control from outside the component.
|
|
1970
1970
|
const [_open, _setOpen] = useState(getValueFromCookie(SIDEBAR_COOKIE_NAME, defaultOpen));
|
|
@@ -1982,16 +1982,6 @@ const SidebarContextProvider = (_a) => {
|
|
|
1982
1982
|
const toggleSidebar = useCallback(() => {
|
|
1983
1983
|
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
|
|
1984
1984
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
1985
|
-
// Add swipe gesture support for opening and closing the sidebar.
|
|
1986
|
-
useOnSwipe(screenRef, (direction) => {
|
|
1987
|
-
const _setOpen = isMobile ? setOpenMobile : setOpen;
|
|
1988
|
-
if (direction === 'right') {
|
|
1989
|
-
_setOpen(true);
|
|
1990
|
-
}
|
|
1991
|
-
else if (direction === 'left') {
|
|
1992
|
-
_setOpen(false);
|
|
1993
|
-
}
|
|
1994
|
-
});
|
|
1995
1985
|
// Adds a keyboard shortcut to toggle the sidebar.
|
|
1996
1986
|
useEffect(() => {
|
|
1997
1987
|
const handleKeyDown = (event) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.
|
|
4
|
+
"version": "0.0.185",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://bacali95.github.io/tw-react-components",
|
|
7
7
|
"type": "module",
|