@cerberus-design/react 0.1.0 → 0.1.1-next-3a4c6c1
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/build/legacy/aria-helpers/nav-menu.aria.js +3 -7
- package/build/legacy/aria-helpers/nav-menu.aria.js.map +1 -1
- package/build/legacy/chunk-55J6XMHW.js +1 -0
- package/build/legacy/chunk-6YEAMVRY.js +82 -0
- package/build/legacy/chunk-6YEAMVRY.js.map +1 -0
- package/build/legacy/chunk-BPIYUAYS.js +26 -0
- package/build/legacy/chunk-BPIYUAYS.js.map +1 -0
- package/build/legacy/chunk-JA4IX7GN.js +48 -0
- package/build/legacy/chunk-JA4IX7GN.js.map +1 -0
- package/build/legacy/chunk-JF76VIL3.js +12 -0
- package/build/legacy/chunk-JF76VIL3.js.map +1 -0
- package/build/legacy/chunk-KETL4ZJK.js +33 -0
- package/build/legacy/chunk-KETL4ZJK.js.map +1 -0
- package/build/legacy/chunk-KJUCHZHV.js +51 -0
- package/build/legacy/chunk-KJUCHZHV.js.map +1 -0
- package/build/legacy/chunk-R4H3352X.js +16 -0
- package/build/legacy/chunk-R4H3352X.js.map +1 -0
- package/build/legacy/chunk-SXXWC6UD.js +83 -0
- package/build/legacy/chunk-SXXWC6UD.js.map +1 -0
- package/build/legacy/chunk-WSQTX34C.js +86 -0
- package/build/legacy/chunk-WSQTX34C.js.map +1 -0
- package/build/legacy/chunk-XFWARXLU.js +26 -0
- package/build/legacy/chunk-XFWARXLU.js.map +1 -0
- package/build/legacy/components/Button.js +3 -21
- package/build/legacy/components/Button.js.map +1 -1
- package/build/legacy/components/IconButton.js +3 -21
- package/build/legacy/components/IconButton.js.map +1 -1
- package/build/legacy/components/NavMenuLink.js +4 -40
- package/build/legacy/components/NavMenuLink.js.map +1 -1
- package/build/legacy/components/NavMenuList.js +6 -76
- package/build/legacy/components/NavMenuList.js.map +1 -1
- package/build/legacy/components/NavMenuTrigger.js +5 -72
- package/build/legacy/components/NavMenuTrigger.js.map +1 -1
- package/build/legacy/components/Show.js +3 -12
- package/build/legacy/components/Show.js.map +1 -1
- package/build/legacy/context/field.js +3 -27
- package/build/legacy/context/field.js.map +1 -1
- package/build/legacy/context/navMenu.js +3 -45
- package/build/legacy/context/navMenu.js.map +1 -1
- package/build/legacy/context/theme.js +6 -21
- package/build/legacy/context/theme.js.map +1 -1
- package/build/legacy/hooks/useTheme.js +2 -56
- package/build/legacy/hooks/useTheme.js.map +1 -1
- package/build/legacy/index.js +57 -13
- package/build/legacy/index.js.map +1 -1
- package/build/legacy/types.js +1 -0
- package/build/modern/aria-helpers/nav-menu.aria.js +3 -7
- package/build/modern/aria-helpers/nav-menu.aria.js.map +1 -1
- package/build/modern/chunk-55J6XMHW.js +1 -0
- package/build/modern/chunk-6YEAMVRY.js +82 -0
- package/build/modern/chunk-6YEAMVRY.js.map +1 -0
- package/build/modern/chunk-BPIYUAYS.js +26 -0
- package/build/modern/chunk-BPIYUAYS.js.map +1 -0
- package/build/modern/chunk-JA4IX7GN.js +48 -0
- package/build/modern/chunk-JA4IX7GN.js.map +1 -0
- package/build/modern/chunk-JF76VIL3.js +12 -0
- package/build/modern/chunk-JF76VIL3.js.map +1 -0
- package/build/modern/chunk-KETL4ZJK.js +33 -0
- package/build/modern/chunk-KETL4ZJK.js.map +1 -0
- package/build/modern/chunk-KJUCHZHV.js +51 -0
- package/build/modern/chunk-KJUCHZHV.js.map +1 -0
- package/build/modern/chunk-R4H3352X.js +16 -0
- package/build/modern/chunk-R4H3352X.js.map +1 -0
- package/build/modern/chunk-SXXWC6UD.js +83 -0
- package/build/modern/chunk-SXXWC6UD.js.map +1 -0
- package/build/modern/chunk-WSQTX34C.js +86 -0
- package/build/modern/chunk-WSQTX34C.js.map +1 -0
- package/build/modern/chunk-XFWARXLU.js +26 -0
- package/build/modern/chunk-XFWARXLU.js.map +1 -0
- package/build/modern/components/Button.js +3 -21
- package/build/modern/components/Button.js.map +1 -1
- package/build/modern/components/IconButton.js +3 -21
- package/build/modern/components/IconButton.js.map +1 -1
- package/build/modern/components/NavMenuLink.js +4 -40
- package/build/modern/components/NavMenuLink.js.map +1 -1
- package/build/modern/components/NavMenuList.js +6 -76
- package/build/modern/components/NavMenuList.js.map +1 -1
- package/build/modern/components/NavMenuTrigger.js +5 -72
- package/build/modern/components/NavMenuTrigger.js.map +1 -1
- package/build/modern/components/Show.js +3 -12
- package/build/modern/components/Show.js.map +1 -1
- package/build/modern/context/field.js +3 -27
- package/build/modern/context/field.js.map +1 -1
- package/build/modern/context/navMenu.js +3 -45
- package/build/modern/context/navMenu.js.map +1 -1
- package/build/modern/context/theme.js +6 -21
- package/build/modern/context/theme.js.map +1 -1
- package/build/modern/hooks/useTheme.js +2 -56
- package/build/modern/hooks/useTheme.js.map +1 -1
- package/build/modern/index.js +57 -13
- package/build/modern/index.js.map +1 -1
- package/build/modern/types.js +1 -0
- package/package.json +5 -12
- package/src/components/NavMenuLink.tsx +1 -1
- package/src/components/NavMenuList.tsx +3 -3
- package/src/components/NavMenuTrigger.tsx +2 -2
- package/build/legacy/_tsup-dts-rollup.d.cts +0 -254
- package/build/legacy/aria-helpers/nav-menu.aria.cjs +0 -36
- package/build/legacy/aria-helpers/nav-menu.aria.cjs.map +0 -1
- package/build/legacy/aria-helpers/nav-menu.aria.d.cts +0 -2
- package/build/legacy/components/Button.cjs +0 -50
- package/build/legacy/components/Button.cjs.map +0 -1
- package/build/legacy/components/Button.d.cts +0 -2
- package/build/legacy/components/IconButton.cjs +0 -50
- package/build/legacy/components/IconButton.cjs.map +0 -1
- package/build/legacy/components/IconButton.d.cts +0 -3
- package/build/legacy/components/NavMenuLink.cjs +0 -69
- package/build/legacy/components/NavMenuLink.cjs.map +0 -1
- package/build/legacy/components/NavMenuLink.d.cts +0 -2
- package/build/legacy/components/NavMenuList.cjs +0 -107
- package/build/legacy/components/NavMenuList.cjs.map +0 -1
- package/build/legacy/components/NavMenuList.d.cts +0 -3
- package/build/legacy/components/NavMenuTrigger.cjs +0 -98
- package/build/legacy/components/NavMenuTrigger.cjs.map +0 -1
- package/build/legacy/components/NavMenuTrigger.d.cts +0 -2
- package/build/legacy/components/Show.cjs +0 -41
- package/build/legacy/components/Show.cjs.map +0 -1
- package/build/legacy/components/Show.d.cts +0 -2
- package/build/legacy/context/field.cjs +0 -55
- package/build/legacy/context/field.cjs.map +0 -1
- package/build/legacy/context/field.d.cts +0 -3
- package/build/legacy/context/navMenu.cjs +0 -70
- package/build/legacy/context/navMenu.cjs.map +0 -1
- package/build/legacy/context/navMenu.d.cts +0 -5
- package/build/legacy/context/theme.cjs +0 -56
- package/build/legacy/context/theme.cjs.map +0 -1
- package/build/legacy/context/theme.d.cts +0 -8
- package/build/legacy/global.d.cjs +0 -2
- package/build/legacy/global.d.d.cts +0 -1
- package/build/legacy/global.d.d.ts +0 -1
- package/build/legacy/global.d.js +0 -1
- package/build/legacy/hooks/useTheme.cjs +0 -77
- package/build/legacy/hooks/useTheme.cjs.map +0 -1
- package/build/legacy/hooks/useTheme.d.cts +0 -1
- package/build/legacy/index.cjs +0 -47
- package/build/legacy/index.cjs.map +0 -1
- package/build/legacy/index.d.cts +0 -34
- package/build/legacy/types.cjs +0 -19
- package/build/legacy/types.cjs.map +0 -1
- package/build/legacy/types.d.cts +0 -1
- package/build/modern/_tsup-dts-rollup.d.cts +0 -254
- package/build/modern/aria-helpers/nav-menu.aria.cjs +0 -36
- package/build/modern/aria-helpers/nav-menu.aria.cjs.map +0 -1
- package/build/modern/aria-helpers/nav-menu.aria.d.cts +0 -2
- package/build/modern/components/Button.cjs +0 -50
- package/build/modern/components/Button.cjs.map +0 -1
- package/build/modern/components/Button.d.cts +0 -2
- package/build/modern/components/IconButton.cjs +0 -50
- package/build/modern/components/IconButton.cjs.map +0 -1
- package/build/modern/components/IconButton.d.cts +0 -3
- package/build/modern/components/NavMenuLink.cjs +0 -69
- package/build/modern/components/NavMenuLink.cjs.map +0 -1
- package/build/modern/components/NavMenuLink.d.cts +0 -2
- package/build/modern/components/NavMenuList.cjs +0 -107
- package/build/modern/components/NavMenuList.cjs.map +0 -1
- package/build/modern/components/NavMenuList.d.cts +0 -3
- package/build/modern/components/NavMenuTrigger.cjs +0 -98
- package/build/modern/components/NavMenuTrigger.cjs.map +0 -1
- package/build/modern/components/NavMenuTrigger.d.cts +0 -2
- package/build/modern/components/Show.cjs +0 -41
- package/build/modern/components/Show.cjs.map +0 -1
- package/build/modern/components/Show.d.cts +0 -2
- package/build/modern/context/field.cjs +0 -55
- package/build/modern/context/field.cjs.map +0 -1
- package/build/modern/context/field.d.cts +0 -3
- package/build/modern/context/navMenu.cjs +0 -70
- package/build/modern/context/navMenu.cjs.map +0 -1
- package/build/modern/context/navMenu.d.cts +0 -5
- package/build/modern/context/theme.cjs +0 -56
- package/build/modern/context/theme.cjs.map +0 -1
- package/build/modern/context/theme.d.cts +0 -8
- package/build/modern/global.d.cjs +0 -2
- package/build/modern/global.d.cjs.map +0 -1
- package/build/modern/global.d.d.cts +0 -1
- package/build/modern/global.d.d.ts +0 -1
- package/build/modern/global.d.js +0 -1
- package/build/modern/global.d.js.map +0 -1
- package/build/modern/hooks/useTheme.cjs +0 -77
- package/build/modern/hooks/useTheme.cjs.map +0 -1
- package/build/modern/hooks/useTheme.d.cts +0 -1
- package/build/modern/index.cjs +0 -47
- package/build/modern/index.cjs.map +0 -1
- package/build/modern/index.d.cts +0 -34
- package/build/modern/types.cjs +0 -19
- package/build/modern/types.cjs.map +0 -1
- package/build/modern/types.d.cts +0 -1
- package/src/global.d.ts +0 -19
- /package/build/legacy/{global.d.cjs.map → chunk-55J6XMHW.js.map} +0 -0
- /package/build/{legacy/global.d.js.map → modern/chunk-55J6XMHW.js.map} +0 -0
|
@@ -1,43 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
function NavMenuLink(props) {
|
|
6
|
-
const { as, ...nativeProps } = props;
|
|
7
|
-
const hasAs = Boolean(as);
|
|
8
|
-
const AsSub = as;
|
|
9
|
-
return /* @__PURE__ */ jsx(
|
|
10
|
-
"li",
|
|
11
|
-
{
|
|
12
|
-
className: css({
|
|
13
|
-
w: "full"
|
|
14
|
-
}),
|
|
15
|
-
children: /* @__PURE__ */ jsx(
|
|
16
|
-
Show,
|
|
17
|
-
{
|
|
18
|
-
when: hasAs,
|
|
19
|
-
fallback: /* @__PURE__ */ jsx(
|
|
20
|
-
"a",
|
|
21
|
-
{
|
|
22
|
-
...nativeProps,
|
|
23
|
-
className: cx(
|
|
24
|
-
nativeProps.className,
|
|
25
|
-
css({
|
|
26
|
-
color: "action.navigation.initial",
|
|
27
|
-
textStyle: "link",
|
|
28
|
-
_hover: {
|
|
29
|
-
color: "action.navigation.hover"
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
),
|
|
35
|
-
children: hasAs && /* @__PURE__ */ jsx(AsSub, { ...nativeProps })
|
|
36
|
-
}
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
NavMenuLink
|
|
3
|
+
} from "../chunk-JA4IX7GN.js";
|
|
4
|
+
import "../chunk-R4H3352X.js";
|
|
41
5
|
export {
|
|
42
6
|
NavMenuLink
|
|
43
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,80 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { vstack } from "@cerberus/styled-system/patterns.js";
|
|
9
|
-
import { jsx } from "react/jsx-runtime";
|
|
10
|
-
function getPosition(position) {
|
|
11
|
-
const defaultPositions = {
|
|
12
|
-
left: "auto",
|
|
13
|
-
right: "auto",
|
|
14
|
-
top: "auto",
|
|
15
|
-
bottom: "auto"
|
|
16
|
-
};
|
|
17
|
-
switch (position) {
|
|
18
|
-
case "right":
|
|
19
|
-
return { ...defaultPositions, top: "0%", left: "105%" };
|
|
20
|
-
case "left":
|
|
21
|
-
return { ...defaultPositions, top: "0%", right: "105%" };
|
|
22
|
-
case "bottom":
|
|
23
|
-
return { ...defaultPositions, top: "110%" };
|
|
24
|
-
case "top":
|
|
25
|
-
return { ...defaultPositions, bottom: "110%" };
|
|
26
|
-
default:
|
|
27
|
-
return defaultPositions;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
var navListStyles = vstack({
|
|
31
|
-
alignItems: "flex-start",
|
|
32
|
-
bgColor: "neutral.surface.100",
|
|
33
|
-
boxShadow: "lg",
|
|
34
|
-
gap: "2",
|
|
35
|
-
opacity: "0",
|
|
36
|
-
p: "4",
|
|
37
|
-
position: "absolute",
|
|
38
|
-
rounded: "md",
|
|
39
|
-
zIndex: "dropdown",
|
|
40
|
-
_motionSafe: {
|
|
41
|
-
animationName: "zoomIn",
|
|
42
|
-
animationDelay: "100ms",
|
|
43
|
-
animationDuration: "150ms",
|
|
44
|
-
animationFillMode: "both",
|
|
45
|
-
animationTimingFunction: "ease-in-out"
|
|
46
|
-
},
|
|
47
|
-
_positionBottom: {
|
|
48
|
-
transformOrigin: "top left"
|
|
49
|
-
},
|
|
50
|
-
_positionTop: {
|
|
51
|
-
transformOrigin: "bottom left"
|
|
52
|
-
},
|
|
53
|
-
_positionLeft: {
|
|
54
|
-
transformOrigin: "top right"
|
|
55
|
-
},
|
|
56
|
-
_positionRight: {
|
|
57
|
-
transformOrigin: "top left"
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
function NavMenuList(props) {
|
|
61
|
-
const { position, ...nativeProps } = props;
|
|
62
|
-
const { menuRef, expanded } = useNavMenuContext();
|
|
63
|
-
const locationStyles = useMemo(
|
|
64
|
-
() => getPosition(position ?? "bottom"),
|
|
65
|
-
[position]
|
|
66
|
-
);
|
|
67
|
-
return /* @__PURE__ */ jsx(Show, { when: expanded, children: /* @__PURE__ */ jsx(
|
|
68
|
-
"ul",
|
|
69
|
-
{
|
|
70
|
-
...nativeProps,
|
|
71
|
-
"data-position": position ?? "bottom",
|
|
72
|
-
className: cx(nativeProps.className, navListStyles),
|
|
73
|
-
ref: menuRef,
|
|
74
|
-
style: locationStyles
|
|
75
|
-
}
|
|
76
|
-
) });
|
|
77
|
-
}
|
|
2
|
+
import {
|
|
3
|
+
NavMenuList,
|
|
4
|
+
getPosition
|
|
5
|
+
} from "../chunk-WSQTX34C.js";
|
|
6
|
+
import "../chunk-KJUCHZHV.js";
|
|
7
|
+
import "../chunk-R4H3352X.js";
|
|
78
8
|
export {
|
|
79
9
|
NavMenuList,
|
|
80
10
|
getPosition
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,77 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
// src/components/NavMenuTrigger.tsx
|
|
4
2
|
import {
|
|
5
|
-
|
|
6
|
-
} from "
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
createNavTriggerProps
|
|
11
|
-
} from "../aria-helpers/nav-menu.aria.js";
|
|
12
|
-
import { Show } from "./Show.js";
|
|
13
|
-
import { useNavMenuContext } from "../context/navMenu.js";
|
|
14
|
-
import { jsx } from "react/jsx-runtime";
|
|
15
|
-
function NavMenuTrigger(props) {
|
|
16
|
-
const {
|
|
17
|
-
as,
|
|
18
|
-
palette,
|
|
19
|
-
usage,
|
|
20
|
-
shape,
|
|
21
|
-
controls,
|
|
22
|
-
expanded: propsExpanded,
|
|
23
|
-
onClick,
|
|
24
|
-
...nativeProps
|
|
25
|
-
} = props;
|
|
26
|
-
const { triggerRef, onToggle, expanded } = useNavMenuContext();
|
|
27
|
-
const ariaProps = createNavTriggerProps({
|
|
28
|
-
controls,
|
|
29
|
-
expanded: propsExpanded ?? expanded
|
|
30
|
-
});
|
|
31
|
-
const hasAs = Boolean(as);
|
|
32
|
-
const AsSub = as;
|
|
33
|
-
const handleClick = useCallback(
|
|
34
|
-
(e) => {
|
|
35
|
-
if (onClick)
|
|
36
|
-
return onClick(e);
|
|
37
|
-
onToggle();
|
|
38
|
-
},
|
|
39
|
-
[onClick, onToggle]
|
|
40
|
-
);
|
|
41
|
-
return /* @__PURE__ */ jsx(
|
|
42
|
-
Show,
|
|
43
|
-
{
|
|
44
|
-
when: hasAs,
|
|
45
|
-
fallback: /* @__PURE__ */ jsx(
|
|
46
|
-
"button",
|
|
47
|
-
{
|
|
48
|
-
...nativeProps,
|
|
49
|
-
...ariaProps,
|
|
50
|
-
className: cx(
|
|
51
|
-
nativeProps.className,
|
|
52
|
-
button({
|
|
53
|
-
palette,
|
|
54
|
-
usage,
|
|
55
|
-
shape
|
|
56
|
-
})
|
|
57
|
-
),
|
|
58
|
-
onClick: handleClick,
|
|
59
|
-
ref: triggerRef,
|
|
60
|
-
children: props.children
|
|
61
|
-
}
|
|
62
|
-
),
|
|
63
|
-
children: hasAs && /* @__PURE__ */ jsx(
|
|
64
|
-
AsSub,
|
|
65
|
-
{
|
|
66
|
-
...nativeProps,
|
|
67
|
-
...ariaProps,
|
|
68
|
-
onClick: handleClick,
|
|
69
|
-
ref: triggerRef
|
|
70
|
-
}
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
}
|
|
3
|
+
NavMenuTrigger
|
|
4
|
+
} from "../chunk-6YEAMVRY.js";
|
|
5
|
+
import "../chunk-JF76VIL3.js";
|
|
6
|
+
import "../chunk-KJUCHZHV.js";
|
|
7
|
+
import "../chunk-R4H3352X.js";
|
|
75
8
|
export {
|
|
76
9
|
NavMenuTrigger
|
|
77
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function Show(props) {
|
|
6
|
-
const { when, children, fallback } = props;
|
|
7
|
-
const condition = useMemo(() => when ?? false, [when]);
|
|
8
|
-
return useMemo(() => {
|
|
9
|
-
if (condition)
|
|
10
|
-
return children;
|
|
11
|
-
return fallback ?? null;
|
|
12
|
-
}, [condition, children, fallback]);
|
|
13
|
-
}
|
|
2
|
+
import {
|
|
3
|
+
Show
|
|
4
|
+
} from "../chunk-R4H3352X.js";
|
|
14
5
|
export {
|
|
15
6
|
Show
|
|
16
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,32 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
// src/context/field.tsx
|
|
4
2
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "react";
|
|
9
|
-
import { jsx } from "react/jsx-runtime";
|
|
10
|
-
var FieldContext = createContext(null);
|
|
11
|
-
function Field(props) {
|
|
12
|
-
const value = useMemo(
|
|
13
|
-
() => ({
|
|
14
|
-
disabled: props.disabled,
|
|
15
|
-
readonly: props.readonly,
|
|
16
|
-
required: props.required,
|
|
17
|
-
invalid: props.invalid
|
|
18
|
-
}),
|
|
19
|
-
[props.disabled, props.readonly, props.required, props.invalid]
|
|
20
|
-
);
|
|
21
|
-
return /* @__PURE__ */ jsx(FieldContext.Provider, { value, children: props.children });
|
|
22
|
-
}
|
|
23
|
-
function useFieldContext() {
|
|
24
|
-
const context = useContext(FieldContext);
|
|
25
|
-
if (!context) {
|
|
26
|
-
throw new Error("useFieldContext must be used within a Field Provider.");
|
|
27
|
-
}
|
|
28
|
-
return context;
|
|
29
|
-
}
|
|
3
|
+
Field,
|
|
4
|
+
useFieldContext
|
|
5
|
+
} from "../chunk-KETL4ZJK.js";
|
|
30
6
|
export {
|
|
31
7
|
Field,
|
|
32
8
|
useFieldContext
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,50 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
// src/context/navMenu.tsx
|
|
4
|
-
import { css } from "@cerberus/styled-system/css.js";
|
|
5
2
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
useMemo,
|
|
10
|
-
useRef,
|
|
11
|
-
useState
|
|
12
|
-
} from "react";
|
|
13
|
-
import { jsx } from "react/jsx-runtime";
|
|
14
|
-
var NavMenuContext = createContext(null);
|
|
15
|
-
function NavMenu(props) {
|
|
16
|
-
const triggerRef = useRef(null);
|
|
17
|
-
const menuRef = useRef(null);
|
|
18
|
-
const [expanded, setExpanded] = useState(false);
|
|
19
|
-
const handleToggle = useCallback(() => {
|
|
20
|
-
setExpanded((prev) => !prev);
|
|
21
|
-
}, []);
|
|
22
|
-
const value = useMemo(
|
|
23
|
-
() => ({
|
|
24
|
-
triggerRef,
|
|
25
|
-
menuRef,
|
|
26
|
-
expanded,
|
|
27
|
-
onToggle: handleToggle
|
|
28
|
-
}),
|
|
29
|
-
[expanded, handleToggle]
|
|
30
|
-
);
|
|
31
|
-
return /* @__PURE__ */ jsx(NavMenuContext.Provider, { value, children: /* @__PURE__ */ jsx(
|
|
32
|
-
"nav",
|
|
33
|
-
{
|
|
34
|
-
className: css({
|
|
35
|
-
position: "relative"
|
|
36
|
-
}),
|
|
37
|
-
children: props.children
|
|
38
|
-
}
|
|
39
|
-
) });
|
|
40
|
-
}
|
|
41
|
-
function useNavMenuContext() {
|
|
42
|
-
const context = useContext(NavMenuContext);
|
|
43
|
-
if (!context) {
|
|
44
|
-
throw new Error("useNavMenuContext must be used within a NavMenu.");
|
|
45
|
-
}
|
|
46
|
-
return context;
|
|
47
|
-
}
|
|
3
|
+
NavMenu,
|
|
4
|
+
useNavMenuContext
|
|
5
|
+
} from "../chunk-KJUCHZHV.js";
|
|
48
6
|
export {
|
|
49
7
|
NavMenu,
|
|
50
8
|
useNavMenuContext
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,25 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var MODE_KEY = "cerberus-mode";
|
|
9
|
-
var ThemeContext = createContext(
|
|
10
|
-
null
|
|
11
|
-
);
|
|
12
|
-
function ThemeProvider(props) {
|
|
13
|
-
const state = useTheme();
|
|
14
|
-
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: state, children: props.children });
|
|
15
|
-
}
|
|
16
|
-
function useThemeContext() {
|
|
17
|
-
const context = useContext(ThemeContext);
|
|
18
|
-
if (!context) {
|
|
19
|
-
throw new Error("useThemeContext must be used within a ThemeProvider");
|
|
20
|
-
}
|
|
21
|
-
return context;
|
|
22
|
-
}
|
|
2
|
+
import {
|
|
3
|
+
MODE_KEY,
|
|
4
|
+
THEME_KEY,
|
|
5
|
+
ThemeProvider,
|
|
6
|
+
useThemeContext
|
|
7
|
+
} from "../chunk-SXXWC6UD.js";
|
|
23
8
|
export {
|
|
24
9
|
MODE_KEY,
|
|
25
10
|
THEME_KEY,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,61 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
// src/hooks/useTheme.ts
|
|
4
2
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
useLayoutEffect,
|
|
8
|
-
useMemo,
|
|
9
|
-
useState
|
|
10
|
-
} from "react";
|
|
11
|
-
import {
|
|
12
|
-
MODE_KEY,
|
|
13
|
-
THEME_KEY
|
|
14
|
-
} from "../context/theme.js";
|
|
15
|
-
function useTheme(defaultTheme = "cerberus", defaultColorMode = "light") {
|
|
16
|
-
const [theme, setTheme] = useState(defaultTheme);
|
|
17
|
-
const [colorMode, setColorMode] = useState(defaultColorMode);
|
|
18
|
-
const handleThemeChange = useCallback((newTheme) => {
|
|
19
|
-
setTheme(newTheme);
|
|
20
|
-
localStorage.setItem(THEME_KEY, newTheme);
|
|
21
|
-
}, []);
|
|
22
|
-
const handleColorModeChange = useCallback(() => {
|
|
23
|
-
setColorMode((prev) => {
|
|
24
|
-
const newMode = prev === "light" ? "dark" : "light";
|
|
25
|
-
localStorage.setItem(MODE_KEY, newMode);
|
|
26
|
-
return newMode;
|
|
27
|
-
});
|
|
28
|
-
}, []);
|
|
29
|
-
useLayoutEffect(() => {
|
|
30
|
-
const theme2 = localStorage.getItem(THEME_KEY);
|
|
31
|
-
if (theme2) {
|
|
32
|
-
setTheme(theme2);
|
|
33
|
-
}
|
|
34
|
-
}, []);
|
|
35
|
-
useLayoutEffect(() => {
|
|
36
|
-
const mode = localStorage.getItem(MODE_KEY);
|
|
37
|
-
if (mode) {
|
|
38
|
-
setColorMode(mode);
|
|
39
|
-
}
|
|
40
|
-
}, []);
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
const root = document.documentElement;
|
|
43
|
-
root.dataset.theme = theme;
|
|
44
|
-
}, [theme]);
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
const root = document.documentElement;
|
|
47
|
-
root.dataset.colorMode = colorMode;
|
|
48
|
-
}, [colorMode]);
|
|
49
|
-
return useMemo(
|
|
50
|
-
() => ({
|
|
51
|
-
theme,
|
|
52
|
-
mode: colorMode,
|
|
53
|
-
updateTheme: handleThemeChange,
|
|
54
|
-
updateMode: handleColorModeChange
|
|
55
|
-
}),
|
|
56
|
-
[theme, colorMode, handleThemeChange, handleColorModeChange]
|
|
57
|
-
);
|
|
58
|
-
}
|
|
3
|
+
useTheme
|
|
4
|
+
} from "../chunk-SXXWC6UD.js";
|
|
59
5
|
export {
|
|
60
6
|
useTheme
|
|
61
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/build/modern/index.js
CHANGED
|
@@ -1,14 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import {
|
|
2
|
+
NavMenuTrigger
|
|
3
|
+
} from "./chunk-6YEAMVRY.js";
|
|
4
|
+
import {
|
|
5
|
+
Field,
|
|
6
|
+
useFieldContext
|
|
7
|
+
} from "./chunk-KETL4ZJK.js";
|
|
8
|
+
import "./chunk-55J6XMHW.js";
|
|
9
|
+
import {
|
|
10
|
+
createNavTriggerProps
|
|
11
|
+
} from "./chunk-JF76VIL3.js";
|
|
12
|
+
import {
|
|
13
|
+
MODE_KEY,
|
|
14
|
+
THEME_KEY,
|
|
15
|
+
ThemeProvider,
|
|
16
|
+
useTheme,
|
|
17
|
+
useThemeContext
|
|
18
|
+
} from "./chunk-SXXWC6UD.js";
|
|
19
|
+
import {
|
|
20
|
+
Button
|
|
21
|
+
} from "./chunk-XFWARXLU.js";
|
|
22
|
+
import {
|
|
23
|
+
IconButton
|
|
24
|
+
} from "./chunk-BPIYUAYS.js";
|
|
25
|
+
import {
|
|
26
|
+
NavMenuLink
|
|
27
|
+
} from "./chunk-JA4IX7GN.js";
|
|
28
|
+
import {
|
|
29
|
+
NavMenuList,
|
|
30
|
+
getPosition
|
|
31
|
+
} from "./chunk-WSQTX34C.js";
|
|
32
|
+
import {
|
|
33
|
+
NavMenu,
|
|
34
|
+
useNavMenuContext
|
|
35
|
+
} from "./chunk-KJUCHZHV.js";
|
|
36
|
+
import {
|
|
37
|
+
Show
|
|
38
|
+
} from "./chunk-R4H3352X.js";
|
|
39
|
+
export {
|
|
40
|
+
Button,
|
|
41
|
+
Field,
|
|
42
|
+
IconButton,
|
|
43
|
+
MODE_KEY,
|
|
44
|
+
NavMenu,
|
|
45
|
+
NavMenuLink,
|
|
46
|
+
NavMenuList,
|
|
47
|
+
NavMenuTrigger,
|
|
48
|
+
Show,
|
|
49
|
+
THEME_KEY,
|
|
50
|
+
ThemeProvider,
|
|
51
|
+
createNavTriggerProps,
|
|
52
|
+
getPosition,
|
|
53
|
+
useFieldContext,
|
|
54
|
+
useNavMenuContext,
|
|
55
|
+
useTheme,
|
|
56
|
+
useThemeContext
|
|
57
|
+
};
|
|
14
58
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/build/modern/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerberus-design/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1-next-3a4c6c1",
|
|
4
4
|
"description": "The Cerberus Design React component library.",
|
|
5
5
|
"browserslist": "> 0.25%, not dead",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"main": "build/legacy/index.cjs",
|
|
9
9
|
"module": "build/legacy/index.js",
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"@cerberus
|
|
12
|
-
"@cerberus
|
|
11
|
+
"@cerberus/panda-preset": "npm:@jsr/cerberus__panda-preset",
|
|
12
|
+
"@cerberus/styled-system": "npm:@cerberus-design/styled-system",
|
|
13
13
|
"@pandacss/dev": "*",
|
|
14
14
|
"react": "*",
|
|
15
15
|
"react-dom": "*"
|
|
@@ -20,8 +20,7 @@
|
|
|
20
20
|
"react": "^18",
|
|
21
21
|
"react-dom": "^18",
|
|
22
22
|
"tsup": "^8.0.2",
|
|
23
|
-
"@cerberus-design/configs": "0.0.0"
|
|
24
|
-
"@cerberus-design/styled-system": "0.1.0"
|
|
23
|
+
"@cerberus-design/configs": "0.0.0"
|
|
25
24
|
},
|
|
26
25
|
"publishConfig": {
|
|
27
26
|
"access": "public"
|
|
@@ -46,7 +45,7 @@
|
|
|
46
45
|
"author": "developers@omnifederal.com",
|
|
47
46
|
"license": "ISC",
|
|
48
47
|
"scripts": {
|
|
49
|
-
"build": "tsup --experimental-dts",
|
|
48
|
+
"build": "tsup-node --experimental-dts",
|
|
50
49
|
"clean": "rm -rf ./build",
|
|
51
50
|
"lint:ts": "tsc --project tsconfig.lint.json --noEmit"
|
|
52
51
|
},
|
|
@@ -62,12 +61,6 @@
|
|
|
62
61
|
"default": "./build/modern/index.cjs"
|
|
63
62
|
}
|
|
64
63
|
},
|
|
65
|
-
"./src": {
|
|
66
|
-
"import": {
|
|
67
|
-
"types": "./src/index.d.ts",
|
|
68
|
-
"default": "./src/index.ts"
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
64
|
"./package.json": "./package.json"
|
|
72
65
|
},
|
|
73
66
|
"typesVersions": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AnchorHTMLAttributes, ElementType } from 'react'
|
|
2
|
-
import { Show } from './Show'
|
|
3
2
|
import { css, cx } from '@cerberus/styled-system/css'
|
|
3
|
+
import { Show } from './Show'
|
|
4
4
|
|
|
5
5
|
export interface NavMenuLinkProps
|
|
6
6
|
extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import { useMemo, type HTMLAttributes } from 'react'
|
|
4
|
-
import { useNavMenuContext } from '../context/navMenu'
|
|
5
|
-
import { Show } from './Show'
|
|
6
|
-
import type { Positions } from '../types'
|
|
7
4
|
import { cx } from '@cerberus/styled-system/css'
|
|
8
5
|
import { vstack } from '@cerberus/styled-system/patterns'
|
|
6
|
+
import { useNavMenuContext } from '../context/navMenu'
|
|
7
|
+
import type { Positions } from '../types'
|
|
8
|
+
import { Show } from './Show'
|
|
9
9
|
|
|
10
10
|
interface GetPositionResult {
|
|
11
11
|
left: string
|