@vnejs/uis.react.menu-controls 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/package.json +12 -18
- package/src/MenuControls.stories.tsx +87 -0
- package/src/MenuControls.tsx +42 -0
- package/src/index.ts +1 -0
- package/tsconfig.json +18 -0
package/package.json
CHANGED
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vnejs/uis.react.menu-controls",
|
|
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",
|
|
20
|
-
"@vnejs/uis.react": "~0.1.0"
|
|
16
|
+
"@vnejs/uis.utils": "~0.1.0"
|
|
21
17
|
},
|
|
22
18
|
"devDependencies": {
|
|
23
|
-
"@vnejs/uis.react": "~0.1.0"
|
|
24
|
-
"typescript": "^5.7.3",
|
|
25
|
-
"@types/react": "^19.0.10",
|
|
26
|
-
"@types/react-dom": "^19.0.4"
|
|
19
|
+
"@vnejs/uis.react": "~0.1.0"
|
|
27
20
|
},
|
|
28
21
|
"files": [
|
|
29
22
|
"dist",
|
|
30
|
-
"
|
|
23
|
+
"src",
|
|
24
|
+
"tsconfig.json"
|
|
31
25
|
]
|
|
32
26
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
|
|
3
|
+
import { VneWrap } from "@vnejs/uis.react";
|
|
4
|
+
|
|
5
|
+
import { Sprite } from "@vnejs/uis.react";
|
|
6
|
+
import { MenuControls } from "./MenuControls";
|
|
7
|
+
import { Flex } from "@vnejs/uis.react";
|
|
8
|
+
|
|
9
|
+
export const Common = {
|
|
10
|
+
args: {
|
|
11
|
+
vneHeight: 720,
|
|
12
|
+
count: 8,
|
|
13
|
+
|
|
14
|
+
textSizeTop: 96,
|
|
15
|
+
textSizeBottom: 72,
|
|
16
|
+
|
|
17
|
+
width: 600,
|
|
18
|
+
height: 1400,
|
|
19
|
+
|
|
20
|
+
scrollbarHeight: 720,
|
|
21
|
+
|
|
22
|
+
activeIndex: -1,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
title: "Base/MenuControls",
|
|
28
|
+
render: ({ vneHeight, count, textSizeTop, textSizeBottom, activeIndex, width, height, scrollbarHeight }) => {
|
|
29
|
+
const textsTop = useMemo(
|
|
30
|
+
() =>
|
|
31
|
+
[
|
|
32
|
+
{ text: "Deborah" },
|
|
33
|
+
{ text: "Chloe" },
|
|
34
|
+
{ text: "Agnes" },
|
|
35
|
+
{ text: "Restoria" },
|
|
36
|
+
{ text: "Maria" },
|
|
37
|
+
{ text: "Deborah" },
|
|
38
|
+
{ text: "Chloe" },
|
|
39
|
+
{ text: "Agnes" },
|
|
40
|
+
{ text: "Restoria" },
|
|
41
|
+
{ text: "Maria" },
|
|
42
|
+
].slice(0, count),
|
|
43
|
+
[count],
|
|
44
|
+
);
|
|
45
|
+
const textPropsTop = useMemo(() => ({ size: textSizeTop, width }), [textSizeTop, width]);
|
|
46
|
+
const textsBottom = useMemo(() => [{ text: "Back" }], []);
|
|
47
|
+
const textPropsBottom = useMemo(() => ({ size: textSizeBottom, width }), [textSizeBottom, width]);
|
|
48
|
+
const scrollbarProps = useMemo(() => ({ width, height: scrollbarHeight }), [width, scrollbarHeight]);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<VneWrap height={vneHeight}>
|
|
52
|
+
<Flex
|
|
53
|
+
align={Flex.ALIGN.CENTER}
|
|
54
|
+
justify={Flex.JUSTIFY.CENTER}
|
|
55
|
+
height={2160}
|
|
56
|
+
>
|
|
57
|
+
<MenuControls
|
|
58
|
+
height={height}
|
|
59
|
+
textsTop={textsTop}
|
|
60
|
+
textPropsTop={textPropsTop}
|
|
61
|
+
textsBottom={textsBottom}
|
|
62
|
+
textPropsBottom={textPropsBottom}
|
|
63
|
+
scrollbarProps={scrollbarProps}
|
|
64
|
+
activeIndex={activeIndex}
|
|
65
|
+
/>
|
|
66
|
+
</Flex>
|
|
67
|
+
</VneWrap>
|
|
68
|
+
);
|
|
69
|
+
},
|
|
70
|
+
argTypes: {
|
|
71
|
+
// engine
|
|
72
|
+
vneHeight: { control: { type: "number", min: 180, max: 2160, step: 45 } },
|
|
73
|
+
count: { control: { type: "number", min: 1, max: 10, step: 1 } },
|
|
74
|
+
|
|
75
|
+
// Scrollbar
|
|
76
|
+
width: { control: { type: "number", min: 0, max: 1000, step: 50 } },
|
|
77
|
+
scrollbarHeight: { control: { type: "number", min: 0, max: 1000, step: 50 } },
|
|
78
|
+
|
|
79
|
+
// Text
|
|
80
|
+
textSizeTop: { control: { type: "number", min: 12, max: 120, step: 12 } },
|
|
81
|
+
textSizeBottom: { control: { type: "number", min: 12, max: 120, step: 12 } },
|
|
82
|
+
|
|
83
|
+
// MenuControls
|
|
84
|
+
height: { control: { type: "number", min: 0, max: 2000, step: 50 } },
|
|
85
|
+
activeIndex: { control: { type: "number", min: -1, max: 10, step: 1 } },
|
|
86
|
+
},
|
|
87
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
|
|
3
|
+
import { Flex } from "@vnejs/uis.react";
|
|
4
|
+
|
|
5
|
+
import { TextControls } from "@vnejs/uis.react";
|
|
6
|
+
|
|
7
|
+
export const MenuControls = ({
|
|
8
|
+
className = "",
|
|
9
|
+
height = 0,
|
|
10
|
+
textPropsTop = {},
|
|
11
|
+
textsTop = [],
|
|
12
|
+
textPropsBottom = {},
|
|
13
|
+
textsBottom = [],
|
|
14
|
+
scrollbarProps = {},
|
|
15
|
+
activeIndex = -1,
|
|
16
|
+
}) => {
|
|
17
|
+
const flexPropsInner = useMemo(() => ({ align: Flex.ALIGN.START, direction: Flex.DIRECTION.COLUMN }), []);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Flex
|
|
21
|
+
className={className}
|
|
22
|
+
align={Flex.ALIGN.START}
|
|
23
|
+
justify={Flex.JUSTIFY.SPACE_BETWEEN}
|
|
24
|
+
direction={Flex.DIRECTION.COLUMN}
|
|
25
|
+
height={height}
|
|
26
|
+
>
|
|
27
|
+
<TextControls
|
|
28
|
+
scrollbarProps={scrollbarProps}
|
|
29
|
+
activeIndex={activeIndex}
|
|
30
|
+
texts={textsTop}
|
|
31
|
+
textProps={textPropsTop}
|
|
32
|
+
flexProps={flexPropsInner}
|
|
33
|
+
/>
|
|
34
|
+
<TextControls
|
|
35
|
+
scrollbarProps={scrollbarProps}
|
|
36
|
+
texts={textsBottom}
|
|
37
|
+
textProps={textPropsBottom}
|
|
38
|
+
flexProps={flexPropsInner}
|
|
39
|
+
/>
|
|
40
|
+
</Flex>
|
|
41
|
+
);
|
|
42
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./MenuControls";
|
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
|
+
}
|