@bccampus/ui-components 0.4.0 → 0.4.1
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/icon-generator-tuhuqdpL.js +76 -0
- package/dist/icon-generator.d.ts +11 -4
- package/dist/icon-generator.js +4 -74
- package/dist/masked-image-generator.js +7 -7
- package/dist/ui-components.js +5 -5
- package/package.json +1 -1
- package/src/components/ui/icon-generator/index.ts +2 -0
- package/vite.config.ts +2 -2
- /package/dist/{igenerate-tiles.d.ts → generate-tiles.d.ts} +0 -0
- /package/dist/{igenerate-tiles.js → generate-tiles.js} +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as r } from "react";
|
|
3
|
+
import { T as o, g as l } from "./generate-tiles-DuagGD1d.js";
|
|
4
|
+
import { c as m } from "./utils-CRiPKpXj.js";
|
|
5
|
+
const k = [
|
|
6
|
+
[o.PieRand, o.PieRand],
|
|
7
|
+
[o.PieRand, o.PieRand]
|
|
8
|
+
];
|
|
9
|
+
function b({
|
|
10
|
+
pattern: e = k,
|
|
11
|
+
tileSize: h = 64,
|
|
12
|
+
tileClassName: c,
|
|
13
|
+
tileBgClassName: s,
|
|
14
|
+
renderChildren: d,
|
|
15
|
+
fit: i = "none",
|
|
16
|
+
...g
|
|
17
|
+
}) {
|
|
18
|
+
const t = r(
|
|
19
|
+
() => ({
|
|
20
|
+
width: e.reduce((n, v) => Math.max(n, v.length), 0) * h,
|
|
21
|
+
height: e.length * h
|
|
22
|
+
}),
|
|
23
|
+
[e, h]
|
|
24
|
+
), a = r(() => {
|
|
25
|
+
const n = l(e, h, c);
|
|
26
|
+
return s && n.unshift(
|
|
27
|
+
/* @__PURE__ */ u(
|
|
28
|
+
"rect",
|
|
29
|
+
{
|
|
30
|
+
x: 0,
|
|
31
|
+
y: 0,
|
|
32
|
+
width: t.width,
|
|
33
|
+
height: t.height,
|
|
34
|
+
className: m("fill-black stroke-2 stroke-black", s)
|
|
35
|
+
},
|
|
36
|
+
"svg-mask-invert"
|
|
37
|
+
)
|
|
38
|
+
), n;
|
|
39
|
+
}, [e, t, c, s, h]), w = r(() => {
|
|
40
|
+
switch (i) {
|
|
41
|
+
case "fill":
|
|
42
|
+
return t.width <= t.height ? "100%" : void 0;
|
|
43
|
+
case "width":
|
|
44
|
+
return "100%";
|
|
45
|
+
case "none":
|
|
46
|
+
return t.width;
|
|
47
|
+
default:
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
}, [i, t]), f = r(() => {
|
|
51
|
+
switch (i) {
|
|
52
|
+
case "fill":
|
|
53
|
+
return t.height < t.width ? "100%" : void 0;
|
|
54
|
+
case "height":
|
|
55
|
+
return "100%";
|
|
56
|
+
case "none":
|
|
57
|
+
return t.height;
|
|
58
|
+
default:
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
}, [i, t]);
|
|
62
|
+
return /* @__PURE__ */ u(
|
|
63
|
+
"svg",
|
|
64
|
+
{
|
|
65
|
+
width: w,
|
|
66
|
+
height: f,
|
|
67
|
+
viewBox: `0 0 ${t.width} ${t.height}`,
|
|
68
|
+
overflow: "visible",
|
|
69
|
+
...g,
|
|
70
|
+
children: d ? d(a, t.width, t.height) : a
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
b as I
|
|
76
|
+
};
|
package/dist/icon-generator.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
|
3
3
|
|
|
4
4
|
export declare function IconGenerator({ pattern, tileSize, tileClassName, tileBgClassName, renderChildren, fit, ...props }: IconGeneratorProps): JSX_2.Element;
|
|
5
5
|
|
|
6
|
-
declare interface IconGeneratorProps extends Omit<React.ComponentProps<"svg">, "children" | "width" | "height" | "overflow"> {
|
|
6
|
+
export declare interface IconGeneratorProps extends Omit<React.ComponentProps<"svg">, "children" | "width" | "height" | "overflow"> {
|
|
7
7
|
pattern?: (TileShape | TileConfig)[][];
|
|
8
8
|
tileSize?: number;
|
|
9
9
|
tileClassName?: string;
|
|
@@ -12,13 +12,20 @@ declare interface IconGeneratorProps extends Omit<React.ComponentProps<"svg">, "
|
|
|
12
12
|
renderChildren?: (paths: (JSX.Element | null)[], width: number, height: number) => React.ReactNode;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
declare interface
|
|
15
|
+
export declare interface MaskedImageGeneratorProps extends IconGeneratorProps {
|
|
16
|
+
src: string;
|
|
17
|
+
imageFit?: "cover" | "contain" | "fill";
|
|
18
|
+
imagePosition?: "top" | "center" | "bottom";
|
|
19
|
+
maskType?: "alpha" | "luminance";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export declare interface TileConfig {
|
|
16
23
|
shape: TileShape;
|
|
17
24
|
scale?: number;
|
|
18
25
|
className?: string;
|
|
19
26
|
}
|
|
20
27
|
|
|
21
|
-
declare const TileShape: {
|
|
28
|
+
export declare const TileShape: {
|
|
22
29
|
readonly Blank: 0;
|
|
23
30
|
readonly Rand: 1;
|
|
24
31
|
readonly Mosaic: 2;
|
|
@@ -46,6 +53,6 @@ declare const TileShape: {
|
|
|
46
53
|
readonly PieRand: 25;
|
|
47
54
|
};
|
|
48
55
|
|
|
49
|
-
declare type TileShape = (typeof TileShape)[keyof typeof TileShape];
|
|
56
|
+
export declare type TileShape = (typeof TileShape)[keyof typeof TileShape];
|
|
50
57
|
|
|
51
58
|
export { }
|
package/dist/icon-generator.js
CHANGED
|
@@ -1,76 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { T as o, g as l } from "./generate-tiles-DuagGD1d.js";
|
|
4
|
-
import { c as m } from "./utils-CRiPKpXj.js";
|
|
5
|
-
const k = [
|
|
6
|
-
[o.PieRand, o.PieRand],
|
|
7
|
-
[o.PieRand, o.PieRand]
|
|
8
|
-
];
|
|
9
|
-
function b({
|
|
10
|
-
pattern: e = k,
|
|
11
|
-
tileSize: h = 64,
|
|
12
|
-
tileClassName: s,
|
|
13
|
-
tileBgClassName: c,
|
|
14
|
-
renderChildren: d,
|
|
15
|
-
fit: i = "none",
|
|
16
|
-
...g
|
|
17
|
-
}) {
|
|
18
|
-
const t = r(
|
|
19
|
-
() => ({
|
|
20
|
-
width: e.reduce((n, v) => Math.max(n, v.length), 0) * h,
|
|
21
|
-
height: e.length * h
|
|
22
|
-
}),
|
|
23
|
-
[e, h]
|
|
24
|
-
), a = r(() => {
|
|
25
|
-
const n = l(e, h, s);
|
|
26
|
-
return c && n.unshift(
|
|
27
|
-
/* @__PURE__ */ u(
|
|
28
|
-
"rect",
|
|
29
|
-
{
|
|
30
|
-
x: 0,
|
|
31
|
-
y: 0,
|
|
32
|
-
width: t.width,
|
|
33
|
-
height: t.height,
|
|
34
|
-
className: m("fill-black stroke-2 stroke-black", c)
|
|
35
|
-
},
|
|
36
|
-
"svg-mask-invert"
|
|
37
|
-
)
|
|
38
|
-
), n;
|
|
39
|
-
}, [e, t, s, c, h]), w = r(() => {
|
|
40
|
-
switch (i) {
|
|
41
|
-
case "fill":
|
|
42
|
-
return t.width <= t.height ? "100%" : void 0;
|
|
43
|
-
case "width":
|
|
44
|
-
return "100%";
|
|
45
|
-
case "none":
|
|
46
|
-
return t.width;
|
|
47
|
-
default:
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
}, [i, t]), f = r(() => {
|
|
51
|
-
switch (i) {
|
|
52
|
-
case "fill":
|
|
53
|
-
return t.height < t.width ? "100%" : void 0;
|
|
54
|
-
case "height":
|
|
55
|
-
return "100%";
|
|
56
|
-
case "none":
|
|
57
|
-
return t.height;
|
|
58
|
-
default:
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
}, [i, t]);
|
|
62
|
-
return /* @__PURE__ */ u(
|
|
63
|
-
"svg",
|
|
64
|
-
{
|
|
65
|
-
width: w,
|
|
66
|
-
height: f,
|
|
67
|
-
viewBox: `0 0 ${t.width} ${t.height}`,
|
|
68
|
-
overflow: "visible",
|
|
69
|
-
...g,
|
|
70
|
-
children: d ? d(a, t.width, t.height) : a
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
}
|
|
1
|
+
import { I as r } from "./icon-generator-tuhuqdpL.js";
|
|
2
|
+
import { T as p } from "./generate-tiles-DuagGD1d.js";
|
|
74
3
|
export {
|
|
75
|
-
|
|
4
|
+
r as IconGenerator,
|
|
5
|
+
p as TileShape
|
|
76
6
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as o, jsxs as c, Fragment as d } from "react/jsx-runtime";
|
|
2
2
|
import { useId as p, useMemo as l } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { I as M } from "./icon-generator-tuhuqdpL.js";
|
|
4
4
|
const h = { cover: "slice", contain: "meet", fill: "none" }, k = { top: "xMidYMin", center: "xMidYMid", bottom: "xMidYMax" };
|
|
5
|
-
function
|
|
6
|
-
src:
|
|
5
|
+
function g({
|
|
6
|
+
src: s,
|
|
7
7
|
imageFit: e = "cover",
|
|
8
8
|
imagePosition: r = "top",
|
|
9
|
-
maskType:
|
|
9
|
+
maskType: n = "alpha",
|
|
10
10
|
...a
|
|
11
11
|
}) {
|
|
12
12
|
const t = p(), i = l(
|
|
@@ -18,12 +18,12 @@ function u({
|
|
|
18
18
|
{
|
|
19
19
|
...a,
|
|
20
20
|
renderChildren: (m) => /* @__PURE__ */ c(d, { children: [
|
|
21
|
-
/* @__PURE__ */ o("mask", { id: `svg-mask${t}`, "mask-type":
|
|
22
|
-
/* @__PURE__ */ o("image", { href:
|
|
21
|
+
/* @__PURE__ */ o("mask", { id: `svg-mask${t}`, "mask-type": n, children: m }),
|
|
22
|
+
/* @__PURE__ */ o("image", { href: s, width: "100%", height: "100%", mask: `url(#svg-mask${t})`, preserveAspectRatio: i })
|
|
23
23
|
] })
|
|
24
24
|
}
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
export {
|
|
28
|
-
|
|
28
|
+
g as MaskedImageGenerator
|
|
29
29
|
};
|
package/dist/ui-components.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I as o } from "./icon-generator-tuhuqdpL.js";
|
|
2
2
|
import { MaskedImageGenerator as e } from "./masked-image-generator.js";
|
|
3
3
|
import { Caption as i, captionVariants as p } from "./caption.js";
|
|
4
4
|
import { Banner as m } from "./banner.js";
|
|
5
5
|
import { Button as u, buttonVariants as C } from "./button.js";
|
|
6
|
-
import { Card as x, CardArea as M, CardCaption as v, CardContent as I, CardImage as N, CardItemGroup as
|
|
6
|
+
import { Card as x, CardArea as M, CardCaption as v, CardContent as I, CardImage as N, CardItemGroup as s, CardMedia as c, CardMeta as l, CardSubcaption as S, CardSubtitle as T, CardTitle as b, CardToolbar as V } from "./card.js";
|
|
7
7
|
import { HorizontalList as L } from "./horizontal-list.js";
|
|
8
8
|
import { Input as k } from "./input.js";
|
|
9
9
|
import { NavigationMenu as B, NavigationMenuContent as H, NavigationMenuIndicator as h, NavigationMenuItem as w, NavigationMenuLink as z, NavigationMenuList as A, NavigationMenuTrigger as O, NavigationMenuViewport as j, navigationMenuTriggerStyle as q } from "./navigation-menu.js";
|
|
@@ -22,9 +22,9 @@ export {
|
|
|
22
22
|
v as CardCaption,
|
|
23
23
|
I as CardContent,
|
|
24
24
|
N as CardImage,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
s as CardItemGroup,
|
|
26
|
+
c as CardMedia,
|
|
27
|
+
l as CardMeta,
|
|
28
28
|
S as CardSubcaption,
|
|
29
29
|
T as CardSubtitle,
|
|
30
30
|
b as CardTitle,
|
package/package.json
CHANGED
package/vite.config.ts
CHANGED
|
@@ -21,8 +21,8 @@ export default defineConfig({
|
|
|
21
21
|
entry: {
|
|
22
22
|
'ui-components': path.resolve(__dirname, 'src/components/ui/index.ts'),
|
|
23
23
|
'composite': path.resolve(__dirname, 'src/components/ui/composite/index.ts'),
|
|
24
|
-
'icon-generator': path.resolve(__dirname, 'src/components/ui/icon-generator/
|
|
25
|
-
'
|
|
24
|
+
'icon-generator': path.resolve(__dirname, 'src/components/ui/icon-generator/index.ts'),
|
|
25
|
+
'generate-tiles': path.resolve(__dirname, 'src/components/ui/icon-generator/generate-tiles.tsx'),
|
|
26
26
|
'masked-image-generator': path.resolve(__dirname, 'src/components/ui/icon-generator/masked-image-generator.tsx'),
|
|
27
27
|
'caption': path.resolve(__dirname, 'src/components/ui/typography/caption.tsx'),
|
|
28
28
|
'banner': path.resolve(__dirname, 'src/components/ui/banner.tsx'),
|
|
File without changes
|
|
File without changes
|