listpage-next 0.0.162 → 0.0.165

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.
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ export interface LinkCardProps {
3
+ icon?: ReactNode;
4
+ url?: string;
5
+ title: string;
6
+ description?: string;
7
+ }
8
+ export declare const LinkCard: (props: LinkCardProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,137 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useRef } from "react";
3
+ import styled_components from "styled-components";
4
+ import icons, { LinkOutlined } from "@ant-design/icons";
5
+ import { Tooltip } from "antd";
6
+ import { useHover } from "ahooks";
7
+ import { IconDoc } from "../../icons/IconDoc.js";
8
+ const LinkCard = (props)=>{
9
+ const { icon, title, description, url } = props;
10
+ const containerRef = useRef(null);
11
+ const isHovered = useHover(containerRef);
12
+ return /*#__PURE__*/ jsxs(LinkCardContainer, {
13
+ ref: containerRef,
14
+ children: [
15
+ /*#__PURE__*/ jsx(IconContainer, {
16
+ children: icon ?? /*#__PURE__*/ jsx(icons, {
17
+ component: IconDoc
18
+ })
19
+ }),
20
+ /*#__PURE__*/ jsxs(TextContainer, {
21
+ children: [
22
+ /*#__PURE__*/ jsx(Title, {
23
+ children: title
24
+ }),
25
+ /*#__PURE__*/ jsx(Description, {
26
+ children: description ?? ' '
27
+ })
28
+ ]
29
+ }),
30
+ isHovered && /*#__PURE__*/ jsx(ActionContainer, {
31
+ children: /*#__PURE__*/ jsx(Tooltip, {
32
+ title: "跳转",
33
+ placement: "top",
34
+ children: /*#__PURE__*/ jsx(ActionItem, {
35
+ onClick: ()=>url && window.open(url, '_blank'),
36
+ children: /*#__PURE__*/ jsx(LinkOutlined, {})
37
+ })
38
+ })
39
+ })
40
+ ]
41
+ });
42
+ };
43
+ const LinkCardContainer = styled_components.div`
44
+ padding: 14px;
45
+ cursor: pointer;
46
+ border-radius: 12px;
47
+ border: 1px solid #0003;
48
+ background: linear-gradient(109deg, #fff 45.34%, #f3f7ff 102.43%);
49
+ gap: 8px;
50
+ height: 72px;
51
+ box-sizing: border-box;
52
+
53
+ display: flex;
54
+
55
+ &:hover {
56
+ box-shadow:
57
+ 0px 0px 4px 0px rgba(0, 0, 0, 0.02),
58
+ 0px 6px 10px 0px rgba(47, 53, 64, 0.1);
59
+ }
60
+ & * {
61
+ transition: all 0.2s ease-in-out;
62
+ }
63
+ `;
64
+ const IconContainer = styled_components.div`
65
+ font-size: 18px;
66
+ color: rgb(0, 87, 255);
67
+
68
+ padding: 0 9px;
69
+
70
+ flex-shrink: 0;
71
+ flex-grow: 0;
72
+
73
+ display: flex;
74
+ align-items: center;
75
+ justify-content: center;
76
+ `;
77
+ const TextContainer = styled_components.div`
78
+ display: flex;
79
+ flex-direction: column;
80
+ gap: 2px;
81
+ flex-grow: 1;
82
+ flex-shrink: 1;
83
+ `;
84
+ const Title = styled_components.div`
85
+ display: -webkit-box;
86
+ -webkit-box-orient: vertical;
87
+ -webkit-line-clamp: 1;
88
+ color: rgba(0, 0, 0, 0.8);
89
+ opacity: 1;
90
+ overflow: hidden;
91
+ text-overflow: ellipsis;
92
+ word-break: break-all;
93
+
94
+ font-weight: 500;
95
+ font-size: 14px;
96
+ line-height: 22px;
97
+ `;
98
+ const Description = styled_components.div`
99
+ display: -webkit-box;
100
+ -webkit-box-orient: vertical;
101
+ -webkit-line-clamp: 1;
102
+ color: rgba(0, 0, 0, 0.3);
103
+ opacity: 1;
104
+ overflow: hidden;
105
+ text-overflow: ellipsis;
106
+
107
+ font-weight: 400;
108
+ font-size: 12px;
109
+ line-height: 18px;
110
+ `;
111
+ const ActionContainer = styled_components.div`
112
+ flex-shrink: 0;
113
+
114
+ display: flex;
115
+ align-items: center;
116
+ `;
117
+ const ActionItem = styled_components.div`
118
+ border-radius: 8px;
119
+ padding: 8px 8px;
120
+ font-size: 14px;
121
+ font-weight: 500;
122
+ border: 1px solid rgba(0, 0, 0, 0.08);
123
+ display: flex;
124
+ width: fit-content;
125
+ gap: 4px;
126
+ align-items: center;
127
+ box-sizing: border-box;
128
+ cursor: pointer;
129
+
130
+ &:hover {
131
+ background: rgba(0, 0, 0, 0.06);
132
+ }
133
+ &:active {
134
+ background: rgba(0, 0, 0, 0.1);
135
+ }
136
+ `;
137
+ export { LinkCard };
@@ -23,6 +23,11 @@ md.renderer.rules.link_open = function(tokens, idx, options, env, self) {
23
23
  else tokens[idx].attrs[relIndex][1] = 'noopener noreferrer';
24
24
  return defaultLinkOpen(tokens, idx, options, env, self);
25
25
  };
