@easyv/biz-components 0.0.1 → 0.0.2
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/_virtual/index.es2.js +2 -2
- package/dist/_virtual/index.es3.js +2 -2
- package/dist/_virtual/index.es4.js +2 -2
- package/dist/_virtual/index.es5.js +2 -2
- package/dist/components/AiMessageRender/AiMessageRender.d.ts +2 -1
- package/dist/components/AiMessageRender/AiMessageRender.es.js +16 -14
- package/dist/components/AiMessageRender/AiMessageRender.es.js.map +1 -1
- package/dist/components/ShadowDom/ShadowDom.es.js +18 -16
- package/dist/components/ShadowDom/ShadowDom.es.js.map +1 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/index.es.js +4 -6
- package/dist/index.es.js.map +1 -1
- package/dist/node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.es.js +1 -1
- package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.es.js +1 -1
- package/dist/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.es.js +1 -1
- package/dist/node_modules/.pnpm/style-to-js@1.1.16/node_modules/style-to-js/cjs/index.es.js +1 -1
- package/dist/node_modules/.pnpm/style-to-object@1.0.8/node_modules/style-to-object/cjs/index.es.js +1 -1
- package/package.json +1 -1
- package/dist/components/Button/index.d.ts +0 -21
- package/dist/components/Button/index.es.js +0 -23
- package/dist/components/Button/index.es.js.map +0 -1
|
@@ -2,6 +2,7 @@ import { DashboardContext } from './types';
|
|
|
2
2
|
|
|
3
3
|
export interface AiMessageRenderProps {
|
|
4
4
|
className?: string;
|
|
5
|
-
|
|
5
|
+
contents: (string | DashboardContext)[];
|
|
6
|
+
renderDashboardContent?: (msg: DashboardContext) => React.ReactNode;
|
|
6
7
|
}
|
|
7
8
|
export declare const AiMessageRender: (props: AiMessageRenderProps) => JSX.Element;
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import { j as e } from "../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
|
|
2
|
-
import { CopyCircleOutlined as p, RedoOutlined as
|
|
2
|
+
import { CopyCircleOutlined as p, RedoOutlined as f } from "../../node_modules/.pnpm/@easyv_react-icons@6.3.0/node_modules/@easyv/react-icons/dist/index.esm.es.js";
|
|
3
3
|
import u from "../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js";
|
|
4
4
|
import j from "./index.css.es.js";
|
|
5
|
-
import { ShadowDom as
|
|
6
|
-
import { Markdown as
|
|
7
|
-
const
|
|
8
|
-
const { className:
|
|
9
|
-
const { data:
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
import { ShadowDom as v } from "../ShadowDom/ShadowDom.es.js";
|
|
6
|
+
import { Markdown as N } from "../../node_modules/.pnpm/react-markdown@10.1.0_@types_react@18.2.0_react@18.2.0/node_modules/react-markdown/lib/index.es.js";
|
|
7
|
+
const D = (d) => {
|
|
8
|
+
const { className: a = "", renderDashboardContent: s, contents: c } = d, l = (r) => /* @__PURE__ */ e.jsx(v, { style: j, children: /* @__PURE__ */ e.jsx(N, { children: r }) }), m = (r) => {
|
|
9
|
+
const { data: t, filterCode: n, plotModuleName: x, plotVersion: h } = r;
|
|
10
|
+
if (s)
|
|
11
|
+
return s(r);
|
|
12
|
+
let i = t;
|
|
13
|
+
return n && (i = new Function("data", n)(t)), /* @__PURE__ */ e.jsxs("div", { children: [
|
|
12
14
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
13
15
|
"组件名称:",
|
|
14
16
|
x
|
|
15
17
|
] }),
|
|
16
18
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
17
19
|
"组件版本:",
|
|
18
|
-
|
|
20
|
+
h
|
|
19
21
|
] }),
|
|
20
22
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
21
23
|
"组件数据:",
|
|
22
24
|
i.slice(0, 5).map((o) => JSON.stringify(o))
|
|
23
25
|
] })
|
|
24
|
-
] }
|
|
26
|
+
] });
|
|
25
27
|
};
|
|
26
28
|
return /* @__PURE__ */ e.jsxs(
|
|
27
29
|
"div",
|
|
@@ -29,19 +31,19 @@ const S = (l) => {
|
|
|
29
31
|
className: u(
|
|
30
32
|
"px-4 py-3 flex flex-col gap-3 rounded-lg max-w-[516px]",
|
|
31
33
|
"bg-[#FFFFFF14] select-auto",
|
|
32
|
-
|
|
34
|
+
a
|
|
33
35
|
),
|
|
34
36
|
children: [
|
|
35
|
-
c.map((
|
|
37
|
+
c.map((r, t) => typeof r == "string" ? /* @__PURE__ */ e.jsx("div", { className: "contents", children: l(r) }, t) : /* @__PURE__ */ e.jsx("div", { className: "contents", children: m(r) }, t)),
|
|
36
38
|
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-1", children: [
|
|
37
39
|
/* @__PURE__ */ e.jsx("div", { className: "w-6 h-6 rounded-md flex justify-center items-center hover:bg-bg-white cursor-pointer", children: /* @__PURE__ */ e.jsx(p, { className: "w-3.5 h-3.5 text-text-2" }) }),
|
|
38
|
-
/* @__PURE__ */ e.jsx("div", { className: "w-6 h-6 rounded-md flex justify-center items-center hover:bg-bg-white cursor-pointer", children: /* @__PURE__ */ e.jsx(
|
|
40
|
+
/* @__PURE__ */ e.jsx("div", { className: "w-6 h-6 rounded-md flex justify-center items-center hover:bg-bg-white cursor-pointer", children: /* @__PURE__ */ e.jsx(f, { className: "w-3.5 h-3.5 text-text-2" }) })
|
|
39
41
|
] })
|
|
40
42
|
]
|
|
41
43
|
}
|
|
42
44
|
);
|
|
43
45
|
};
|
|
44
46
|
export {
|
|
45
|
-
|
|
47
|
+
D as AiMessageRender
|
|
46
48
|
};
|
|
47
49
|
//# sourceMappingURL=AiMessageRender.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiMessageRender.es.js","sources":["../../../src/components/AiMessageRender/AiMessageRender.tsx"],"sourcesContent":["import { CopyCircleOutlined, RedoOutlined } from '@easyv/react-icons';\nimport classNames from 'classnames';\nimport Markdown from 'react-markdown';\nimport { ShadowDom } from '../ShadowDom';\n// @ts-expect-error\nimport messageRenderCss from './index.css?raw';\nimport { DashboardContext } from './types';\n\nexport interface AiMessageRenderProps {\n className?: string;\n
|
|
1
|
+
{"version":3,"file":"AiMessageRender.es.js","sources":["../../../src/components/AiMessageRender/AiMessageRender.tsx"],"sourcesContent":["import { CopyCircleOutlined, RedoOutlined } from '@easyv/react-icons';\nimport classNames from 'classnames';\nimport Markdown from 'react-markdown';\nimport { ShadowDom } from '../ShadowDom';\n// @ts-expect-error\nimport messageRenderCss from './index.css?raw';\nimport { DashboardContext } from './types';\n\nexport interface AiMessageRenderProps {\n className?: string;\n contents: (string | DashboardContext)[];\n renderDashboardContent?: (msg: DashboardContext) => React.ReactNode;\n}\n\nexport const AiMessageRender = (props: AiMessageRenderProps) => {\n const { className = '', renderDashboardContent: propsRenderDashboardContent, contents } = props;\n\n const renderStringContent = (msg: string) => {\n return (\n <ShadowDom style={messageRenderCss}>\n <Markdown>{msg}</Markdown>\n </ShadowDom>\n );\n };\n const renderDashboardContent = (msg: DashboardContext) => {\n const { data, filterCode, plotModuleName, plotVersion } = msg;\n if (propsRenderDashboardContent) {\n return propsRenderDashboardContent(msg);\n }\n let finalData = data;\n if (filterCode) {\n const filterFunc = new Function('data', filterCode);\n finalData = filterFunc(data) as unknown[];\n }\n return (\n <div>\n <div>组件名称:{plotModuleName}</div>\n <div>组件版本:{plotVersion}</div>\n <div>组件数据:{finalData.slice(0, 5).map((i: unknown) => JSON.stringify(i))}</div>\n </div>\n );\n };\n\n return (\n <div\n className={classNames(\n 'px-4 py-3 flex flex-col gap-3 rounded-lg max-w-[516px]',\n 'bg-[#FFFFFF14] select-auto',\n className\n )}\n >\n {contents.map((msg, index) => {\n if (typeof msg === 'string') {\n return (\n <div key={index} className='contents'>\n {renderStringContent(msg)}\n </div>\n );\n } else {\n return (\n <div key={index} className='contents'>\n {renderDashboardContent(msg)}\n </div>\n );\n }\n })}\n <div className='flex gap-1'>\n <div className='w-6 h-6 rounded-md flex justify-center items-center hover:bg-bg-white cursor-pointer'>\n <CopyCircleOutlined className='w-3.5 h-3.5 text-text-2' />\n </div>\n <div className='w-6 h-6 rounded-md flex justify-center items-center hover:bg-bg-white cursor-pointer'>\n <RedoOutlined className='w-3.5 h-3.5 text-text-2' />\n </div>\n </div>\n </div>\n );\n};\n"],"names":["AiMessageRender","props","className","propsRenderDashboardContent","contents","renderStringContent","msg","ShadowDom","messageRenderCss","jsx","Markdown","renderDashboardContent","data","filterCode","plotModuleName","plotVersion","finalData","jsxs","i","classNames","index","CopyCircleOutlined","RedoOutlined"],"mappings":";;;;;;AAca,MAAAA,IAAkB,CAACC,MAAgC;AAC9D,QAAM,EAAE,WAAAC,IAAY,IAAI,wBAAwBC,GAA6B,UAAAC,MAAaH,GAEpFI,IAAsB,CAACC,4BAExBC,GAAU,EAAA,OAAOC,GAChB,UAACC,gBAAAA,EAAA,IAAAC,GAAA,EAAU,aAAI,EACjB,CAAA,GAGEC,IAAyB,CAACL,MAA0B;AACxD,UAAM,EAAE,MAAAM,GAAM,YAAAC,GAAY,gBAAAC,GAAgB,aAAAC,EAAgB,IAAAT;AAC1D,QAAIH;AACF,aAAOA,EAA4BG,CAAG;AAExC,QAAIU,IAAYJ;AAChB,WAAIC,MAEFG,IADmB,IAAI,SAAS,QAAQH,CAAU,EAC3BD,CAAI,2BAG1B,OACC,EAAA,UAAA;AAAA,MAAAK,gBAAAA,OAAC,OAAI,EAAA,UAAA;AAAA,QAAA;AAAA,QAAMH;AAAA,MAAA,GAAe;AAAA,6BACzB,OAAI,EAAA,UAAA;AAAA,QAAA;AAAA,QAAMC;AAAA,MAAA,GAAY;AAAA,6BACtB,OAAI,EAAA,UAAA;AAAA,QAAA;AAAA,QAAMC,EAAU,MAAM,GAAG,CAAC,EAAE,IAAI,CAACE,MAAe,KAAK,UAAUA,CAAC,CAAC;AAAA,MAAA,EAAE,CAAA;AAAA,IAAA,GAC1E;AAAA,EAEJ;AAGE,SAAAD,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWE;AAAA,QACT;AAAA,QACA;AAAA,QACAjB;AAAA,MACF;AAAA,MAEC,UAAA;AAAA,QAASE,EAAA,IAAI,CAACE,GAAKc,MACd,OAAOd,KAAQ,iCAEd,OAAgB,EAAA,WAAU,YACxB,UAAoBD,EAAAC,CAAG,KADhBc,CAEV,0BAIC,OAAgB,EAAA,WAAU,YACxB,UAAuBT,EAAAL,CAAG,KADnBc,CAEV,CAGL;AAAA,QACDH,gBAAAA,EAAAA,KAAC,OAAI,EAAA,WAAU,cACb,UAAA;AAAA,UAAAR,gBAAAA,EAAAA,IAAC,SAAI,WAAU,wFACb,gCAACY,GAAmB,EAAA,WAAU,2BAA0B,EAC1D,CAAA;AAAA,UACAZ,gBAAAA,EAAAA,IAAC,SAAI,WAAU,wFACb,gCAACa,GAAa,EAAA,WAAU,0BAA0B,CAAA,EACpD,CAAA;AAAA,QAAA,EACF,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useRef as i,
|
|
3
|
-
import { createPortal as
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
d.innerHTML = `
|
|
1
|
+
import { j as o } from "../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
|
|
2
|
+
import { useRef as i, useState as h, useEffect as m } from "react";
|
|
3
|
+
import { createPortal as u } from "react-dom";
|
|
4
|
+
const p = (a) => {
|
|
5
|
+
const { children: e, style: n } = a, t = i(null), [r, c] = h();
|
|
6
|
+
return m(() => {
|
|
7
|
+
if (t.current && !t.current.shadowRoot) {
|
|
8
|
+
const s = t.current.attachShadow({ mode: "open" });
|
|
9
|
+
s.innerHTML = `
|
|
11
10
|
<style>${n}</style>
|
|
12
|
-
<div data-shadow-container class="content"
|
|
13
|
-
|
|
11
|
+
<div data-shadow-container class="content"></div>
|
|
12
|
+
`, setTimeout(() => {
|
|
13
|
+
const d = s.querySelector("[data-shadow-container]");
|
|
14
|
+
c(d);
|
|
15
|
+
}, 0);
|
|
14
16
|
}
|
|
15
|
-
}, [
|
|
16
|
-
|
|
17
|
-
/* @__PURE__ */
|
|
17
|
+
}, [e, n]), /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
18
|
+
r && u(e, r),
|
|
19
|
+
/* @__PURE__ */ o.jsx("div", { ref: t })
|
|
18
20
|
] });
|
|
19
21
|
};
|
|
20
22
|
export {
|
|
21
|
-
|
|
23
|
+
p as ShadowDom
|
|
22
24
|
};
|
|
23
25
|
//# sourceMappingURL=ShadowDom.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShadowDom.es.js","sources":["../../../src/components/ShadowDom/ShadowDom.tsx"],"sourcesContent":["import React, { PropsWithChildren, useEffect, useRef } from 'react';\nimport { createPortal } from 'react-dom';\n\ninterface ShadowDomProps {\n style: string;\n}\nexport const ShadowDom = (props: PropsWithChildren<ShadowDomProps>) => {\n const { children, style } = props;\n const shadowRef = useRef<HTMLDivElement>(null);\n const shadowContainer = shadowRef.current?.shadowRoot?.querySelector('[data-shadow-container]');\n\n useEffect(() => {\n if (shadowRef.current && !shadowRef.current.shadowRoot) {\n const shadowRoot = shadowRef.current.attachShadow({ mode: 'open' });\n shadowRoot.innerHTML = `\n <style>${style}</style>\n <div data-shadow-container class=\"content\"
|
|
1
|
+
{"version":3,"file":"ShadowDom.es.js","sources":["../../../src/components/ShadowDom/ShadowDom.tsx"],"sourcesContent":["import React, { PropsWithChildren, useEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\n\ninterface ShadowDomProps {\n style: string;\n}\nexport const ShadowDom = (props: PropsWithChildren<ShadowDomProps>) => {\n const { children, style } = props;\n const shadowRef = useRef<HTMLDivElement>(null);\n const [shadowContainer, setShadowContainer] = useState<HTMLDivElement>(); // shadowRef.current?.shadowRoot?.querySelector('[data-shadow-container]');\n\n useEffect(() => {\n if (shadowRef.current && !shadowRef.current.shadowRoot) {\n const shadowRoot = shadowRef.current.attachShadow({ mode: 'open' });\n shadowRoot.innerHTML = `\n <style>${style}</style>\n <div data-shadow-container class=\"content\"></div>\n `;\n setTimeout(() => {\n const shadowContainerInner = shadowRoot.querySelector('[data-shadow-container]');\n setShadowContainer(shadowContainerInner as HTMLDivElement);\n }, 0);\n }\n }, [children, style]);\n\n return (\n <>\n {shadowContainer && createPortal(children, shadowContainer)}\n <div ref={shadowRef} />\n </>\n );\n};\n"],"names":["ShadowDom","props","children","style","shadowRef","useRef","shadowContainer","setShadowContainer","useState","useEffect","shadowRoot","shadowContainerInner","jsxs","Fragment","createPortal","jsx"],"mappings":";;;AAMa,MAAAA,IAAY,CAACC,MAA6C;AAC/D,QAAA,EAAE,UAAAC,GAAU,OAAAC,EAAA,IAAUF,GACtBG,IAAYC,EAAuB,IAAI,GACvC,CAACC,GAAiBC,CAAkB,IAAIC,EAAyB;AAEvE,SAAAC,EAAU,MAAM;AACd,QAAIL,EAAU,WAAW,CAACA,EAAU,QAAQ,YAAY;AACtD,YAAMM,IAAaN,EAAU,QAAQ,aAAa,EAAE,MAAM,QAAQ;AAClE,MAAAM,EAAW,YAAY;AAAA,iBACZP,CAAK;AAAA;AAAA,SAGhB,WAAW,MAAM;AACT,cAAAQ,IAAuBD,EAAW,cAAc,yBAAyB;AAC/E,QAAAH,EAAmBI,CAAsC;AAAA,SACxD,CAAC;AAAA,IAAA;AAAA,EACN,GACC,CAACT,GAAUC,CAAK,CAAC,GAIfS,gBAAAA,EAAA,KAAAC,YAAA,EAAA,UAAA;AAAA,IAAmBP,KAAAQ,EAAaZ,GAAUI,CAAe;AAAA,IAC1DS,gBAAAA,EAAAA,IAAC,OAAI,EAAA,KAAKX,EAAW,CAAA;AAAA,EAAA,GACvB;AAEJ;"}
|
package/dist/index.es.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ShadowDom as p } from "./components/ShadowDom/ShadowDom.es.js";
|
|
1
|
+
import { AiMessageRender as r } from "./components/AiMessageRender/AiMessageRender.es.js";
|
|
2
|
+
import { ShadowDom as a } from "./components/ShadowDom/ShadowDom.es.js";
|
|
4
3
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
p as ShadowDom
|
|
4
|
+
r as AiMessageRender,
|
|
5
|
+
a as ShadowDom
|
|
8
6
|
};
|
|
9
7
|
//# sourceMappingURL=index.es.js.map
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDefaultExportFromCjs as u } from "../../../../../_virtual/_commonjsHelpers.es.js";
|
|
2
|
-
import { __module as f } from "../../../../../_virtual/index.
|
|
2
|
+
import { __module as f } from "../../../../../_virtual/index.es3.js";
|
|
3
3
|
/*!
|
|
4
4
|
Copyright (c) 2018 Jed Watson.
|
|
5
5
|
Licensed under the MIT License (MIT), see
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDefaultExportFromCjs as e } from "../../../../../_virtual/_commonjsHelpers.es.js";
|
|
2
|
-
import { __module as r } from "../../../../../_virtual/index.
|
|
2
|
+
import { __module as r } from "../../../../../_virtual/index.es2.js";
|
|
3
3
|
import { __require as o } from "../../../react-is@16.13.1/node_modules/react-is/index.es.js";
|
|
4
4
|
import { __require as t } from "./factoryWithTypeCheckers.es.js";
|
|
5
5
|
import { __require as p } from "./factoryWithThrowingShims.es.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as e } from "../../../../../_virtual/index.
|
|
1
|
+
import { __module as e } from "../../../../../_virtual/index.es4.js";
|
|
2
2
|
import { __require as o } from "./cjs/react-is.production.min.es.js";
|
|
3
3
|
import { __require as t } from "./cjs/react-is.development.es.js";
|
|
4
4
|
var r;
|
|
@@ -2,7 +2,7 @@ import { getDefaultExportFromCjs as f, commonjsGlobal as a } from "../../../../.
|
|
|
2
2
|
import "../../../../style-to-object@1.0.8/node_modules/style-to-object/cjs/index.es.js";
|
|
3
3
|
import "./utilities.es.js";
|
|
4
4
|
import { __exports as s } from "../../../../../../_virtual/utilities.es.js";
|
|
5
|
-
import { __exports as _ } from "../../../../../../_virtual/index.
|
|
5
|
+
import { __exports as _ } from "../../../../../../_virtual/index.es5.js";
|
|
6
6
|
var l = a && a.__importDefault || function(t) {
|
|
7
7
|
return t && t.__esModule ? t : { default: t };
|
|
8
8
|
}, n = l(_), m = s;
|
package/dist/node_modules/.pnpm/style-to-object@1.0.8/node_modules/style-to-object/cjs/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { commonjsGlobal as a } from "../../../../../../_virtual/_commonjsHelpers.es.js";
|
|
2
|
-
import { __exports as n } from "../../../../../../_virtual/index.
|
|
2
|
+
import { __exports as n } from "../../../../../../_virtual/index.es5.js";
|
|
3
3
|
import { i as p } from "../../../../inline-style-parser@0.2.4/node_modules/inline-style-parser/index.es.js";
|
|
4
4
|
var s = a && a.__importDefault || function(e) {
|
|
5
5
|
return e && e.__esModule ? e : { default: e };
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
|
|
3
|
-
export interface ButtonProps {
|
|
4
|
-
/**
|
|
5
|
-
* 按钮文本
|
|
6
|
-
*/
|
|
7
|
-
children?: React.ReactNode;
|
|
8
|
-
/**
|
|
9
|
-
* 点击事件处理函数
|
|
10
|
-
*/
|
|
11
|
-
onClick?: () => void;
|
|
12
|
-
/**
|
|
13
|
-
* 按钮类型
|
|
14
|
-
*/
|
|
15
|
-
type?: 'primary' | 'default' | 'dashed' | 'link' | 'text';
|
|
16
|
-
/**
|
|
17
|
-
* 是否禁用
|
|
18
|
-
*/
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
}
|
|
21
|
-
export declare const Button: React.FC<ButtonProps>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { j as l } from "../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
|
|
2
|
-
const u = ({ children: r, onClick: t, type: o = "default", disabled: e = !1 }) => {
|
|
3
|
-
const a = "px-4 py-2 rounded-md transition-all duration-200", s = {
|
|
4
|
-
primary: "bg-blue-500 text-white hover:bg-blue-600",
|
|
5
|
-
default: "bg-gray-200 text-gray-800 hover:bg-gray-300",
|
|
6
|
-
dashed: "border-dashed border-2 border-gray-300 hover:border-gray-400",
|
|
7
|
-
link: "text-blue-500 hover:text-blue-600 hover:underline",
|
|
8
|
-
text: "text-gray-600 hover:bg-gray-100"
|
|
9
|
-
}, n = e ? "opacity-50 cursor-not-allowed" : "cursor-pointer";
|
|
10
|
-
return /* @__PURE__ */ l.jsx(
|
|
11
|
-
"button",
|
|
12
|
-
{
|
|
13
|
-
className: `${a} ${s[o]} ${n}`,
|
|
14
|
-
onClick: e ? void 0 : t,
|
|
15
|
-
disabled: e,
|
|
16
|
-
children: r
|
|
17
|
-
}
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
u as Button
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=index.es.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../../../src/components/Button/index.tsx"],"sourcesContent":["import React from 'react';\n\nexport interface ButtonProps {\n /**\n * 按钮文本\n */\n children?: React.ReactNode;\n /**\n * 点击事件处理函数\n */\n onClick?: () => void;\n /**\n * 按钮类型\n */\n type?: 'primary' | 'default' | 'dashed' | 'link' | 'text';\n /**\n * 是否禁用\n */\n disabled?: boolean;\n}\n\nexport const Button: React.FC<ButtonProps> = ({ children, onClick, type = 'default', disabled = false }) => {\n const baseStyles = 'px-4 py-2 rounded-md transition-all duration-200';\n const typeStyles = {\n primary: 'bg-blue-500 text-white hover:bg-blue-600',\n default: 'bg-gray-200 text-gray-800 hover:bg-gray-300',\n dashed: 'border-dashed border-2 border-gray-300 hover:border-gray-400',\n link: 'text-blue-500 hover:text-blue-600 hover:underline',\n text: 'text-gray-600 hover:bg-gray-100',\n };\n\n const disabledStyles = disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer';\n\n return (\n <button\n className={`${baseStyles} ${typeStyles[type]} ${disabledStyles}`}\n onClick={disabled ? undefined : onClick}\n disabled={disabled}\n >\n {children}\n </button>\n );\n};\n"],"names":["Button","children","onClick","type","disabled","baseStyles","typeStyles","disabledStyles","jsx"],"mappings":";AAqBa,MAAAA,IAAgC,CAAC,EAAE,UAAAC,GAAU,SAAAC,GAAS,MAAAC,IAAO,WAAW,UAAAC,IAAW,SAAY;AAC1G,QAAMC,IAAa,oDACbC,IAAa;AAAA,IACjB,SAAS;AAAA,IACT,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM;AAAA,EACR,GAEMC,IAAiBH,IAAW,kCAAkC;AAGlE,SAAAI,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,GAAGH,CAAU,IAAIC,EAAWH,CAAI,CAAC,IAAII,CAAc;AAAA,MAC9D,SAASH,IAAW,SAAYF;AAAA,MAChC,UAAAE;AAAA,MAEC,UAAAH;AAAA,IAAA;AAAA,EACH;AAEJ;"}
|