@vnejs/uis.react.wrap-with-content 0.1.6 → 0.1.8

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.
@@ -1,28 +1,3 @@
1
- export declare const WrapWithContent: ({ className, imageSrc, isSelected, isRounded, withHover, width, height, borderWidth, top, right, bottom, left, transition, renderTopLeft, renderTopRight, renderBottomLeft, renderBottomRight, topLeftText, topLeftSize, topRightText, topRightSize, bottomLeftText, bottomLeftSize, onClick, value, }: {
2
- className: any;
3
- imageSrc?: string;
4
- isSelected?: boolean;
5
- isRounded?: boolean;
6
- withHover?: boolean;
7
- width?: number;
8
- height?: number;
9
- borderWidth?: number;
10
- top?: number;
11
- right?: number;
12
- bottom?: number;
13
- left?: number;
14
- transition?: number;
15
- renderTopLeft: any;
16
- renderTopRight: any;
17
- renderBottomLeft: any;
18
- renderBottomRight: any;
19
- topLeftText: any;
20
- topLeftSize: any;
21
- topRightText: any;
22
- topRightSize: any;
23
- bottomLeftText: any;
24
- bottomLeftSize: any;
25
- onClick: any;
26
- value: any;
27
- }) => import("react/jsx-runtime").JSX.Element;
1
+ import { type WrapWithContentProps } from "./WrapWithContent.types.js";
2
+ export declare const WrapWithContent: ({ className, imageSrc, isSelected, isRounded, withHover, width, height, borderWidth, top, right, bottom, left, transition, renderTopLeft, renderTopRight, renderBottomLeft, renderBottomRight, topLeftText, topLeftSize, topRightText, topRightSize, bottomLeftText, bottomLeftSize, onClick, value, }: WrapWithContentProps) => import("react/jsx-runtime").JSX.Element;
28
3
  //# sourceMappingURL=WrapWithContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WrapWithContent.d.ts","sourceRoot":"","sources":["../src/WrapWithContent.tsx"],"names":[],"mappings":"AAqCA,eAAO,MAAM,eAAe,GAAI;;;;;;;;;;;;;;;;;;;;;;;;;;CA2B/B,4CAoDA,CAAC"}
