@bccampus/ui-components 0.9.9 → 0.9.11
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.
|
@@ -3,7 +3,7 @@ import { S as Slot, a as Slottable } from "../../_chunks/index.js";
|
|
|
3
3
|
import { PageSection } from "./page-section.js";
|
|
4
4
|
function PageHeader({ children, asChild, logo, ...props }) {
|
|
5
5
|
const Comp = asChild ? Slot : "div";
|
|
6
|
-
return /* @__PURE__ */ jsx(PageSection, { py: "none", className: "sticky top-0 right-0 left-0 z-50 bg-background", ...props, children: /* @__PURE__ */ jsxs(Comp, { className: "h-page-nav
|
|
6
|
+
return /* @__PURE__ */ jsx(PageSection, { py: "none", className: "sticky top-0 right-0 left-0 z-50 bg-background", ...props, children: /* @__PURE__ */ jsxs(Comp, { className: "h-page-nav 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", children: [
|
|
7
7
|
logo,
|
|
8
8
|
/* @__PURE__ */ jsx(Slottable, { children })
|
|
9
9
|
] }) });
|
package/dist/lib/object.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
const get = (object, prop) => prop.split(".").reduce(
|
|
1
|
+
const get = (object, prop) => prop.split(".").reduce(
|
|
2
|
+
(reducedObject, key) => reducedObject && key in reducedObject ? reducedObject[key] : void 0,
|
|
3
|
+
object
|
|
4
|
+
);
|
|
2
5
|
const set = (object, prop, value) => {
|
|
3
6
|
const propChunks = prop.split(".");
|
|
4
7
|
const lastChunk = propChunks.pop();
|
|
5
8
|
if (!lastChunk) return object;
|
|
6
9
|
const ref = propChunks.reduce((reducedObject, key) => {
|
|
7
|
-
reducedObject[key] = {};
|
|
10
|
+
if (reducedObject[key] === void 0) reducedObject[key] = {};
|
|
8
11
|
return reducedObject[key];
|
|
9
12
|
}, object);
|
|
10
13
|
ref[lastChunk] = value;
|
|
@@ -22,7 +25,10 @@ const omit = (object, props) => {
|
|
|
22
25
|
const propChunks = prop.split(".");
|
|
23
26
|
const lastChunk = propChunks.pop();
|
|
24
27
|
if (lastChunk) {
|
|
25
|
-
const ref = propChunks.reduce(
|
|
28
|
+
const ref = propChunks.reduce(
|
|
29
|
+
(reducedObject, key) => reducedObject && key in reducedObject ? reducedObject[key] : void 0,
|
|
30
|
+
result
|
|
31
|
+
);
|
|
26
32
|
if (ref && lastChunk in ref) delete ref[lastChunk];
|
|
27
33
|
}
|
|
28
34
|
});
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ function PageHeader({ children, asChild, logo, ...props }: PageHeaderProps) {
|
|
|
10
10
|
const Comp = asChild ? Root : "div";
|
|
11
11
|
return (
|
|
12
12
|
<PageSection py="none" className="sticky top-0 right-0 left-0 z-50 bg-background" {...props}>
|
|
13
|
-
<Comp className="h-page-nav
|
|
13
|
+
<Comp className="h-page-nav 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
14
|
{logo}
|
|
15
15
|
<Slottable>{children}</Slottable>
|
|
16
16
|
</Comp>
|
package/src/lib/object.ts
CHANGED
|
@@ -1,48 +1,52 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
|
|
3
|
-
export const get = <T extends object>(object: T, prop: string) =>
|
|
4
|
-
|
|
5
|
-
.
|
|
3
|
+
export const get = <T extends object>(object: T, prop: string) =>
|
|
4
|
+
prop
|
|
5
|
+
.split(".")
|
|
6
|
+
.reduce<any>(
|
|
7
|
+
(reducedObject, key) => (reducedObject && key in reducedObject ? reducedObject[key] : undefined),
|
|
8
|
+
object,
|
|
9
|
+
);
|
|
6
10
|
|
|
7
11
|
export const set = <T extends object, V>(object: T, prop: string, value: V) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
const propChunks = prop.split(".");
|
|
13
|
+
const lastChunk = propChunks.pop();
|
|
14
|
+
if (!lastChunk) return object;
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
const ref = propChunks.reduce<any>((reducedObject, key) => {
|
|
17
|
+
if (reducedObject[key] === undefined) reducedObject[key] = {};
|
|
18
|
+
return reducedObject[key];
|
|
19
|
+
}, object);
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
ref[lastChunk] = value;
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
}
|
|
23
|
+
return object;
|
|
24
|
+
};
|
|
21
25
|
|
|
22
26
|
export const pick = <T extends object>(object: T, props: string[]) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
set(result, key, get(object, key));
|
|
27
|
-
|
|
28
|
-
return result;
|
|
29
|
-
}, {}) as Partial<T>;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const omit = <T extends object>(object: T, props: string[]) => {
|
|
33
|
-
const result: Partial<T> = { ...object };
|
|
34
|
-
|
|
35
|
-
props.forEach(prop => {
|
|
36
|
-
const propChunks = prop.split('.');
|
|
37
|
-
const lastChunk = propChunks.pop();
|
|
38
|
-
if (lastChunk) {
|
|
39
|
-
const ref = propChunks.reduce<any>((reducedObject, key) => (reducedObject && key in reducedObject) ? reducedObject[key] : undefined, result);
|
|
40
|
-
if (ref && lastChunk in ref) delete ref[lastChunk];
|
|
41
|
-
}
|
|
42
|
-
})
|
|
27
|
+
return props.reduce<Record<string, unknown>>((result, key) => {
|
|
28
|
+
set(result, key, get(object, key));
|
|
43
29
|
|
|
44
30
|
return result;
|
|
45
|
-
}
|
|
31
|
+
}, {}) as Partial<T>;
|
|
32
|
+
};
|
|
46
33
|
|
|
47
|
-
export const
|
|
34
|
+
export const omit = <T extends object>(object: T, props: string[]) => {
|
|
35
|
+
const result: Partial<T> = { ...object };
|
|
48
36
|
|
|
37
|
+
props.forEach((prop) => {
|
|
38
|
+
const propChunks = prop.split(".");
|
|
39
|
+
const lastChunk = propChunks.pop();
|
|
40
|
+
if (lastChunk) {
|
|
41
|
+
const ref = propChunks.reduce<any>(
|
|
42
|
+
(reducedObject, key) => (reducedObject && key in reducedObject ? reducedObject[key] : undefined),
|
|
43
|
+
result,
|
|
44
|
+
);
|
|
45
|
+
if (ref && lastChunk in ref) delete ref[lastChunk];
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return result;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const isObject = (object: unknown) => typeof object === "object" && !Array.isArray(object) && object !== null;
|
package/vite.ladle.config.ts
CHANGED
|
@@ -9,6 +9,9 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
9
9
|
// https://vite.dev/config/
|
|
10
10
|
export default defineConfig({
|
|
11
11
|
plugins: [react(), tailwindcss()],
|
|
12
|
+
server: {
|
|
13
|
+
allowedHosts: ["desk.sailfish-dragon.ts.net"],
|
|
14
|
+
},
|
|
12
15
|
resolve: {
|
|
13
16
|
alias: {
|
|
14
17
|
"@": path.resolve(__dirname, "./src"),
|