@alifd/chat 0.0.1 → 0.1.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 (139) hide show
  1. package/es/button/index.d.ts +23 -1
  2. package/es/button/index.js +30 -1
  3. package/es/button/main.scss +5 -0
  4. package/es/button/style.d.ts +1 -0
  5. package/es/button/style.js +1 -0
  6. package/es/card/index.d.ts +5 -0
  7. package/es/card/index.js +5 -0
  8. package/es/card/main.scss +141 -0
  9. package/es/card/style.d.ts +2 -0
  10. package/es/card/style.js +2 -0
  11. package/es/card/types.d.ts +56 -0
  12. package/es/card/types.js +1 -0
  13. package/es/card/view/card.d.ts +6 -0
  14. package/es/card/view/card.js +52 -0
  15. package/es/card/view/collapsable.d.ts +7 -0
  16. package/es/card/view/collapsable.js +62 -0
  17. package/es/core/variables.scss +33 -0
  18. package/es/feedback/index.d.ts +6 -0
  19. package/es/feedback/index.js +46 -0
  20. package/es/feedback/main.scss +42 -0
  21. package/es/feedback/style.d.ts +1 -0
  22. package/es/feedback/style.js +1 -0
  23. package/es/feedback/types.d.ts +54 -0
  24. package/es/feedback/types.js +1 -0
  25. package/es/feedback/view/good.d.ts +7 -0
  26. package/es/feedback/view/good.js +7 -0
  27. package/es/float-button/hooks/useAutoAlign.d.ts +2 -2
  28. package/es/float-button/hooks/useAutoAlign.js +2 -2
  29. package/es/float-button/hooks/useTriggerType.d.ts +3 -0
  30. package/es/float-button/hooks/useTriggerType.js +31 -0
  31. package/es/float-button/main.scss +69 -11
  32. package/es/float-button/style.d.ts +1 -0
  33. package/es/float-button/style.js +1 -0
  34. package/es/float-button/types.d.ts +7 -2
  35. package/es/float-button/view/backtop.js +3 -3
  36. package/es/float-button/view/drawer.d.ts +7 -1
  37. package/es/float-button/view/drawer.js +11 -2
  38. package/es/float-button/view/float-button.js +43 -7
  39. package/es/float-button/view/inner-drawer.d.ts +16 -2
  40. package/es/float-button/view/inner-drawer.js +103 -3
  41. package/es/index.d.ts +6 -0
  42. package/es/index.js +7 -1
  43. package/es/tab/index.d.ts +8 -0
  44. package/es/tab/index.js +14 -0
  45. package/es/tab/main.scss +10 -0
  46. package/es/tab/style.d.ts +2 -0
  47. package/es/tab/style.js +2 -0
  48. package/es/tag/index.d.ts +12 -0
  49. package/es/tag/index.js +18 -0
  50. package/es/tag/main.scss +9 -0
  51. package/es/tag/style.d.ts +2 -0
  52. package/es/tag/style.js +2 -0
  53. package/es/tag/types.d.ts +0 -0
  54. package/es/tag/types.js +1 -0
  55. package/es/text/index.d.ts +3 -0
  56. package/es/text/index.js +301 -0
  57. package/es/text/main.scss +19 -0
  58. package/es/text/style.d.ts +1 -0
  59. package/es/text/style.js +1 -0
  60. package/es/text/types.d.ts +16 -0
  61. package/es/text/types.js +1 -0
  62. package/es/utils/consts.d.ts +1 -0
  63. package/es/utils/consts.js +1 -0
  64. package/es/utils/hooks/useControlable.d.ts +1 -1
  65. package/es/utils/hooks/useControlable.js +4 -3
  66. package/es/utils/index.d.ts +1 -0
  67. package/es/utils/index.js +1 -0
  68. package/lib/button/index.d.ts +23 -1
  69. package/lib/button/index.js +30 -6
  70. package/lib/button/main.scss +5 -0
  71. package/lib/button/style.d.ts +1 -0
  72. package/lib/button/style.js +1 -0
  73. package/lib/card/index.d.ts +5 -0
  74. package/lib/card/index.js +8 -0
  75. package/lib/card/main.scss +141 -0
  76. package/lib/card/style.d.ts +2 -0
  77. package/lib/card/style.js +4 -0
  78. package/lib/card/types.d.ts +56 -0
  79. package/lib/card/types.js +2 -0
  80. package/lib/card/view/card.d.ts +6 -0
  81. package/lib/card/view/card.js +57 -0
  82. package/lib/card/view/collapsable.d.ts +7 -0
  83. package/lib/card/view/collapsable.js +64 -0
  84. package/lib/core/variables.scss +33 -0
  85. package/lib/feedback/index.d.ts +6 -0
  86. package/lib/feedback/index.js +48 -0
  87. package/lib/feedback/main.scss +42 -0
  88. package/lib/feedback/style.d.ts +1 -0
  89. package/lib/feedback/style.js +3 -0
  90. package/lib/feedback/types.d.ts +54 -0
  91. package/lib/feedback/types.js +2 -0
  92. package/lib/feedback/view/good.d.ts +7 -0
  93. package/lib/feedback/view/good.js +10 -0
  94. package/lib/float-button/hooks/useAutoAlign.d.ts +2 -2
  95. package/lib/float-button/hooks/useAutoAlign.js +2 -2
  96. package/lib/float-button/hooks/useTriggerType.d.ts +3 -0
  97. package/lib/float-button/hooks/useTriggerType.js +35 -0
  98. package/lib/float-button/main.scss +69 -11
  99. package/lib/float-button/style.d.ts +1 -0
  100. package/lib/float-button/style.js +1 -0
  101. package/lib/float-button/types.d.ts +7 -2
  102. package/lib/float-button/view/backtop.js +2 -2
  103. package/lib/float-button/view/drawer.d.ts +7 -1
  104. package/lib/float-button/view/drawer.js +10 -2
  105. package/lib/float-button/view/float-button.js +41 -5
  106. package/lib/float-button/view/inner-drawer.d.ts +16 -2
  107. package/lib/float-button/view/inner-drawer.js +103 -3
  108. package/lib/index.d.ts +6 -0
  109. package/lib/index.js +14 -2
  110. package/lib/tab/index.d.ts +8 -0
  111. package/lib/tab/index.js +16 -0
  112. package/lib/tab/main.scss +10 -0
  113. package/lib/tab/style.d.ts +2 -0
  114. package/lib/tab/style.js +4 -0
  115. package/lib/tag/index.d.ts +12 -0
  116. package/lib/tag/index.js +20 -0
  117. package/lib/tag/main.scss +9 -0
  118. package/lib/tag/style.d.ts +2 -0
  119. package/lib/tag/style.js +4 -0
  120. package/lib/tag/types.d.ts +0 -0
  121. package/lib/tag/types.js +1 -0
  122. package/lib/text/index.d.ts +3 -0
  123. package/lib/text/index.js +304 -0
  124. package/lib/text/main.scss +19 -0
  125. package/lib/text/style.d.ts +1 -0
  126. package/lib/text/style.js +3 -0
  127. package/lib/text/types.d.ts +16 -0
  128. package/lib/text/types.js +2 -0
  129. package/lib/utils/consts.d.ts +1 -0
  130. package/lib/utils/consts.js +4 -0
  131. package/lib/utils/hooks/useControlable.d.ts +1 -1
  132. package/lib/utils/hooks/useControlable.js +4 -3
  133. package/lib/utils/index.d.ts +1 -0
  134. package/lib/utils/index.js +1 -0
  135. package/package.json +81 -1
  136. package/es/button/view/button.d.ts +0 -23
  137. package/es/button/view/button.js +0 -26
  138. package/lib/button/view/button.d.ts +0 -23
  139. package/lib/button/view/button.js +0 -29
