@vnejs/uis.react.backdrop 0.1.2 → 0.1.4
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/Backdrop.d.ts +0 -1
- package/dist/Backdrop.d.ts.map +1 -1
- package/dist/Backdrop.js +2 -3
- package/dist/Backdrop.js.map +1 -1
- package/dist/Backdrop.styles.d.ts +2 -0
- package/dist/Backdrop.styles.d.ts.map +1 -0
- package/dist/Backdrop.styles.js +52 -0
- package/dist/Backdrop.styles.js.map +1 -0
- package/package.json +12 -17
- package/src/Backdrop.stories.tsx +33 -0
- package/src/Backdrop.styles.ts +55 -0
- package/src/Backdrop.tsx +33 -0
- package/src/index.ts +1 -0
- package/tsconfig.json +18 -0
- package/dist/Backdrop.styl +0 -39
package/dist/Backdrop.d.ts
CHANGED
package/dist/Backdrop.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Backdrop.d.ts","sourceRoot":"","sources":["../src/Backdrop.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Backdrop.d.ts","sourceRoot":"","sources":["../src/Backdrop.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;CAwBpB,CAAC"}
|
package/dist/Backdrop.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import "./Backdrop.
|
|
5
|
-
const b = cn("Backdrop");
|
|
3
|
+
import { getVneLength } from "@vnejs/uis.utils";
|
|
4
|
+
import { b } from "./Backdrop.styles.js";
|
|
6
5
|
export const Backdrop = ({ zIndex = null, transition = null, type = "", size = 360, opacity = 1, color1, color2, className, children }) => {
|
|
7
6
|
const style = useMemo(() => {
|
|
8
7
|
const TYPE_TO_DEGREE = { [Backdrop.TYPE.BOTTOM]: 0, [Backdrop.TYPE.LEFT]: 90, [Backdrop.TYPE.TOP]: 180, [Backdrop.TYPE.RIGHT]: 270 };
|
package/dist/Backdrop.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Backdrop.js","sourceRoot":"","sources":["../src/Backdrop.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Backdrop.js","sourceRoot":"","sources":["../src/Backdrop.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAC;AAEzC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,UAAU,GAAG,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE,IAAI,GAAG,GAAG,EAAE,OAAO,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;IACxI,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE;QACzB,MAAM,cAAc,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;QAErI,MAAM,MAAM,GAAwB,EAAE,CAAC,uBAAuB,CAAC,EAAE,GAAG,cAAc,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC;QAE9H,MAAM,CAAC,uBAAuB,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QAErD,IAAI,MAAM;YAAE,MAAM,CAAC,wBAAwB,CAAC,GAAG,MAAM,CAAC;QACtD,IAAI,MAAM;YAAE,MAAM,CAAC,wBAAwB,CAAC,GAAG,MAAM,CAAC;QACtD,IAAI,MAAM,KAAK,IAAI;YAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QAC5C,IAAI,UAAU,KAAK,IAAI;YAAE,MAAM,CAAC,UAAU,GAAG,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,UAAU,IAAI,CAAC;QAE3F,OAAO,MAAM,CAAC;IAChB,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAElD,OAAO,CACL,cACE,SAAS,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,EACnC,KAAK,EAAE,KAAK,YAEX,QAAQ,GACL,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,QAAQ,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Backdrop.styles.d.ts","sourceRoot":"","sources":["../src/Backdrop.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,CAAC,4BAAiB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { cn, injectStyles, sel } from "@vnejs/uis.utils";
|
|
2
|
+
export const b = cn("Backdrop");
|
|
3
|
+
const typeTop = sel(b({ type: "top" }));
|
|
4
|
+
const typeRight = sel(b({ type: "right" }));
|
|
5
|
+
const typeBottom = sel(b({ type: "bottom" }));
|
|
6
|
+
const typeLeft = sel(b({ type: "left" }));
|
|
7
|
+
const CSS = `
|
|
8
|
+
${sel(b())} {
|
|
9
|
+
--vne-backdrop-color-1: rgba(0, 0, 0, 85%);
|
|
10
|
+
--vne-backdrop-color-2: rgba(0, 0, 0, 0%);
|
|
11
|
+
--vne-backdrop-degree: 0deg;
|
|
12
|
+
display: block;
|
|
13
|
+
position: absolute;
|
|
14
|
+
background: linear-gradient(var(--vne-backdrop-degree), var(--vne-backdrop-color-1) 0%, var(--vne-backdrop-color-2) 100%);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
${typeTop},
|
|
18
|
+
${typeRight},
|
|
19
|
+
${typeLeft} {
|
|
20
|
+
top: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
${typeTop},
|
|
24
|
+
${typeRight},
|
|
25
|
+
${typeBottom} {
|
|
26
|
+
right: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
${typeRight},
|
|
30
|
+
${typeBottom},
|
|
31
|
+
${typeLeft} {
|
|
32
|
+
bottom: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
${typeTop},
|
|
36
|
+
${typeBottom},
|
|
37
|
+
${typeLeft} {
|
|
38
|
+
left: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
${typeTop},
|
|
42
|
+
${typeBottom} {
|
|
43
|
+
height: var(--vne-backdrop-length);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
${typeRight},
|
|
47
|
+
${typeLeft} {
|
|
48
|
+
width: var(--vne-backdrop-length);
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
injectStyles(CSS);
|
|
52
|
+
//# sourceMappingURL=Backdrop.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Backdrop.styles.js","sourceRoot":"","sources":["../src/Backdrop.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;AAEhC,MAAM,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AACxC,MAAM,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AAC5C,MAAM,UAAU,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;AAC9C,MAAM,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAE1C,MAAM,GAAG,GAAG;EACV,GAAG,CAAC,CAAC,EAAE,CAAC;;;;;;;;;EASR,OAAO;EACP,SAAS;EACT,QAAQ;;;;EAIR,OAAO;EACP,SAAS;EACT,UAAU;;;;EAIV,SAAS;EACT,UAAU;EACV,QAAQ;;;;EAIR,OAAO;EACP,UAAU;EACV,QAAQ;;;;EAIR,OAAO;EACP,UAAU;;;;EAIV,SAAS;EACT,QAAQ;;;CAGT,CAAC;AAEF,YAAY,CAAC,GAAG,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,31 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vnejs/uis.react.backdrop",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "
|
|
8
|
-
"publish:major:
|
|
9
|
-
"publish:minor:
|
|
10
|
-
"publish:patch:
|
|
11
|
-
"publish:major": "
|
|
12
|
-
"publish:minor": "
|
|
13
|
-
"publish:patch": "
|
|
7
|
+
"build": "npx @vnejs/monorepo package",
|
|
8
|
+
"publish:major:uis:react": "npm run publish:major",
|
|
9
|
+
"publish:minor:uis:react": "npm run publish:minor",
|
|
10
|
+
"publish:patch:uis:react": "npm run publish:patch",
|
|
11
|
+
"publish:major": "npx @vnejs/monorepo publish major --access public",
|
|
12
|
+
"publish:minor": "npx @vnejs/monorepo publish minor --access public",
|
|
13
|
+
"publish:patch": "npx @vnejs/monorepo publish patch --access public"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"@
|
|
17
|
-
"@vnejs/uis.utils": "~0.1.0",
|
|
18
|
-
"react": "19.2.4",
|
|
19
|
-
"react-dom": "19.2.4"
|
|
16
|
+
"@vnejs/uis.utils": "~0.1.0"
|
|
20
17
|
},
|
|
21
18
|
"devDependencies": {
|
|
22
|
-
"@vnejs/uis.react": "~0.1.0"
|
|
23
|
-
"typescript": "^5.7.3",
|
|
24
|
-
"@types/react": "^19.0.10",
|
|
25
|
-
"@types/react-dom": "^19.0.4"
|
|
19
|
+
"@vnejs/uis.react": "~0.1.0"
|
|
26
20
|
},
|
|
27
21
|
"files": [
|
|
28
22
|
"dist",
|
|
29
|
-
"
|
|
23
|
+
"src",
|
|
24
|
+
"tsconfig.json"
|
|
30
25
|
]
|
|
31
26
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { VneWrap } from "@vnejs/uis.react";
|
|
2
|
+
|
|
3
|
+
import { Backdrop } from "@vnejs/uis.react";
|
|
4
|
+
|
|
5
|
+
export const Common = {
|
|
6
|
+
args: {
|
|
7
|
+
vneHeight: 720,
|
|
8
|
+
type: Backdrop.TYPE.TOP,
|
|
9
|
+
zIndex: 10,
|
|
10
|
+
size: 180,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
title: "Primitives/Backdrop",
|
|
16
|
+
render: ({ vneHeight, ...args }) => (
|
|
17
|
+
<VneWrap height={vneHeight}>
|
|
18
|
+
<Backdrop {...args} />
|
|
19
|
+
</VneWrap>
|
|
20
|
+
),
|
|
21
|
+
argTypes: {
|
|
22
|
+
// Engine
|
|
23
|
+
vneHeight: { control: { type: "number", min: 180, max: 2160, step: 45 } },
|
|
24
|
+
|
|
25
|
+
// Backdrop
|
|
26
|
+
zIndex: { control: { type: "number", min: -100, max: 100, step: 5 } },
|
|
27
|
+
type: { control: { type: "select" }, options: Object.values(Backdrop.TYPE) },
|
|
28
|
+
size: { control: { type: "number", min: 120, max: 600, step: 12 } },
|
|
29
|
+
color1: { control: { type: "select" }, options: ["", "red", "green", "blue", "black"] },
|
|
30
|
+
color2: { control: { type: "select" }, options: ["", "red", "green", "blue", "black"] },
|
|
31
|
+
transition: { control: { type: "number", min: 0, max: 600, step: 30 } },
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { cn, injectStyles, sel } from "@vnejs/uis.utils";
|
|
2
|
+
|
|
3
|
+
export const b = cn("Backdrop");
|
|
4
|
+
|
|
5
|
+
const typeTop = sel(b({ type: "top" }));
|
|
6
|
+
const typeRight = sel(b({ type: "right" }));
|
|
7
|
+
const typeBottom = sel(b({ type: "bottom" }));
|
|
8
|
+
const typeLeft = sel(b({ type: "left" }));
|
|
9
|
+
|
|
10
|
+
const CSS = `
|
|
11
|
+
${sel(b())} {
|
|
12
|
+
--vne-backdrop-color-1: rgba(0, 0, 0, 85%);
|
|
13
|
+
--vne-backdrop-color-2: rgba(0, 0, 0, 0%);
|
|
14
|
+
--vne-backdrop-degree: 0deg;
|
|
15
|
+
display: block;
|
|
16
|
+
position: absolute;
|
|
17
|
+
background: linear-gradient(var(--vne-backdrop-degree), var(--vne-backdrop-color-1) 0%, var(--vne-backdrop-color-2) 100%);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
${typeTop},
|
|
21
|
+
${typeRight},
|
|
22
|
+
${typeLeft} {
|
|
23
|
+
top: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
${typeTop},
|
|
27
|
+
${typeRight},
|
|
28
|
+
${typeBottom} {
|
|
29
|
+
right: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
${typeRight},
|
|
33
|
+
${typeBottom},
|
|
34
|
+
${typeLeft} {
|
|
35
|
+
bottom: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
${typeTop},
|
|
39
|
+
${typeBottom},
|
|
40
|
+
${typeLeft} {
|
|
41
|
+
left: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
${typeTop},
|
|
45
|
+
${typeBottom} {
|
|
46
|
+
height: var(--vne-backdrop-length);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
${typeRight},
|
|
50
|
+
${typeLeft} {
|
|
51
|
+
width: var(--vne-backdrop-length);
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
injectStyles(CSS);
|
package/src/Backdrop.tsx
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
|
|
3
|
+
import { getVneLength } from "@vnejs/uis.utils";
|
|
4
|
+
|
|
5
|
+
import { b } from "./Backdrop.styles.js";
|
|
6
|
+
|
|
7
|
+
export const Backdrop = ({ zIndex = null, transition = null, type = "", size = 360, opacity = 1, color1, color2, className, children }) => {
|
|
8
|
+
const style = useMemo(() => {
|
|
9
|
+
const TYPE_TO_DEGREE = { [Backdrop.TYPE.BOTTOM]: 0, [Backdrop.TYPE.LEFT]: 90, [Backdrop.TYPE.TOP]: 180, [Backdrop.TYPE.RIGHT]: 270 };
|
|
10
|
+
|
|
11
|
+
const result: Record<string, any> = { ["--vne-backdrop-degree"]: `${TYPE_TO_DEGREE[type || Backdrop.TYPE.TOP]}deg`, opacity };
|
|
12
|
+
|
|
13
|
+
result["--vne-backdrop-length"] = getVneLength(size);
|
|
14
|
+
|
|
15
|
+
if (color1) result["--vne-backdrop-color-1"] = color1;
|
|
16
|
+
if (color2) result["--vne-backdrop-color-2"] = color2;
|
|
17
|
+
if (zIndex !== null) result.zIndex = zIndex;
|
|
18
|
+
if (transition !== null) result.transition = transition === 0 ? "none" : `${transition}ms`;
|
|
19
|
+
|
|
20
|
+
return result;
|
|
21
|
+
}, [zIndex, size, type, color1, color2, opacity]);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div
|
|
25
|
+
className={b({ type }, [className])}
|
|
26
|
+
style={style}
|
|
27
|
+
>
|
|
28
|
+
{children}
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
Backdrop.TYPE = { TOP: "top", RIGHT: "right", BOTTOM: "bottom", LEFT: "left" };
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Backdrop";
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../tsconfig.react.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "dist",
|
|
5
|
+
"rootDir": "src"
|
|
6
|
+
},
|
|
7
|
+
"include": [
|
|
8
|
+
"src/**/*.ts",
|
|
9
|
+
"src/**/*.tsx",
|
|
10
|
+
"../../../globals.d.ts",
|
|
11
|
+
"../../../peer-modules.d.ts"
|
|
12
|
+
],
|
|
13
|
+
"exclude": [
|
|
14
|
+
"dist",
|
|
15
|
+
"node_modules",
|
|
16
|
+
"src/**/*.stories.tsx"
|
|
17
|
+
]
|
|
18
|
+
}
|
package/dist/Backdrop.styl
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
.Backdrop
|
|
2
|
-
--vne-backdrop-color-1: rgba(0, 0, 0, 85%);
|
|
3
|
-
--vne-backdrop-color-2: rgba(0, 0, 0, 0%);
|
|
4
|
-
|
|
5
|
-
--vne-backdrop-degree: 0deg
|
|
6
|
-
|
|
7
|
-
display: block
|
|
8
|
-
position: absolute
|
|
9
|
-
|
|
10
|
-
background: linear-gradient(var(--vne-backdrop-degree), var(--vne-backdrop-color-1) 0%, var(--vne-backdrop-color-2) 100%)
|
|
11
|
-
|
|
12
|
-
&_type_top,
|
|
13
|
-
&_type_right,
|
|
14
|
-
&_type_left
|
|
15
|
-
top: 0
|
|
16
|
-
|
|
17
|
-
&_type_top,
|
|
18
|
-
&_type_right,
|
|
19
|
-
&_type_bottom
|
|
20
|
-
right: 0
|
|
21
|
-
|
|
22
|
-
&_type_right,
|
|
23
|
-
&_type_bottom,
|
|
24
|
-
&_type_left
|
|
25
|
-
bottom: 0
|
|
26
|
-
|
|
27
|
-
&_type_top,
|
|
28
|
-
&_type_bottom,
|
|
29
|
-
&_type_left
|
|
30
|
-
left: 0
|
|
31
|
-
|
|
32
|
-
&_type_top,
|
|
33
|
-
&_type_bottom
|
|
34
|
-
height: var(--vne-backdrop-length)
|
|
35
|
-
|
|
36
|
-
&_type_right,
|
|
37
|
-
&_type_left
|
|
38
|
-
width: var(--vne-backdrop-length)
|
|
39
|
-
|