deepsea-components 5.8.3 → 5.9.0
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/cjs/components/Unify.d.ts +14 -0
- package/dist/cjs/components/Unify.js +45 -0
- package/dist/cjs/components/Unify.js.map +7 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/components/Unify.d.ts +14 -0
- package/dist/esm/components/Unify.js +39 -0
- package/dist/esm/components/Unify.js.map +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Unify.tsx +36 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CSSProperties, ComponentProps, FC, ReactNode } from "react";
|
|
2
|
+
export interface UnifyConfig {
|
|
3
|
+
className?: string;
|
|
4
|
+
style?: CSSProperties;
|
|
5
|
+
}
|
|
6
|
+
export interface UnifyConfigProviderProps extends UnifyConfig {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const UnifyConfigProvider: FC<UnifyConfigProviderProps>;
|
|
10
|
+
export type UnifyProps<T extends keyof JSX.IntrinsicElements = "div"> = ComponentProps<T> & {
|
|
11
|
+
as?: T;
|
|
12
|
+
};
|
|
13
|
+
declare function Unify<T extends keyof JSX.IntrinsicElements = "div">(props: UnifyProps<T>): ReactNode;
|
|
14
|
+
export default Unify;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/Unify.tsx
|
|
21
|
+
var Unify_exports = {};
|
|
22
|
+
__export(Unify_exports, {
|
|
23
|
+
UnifyConfigProvider: () => UnifyConfigProvider,
|
|
24
|
+
default: () => Unify_default
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(Unify_exports);
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var import_deepsea_tools = require("deepsea-tools");
|
|
29
|
+
var UnifyConfigContext = (0, import_react.createContext)({});
|
|
30
|
+
var UnifyConfigProvider = ({ className, style, children }) => /* @__PURE__ */ React.createElement(UnifyConfigContext.Provider, { value: { className, style } }, children);
|
|
31
|
+
function Unify(props) {
|
|
32
|
+
const { as, className, style, ...rest } = props;
|
|
33
|
+
const { className: _className, style: _style } = (0, import_react.useContext)(UnifyConfigContext);
|
|
34
|
+
return (0, import_react.createElement)(as ?? "div", {
|
|
35
|
+
className: (0, import_deepsea_tools.clsx)(_className, className),
|
|
36
|
+
style: { ..._style, ...style },
|
|
37
|
+
...rest
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
var Unify_default = Unify;
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
UnifyConfigProvider
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=Unify.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/Unify.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\r\n\r\nimport { CSSProperties, ComponentProps, FC, ReactNode, createContext, createElement, useContext } from \"react\"\r\nimport { clsx } from \"deepsea-tools\"\r\n\r\nexport interface UnifyConfig {\r\n className?: string\r\n style?: CSSProperties\r\n}\r\n\r\nconst UnifyConfigContext = createContext<UnifyConfig>({})\r\n\r\nexport interface UnifyConfigProviderProps extends UnifyConfig {\r\n children?: ReactNode\r\n}\r\n\r\nexport const UnifyConfigProvider: FC<UnifyConfigProviderProps> = ({ className, style, children }) => (\r\n <UnifyConfigContext.Provider value={{ className, style }}>{children}</UnifyConfigContext.Provider>\r\n)\r\n\r\nexport type UnifyProps<T extends keyof JSX.IntrinsicElements = \"div\"> = ComponentProps<T> & {\r\n as?: T\r\n}\r\n\r\nfunction Unify<T extends keyof JSX.IntrinsicElements = \"div\">(props: UnifyProps<T>) {\r\n const { as, className, style, ...rest } = props\r\n const { className: _className, style: _style } = useContext(UnifyConfigContext)\r\n\r\n return createElement(as ?? \"div\", {\r\n className: clsx(_className, className),\r\n style: { ..._style, ...style },\r\n ...rest,\r\n }) as ReactNode\r\n}\r\n\r\nexport default Unify\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAuG;AACvG,2BAAqB;AAOrB,IAAM,yBAAqB,4BAA2B,CAAC,CAAC;AAMjD,IAAM,sBAAoD,CAAC,EAAE,WAAW,OAAO,SAAS,MAC3F,oCAAC,mBAAmB,UAAnB,EAA4B,OAAO,EAAE,WAAW,MAAM,KAAI,QAAS;AAOxE,SAAS,MAAqD,OAAsB;AAChF,QAAM,EAAE,IAAI,WAAW,OAAO,GAAG,KAAK,IAAI;AAC1C,QAAM,EAAE,WAAW,YAAY,OAAO,OAAO,QAAI,yBAAW,kBAAkB;AAE9E,aAAO,4BAAc,MAAM,OAAO;AAAA,IAC9B,eAAW,2BAAK,YAAY,SAAS;AAAA,IACrC,OAAO,EAAE,GAAG,QAAQ,GAAG,MAAM;AAAA,IAC7B,GAAG;AAAA,EACP,CAAC;AACL;AAEA,IAAO,gBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -20,5 +20,6 @@ export * from "./components/Title";
|
|
|
20
20
|
export * from "./components/TransitionBox";
|
|
21
21
|
export * from "./components/TransitionNum";
|
|
22
22
|
export * from "./components/Trapezium";
|
|
23
|
+
export * from "./components/Unify";
|
|
23
24
|
export * from "./utils/getReactVersion";
|
|
24
25
|
export * from "./utils/index";
|
package/dist/cjs/index.js
CHANGED
|
@@ -38,6 +38,7 @@ __reExport(src_exports, require("./components/Title"), module.exports);
|
|
|
38
38
|
__reExport(src_exports, require("./components/TransitionBox"), module.exports);
|
|
39
39
|
__reExport(src_exports, require("./components/TransitionNum"), module.exports);
|
|
40
40
|
__reExport(src_exports, require("./components/Trapezium"), module.exports);
|
|
41
|
+
__reExport(src_exports, require("./components/Unify"), module.exports);
|
|
41
42
|
__reExport(src_exports, require("./utils/getReactVersion"), module.exports);
|
|
42
43
|
__reExport(src_exports, require("./utils/index"), module.exports);
|
|
43
44
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -64,6 +65,7 @@ __reExport(src_exports, require("./utils/index"), module.exports);
|
|
|
64
65
|
...require("./components/TransitionBox"),
|
|
65
66
|
...require("./components/TransitionNum"),
|
|
66
67
|
...require("./components/Trapezium"),
|
|
68
|
+
...require("./components/Unify"),
|
|
67
69
|
...require("./utils/getReactVersion"),
|
|
68
70
|
...require("./utils/index")
|
|
69
71
|
});
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from \"@/components/AutoFit\"\nexport * from \"@/components/AutoScroll\"\nexport * from \"@/components/AutoSizeTextarea\"\nexport * from \"@/components/CircleText\"\nexport * from \"@/components/CopyButton\"\nexport * from \"@/components/Echart\"\nexport * from \"@/components/ExportExcel\"\nexport * from \"@/components/Flow\"\nexport * from \"@/components/FormLabel\"\nexport * from \"@/components/HlsPlayer\"\nexport * from \"@/components/ImportExcel\"\nexport * from \"@/components/InfiniteScroll\"\nexport * from \"@/components/InputFile\"\nexport * from \"@/components/LoopSwiper\"\nexport * from \"@/components/Ring\"\nexport * from \"@/components/Scroll\"\nexport * from \"@/components/SectionRing\"\nexport * from \"@/components/Skeleton\"\nexport * from \"@/components/Title\"\nexport * from \"@/components/TransitionBox\"\nexport * from \"@/components/TransitionNum\"\nexport * from \"@/components/Trapezium\"\nexport * from \"@/utils/getReactVersion\"\nexport * from \"@/utils/index\"\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,iCAAd;AACA,wBAAc,oCADd;AAEA,wBAAc,0CAFd;AAGA,wBAAc,oCAHd;AAIA,wBAAc,oCAJd;AAKA,wBAAc,gCALd;AAMA,wBAAc,qCANd;AAOA,wBAAc,8BAPd;AAQA,wBAAc,mCARd;AASA,wBAAc,mCATd;AAUA,wBAAc,qCAVd;AAWA,wBAAc,wCAXd;AAYA,wBAAc,mCAZd;AAaA,wBAAc,oCAbd;AAcA,wBAAc,8BAdd;AAeA,wBAAc,gCAfd;AAgBA,wBAAc,qCAhBd;AAiBA,wBAAc,kCAjBd;AAkBA,wBAAc,+BAlBd;AAmBA,wBAAc,uCAnBd;AAoBA,wBAAc,uCApBd;AAqBA,wBAAc,mCArBd;AAsBA,wBAAc
|
|
4
|
+
"sourcesContent": ["export * from \"@/components/AutoFit\"\nexport * from \"@/components/AutoScroll\"\nexport * from \"@/components/AutoSizeTextarea\"\nexport * from \"@/components/CircleText\"\nexport * from \"@/components/CopyButton\"\nexport * from \"@/components/Echart\"\nexport * from \"@/components/ExportExcel\"\nexport * from \"@/components/Flow\"\nexport * from \"@/components/FormLabel\"\nexport * from \"@/components/HlsPlayer\"\nexport * from \"@/components/ImportExcel\"\nexport * from \"@/components/InfiniteScroll\"\nexport * from \"@/components/InputFile\"\nexport * from \"@/components/LoopSwiper\"\nexport * from \"@/components/Ring\"\nexport * from \"@/components/Scroll\"\nexport * from \"@/components/SectionRing\"\nexport * from \"@/components/Skeleton\"\nexport * from \"@/components/Title\"\nexport * from \"@/components/TransitionBox\"\nexport * from \"@/components/TransitionNum\"\nexport * from \"@/components/Trapezium\"\nexport * from \"@/components/Unify\"\nexport * from \"@/utils/getReactVersion\"\nexport * from \"@/utils/index\"\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,iCAAd;AACA,wBAAc,oCADd;AAEA,wBAAc,0CAFd;AAGA,wBAAc,oCAHd;AAIA,wBAAc,oCAJd;AAKA,wBAAc,gCALd;AAMA,wBAAc,qCANd;AAOA,wBAAc,8BAPd;AAQA,wBAAc,mCARd;AASA,wBAAc,mCATd;AAUA,wBAAc,qCAVd;AAWA,wBAAc,wCAXd;AAYA,wBAAc,mCAZd;AAaA,wBAAc,oCAbd;AAcA,wBAAc,8BAdd;AAeA,wBAAc,gCAfd;AAgBA,wBAAc,qCAhBd;AAiBA,wBAAc,kCAjBd;AAkBA,wBAAc,+BAlBd;AAmBA,wBAAc,uCAnBd;AAoBA,wBAAc,uCApBd;AAqBA,wBAAc,mCArBd;AAsBA,wBAAc,+BAtBd;AAuBA,wBAAc,oCAvBd;AAwBA,wBAAc,0BAxBd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CSSProperties, ComponentProps, FC, ReactNode } from "react";
|
|
2
|
+
export interface UnifyConfig {
|
|
3
|
+
className?: string;
|
|
4
|
+
style?: CSSProperties;
|
|
5
|
+
}
|
|
6
|
+
export interface UnifyConfigProviderProps extends UnifyConfig {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const UnifyConfigProvider: FC<UnifyConfigProviderProps>;
|
|
10
|
+
export type UnifyProps<T extends keyof JSX.IntrinsicElements = "div"> = ComponentProps<T> & {
|
|
11
|
+
as?: T;
|
|
12
|
+
};
|
|
13
|
+
declare function Unify<T extends keyof JSX.IntrinsicElements = "div">(props: UnifyProps<T>): ReactNode;
|
|
14
|
+
export default Unify;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { createContext, createElement, useContext } from "react";
|
|
4
|
+
import { clsx } from "deepsea-tools";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const UnifyConfigContext = /*#__PURE__*/createContext({});
|
|
7
|
+
export const UnifyConfigProvider = ({
|
|
8
|
+
className,
|
|
9
|
+
style,
|
|
10
|
+
children
|
|
11
|
+
}) => /*#__PURE__*/_jsx(UnifyConfigContext.Provider, {
|
|
12
|
+
value: {
|
|
13
|
+
className,
|
|
14
|
+
style
|
|
15
|
+
},
|
|
16
|
+
children: children
|
|
17
|
+
});
|
|
18
|
+
function Unify(props) {
|
|
19
|
+
const {
|
|
20
|
+
as,
|
|
21
|
+
className,
|
|
22
|
+
style,
|
|
23
|
+
...rest
|
|
24
|
+
} = props;
|
|
25
|
+
const {
|
|
26
|
+
className: _className,
|
|
27
|
+
style: _style
|
|
28
|
+
} = useContext(UnifyConfigContext);
|
|
29
|
+
return /*#__PURE__*/createElement(as ?? "div", {
|
|
30
|
+
className: clsx(_className, className),
|
|
31
|
+
style: {
|
|
32
|
+
..._style,
|
|
33
|
+
...style
|
|
34
|
+
},
|
|
35
|
+
...rest
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export default Unify;
|
|
39
|
+
//# sourceMappingURL=Unify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","createElement","useContext","clsx","jsx","_jsx","UnifyConfigContext","UnifyConfigProvider","className","style","children","Provider","value","Unify","props","as","rest","_className","_style"],"sources":["../../../src/components/Unify.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport { CSSProperties, ComponentProps, FC, ReactNode, createContext, createElement, useContext } from \"react\"\r\nimport { clsx } from \"deepsea-tools\"\r\n\r\nexport interface UnifyConfig {\r\n className?: string\r\n style?: CSSProperties\r\n}\r\n\r\nconst UnifyConfigContext = createContext<UnifyConfig>({})\r\n\r\nexport interface UnifyConfigProviderProps extends UnifyConfig {\r\n children?: ReactNode\r\n}\r\n\r\nexport const UnifyConfigProvider: FC<UnifyConfigProviderProps> = ({ className, style, children }) => (\r\n <UnifyConfigContext.Provider value={{ className, style }}>{children}</UnifyConfigContext.Provider>\r\n)\r\n\r\nexport type UnifyProps<T extends keyof JSX.IntrinsicElements = \"div\"> = ComponentProps<T> & {\r\n as?: T\r\n}\r\n\r\nfunction Unify<T extends keyof JSX.IntrinsicElements = \"div\">(props: UnifyProps<T>) {\r\n const { as, className, style, ...rest } = props\r\n const { className: _className, style: _style } = useContext(UnifyConfigContext)\r\n\r\n return createElement(as ?? \"div\", {\r\n className: clsx(_className, className),\r\n style: { ..._style, ...style },\r\n ...rest,\r\n }) as ReactNode\r\n}\r\n\r\nexport default Unify\r\n"],"mappings":"AAAA,YAAY;;AAEZ,SAAuDA,aAAa,EAAEC,aAAa,EAAEC,UAAU,QAAQ,OAAO;AAC9G,SAASC,IAAI,QAAQ,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAOpC,MAAMC,kBAAkB,gBAAGN,aAAa,CAAc,CAAC,CAAC,CAAC;AAMzD,OAAO,MAAMO,mBAAiD,GAAGA,CAAC;EAAEC,SAAS;EAAEC,KAAK;EAAEC;AAAS,CAAC,kBAC5FL,IAAA,CAACC,kBAAkB,CAACK,QAAQ;EAACC,KAAK,EAAE;IAAEJ,SAAS;IAAEC;EAAM,CAAE;EAAAC,QAAA,EAAEA;AAAQ,CAA8B,CACpG;AAMD,SAASG,KAAKA,CAAgDC,KAAoB,EAAE;EAChF,MAAM;IAAEC,EAAE;IAAEP,SAAS;IAAEC,KAAK;IAAE,GAAGO;EAAK,CAAC,GAAGF,KAAK;EAC/C,MAAM;IAAEN,SAAS,EAAES,UAAU;IAAER,KAAK,EAAES;EAAO,CAAC,GAAGhB,UAAU,CAACI,kBAAkB,CAAC;EAE/E,oBAAOL,aAAa,CAACc,EAAE,IAAI,KAAK,EAAE;IAC9BP,SAAS,EAAEL,IAAI,CAACc,UAAU,EAAET,SAAS,CAAC;IACtCC,KAAK,EAAE;MAAE,GAAGS,MAAM;MAAE,GAAGT;IAAM,CAAC;IAC9B,GAAGO;EACP,CAAC,CAAC;AACN;AAEA,eAAeH,KAAK"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -20,5 +20,6 @@ export * from "./components/Title";
|
|
|
20
20
|
export * from "./components/TransitionBox";
|
|
21
21
|
export * from "./components/TransitionNum";
|
|
22
22
|
export * from "./components/Trapezium";
|
|
23
|
+
export * from "./components/Unify";
|
|
23
24
|
export * from "./utils/getReactVersion";
|
|
24
25
|
export * from "./utils/index";
|
package/dist/esm/index.js
CHANGED
|
@@ -20,6 +20,7 @@ export * from "./components/Title";
|
|
|
20
20
|
export * from "./components/TransitionBox";
|
|
21
21
|
export * from "./components/TransitionNum";
|
|
22
22
|
export * from "./components/Trapezium";
|
|
23
|
+
export * from "./components/Unify";
|
|
23
24
|
export * from "./utils/getReactVersion";
|
|
24
25
|
export * from "./utils";
|
|
25
26
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from \"@/components/AutoFit\"\nexport * from \"@/components/AutoScroll\"\nexport * from \"@/components/AutoSizeTextarea\"\nexport * from \"@/components/CircleText\"\nexport * from \"@/components/CopyButton\"\nexport * from \"@/components/Echart\"\nexport * from \"@/components/ExportExcel\"\nexport * from \"@/components/Flow\"\nexport * from \"@/components/FormLabel\"\nexport * from \"@/components/HlsPlayer\"\nexport * from \"@/components/ImportExcel\"\nexport * from \"@/components/InfiniteScroll\"\nexport * from \"@/components/InputFile\"\nexport * from \"@/components/LoopSwiper\"\nexport * from \"@/components/Ring\"\nexport * from \"@/components/Scroll\"\nexport * from \"@/components/SectionRing\"\nexport * from \"@/components/Skeleton\"\nexport * from \"@/components/Title\"\nexport * from \"@/components/TransitionBox\"\nexport * from \"@/components/TransitionNum\"\nexport * from \"@/components/Trapezium\"\nexport * from \"@/utils/getReactVersion\"\nexport * from \"@/utils/index\"\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from \"@/components/AutoFit\"\nexport * from \"@/components/AutoScroll\"\nexport * from \"@/components/AutoSizeTextarea\"\nexport * from \"@/components/CircleText\"\nexport * from \"@/components/CopyButton\"\nexport * from \"@/components/Echart\"\nexport * from \"@/components/ExportExcel\"\nexport * from \"@/components/Flow\"\nexport * from \"@/components/FormLabel\"\nexport * from \"@/components/HlsPlayer\"\nexport * from \"@/components/ImportExcel\"\nexport * from \"@/components/InfiniteScroll\"\nexport * from \"@/components/InputFile\"\nexport * from \"@/components/LoopSwiper\"\nexport * from \"@/components/Ring\"\nexport * from \"@/components/Scroll\"\nexport * from \"@/components/SectionRing\"\nexport * from \"@/components/Skeleton\"\nexport * from \"@/components/Title\"\nexport * from \"@/components/TransitionBox\"\nexport * from \"@/components/TransitionNum\"\nexport * from \"@/components/Trapezium\"\nexport * from \"@/components/Unify\"\nexport * from \"@/utils/getReactVersion\"\nexport * from \"@/utils/index\"\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deepsea-components",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.9.0",
|
|
4
4
|
"description": "格数科技自用组件库",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"echarts": "^5.5.1",
|
|
32
32
|
"hls.js": "^1.5.18",
|
|
33
33
|
"smooth-scrollbar": "^8.8.4",
|
|
34
|
-
"deepsea-tools": "5.18.
|
|
34
|
+
"deepsea-tools": "5.18.2"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@types/react": "^18.3.1",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { CSSProperties, ComponentProps, FC, ReactNode, createContext, createElement, useContext } from "react"
|
|
4
|
+
import { clsx } from "deepsea-tools"
|
|
5
|
+
|
|
6
|
+
export interface UnifyConfig {
|
|
7
|
+
className?: string
|
|
8
|
+
style?: CSSProperties
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const UnifyConfigContext = createContext<UnifyConfig>({})
|
|
12
|
+
|
|
13
|
+
export interface UnifyConfigProviderProps extends UnifyConfig {
|
|
14
|
+
children?: ReactNode
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const UnifyConfigProvider: FC<UnifyConfigProviderProps> = ({ className, style, children }) => (
|
|
18
|
+
<UnifyConfigContext.Provider value={{ className, style }}>{children}</UnifyConfigContext.Provider>
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
export type UnifyProps<T extends keyof JSX.IntrinsicElements = "div"> = ComponentProps<T> & {
|
|
22
|
+
as?: T
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function Unify<T extends keyof JSX.IntrinsicElements = "div">(props: UnifyProps<T>) {
|
|
26
|
+
const { as, className, style, ...rest } = props
|
|
27
|
+
const { className: _className, style: _style } = useContext(UnifyConfigContext)
|
|
28
|
+
|
|
29
|
+
return createElement(as ?? "div", {
|
|
30
|
+
className: clsx(_className, className),
|
|
31
|
+
style: { ..._style, ...style },
|
|
32
|
+
...rest,
|
|
33
|
+
}) as ReactNode
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default Unify
|
package/src/index.ts
CHANGED
|
@@ -20,5 +20,6 @@ export * from "@/components/Title"
|
|
|
20
20
|
export * from "@/components/TransitionBox"
|
|
21
21
|
export * from "@/components/TransitionNum"
|
|
22
22
|
export * from "@/components/Trapezium"
|
|
23
|
+
export * from "@/components/Unify"
|
|
23
24
|
export * from "@/utils/getReactVersion"
|
|
24
25
|
export * from "@/utils/index"
|