@oscloudlab/knowledge-card 0.0.1
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/README.md +77 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +685 -0
- package/dist/index.umd.js +30 -0
- package/dist/style.css +1 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# React Knowledge Card
|
|
2
|
+
|
|
3
|
+
一个美观且可定制的React知识卡片组件���支持TypeScript。
|
|
4
|
+
|
|
5
|
+
## 特性
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## 安装
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install react-knowledge-card
|
|
12
|
+
# 或
|
|
13
|
+
yarn add react-knowledge-card
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## 使用方法
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import React from 'react'
|
|
20
|
+
import { KnowledgeCard } from 'react-knowledge-card'
|
|
21
|
+
|
|
22
|
+
function App() {
|
|
23
|
+
return (
|
|
24
|
+
<KnowledgeCard
|
|
25
|
+
title="React Hooks 入门"
|
|
26
|
+
content="React Hooks 是 React 16.8 引入的新特性..."
|
|
27
|
+
tags={['React', 'Hooks', '前端']}
|
|
28
|
+
type="primary"
|
|
29
|
+
author="张三"
|
|
30
|
+
createTime="2024-01-15"
|
|
31
|
+
readTime="5分钟"
|
|
32
|
+
clickable
|
|
33
|
+
onClick={() => console.log('卡片被点击')}
|
|
34
|
+
/>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## API
|
|
40
|
+
|
|
41
|
+
### KnowledgeCardProps
|
|
42
|
+
|
|
43
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
44
|
+
|------|------|--------|------|
|
|
45
|
+
| title | string | - | 卡片标题 |
|
|
46
|
+
| content | string | - | 卡片内容 |
|
|
47
|
+
| tags | string[] | [] | 标签列表 |
|
|
48
|
+
| type | 'default' \| 'primary' \| 'success' \| 'warning' \| 'danger' | 'default' | 卡片类型 |
|
|
49
|
+
| shadow | boolean | true | 是否显示阴影 |
|
|
50
|
+
| clickable | boolean | false | 是否可点击 |
|
|
51
|
+
| onClick | () => void | - | 点击事件 |
|
|
52
|
+
| className | string | - | 自定义类名 |
|
|
53
|
+
| style | React.CSSProperties | - | 自定义样式 |
|
|
54
|
+
| icon | React.ReactNode | - | 图标 |
|
|
55
|
+
| author | string | - | 作者信息 |
|
|
56
|
+
| createTime | string | - | 创建时间 |
|
|
57
|
+
| readTime | string | - | 阅读时长 |
|
|
58
|
+
|
|
59
|
+
## 开发
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# 安装依赖
|
|
63
|
+
npm install
|
|
64
|
+
|
|
65
|
+
# 启动开发服务器
|
|
66
|
+
npm run dev
|
|
67
|
+
|
|
68
|
+
# 构建组件库
|
|
69
|
+
npm run build:lib
|
|
70
|
+
|
|
71
|
+
# 发布到npm
|
|
72
|
+
npm run publish:npm
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## 许可证
|
|
76
|
+
|
|
77
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,685 @@
|
|
|
1
|
+
import ke from "react";
|
|
2
|
+
var ee = { exports: {} }, $ = {};
|
|
3
|
+
/**
|
|
4
|
+
* @license React
|
|
5
|
+
* react-jsx-runtime.production.min.js
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
var xe;
|
|
13
|
+
function cr() {
|
|
14
|
+
if (xe) return $;
|
|
15
|
+
xe = 1;
|
|
16
|
+
var A = ke, j = Symbol.for("react.element"), k = Symbol.for("react.fragment"), y = Object.prototype.hasOwnProperty, C = A.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, T = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
17
|
+
function R(E, c, b) {
|
|
18
|
+
var f, g = {}, m = null, S = null;
|
|
19
|
+
b !== void 0 && (m = "" + b), c.key !== void 0 && (m = "" + c.key), c.ref !== void 0 && (S = c.ref);
|
|
20
|
+
for (f in c) y.call(c, f) && !T.hasOwnProperty(f) && (g[f] = c[f]);
|
|
21
|
+
if (E && E.defaultProps) for (f in c = E.defaultProps, c) g[f] === void 0 && (g[f] = c[f]);
|
|
22
|
+
return { $$typeof: j, type: E, key: m, ref: S, props: g, _owner: C.current };
|
|
23
|
+
}
|
|
24
|
+
return $.Fragment = k, $.jsx = R, $.jsxs = R, $;
|
|
25
|
+
}
|
|
26
|
+
var W = {};
|
|
27
|
+
/**
|
|
28
|
+
* @license React
|
|
29
|
+
* react-jsx-runtime.development.js
|
|
30
|
+
*
|
|
31
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
32
|
+
*
|
|
33
|
+
* This source code is licensed under the MIT license found in the
|
|
34
|
+
* LICENSE file in the root directory of this source tree.
|
|
35
|
+
*/
|
|
36
|
+
var Oe;
|
|
37
|
+
function fr() {
|
|
38
|
+
return Oe || (Oe = 1, process.env.NODE_ENV !== "production" && function() {
|
|
39
|
+
var A = ke, j = Symbol.for("react.element"), k = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), C = Symbol.for("react.strict_mode"), T = Symbol.for("react.profiler"), R = Symbol.for("react.provider"), E = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), b = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), m = Symbol.for("react.lazy"), S = Symbol.for("react.offscreen"), Y = Symbol.iterator, B = "@@iterator";
|
|
40
|
+
function J(e) {
|
|
41
|
+
if (e === null || typeof e != "object")
|
|
42
|
+
return null;
|
|
43
|
+
var r = Y && e[Y] || e[B];
|
|
44
|
+
return typeof r == "function" ? r : null;
|
|
45
|
+
}
|
|
46
|
+
var P = A.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
47
|
+
function v(e) {
|
|
48
|
+
{
|
|
49
|
+
for (var r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), t = 1; t < r; t++)
|
|
50
|
+
n[t - 1] = arguments[t];
|
|
51
|
+
Ce("error", e, n);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function Ce(e, r, n) {
|
|
55
|
+
{
|
|
56
|
+
var t = P.ReactDebugCurrentFrame, i = t.getStackAddendum();
|
|
57
|
+
i !== "" && (r += "%s", n = n.concat([i]));
|
|
58
|
+
var s = n.map(function(o) {
|
|
59
|
+
return String(o);
|
|
60
|
+
});
|
|
61
|
+
s.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, s);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
var Se = !1, Pe = !1, De = !1, Fe = !1, Ae = !1, re;
|
|
65
|
+
re = Symbol.for("react.module.reference");
|
|
66
|
+
function Ne(e) {
|
|
67
|
+
return !!(typeof e == "string" || typeof e == "function" || e === y || e === T || Ae || e === C || e === b || e === f || Fe || e === S || Se || Pe || De || typeof e == "object" && e !== null && (e.$$typeof === m || e.$$typeof === g || e.$$typeof === R || e.$$typeof === E || e.$$typeof === c || // This needs to include all possible module reference object
|
|
68
|
+
// types supported by any Flight configuration anywhere since
|
|
69
|
+
// we don't know which Flight build this will end up being used
|
|
70
|
+
// with.
|
|
71
|
+
e.$$typeof === re || e.getModuleId !== void 0));
|
|
72
|
+
}
|
|
73
|
+
function Ie(e, r, n) {
|
|
74
|
+
var t = e.displayName;
|
|
75
|
+
if (t)
|
|
76
|
+
return t;
|
|
77
|
+
var i = r.displayName || r.name || "";
|
|
78
|
+
return i !== "" ? n + "(" + i + ")" : n;
|
|
79
|
+
}
|
|
80
|
+
function ne(e) {
|
|
81
|
+
return e.displayName || "Context";
|
|
82
|
+
}
|
|
83
|
+
function w(e) {
|
|
84
|
+
if (e == null)
|
|
85
|
+
return null;
|
|
86
|
+
if (typeof e.tag == "number" && v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
87
|
+
return e.displayName || e.name || null;
|
|
88
|
+
if (typeof e == "string")
|
|
89
|
+
return e;
|
|
90
|
+
switch (e) {
|
|
91
|
+
case y:
|
|
92
|
+
return "Fragment";
|
|
93
|
+
case k:
|
|
94
|
+
return "Portal";
|
|
95
|
+
case T:
|
|
96
|
+
return "Profiler";
|
|
97
|
+
case C:
|
|
98
|
+
return "StrictMode";
|
|
99
|
+
case b:
|
|
100
|
+
return "Suspense";
|
|
101
|
+
case f:
|
|
102
|
+
return "SuspenseList";
|
|
103
|
+
}
|
|
104
|
+
if (typeof e == "object")
|
|
105
|
+
switch (e.$$typeof) {
|
|
106
|
+
case E:
|
|
107
|
+
var r = e;
|
|
108
|
+
return ne(r) + ".Consumer";
|
|
109
|
+
case R:
|
|
110
|
+
var n = e;
|
|
111
|
+
return ne(n._context) + ".Provider";
|
|
112
|
+
case c:
|
|
113
|
+
return Ie(e, e.render, "ForwardRef");
|
|
114
|
+
case g:
|
|
115
|
+
var t = e.displayName || null;
|
|
116
|
+
return t !== null ? t : w(e.type) || "Memo";
|
|
117
|
+
case m: {
|
|
118
|
+
var i = e, s = i._payload, o = i._init;
|
|
119
|
+
try {
|
|
120
|
+
return w(o(s));
|
|
121
|
+
} catch {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
var x = Object.assign, N = 0, te, ae, oe, ie, se, ue, le;
|
|
129
|
+
function ce() {
|
|
130
|
+
}
|
|
131
|
+
ce.__reactDisabledLog = !0;
|
|
132
|
+
function $e() {
|
|
133
|
+
{
|
|
134
|
+
if (N === 0) {
|
|
135
|
+
te = console.log, ae = console.info, oe = console.warn, ie = console.error, se = console.group, ue = console.groupCollapsed, le = console.groupEnd;
|
|
136
|
+
var e = {
|
|
137
|
+
configurable: !0,
|
|
138
|
+
enumerable: !0,
|
|
139
|
+
value: ce,
|
|
140
|
+
writable: !0
|
|
141
|
+
};
|
|
142
|
+
Object.defineProperties(console, {
|
|
143
|
+
info: e,
|
|
144
|
+
log: e,
|
|
145
|
+
warn: e,
|
|
146
|
+
error: e,
|
|
147
|
+
group: e,
|
|
148
|
+
groupCollapsed: e,
|
|
149
|
+
groupEnd: e
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
N++;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function We() {
|
|
156
|
+
{
|
|
157
|
+
if (N--, N === 0) {
|
|
158
|
+
var e = {
|
|
159
|
+
configurable: !0,
|
|
160
|
+
enumerable: !0,
|
|
161
|
+
writable: !0
|
|
162
|
+
};
|
|
163
|
+
Object.defineProperties(console, {
|
|
164
|
+
log: x({}, e, {
|
|
165
|
+
value: te
|
|
166
|
+
}),
|
|
167
|
+
info: x({}, e, {
|
|
168
|
+
value: ae
|
|
169
|
+
}),
|
|
170
|
+
warn: x({}, e, {
|
|
171
|
+
value: oe
|
|
172
|
+
}),
|
|
173
|
+
error: x({}, e, {
|
|
174
|
+
value: ie
|
|
175
|
+
}),
|
|
176
|
+
group: x({}, e, {
|
|
177
|
+
value: se
|
|
178
|
+
}),
|
|
179
|
+
groupCollapsed: x({}, e, {
|
|
180
|
+
value: ue
|
|
181
|
+
}),
|
|
182
|
+
groupEnd: x({}, e, {
|
|
183
|
+
value: le
|
|
184
|
+
})
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
N < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
var K = P.ReactCurrentDispatcher, q;
|
|
191
|
+
function L(e, r, n) {
|
|
192
|
+
{
|
|
193
|
+
if (q === void 0)
|
|
194
|
+
try {
|
|
195
|
+
throw Error();
|
|
196
|
+
} catch (i) {
|
|
197
|
+
var t = i.stack.trim().match(/\n( *(at )?)/);
|
|
198
|
+
q = t && t[1] || "";
|
|
199
|
+
}
|
|
200
|
+
return `
|
|
201
|
+
` + q + e;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
var G = !1, V;
|
|
205
|
+
{
|
|
206
|
+
var Ye = typeof WeakMap == "function" ? WeakMap : Map;
|
|
207
|
+
V = new Ye();
|
|
208
|
+
}
|
|
209
|
+
function fe(e, r) {
|
|
210
|
+
if (!e || G)
|
|
211
|
+
return "";
|
|
212
|
+
{
|
|
213
|
+
var n = V.get(e);
|
|
214
|
+
if (n !== void 0)
|
|
215
|
+
return n;
|
|
216
|
+
}
|
|
217
|
+
var t;
|
|
218
|
+
G = !0;
|
|
219
|
+
var i = Error.prepareStackTrace;
|
|
220
|
+
Error.prepareStackTrace = void 0;
|
|
221
|
+
var s;
|
|
222
|
+
s = K.current, K.current = null, $e();
|
|
223
|
+
try {
|
|
224
|
+
if (r) {
|
|
225
|
+
var o = function() {
|
|
226
|
+
throw Error();
|
|
227
|
+
};
|
|
228
|
+
if (Object.defineProperty(o.prototype, "props", {
|
|
229
|
+
set: function() {
|
|
230
|
+
throw Error();
|
|
231
|
+
}
|
|
232
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
|
233
|
+
try {
|
|
234
|
+
Reflect.construct(o, []);
|
|
235
|
+
} catch (_) {
|
|
236
|
+
t = _;
|
|
237
|
+
}
|
|
238
|
+
Reflect.construct(e, [], o);
|
|
239
|
+
} else {
|
|
240
|
+
try {
|
|
241
|
+
o.call();
|
|
242
|
+
} catch (_) {
|
|
243
|
+
t = _;
|
|
244
|
+
}
|
|
245
|
+
e.call(o.prototype);
|
|
246
|
+
}
|
|
247
|
+
} else {
|
|
248
|
+
try {
|
|
249
|
+
throw Error();
|
|
250
|
+
} catch (_) {
|
|
251
|
+
t = _;
|
|
252
|
+
}
|
|
253
|
+
e();
|
|
254
|
+
}
|
|
255
|
+
} catch (_) {
|
|
256
|
+
if (_ && t && typeof _.stack == "string") {
|
|
257
|
+
for (var a = _.stack.split(`
|
|
258
|
+
`), p = t.stack.split(`
|
|
259
|
+
`), u = a.length - 1, l = p.length - 1; u >= 1 && l >= 0 && a[u] !== p[l]; )
|
|
260
|
+
l--;
|
|
261
|
+
for (; u >= 1 && l >= 0; u--, l--)
|
|
262
|
+
if (a[u] !== p[l]) {
|
|
263
|
+
if (u !== 1 || l !== 1)
|
|
264
|
+
do
|
|
265
|
+
if (u--, l--, l < 0 || a[u] !== p[l]) {
|
|
266
|
+
var h = `
|
|
267
|
+
` + a[u].replace(" at new ", " at ");
|
|
268
|
+
return e.displayName && h.includes("<anonymous>") && (h = h.replace("<anonymous>", e.displayName)), typeof e == "function" && V.set(e, h), h;
|
|
269
|
+
}
|
|
270
|
+
while (u >= 1 && l >= 0);
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
} finally {
|
|
275
|
+
G = !1, K.current = s, We(), Error.prepareStackTrace = i;
|
|
276
|
+
}
|
|
277
|
+
var F = e ? e.displayName || e.name : "", O = F ? L(F) : "";
|
|
278
|
+
return typeof e == "function" && V.set(e, O), O;
|
|
279
|
+
}
|
|
280
|
+
function Le(e, r, n) {
|
|
281
|
+
return fe(e, !1);
|
|
282
|
+
}
|
|
283
|
+
function Ve(e) {
|
|
284
|
+
var r = e.prototype;
|
|
285
|
+
return !!(r && r.isReactComponent);
|
|
286
|
+
}
|
|
287
|
+
function M(e, r, n) {
|
|
288
|
+
if (e == null)
|
|
289
|
+
return "";
|
|
290
|
+
if (typeof e == "function")
|
|
291
|
+
return fe(e, Ve(e));
|
|
292
|
+
if (typeof e == "string")
|
|
293
|
+
return L(e);
|
|
294
|
+
switch (e) {
|
|
295
|
+
case b:
|
|
296
|
+
return L("Suspense");
|
|
297
|
+
case f:
|
|
298
|
+
return L("SuspenseList");
|
|
299
|
+
}
|
|
300
|
+
if (typeof e == "object")
|
|
301
|
+
switch (e.$$typeof) {
|
|
302
|
+
case c:
|
|
303
|
+
return Le(e.render);
|
|
304
|
+
case g:
|
|
305
|
+
return M(e.type, r, n);
|
|
306
|
+
case m: {
|
|
307
|
+
var t = e, i = t._payload, s = t._init;
|
|
308
|
+
try {
|
|
309
|
+
return M(s(i), r, n);
|
|
310
|
+
} catch {
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return "";
|
|
315
|
+
}
|
|
316
|
+
var I = Object.prototype.hasOwnProperty, de = {}, ve = P.ReactDebugCurrentFrame;
|
|
317
|
+
function U(e) {
|
|
318
|
+
if (e) {
|
|
319
|
+
var r = e._owner, n = M(e.type, e._source, r ? r.type : null);
|
|
320
|
+
ve.setExtraStackFrame(n);
|
|
321
|
+
} else
|
|
322
|
+
ve.setExtraStackFrame(null);
|
|
323
|
+
}
|
|
324
|
+
function Me(e, r, n, t, i) {
|
|
325
|
+
{
|
|
326
|
+
var s = Function.call.bind(I);
|
|
327
|
+
for (var o in e)
|
|
328
|
+
if (s(e, o)) {
|
|
329
|
+
var a = void 0;
|
|
330
|
+
try {
|
|
331
|
+
if (typeof e[o] != "function") {
|
|
332
|
+
var p = Error((t || "React class") + ": " + n + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
333
|
+
throw p.name = "Invariant Violation", p;
|
|
334
|
+
}
|
|
335
|
+
a = e[o](r, o, t, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
336
|
+
} catch (u) {
|
|
337
|
+
a = u;
|
|
338
|
+
}
|
|
339
|
+
a && !(a instanceof Error) && (U(i), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", t || "React class", n, o, typeof a), U(null)), a instanceof Error && !(a.message in de) && (de[a.message] = !0, U(i), v("Failed %s type: %s", n, a.message), U(null));
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
var Ue = Array.isArray;
|
|
344
|
+
function z(e) {
|
|
345
|
+
return Ue(e);
|
|
346
|
+
}
|
|
347
|
+
function Be(e) {
|
|
348
|
+
{
|
|
349
|
+
var r = typeof Symbol == "function" && Symbol.toStringTag, n = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
350
|
+
return n;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function Je(e) {
|
|
354
|
+
try {
|
|
355
|
+
return pe(e), !1;
|
|
356
|
+
} catch {
|
|
357
|
+
return !0;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
function pe(e) {
|
|
361
|
+
return "" + e;
|
|
362
|
+
}
|
|
363
|
+
function _e(e) {
|
|
364
|
+
if (Je(e))
|
|
365
|
+
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Be(e)), pe(e);
|
|
366
|
+
}
|
|
367
|
+
var ge = P.ReactCurrentOwner, Ke = {
|
|
368
|
+
key: !0,
|
|
369
|
+
ref: !0,
|
|
370
|
+
__self: !0,
|
|
371
|
+
__source: !0
|
|
372
|
+
}, he, me;
|
|
373
|
+
function qe(e) {
|
|
374
|
+
if (I.call(e, "ref")) {
|
|
375
|
+
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
376
|
+
if (r && r.isReactWarning)
|
|
377
|
+
return !1;
|
|
378
|
+
}
|
|
379
|
+
return e.ref !== void 0;
|
|
380
|
+
}
|
|
381
|
+
function Ge(e) {
|
|
382
|
+
if (I.call(e, "key")) {
|
|
383
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
384
|
+
if (r && r.isReactWarning)
|
|
385
|
+
return !1;
|
|
386
|
+
}
|
|
387
|
+
return e.key !== void 0;
|
|
388
|
+
}
|
|
389
|
+
function ze(e, r) {
|
|
390
|
+
typeof e.ref == "string" && ge.current;
|
|
391
|
+
}
|
|
392
|
+
function Xe(e, r) {
|
|
393
|
+
{
|
|
394
|
+
var n = function() {
|
|
395
|
+
he || (he = !0, v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
396
|
+
};
|
|
397
|
+
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
398
|
+
get: n,
|
|
399
|
+
configurable: !0
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
function He(e, r) {
|
|
404
|
+
{
|
|
405
|
+
var n = function() {
|
|
406
|
+
me || (me = !0, v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
407
|
+
};
|
|
408
|
+
n.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
409
|
+
get: n,
|
|
410
|
+
configurable: !0
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
var Ze = function(e, r, n, t, i, s, o) {
|
|
415
|
+
var a = {
|
|
416
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
417
|
+
$$typeof: j,
|
|
418
|
+
// Built-in properties that belong on the element
|
|
419
|
+
type: e,
|
|
420
|
+
key: r,
|
|
421
|
+
ref: n,
|
|
422
|
+
props: o,
|
|
423
|
+
// Record the component responsible for creating this element.
|
|
424
|
+
_owner: s
|
|
425
|
+
};
|
|
426
|
+
return a._store = {}, Object.defineProperty(a._store, "validated", {
|
|
427
|
+
configurable: !1,
|
|
428
|
+
enumerable: !1,
|
|
429
|
+
writable: !0,
|
|
430
|
+
value: !1
|
|
431
|
+
}), Object.defineProperty(a, "_self", {
|
|
432
|
+
configurable: !1,
|
|
433
|
+
enumerable: !1,
|
|
434
|
+
writable: !1,
|
|
435
|
+
value: t
|
|
436
|
+
}), Object.defineProperty(a, "_source", {
|
|
437
|
+
configurable: !1,
|
|
438
|
+
enumerable: !1,
|
|
439
|
+
writable: !1,
|
|
440
|
+
value: i
|
|
441
|
+
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
|
|
442
|
+
};
|
|
443
|
+
function Qe(e, r, n, t, i) {
|
|
444
|
+
{
|
|
445
|
+
var s, o = {}, a = null, p = null;
|
|
446
|
+
n !== void 0 && (_e(n), a = "" + n), Ge(r) && (_e(r.key), a = "" + r.key), qe(r) && (p = r.ref, ze(r, i));
|
|
447
|
+
for (s in r)
|
|
448
|
+
I.call(r, s) && !Ke.hasOwnProperty(s) && (o[s] = r[s]);
|
|
449
|
+
if (e && e.defaultProps) {
|
|
450
|
+
var u = e.defaultProps;
|
|
451
|
+
for (s in u)
|
|
452
|
+
o[s] === void 0 && (o[s] = u[s]);
|
|
453
|
+
}
|
|
454
|
+
if (a || p) {
|
|
455
|
+
var l = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
456
|
+
a && Xe(o, l), p && He(o, l);
|
|
457
|
+
}
|
|
458
|
+
return Ze(e, a, p, i, t, ge.current, o);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
var X = P.ReactCurrentOwner, Ee = P.ReactDebugCurrentFrame;
|
|
462
|
+
function D(e) {
|
|
463
|
+
if (e) {
|
|
464
|
+
var r = e._owner, n = M(e.type, e._source, r ? r.type : null);
|
|
465
|
+
Ee.setExtraStackFrame(n);
|
|
466
|
+
} else
|
|
467
|
+
Ee.setExtraStackFrame(null);
|
|
468
|
+
}
|
|
469
|
+
var H;
|
|
470
|
+
H = !1;
|
|
471
|
+
function Z(e) {
|
|
472
|
+
return typeof e == "object" && e !== null && e.$$typeof === j;
|
|
473
|
+
}
|
|
474
|
+
function be() {
|
|
475
|
+
{
|
|
476
|
+
if (X.current) {
|
|
477
|
+
var e = w(X.current.type);
|
|
478
|
+
if (e)
|
|
479
|
+
return `
|
|
480
|
+
|
|
481
|
+
Check the render method of \`` + e + "`.";
|
|
482
|
+
}
|
|
483
|
+
return "";
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
function er(e) {
|
|
487
|
+
return "";
|
|
488
|
+
}
|
|
489
|
+
var ye = {};
|
|
490
|
+
function rr(e) {
|
|
491
|
+
{
|
|
492
|
+
var r = be();
|
|
493
|
+
if (!r) {
|
|
494
|
+
var n = typeof e == "string" ? e : e.displayName || e.name;
|
|
495
|
+
n && (r = `
|
|
496
|
+
|
|
497
|
+
Check the top-level render call using <` + n + ">.");
|
|
498
|
+
}
|
|
499
|
+
return r;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
function Re(e, r) {
|
|
503
|
+
{
|
|
504
|
+
if (!e._store || e._store.validated || e.key != null)
|
|
505
|
+
return;
|
|
506
|
+
e._store.validated = !0;
|
|
507
|
+
var n = rr(r);
|
|
508
|
+
if (ye[n])
|
|
509
|
+
return;
|
|
510
|
+
ye[n] = !0;
|
|
511
|
+
var t = "";
|
|
512
|
+
e && e._owner && e._owner !== X.current && (t = " It was passed a child from " + w(e._owner.type) + "."), D(e), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, t), D(null);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
function we(e, r) {
|
|
516
|
+
{
|
|
517
|
+
if (typeof e != "object")
|
|
518
|
+
return;
|
|
519
|
+
if (z(e))
|
|
520
|
+
for (var n = 0; n < e.length; n++) {
|
|
521
|
+
var t = e[n];
|
|
522
|
+
Z(t) && Re(t, r);
|
|
523
|
+
}
|
|
524
|
+
else if (Z(e))
|
|
525
|
+
e._store && (e._store.validated = !0);
|
|
526
|
+
else if (e) {
|
|
527
|
+
var i = J(e);
|
|
528
|
+
if (typeof i == "function" && i !== e.entries)
|
|
529
|
+
for (var s = i.call(e), o; !(o = s.next()).done; )
|
|
530
|
+
Z(o.value) && Re(o.value, r);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
function nr(e) {
|
|
535
|
+
{
|
|
536
|
+
var r = e.type;
|
|
537
|
+
if (r == null || typeof r == "string")
|
|
538
|
+
return;
|
|
539
|
+
var n;
|
|
540
|
+
if (typeof r == "function")
|
|
541
|
+
n = r.propTypes;
|
|
542
|
+
else if (typeof r == "object" && (r.$$typeof === c || // Note: Memo only checks outer props here.
|
|
543
|
+
// Inner props are checked in the reconciler.
|
|
544
|
+
r.$$typeof === g))
|
|
545
|
+
n = r.propTypes;
|
|
546
|
+
else
|
|
547
|
+
return;
|
|
548
|
+
if (n) {
|
|
549
|
+
var t = w(r);
|
|
550
|
+
Me(n, e.props, "prop", t, e);
|
|
551
|
+
} else if (r.PropTypes !== void 0 && !H) {
|
|
552
|
+
H = !0;
|
|
553
|
+
var i = w(r);
|
|
554
|
+
v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", i || "Unknown");
|
|
555
|
+
}
|
|
556
|
+
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
function tr(e) {
|
|
560
|
+
{
|
|
561
|
+
for (var r = Object.keys(e.props), n = 0; n < r.length; n++) {
|
|
562
|
+
var t = r[n];
|
|
563
|
+
if (t !== "children" && t !== "key") {
|
|
564
|
+
D(e), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", t), D(null);
|
|
565
|
+
break;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
e.ref !== null && (D(e), v("Invalid attribute `ref` supplied to `React.Fragment`."), D(null));
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
var je = {};
|
|
572
|
+
function Te(e, r, n, t, i, s) {
|
|
573
|
+
{
|
|
574
|
+
var o = Ne(e);
|
|
575
|
+
if (!o) {
|
|
576
|
+
var a = "";
|
|
577
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
578
|
+
var p = er();
|
|
579
|
+
p ? a += p : a += be();
|
|
580
|
+
var u;
|
|
581
|
+
e === null ? u = "null" : z(e) ? u = "array" : e !== void 0 && e.$$typeof === j ? (u = "<" + (w(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : u = typeof e, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", u, a);
|
|
582
|
+
}
|
|
583
|
+
var l = Qe(e, r, n, i, s);
|
|
584
|
+
if (l == null)
|
|
585
|
+
return l;
|
|
586
|
+
if (o) {
|
|
587
|
+
var h = r.children;
|
|
588
|
+
if (h !== void 0)
|
|
589
|
+
if (t)
|
|
590
|
+
if (z(h)) {
|
|
591
|
+
for (var F = 0; F < h.length; F++)
|
|
592
|
+
we(h[F], e);
|
|
593
|
+
Object.freeze && Object.freeze(h);
|
|
594
|
+
} else
|
|
595
|
+
v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
596
|
+
else
|
|
597
|
+
we(h, e);
|
|
598
|
+
}
|
|
599
|
+
if (I.call(r, "key")) {
|
|
600
|
+
var O = w(e), _ = Object.keys(r).filter(function(lr) {
|
|
601
|
+
return lr !== "key";
|
|
602
|
+
}), Q = _.length > 0 ? "{key: someKey, " + _.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
603
|
+
if (!je[O + Q]) {
|
|
604
|
+
var ur = _.length > 0 ? "{" + _.join(": ..., ") + ": ...}" : "{}";
|
|
605
|
+
v(`A props object containing a "key" prop is being spread into JSX:
|
|
606
|
+
let props = %s;
|
|
607
|
+
<%s {...props} />
|
|
608
|
+
React keys must be passed directly to JSX without using spread:
|
|
609
|
+
let props = %s;
|
|
610
|
+
<%s key={someKey} {...props} />`, Q, O, ur, O), je[O + Q] = !0;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return e === y ? tr(l) : nr(l), l;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
function ar(e, r, n) {
|
|
617
|
+
return Te(e, r, n, !0);
|
|
618
|
+
}
|
|
619
|
+
function or(e, r, n) {
|
|
620
|
+
return Te(e, r, n, !1);
|
|
621
|
+
}
|
|
622
|
+
var ir = or, sr = ar;
|
|
623
|
+
W.Fragment = y, W.jsx = ir, W.jsxs = sr;
|
|
624
|
+
}()), W;
|
|
625
|
+
}
|
|
626
|
+
process.env.NODE_ENV === "production" ? ee.exports = cr() : ee.exports = fr();
|
|
627
|
+
var d = ee.exports;
|
|
628
|
+
const vr = ({
|
|
629
|
+
title: A,
|
|
630
|
+
content: j,
|
|
631
|
+
tags: k = [],
|
|
632
|
+
type: y = "default",
|
|
633
|
+
shadow: C = !0,
|
|
634
|
+
clickable: T = !1,
|
|
635
|
+
onClick: R,
|
|
636
|
+
className: E = "",
|
|
637
|
+
style: c,
|
|
638
|
+
icon: b,
|
|
639
|
+
author: f,
|
|
640
|
+
createTime: g,
|
|
641
|
+
readTime: m
|
|
642
|
+
}) => {
|
|
643
|
+
const S = [
|
|
644
|
+
"knowledge-card",
|
|
645
|
+
`knowledge-card--${y}`,
|
|
646
|
+
C ? "knowledge-card--shadow" : "",
|
|
647
|
+
T ? "knowledge-card--clickable" : "",
|
|
648
|
+
E
|
|
649
|
+
].filter(Boolean).join(" "), Y = () => {
|
|
650
|
+
T && R && R();
|
|
651
|
+
};
|
|
652
|
+
return /* @__PURE__ */ d.jsxs(
|
|
653
|
+
"div",
|
|
654
|
+
{
|
|
655
|
+
className: S,
|
|
656
|
+
style: c,
|
|
657
|
+
onClick: Y,
|
|
658
|
+
children: [
|
|
659
|
+
/* @__PURE__ */ d.jsxs("div", { className: "knowledge-card__header", children: [
|
|
660
|
+
b && /* @__PURE__ */ d.jsx("div", { className: "knowledge-card__icon", children: b }),
|
|
661
|
+
/* @__PURE__ */ d.jsx("h3", { className: "knowledge-card__title", children: A })
|
|
662
|
+
] }),
|
|
663
|
+
/* @__PURE__ */ d.jsx("div", { className: "knowledge-card__content", children: /* @__PURE__ */ d.jsx("p", { className: "knowledge-card__text", children: j }) }),
|
|
664
|
+
k.length > 0 && /* @__PURE__ */ d.jsx("div", { className: "knowledge-card__tags", children: k.map((B, J) => /* @__PURE__ */ d.jsx("span", { className: "knowledge-card__tag", children: B }, J)) }),
|
|
665
|
+
(f || g || m) && /* @__PURE__ */ d.jsx("div", { className: "knowledge-card__footer", children: /* @__PURE__ */ d.jsxs("div", { className: "knowledge-card__meta", children: [
|
|
666
|
+
f && /* @__PURE__ */ d.jsxs("span", { className: "knowledge-card__author", children: [
|
|
667
|
+
/* @__PURE__ */ d.jsx("i", { className: "icon-user" }),
|
|
668
|
+
f
|
|
669
|
+
] }),
|
|
670
|
+
g && /* @__PURE__ */ d.jsxs("span", { className: "knowledge-card__time", children: [
|
|
671
|
+
/* @__PURE__ */ d.jsx("i", { className: "icon-clock" }),
|
|
672
|
+
g
|
|
673
|
+
] }),
|
|
674
|
+
m && /* @__PURE__ */ d.jsxs("span", { className: "knowledge-card__read-time", children: [
|
|
675
|
+
/* @__PURE__ */ d.jsx("i", { className: "icon-book" }),
|
|
676
|
+
m
|
|
677
|
+
] })
|
|
678
|
+
] }) })
|
|
679
|
+
]
|
|
680
|
+
}
|
|
681
|
+
);
|
|
682
|
+
};
|
|
683
|
+
export {
|
|
684
|
+
vr as KnowledgeCard
|
|
685
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
(function(j,C){typeof exports=="object"&&typeof module<"u"?C(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],C):(j=typeof globalThis<"u"?globalThis:j||self,C(j.ReactKnowledgeCard={},j.React))})(this,function(j,C){"use strict";var J={exports:{}},I={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var te;function Se(){if(te)return I;te=1;var Y=C,T=Symbol.for("react.element"),S=Symbol.for("react.fragment"),E=Object.prototype.hasOwnProperty,P=Y.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,x={key:!0,ref:!0,__self:!0,__source:!0};function R(y,c,b){var f,_={},m=null,D=null;b!==void 0&&(m=""+b),c.key!==void 0&&(m=""+c.key),c.ref!==void 0&&(D=c.ref);for(f in c)E.call(c,f)&&!x.hasOwnProperty(f)&&(_[f]=c[f]);if(y&&y.defaultProps)for(f in c=y.defaultProps,c)_[f]===void 0&&(_[f]=c[f]);return{$$typeof:T,type:y,key:m,ref:D,props:_,_owner:P.current}}return I.Fragment=S,I.jsx=R,I.jsxs=R,I}var W={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var ae;function Pe(){return ae||(ae=1,process.env.NODE_ENV!=="production"&&function(){var Y=C,T=Symbol.for("react.element"),S=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),R=Symbol.for("react.provider"),y=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),D=Symbol.for("react.offscreen"),M=Symbol.iterator,q="@@iterator";function G(e){if(e===null||typeof e!="object")return null;var r=M&&e[M]||e[q];return typeof r=="function"?r:null}var F=Y.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(e){{for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];Fe("error",e,n)}}function Fe(e,r,n){{var t=F.ReactDebugCurrentFrame,i=t.getStackAddendum();i!==""&&(r+="%s",n=n.concat([i]));var s=n.map(function(o){return String(o)});s.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,s)}}var Ae=!1,Ne=!1,Ie=!1,We=!1,Ye=!1,oe;oe=Symbol.for("react.module.reference");function $e(e){return!!(typeof e=="string"||typeof e=="function"||e===E||e===x||Ye||e===P||e===b||e===f||We||e===D||Ae||Ne||Ie||typeof e=="object"&&e!==null&&(e.$$typeof===m||e.$$typeof===_||e.$$typeof===R||e.$$typeof===y||e.$$typeof===c||e.$$typeof===oe||e.getModuleId!==void 0))}function Le(e,r,n){var t=e.displayName;if(t)return t;var i=r.displayName||r.name||"";return i!==""?n+"("+i+")":n}function ie(e){return e.displayName||"Context"}function w(e){if(e==null)return null;if(typeof e.tag=="number"&&v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case S:return"Portal";case x:return"Profiler";case P:return"StrictMode";case b:return"Suspense";case f:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case y:var r=e;return ie(r)+".Consumer";case R:var n=e;return ie(n._context)+".Provider";case c:return Le(e,e.render,"ForwardRef");case _:var t=e.displayName||null;return t!==null?t:w(e.type)||"Memo";case m:{var i=e,s=i._payload,o=i._init;try{return w(o(s))}catch{return null}}}return null}var O=Object.assign,$=0,se,ue,le,ce,fe,de,ve;function pe(){}pe.__reactDisabledLog=!0;function Me(){{if($===0){se=console.log,ue=console.info,le=console.warn,ce=console.error,fe=console.group,de=console.groupCollapsed,ve=console.groupEnd;var e={configurable:!0,enumerable:!0,value:pe,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}$++}}function Ve(){{if($--,$===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:O({},e,{value:se}),info:O({},e,{value:ue}),warn:O({},e,{value:le}),error:O({},e,{value:ce}),group:O({},e,{value:fe}),groupCollapsed:O({},e,{value:de}),groupEnd:O({},e,{value:ve})})}$<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var z=F.ReactCurrentDispatcher,X;function V(e,r,n){{if(X===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);X=t&&t[1]||""}return`
|
|
18
|
+
`+X+e}}var H=!1,U;{var Ue=typeof WeakMap=="function"?WeakMap:Map;U=new Ue}function ge(e,r){if(!e||H)return"";{var n=U.get(e);if(n!==void 0)return n}var t;H=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var s;s=z.current,z.current=null,Me();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(g){t=g}Reflect.construct(e,[],o)}else{try{o.call()}catch(g){t=g}e.call(o.prototype)}}else{try{throw Error()}catch(g){t=g}e()}}catch(g){if(g&&t&&typeof g.stack=="string"){for(var a=g.stack.split(`
|
|
19
|
+
`),p=t.stack.split(`
|
|
20
|
+
`),u=a.length-1,l=p.length-1;u>=1&&l>=0&&a[u]!==p[l];)l--;for(;u>=1&&l>=0;u--,l--)if(a[u]!==p[l]){if(u!==1||l!==1)do if(u--,l--,l<0||a[u]!==p[l]){var h=`
|
|
21
|
+
`+a[u].replace(" at new "," at ");return e.displayName&&h.includes("<anonymous>")&&(h=h.replace("<anonymous>",e.displayName)),typeof e=="function"&&U.set(e,h),h}while(u>=1&&l>=0);break}}}finally{H=!1,z.current=s,Ve(),Error.prepareStackTrace=i}var N=e?e.displayName||e.name:"",k=N?V(N):"";return typeof e=="function"&&U.set(e,k),k}function Ke(e,r,n){return ge(e,!1)}function Be(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function K(e,r,n){if(e==null)return"";if(typeof e=="function")return ge(e,Be(e));if(typeof e=="string")return V(e);switch(e){case b:return V("Suspense");case f:return V("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case c:return Ke(e.render);case _:return K(e.type,r,n);case m:{var t=e,i=t._payload,s=t._init;try{return K(s(i),r,n)}catch{}}}return""}var L=Object.prototype.hasOwnProperty,_e={},he=F.ReactDebugCurrentFrame;function B(e){if(e){var r=e._owner,n=K(e.type,e._source,r?r.type:null);he.setExtraStackFrame(n)}else he.setExtraStackFrame(null)}function Je(e,r,n,t,i){{var s=Function.call.bind(L);for(var o in e)if(s(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var p=Error((t||"React class")+": "+n+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}a=e[o](r,o,t,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(u){a=u}a&&!(a instanceof Error)&&(B(i),v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",t||"React class",n,o,typeof a),B(null)),a instanceof Error&&!(a.message in _e)&&(_e[a.message]=!0,B(i),v("Failed %s type: %s",n,a.message),B(null))}}}var qe=Array.isArray;function Z(e){return qe(e)}function Ge(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,n=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n}}function ze(e){try{return me(e),!1}catch{return!0}}function me(e){return""+e}function ye(e){if(ze(e))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ge(e)),me(e)}var be=F.ReactCurrentOwner,Xe={key:!0,ref:!0,__self:!0,__source:!0},Ee,Re;function He(e){if(L.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Ze(e){if(L.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Qe(e,r){typeof e.ref=="string"&&be.current}function er(e,r){{var n=function(){Ee||(Ee=!0,v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}}function rr(e,r){{var n=function(){Re||(Re=!0,v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}}var nr=function(e,r,n,t,i,s,o){var a={$$typeof:T,type:e,key:r,ref:n,props:o,_owner:s};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:t}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function tr(e,r,n,t,i){{var s,o={},a=null,p=null;n!==void 0&&(ye(n),a=""+n),Ze(r)&&(ye(r.key),a=""+r.key),He(r)&&(p=r.ref,Qe(r,i));for(s in r)L.call(r,s)&&!Xe.hasOwnProperty(s)&&(o[s]=r[s]);if(e&&e.defaultProps){var u=e.defaultProps;for(s in u)o[s]===void 0&&(o[s]=u[s])}if(a||p){var l=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&er(o,l),p&&rr(o,l)}return nr(e,a,p,i,t,be.current,o)}}var Q=F.ReactCurrentOwner,we=F.ReactDebugCurrentFrame;function A(e){if(e){var r=e._owner,n=K(e.type,e._source,r?r.type:null);we.setExtraStackFrame(n)}else we.setExtraStackFrame(null)}var ee;ee=!1;function re(e){return typeof e=="object"&&e!==null&&e.$$typeof===T}function je(){{if(Q.current){var e=w(Q.current.type);if(e)return`
|
|
22
|
+
|
|
23
|
+
Check the render method of \``+e+"`."}return""}}function ar(e){return""}var Te={};function or(e){{var r=je();if(!r){var n=typeof e=="string"?e:e.displayName||e.name;n&&(r=`
|
|
24
|
+
|
|
25
|
+
Check the top-level render call using <`+n+">.")}return r}}function xe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var n=or(r);if(Te[n])return;Te[n]=!0;var t="";e&&e._owner&&e._owner!==Q.current&&(t=" It was passed a child from "+w(e._owner.type)+"."),A(e),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,t),A(null)}}function Oe(e,r){{if(typeof e!="object")return;if(Z(e))for(var n=0;n<e.length;n++){var t=e[n];re(t)&&xe(t,r)}else if(re(e))e._store&&(e._store.validated=!0);else if(e){var i=G(e);if(typeof i=="function"&&i!==e.entries)for(var s=i.call(e),o;!(o=s.next()).done;)re(o.value)&&xe(o.value,r)}}}function ir(e){{var r=e.type;if(r==null||typeof r=="string")return;var n;if(typeof r=="function")n=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===c||r.$$typeof===_))n=r.propTypes;else return;if(n){var t=w(r);Je(n,e.props,"prop",t,e)}else if(r.PropTypes!==void 0&&!ee){ee=!0;var i=w(r);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function sr(e){{for(var r=Object.keys(e.props),n=0;n<r.length;n++){var t=r[n];if(t!=="children"&&t!=="key"){A(e),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",t),A(null);break}}e.ref!==null&&(A(e),v("Invalid attribute `ref` supplied to `React.Fragment`."),A(null))}}var ke={};function Ce(e,r,n,t,i,s){{var o=$e(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var p=ar();p?a+=p:a+=je();var u;e===null?u="null":Z(e)?u="array":e!==void 0&&e.$$typeof===T?(u="<"+(w(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):u=typeof e,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",u,a)}var l=tr(e,r,n,i,s);if(l==null)return l;if(o){var h=r.children;if(h!==void 0)if(t)if(Z(h)){for(var N=0;N<h.length;N++)Oe(h[N],e);Object.freeze&&Object.freeze(h)}else v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Oe(h,e)}if(L.call(r,"key")){var k=w(e),g=Object.keys(r).filter(function(vr){return vr!=="key"}),ne=g.length>0?"{key: someKey, "+g.join(": ..., ")+": ...}":"{key: someKey}";if(!ke[k+ne]){var dr=g.length>0?"{"+g.join(": ..., ")+": ...}":"{}";v(`A props object containing a "key" prop is being spread into JSX:
|
|
26
|
+
let props = %s;
|
|
27
|
+
<%s {...props} />
|
|
28
|
+
React keys must be passed directly to JSX without using spread:
|
|
29
|
+
let props = %s;
|
|
30
|
+
<%s key={someKey} {...props} />`,ne,k,dr,k),ke[k+ne]=!0}}return e===E?sr(l):ir(l),l}}function ur(e,r,n){return Ce(e,r,n,!0)}function lr(e,r,n){return Ce(e,r,n,!1)}var cr=lr,fr=ur;W.Fragment=E,W.jsx=cr,W.jsxs=fr}()),W}process.env.NODE_ENV==="production"?J.exports=Se():J.exports=Pe();var d=J.exports;const De=({title:Y,content:T,tags:S=[],type:E="default",shadow:P=!0,clickable:x=!1,onClick:R,className:y="",style:c,icon:b,author:f,createTime:_,readTime:m})=>{const D=["knowledge-card",`knowledge-card--${E}`,P?"knowledge-card--shadow":"",x?"knowledge-card--clickable":"",y].filter(Boolean).join(" "),M=()=>{x&&R&&R()};return d.jsxs("div",{className:D,style:c,onClick:M,children:[d.jsxs("div",{className:"knowledge-card__header",children:[b&&d.jsx("div",{className:"knowledge-card__icon",children:b}),d.jsx("h3",{className:"knowledge-card__title",children:Y})]}),d.jsx("div",{className:"knowledge-card__content",children:d.jsx("p",{className:"knowledge-card__text",children:T})}),S.length>0&&d.jsx("div",{className:"knowledge-card__tags",children:S.map((q,G)=>d.jsx("span",{className:"knowledge-card__tag",children:q},G))}),(f||_||m)&&d.jsx("div",{className:"knowledge-card__footer",children:d.jsxs("div",{className:"knowledge-card__meta",children:[f&&d.jsxs("span",{className:"knowledge-card__author",children:[d.jsx("i",{className:"icon-user"}),f]}),_&&d.jsxs("span",{className:"knowledge-card__time",children:[d.jsx("i",{className:"icon-clock"}),_]}),m&&d.jsxs("span",{className:"knowledge-card__read-time",children:[d.jsx("i",{className:"icon-book"}),m]})]})})]})};j.KnowledgeCard=De,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})});
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.knowledge-card{background:#fff;border-radius:12px;padding:20px;margin:16px 0;border:1px solid #e8e8e8;transition:all .3s ease;position:relative;overflow:hidden}.knowledge-card--shadow{box-shadow:0 2px 8px #0000001a}.knowledge-card--clickable{cursor:pointer}.knowledge-card--clickable:hover{transform:translateY(-2px);box-shadow:0 4px 16px #00000026}.knowledge-card--primary{border-left:4px solid #1890ff}.knowledge-card--primary .knowledge-card__title{color:#1890ff}.knowledge-card--success{border-left:4px solid #52c41a}.knowledge-card--success .knowledge-card__title{color:#52c41a}.knowledge-card--warning{border-left:4px solid #faad14}.knowledge-card--warning .knowledge-card__title{color:#faad14}.knowledge-card--danger{border-left:4px solid #ff4d4f}.knowledge-card--danger .knowledge-card__title{color:#ff4d4f}.knowledge-card__header{display:flex;align-items:center;margin-bottom:12px}.knowledge-card__icon{margin-right:8px;font-size:20px;display:flex;align-items:center}.knowledge-card__title{margin:0;font-size:18px;font-weight:600;color:#262626;line-height:1.4}.knowledge-card__content{margin-bottom:16px}.knowledge-card__text{margin:0;color:#595959;line-height:1.6;font-size:14px}.knowledge-card__tags{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:16px}.knowledge-card__tag{display:inline-block;padding:4px 8px;background:#f0f0f0;color:#595959;border-radius:4px;font-size:12px;font-weight:500;transition:all .2s ease}.knowledge-card__tag:hover{background:#e6f7ff;color:#1890ff}.knowledge-card__footer{border-top:1px solid #f0f0f0;padding-top:12px}.knowledge-card__meta{display:flex;align-items:center;gap:16px;font-size:12px;color:#8c8c8c}.knowledge-card__author,.knowledge-card__time,.knowledge-card__read-time{display:flex;align-items:center;gap:4px}.knowledge-card__author i,.knowledge-card__time i,.knowledge-card__read-time i{font-size:12px}@media (max-width: 768px){.knowledge-card{padding:16px;margin:12px 0}.knowledge-card__title{font-size:16px}.knowledge-card__text{font-size:13px}.knowledge-card__meta{flex-direction:column;align-items:flex-start;gap:8px}}@media (prefers-color-scheme: dark){.knowledge-card{background:#1f1f1f;border-color:#303030;color:#fff}.knowledge-card__title{color:#fff}.knowledge-card__text{color:#d9d9d9}.knowledge-card__tag{background:#262626;color:#d9d9d9}.knowledge-card__tag:hover{background:#003a8c;color:#91d5ff}.knowledge-card__footer{border-top-color:#303030}.knowledge-card__meta{color:#8c8c8c}}.icon-user:before{content:"👤"}.icon-clock:before{content:"🕒"}.icon-book:before{content:"📖"}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@oscloudlab/knowledge-card",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "A beautiful and customizable knowledge card component for React",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "vite",
|
|
13
|
+
"build": "tsc && vite build",
|
|
14
|
+
"build:lib": "vite build --mode lib",
|
|
15
|
+
"preview": "vite preview",
|
|
16
|
+
"prepublishOnly": "npm run build:lib",
|
|
17
|
+
"publish:npm": "npm publish"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"react",
|
|
21
|
+
"component",
|
|
22
|
+
"knowledge-card",
|
|
23
|
+
"ui",
|
|
24
|
+
"typescript"
|
|
25
|
+
],
|
|
26
|
+
"author": "huangjianzhong",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/cloudlab-os/KnowledgeCard.git"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"react": ">=16.8.0",
|
|
34
|
+
"react-dom": ">=16.8.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^25.0.6",
|
|
38
|
+
"@types/react": "^18.2.43",
|
|
39
|
+
"@types/react-dom": "^18.2.17",
|
|
40
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
41
|
+
"less": "^4.2.0",
|
|
42
|
+
"typescript": "^5.2.2",
|
|
43
|
+
"vite": "^5.0.8",
|
|
44
|
+
"vite-plugin-dts": "^3.6.4"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"react": ">=16.8.0",
|
|
48
|
+
"react-dom": ">=16.8.0"
|
|
49
|
+
}
|
|
50
|
+
}
|