@bccampus/ui-components 0.5.7 → 0.5.9
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/ui/card.d.ts +6 -9
- package/dist/components/ui/card.js +12 -19
- package/package.json +2 -2
- package/src/components/ui/card.tsx +12 -23
- package/src/styles/theme.css +3 -2
- package/dist/components/ui/composite/layout-grid.d.ts +0 -2
- package/dist/components/ui/composite/layout-grid.js +0 -59
- package/src/components/ui/composite/layout-grid.tsx +0 -61
|
@@ -17,14 +17,11 @@ type CardTitleProps = React.ComponentProps<"div"> & {
|
|
|
17
17
|
};
|
|
18
18
|
declare function CardTitle({ size, className, ...props }: CardTitleProps): import("react").JSX.Element;
|
|
19
19
|
declare function CardSubtitle({ size, className, ...props }: CardTitleProps): import("react").JSX.Element;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
declare function
|
|
24
|
-
declare function
|
|
25
|
-
declare function
|
|
26
|
-
declare function CardContent({ asChild, ...props }: CardChildProps): import("react").JSX.Element;
|
|
27
|
-
declare function CardToolbar({ className, asChild, ...props }: CardChildProps): import("react").JSX.Element;
|
|
28
|
-
declare function CardMedia({ className, asChild, ...props }: CardChildProps): import("react").JSX.Element;
|
|
20
|
+
declare function CardCaption(props: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
21
|
+
declare function CardSubcaption(props: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
22
|
+
declare function CardMeta(props: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
23
|
+
declare function CardContent(props: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
24
|
+
declare function CardToolbar({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
25
|
+
declare function CardMedia({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
29
26
|
declare function CardImage({ className, ...props }: React.ComponentProps<"img">): import("react").JSX.Element;
|
|
30
27
|
export { Card, CardArea, CardItemGroup, CardToolbar, CardTitle, CardSubtitle, CardCaption, CardSubcaption, CardMeta, CardContent, CardMedia, CardImage, };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { S as Slot } from "../../_chunks/index.js";
|
|
3
2
|
import { c as cn } from "../../_chunks/utils.js";
|
|
4
3
|
import { Caption } from "./typography/caption.js";
|
|
5
4
|
import { c as cva } from "../../_chunks/index2.js";
|
|
@@ -73,29 +72,23 @@ function CardSubtitle({ size = "md", className, ...props }) {
|
|
|
73
72
|
}
|
|
74
73
|
);
|
|
75
74
|
}
|
|
76
|
-
function CardCaption(
|
|
77
|
-
|
|
78
|
-
return /* @__PURE__ */ jsx(Comp, { variant: "light", ...props });
|
|
75
|
+
function CardCaption(props) {
|
|
76
|
+
return /* @__PURE__ */ jsx(Caption, { ...props });
|
|
79
77
|
}
|
|
80
|
-
function CardSubcaption(
|
|
81
|
-
|
|
82
|
-
return /* @__PURE__ */ jsx(Comp, { variant: "light", ...props });
|
|
78
|
+
function CardSubcaption(props) {
|
|
79
|
+
return /* @__PURE__ */ jsx(Caption, { variant: "light", ...props });
|
|
83
80
|
}
|
|
84
|
-
function CardMeta(
|
|
85
|
-
|
|
86
|
-
return /* @__PURE__ */ jsx(Comp, { variant: "light", ...props });
|
|
81
|
+
function CardMeta(props) {
|
|
82
|
+
return /* @__PURE__ */ jsx(Caption, { variant: "light", ...props });
|
|
87
83
|
}
|
|
88
|
-
function CardContent(
|
|
89
|
-
|
|
90
|
-
return /* @__PURE__ */ jsx(Comp, { ...props });
|
|
84
|
+
function CardContent(props) {
|
|
85
|
+
return /* @__PURE__ */ jsx("div", { ...props });
|
|
91
86
|
}
|
|
92
|
-
function CardToolbar({ className,
|
|
93
|
-
|
|
94
|
-
return /* @__PURE__ */ jsx(Comp, { className: cn("flex flex-wrap items-center gap-(--gap-card-item-group)", className), ...props });
|
|
87
|
+
function CardToolbar({ className, ...props }) {
|
|
88
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex flex-wrap items-center gap-(--gap-card-item-group)", className), ...props });
|
|
95
89
|
}
|
|
96
|
-
function CardMedia({ className,
|
|
97
|
-
|
|
98
|
-
return /* @__PURE__ */ jsx(Comp, { className: cn("relative w-full h-full", className), ...props });
|
|
90
|
+
function CardMedia({ className, ...props }) {
|
|
91
|
+
return /* @__PURE__ */ jsx("div", { className: cn("relative w-full h-full", className), ...props });
|
|
99
92
|
}
|
|
100
93
|
function CardImage({ className, ...props }) {
|
|
101
94
|
return /* @__PURE__ */ jsx(CardMedia, { children: /* @__PURE__ */ jsx("img", { className: cn("w-full h-full rounded-lg aspect-9/5 object-cover object-top", className), ...props }) });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bccampus/ui-components",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"packageManager": "yarn@4.10.3",
|
|
6
6
|
"exports": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dev": "vite",
|
|
27
27
|
"build": "tsc -b && vite build",
|
|
28
28
|
"lint": "eslint .",
|
|
29
|
-
"publish": "yarn build && npm publish --access public",
|
|
29
|
+
"publish": "yarn build && npm publish --access public --scope=@bccampus",
|
|
30
30
|
"preview": "vite preview"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
2
1
|
import { cn } from "@/lib/utils";
|
|
3
2
|
import { Caption } from "./typography/caption";
|
|
4
3
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
@@ -84,38 +83,28 @@ function CardSubtitle({ size = "md", className, ...props }: CardTitleProps) {
|
|
|
84
83
|
);
|
|
85
84
|
}
|
|
86
85
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
function CardCaption({ asChild, ...props }: CardChildProps) {
|
|
92
|
-
const Comp = asChild ? Slot : Caption;
|
|
93
|
-
return <Comp variant="light" {...props} />;
|
|
86
|
+
function CardCaption(props: React.ComponentProps<"div">) {
|
|
87
|
+
return <Caption {...props} />;
|
|
94
88
|
}
|
|
95
89
|
|
|
96
|
-
function CardSubcaption(
|
|
97
|
-
|
|
98
|
-
return <Comp variant="light" {...props} />;
|
|
90
|
+
function CardSubcaption(props: React.ComponentProps<"div">) {
|
|
91
|
+
return <Caption variant="light" {...props} />;
|
|
99
92
|
}
|
|
100
93
|
|
|
101
|
-
function CardMeta(
|
|
102
|
-
|
|
103
|
-
return <Comp variant="light" {...props} />;
|
|
94
|
+
function CardMeta(props: React.ComponentProps<"div">) {
|
|
95
|
+
return <Caption variant="light" {...props} />;
|
|
104
96
|
}
|
|
105
97
|
|
|
106
|
-
function CardContent(
|
|
107
|
-
|
|
108
|
-
return <Comp {...props} />;
|
|
98
|
+
function CardContent(props: React.ComponentProps<"div">) {
|
|
99
|
+
return <div {...props} />;
|
|
109
100
|
}
|
|
110
101
|
|
|
111
|
-
function CardToolbar({ className,
|
|
112
|
-
|
|
113
|
-
return <Comp className={cn("flex flex-wrap items-center gap-(--gap-card-item-group)", className)} {...props} />;
|
|
102
|
+
function CardToolbar({ className, ...props }: React.ComponentProps<"div">) {
|
|
103
|
+
return <div className={cn("flex flex-wrap items-center gap-(--gap-card-item-group)", className)} {...props} />;
|
|
114
104
|
}
|
|
115
105
|
|
|
116
|
-
function CardMedia({ className,
|
|
117
|
-
|
|
118
|
-
return <Comp className={cn("relative w-full h-full", className)} {...props} />;
|
|
106
|
+
function CardMedia({ className, ...props }: React.ComponentProps<"div">) {
|
|
107
|
+
return <div className={cn("relative w-full h-full", className)} {...props} />;
|
|
119
108
|
}
|
|
120
109
|
|
|
121
110
|
function CardImage({ className, ...props }: React.ComponentProps<"img">) {
|
package/src/styles/theme.css
CHANGED
|
@@ -168,9 +168,10 @@
|
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
/* prettier-ignore */
|
|
171
172
|
@utility areas-* {
|
|
172
|
-
grid-template-areas: --value(
|
|
173
|
-
grid-template-columns: --modifier(
|
|
173
|
+
grid-template-areas: --value([*]);
|
|
174
|
+
grid-template-columns: --modifier([*]);
|
|
174
175
|
}
|
|
175
176
|
|
|
176
177
|
@utility stick-to-page {
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { CompositeComponent } from "./composite-component.js";
|
|
3
|
-
import { useRef, useCallback } from "react";
|
|
4
|
-
import "nanostores";
|
|
5
|
-
import { useKeyboardEvent } from "../../../hooks/use-keyboard-event.js";
|
|
6
|
-
function LayoutGrid({ data, ...props }) {
|
|
7
|
-
const compositeRef = useRef(null);
|
|
8
|
-
const focusElement = useCallback(() => {
|
|
9
|
-
const itemKey = data.focusProvider.focusedItem.get()?.key;
|
|
10
|
-
if (itemKey && compositeRef.current) {
|
|
11
|
-
const focusedItemEl = compositeRef.current.querySelector(`[data-key="${itemKey}"]`);
|
|
12
|
-
if (focusedItemEl) focusedItemEl.focus();
|
|
13
|
-
}
|
|
14
|
-
}, [data]);
|
|
15
|
-
const handleKeyboardEvent = useKeyboardEvent({
|
|
16
|
-
ArrowUp: () => {
|
|
17
|
-
data.focusProvider.focusUp();
|
|
18
|
-
focusElement();
|
|
19
|
-
},
|
|
20
|
-
ArrowDown: () => {
|
|
21
|
-
data.focusProvider.focusDown();
|
|
22
|
-
focusElement();
|
|
23
|
-
},
|
|
24
|
-
Home: () => {
|
|
25
|
-
data.focusProvider.focusToFirst();
|
|
26
|
-
focusElement();
|
|
27
|
-
},
|
|
28
|
-
End: () => {
|
|
29
|
-
data.focusProvider.focusToLast();
|
|
30
|
-
focusElement();
|
|
31
|
-
},
|
|
32
|
-
Space: () => {
|
|
33
|
-
data.selectionProvider?.toggleSelect();
|
|
34
|
-
focusElement();
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const handleItemMouseEvent = useCallback(
|
|
38
|
-
(item) => {
|
|
39
|
-
data.focusProvider.focus(item.key);
|
|
40
|
-
data.selectionProvider?.toggleSelect(item);
|
|
41
|
-
focusElement();
|
|
42
|
-
},
|
|
43
|
-
[data.focusProvider, data.selectionProvider, focusElement]
|
|
44
|
-
);
|
|
45
|
-
return /* @__PURE__ */ jsx(
|
|
46
|
-
CompositeComponent,
|
|
47
|
-
{
|
|
48
|
-
ref: compositeRef,
|
|
49
|
-
variant: "listbox",
|
|
50
|
-
data,
|
|
51
|
-
onKeyDown: handleKeyboardEvent,
|
|
52
|
-
itemMouseEventHandler: handleItemMouseEvent,
|
|
53
|
-
...props
|
|
54
|
-
}
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
export {
|
|
58
|
-
LayoutGrid
|
|
59
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { CompositeComponent } from "./composite-component";
|
|
2
|
-
import { useCallback, useRef } from "react";
|
|
3
|
-
import { CompositeDataItem } from "./CompositeDataItem";
|
|
4
|
-
import type { BaseCompositeProps } from "./types";
|
|
5
|
-
import { useKeyboardEvent } from "@/hooks/use-keyboard-event";
|
|
6
|
-
|
|
7
|
-
export function LayoutGrid<T extends object>({ data, ...props }: BaseCompositeProps<T>) {
|
|
8
|
-
const compositeRef = useRef<HTMLDivElement>(null);
|
|
9
|
-
|
|
10
|
-
const focusElement = useCallback(() => {
|
|
11
|
-
const itemKey = data.focusProvider.focusedItem.get()?.key;
|
|
12
|
-
|
|
13
|
-
if (itemKey && compositeRef.current) {
|
|
14
|
-
const focusedItemEl = compositeRef.current.querySelector<HTMLDivElement>(`[data-key="${itemKey}"]`);
|
|
15
|
-
if (focusedItemEl) focusedItemEl.focus();
|
|
16
|
-
}
|
|
17
|
-
}, [data]);
|
|
18
|
-
|
|
19
|
-
const handleKeyboardEvent = useKeyboardEvent({
|
|
20
|
-
ArrowUp: () => {
|
|
21
|
-
data.focusProvider.focusUp();
|
|
22
|
-
focusElement();
|
|
23
|
-
},
|
|
24
|
-
ArrowDown: () => {
|
|
25
|
-
data.focusProvider.focusDown();
|
|
26
|
-
focusElement();
|
|
27
|
-
},
|
|
28
|
-
Home: () => {
|
|
29
|
-
data.focusProvider.focusToFirst();
|
|
30
|
-
focusElement();
|
|
31
|
-
},
|
|
32
|
-
End: () => {
|
|
33
|
-
data.focusProvider.focusToLast();
|
|
34
|
-
focusElement();
|
|
35
|
-
},
|
|
36
|
-
Space: () => {
|
|
37
|
-
data.selectionProvider?.toggleSelect();
|
|
38
|
-
focusElement();
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const handleItemMouseEvent = useCallback(
|
|
43
|
-
(item: CompositeDataItem<T>) => {
|
|
44
|
-
data.focusProvider.focus(item.key);
|
|
45
|
-
data.selectionProvider?.toggleSelect(item);
|
|
46
|
-
focusElement();
|
|
47
|
-
},
|
|
48
|
-
[data.focusProvider, data.selectionProvider, focusElement]
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<CompositeComponent
|
|
53
|
-
ref={compositeRef}
|
|
54
|
-
variant="listbox"
|
|
55
|
-
data={data}
|
|
56
|
-
onKeyDown={handleKeyboardEvent}
|
|
57
|
-
itemMouseEventHandler={handleItemMouseEvent}
|
|
58
|
-
{...props}
|
|
59
|
-
/>
|
|
60
|
-
);
|
|
61
|
-
}
|