26
+ md.renderer.rules.text = (tokens, idx)=>{
27
+ let text = tokens[idx].content;
28
+ text = text.replace(/\[\[(-?\d+(\.\d+)?)\]\]/g, '<sup>[$1]</sup>');
29
+ return text;
30
+ };
26
31
  const Markdown = (props)=>/*#__PURE__*/ jsx(MarkdownBody, {
27
32
  dangerouslySetInnerHTML: {
28
33
  __html: md.render(props.content)
@@ -2,3 +2,4 @@ export * from './Bubble';
2
2
  export * from './Reasoning';
3
3
  export * from './ReferenceList';
4
4
  export * from './SuggestMessageList';
5
+ export * from './LinkCard';
@@ -2,3 +2,4 @@ export * from "./Bubble.js";
2
2
  export * from "./Reasoning.js";
3
3
  export * from "./ReferenceList.js";
4
4
  export * from "./SuggestMessageList.js";
5
+ export * from "./LinkCard.js";
@@ -0,0 +1 @@
1
+ export declare const IconDoc: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ const IconDoc = ()=>/*#__PURE__*/ jsx("svg", {
3
+ xmlns: "http://www.w3.org/2000/svg",
4
+ width: "1em",
5
+ height: "1em",
6
+ fill: "none",
7
+ viewBox: "0 0 24 24",
8
+ children: /*#__PURE__*/ jsx("path", {
9
+ fill: "currentColor",
10
+ "fill-rule": "evenodd",
11
+ d: "M20.014 9.046a.514.514 0 0 1-.512.454.52.52 0 0 1-.515-.452c-.241-1.445-.452-2.18-.906-2.634-.455-.453-1.186-.66-2.612-.9A.52.52 0 0 1 15 5.002c0-.275.206-.487.473-.513 1.422-.242 2.153-.454 2.607-.91s.666-1.191.907-2.623A.52.52 0 0 1 19.502.5c.273 0 .473.197.512.458.24 1.43.451 2.165.906 2.622.455.455 1.187.667 2.61.909.266.027.47.24.47.513a.52.52 0 0 1-.468.512c-1.425.24-2.157.452-2.612.907-.455.456-.666 1.192-.907 2.625M7 7.75A.75.75 0 0 1 7.75 7h2.5a.75.75 0 0 1 0 1.5h-2.5A.75.75 0 0 1 7 7.75m0 3a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75M7.75 13a.75.75 0 0 0 0 1.5h8.5a.75.75 0 0 0 0-1.5zM19 21v-9.55c1.335-.276 1.744-.708 2-1.95V21a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h12.054c-.084.45-.158.754-.23.972-.05.151-.089.223-.105.25a1.3 1.3 0 0 1-.245.104c-.28.093-.703.19-1.4.309-.354.048-.69.175-.985.365H5v18z",
12
+ "clip-rule": "evenodd"
13
+ })
14
+ });
15
+ export { IconDoc };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage-next",
3
- "version": "0.0.162",
3
+ "version": "0.0.165",
4
4
  "description": "A React component library for creating filter forms with Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",