tango-ui-cw 0.9.8 → 1.0.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.
Files changed (118) hide show
  1. package/README.md +124 -39
  2. package/dist/component/CSSFab/index.d.ts +55 -0
  3. package/dist/component/CSSFab/useTangoStyle.d.ts +1 -0
  4. package/dist/component/TBanner/index.d.ts +50 -0
  5. package/dist/component/TButton/index.d.ts +107 -0
  6. package/dist/component/TColorPicker/index.d.ts +41 -0
  7. package/dist/component/TDate/index.d.ts +41 -0
  8. package/dist/component/TDatePicker/index.d.ts +49 -0
  9. package/dist/component/TDrawer/index.d.ts +58 -0
  10. package/dist/component/TInput/index.d.ts +81 -0
  11. package/dist/component/TLayout/index.d.ts +133 -0
  12. package/dist/component/TLine/index.d.ts +33 -0
  13. package/dist/component/TMark/index.d.ts +38 -0
  14. package/dist/component/TModal/index.d.ts +52 -0
  15. package/dist/component/TNotice/index.d.ts +30 -0
  16. package/dist/component/TSearch/index.d.ts +42 -0
  17. package/dist/component/TSpace/index.d.ts +56 -0
  18. package/dist/component/TTable/index.d.ts +76 -0
  19. package/dist/component/TTooltip/index.d.ts +31 -0
  20. package/dist/component/TUpload/index.d.ts +45 -0
  21. package/dist/component/index.d.ts +147 -0
  22. package/dist/index.cjs +12 -0
  23. package/dist/index.d.cts +18 -0
  24. package/dist/index.d.ts +18 -0
  25. package/dist/index.js +3648 -2
  26. package/dist/providers/NoticeProvider/NoticeProvider.d.ts +19 -0
  27. package/dist/providers/TangoI18nProvider/TangoI18nProvider.d.ts +28 -0
  28. package/dist/providers/ThemeProvider/ThemeProvider.d.ts +22 -0
  29. package/dist/scripts/check-peers.js +75 -0
  30. package/dist/styles/global.css +372 -0
  31. package/dist/styles/theme.css +13 -0
  32. package/package.json +65 -48
  33. package/dist/assets/Upload/delLogo.png.js +0 -1
  34. package/dist/assets/Upload/delLogo.png.mjs +0 -4
  35. package/dist/assets/Upload/fileslogo.png.js +0 -1
  36. package/dist/assets/Upload/fileslogo.png.mjs +0 -4
  37. package/dist/component/CSSFab/useTangoStyle.js +0 -2
  38. package/dist/component/CSSFab/useTangoStyle.mjs +0 -171
  39. package/dist/component/MaterialButton/MaterialButton.module.css.js +0 -1
  40. package/dist/component/MaterialButton/MaterialButton.module.css.mjs +0 -17
  41. package/dist/component/MaterialButton/index.js +0 -2
  42. package/dist/component/MaterialButton/index.mjs +0 -62
  43. package/dist/component/MaterialInput/MaterialInput.module.css.js +0 -1
  44. package/dist/component/MaterialInput/MaterialInput.module.css.mjs +0 -17
  45. package/dist/component/MaterialInput/index.js +0 -2
  46. package/dist/component/MaterialInput/index.mjs +0 -37
  47. package/dist/component/TBanner/TBanner.module.css.js +0 -1
  48. package/dist/component/TBanner/TBanner.module.css.mjs +0 -35
  49. package/dist/component/TBanner/index.js +0 -2
  50. package/dist/component/TBanner/index.mjs +0 -341
  51. package/dist/component/TButton/TButton.module.css.js +0 -1
  52. package/dist/component/TButton/TButton.module.css.mjs +0 -26
  53. package/dist/component/TButton/index.js +0 -2
  54. package/dist/component/TButton/index.mjs +0 -186
  55. package/dist/component/TColorPicker/TColorPicker.module.css.js +0 -1
  56. package/dist/component/TColorPicker/TColorPicker.module.css.mjs +0 -13
  57. package/dist/component/TColorPicker/index.js +0 -2
  58. package/dist/component/TColorPicker/index.mjs +0 -62
  59. package/dist/component/TDate/index.js +0 -2
  60. package/dist/component/TDate/index.mjs +0 -145
  61. package/dist/component/TDatePicker/TDatePicker.module.css.js +0 -1
  62. package/dist/component/TDatePicker/TDatePicker.module.css.mjs +0 -45
  63. package/dist/component/TDatePicker/index.js +0 -2
  64. package/dist/component/TDatePicker/index.mjs +0 -167
  65. package/dist/component/TDrawer/TDrawer.module.css.js +0 -1
  66. package/dist/component/TDrawer/TDrawer.module.css.mjs +0 -49
  67. package/dist/component/TDrawer/index.js +0 -2
  68. package/dist/component/TDrawer/index.mjs +0 -111
  69. package/dist/component/TInput/TInput.module.css.js +0 -1
  70. package/dist/component/TInput/TInput.module.css.mjs +0 -21
  71. package/dist/component/TInput/index.js +0 -2
  72. package/dist/component/TInput/index.mjs +0 -75
  73. package/dist/component/TLayout/index.js +0 -2
  74. package/dist/component/TLayout/index.mjs +0 -53
  75. package/dist/component/TLine/TLine.module.css.js +0 -1
  76. package/dist/component/TLine/TLine.module.css.mjs +0 -19
  77. package/dist/component/TLine/index.js +0 -2
  78. package/dist/component/TLine/index.mjs +0 -35
  79. package/dist/component/TMark/TMark.module.css.js +0 -1
  80. package/dist/component/TMark/TMark.module.css.mjs +0 -7
  81. package/dist/component/TMark/index.js +0 -2
  82. package/dist/component/TMark/index.mjs +0 -52
  83. package/dist/component/TModal/TModal.module.css.js +0 -1
  84. package/dist/component/TModal/TModal.module.css.mjs +0 -33
  85. package/dist/component/TModal/index.js +0 -2
  86. package/dist/component/TModal/index.mjs +0 -110
  87. package/dist/component/TNotice/TNotice.module.css.js +0 -1
  88. package/dist/component/TNotice/TNotice.module.css.mjs +0 -27
  89. package/dist/component/TNotice/index.js +0 -4
  90. package/dist/component/TNotice/index.mjs +0 -40
  91. package/dist/component/TNotice/useNotice.js +0 -2
  92. package/dist/component/TNotice/useNotice.mjs +0 -19
  93. package/dist/component/TSearch/TSearch.module.css.js +0 -1
  94. package/dist/component/TSearch/TSearch.module.css.mjs +0 -21
  95. package/dist/component/TSearch/index.js +0 -2
  96. package/dist/component/TSearch/index.mjs +0 -73
  97. package/dist/component/TSpace/TSpace.module.css.js +0 -1
  98. package/dist/component/TSpace/TSpace.module.css.mjs +0 -23
  99. package/dist/component/TSpace/index.js +0 -2
  100. package/dist/component/TSpace/index.mjs +0 -49
  101. package/dist/component/TTable/TTable.module.css.js +0 -1
  102. package/dist/component/TTable/TTable.module.css.mjs +0 -25
  103. package/dist/component/TTable/index.js +0 -8
  104. package/dist/component/TTable/index.mjs +0 -154
  105. package/dist/component/TTooltip/TTooltip.module.css.js +0 -1
  106. package/dist/component/TTooltip/TTooltip.module.css.mjs +0 -17
  107. package/dist/component/TTooltip/index.js +0 -2
  108. package/dist/component/TTooltip/index.mjs +0 -34
  109. package/dist/component/TUpload/TUpload.module.css.js +0 -1
  110. package/dist/component/TUpload/TUpload.module.css.mjs +0 -15
  111. package/dist/component/TUpload/index.js +0 -2
  112. package/dist/component/TUpload/index.mjs +0 -152
  113. package/dist/index.mjs +0 -50
  114. package/dist/providers/NoticeProvider.js +0 -2
  115. package/dist/providers/NoticeProvider.mjs +0 -117
  116. package/dist/providers/ThemeProvider.js +0 -2
  117. package/dist/providers/ThemeProvider.mjs +0 -21
  118. package/dist/tango-ui-cw.css +0 -1