1
+ {"version":3,"file":"WrapWithContent.d.ts","sourceRoot":"","sources":["../src/WrapWithContent.tsx"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,oBAAoB,EAG1B,MAAM,4BAA4B,CAAC;AAqCpC,eAAO,MAAM,eAAe,GAAI,wSA0B7B,oBAAoB,4CAoDtB,CAAC"}
@@ -3,19 +3,17 @@ import { useCallback, useMemo } from "react";
3
3
  import { getVneLength } from "@vnejs/uis.utils";
4
4
  import { Text, Wrap } from "@vnejs/uis.react";
5
5
  import { b } from "./WrapWithContent.styles.js";
6
- const getCssPosition = (value) => () => value ? getVneLength(value) : "0";
6
+ const getCssPosition = (value) => () => (value ? getVneLength(value) : "0");
7
7
  const renderOneItem = (props, style, renderFunc) => renderFunc && (_jsx("div", { className: b("item"), style: style, children: renderFunc(props) }));
8
8
  const useRenderContentCallback = (renderFunc, text, size) => {
9
9
  return useCallback(({ isSelected = false }) => {
10
10
  if (text)
11
11
  return (_jsx(Text, { isSelected: isSelected, text: text, size: size }));
12
12
  if (renderFunc)
13
- return renderFunc();
13
+ return renderFunc({ isSelected });
14
14
  }, [renderFunc, text, size]);
15
15
  };
16
- export const WrapWithContent = ({
17
- //
18
- className, imageSrc = "", isSelected = false, isRounded = false, withHover = false, width = 0, height = 0, borderWidth = 0, top = 0, right = 0, bottom = 0, left = 0, transition = 300, renderTopLeft, renderTopRight, renderBottomLeft, renderBottomRight, topLeftText, topLeftSize, topRightText, topRightSize, bottomLeftText, bottomLeftSize, onClick, value, }) => {
16
+ export const WrapWithContent = ({ className, imageSrc = "", isSelected = false, isRounded = false, withHover = false, width = 0, height = 0, borderWidth = 0, top = 0, right = 0, bottom = 0, left = 0, transition = 300, renderTopLeft, renderTopRight, renderBottomLeft, renderBottomRight, topLeftText, topLeftSize, topRightText, topRightSize, bottomLeftText, bottomLeftSize, onClick, value, }) => {
19
17
  const realTop = useMemo(getCssPosition(top), [top]);
20
18
  const realRight = useMemo(getCssPosition(right), [right]);
21
19
  const realBottom = useMemo(getCssPosition(bottom), [bottom]);
@@ -1 +1 @@
1
- {"version":3,"file":"WrapWith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WAAW,CAAC,CAAC;IAC/F,MAAM,qBAAqB,GAAG,wBAAwB,CAAC,cAAc,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IACnG,MAAM,uBAAuB,GAAG,wBAAwB,CAAC,gBAAgB,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;IAE3G,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,aAAa,CAAC,EAC1C,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,CAAC,EACV,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,YAEZ,eACE,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,EACvB,KAAK,EAAE,YAAY,aAElB,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,oBAAoB,CAAC,EACxD,aAAa,CAAC,KAAK,EAAE,aAAa,EAAE,qBAAqB,CAAC,EAC1D,aAAa,CAAC,KAAK,EAAE,eAAe,EAAE,uBAAuB,CAAC,EAC9D,aAAa,CAAC,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,IACtD,GACD,CACR,CAAC;AACJ,CAAC,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const b: (...args: any[]) => string;
1
+ export declare const b: any;
2
2
  //# sourceMappingURL=WrapWithContent.styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WrapWithContent.styles.d.ts","sourceRoot":"","sources":["../src/WrapWithContent.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,CAAC,4BAAwB,CAAC"}
1
+ {"version":3,"file":"WrapWithContent.styles.d.ts","sourceRoot":"","sources":["../src/WrapWithContent.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,CAAC,KAAwB,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { CssInsertInnerText, CssInsertValueLength, CssInsertValueNumber } from "@vnejs/uis.utils";
2
+ import type { ReactNode } from "react";
3
+ export type WrapWithContentRenderProps = {
4
+ isSelected?: boolean;
5
+ };
6
+ export type WrapWithContentRenderFunc = (props: WrapWithContentRenderProps) => ReactNode;
7
+ export type WrapWithContentProps<T = unknown> = {
8
+ className?: string;
9
+ imageSrc?: string;
10
+ isSelected?: boolean;
11
+ isRounded?: boolean;
12
+ withHover?: boolean;
13
+ width?: CssInsertValueLength;
14
+ height?: CssInsertValueLength;
15
+ borderWidth?: CssInsertValueLength;
16
+ top?: CssInsertValueLength;
17
+ right?: CssInsertValueLength;
18
+ bottom?: CssInsertValueLength;
19
+ left?: CssInsertValueLength;
20
+ transition?: CssInsertValueNumber;
21
+ renderTopLeft?: WrapWithContentRenderFunc;
22
+ renderTopRight?: WrapWithContentRenderFunc;
23
+ renderBottomLeft?: WrapWithContentRenderFunc;
24
+ renderBottomRight?: WrapWithContentRenderFunc;
25
+ topLeftText?: CssInsertInnerText;
26
+ topLeftSize?: CssInsertValueLength;
27
+ topRightText?: CssInsertInnerText;
28
+ topRightSize?: CssInsertValueLength;
29
+ bottomLeftText?: CssInsertInnerText;
30
+ bottomLeftSize?: CssInsertValueLength;
31
+ onClick?: (value?: T) => void;
32
+ value?: T;
33
+ };
34
+ //# sourceMappingURL=WrapWithContent.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WrapWithContent.types.d.ts","sourceRoot":"","sources":["../src/WrapWithContent.types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACvG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,0BAA0B,GAAG;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM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rapWithContent.types.js","sourceRoot":"","sources":["../src/WrapWithContent.types.tsx"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export * from "./WrapWithContent";
1
+ export * from "./WrapWithContent.types.js";
2
+ export * from "./WrapWithContent.js";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
- export * from "./WrapWithContent";
1
+ export * from "./WrapWithContent.types.js";
2
+ export * from "./WrapWithContent.js";
2
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/uis.react.wrap-with-content",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -1,14 +1,25 @@
1
1
  import { useCallback, useMemo } from "react";
2
+ import type { CSSProperties } from "react";
2
3
 
3
- import { getVneLength } from "@vnejs/uis.utils";
4
+ import { getVneLength, type CssInsertInnerText, type CssInsertValueLength } from "@vnejs/uis.utils";
4
5
 
5
6
  import { Text, Wrap } from "@vnejs/uis.react";
6
7
 
8
+ import {
9
+ type WrapWithContentProps,
10
+ type WrapWithContentRenderFunc,
11
+ type WrapWithContentRenderProps,
12
+ } from "./WrapWithContent.types.js";
13
+
7
14
  import { b } from "./WrapWithContent.styles.js";
8
15
 
9
- const getCssPosition = (value) => () => value ? getVneLength(value) : "0";
16
+ const getCssPosition = (value: CssInsertValueLength) => () => (value ? getVneLength(value) : "0");
10
17
 
11
- const renderOneItem = (props, style, renderFunc) =>
18
+ const renderOneItem = (
19
+ props: WrapWithContentRenderProps,
20
+ style: CSSProperties,
21
+ renderFunc?: WrapWithContentRenderFunc,
22
+ ) =>
12
23
  renderFunc && (
13
24
  <div
14
25
  className={b("item")}
@@ -18,9 +29,9 @@ const renderOneItem = (props, style, renderFunc) =>
18
29
  </div>
19
30
  );
20
31
 
21
- const useRenderContentCallback = (renderFunc, text, size) => {
32
+ const useRenderContentCallback = (renderFunc: WrapWithContentRenderFunc | undefined, text?: CssInsertInnerText, size?: CssInsertValueLength) => {
22
33
  return useCallback(
23
- ({ isSelected = false }) => {
34
+ ({ isSelected = false }: WrapWithContentRenderProps) => {
24
35
  if (text)
25
36
  return (
26
37
  <Text
@@ -29,14 +40,13 @@ const useRenderContentCallback = (renderFunc, text, size) => {
29
40
  size={size}
30
41
  />
31
42
  );
32
- if (renderFunc) return renderFunc();
43
+ if (renderFunc) return renderFunc({ isSelected });
33
44
  },
34
45
  [renderFunc, text, size],
35
46
  );
36
47
  };
37
48
 
38
49
  export const WrapWithContent = ({
39
- //
40
50
  className,
41
51
  imageSrc = "",
42
52
  isSelected = false,
@@ -62,7 +72,7 @@ export const WrapWithContent = ({
62
72
  bottomLeftSize,
63
73
  onClick,
64
74
  value,
65
- }) => {
75
+ }: WrapWithContentProps) => {
66
76
  const realTop = useMemo(getCssPosition(top), [top]);
67
77
  const realRight = useMemo(getCssPosition(right), [right]);
68
78
  const realBottom = useMemo(getCssPosition(bottom), [bottom]);
@@ -75,10 +85,10 @@ export const WrapWithContent = ({
75
85
 
76
86
  const props = useMemo(() => ({ isSelected }), [isSelected]);
77
87
 
78
- const addClassNames = useMemo(() => [className, withHover && "TextHoverParent"].filter(Boolean), [className, withHover]);
88
+ const addClassNames = useMemo(() => [className, withHover && "TextHoverParent"].filter(Boolean) as string[], [className, withHover]);
79
89
 
80
90
  const styleContent = useMemo(() => {
81
- const result: Record<string, any> = {};
91
+ const result: Record<string, string> = {};
82
92
 
83
93
  if (transition) result.transition = `${transition}ms`;
84
94
 
@@ -0,0 +1,36 @@
1
+ import type { CssInsertInnerText, CssInsertValueLength, CssInsertValueNumber } from "@vnejs/uis.utils";
2
+ import type { ReactNode } from "react";
3
+
4
+ export type WrapWithContentRenderProps = {
5
+ isSelected?: boolean;
6
+ };
7
+
8
+ export type WrapWithContentRenderFunc = (props: WrapWithContentRenderProps) => ReactNode;
9
+
10
+ export type WrapWithContentProps<T = unknown> = {
11
+ className?: string;
12
+ imageSrc?: string;
13
+ isSelected?: boolean;
14
+ isRounded?: boolean;
15
+ withHover?: boolean;
16
+ width?: CssInsertValueLength;
17
+ height?: CssInsertValueLength;
18
+ borderWidth?: CssInsertValueLength;
19
+ top?: CssInsertValueLength;
20
+ right?: CssInsertValueLength;
21
+ bottom?: CssInsertValueLength;
22
+ left?: CssInsertValueLength;
23
+ transition?: CssInsertValueNumber;
24
+ renderTopLeft?: WrapWithContentRenderFunc;
25
+ renderTopRight?: WrapWithContentRenderFunc;
26
+ renderBottomLeft?: WrapWithContentRenderFunc;
27
+ renderBottomRight?: WrapWithContentRenderFunc;
28
+ topLeftText?: CssInsertInnerText;
29
+ topLeftSize?: CssInsertValueLength;
30
+ topRightText?: CssInsertInnerText;
31
+ topRightSize?: CssInsertValueLength;
32
+ bottomLeftText?: CssInsertInnerText;
33
+ bottomLeftSize?: CssInsertValueLength;
34
+ onClick?: (value?: T) => void;
35
+ value?: T;
36
+ };
package/src/index.ts CHANGED
@@ -1 +1,2 @@
1
- export * from "./WrapWithContent";
1
+ export * from "./WrapWithContent.types.js";
2
+ export * from "./WrapWithContent.js";
package/tsconfig.json CHANGED
@@ -8,7 +8,6 @@
8
8
  "src/**/*.ts",
9
9
  "src/**/*.tsx",
10
10
  "../../../globals.d.ts",
11
- "../../peer-modules.d.ts"
12
11
  ],
13
12
  "exclude": [
14
13
  "dist",