@greatapps/common 1.1.314 → 1.1.315
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/components/layouts/MdSideBarNavigation.mjs +1 -1
- package/dist/components/layouts/MdSideBarNavigation.mjs.map +1 -1
- package/dist/store/useDesktopSidebarStore.mjs +21 -4
- package/dist/store/useDesktopSidebarStore.mjs.map +1 -1
- package/dist/store/useMdSidebarStore.mjs +21 -4
- package/dist/store/useMdSidebarStore.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/layouts/MdSideBarNavigation.tsx +1 -1
- package/src/store/useDesktopSidebarStore.ts +23 -4
- package/src/store/useMdSidebarStore.ts +34 -15
|
@@ -34,7 +34,7 @@ function MdSideBarNavigation({
|
|
|
34
34
|
"button",
|
|
35
35
|
{
|
|
36
36
|
onClick: collapse,
|
|
37
|
-
className: "absolute top-[
|
|
37
|
+
className: "absolute top-[60px] -right-4 size-8 flex items-center justify-center rounded-full border border-gray-200 bg-white hover:bg-gray-100 cursor-pointer transition-colors z-40",
|
|
38
38
|
children: /* @__PURE__ */ jsx(IconChevronLeft, { size: 16, className: "text-gray-500" })
|
|
39
39
|
}
|
|
40
40
|
) }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/layouts/MdSideBarNavigation.tsx"],"sourcesContent":["'use client';\n\n\"use client\"\n\nimport * as React from \"react\"\nimport { IconChevronLeft } from '@tabler/icons-react'\nimport { useMdSidebarStore } from \"../../store/useMdSidebarStore\"\nimport { cn } from \"../../infra/utils/clsx\"\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../ui/overlay/Tooltip\"\n\nfunction MdSideBarNavigation({\n className,\n children,\n ...props\n}: React.ComponentProps<\"div\">) {\n const { isExpanded, collapse } = useMdSidebarStore()\n\n return (\n <>\n <div\n className={`hidden md:block lg:hidden fixed inset-0 bg-black/50 z-20 transition-opacity duration-300 ${\n isExpanded ? \"opacity-100\" : \"opacity-0 pointer-events-none\"\n }`}\n onClick={collapse}\n />\n <div\n className={`hidden md:flex lg:hidden fixed top-0 bottom-0 left-[73px] z-30 transition-transform duration-300 ease-in-out overflow-visible ${\n isExpanded ? \"translate-x-0\" : \"-translate-x-full\"\n }`}\n >\n <div\n data-slot=\"md-sidebar-navigation\"\n className={cn(\"relative w-[273px] h-full flex flex-col p-4 bg-white border-r border-gray-200\", className)}\n {...props}\n >\n {isExpanded && (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n onClick={collapse}\n className=\"absolute top-[
|
|
1
|
+
{"version":3,"sources":["../../../src/components/layouts/MdSideBarNavigation.tsx"],"sourcesContent":["'use client';\n\n\"use client\"\n\nimport * as React from \"react\"\nimport { IconChevronLeft } from '@tabler/icons-react'\nimport { useMdSidebarStore } from \"../../store/useMdSidebarStore\"\nimport { cn } from \"../../infra/utils/clsx\"\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../ui/overlay/Tooltip\"\n\nfunction MdSideBarNavigation({\n className,\n children,\n ...props\n}: React.ComponentProps<\"div\">) {\n const { isExpanded, collapse } = useMdSidebarStore()\n\n return (\n <>\n <div\n className={`hidden md:block lg:hidden fixed inset-0 bg-black/50 z-20 transition-opacity duration-300 ${\n isExpanded ? \"opacity-100\" : \"opacity-0 pointer-events-none\"\n }`}\n onClick={collapse}\n />\n <div\n className={`hidden md:flex lg:hidden fixed top-0 bottom-0 left-[73px] z-30 transition-transform duration-300 ease-in-out overflow-visible ${\n isExpanded ? \"translate-x-0\" : \"-translate-x-full\"\n }`}\n >\n <div\n data-slot=\"md-sidebar-navigation\"\n className={cn(\"relative w-[273px] h-full flex flex-col p-4 bg-white border-r border-gray-200\", className)}\n {...props}\n >\n {isExpanded && (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n onClick={collapse}\n className=\"absolute top-[60px] -right-4 size-8 flex items-center justify-center rounded-full border border-gray-200 bg-white hover:bg-gray-100 cursor-pointer transition-colors z-40\"\n >\n <IconChevronLeft size={16} className=\"text-gray-500\" />\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"right\">Recolher menu</TooltipContent>\n </Tooltip>\n )}\n {children}\n </div>\n </div>\n </>\n )\n}\n\nexport { MdSideBarNavigation };\n"],"mappings":";AAkBQ,mBACI,KAiBY,YAlBhB;AAbR,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAClC,SAAS,UAAU;AACnB,SAAS,SAAS,gBAAgB,sBAAsB;AAExD,SAAS,oBAAoB;AAAA,EACzB;AAAA,EACA;AAAA,EACA,GAAG;AACP,GAAgC;AAC5B,QAAM,EAAE,YAAY,SAAS,IAAI,kBAAkB;AAEnD,SACI,iCACI;AAAA;AAAA,MAAC;AAAA;AAAA,QACG,WAAW,4FACP,aAAa,gBAAgB,+BACjC;AAAA,QACA,SAAS;AAAA;AAAA,IACb;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACG,WAAW,iIACP,aAAa,kBAAkB,mBACnC;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACG,aAAU;AAAA,YACV,WAAW,GAAG,iFAAiF,SAAS;AAAA,YACvG,GAAG;AAAA,YAEH;AAAA,4BACG,qBAAC,WACG;AAAA,oCAAC,kBAAe,SAAO,MACnB;AAAA,kBAAC;AAAA;AAAA,oBACG,SAAS;AAAA,oBACT,WAAU;AAAA,oBAEV,8BAAC,mBAAgB,MAAM,IAAI,WAAU,iBAAgB;AAAA;AAAA,gBACzD,GACJ;AAAA,gBACA,oBAAC,kBAAe,MAAK,SAAQ,2BAAa;AAAA,iBAC9C;AAAA,cAEH;AAAA;AAAA;AAAA,QACL;AAAA;AAAA,IACJ;AAAA,KACJ;AAER;","names":[]}
|
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
import { create } from "zustand";
|
|
2
|
+
const STORAGE_KEY = "desktop-sidebar-expanded";
|
|
3
|
+
function getInitialState() {
|
|
4
|
+
if (typeof window === "undefined") return true;
|
|
5
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
6
|
+
if (stored === null) return true;
|
|
7
|
+
return stored === "true";
|
|
8
|
+
}
|
|
2
9
|
const useDesktopSidebarStore = create((set) => ({
|
|
3
|
-
isExpanded:
|
|
4
|
-
toggle: () => set((state) =>
|
|
5
|
-
|
|
6
|
-
|
|
10
|
+
isExpanded: getInitialState(),
|
|
11
|
+
toggle: () => set((state) => {
|
|
12
|
+
const next = !state.isExpanded;
|
|
13
|
+
localStorage.setItem(STORAGE_KEY, String(next));
|
|
14
|
+
return { isExpanded: next };
|
|
15
|
+
}),
|
|
16
|
+
expand: () => {
|
|
17
|
+
localStorage.setItem(STORAGE_KEY, "true");
|
|
18
|
+
return set({ isExpanded: true });
|
|
19
|
+
},
|
|
20
|
+
collapse: () => {
|
|
21
|
+
localStorage.setItem(STORAGE_KEY, "false");
|
|
22
|
+
return set({ isExpanded: false });
|
|
23
|
+
}
|
|
7
24
|
}));
|
|
8
25
|
export {
|
|
9
26
|
useDesktopSidebarStore
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/store/useDesktopSidebarStore.ts"],"sourcesContent":["import { create } from \"zustand\";\n\ntype DesktopSidebarStore = {\n isExpanded: boolean;\n toggle: () => void;\n expand: () => void;\n collapse: () => void;\n};\n\nexport const useDesktopSidebarStore = create<DesktopSidebarStore>((set) => ({\n isExpanded:
|
|
1
|
+
{"version":3,"sources":["../../src/store/useDesktopSidebarStore.ts"],"sourcesContent":["import { create } from \"zustand\";\n\nconst STORAGE_KEY = \"desktop-sidebar-expanded\";\n\nfunction getInitialState(): boolean {\n if (typeof window === \"undefined\") return true;\n const stored = localStorage.getItem(STORAGE_KEY);\n if (stored === null) return true;\n return stored === \"true\";\n}\n\ntype DesktopSidebarStore = {\n isExpanded: boolean;\n toggle: () => void;\n expand: () => void;\n collapse: () => void;\n};\n\nexport const useDesktopSidebarStore = create<DesktopSidebarStore>((set) => ({\n isExpanded: getInitialState(),\n toggle: () => set((state) => {\n const next = !state.isExpanded;\n localStorage.setItem(STORAGE_KEY, String(next));\n return { isExpanded: next };\n }),\n expand: () => {\n localStorage.setItem(STORAGE_KEY, \"true\");\n return set({ isExpanded: true });\n },\n collapse: () => {\n localStorage.setItem(STORAGE_KEY, \"false\");\n return set({ isExpanded: false });\n },\n}));\n"],"mappings":"AAAA,SAAS,cAAc;AAEvB,MAAM,cAAc;AAEpB,SAAS,kBAA2B;AAChC,MAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,QAAM,SAAS,aAAa,QAAQ,WAAW;AAC/C,MAAI,WAAW,KAAM,QAAO;AAC5B,SAAO,WAAW;AACtB;AASO,MAAM,yBAAyB,OAA4B,CAAC,SAAS;AAAA,EACxE,YAAY,gBAAgB;AAAA,EAC5B,QAAQ,MAAM,IAAI,CAAC,UAAU;AACzB,UAAM,OAAO,CAAC,MAAM;AACpB,iBAAa,QAAQ,aAAa,OAAO,IAAI,CAAC;AAC9C,WAAO,EAAE,YAAY,KAAK;AAAA,EAC9B,CAAC;AAAA,EACD,QAAQ,MAAM;AACV,iBAAa,QAAQ,aAAa,MAAM;AACxC,WAAO,IAAI,EAAE,YAAY,KAAK,CAAC;AAAA,EACnC;AAAA,EACA,UAAU,MAAM;AACZ,iBAAa,QAAQ,aAAa,OAAO;AACzC,WAAO,IAAI,EAAE,YAAY,MAAM,CAAC;AAAA,EACpC;AACJ,EAAE;","names":[]}
|
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
import { create } from "zustand";
|
|
2
|
+
const STORAGE_KEY = "md-sidebar-expanded";
|
|
3
|
+
function getInitialState() {
|
|
4
|
+
if (typeof window === "undefined") return false;
|
|
5
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
6
|
+
if (stored === null) return false;
|
|
7
|
+
return stored === "true";
|
|
8
|
+
}
|
|
2
9
|
const useMdSidebarStore = create((set) => ({
|
|
3
|
-
isExpanded:
|
|
4
|
-
toggle: () => set((state) =>
|
|
5
|
-
|
|
6
|
-
|
|
10
|
+
isExpanded: getInitialState(),
|
|
11
|
+
toggle: () => set((state) => {
|
|
12
|
+
const next = !state.isExpanded;
|
|
13
|
+
localStorage.setItem(STORAGE_KEY, String(next));
|
|
14
|
+
return { isExpanded: next };
|
|
15
|
+
}),
|
|
16
|
+
expand: () => {
|
|
17
|
+
localStorage.setItem(STORAGE_KEY, "true");
|
|
18
|
+
return set({ isExpanded: true });
|
|
19
|
+
},
|
|
20
|
+
collapse: () => {
|
|
21
|
+
localStorage.setItem(STORAGE_KEY, "false");
|
|
22
|
+
return set({ isExpanded: false });
|
|
23
|
+
}
|
|
7
24
|
}));
|
|
8
25
|
export {
|
|
9
26
|
useMdSidebarStore
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/store/useMdSidebarStore.ts"],"sourcesContent":["import { create } from \"zustand\";\
|
|
1
|
+
{"version":3,"sources":["../../src/store/useMdSidebarStore.ts"],"sourcesContent":["import { create } from \"zustand\";\n\nconst STORAGE_KEY = \"md-sidebar-expanded\";\n\nfunction getInitialState(): boolean {\n if (typeof window === \"undefined\") return false;\n const stored = localStorage.getItem(STORAGE_KEY);\n if (stored === null) return false;\n return stored === \"true\";\n}\n\ntype MdSidebarStore = {\n isExpanded: boolean;\n toggle: () => void;\n expand: () => void;\n collapse: () => void;\n};\n\nexport const useMdSidebarStore = create<MdSidebarStore>((set) => ({\n isExpanded: getInitialState(),\n toggle: () => set((state) => {\n const next = !state.isExpanded;\n localStorage.setItem(STORAGE_KEY, String(next));\n return { isExpanded: next };\n }),\n expand: () => {\n localStorage.setItem(STORAGE_KEY, \"true\");\n return set({ isExpanded: true });\n },\n collapse: () => {\n localStorage.setItem(STORAGE_KEY, \"false\");\n return set({ isExpanded: false });\n },\n}));\n"],"mappings":"AAAA,SAAS,cAAc;AAEvB,MAAM,cAAc;AAEpB,SAAS,kBAA2B;AAChC,MAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,QAAM,SAAS,aAAa,QAAQ,WAAW;AAC/C,MAAI,WAAW,KAAM,QAAO;AAC5B,SAAO,WAAW;AACtB;AASO,MAAM,oBAAoB,OAAuB,CAAC,SAAS;AAAA,EAC9D,YAAY,gBAAgB;AAAA,EAC5B,QAAQ,MAAM,IAAI,CAAC,UAAU;AACzB,UAAM,OAAO,CAAC,MAAM;AACpB,iBAAa,QAAQ,aAAa,OAAO,IAAI,CAAC;AAC9C,WAAO,EAAE,YAAY,KAAK;AAAA,EAC9B,CAAC;AAAA,EACD,QAAQ,MAAM;AACV,iBAAa,QAAQ,aAAa,MAAM;AACxC,WAAO,IAAI,EAAE,YAAY,KAAK,CAAC;AAAA,EACnC;AAAA,EACA,UAAU,MAAM;AACZ,iBAAa,QAAQ,aAAa,OAAO;AACzC,WAAO,IAAI,EAAE,YAAY,MAAM,CAAC;AAAA,EACpC;AACJ,EAAE;","names":[]}
|
package/package.json
CHANGED
|
@@ -38,7 +38,7 @@ function MdSideBarNavigation({
|
|
|
38
38
|
<TooltipTrigger asChild>
|
|
39
39
|
<button
|
|
40
40
|
onClick={collapse}
|
|
41
|
-
className="absolute top-[
|
|
41
|
+
className="absolute top-[60px] -right-4 size-8 flex items-center justify-center rounded-full border border-gray-200 bg-white hover:bg-gray-100 cursor-pointer transition-colors z-40"
|
|
42
42
|
>
|
|
43
43
|
<IconChevronLeft size={16} className="text-gray-500" />
|
|
44
44
|
</button>
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { create } from "zustand";
|
|
2
2
|
|
|
3
|
+
const STORAGE_KEY = "desktop-sidebar-expanded";
|
|
4
|
+
|
|
5
|
+
function getInitialState(): boolean {
|
|
6
|
+
if (typeof window === "undefined") return true;
|
|
7
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
8
|
+
if (stored === null) return true;
|
|
9
|
+
return stored === "true";
|
|
10
|
+
}
|
|
11
|
+
|
|
3
12
|
type DesktopSidebarStore = {
|
|
4
13
|
isExpanded: boolean;
|
|
5
14
|
toggle: () => void;
|
|
@@ -8,8 +17,18 @@ type DesktopSidebarStore = {
|
|
|
8
17
|
};
|
|
9
18
|
|
|
10
19
|
export const useDesktopSidebarStore = create<DesktopSidebarStore>((set) => ({
|
|
11
|
-
isExpanded:
|
|
12
|
-
toggle: () => set((state) =>
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
isExpanded: getInitialState(),
|
|
21
|
+
toggle: () => set((state) => {
|
|
22
|
+
const next = !state.isExpanded;
|
|
23
|
+
localStorage.setItem(STORAGE_KEY, String(next));
|
|
24
|
+
return { isExpanded: next };
|
|
25
|
+
}),
|
|
26
|
+
expand: () => {
|
|
27
|
+
localStorage.setItem(STORAGE_KEY, "true");
|
|
28
|
+
return set({ isExpanded: true });
|
|
29
|
+
},
|
|
30
|
+
collapse: () => {
|
|
31
|
+
localStorage.setItem(STORAGE_KEY, "false");
|
|
32
|
+
return set({ isExpanded: false });
|
|
33
|
+
},
|
|
15
34
|
}));
|
|
@@ -1,15 +1,34 @@
|
|
|
1
|
-
import { create } from "zustand";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { create } from "zustand";
|
|
2
|
+
|
|
3
|
+
const STORAGE_KEY = "md-sidebar-expanded";
|
|
4
|
+
|
|
5
|
+
function getInitialState(): boolean {
|
|
6
|
+
if (typeof window === "undefined") return false;
|
|
7
|
+
const stored = localStorage.getItem(STORAGE_KEY);
|
|
8
|
+
if (stored === null) return false;
|
|
9
|
+
return stored === "true";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type MdSidebarStore = {
|
|
13
|
+
isExpanded: boolean;
|
|
14
|
+
toggle: () => void;
|
|
15
|
+
expand: () => void;
|
|
16
|
+
collapse: () => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const useMdSidebarStore = create<MdSidebarStore>((set) => ({
|
|
20
|
+
isExpanded: getInitialState(),
|
|
21
|
+
toggle: () => set((state) => {
|
|
22
|
+
const next = !state.isExpanded;
|
|
23
|
+
localStorage.setItem(STORAGE_KEY, String(next));
|
|
24
|
+
return { isExpanded: next };
|
|
25
|
+
}),
|
|
26
|
+
expand: () => {
|
|
27
|
+
localStorage.setItem(STORAGE_KEY, "true");
|
|
28
|
+
return set({ isExpanded: true });
|
|
29
|
+
},
|
|
30
|
+
collapse: () => {
|
|
31
|
+
localStorage.setItem(STORAGE_KEY, "false");
|
|
32
|
+
return set({ isExpanded: false });
|
|
33
|
+
},
|
|
34
|
+
}));
|