@@ -1,25 +0,0 @@
1
- const e = "_wrapper_1g73i_1", t = "_table_1g73i_33", _ = "_thead_1g73i_51", a = "_tableHeader_1g73i_83", l = "_headerContent_1g73i_147", n = "_tableRow_1g73i_159", o = "_tableCell_1g73i_187", c = "_cellContent_1g73i_255", s = "_empty_1g73i_267", p = "_emptyState_1g73i_279", r = {
2
- wrapper: e,
3
- table: t,
4
- thead: _,
5
- tableHeader: a,
6
- headerContent: l,
7
- tableRow: n,
8
- tableCell: o,
9
- cellContent: c,
10
- empty: s,
11
- emptyState: p
12
- };
13
- export {
14
- c as cellContent,
15
- r as default,
16
- s as empty,
17
- p as emptyState,
18
- l as headerContent,
19
- t as table,
20
- o as tableCell,
21
- a as tableHeader,
22
- n as tableRow,
23
- _ as thead,
24
- e as wrapper
25
- };
@@ -1,8 +0,0 @@
1
- "use client";
2
- "use strict";const a=require("react/jsx-runtime");require("react");const t=require("prop-types"),i=require("./TTable.module.css.js");function g({dataSource:m=[],columns:x,className:b="",tableWapperStyles:j={},tableWrapperClassName:N="",containerStyles:$={},containerClassName:C="",theadStyles:v={},theadClassName:R="",trStyles:q={},trClassName:T="",rowClassName:c=()=>"",rowStyle:f=()=>({}),cellClassName:h=()=>"",cellStyle:y=()=>({}),hoverColor:o="",hide:u=[]}){const k=Array.isArray(u)?u:typeof u=="string"?[u]:[],p=x.filter(e=>!e.hide&&!k.includes(e.dataIndex)),O=(e,s,n)=>typeof f=="function"?f(e,s,n):f||{},A=(e,s,n,r,d,l)=>typeof y=="function"?y(e,s,n,r,d,l):y||{},P=(e,s,n)=>typeof c=="function"?c(e,s,n):c||"",S=(e,s,n,r,d,l)=>typeof h=="function"?h(e,s,n,r,d,l):h||"";return a.jsxs("div",{className:`${i.default.wrapper} ${b} ${N}`,style:{overflow:"hidden",borderRadius:"12px",boxShadow:"0 0 20px rgba(0, 0, 0, 0.08)",...j},children:[o&&a.jsx("style",{children:`
3
- .${i.default.table} tbody tr:hover {
4
- background-color: ${o} !important;
5
- transform: translateY(-1px);
6
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
7
- }
8
- `}),a.jsxs("table",{className:`${i.default.table} ${C}`,style:$,children:[a.jsx("thead",{className:`${i.default.thead} ${R}`,style:v,children:a.jsx("tr",{className:T,style:q,children:p.map(e=>a.jsx("th",{style:e.width?{width:e.width}:{},className:i.default.tableHeader,children:a.jsx("div",{className:i.default.headerContent,children:e.title})},e.key||e.dataIndex))})}),a.jsx("tbody",{children:m.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:p.length,className:i.default.empty,children:a.jsx("div",{className:i.default.emptyState,children:a.jsx("div",{children:"暂无数据"})})})}):m.map((e,s)=>{const n=s%2===0?"even":"odd";return a.jsx("tr",{className:`${i.default.tableRow} ${P(e,s,n)}`,style:O(e,s,n),children:p.map((r,d)=>{const l=d%2===0?"even":"odd";return a.jsx("td",{className:`${i.default.tableCell} ${S(e,r,s,d,n,l)}`,style:{...r.width?{width:r.width}:{},...A(e,r,s,d,n,l)},children:a.jsx("div",{className:i.default.cellContent,children:r.render?r.render(e[r.dataIndex],e,s):e[r.dataIndex]})},r.key||r.dataIndex||d)})},e.key||s)})})]})]})}g.propTypes={dataSource:t.array.isRequired,columns:t.arrayOf(t.shape({title:t.string.isRequired,dataIndex:t.string.isRequired,key:t.oneOfType([t.string,t.number]),render:t.func})).isRequired,className:t.string,tableWrapperClassName:t.string,containerClassName:t.string,theadClassName:t.string,trClassName:t.string,rowClassName:t.func,rowStyle:t.func,cellClassName:t.func,cellStyle:t.func,hoverColor:t.string,hide:t.oneOfType([t.arrayOf(t.string),t.string])};module.exports=g;
@@ -1,154 +0,0 @@
1
- "use client";
2
- import { jsxs as g, jsx as n } from "react/jsx-runtime";
3
- import "react";
4
- import t from "prop-types";
5
- import i from "./TTable.module.css.mjs";
6
- function H({
7
- dataSource: f = [],
8
- columns: b,
9
- className: N = "",
10
- tableWapperStyles: $ = {},
11
- tableWrapperClassName: C = "",
12
- containerStyles: v = {},
13
- containerClassName: R = "",
14
- theadStyles: x = {},
15
- theadClassName: k = "",
16
- trStyles: T = {},
17
- trClassName: q = "",
18
- rowClassName: p = () => "",
19
- rowStyle: h = () => ({}),
20
- // 默认值改为函数
21
- cellClassName: m = () => "",
22
- cellStyle: y = () => ({}),
23
- // 默认值改为函数
24
- hoverColor: o = "",
25
- // 自定义 hover
26
- hide: c = []
27
- // 新增,支持字符串数组或不传
28
- }) {
29
- const O = Array.isArray(c) ? c : typeof c == "string" ? [c] : [], u = b.filter(
30
- (e) => !e.hide && !O.includes(e.dataIndex)
31
- ), A = (e, r, s) => typeof h == "function" ? h(e, r, s) : h || {}, P = (e, r, s, a, d, l) => typeof y == "function" ? y(e, r, s, a, d, l) : y || {}, S = (e, r, s) => typeof p == "function" ? p(e, r, s) : p || "", j = (e, r, s, a, d, l) => typeof m == "function" ? m(e, r, s, a, d, l) : m || "";
32
- return /* @__PURE__ */ g(
33
- "div",
34
- {
35
- className: `${i.wrapper} ${N} ${C}`,
36
- style: {
37
- overflow: "hidden",
38
- borderRadius: "12px",
39
- boxShadow: "0 0 20px rgba(0, 0, 0, 0.08)",
40
- ...$
41
- },
42
- children: [
43
- o && /* @__PURE__ */ n("style", { children: `
44
- .${i.table} tbody tr:hover {
45
- background-color: ${o} !important;
46
- transform: translateY(-1px);
47
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
48
- }
49
- ` }),
50
- /* @__PURE__ */ g(
51
- "table",
52
- {
53
- className: `${i.table} ${R}`,
54
- style: v,
55
- children: [
56
- /* @__PURE__ */ n(
57
- "thead",
58
- {
59
- className: `${i.thead} ${k}`,
60
- style: x,
61
- children: /* @__PURE__ */ n("tr", { className: q, style: T, children: u.map((e) => /* @__PURE__ */ n(
62
- "th",
63
- {
64
- style: e.width ? { width: e.width } : {},
65
- className: i.tableHeader,
66
- children: /* @__PURE__ */ n("div", { className: i.headerContent, children: e.title })
67
- },
68
- e.key || e.dataIndex
69
- )) })
70
- }
71
- ),
72
- /* @__PURE__ */ n("tbody", { children: f.length === 0 ? /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n("td", { colSpan: u.length, className: i.empty, children: /* @__PURE__ */ n("div", { className: i.emptyState, children: /* @__PURE__ */ n("div", { children: "暂无数据" }) }) }) }) : f.map((e, r) => {
73
- const s = r % 2 === 0 ? "even" : "odd";
74
- return /* @__PURE__ */ n(
75
- "tr",
76
- {
77
- className: `${i.tableRow} ${S(
78
- e,
79
- r,
80
- s
81
- )}`,
82
- style: A(e, r, s),
83
- children: u.map((a, d) => {
84
- const l = d % 2 === 0 ? "even" : "odd";
85
- return /* @__PURE__ */ n(
86
- "td",
87
- {
88
- className: `${i.tableCell} ${j(
89
- e,
90
- a,
91
- r,
92
- d,
93
- s,
94
- l
95
- )}`,
96
- style: {
97
- ...a.width ? { width: a.width } : {},
98
- ...P(
99
- e,
100
- a,
101
- r,
102
- d,
103
- s,
104
- l
105
- )
106
- },
107
- children: /* @__PURE__ */ n("div", { className: i.cellContent, children: a.render ? a.render(e[a.dataIndex], e, r) : e[a.dataIndex] })
108
- },
109
- a.key || a.dataIndex || d
110
- );
111
- })
112
- },
113
- e.key || r
114
- );
115
- }) })
116
- ]
117
- }
118
- )
119
- ]
120
- }
121
- );
122
- }
123
- H.propTypes = {
124
- dataSource: t.array.isRequired,
125
- columns: t.arrayOf(
126
- t.shape({
127
- title: t.string.isRequired,
128
- dataIndex: t.string.isRequired,
129
- key: t.oneOfType([t.string, t.number]),
130
- render: t.func
131
- })
132
- ).isRequired,
133
- className: t.string,
134
- tableWrapperClassName: t.string,
135
- containerClassName: t.string,
136
- theadClassName: t.string,
137
- trClassName: t.string,
138
- rowClassName: t.func,
139
- // (row, rowIndex, rowParity) => string
140
- rowStyle: t.func,
141
- // (row, rowIndex, rowParity) => styleObj
142
- cellClassName: t.func,
143
- // (row, col, rowIndex, colIndex, rowParity, colParity) => string
144
- cellStyle: t.func,
145
- // (row, col, rowIndex, colIndex, rowParity, colParity) => styleObj
146
- hoverColor: t.string,
147
- hide: t.oneOfType([
148
- t.arrayOf(t.string),
149
- t.string
150
- ])
151
- };
152
- export {
153
- H as default
154
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t="_tooltipWrapper_19a07_1",o="_tooltip_19a07_1",p="_tooltipTop_19a07_53",i="_tooltipBottom_19a07_81",l="_tooltipRight_19a07_109",e="_tooltipLeft_19a07_137",_={tooltipWrapper:t,tooltip:o,tooltipTop:p,tooltipBottom:i,tooltipRight:l,tooltipLeft:e};exports.default=_;exports.tooltip=o;exports.tooltipBottom=i;exports.tooltipLeft=e;exports.tooltipRight=l;exports.tooltipTop=p;exports.tooltipWrapper=t;
@@ -1,17 +0,0 @@
1
- const t = "_tooltipWrapper_19a07_1", o = "_tooltip_19a07_1", p = "_tooltipTop_19a07_53", i = "_tooltipBottom_19a07_81", l = "_tooltipRight_19a07_109", _ = "_tooltipLeft_19a07_137", a = {
2
- tooltipWrapper: t,
3
- tooltip: o,
4
- tooltipTop: p,
5
- tooltipBottom: i,
6
- tooltipRight: l,
7
- tooltipLeft: _
8
- };
9
- export {
10
- a as default,
11
- o as tooltip,
12
- i as tooltipBottom,
13
- _ as tooltipLeft,
14
- l as tooltipRight,
15
- p as tooltipTop,
16
- t as tooltipWrapper
17
- };
@@ -1,2 +0,0 @@
1
- "use client";
2
- "use strict";const r=require("react/jsx-runtime"),a=require("react"),e=require("prop-types"),t=require("./TTooltip.module.css.js");function i({children:l,tooltipText:n,placement:o="top",tooltipClassName:p=""}){const[u,s]=a.useState(!1);return r.jsxs("div",{className:`${t.default.tooltipWrapper} ${t.default[`tooltip${o[0].toUpperCase()+o.slice(1)}`]}`,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:[l,u&&r.jsx("div",{className:`${t.default.tooltip} ${p}`,children:n})]})}i.propTypes={children:e.node.isRequired,tooltipText:e.string.isRequired,placement:e.oneOf(["top","bottom","right","left"]),tooltipClassName:e.string};module.exports=i;
@@ -1,34 +0,0 @@
1
- "use client";
2
- import { jsxs as a, jsx as n } from "react/jsx-runtime";
3
- import { useState as m } from "react";
4
- import e from "prop-types";
5
- import o from "./TTooltip.module.css.mjs";
6
- function d({
7
- children: s,
8
- tooltipText: i,
9
- placement: t = "top",
10
- tooltipClassName: p = ""
11
- }) {
12
- const [l, r] = m(!1);
13
- return /* @__PURE__ */ a(
14
- "div",
15
- {
16
- className: `${o.tooltipWrapper} ${o[`tooltip${t[0].toUpperCase() + t.slice(1)}`]}`,
17
- onMouseEnter: () => r(!0),
18
- onMouseLeave: () => r(!1),
19
- children: [
20
- s,
21
- l && /* @__PURE__ */ n("div", { className: `${o.tooltip} ${p}`, children: i })
22
- ]
23
- }
24
- );
25
- }
26
- d.propTypes = {
27
- children: e.node.isRequired,
28
- tooltipText: e.string.isRequired,
29
- placement: e.oneOf(["top", "bottom", "right", "left"]),
30
- tooltipClassName: e.string
31
- };
32
- export {
33
- d as default
34
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o="_hiddenInput_vhvc7_49",t="_fileListPhoto_vhvc7_103",e="_fileItemPhoto_vhvc7_127",i="_fileIconPhoto_vhvc7_139",n="_noBorder_vhvc7_151",h={hiddenInput:o,fileListPhoto:t,fileItemPhoto:e,fileIconPhoto:i,noBorder:n};exports.default=h;exports.fileIconPhoto=i;exports.fileItemPhoto=e;exports.fileListPhoto=t;exports.hiddenInput=o;exports.noBorder=n;
@@ -1,15 +0,0 @@
1
- const o = "_hiddenInput_vhvc7_49", t = "_fileListPhoto_vhvc7_103", e = "_fileItemPhoto_vhvc7_127", n = "_fileIconPhoto_vhvc7_139", h = "_noBorder_vhvc7_151", i = {
2
- hiddenInput: o,
3
- fileListPhoto: t,
4
- fileItemPhoto: e,
5
- fileIconPhoto: n,
6
- noBorder: h
7
- };
8
- export {
9
- i as default,
10
- n as fileIconPhoto,
11
- e as fileItemPhoto,
12
- t as fileListPhoto,
13
- o as hiddenInput,
14
- h as noBorder
15
- };
@@ -1,2 +0,0 @@
1
- "use client";
2
- "use strict";const s=require("react/jsx-runtime"),R=require("react"),e=require("prop-types"),t=require("./TUpload.module.css.js"),k=require("../CSSFab/useTangoStyle.js"),F=require("../../assets/Upload/fileslogo.png.js"),S=require("../../assets/Upload/delLogo.png.js"),K=require("../TButton/index.js");function m(w){const{sx:u={},style:I={},className:N="",accept:C="image/*",multiple:f=!1,onChange:p=()=>{},beforeUpload:h=()=>{},files:x=[],showUploadList:z=!0,maxCount:B=20,maxSize:y=100,btnText:P="选择文件",btnStyle:T={},showSize:g=!0,...O}=w,b=R.useId(),o=x||[],q=typeof u=="object"?u:{},U=k.useTangoStyle(q),L=[typeof u=="string"?u:"",N].filter(Boolean).join(" "),_={...U,...I};async function v(l,i){if(h)try{const n=await h(l,i);return n===void 0?!0:n}catch{return!1}return!0}const $=async l=>{const n=Array.from(l.target.files||[]).filter(a=>a.size/1024/1024>y?(console.warn(`${a.name} 超过 ${y}MB,已被过滤`),!1):!0);let d=f?n.slice(0,B):n.slice(0,1);const c=[];for(const a of d){const r=await v(a,d);if(r!==!1&&r!==m.LIST_IGNORE)if(r instanceof Blob){const M=r instanceof File?r:new File([r],a.name,{type:a.type});c.push(M)}else c.push(a)}p(c)};function j(l,i){const n=x.filter((d,c)=>c!==i);p(n)}return s.jsxs("div",{style:{padding:20},children:[s.jsx("input",{id:b,type:"file",accept:C,multiple:f,className:t.default.hiddenInput,onChange:$}),s.jsx(K,{style:T,children:s.jsx("label",{htmlFor:b,children:P})}),z&&s.jsx("ul",{className:[t.default.fileListPhoto,L,o.length===0?t.default.noBorder:""].filter(Boolean).join(" "),style:_,children:o.length>0&&(f?o.map((l,i)=>s.jsxs("li",{className:t.default.fileItemPhoto,children:[s.jsx("img",{src:F,alt:"file icon",className:t.default.fileIconPhoto}),s.jsxs("span",{children:[l.name,g?` (${(l.size/1024).toFixed(2)} KB)`:null]}),s.jsx("img",{src:S,alt:"file icon2",className:t.default.fileIconPhoto,onClick:()=>j(l,i)})]},i)):s.jsxs("li",{className:t.default.fileItemPhoto,children:[s.jsx("img",{src:F,alt:"file icon",className:t.default.fileIconPhoto}),o.length>0&&s.jsxs("span",{children:[o[0].name,g?` (${(o[0].size/1024).toFixed(2)} KB)`:null]}),s.jsx("img",{src:S,alt:"file icon2",className:t.default.fileIconPhoto,onClick:()=>j(o[0],0)})]}))})]})}m.propTypes={sx:e.oneOfType([e.object,e.string]),style:e.object,className:e.string,accept:e.string,multiple:e.bool,onChange:e.func,beforeUpload:e.func,files:e.array,showUploadList:e.bool,maxCount:e.number,maxSize:e.number,btnText:e.string,btnStyle:e.object,showSize:e.bool};module.exports=m;
@@ -1,152 +0,0 @@
1
- "use client";
2
- import { jsxs as m, jsx as s } from "react/jsx-runtime";
3
- import { useId as K } from "react";
4
- import e from "prop-types";
5
- import t from "./TUpload.module.css.mjs";
6
- import { useTangoStyle as O } from "../CSSFab/useTangoStyle.mjs";
7
- import w from "../../assets/Upload/fileslogo.png.mjs";
8
- import F from "../../assets/Upload/delLogo.png.mjs";
9
- import A from "../TButton/index.mjs";
10
- function I(N) {
11
- const {
12
- sx: f = {},
13
- style: C = {},
14
- className: B = "",
15
- accept: z = "image/*",
16
- multiple: u = !1,
17
- onChange: d = () => {
18
- },
19
- beforeUpload: h = () => {
20
- },
21
- files: y = [],
22
- showUploadList: P = !0,
23
- maxCount: j = 20,
24
- maxSize: g = 100,
25
- // MB
26
- btnText: T = "选择文件",
27
- // 按钮文字
28
- btnStyle: U = {},
29
- // 按钮样式
30
- showSize: b = !0,
31
- // 是否显示文件大小
32
- ...E
33
- } = N, x = K(), n = y || [], v = O(typeof f == "object" ? f : {}), L = [typeof f == "string" ? f : "", B].filter(Boolean).join(" "), _ = { ...v, ...C };
34
- async function $(o, i) {
35
- if (h)
36
- try {
37
- const l = await h(o, i);
38
- return l === void 0 ? !0 : l;
39
- } catch {
40
- return !1;
41
- }
42
- return !0;
43
- }
44
- const M = async (o) => {
45
- const l = Array.from(o.target.files || []).filter((r) => r.size / 1024 / 1024 > g ? (console.warn(`${r.name} 超过 ${g}MB,已被过滤`), !1) : !0);
46
- let p = u ? l.slice(0, j) : l.slice(0, 1);
47
- const c = [];
48
- for (const r of p) {
49
- const a = await $(r, p);
50
- if (a !== !1 && a !== I.LIST_IGNORE)
51
- if (a instanceof Blob) {
52
- const k = a instanceof File ? a : new File([a], r.name, { type: r.type });
53
- c.push(k);
54
- } else
55
- c.push(r);
56
- }
57
- d(c);
58
- };
59
- function S(o, i) {
60
- const l = y.filter((p, c) => c !== i);
61
- d(l);
62
- }
63
- return /* @__PURE__ */ m("div", { style: { padding: 20 }, children: [
64
- /* @__PURE__ */ s(
65
- "input",
66
- {
67
- id: x,
68
- type: "file",
69
- accept: z,
70
- multiple: u,
71
- className: t.hiddenInput,
72
- onChange: M
73
- }
74
- ),
75
- /* @__PURE__ */ s(A, { style: U, children: /* @__PURE__ */ s("label", { htmlFor: x, children: T }) }),
76
- P && /* @__PURE__ */ s(
77
- "ul",
78
- {
79
- className: [
80
- t.fileListPhoto,
81
- L,
82
- n.length === 0 ? t.noBorder : ""
83
- ].filter(Boolean).join(" "),
84
- style: _,
85
- children: n.length > 0 && (u ? n.map((o, i) => /* @__PURE__ */ m("li", { className: t.fileItemPhoto, children: [
86
- /* @__PURE__ */ s(
87
- "img",
88
- {
89
- src: w,
90
- alt: "file icon",
91
- className: t.fileIconPhoto
92
- }
93
- ),
94
- /* @__PURE__ */ m("span", { children: [
95
- o.name,
96
- b ? ` (${(o.size / 1024).toFixed(2)} KB)` : null
97
- ] }),
98
- /* @__PURE__ */ s(
99
- "img",
100
- {
101
- src: F,
102
- alt: "file icon2",
103
- className: t.fileIconPhoto,
104
- onClick: () => S(o, i)
105
- }
106
- )
107
- ] }, i)) : /* @__PURE__ */ m("li", { className: t.fileItemPhoto, children: [
108
- /* @__PURE__ */ s(
109
- "img",
110
- {
111
- src: w,
112
- alt: "file icon",
113
- className: t.fileIconPhoto
114
- }
115
- ),
116
- n.length > 0 && /* @__PURE__ */ m("span", { children: [
117
- n[0].name,
118
- b ? ` (${(n[0].size / 1024).toFixed(2)} KB)` : null
119
- ] }),
120
- /* @__PURE__ */ s(
121
- "img",
122
- {
123
- src: F,
124
- alt: "file icon2",
125
- className: t.fileIconPhoto,
126
- onClick: () => S(n[0], 0)
127
- }
128
- )
129
- ] }))
130
- }
131
- )
132
- ] });
133
- }
134
- I.propTypes = {
135
- sx: e.oneOfType([e.object, e.string]),
136
- style: e.object,
137
- className: e.string,
138
- accept: e.string,
139
- multiple: e.bool,
140
- onChange: e.func,
141
- beforeUpload: e.func,
142
- files: e.array,
143
- showUploadList: e.bool,
144
- maxCount: e.number,
145
- maxSize: e.number,
146
- btnText: e.string,
147
- btnStyle: e.object,
148
- showSize: e.bool
149
- };
150
- export {
151
- I as default
152
- };
package/dist/index.mjs DELETED
@@ -1,50 +0,0 @@
1
- "use client";
2
- /* empty css */
3
- /* empty css */
4
- import { ThemeProvider as a, useTheme as f } from "./providers/ThemeProvider.mjs";
5
- import { default as l } from "./component/TButton/index.mjs";
6
- import { default as u } from "./component/MaterialButton/index.mjs";
7
- import { default as x } from "./component/MaterialInput/index.mjs";
8
- import { default as i } from "./component/TColorPicker/index.mjs";
9
- import { default as n } from "./component/TDate/index.mjs";
10
- import { default as P } from "./component/TDatePicker/index.mjs";
11
- import { default as h } from "./component/TDrawer/index.mjs";
12
- import { default as B } from "./component/TInput/index.mjs";
13
- import { default as N } from "./component/TLayout/index.mjs";
14
- import { default as I } from "./component/TLine/index.mjs";
15
- import { default as S } from "./component/TMark/index.mjs";
16
- import { default as w } from "./component/TModal/index.mjs";
17
- import { default as C } from "./component/TNotice/index.mjs";
18
- import { useNotice as g } from "./component/TNotice/useNotice.mjs";
19
- import { NoticeProvider as q } from "./providers/NoticeProvider.mjs";
20
- import { default as A } from "./component/TSearch/index.mjs";
21
- import { default as F } from "./component/TSpace/index.mjs";
22
- import { default as H } from "./component/TTable/index.mjs";
23
- import { default as K } from "./component/TTooltip/index.mjs";
24
- import { default as Q } from "./component/TUpload/index.mjs";
25
- import { default as V } from "./component/TBanner/index.mjs";
26
- export {
27
- V as Banner,
28
- l as Button,
29
- i as ColorPicker,
30
- n as Date,
31
- P as DatePicker,
32
- h as Drawer,
33
- B as Input,
34
- N as Layout,
35
- I as Line,
36
- S as Mark,
37
- u as MaterialButton,
38
- x as MaterialInput,
39
- w as Modal,
40
- C as Notice,
41
- q as NoticeProvider,
42
- A as Search,
43
- F as Space,
44
- H as Table,
45
- a as ThemeProvider,
46
- K as Tooltip,
47
- Q as Upload,
48
- g as useNotice,
49
- f as useTheme
50
- };
@@ -1,2 +0,0 @@
1
- "use client";
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),g=require("react-dom"),M=require("../component/TNotice/index.js"),a=i.createContext(null);function N({children:o}){const[r,n]=i.useState([]),[d,l]=i.useState(!1);i.useEffect(()=>{l(!0)},[]);const u=e.jsx("svg",{t:"1772605923154",className:"TangoIcon",viewBox:"0 0 1024 1024",version:"1.1","p-id":"5323",width:"1.2em",height:"1.2em",children:e.jsx("path",{d:"M874.119618 149.859922A510.816461 510.816461 0 0 0 511.997 0.00208a509.910462 509.910462 0 0 0-362.119618 149.857842c-199.817789 199.679789-199.817789 524.581447 0 724.260236a509.969462 509.969462 0 0 0 362.119618 149.857842A508.872463 508.872463 0 0 0 874.119618 874.120158c199.836789-199.679789 199.836789-524.581447 0-724.260236zM814.94268 378.210681L470.999043 744.132295a15.359984 15.359984 0 0 1-5.887994 4.095996c-1.751998 1.180999-2.913997 2.362998-5.276994 2.913997a34.499964 34.499964 0 0 1-13.469986 2.914997 45.547952 45.547952 0 0 1-12.897986-2.303998l-4.095996-2.363997a45.291952 45.291952 0 0 1-7.009992-4.095996l-196.902793-193.789796a34.126964 34.126964 0 0 1-10.555989-25.186973c0-9.37399 3.583996-18.74698 9.98399-25.186974a36.429962 36.429962 0 0 1 50.372947 0l169.98382 167.423824L763.389735 330.220732a37.059961 37.059961 0 0 1 50.371947-1.732998 33.647965 33.647965 0 0 1 11.165988 25.186973 35.544963 35.544963 0 0 1-9.98399 24.575974v-0.04z m0 0",fill:"#52C41A","p-id":"5324"})}),x=e.jsx("svg",{t:"1772605974217",className:"TangoIcon",viewBox:"0 0 1024 1024",version:"1.1","p-id":"6333",width:"1.2em",height:"1.2em",children:e.jsx("path",{d:"M549.044706 512l166.189176-166.249412a26.383059 26.383059 0 0 0 0-36.98447 26.383059 26.383059 0 0 0-37.044706 0L512 475.015529l-166.249412-166.249411a26.383059 26.383059 0 0 0-36.98447 0 26.383059 26.383059 0 0 0 0 37.044706L475.015529 512l-166.249411 166.249412a26.383059 26.383059 0 0 0 0 36.98447 26.383059 26.383059 0 0 0 37.044706 0L512 548.984471l166.249412 166.249411a26.383059 26.383059 0 0 0 36.98447 0 26.383059 26.383059 0 0 0 0-37.044706L548.984471 512zM512 1024a512 512 0 1 1 0-1024 512 512 0 0 1 0 1024z",fill:"#E84335","p-id":"6334"})}),h=e.jsxs("svg",{t:"1772606035823",className:"TangoIcon",viewBox:"0 0 1024 1024",version:"1.1","p-id":"10722",width:"1.2em",height:"1.2em",children:[e.jsx("path",{d:"M512 909.061224c-218.906122 0-397.061224-178.155102-397.061224-397.061224s178.155102-397.061224 397.061224-397.061224 397.061224 178.155102 397.061224 397.061224-178.155102 397.061224-397.061224 397.061224z",fill:"#F2CB51","p-id":"10723"}),e.jsx("path",{d:"M512 690.677551m-31.346939 0a31.346939 31.346939 0 1 0 62.693878 0 31.346939 31.346939 0 1 0-62.693878 0Z",fill:"#E5404F","p-id":"10724"}),e.jsx("path",{d:"M512 584.097959c-11.493878 0-20.897959-9.404082-20.897959-20.897959v-261.22449c0-11.493878 9.404082-20.897959 20.897959-20.897959s20.897959 9.404082 20.897959 20.897959v261.22449c0 12.016327-9.404082 20.897959-20.897959 20.897959z",fill:"#E5404F","p-id":"10725"})]}),m=i.useCallback(t=>{n(c=>c.filter(s=>s.id!==t))},[]),v=i.useCallback((t,c,s="default")=>{const f={success:u,fail:x,caution:h},p=Date.now()+Math.random();n(j=>[...j,{id:p,type:t,message:c,variant:s,icon:f[t]}])},[]);return e.jsxs(a.Provider,{value:{add:v},children:[o,d&&g.createPortal(e.jsx("div",{id:"notification-container",children:r.map(t=>e.jsx(M,{...t,onClose:()=>m(t.id)},t.id))}),document.body)]})}function C(){const o=i.useContext(a);if(!o)throw new Error("useNotice must be used inside <NoticeProvider />");return o}exports.NoticeProvider=N;exports.useNoticeContext=C;
@@ -1,117 +0,0 @@
1
- "use client";
2
- import { jsxs as a, jsx as e } from "react/jsx-runtime";
3
- import { createContext as w, useState as s, useEffect as C, useCallback as d, useContext as z } from "react";
4
- import { createPortal as I } from "react-dom";
5
- import L from "../component/TNotice/index.mjs";
6
- const r = w(null);
7
- function A({ children: o }) {
8
- const [l, n] = s([]), [m, u] = s(!1);
9
- C(() => {
10
- u(!0);
11
- }, []);
12
- const h = /* @__PURE__ */ e(
13
- "svg",
14
- {
15
- t: "1772605923154",
16
- className: "TangoIcon",
17
- viewBox: "0 0 1024 1024",
18
- version: "1.1",
19
- "p-id": "5323",
20
- width: "1.2em",
21
- height: "1.2em",
22
- children: /* @__PURE__ */ e(
23
- "path",
24
- {
25
- d: "M874.119618 149.859922A510.816461 510.816461 0 0 0 511.997 0.00208a509.910462 509.910462 0 0 0-362.119618 149.857842c-199.817789 199.679789-199.817789 524.581447 0 724.260236a509.969462 509.969462 0 0 0 362.119618 149.857842A508.872463 508.872463 0 0 0 874.119618 874.120158c199.836789-199.679789 199.836789-524.581447 0-724.260236zM814.94268 378.210681L470.999043 744.132295a15.359984 15.359984 0 0 1-5.887994 4.095996c-1.751998 1.180999-2.913997 2.362998-5.276994 2.913997a34.499964 34.499964 0 0 1-13.469986 2.914997 45.547952 45.547952 0 0 1-12.897986-2.303998l-4.095996-2.363997a45.291952 45.291952 0 0 1-7.009992-4.095996l-196.902793-193.789796a34.126964 34.126964 0 0 1-10.555989-25.186973c0-9.37399 3.583996-18.74698 9.98399-25.186974a36.429962 36.429962 0 0 1 50.372947 0l169.98382 167.423824L763.389735 330.220732a37.059961 37.059961 0 0 1 50.371947-1.732998 33.647965 33.647965 0 0 1 11.165988 25.186973 35.544963 35.544963 0 0 1-9.98399 24.575974v-0.04z m0 0",
26
- fill: "#52C41A",
27
- "p-id": "5324"
28
- }
29
- )
30
- }
31
- ), f = /* @__PURE__ */ e(
32
- "svg",
33
- {
34
- t: "1772605974217",
35
- className: "TangoIcon",
36
- viewBox: "0 0 1024 1024",
37
- version: "1.1",
38
- "p-id": "6333",
39
- width: "1.2em",
40
- height: "1.2em",
41
- children: /* @__PURE__ */ e(
42
- "path",
43
- {
44
- d: "M549.044706 512l166.189176-166.249412a26.383059 26.383059 0 0 0 0-36.98447 26.383059 26.383059 0 0 0-37.044706 0L512 475.015529l-166.249412-166.249411a26.383059 26.383059 0 0 0-36.98447 0 26.383059 26.383059 0 0 0 0 37.044706L475.015529 512l-166.249411 166.249412a26.383059 26.383059 0 0 0 0 36.98447 26.383059 26.383059 0 0 0 37.044706 0L512 548.984471l166.249412 166.249411a26.383059 26.383059 0 0 0 36.98447 0 26.383059 26.383059 0 0 0 0-37.044706L548.984471 512zM512 1024a512 512 0 1 1 0-1024 512 512 0 0 1 0 1024z",
45
- fill: "#E84335",
46
- "p-id": "6334"
47
- }
48
- )
49
- }
50
- ), p = /* @__PURE__ */ a(
51
- "svg",
52
- {
53
- t: "1772606035823",
54
- className: "TangoIcon",
55
- viewBox: "0 0 1024 1024",
56
- version: "1.1",
57
- "p-id": "10722",
58
- width: "1.2em",
59
- height: "1.2em",
60
- children: [
61
- /* @__PURE__ */ e(
62
- "path",
63
- {
64
- d: "M512 909.061224c-218.906122 0-397.061224-178.155102-397.061224-397.061224s178.155102-397.061224 397.061224-397.061224 397.061224 178.155102 397.061224 397.061224-178.155102 397.061224-397.061224 397.061224z",
65
- fill: "#F2CB51",
66
- "p-id": "10723"
67
- }
68
- ),
69
- /* @__PURE__ */ e(
70
- "path",
71
- {
72
- d: "M512 690.677551m-31.346939 0a31.346939 31.346939 0 1 0 62.693878 0 31.346939 31.346939 0 1 0-62.693878 0Z",
73
- fill: "#E5404F",
74
- "p-id": "10724"
75
- }
76
- ),
77
- /* @__PURE__ */ e(
78
- "path",
79
- {
80
- d: "M512 584.097959c-11.493878 0-20.897959-9.404082-20.897959-20.897959v-261.22449c0-11.493878 9.404082-20.897959 20.897959-20.897959s20.897959 9.404082 20.897959 20.897959v261.22449c0 12.016327-9.404082 20.897959-20.897959 20.897959z",
81
- fill: "#E5404F",
82
- "p-id": "10725"
83
- }
84
- )
85
- ]
86
- }
87
- ), v = d((t) => {
88
- n((i) => i.filter((c) => c.id !== t));
89
- }, []), x = d((t, i, c = "default") => {
90
- const M = {
91
- success: h,
92
- fail: f,
93
- caution: p
94
- }, N = Date.now() + Math.random();
95
- n((g) => [
96
- ...g,
97
- { id: N, type: t, message: i, variant: c, icon: M[t] }
98
- ]);
99
- }, []);
100
- return /* @__PURE__ */ a(r.Provider, { value: { add: x }, children: [
101
- o,
102
- m && I(
103
- /* @__PURE__ */ e("div", { id: "notification-container", children: l.map((t) => /* @__PURE__ */ e(L, { ...t, onClose: () => v(t.id) }, t.id)) }),
104
- document.body
105
- )
106
- ] });
107
- }
108
- function F() {
109
- const o = z(r);
110
- if (!o)
111
- throw new Error("useNotice must be used inside <NoticeProvider />");
112
- return o;
113
- }
114
- export {
115
- A as NoticeProvider,
116
- F as useNoticeContext
117
- };
@@ -1,2 +0,0 @@
1
- "use client";
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),e=require("react"),r=e.createContext(null);function m({children:o}){const[t,n]=e.useState("light");e.useEffect(()=>{document.documentElement.dataset.theme=t},[t]);const u=()=>{n(s=>s==="dark"?"light":"dark")};return c.jsx(r.Provider,{value:{theme:t,setTheme:n,toggleTheme:u},children:o})}function i(){return e.useContext(r)}exports.ThemeProvider=m;exports.useTheme=i;
@@ -1,21 +0,0 @@
1
- "use client";
2
- import { jsx as u } from "react/jsx-runtime";
3
- import { createContext as s, useState as c, useEffect as h, useContext as i } from "react";
4
- const o = s(null);
5
- function l({ children: n }) {
6
- const [e, t] = c("light");
7
- h(() => {
8
- document.documentElement.dataset.theme = e;
9
- }, [e]);
10
- const r = () => {
11
- t((m) => m === "dark" ? "light" : "dark");
12
- };
13
- return /* @__PURE__ */ u(o.Provider, { value: { theme: e, setTheme: t, toggleTheme: r }, children: n });
14
- }
15
- function f() {
16
- return i(o);
17
- }
18
- export {
19
- l as ThemeProvider,
20
- f as useTheme
21
- };