@ai-group/chat-sdk 3.7.1-alpha1 → 3.7.1-alpha2

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 (52) hide show
  1. package/dist/cjs/components/Sources/components/CarouselCard.d.ts +12 -0
  2. package/dist/cjs/components/Sources/components/CarouselCard.js +130 -0
  3. package/dist/cjs/components/Sources/components/CarouselCard.js.map +7 -0
  4. package/dist/cjs/components/Sources/index.d.ts +5 -0
  5. package/dist/cjs/components/Sources/index.js +162 -0
  6. package/dist/cjs/components/Sources/index.js.map +7 -0
  7. package/dist/cjs/components/Sources/styles.d.ts +59 -0
  8. package/dist/cjs/components/Sources/styles.js +179 -0
  9. package/dist/cjs/components/Sources/styles.js.map +7 -0
  10. package/dist/cjs/components/XAdkSender/InlineTagInput.d.ts +2 -1
  11. package/dist/cjs/components/XAdkSender/InlineTagInput.js +26 -2
  12. package/dist/cjs/components/XAdkSender/InlineTagInput.js.map +2 -2
  13. package/dist/cjs/components/XAdkSender/index.js +66 -11
  14. package/dist/cjs/components/XAdkSender/index.js.map +3 -3
  15. package/dist/cjs/index.d.ts +3 -0
  16. package/dist/cjs/index.js +3 -0
  17. package/dist/cjs/index.js.map +3 -3
  18. package/dist/cjs/types/Sources.d.ts +30 -0
  19. package/dist/cjs/types/Sources.js +18 -0
  20. package/dist/cjs/types/Sources.js.map +7 -0
  21. package/dist/cjs/types/XAdkSender.d.ts +38 -5
  22. package/dist/cjs/types/XAdkSender.js.map +1 -1
  23. package/dist/cjs/types/index.d.ts +1 -0
  24. package/dist/cjs/types/index.js +3 -1
  25. package/dist/cjs/types/index.js.map +2 -2
  26. package/dist/esm/components/Sources/components/CarouselCard.d.ts +12 -0
  27. package/dist/esm/components/Sources/components/CarouselCard.js +107 -0
  28. package/dist/esm/components/Sources/components/CarouselCard.js.map +1 -0
  29. package/dist/esm/components/Sources/index.d.ts +5 -0
  30. package/dist/esm/components/Sources/index.js +127 -0
  31. package/dist/esm/components/Sources/index.js.map +1 -0
  32. package/dist/esm/components/Sources/styles.d.ts +59 -0
  33. package/dist/esm/components/Sources/styles.js +34 -0
  34. package/dist/esm/components/Sources/styles.js.map +1 -0
  35. package/dist/esm/components/XAdkSender/InlineTagInput.d.ts +2 -1
  36. package/dist/esm/components/XAdkSender/InlineTagInput.js +32 -2
  37. package/dist/esm/components/XAdkSender/InlineTagInput.js.map +1 -1
  38. package/dist/esm/components/XAdkSender/index.js +96 -26
  39. package/dist/esm/components/XAdkSender/index.js.map +1 -1
  40. package/dist/esm/index.d.ts +3 -0
  41. package/dist/esm/index.js +3 -0
  42. package/dist/esm/index.js.map +1 -1
  43. package/dist/esm/types/Sources.d.ts +30 -0
  44. package/dist/esm/types/Sources.js +2 -0
  45. package/dist/esm/types/Sources.js.map +1 -0
  46. package/dist/esm/types/XAdkSender.d.ts +38 -5
  47. package/dist/esm/types/XAdkSender.js.map +1 -1
  48. package/dist/esm/types/index.d.ts +1 -0
  49. package/dist/esm/types/index.js +1 -0
  50. package/dist/esm/types/index.js.map +1 -1
  51. package/dist/umd/chat-sdk.min.js +1 -1
  52. package/package.json +1 -1
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import type { SourcesItem, SourcesProps } from "../../../types/Sources";
3
+ export interface CarouselCardProps {
4
+ activeKey?: SourcesProps['activeKey'];
5
+ prefixCls: string;
6
+ items?: SourcesProps['items'];
7
+ className?: string;
8
+ style?: React.CSSProperties;
9
+ onClick?: (item: SourcesItem) => void;
10
+ }
11
+ declare const CarouselCard: React.FC<CarouselCardProps>;
12
+ export default CarouselCard;
@@ -0,0 +1,130 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/Sources/components/CarouselCard.tsx
30
+ var CarouselCard_exports = {};
31
+ __export(CarouselCard_exports, {
32
+ default: () => CarouselCard_default
33
+ });
34
+ module.exports = __toCommonJS(CarouselCard_exports);
35
+ var import_icons = require("@ant-design/icons");
36
+ var import_antd = require("antd");
37
+ var import_clsx = require("clsx");
38
+ var import_react = __toESM(require("react"));
39
+ var import_styles = __toESM(require("../styles"));
40
+ var import_jsx_runtime = require("react/jsx-runtime");
41
+ var CarouselCard = (props) => {
42
+ const { prefixCls, items, activeKey, className, style } = props;
43
+ const styles = (0, import_styles.default)();
44
+ const activeSlideIndex = import_react.default.useMemo(
45
+ () => Math.max(0, (items == null ? void 0 : items.findIndex(({ key }) => key === activeKey)) ?? 0),
46
+ [items, activeKey]
47
+ );
48
+ const [slide, setSlide] = (0, import_react.useState)(activeSlideIndex);
49
+ const carouselRef = (0, import_react.useRef)(null);
50
+ (0, import_react.useEffect)(() => {
51
+ setSlide(activeSlideIndex);
52
+ if (carouselRef.current) {
53
+ carouselRef.current.goTo(activeSlideIndex, false);
54
+ }
55
+ }, [activeSlideIndex]);
56
+ const handleClick = (item) => {
57
+ var _a;
58
+ item.url && window.open(item.url, "_blank", "noopener,noreferrer");
59
+ (_a = props.onClick) == null ? void 0 : _a.call(props, item);
60
+ };
61
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style, className: (0, import_clsx.clsx)(styles.carouselWrapper, className), children: [
62
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: styles.carouselTitle, children: [
63
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: styles.carouselBtnWrapper, children: [
64
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
65
+ "span",
66
+ {
67
+ className: (0, import_clsx.clsx)(styles.carouselBtn, {
68
+ [styles.carouselBtnDisabled]: slide === 0
69
+ }),
70
+ onClick: () => {
71
+ var _a;
72
+ if (slide > 0) {
73
+ const next = slide - 1;
74
+ setSlide(next);
75
+ (_a = carouselRef.current) == null ? void 0 : _a.goTo(next, false);
76
+ }
77
+ },
78
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.LeftOutlined, {})
79
+ }
80
+ ),
81
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
82
+ "span",
83
+ {
84
+ className: (0, import_clsx.clsx)(styles.carouselBtn, {
85
+ [styles.carouselBtnDisabled]: slide === ((items == null ? void 0 : items.length) || 1) - 1
86
+ }),
87
+ onClick: () => {
88
+ var _a;
89
+ const max = ((items == null ? void 0 : items.length) || 1) - 1;
90
+ if (slide < max) {
91
+ const next = slide + 1;
92
+ setSlide(next);
93
+ (_a = carouselRef.current) == null ? void 0 : _a.goTo(next, false);
94
+ }
95
+ },
96
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.RightOutlined, {})
97
+ }
98
+ )
99
+ ] }),
100
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.carouselPage, children: `${slide + 1}/${(items == null ? void 0 : items.length) || 1}` })
101
+ ] }),
102
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
103
+ import_antd.Carousel,
104
+ {
105
+ ref: carouselRef,
106
+ arrows: false,
107
+ infinite: false,
108
+ dots: false,
109
+ afterChange: setSlide,
110
+ children: items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
111
+ "div",
112
+ {
113
+ className: styles.carouselItem,
114
+ onClick: () => handleClick(item),
115
+ children: [
116
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: styles.carouselItemTitleWrapper, children: [
117
+ item.icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: item.icon }),
118
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: styles.carouselItemTitle, children: item.title })
119
+ ] }),
120
+ item.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.carouselItemDescription, children: item.description })
121
+ ]
122
+ },
123
+ item.key || index
124
+ ))
125
+ }
126
+ )
127
+ ] });
128
+ };
129
+ var CarouselCard_default = CarouselCard;
130
+ //# sourceMappingURL=CarouselCard.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/components/Sources/components/CarouselCard.tsx"],
4
+ "sourcesContent": ["import { LeftOutlined, RightOutlined } from '@ant-design/icons';\nimport { Carousel } from 'antd';\nimport { clsx } from 'clsx';\nimport React, { useEffect, useRef, useState } from 'react';\nimport type { SourcesItem, SourcesProps } from '@/types/Sources';\nimport useStyle from '../styles';\n\nexport interface CarouselCardProps {\n activeKey?: SourcesProps['activeKey'];\n prefixCls: string;\n items?: SourcesProps['items'];\n className?: string;\n style?: React.CSSProperties;\n onClick?: (item: SourcesItem) => void;\n}\n\nconst CarouselCard: React.FC<CarouselCardProps> = (props) => {\n const { prefixCls, items, activeKey, className, style } = props;\n const styles = useStyle();\n\n // Derive the target slide index from activeKey\n const activeSlideIndex = React.useMemo(\n () => Math.max(0, items?.findIndex(({ key }) => key === activeKey) ?? 0),\n [items, activeKey],\n );\n\n const [slide, setSlide] = useState<number>(activeSlideIndex);\n\n const carouselRef = useRef<React.ComponentRef<typeof Carousel>>(null);\n\n useEffect(() => {\n setSlide(activeSlideIndex);\n if (carouselRef.current) {\n carouselRef.current.goTo(activeSlideIndex, false);\n }\n }, [activeSlideIndex]);\n\n const handleClick = (item: SourcesItem) => {\n item.url && window.open(item.url, '_blank', 'noopener,noreferrer');\n props.onClick?.(item);\n };\n\n return (\n <div style={style} className={clsx(styles.carouselWrapper, className)}>\n <div className={styles.carouselTitle}>\n <div className={styles.carouselBtnWrapper}>\n <span\n className={clsx(styles.carouselBtn, {\n [styles.carouselBtnDisabled]: slide === 0,\n })}\n onClick={() => {\n if (slide > 0) {\n const next = slide - 1;\n setSlide(next);\n carouselRef.current?.goTo(next, false);\n }\n }}\n >\n <LeftOutlined />\n </span>\n <span\n className={clsx(styles.carouselBtn, {\n [styles.carouselBtnDisabled]: slide === (items?.length || 1) - 1,\n })}\n onClick={() => {\n const max = (items?.length || 1) - 1;\n if (slide < max) {\n const next = slide + 1;\n setSlide(next);\n carouselRef.current?.goTo(next, false);\n }\n }}\n >\n <RightOutlined />\n </span>\n </div>\n <div className={styles.carouselPage}>{`${slide + 1}/${items?.length || 1}`}</div>\n </div>\n <Carousel\n ref={carouselRef}\n arrows={false}\n infinite={false}\n dots={false}\n afterChange={setSlide}\n >\n {items?.map((item, index) => (\n <div\n key={item.key || index}\n className={styles.carouselItem}\n onClick={() => handleClick(item)}\n >\n <div className={styles.carouselItemTitleWrapper}>\n {item.icon && <span>{item.icon}</span>}\n <span className={styles.carouselItemTitle}>{item.title}</span>\n </div>\n {item.description && (\n <div className={styles.carouselItemDescription}>{item.description}</div>\n )}\n </div>\n ))}\n </Carousel>\n </div>\n );\n};\n\nexport default CarouselCard;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA4C;AAC5C,kBAAyB;AACzB,kBAAqB;AACrB,mBAAmD;AAEnD,oBAAqB;AAwCb;AA7BR,IAAM,eAA4C,CAAC,UAAU;AAC3D,QAAM,EAAE,WAAW,OAAO,WAAW,WAAW,MAAM,IAAI;AAC1D,QAAM,aAAS,cAAAA,SAAS;AAGxB,QAAM,mBAAmB,aAAAC,QAAM;AAAA,IAC7B,MAAM,KAAK,IAAI,IAAG,+BAAO,UAAU,CAAC,EAAE,IAAI,MAAM,QAAQ,eAAc,CAAC;AAAA,IACvE,CAAC,OAAO,SAAS;AAAA,EACnB;AAEA,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAiB,gBAAgB;AAE3D,QAAM,kBAAc,qBAA4C,IAAI;AAEpE,8BAAU,MAAM;AACd,aAAS,gBAAgB;AACzB,QAAI,YAAY,SAAS;AACvB,kBAAY,QAAQ,KAAK,kBAAkB,KAAK;AAAA,IAClD;AAAA,EACF,GAAG,CAAC,gBAAgB,CAAC;AAErB,QAAM,cAAc,CAAC,SAAsB;AArC7C;AAsCI,SAAK,OAAO,OAAO,KAAK,KAAK,KAAK,UAAU,qBAAqB;AACjE,gBAAM,YAAN,+BAAgB;AAAA,EAClB;AAEA,SACE,6CAAC,SAAI,OAAc,eAAW,kBAAK,OAAO,iBAAiB,SAAS,GAClE;AAAA,iDAAC,SAAI,WAAW,OAAO,eACrB;AAAA,mDAAC,SAAI,WAAW,OAAO,oBACrB;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,eAAW,kBAAK,OAAO,aAAa;AAAA,cAClC,CAAC,OAAO,mBAAmB,GAAG,UAAU;AAAA,YAC1C,CAAC;AAAA,YACD,SAAS,MAAM;AAlD3B;AAmDc,kBAAI,QAAQ,GAAG;AACb,sBAAM,OAAO,QAAQ;AACrB,yBAAS,IAAI;AACb,kCAAY,YAAZ,mBAAqB,KAAK,MAAM;AAAA,cAClC;AAAA,YACF;AAAA,YAEA,sDAAC,6BAAa;AAAA;AAAA,QAChB;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,eAAW,kBAAK,OAAO,aAAa;AAAA,cAClC,CAAC,OAAO,mBAAmB,GAAG,YAAW,+BAAO,WAAU,KAAK;AAAA,YACjE,CAAC;AAAA,YACD,SAAS,MAAM;AAhE3B;AAiEc,oBAAM,QAAO,+BAAO,WAAU,KAAK;AACnC,kBAAI,QAAQ,KAAK;AACf,sBAAM,OAAO,QAAQ;AACrB,yBAAS,IAAI;AACb,kCAAY,YAAZ,mBAAqB,KAAK,MAAM;AAAA,cAClC;AAAA,YACF;AAAA,YAEA,sDAAC,8BAAc;AAAA;AAAA,QACjB;AAAA,SACF;AAAA,MACA,4CAAC,SAAI,WAAW,OAAO,cAAe,aAAG,QAAQ,MAAK,+BAAO,WAAU,KAAI;AAAA,OAC7E;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,MAAM;AAAA,QACN,aAAa;AAAA,QAEZ,yCAAO,IAAI,CAAC,MAAM,UACjB;AAAA,UAAC;AAAA;AAAA,YAEC,WAAW,OAAO;AAAA,YAClB,SAAS,MAAM,YAAY,IAAI;AAAA,YAE/B;AAAA,2DAAC,SAAI,WAAW,OAAO,0BACpB;AAAA,qBAAK,QAAQ,4CAAC,UAAM,eAAK,MAAK;AAAA,gBAC/B,4CAAC,UAAK,WAAW,OAAO,mBAAoB,eAAK,OAAM;AAAA,iBACzD;AAAA,cACC,KAAK,eACJ,4CAAC,SAAI,WAAW,OAAO,yBAA0B,eAAK,aAAY;AAAA;AAAA;AAAA,UAT/D,KAAK,OAAO;AAAA,QAWnB;AAAA;AAAA,IAEJ;AAAA,KACF;AAEJ;AAEA,IAAO,uBAAQ;",
6
+ "names": ["useStyle", "React"]
7
+ }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { SourcesProps, SourcesRef } from "../../types/Sources";
3
+ declare const ForwardSources: React.ForwardRefExoticComponent<SourcesProps & React.RefAttributes<SourcesRef>>;
4
+ export default ForwardSources;
5
+ export type { SourcesProps, SourcesItem, SourcesRef } from "../../types/Sources";
@@ -0,0 +1,162 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/Sources/index.tsx
30
+ var Sources_exports = {};
31
+ __export(Sources_exports, {
32
+ default: () => Sources_default
33
+ });
34
+ module.exports = __toCommonJS(Sources_exports);
35
+ var import_icons = require("@ant-design/icons");
36
+ var import_antd = require("antd");
37
+ var import_clsx = require("clsx");
38
+ var import_react = __toESM(require("react"));
39
+ var import_CarouselCard = __toESM(require("./components/CarouselCard"));
40
+ var import_styles = __toESM(require("./styles"));
41
+ var import_jsx_runtime = require("react/jsx-runtime");
42
+ var Sources = (props, ref) => {
43
+ const {
44
+ style,
45
+ className,
46
+ rootClassName,
47
+ title,
48
+ expandIconPosition = "start",
49
+ inline = false,
50
+ expanded,
51
+ defaultExpanded,
52
+ onExpand,
53
+ activeKey,
54
+ items,
55
+ onClick,
56
+ popoverOverlayWidth = 300,
57
+ ...restProps
58
+ } = props;
59
+ const styles = (0, import_styles.default)();
60
+ const sourcesRef = import_react.default.useRef(null);
61
+ import_react.default.useImperativeHandle(ref, () => ({
62
+ nativeElement: sourcesRef.current
63
+ }));
64
+ const [isExpand, setIsExpand] = (0, import_react.useState)(defaultExpanded ?? true);
65
+ const isControlled = expanded !== void 0;
66
+ const actualExpanded = isControlled ? expanded : isExpand;
67
+ const handleToggle = (0, import_react.useCallback)(() => {
68
+ const newExpand = !actualExpanded;
69
+ if (!isControlled) {
70
+ setIsExpand(newExpand);
71
+ }
72
+ onExpand == null ? void 0 : onExpand(newExpand);
73
+ }, [actualExpanded, isControlled, onExpand]);
74
+ const mergedCls = (0, import_clsx.clsx)(
75
+ styles.sources,
76
+ className,
77
+ rootClassName,
78
+ {
79
+ [styles.sourcesInline]: inline
80
+ }
81
+ );
82
+ const ContentNode = items ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: styles.sourcesList, children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
83
+ "li",
84
+ {
85
+ className: styles.sourcesListItem,
86
+ onClick: () => onClick == null ? void 0 : onClick(item),
87
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
88
+ "a",
89
+ {
90
+ className: styles.sourcesLink,
91
+ href: item.url,
92
+ target: "_blank",
93
+ rel: "noopener noreferrer",
94
+ children: [
95
+ item.icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: styles.sourcesLinkIcon, children: item.icon }),
96
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: styles.sourcesLinkTitle, children: item.title })
97
+ ]
98
+ }
99
+ )
100
+ },
101
+ item.key || index
102
+ )) }) : null;
103
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
104
+ "div",
105
+ {
106
+ ref: sourcesRef,
107
+ className: mergedCls,
108
+ style,
109
+ ...restProps,
110
+ children: inline ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
111
+ import_antd.Popover,
112
+ {
113
+ content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
114
+ import_CarouselCard.default,
115
+ {
116
+ className: (0, import_clsx.clsx)(styles.sources, className),
117
+ style,
118
+ activeKey,
119
+ prefixCls: "sources",
120
+ items,
121
+ onClick
122
+ }
123
+ ),
124
+ open: inline ? void 0 : false,
125
+ overlayStyle: { width: popoverOverlayWidth },
126
+ placement: "top",
127
+ forceRender: true,
128
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.sourcesTitleWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title }) })
129
+ }
130
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
131
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
132
+ "div",
133
+ {
134
+ className: (0, import_clsx.clsx)(
135
+ styles.sourcesTitleWrapper,
136
+ expandIconPosition === "end" && styles.sourcesIconPositionEnd
137
+ ),
138
+ onClick: handleToggle,
139
+ children: [
140
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
141
+ import_icons.RightOutlined,
142
+ {
143
+ className: (0, import_clsx.clsx)(styles.sourcesTitleDownIcon, {
144
+ [styles.sourcesTitleDownIconExpanded]: actualExpanded
145
+ })
146
+ }
147
+ ),
148
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title })
149
+ ]
150
+ }
151
+ ),
152
+ actualExpanded && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.sourcesContent, children: ContentNode })
153
+ ] })
154
+ }
155
+ );
156
+ };
157
+ var ForwardSources = import_react.default.forwardRef(Sources);
158
+ if (process.env.NODE_ENV !== "production") {
159
+ ForwardSources.displayName = "Sources";
160
+ }
161
+ var Sources_default = ForwardSources;
162
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/components/Sources/index.tsx"],
4
+ "sourcesContent": ["import { RightOutlined } from '@ant-design/icons';\nimport { Popover } from 'antd';\nimport { clsx } from 'clsx';\nimport React, { useState, useCallback } from 'react';\nimport type { SourcesProps, SourcesRef } from '@/types/Sources';\nimport CarouselCard from './components/CarouselCard';\nimport useStyle from './styles';\n\nconst Sources: React.ForwardRefRenderFunction<SourcesRef, SourcesProps> = (props, ref) => {\n const {\n style,\n className,\n rootClassName,\n title,\n expandIconPosition = 'start',\n inline = false,\n expanded,\n defaultExpanded,\n onExpand,\n activeKey,\n items,\n onClick,\n popoverOverlayWidth = 300,\n ...restProps\n } = props;\n\n const styles = useStyle();\n\n const sourcesRef = React.useRef<HTMLDivElement>(null);\n React.useImperativeHandle(ref, () => ({\n nativeElement: sourcesRef.current!,\n }));\n\n // ============================ Collapsible ============================\n const [isExpand, setIsExpand] = useState<boolean>(defaultExpanded ?? true);\n const isControlled = expanded !== undefined;\n const actualExpanded = isControlled ? expanded : isExpand;\n\n const handleToggle = useCallback(() => {\n const newExpand = !actualExpanded;\n if (!isControlled) {\n setIsExpand(newExpand);\n }\n onExpand?.(newExpand);\n }, [actualExpanded, isControlled, onExpand]);\n\n const mergedCls = clsx(\n styles.sources,\n className,\n rootClassName,\n {\n [styles.sourcesInline]: inline,\n },\n );\n\n const ContentNode = items ? (\n <ul className={styles.sourcesList}>\n {items.map((item, index) => (\n <li\n key={item.key || index}\n className={styles.sourcesListItem}\n onClick={() => onClick?.(item)}\n >\n <a\n className={styles.sourcesLink}\n href={item.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {item.icon && <span className={styles.sourcesLinkIcon}>{item.icon}</span>}\n <span className={styles.sourcesLinkTitle}>{item.title}</span>\n </a>\n </li>\n ))}\n </ul>\n ) : null;\n\n return (\n <div\n ref={sourcesRef}\n className={mergedCls}\n style={style}\n {...restProps}\n >\n {inline ? (\n <Popover\n content={\n <CarouselCard\n className={clsx(styles.sources, className)}\n style={style}\n activeKey={activeKey}\n prefixCls=\"sources\"\n items={items}\n onClick={onClick}\n />\n }\n open={inline ? undefined : false}\n overlayStyle={{ width: popoverOverlayWidth }}\n placement=\"top\"\n forceRender\n >\n <div className={styles.sourcesTitleWrapper}>\n <span>{title}</span>\n </div>\n </Popover>\n ) : (\n <>\n <div\n className={clsx(\n styles.sourcesTitleWrapper,\n expandIconPosition === 'end' && styles.sourcesIconPositionEnd,\n )}\n onClick={handleToggle}\n >\n <RightOutlined\n className={clsx(styles.sourcesTitleDownIcon, {\n [styles.sourcesTitleDownIconExpanded]: actualExpanded,\n })}\n />\n <span>{title}</span>\n </div>\n {actualExpanded && (\n <div className={styles.sourcesContent}>\n {ContentNode}\n </div>\n )}\n </>\n )}\n </div>\n );\n};\n\nconst ForwardSources = React.forwardRef(Sources);\n\nif (process.env.NODE_ENV !== 'production') {\n ForwardSources.displayName = 'Sources';\n}\n\nexport default ForwardSources;\nexport type { SourcesProps, SourcesItem, SourcesRef } from '@/types/Sources';"],
5
+ "mappings": "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",
6
+ "names": ["useStyle", "React", "CarouselCard"]
7
+ }
@@ -0,0 +1,59 @@
1
+ export declare const useStyles: () => {
2
+ sources: string;
3
+ sourcesTitleWrapper: string;
4
+ sourcesTitleDownIcon: string;
5
+ sourcesTitleDownIconExpanded: string;
6
+ sourcesIconPositionEnd: string;
7
+ sourcesList: string;
8
+ sourcesListItem: string;
9
+ sourcesLink: string;
10
+ sourcesLinkIcon: string;
11
+ sourcesLinkTitle: string;
12
+ sourcesContent: string;
13
+ sourcesContentHidden: string;
14
+ sourcesInline: string;
15
+ carouselWrapper: string;
16
+ carouselTitle: string;
17
+ carouselBtnWrapper: string;
18
+ carouselBtn: string;
19
+ carouselBtnDisabled: string;
20
+ carouselPage: string;
21
+ carouselItem: string;
22
+ carouselItemTitleWrapper: string;
23
+ carouselItemTitle: string;
24
+ carouselItemDescription: string;
25
+ } & {
26
+ w: (width: string | number) => string;
27
+ h: (height: string | number) => string;
28
+ p: (padding: string) => string;
29
+ pb: (padding: string | number) => string;
30
+ pt: (padding: string | number) => string;
31
+ pl: (padding: string | number) => string;
32
+ pr: (padding: string | number) => string;
33
+ m: (margin: string) => string;
34
+ mb: (margin: string | number) => string;
35
+ mt: (margin: string | number) => string;
36
+ ml: (margin: string | number) => string;
37
+ mr: (margin: string | number) => string;
38
+ text: (size: string | number) => string;
39
+ weight: (size: number) => string;
40
+ textColor: (c: string) => string;
41
+ bg: (c: string) => string;
42
+ rs: (radius: string | number) => string;
43
+ gap: (g: string | number) => string;
44
+ flex: string;
45
+ flexCenter: string;
46
+ flexBetween: string;
47
+ flexColumn: string;
48
+ flex1: string;
49
+ cursor: (type: string) => string;
50
+ border: (color: string, width?: string) => string;
51
+ boxShadow: (shadow: string) => string;
52
+ transition: (property?: string, duration?: string) => string;
53
+ overflow: (type: string) => string;
54
+ position: (type: string) => string;
55
+ zIndex: (index: number) => string;
56
+ flexCenterGap2: string;
57
+ flexCenterGap4: string;
58
+ };
59
+ export default useStyles;
@@ -0,0 +1,179 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/Sources/styles.tsx
20
+ var styles_exports = {};
21
+ __export(styles_exports, {
22
+ default: () => styles_default,
23
+ useStyles: () => useStyles
24
+ });
25
+ module.exports = __toCommonJS(styles_exports);
26
+ var import_css = require("@emotion/css");
27
+ var import_common = require("../../styles/common");
28
+ var useStyles = (0, import_common.withBasicStyles)(() => ({
29
+ sources: import_css.css`
30
+ position: relative;
31
+ `,
32
+ sourcesTitleWrapper: import_css.css`
33
+ display: flex;
34
+ flex-direction: row;
35
+ gap: 8px;
36
+ align-items: center;
37
+ font-size: 14px;
38
+ color: #888;
39
+ line-height: 1.5;
40
+ cursor: pointer;
41
+ margin-bottom: 12px;
42
+ width: fit-content;
43
+ `,
44
+ sourcesTitleDownIcon: import_css.css`
45
+ font-size: 12px;
46
+ transition: transform 0.3s ease;
47
+ `,
48
+ sourcesTitleDownIconExpanded: import_css.css`
49
+ transform: rotate(90deg);
50
+ `,
51
+ sourcesIconPositionEnd: import_css.css`
52
+ .sources-title-down-icon {
53
+ order: 1;
54
+ }
55
+ `,
56
+ sourcesList: import_css.css`
57
+ list-style: none;
58
+ margin: 0;
59
+ padding: 0;
60
+ ul, ol {
61
+ margin: 0;
62
+ padding: 0;
63
+ list-style: none;
64
+ }
65
+ `,
66
+ sourcesListItem: import_css.css`
67
+ margin-bottom: 8px;
68
+ `,
69
+ sourcesLink: import_css.css`
70
+ color: #333;
71
+ display: flex;
72
+ gap: 4px;
73
+ text-decoration: none;
74
+ &:hover {
75
+ color: #1677ff;
76
+ }
77
+ `,
78
+ sourcesLinkIcon: import_css.css`
79
+ flex-shrink: 0;
80
+ `,
81
+ sourcesLinkTitle: import_css.css`
82
+ overflow: hidden;
83
+ text-overflow: ellipsis;
84
+ white-space: nowrap;
85
+ `,
86
+ sourcesContent: import_css.css`
87
+ overflow: hidden;
88
+ transition: all 0.3s ease;
89
+ `,
90
+ sourcesContentHidden: import_css.css`
91
+ display: none;
92
+ `,
93
+ sourcesInline: import_css.css`
94
+ display: inline-flex;
95
+ .sources-title-wrapper {
96
+ background: #f5f5f5;
97
+ border-radius: 10px;
98
+ height: 24px;
99
+ line-height: 24px;
100
+ font-size: 12px;
101
+ color: #888;
102
+ font-weight: 400;
103
+ padding-inline: 6px;
104
+ padding-block: 0;
105
+ margin-inline: 4px;
106
+ margin-block: 0;
107
+ }
108
+ `,
109
+ // ========== Carousel 相关 ==========
110
+ carouselWrapper: import_css.css`
111
+ min-width: 260px;
112
+ `,
113
+ carouselTitle: import_css.css`
114
+ display: flex;
115
+ justify-content: space-between;
116
+ align-items: center;
117
+ margin-bottom: 8px;
118
+ `,
119
+ carouselBtnWrapper: import_css.css`
120
+ display: flex;
121
+ gap: 4px;
122
+ `,
123
+ carouselBtn: import_css.css`
124
+ display: inline-flex;
125
+ align-items: center;
126
+ justify-content: center;
127
+ cursor: pointer;
128
+ height: 32px;
129
+ width: 32px;
130
+ border-radius: 6px;
131
+ transition: background 0.2s ease;
132
+ &:not(.carousel-btn-disabled):hover {
133
+ background: #f5f5f5;
134
+ }
135
+ `,
136
+ carouselBtnDisabled: import_css.css`
137
+ opacity: 0.4;
138
+ cursor: not-allowed;
139
+ pointer-events: none;
140
+ `,
141
+ carouselPage: import_css.css`
142
+ font-size: 12px;
143
+ color: #888;
144
+ `,
145
+ carouselItem: import_css.css`
146
+ padding: 8px;
147
+ box-sizing: border-box;
148
+ font-size: 14px;
149
+ line-height: 1.5;
150
+ cursor: pointer;
151
+ `,
152
+ carouselItemTitleWrapper: import_css.css`
153
+ display: flex;
154
+ gap: 4px;
155
+ align-items: center;
156
+ `,
157
+ carouselItemTitle: import_css.css`
158
+ overflow: hidden;
159
+ text-overflow: ellipsis;
160
+ white-space: nowrap;
161
+ `,
162
+ carouselItemDescription: import_css.css`
163
+ opacity: 0.8;
164
+ display: -webkit-box;
165
+ overflow: hidden;
166
+ -webkit-box-orient: vertical;
167
+ -webkit-line-clamp: 3;
168
+ text-overflow: ellipsis;
169
+ margin-top: 4px;
170
+ font-size: 12px;
171
+ color: #888;
172
+ `
173
+ }));
174
+ var styles_default = useStyles;
175
+ // Annotate the CommonJS export names for ESM import in node:
176
+ 0 && (module.exports = {
177
+ useStyles
178
+ });
179
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/components/Sources/styles.tsx"],
4
+ "sourcesContent": ["import { css } from \"@emotion/css\";\nimport { withBasicStyles } from \"@/styles/common\";\n\nexport const useStyles = withBasicStyles(() => ({\n sources: css`\n position: relative;\n `,\n\n sourcesTitleWrapper: css`\n display: flex;\n flex-direction: row;\n gap: 8px;\n align-items: center;\n font-size: 14px;\n color: #888;\n line-height: 1.5;\n cursor: pointer;\n margin-bottom: 12px;\n width: fit-content;\n `,\n\n sourcesTitleDownIcon: css`\n font-size: 12px;\n transition: transform 0.3s ease;\n `,\n\n sourcesTitleDownIconExpanded: css`\n transform: rotate(90deg);\n `,\n\n sourcesIconPositionEnd: css`\n .sources-title-down-icon {\n order: 1;\n }\n `,\n\n sourcesList: css`\n list-style: none;\n margin: 0;\n padding: 0;\n ul, ol {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n `,\n\n sourcesListItem: css`\n margin-bottom: 8px;\n `,\n\n sourcesLink: css`\n color: #333;\n display: flex;\n gap: 4px;\n text-decoration: none;\n &:hover {\n color: #1677ff;\n }\n `,\n\n sourcesLinkIcon: css`\n flex-shrink: 0;\n `,\n\n sourcesLinkTitle: css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n\n sourcesContent: css`\n overflow: hidden;\n transition: all 0.3s ease;\n `,\n\n sourcesContentHidden: css`\n display: none;\n `,\n\n sourcesInline: css`\n display: inline-flex;\n .sources-title-wrapper {\n background: #f5f5f5;\n border-radius: 10px;\n height: 24px;\n line-height: 24px;\n font-size: 12px;\n color: #888;\n font-weight: 400;\n padding-inline: 6px;\n padding-block: 0;\n margin-inline: 4px;\n margin-block: 0;\n }\n `,\n\n // ========== Carousel 相关 ==========\n carouselWrapper: css`\n min-width: 260px;\n `,\n\n carouselTitle: css`\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 8px;\n `,\n\n carouselBtnWrapper: css`\n display: flex;\n gap: 4px;\n `,\n\n carouselBtn: css`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n height: 32px;\n width: 32px;\n border-radius: 6px;\n transition: background 0.2s ease;\n &:not(.carousel-btn-disabled):hover {\n background: #f5f5f5;\n }\n `,\n\n carouselBtnDisabled: css`\n opacity: 0.4;\n cursor: not-allowed;\n pointer-events: none;\n `,\n\n carouselPage: css`\n font-size: 12px;\n color: #888;\n `,\n\n carouselItem: css`\n padding: 8px;\n box-sizing: border-box;\n font-size: 14px;\n line-height: 1.5;\n cursor: pointer;\n `,\n\n carouselItemTitleWrapper: css`\n display: flex;\n gap: 4px;\n align-items: center;\n `,\n\n carouselItemTitle: css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n\n carouselItemDescription: css`\n opacity: 0.8;\n display: -webkit-box;\n overflow: hidden;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n text-overflow: ellipsis;\n margin-top: 4px;\n font-size: 12px;\n color: #888;\n `,\n}));\n\nexport default useStyles;"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoB;AACpB,oBAAgC;AAEzB,IAAM,gBAAY,+BAAgB,OAAO;AAAA,EAC9C,SAAS;AAAA;AAAA;AAAA,EAIT,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAarB,sBAAsB;AAAA;AAAA;AAAA;AAAA,EAKtB,8BAA8B;AAAA;AAAA;AAAA,EAI9B,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMxB,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWb,iBAAiB;AAAA;AAAA;AAAA,EAIjB,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUb,iBAAiB;AAAA;AAAA;AAAA,EAIjB,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMlB,gBAAgB;AAAA;AAAA;AAAA;AAAA,EAKhB,sBAAsB;AAAA;AAAA;AAAA,EAItB,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBf,iBAAiB;AAAA;AAAA;AAAA,EAIjB,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOf,oBAAoB;AAAA;AAAA;AAAA;AAAA,EAKpB,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcb,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMrB,cAAc;AAAA;AAAA;AAAA;AAAA,EAKd,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQd,0BAA0B;AAAA;AAAA;AAAA;AAAA;AAAA,EAM1B,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMnB,yBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAW3B,EAAE;AAEF,IAAO,iBAAQ;",
6
+ "names": []
7
+ }
@@ -1,8 +1,9 @@
1
1
  import React from "react";
