@bccampus/ui-components 0.2.0 → 0.3.0

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,165 @@
1
+ import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
2
+ import { ChevronDownIcon } from "lucide-react";
3
+
4
+ import { cn } from "@/lib/utils";
5
+ import { buttonVariants } from "./button";
6
+
7
+ function NavigationMenu({
8
+ className,
9
+ children,
10
+ noViewport = false,
11
+ mega = false,
12
+ ...props
13
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Root> & {
14
+ noViewport?: boolean;
15
+ mega?: boolean;
16
+ }) {
17
+ return (
18
+ <NavigationMenuPrimitive.Root
19
+ data-slot="navigation-menu"
20
+ data-mega={mega}
21
+ data-viewport={!noViewport || mega}
22
+ className={cn(
23
+ "group/navigation-menu flex max-w-max flex-1 items-center justify-center",
24
+ { relative: !mega },
25
+ className
26
+ )}
27
+ {...props}
28
+ >
29
+ {children}
30
+ {(!noViewport || mega) && <NavigationMenuViewport mega={mega} />}
31
+ </NavigationMenuPrimitive.Root>
32
+ );
33
+ }
34
+
35
+ function NavigationMenuList({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.List>) {
36
+ return (
37
+ <NavigationMenuPrimitive.List
38
+ data-slot="navigation-menu-list"
39
+ className={cn("group flex flex-1 list-none items-center justify-center gap-1", className)}
40
+ {...props}
41
+ />
42
+ );
43
+ }
44
+
45
+ function NavigationMenuItem({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Item>) {
46
+ return (
47
+ <NavigationMenuPrimitive.Item data-slot="navigation-menu-item" className={cn("relative", className)} {...props} />
48
+ );
49
+ }
50
+
51
+ const navigationMenuTriggerStyle = buttonVariants({
52
+ variant: "ghost",
53
+ className:
54
+ "data-[state=open]:hover:text-secondary data-[state=open]:focus:text-secondary data-[state=open]:text-secondary",
55
+ });
56
+
57
+ function NavigationMenuTrigger({
58
+ className,
59
+ children,
60
+ ...props
61
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>) {
62
+ return (
63
+ <NavigationMenuPrimitive.Trigger
64
+ data-slot="navigation-menu-trigger"
65
+ className={cn(navigationMenuTriggerStyle, "group", className)}
66
+ {...props}
67
+ >
68
+ {children}{" "}
69
+ <ChevronDownIcon
70
+ className="relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180"
71
+ aria-hidden="true"
72
+ />
73
+ </NavigationMenuPrimitive.Trigger>
74
+ );
75
+ }
76
+
77
+ function NavigationMenuContent({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Content>) {
78
+ return (
79
+ <NavigationMenuPrimitive.Content
80
+ data-slot="navigation-menu-content"
81
+ className={cn(
82
+ "max-md:h-[calc(100vh-var(--spacing-page-nav))] top-0 left-0 min-w-xs w-auto absolute group-data-[mega=true]/navigation-menu:w-full",
83
+ "data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52",
84
+ "group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0",
85
+ "group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none",
86
+ className
87
+ )}
88
+ {...props}
89
+ />
90
+ );
91
+ }
92
+
93
+ function NavigationMenuViewport({
94
+ className,
95
+ mega = false,
96
+ ...props
97
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport> & {
98
+ mega?: boolean;
99
+ }) {
100
+ return (
101
+ <div
102
+ className={cn("absolute top-full left-0 isolate z-50 flex justify-center bg-popover", {
103
+ "min-w-xs": !mega,
104
+ "w-full px-(--spacing-section)": mega,
105
+ })}
106
+ >
107
+ <NavigationMenuPrimitive.Viewport
108
+ data-slot="navigation-menu-viewport"
109
+ className={cn(
110
+ "origin-top-center duration-150 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in",
111
+ "bg-popover text-popover-foreground relative overflow-hidden w-full h-[var(--radix-navigation-menu-viewport-height)] overscroll-contain",
112
+ {
113
+ "mt-1.5 rounded-md border shadow md:w-[var(--radix-navigation-menu-viewport-width)]": !mega,
114
+ "border-b-1 border-complement-1-50": mega,
115
+ },
116
+ className
117
+ )}
118
+ {...props}
119
+ />
120
+ </div>
121
+ );
122
+ }
123
+
124
+ function NavigationMenuLink({ className, ...props }: React.ComponentProps<typeof NavigationMenuPrimitive.Link>) {
125
+ return (
126
+ <NavigationMenuPrimitive.Link
127
+ data-slot="navigation-menu-link"
128
+ className={cn(
129
+ "[&_svg:not([class*='text-'])]:text-muted-foreground flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4",
130
+ className
131
+ )}
132
+ {...props}
133
+ />
134
+ );
135
+ }
136
+
137
+ function NavigationMenuIndicator({
138
+ className,
139
+ ...props
140
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>) {
141
+ return (
142
+ <NavigationMenuPrimitive.Indicator
143
+ data-slot="navigation-menu-indicator"
144
+ className={cn(
145
+ "data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden",
146
+ className
147
+ )}
148
+ {...props}
149
+ >
150
+ <div className="bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" />
151
+ </NavigationMenuPrimitive.Indicator>
152
+ );
153
+ }
154
+
155
+ export {
156
+ NavigationMenu,
157
+ NavigationMenuList,
158
+ NavigationMenuItem,
159
+ NavigationMenuContent,
160
+ NavigationMenuTrigger,
161
+ NavigationMenuLink,
162
+ NavigationMenuIndicator,
163
+ NavigationMenuViewport,
164
+ navigationMenuTriggerStyle,
165
+ };
@@ -1,14 +1,22 @@
1
+ import { Slot } from "@radix-ui/react-slot";
1
2
  import { PageSection } from "./page-section";
2
3
  import { LogoBCcampusWithTagline } from "@bccampus/media-kit";
3
4
 
4
- function PageHeader({ children, ...props }: React.ComponentProps<"div">) {
5
+ export type PageHeaderProps = React.ComponentProps<"div"> & {
6
+ asChild?: boolean;
7
+ };
8
+
9
+ function PageHeader({ children, asChild, ...props }: PageHeaderProps) {
10
+ const Comp = asChild ? Slot : "div";
5
11
  return (
6
- <PageSection py="none" className="sticky top-0 right-0 left-0 z-10 bg-background" {...props}>
7
- <div className="h-page-nav flex flex-row flex-nowrap place-items-center border-b-1 border-b-complement-1-50 py-4 gap-12">
8
- <LogoBCcampusWithTagline height="100%" variant="color" />
12
+ <PageSection py="none" className="sticky top-0 right-0 left-0 z-50 bg-background" {...props}>
13
+ <Comp className="h-page-nav overflow-hidden flex flex-row flex-nowrap border-b-1 border-b-complement-1-50 gap-2 sm:gap-12 justify-between items-center sm:justify-start">
14
+ <div className="py-4 h-full">
15
+ <LogoBCcampusWithTagline height="100%" variant="color" />
16
+ </div>
9
17
 
10
18
  {children}
11
- </div>
19
+ </Comp>
12
20
  </PageSection>
13
21
  );
14
22
  }
@@ -5,17 +5,17 @@ const pageSectionVariants = cva("group @container/page-section relative w-full",
5
5
  variants: {
6
6
  px: {
7
7
  none: "px-0",
8
- default: "px-section",
9
- sm: "px-sextion-sm",
10
- lg: "px-section-lg",
11
- xl: "px-section-xl",
8
+ default: "px-(--spacing-section)",
9
+ sm: "px-(--spacing-section-sm)",
10
+ lg: "px-(--spacing-section-lg)",
11
+ xl: "px-(--spacing-section-xl)",
12
12
  },
13
13
  py: {
14
14
  none: "py-0",
15
- default: "py-section",
16
- sm: "py-sextion-sm",
17
- lg: "py-section-lg",
18
- xl: "py-section-xl",
15
+ default: "py-(--spacing-section)",
16
+ sm: "py-(--spacing-section-sm)",
17
+ lg: "py-(--spacing-section-lg)",
18
+ xl: "py-(--spacing-section-xl)",
19
19
  },
20
20
  },
21
21
  defaultVariants: {
@@ -3,7 +3,9 @@ import { cn } from "@/lib/utils";
3
3
  export type PageProps = React.ComponentProps<"div">;
4
4
 
5
5
  function Page({ className, ...props }: PageProps) {
6
- return <div data-slot="page" className={cn("group @container/page relative w-full", className)} {...props} />;
6
+ return (
7
+ <div data-slot="page" className={cn("group/page @container/page relative w-full", className)} {...props} />
8
+ );
7
9
  }
8
10
 
9
11
  export { Page };
@@ -69,7 +69,7 @@
69
69
  --secondary: oklch(0.5393 0.0909 200);
70
70
  --secondary-foreground: oklch(0.985 0 0);
71
71
  --muted: oklch(0.967 0.001 286.375);
72
- --muted-foreground: oklch(0.552 0.016 285.938);
72
+ --muted-foreground: oklch(0.45 0.0236 285.938);
73
73
  --accent: oklch(0.967 0.001 286.375);
74
74
  --accent-foreground: oklch(0.3741 0.0774 245.65);
75
75
  --destructive: oklch(0.577 0.245 27.325);
@@ -91,11 +91,11 @@
91
91
  --sidebar-ring: oklch(0.5393 0.0909 199.73);
92
92
 
93
93
  /* Responsive Layout Spacing */
94
- --section-p: --spacing(6);
95
- --card-p: --spacing(6);
94
+ --section-p: --spacing(4);
95
+ --card-p: --spacing(4);
96
96
  --page-gap: --spacing(0);
97
- --card-gap: --spacing(6);
98
- --card-area-gap: --spacing(6);
97
+ --card-gap: --spacing(4);
98
+ --card-area-gap: --spacing(4);
99
99
  --card-item-group-gap: --spacing(2);
100
100
 
101
101
  @media (width >= 40rem) {
@@ -169,8 +169,8 @@
169
169
  }
170
170
 
171
171
  @utility areas-* {
172
- grid-template-areas: --value(*, [*]);
173
- grid-template-columns: --modifier(*, [*]);
172
+ grid-template-areas: --value(*, [ *]);
173
+ grid-template-columns: --modifier(*, [ *]);
174
174
  }
175
175
 
176
176
  @utility stick-to-page {