@@ -0,0 +1,304 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importStar(require("react"));
5
+ const next_1 = require("@alifd/next");
6
+ const classnames_1 = tslib_1.__importDefault(require("classnames"));
7
+ const utils_1 = require("../utils");
8
+ const button_1 = tslib_1.__importDefault(require("../button"));
9
+ function normalizeTriggerType(triggerType) {
10
+ if (!triggerType) {
11
+ return ['click'];
12
+ }
13
+ const arr = Array.isArray(triggerType) ? triggerType : [triggerType];
14
+ const allowedSet = new Set(['click', 'hover']);
15
+ const results = Array.from(new Set(arr.filter(t => allowedSet.has(t))));
16
+ if (!results.length) {
17
+ results.push('click');
18
+ }
19
+ return results;
20
+ }
21
+ function useCollapseText({ enable, boxRef, textRef, maxLine, placeholder = '...', before, after, }) {
22
+ const callbackRef = (0, react_1.useRef)({ before, after });
23
+ callbackRef.current = { before, after };
24
+ const [canCollapse, setCanCollapse] = (0, react_1.useState)(false);
25
+ const getLineHeight = (0, react_1.useCallback)((dom) => {
26
+ const lineHeight = getComputedStyle(dom).getPropertyValue('line-height');
27
+ if (lineHeight === 'normal') {
28
+ // 向容器里添加一段文本来测试行高
29
+ const span = document.createElement('span');
30
+ span.style.whiteSpace = 'nowrap';
31
+ span.innerText = 'test';
32
+ span.style.visibility = 'hidden';
33
+ dom.appendChild(span);
34
+ const height = span.offsetHeight;
35
+ dom.removeChild(span);
36
+ return height;
37
+ }
38
+ return parseFloat(lineHeight);
39
+ }, []);
40
+ const handleCollapseText = (0, react_1.useCallback)((box, text, maxLine) => {
41
+ var _a, _b, _c, _d;
42
+ // 计算思路,通过容器的实际高度 / 行高 来判断是否超出限制行数,然后多次通过二分法截断文本
43
+ const lineHeight = getLineHeight(text);
44
+ const maxHeight = maxLine * lineHeight;
45
+ const isOver = () => {
46
+ const height = box.offsetHeight;
47
+ const max = maxHeight + lineHeight - 1;
48
+ return height > max;
49
+ };
50
+ if (!isOver()) {
51
+ return;
52
+ }
53
+ const removeNodeAndTry = (node) => {
54
+ node.parentNode.removeChild(node);
55
+ return !isOver();
56
+ };
57
+ const sliceTextAndTry = (node) => {
58
+ const str = node.textContent;
59
+ if (!str) {
60
+ if (removeNodeAndTry(node)) {
61
+ return true;
62
+ }
63
+ }
64
+ else {
65
+ let left = 0;
66
+ let right = str.length - 1;
67
+ while (left < right) {
68
+ const middle = Math.floor((left + right) / 2);
69
+ const temp1 = str.slice(0, middle) + placeholder;
70
+ node.textContent = temp1;
71
+ if (!isOver()) {
72
+ // 若已经到减去一个字符就满足,则中断
73
+ if (right - middle === 1) {
74
+ return true;
75
+ }
76
+ // 减半后高度小于最大高度,向后二分
77
+ left = middle;
78
+ }
79
+ else {
80
+ // 减半后高度还是大于最大高度,则继续向前二分
81
+ right = middle;
82
+ }
83
+ if (left === right) {
84
+ break;
85
+ }
86
+ }
87
+ if (removeNodeAndTry(node)) {
88
+ return true;
89
+ }
90
+ }
91
+ return false;
92
+ };
93
+ const loop = (childNodes) => {
94
+ const nodes = Array.from(childNodes);
95
+ for (let i = nodes.length - 1; i >= 0; i--) {
96
+ const node = nodes[i];
97
+ if (node.childNodes.length) {
98
+ loop(node.childNodes);
99
+ }
100
+ else if (sliceTextAndTry(node)) {
101
+ return;
102
+ }
103
+ }
104
+ };
105
+ const isContinue = (_b = (_a = callbackRef.current).before) === null || _b === void 0 ? void 0 : _b.call(_a);
106
+ if (isContinue === false) {
107
+ return;
108
+ }
109
+ loop(text.childNodes);
110
+ (_d = (_c = callbackRef.current).after) === null || _d === void 0 ? void 0 : _d.call(_c);
111
+ }, []);
112
+ (0, react_1.useLayoutEffect)(() => {
113
+ const box = boxRef.current;
114
+ const text = textRef.current;
115
+ if (!box || !text || typeof maxLine !== 'number' || maxLine <= 0) {
116
+ return;
117
+ }
118
+ const lineHeight = getLineHeight(text);
119
+ const newCanCollapse = box.offsetHeight > maxLine * lineHeight;
120
+ if (canCollapse !== newCanCollapse) {
121
+ setCanCollapse(newCanCollapse);
122
+ }
123
+ });
124
+ (0, react_1.useLayoutEffect)(() => {
125
+ const box = boxRef.current;
126
+ const text = textRef.current;
127
+ if (!enable ||
128
+ !box ||
129
+ !text ||
130
+ typeof maxLine !== 'number' ||
131
+ maxLine <= 0 ||
132
+ !canCollapse) {
133
+ return;
134
+ }
135
+ handleCollapseText(box, text, maxLine);
136
+ });
137
+ return canCollapse;
138
+ }
139
+ function useEnsureBoxFullLine({ enableRef, boxRef, modifierRef, before, after, }) {
140
+ const callbackRef = (0, react_1.useRef)({ before, after });
141
+ callbackRef.current = { before, after };
142
+ const ensureTriggerEnd = (0, react_1.useCallback)((box, modifier) => {
143
+ var _a, _b, _c, _d, _e, _f;
144
+ const blank = '&nbsp;';
145
+ const isEnd = () => {
146
+ const height = box.offsetHeight;
147
+ const text = document.createElement('span');
148
+ text.innerHTML = blank;
149
+ modifier.appendChild(text);
150
+ // 添加一个空格元素后,容器高度变化了则代表已经在行末
151
+ if (box.offsetHeight > height) {
152
+ modifier.removeChild(text);
153
+ return true;
154
+ }
155
+ modifier.removeChild(text);
156
+ return false;
157
+ };
158
+ (_b = (_a = callbackRef.current).before) === null || _b === void 0 ? void 0 : _b.call(_a);
159
+ if (isEnd()) {
160
+ (_d = (_c = callbackRef.current).after) === null || _d === void 0 ? void 0 : _d.call(_c);
161
+ return;
162
+ }
163
+ const height = box.offsetHeight;
164
+ const text = document.createElement('span');
165
+ text.innerHTML = blank;
166
+ modifier.appendChild(text);
167
+ const MAX_TIMES = 9999;
168
+ let times = 0;
169
+ while (box.offsetHeight === height) {
170
+ text.innerHTML = `${text.innerHTML}${blank}`;
171
+ if (times++ >= MAX_TIMES) {
172
+ break;
173
+ }
174
+ }
175
+ text.innerHTML = text.innerHTML.replace(new RegExp(`${blank}$`), '');
176
+ (_f = (_e = callbackRef.current).after) === null || _f === void 0 ? void 0 : _f.call(_e);
177
+ }, []);
178
+ (0, react_1.useLayoutEffect)(() => {
179
+ const enable = enableRef.current;
180
+ const box = boxRef.current;
181
+ const modifier = modifierRef.current;
182
+ if (!enable || !box || !modifier) {
183
+ return;
184
+ }
185
+ // 通过向 modifier 添加空格元素来保证 trigger 元素正好在行末
186
+ ensureTriggerEnd(box, modifier);
187
+ });
188
+ }
189
+ function useResize(domRef, onResize, shouldTriggerRef) {
190
+ const sizeRef = (0, react_1.useRef)();
191
+ const debounceOnResize = (0, utils_1.useDebounce)(onResize, 50);
192
+ const observer = (0, react_1.useMemo)(() => {
193
+ return new ResizeObserver(() => {
194
+ const dom = domRef.current;
195
+ if (!dom || !shouldTriggerRef.current) {
196
+ return;
197
+ }
198
+ const { offsetWidth, offsetHeight } = dom;
199
+ const lastSize = sizeRef.current;
200
+ const newSize = { width: offsetWidth, height: offsetHeight };
201
+ if (!lastSize ||
202
+ newSize.width !== lastSize.width ||
203
+ newSize.height !== lastSize.height) {
204
+ debounceOnResize();
205
+ }
206
+ sizeRef.current = newSize;
207
+ });
208
+ }, []);
209
+ (0, react_1.useEffect)(() => {
210
+ const dom = domRef.current;
211
+ if (!dom) {
212
+ return;
213
+ }
214
+ observer.observe(dom);
215
+ return () => {
216
+ observer.unobserve(dom);
217
+ };
218
+ }, [domRef.current, observer]);
219
+ }
220
+ function TextComp(props) {
221
+ const { className, maxLine, renderTrigger, triggerType = 'click', locale, showTrigger = true, children, } = props;
222
+ const collapsable = typeof maxLine === 'number' && maxLine > 0;
223
+ const { collapseText = '收起', expandText = '展开' } = locale || {};
224
+ const prefix = utils_1.PREFIX_DEFAULT;
225
+ const triggerTypes = normalizeTriggerType(triggerType);
226
+ const clickToTrigger = triggerTypes.includes('click');
227
+ const hoverToTrigger = triggerTypes.includes('hover');
228
+ const [value, onChange] = (0, utils_1.useControlable)(props, {
229
+ valueName: 'visible',
230
+ changeName: 'onVisibleChange',
231
+ });
232
+ const shouldTriggerResizeRef = (0, react_1.useRef)(false);
233
+ const [, rerender] = (0, react_1.useState)({});
234
+ const boxRef = (0, react_1.useRef)(null);
235
+ const textRef = (0, react_1.useRef)(null);
236
+ const triggerRef = (0, react_1.useRef)(null);
237
+ const canCollapse = useCollapseText({
238
+ boxRef,
239
+ textRef,
240
+ maxLine,
241
+ enable: !value && collapsable,
242
+ before() {
243
+ shouldTriggerResizeRef.current = false;
244
+ },
245
+ after() {
246
+ shouldTriggerResizeRef.current = true;
247
+ },
248
+ });
249
+ useEnsureBoxFullLine({
250
+ enableRef: triggerRef,
251
+ boxRef,
252
+ modifierRef: textRef,
253
+ before() {
254
+ shouldTriggerResizeRef.current = false;
255
+ },
256
+ after() {
257
+ shouldTriggerResizeRef.current = true;
258
+ },
259
+ });
260
+ useResize(boxRef, () => {
261
+ rerender({});
262
+ }, shouldTriggerResizeRef);
263
+ (0, react_1.useEffect)(() => {
264
+ shouldTriggerResizeRef.current = true;
265
+ }, []);
266
+ const render = renderTrigger ||
267
+ ((visible, onVisibleChange) => {
268
+ return (react_1.default.createElement(button_1.default, { text: true, className: `${prefix}text-trigger-btn`, component: "a", type: "primary", onClick: () => {
269
+ onVisibleChange(!visible);
270
+ } }, visible ? collapseText : expandText));
271
+ });
272
+ const triggerByContent = (newValue = value) => {
273
+ if (!collapsable) {
274
+ return;
275
+ }
276
+ onChange(newValue !== null && newValue !== void 0 ? newValue : !value, 'content');
277
+ };
278
+ const debounceTriggerByContent = (0, utils_1.useDebounce)(triggerByContent, 100);
279
+ return (react_1.default.createElement("div", { className: (0, classnames_1.default)(`${prefix}text`, className), ref: boxRef },
280
+ react_1.default.createElement("span", { ref: textRef, className: `${prefix}text-inner`, role: "textbox", tabIndex: 0, key: Math.random(), onKeyUp: e => {
281
+ if (!clickToTrigger || e.key !== 'Enter') {
282
+ return;
283
+ }
284
+ triggerByContent();
285
+ }, onClick: () => {
286
+ if (!clickToTrigger) {
287
+ return;
288
+ }
289
+ triggerByContent();
290
+ }, onMouseEnter: () => {
291
+ if (!hoverToTrigger) {
292
+ return;
293
+ }
294
+ debounceTriggerByContent(true);
295
+ }, onMouseLeave: () => {
296
+ if (!hoverToTrigger) {
297
+ return;
298
+ }
299
+ debounceTriggerByContent(false);
300
+ } }, children),
301
+ showTrigger && canCollapse && collapsable && (react_1.default.createElement("span", { className: `${prefix}text-trigger`, ref: triggerRef }, render(value, v => onChange(v, 'trigger'))))));
302
+ }
303
+ TextComp.displayName = 'Text';
304
+ exports.default = next_1.ConfigProvider.config(TextComp);
@@ -0,0 +1,19 @@
1
+ @import '../core/variables.scss';
2
+
3
+ .#{$prefix}text {
4
+ display: inline-block;
5
+
6
+ &-inner {
7
+ }
8
+ &-trigger {
9
+ line-height: 1;
10
+
11
+ & &-btn {
12
+ font-size: inherit;
13
+ line-height: inherit;
14
+ height: auto;
15
+ vertical-align: baseline;
16
+ margin-left: 12px;
17
+ }
18
+ }
19
+ }
@@ -0,0 +1 @@
1
+ import './main.scss';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("./main.scss");
@@ -0,0 +1,16 @@
1
+ import type { HTMLAttributes, ReactElement, ReactNode } from 'react';
2
+ export type HTMLAttributesWeak = Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
3
+ export type TriggerType = 'click' | 'hover';
4
+ export interface TextProps extends HTMLAttributesWeak {
5
+ maxLine?: number;
6
+ visible?: boolean;
7
+ children?: ReactNode;
8
+ onVisibleChange?: (visible: boolean, type: string) => void;
9
+ triggerType?: TriggerType | Array<TriggerType>;
10
+ showTrigger?: boolean;
11
+ renderTrigger?: (visible: boolean, onVisibleChange: (visible: boolean) => void) => ReactElement | string;
12
+ locale?: {
13
+ expandText?: string;
14
+ collapseText?: string;
15
+ };
16
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export declare const PREFIX_DEFAULT = "ct-";
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PREFIX_DEFAULT = void 0;
4
+ exports.PREFIX_DEFAULT = 'ct-';
@@ -3,4 +3,4 @@ export interface ControlableOptions {
3
3
  defaultValueName?: string;
4
4
  changeName?: string;
5
5
  }
6
- export declare function useControlable<Value = unknown, OnChange extends (nextValue: Value, ...rest: unknown[]) => unknown = (nextValue: Value, ...rest: unknown[]) => unknown>(props: Record<string, unknown>, { valueName, defaultValueName, changeName, }?: ControlableOptions): readonly [Value, OnChange];
6
+ export declare function useControlable<Value = unknown, OnChange extends (nextValue: Value, ...rest: unknown[]) => unknown = (nextValue: Value, ...rest: unknown[]) => unknown>(props: object, { valueName, defaultValueName, changeName, }?: ControlableOptions): readonly [Value, OnChange];
@@ -9,9 +9,10 @@ function getDefaultValueName(valueName) {
9
9
  return `default${upperFirst(valueName)}`;
10
10
  }
11
11
  function useControlable(props, { valueName = 'value', defaultValueName = getDefaultValueName(valueName), changeName = 'onChange', } = {}) {
12
- const isControl = valueName in props;
13
- const propValue = (isControl ? props[valueName] : props[defaultValueName]);
14
- const propOnChange = props[changeName];
12
+ const typedProps = props;
13
+ const isControl = valueName in typedProps;
14
+ const propValue = (isControl ? typedProps[valueName] : typedProps[defaultValueName]);
15
+ const propOnChange = typedProps[changeName];
15
16
  const [value, setValue] = (0, react_1.useState)(() => propValue);
16
17
  const handleChange = (nextValue, ...rest) => {
17
18
  if (!isControl) {
@@ -1,3 +1,4 @@
1
+ export * from './consts';
1
2
  export * from './types';
2
3
  export * from './common';
3
4
  export * from './func';
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useThrottle = exports.useDebounce = exports.useControlable = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ tslib_1.__exportStar(require("./consts"), exports);
5
6
  tslib_1.__exportStar(require("./types"), exports);
6
7
  tslib_1.__exportStar(require("./common"), exports);
7
8
  tslib_1.__exportStar(require("./func"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alifd/chat",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "description": "A configurable component library for chat built on React.",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -14,10 +14,86 @@
14
14
  "import": "./es/button/index.js",
15
15
  "require": "./lib/button/index.js"
16
16
  },
17
+ "./button/style": {
18
+ "import": "./es/button/style.js",
19
+ "require": "./lib/button/style.js"
20
+ },
21
+ "./button/style.js": {
22
+ "import": "./es/button/style.js",
23
+ "require": "./lib/button/style.js"
24
+ },
25
+ "./card": {
26
+ "import": "./es/card/index.js",
27
+ "require": "./lib/card/index.js"
28
+ },
29
+ "./card/style": {
30
+ "import": "./es/card/style.js",
31
+ "require": "./lib/card/style.js"
32
+ },
33
+ "./card/style.js": {
34
+ "import": "./es/card/style.js",
35
+ "require": "./lib/card/style.js"
36
+ },
37
+ "./feedback": {
38
+ "import": "./es/feedback/index.js",
39
+ "require": "./lib/feedback/index.js"
40
+ },
41
+ "./feedback/style": {
42
+ "import": "./es/feedback/style.js",
43
+ "require": "./lib/feedback/style.js"
44
+ },
45
+ "./feedback/style.js": {
46
+ "import": "./es/feedback/style.js",
47
+ "require": "./lib/feedback/style.js"
48
+ },
17
49
  "./float-button": {
18
50
  "import": "./es/float-button/index.js",
19
51
  "require": "./lib/float-button/index.js"
20
52
  },
53
+ "./float-button/style": {
54
+ "import": "./es/float-button/style.js",
55
+ "require": "./lib/float-button/style.js"
56
+ },
57
+ "./float-button/style.js": {
58
+ "import": "./es/float-button/style.js",
59
+ "require": "./lib/float-button/style.js"
60
+ },
61
+ "./tab": {
62
+ "import": "./es/tab/index.js",
63
+ "require": "./lib/tab/index.js"
64
+ },
65
+ "./tab/style": {
66
+ "import": "./es/tab/style.js",
67
+ "require": "./lib/tab/style.js"
68
+ },
69
+ "./tab/style.js": {
70
+ "import": "./es/tab/style.js",
71
+ "require": "./lib/tab/style.js"
72
+ },
73
+ "./tag": {
74
+ "import": "./es/tag/index.js",
75
+ "require": "./lib/tag/index.js"
76
+ },
77
+ "./tag/style": {
78
+ "import": "./es/tag/style.js",
79
+ "require": "./lib/tag/style.js"
80
+ },
81
+ "./tag/style.js": {
82
+ "import": "./es/tag/style.js",
83
+ "require": "./lib/tag/style.js"
84
+ },
85
+ "./text": {
86
+ "import": "./es/text/index.js",
87
+ "require": "./lib/text/index.js"
88
+ },
89
+ "./text/style": {
90
+ "import": "./es/text/style.js",
91
+ "require": "./lib/text/style.js"
92
+ },
93
+ "./text/style.js": {
94
+ "import": "./es/text/style.js",
95
+ "require": "./lib/text/style.js"
96
+ },
21
97
  "./utils": {
22
98
  "import": "./es/utils/index.js",
23
99
  "require": "./lib/utils/index.js"
@@ -43,13 +119,16 @@
43
119
  "@rspack/dev-server": "^0.5.1",
44
120
  "@rspack/plugin-react-refresh": "^0.5.1",
45
121
  "@swc/core": "^1.3.104",
122
+ "@swc/helpers": "^0.5.6",
46
123
  "@types/fs-extra": "^11.0.4",
124
+ "@types/hoist-non-react-statics": "^3.3.5",
47
125
  "@types/lodash": "^4.14.202",
48
126
  "@types/minimist": "^1.2.5",
49
127
  "@types/react": "^16.0.0",
50
128
  "@types/react-dom": "^16.0.0",
51
129
  "@typescript-eslint/eslint-plugin": "^6.19.0",
52
130
  "@typescript-eslint/parser": "^6.19.0",
131
+ "ajv": "^8.12.0",
53
132
  "chalk": "^5.3.0",
54
133
  "eslint": "^8.56.0",
55
134
  "eslint-config-prettier": "^9.1.0",
@@ -86,6 +165,7 @@
86
165
  "react-dom": ">=16.0.0"
87
166
  },
88
167
  "dependencies": {
168
+ "hoist-non-react-statics": "^3.3.2",
89
169
  "tslib": "^2.6.2"
90
170
  },
91
171
  "sideEffects": [
@@ -1,23 +0,0 @@
1
- import * as React from 'react';
2
- import type { ButtonProps } from '../types.js';
3
- /**
4
- * @component 按钮
5
- * @en Button
6
- * @type 通用 - General
7
- * @remarks 按钮用于开始一个即时操作。- Button used to trigger an action.
8
- * @when 标记一个(或封装一组)操作命令,响应用户点击行为,触发相应的业务逻辑。- Buttons are used for emphasizing important functions on your page.
9
- * @others
10
- * ## 无障碍键盘操作指南
11
- * | 按键 | 说明 |
12
- * | :---- | :---------- |
13
- * | Enter | 触发 onClick 事件 |
14
- * | SPACE | 触发 onClick 事件 |
15
- * @othersEn
16
- * ## ARIA and KeyBoard
17
- * | KeyBoard | Description |
18
- * | :---------- | :------------------------------ |
19
- * | Enter | Trigger the onClick event |
20
- * | SPACE | Trigger the onClick event |
21
- */
22
- declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<{}>>;
23
- export default Button;
@@ -1,26 +0,0 @@
1
- import { forwardRef } from 'react';
2
- import * as React from 'react';
3
- /**
4
- * @component 按钮
5
- * @en Button
6
- * @type 通用 - General
7
- * @remarks 按钮用于开始一个即时操作。- Button used to trigger an action.
8
- * @when 标记一个(或封装一组)操作命令,响应用户点击行为,触发相应的业务逻辑。- Buttons are used for emphasizing important functions on your page.
9
- * @others
10
- * ## 无障碍键盘操作指南
11
- * | 按键 | 说明 |
12
- * | :---- | :---------- |
13
- * | Enter | 触发 onClick 事件 |
14
- * | SPACE | 触发 onClick 事件 |
15
- * @othersEn
16
- * ## ARIA and KeyBoard
17
- * | KeyBoard | Description |
18
- * | :---------- | :------------------------------ |
19
- * | Enter | Trigger the onClick event |
20
- * | SPACE | Trigger the onClick event |
21
- */
22
- const Button = forwardRef((props, ref) => {
23
- return React.createElement("div", null, props.children);
24
- });
25
- Button.displayName = 'Button';
26
- export default Button;
@@ -1,23 +0,0 @@
1
- import * as React from 'react';
2
- import type { ButtonProps } from '../types.js';
3
- /**
4
- * @component 按钮
5
- * @en Button
6
- * @type 通用 - General
7
- * @remarks 按钮用于开始一个即时操作。- Button used to trigger an action.
8
- * @when 标记一个(或封装一组)操作命令,响应用户点击行为,触发相应的业务逻辑。- Buttons are used for emphasizing important functions on your page.
9
- * @others
10
- * ## 无障碍键盘操作指南
11
- * | 按键 | 说明 |
12
- * | :---- | :---------- |
13
- * | Enter | 触发 onClick 事件 |
14
- * | SPACE | 触发 onClick 事件 |
15
- * @othersEn
16
- * ## ARIA and KeyBoard
17
- * | KeyBoard | Description |
18
- * | :---------- | :------------------------------ |
19
- * | Enter | Trigger the onClick event |
20
- * | SPACE | Trigger the onClick event |
21
- */
22
- declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<{}>>;
23
- export default Button;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const react_1 = require("react");
5
- const React = tslib_1.__importStar(require("react"));
6
- /**
7
- * @component 按钮
8
- * @en Button
9
- * @type 通用 - General
10
- * @remarks 按钮用于开始一个即时操作。- Button used to trigger an action.
11
- * @when 标记一个(或封装一组)操作命令,响应用户点击行为,触发相应的业务逻辑。- Buttons are used for emphasizing important functions on your page.
12
- * @others
13
- * ## 无障碍键盘操作指南
14
- * | 按键 | 说明 |
15
- * | :---- | :---------- |
16
- * | Enter | 触发 onClick 事件 |
17
- * | SPACE | 触发 onClick 事件 |
18
- * @othersEn
19
- * ## ARIA and KeyBoard
20
- * | KeyBoard | Description |
21
- * | :---------- | :------------------------------ |
22
- * | Enter | Trigger the onClick event |
23
- * | SPACE | Trigger the onClick event |
24
- */
25
- const Button = (0, react_1.forwardRef)((props, ref) => {
26
- return React.createElement("div", null, props.children);
27
- });
28
- Button.displayName = 'Button';
29
- exports.default = Button;