2
- import type { InlineTagRenderInfo, InputTag } from "../../types";
2
+ import type { InlineTagRenderInfo, InputTag, XAdkSenderSubmitPart } from "../../types";
3
3
  export interface InlineTagInputRef {
4
4
  focus: () => void;
5
5
  getText: () => string;
6
+ getParts: () => XAdkSenderSubmitPart[];
6
7
  getCursorOffset: () => number;
7
8
  insertTag: (tag: InputTag, replace?: {
8
9
  start: number;
@@ -81,6 +81,28 @@ var InlineTagInput = (0, import_react.forwardRef)(
81
81
  });
82
82
  return normalizeText(text);
83
83
  }, []);
84
+ const getParts = (0, import_react.useCallback)(() => {
85
+ const editor = editorRef.current;
86
+ if (!editor)
87
+ return [];
88
+ const tagMap = new Map(latestTagsRef.current.map((tag) => [tag.id, tag]));
89
+ const parts = [];
90
+ editor.childNodes.forEach((node) => {
91
+ if (node.nodeType === Node.TEXT_NODE) {
92
+ const text = normalizeText(node.textContent || "");
93
+ if (text)
94
+ parts.push({ type: "text", text });
95
+ return;
96
+ }
97
+ if (node instanceof HTMLElement && node.hasAttribute(TAG_ATTR)) {
98
+ const tagId = node.dataset.xadkInlineTagId || "";
99
+ const tag = tagMap.get(tagId);
100
+ if (tag)
101
+ parts.push({ type: "tag", tag });
102
+ }
103
+ });
104
+ return parts;
105
+ }, []);
84
106
  const emitChange = (0, import_react.useCallback)(() => {
85
107
  onChange(getPlainText());
86
108
  onTagsChange(getOrderedTags());
@@ -366,9 +388,10 @@ var InlineTagInput = (0, import_react.forwardRef)(
366
388
  return (_a = editorRef.current) == null ? void 0 : _a.focus();
367
389
  },
368
390
  getText: getPlainText,
391
+ getParts,
369
392
  getCursorOffset: getOffsetInEditor,
370
393
  insertTag
371
- }), [getOffsetInEditor, getPlainText, insertTag]);
394
+ }), [getOffsetInEditor, getParts, getPlainText, insertTag]);
372
395
  (0, import_react.useEffect)(() => {
373
396
  const editor = editorRef.current;
374
397
  if (!editor || editor.childNodes.length > 0)
@@ -431,11 +454,12 @@ var InlineTagInput = (0, import_react.forwardRef)(
431
454
  }
432
455
  onKeyDown == null ? void 0 : onKeyDown(event);
433
456
  };
434
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.inlineInputWrapper, "data-placeholder": placeholder, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
457
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: styles.inlineInputWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
435
458
  "div",
436
459
  {
437
460
  ref: editorRef,
438
461
  className: styles.inlineInput,
462
+ "data-placeholder": placeholder,
439
463
  contentEditable: !disabled,
440
464
  suppressContentEditableWarning: true,
441
465
  role: "textbox",