@x-plat/design-system 0.5.64 → 0.5.65

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,118 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/components/AutoResizeTextArea/index.ts
31
+ var AutoResizeTextArea_exports = {};
32
+ __export(AutoResizeTextArea_exports, {
33
+ AutoResizeTextArea: () => AutoResizeTextArea_default
34
+ });
35
+ module.exports = __toCommonJS(AutoResizeTextArea_exports);
36
+
37
+ // src/components/AutoResizeTextArea/AutoResizeTextArea.tsx
38
+ var import_react = __toESM(require("react"), 1);
39
+
40
+ // ../../node_modules/clsx/dist/clsx.mjs
41
+ function r(e) {
42
+ var t, f, n = "";
43
+ if ("string" == typeof e || "number" == typeof e) n += e;
44
+ else if ("object" == typeof e) if (Array.isArray(e)) {
45
+ var o = e.length;
46
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
47
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
48
+ return n;
49
+ }
50
+ function clsx() {
51
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
52
+ return n;
53
+ }
54
+ var clsx_default = clsx;
55
+
56
+ // src/components/AutoResizeTextArea/AutoResizeTextArea.tsx
57
+ var import_jsx_runtime = require("react/jsx-runtime");
58
+ var MAX_HEIGHT = 400;
59
+ var AutoResizeTextArea = import_react.default.forwardRef(
60
+ (props, ref) => {
61
+ const { value, className, onChange, disabled, bare = false, ...textareaProps } = props;
62
+ const localRef = import_react.default.useRef(null);
63
+ const setRefs = (el) => {
64
+ localRef.current = el;
65
+ if (!ref) return;
66
+ if (typeof ref === "function") ref(el);
67
+ else if (ref && "current" in ref)
68
+ ref.current = el;
69
+ };
70
+ const updateHeight = () => {
71
+ const el = localRef.current;
72
+ if (!el) return;
73
+ el.style.height = "0px";
74
+ el.style.height = `${Math.min(el.scrollHeight, MAX_HEIGHT)}px`;
75
+ };
76
+ const handleChange = (e) => {
77
+ if (onChange) {
78
+ const event = {
79
+ ...e,
80
+ target: { value: e.target.value }
81
+ };
82
+ onChange(event);
83
+ }
84
+ };
85
+ import_react.default.useEffect(() => {
86
+ updateHeight();
87
+ }, [value]);
88
+ if (bare) {
89
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
90
+ "textarea",
91
+ {
92
+ ...textareaProps,
93
+ ref: setRefs,
94
+ className,
95
+ disabled,
96
+ value,
97
+ onChange: handleChange
98
+ }
99
+ );
100
+ }
101
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: clsx_default("lib-xplat-auto-resize-textarea-wrapper", className), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: clsx_default("lib-xplat-auto-resize-textarea", disabled && "disabled"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
102
+ "textarea",
103
+ {
104
+ ...textareaProps,
105
+ ref: setRefs,
106
+ disabled,
107
+ value,
108
+ onChange: handleChange
109
+ }
110
+ ) }) });
111
+ }
112
+ );
113
+ AutoResizeTextArea.displayName = "AutoResizeTextArea";
114
+ var AutoResizeTextArea_default = AutoResizeTextArea;
115
+ // Annotate the CommonJS export names for ESM import in node:
116
+ 0 && (module.exports = {
117
+ AutoResizeTextArea
118
+ });
@@ -0,0 +1,46 @@
1
+ /* src/components/AutoResizeTextArea/autoResizeTextArea.scss */
2
+ .lib-xplat-auto-resize-textarea-wrapper {
3
+ display: flex;
4
+ flex-direction: column;
5
+ gap: var(--spacing-space-2);
6
+ }
7
+ .lib-xplat-auto-resize-textarea-wrapper .lib-xplat-auto-resize-textarea {
8
+ display: flex;
9
+ align-items: center;
10
+ border: 1px solid var(--semantic-border-default);
11
+ border-radius: var(--spacing-radius-md);
12
+ min-height: var(--spacing-control-height-md);
13
+ overflow: hidden;
14
+ background-color: var(--semantic-surface-neutral-default);
15
+ width: 100%;
16
+ transition: border-color 0.15s, box-shadow 0.15s;
17
+ }
18
+ .lib-xplat-auto-resize-textarea-wrapper .lib-xplat-auto-resize-textarea:hover:not(.disabled):not(:focus-within) {
19
+ border-color: var(--semantic-border-strong);
20
+ }
21
+ .lib-xplat-auto-resize-textarea-wrapper .lib-xplat-auto-resize-textarea:focus-within {
22
+ border-color: var(--semantic-interaction-focus-ring);
23
+ box-shadow: 0 0 0 2px var(--semantic-interaction-overlay-10);
24
+ }
25
+ .lib-xplat-auto-resize-textarea-wrapper .lib-xplat-auto-resize-textarea:has(> textarea:not(:placeholder-shown)):not(:focus-within) {
26
+ border-color: var(--semantic-border-strong);
27
+ }
28
+ .lib-xplat-auto-resize-textarea-wrapper .lib-xplat-auto-resize-textarea.disabled {
29
+ background-color: var(--semantic-surface-neutral-disabled);
30
+ cursor: not-allowed;
31
+ }
32
+ .lib-xplat-auto-resize-textarea-wrapper .lib-xplat-auto-resize-textarea > textarea {
33
+ border: none;
34
+ outline: none;
35
+ flex: 1;
36
+ padding: var(--spacing-space-2) var(--spacing-space-4);
37
+ width: 100%;
38
+ color: var(--semantic-text-subtle);
39
+ resize: none;
40
+ font-size: var(--semantic-typo-label-2-m-size);
41
+ line-height: var(--semantic-typo-label-2-m-lh);
42
+ font-family: inherit;
43
+ }
44
+ .lib-xplat-auto-resize-textarea-wrapper .lib-xplat-auto-resize-textarea > textarea:disabled {
45
+ cursor: not-allowed;
46
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { T as TextareaAttributes } from '../../attributes-DJIWir_0.cjs';
3
+
4
+ interface AutoResizeTextAreaProps extends TextareaAttributes {
5
+ /** ChatInput 등 내부 임베딩 시 wrapper 없이 textarea만 렌더 */
6
+ bare?: boolean;
7
+ }
8
+ declare const AutoResizeTextArea: React.ForwardRefExoticComponent<AutoResizeTextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
9
+
10
+ export { AutoResizeTextArea };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { T as TextareaAttributes } from '../../attributes-DJIWir_0.js';
3
+
4
+ interface AutoResizeTextAreaProps extends TextareaAttributes {
5
+ /** ChatInput 등 내부 임베딩 시 wrapper 없이 textarea만 렌더 */
6
+ bare?: boolean;
7
+ }
8
+ declare const AutoResizeTextArea: React.ForwardRefExoticComponent<AutoResizeTextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
9
+
10
+ export { AutoResizeTextArea };
@@ -0,0 +1,81 @@
1
+ // src/components/AutoResizeTextArea/AutoResizeTextArea.tsx
2
+ import React from "react";
3
+
4
+ // ../../node_modules/clsx/dist/clsx.mjs
5
+ function r(e) {
6
+ var t, f, n = "";
7
+ if ("string" == typeof e || "number" == typeof e) n += e;
8
+ else if ("object" == typeof e) if (Array.isArray(e)) {
9
+ var o = e.length;
10
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
11
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
12
+ return n;
13
+ }
14
+ function clsx() {
15
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
16
+ return n;
17
+ }
18
+ var clsx_default = clsx;
19
+
20
+ // src/components/AutoResizeTextArea/AutoResizeTextArea.tsx
21
+ import { jsx } from "react/jsx-runtime";
22
+ var MAX_HEIGHT = 400;
23
+ var AutoResizeTextArea = React.forwardRef(
24
+ (props, ref) => {
25
+ const { value, className, onChange, disabled, bare = false, ...textareaProps } = props;
26
+ const localRef = React.useRef(null);
27
+ const setRefs = (el) => {
28
+ localRef.current = el;
29
+ if (!ref) return;
30
+ if (typeof ref === "function") ref(el);
31
+ else if (ref && "current" in ref)
32
+ ref.current = el;
33
+ };
34
+ const updateHeight = () => {
35
+ const el = localRef.current;
36
+ if (!el) return;
37
+ el.style.height = "0px";
38
+ el.style.height = `${Math.min(el.scrollHeight, MAX_HEIGHT)}px`;
39
+ };
40
+ const handleChange = (e) => {
41
+ if (onChange) {
42
+ const event = {
43
+ ...e,
44
+ target: { value: e.target.value }
45
+ };
46
+ onChange(event);
47
+ }
48
+ };
49
+ React.useEffect(() => {
50
+ updateHeight();
51
+ }, [value]);
52
+ if (bare) {
53
+ return /* @__PURE__ */ jsx(
54
+ "textarea",
55
+ {
56
+ ...textareaProps,
57
+ ref: setRefs,
58
+ className,
59
+ disabled,
60
+ value,
61
+ onChange: handleChange
62
+ }
63
+ );
64
+ }
65
+ return /* @__PURE__ */ jsx("div", { className: clsx_default("lib-xplat-auto-resize-textarea-wrapper", className), children: /* @__PURE__ */ jsx("div", { className: clsx_default("lib-xplat-auto-resize-textarea", disabled && "disabled"), children: /* @__PURE__ */ jsx(
66
+ "textarea",
67
+ {
68
+ ...textareaProps,
69
+ ref: setRefs,
70
+ disabled,
71
+ value,
72
+ onChange: handleChange
73
+ }
74
+ ) }) });
75
+ }
76
+ );
77
+ AutoResizeTextArea.displayName = "AutoResizeTextArea";
78
+ var AutoResizeTextArea_default = AutoResizeTextArea;
79
+ export {
80
+ AutoResizeTextArea_default as AutoResizeTextArea
81
+ };
@@ -35,7 +35,7 @@ __export(ChatInput_exports, {
35
35
  module.exports = __toCommonJS(ChatInput_exports);
36
36
 
37
37
  // src/components/ChatInput/ChatInput.tsx
38
- var import_react = __toESM(require("react"), 1);
38
+ var import_react2 = __toESM(require("react"), 1);
39
39
 
40
40
  // ../../node_modules/clsx/dist/clsx.mjs
41
41
  function r(e) {
@@ -110,10 +110,70 @@ var import_jsx_runtime7 = require("react/jsx-runtime");
110
110
  // src/tokens/svg/communication/SendIcon.tsx
111
111
  var import_jsx_runtime8 = require("react/jsx-runtime");
112
112
 
113
- // src/components/ChatInput/ChatInput.tsx
113
+ // src/components/AutoResizeTextArea/AutoResizeTextArea.tsx
114
+ var import_react = __toESM(require("react"), 1);
114
115
  var import_jsx_runtime9 = require("react/jsx-runtime");
115
- var MAX_HEIGHT = 200;
116
- var ChatInput = import_react.default.forwardRef(
116
+ var MAX_HEIGHT = 400;
117
+ var AutoResizeTextArea = import_react.default.forwardRef(
118
+ (props, ref) => {
119
+ const { value, className, onChange, disabled, bare = false, ...textareaProps } = props;
120
+ const localRef = import_react.default.useRef(null);
121
+ const setRefs = (el) => {
122
+ localRef.current = el;
123
+ if (!ref) return;
124
+ if (typeof ref === "function") ref(el);
125
+ else if (ref && "current" in ref)
126
+ ref.current = el;
127
+ };
128
+ const updateHeight = () => {
129
+ const el = localRef.current;
130
+ if (!el) return;
131
+ el.style.height = "0px";
132
+ el.style.height = `${Math.min(el.scrollHeight, MAX_HEIGHT)}px`;
133
+ };
134
+ const handleChange = (e) => {
135
+ if (onChange) {
136
+ const event = {
137
+ ...e,
138
+ target: { value: e.target.value }
139
+ };
140
+ onChange(event);
141
+ }
142
+ };
143
+ import_react.default.useEffect(() => {
144
+ updateHeight();
145
+ }, [value]);
146
+ if (bare) {
147
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
148
+ "textarea",
149
+ {
150
+ ...textareaProps,
151
+ ref: setRefs,
152
+ className,
153
+ disabled,
154
+ value,
155
+ onChange: handleChange
156
+ }
157
+ );
158
+ }
159
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: clsx_default("lib-xplat-auto-resize-textarea-wrapper", className), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: clsx_default("lib-xplat-auto-resize-textarea", disabled && "disabled"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
160
+ "textarea",
161
+ {
162
+ ...textareaProps,
163
+ ref: setRefs,
164
+ disabled,
165
+ value,
166
+ onChange: handleChange
167
+ }
168
+ ) }) });
169
+ }
170
+ );
171
+ AutoResizeTextArea.displayName = "AutoResizeTextArea";
172
+ var AutoResizeTextArea_default = AutoResizeTextArea;
173
+
174
+ // src/components/ChatInput/ChatInput.tsx
175
+ var import_jsx_runtime10 = require("react/jsx-runtime");
176
+ var ChatInput = import_react2.default.forwardRef(
117
177
  (props, ref) => {
118
178
  const {
119
179
  placeholder,
@@ -124,24 +184,9 @@ var ChatInput = import_react.default.forwardRef(
124
184
  onChange
125
185
  } = props;
126
186
  const isControlled = valueProp !== void 0;
127
- const [internalValue, setInternalValue] = import_react.default.useState("");
187
+ const [internalValue, setInternalValue] = import_react2.default.useState("");
128
188
  const value = isControlled ? valueProp : internalValue;
129
189
  const hasText = value.trim().length > 0;
130
- const textareaRef = import_react.default.useRef(null);
131
- const setRefs = import_react.default.useCallback(
132
- (el) => {
133
- textareaRef.current = el;
134
- if (typeof ref === "function") ref(el);
135
- else if (ref) ref.current = el;
136
- },
137
- [ref]
138
- );
139
- const updateHeight = import_react.default.useCallback(() => {
140
- const el = textareaRef.current;
141
- if (!el) return;
142
- el.style.height = "0px";
143
- el.style.height = `${Math.min(el.scrollHeight, MAX_HEIGHT)}px`;
144
- }, []);
145
190
  const handleChange = (e) => {
146
191
  const val = e.target.value;
147
192
  if (!isControlled) setInternalValue(val);
@@ -151,7 +196,6 @@ var ChatInput = import_react.default.forwardRef(
151
196
  if (!hasText || disabled) return;
152
197
  onSubmit?.(value);
153
198
  if (!isControlled) setInternalValue("");
154
- requestAnimationFrame(updateHeight);
155
199
  };
156
200
  const handleKeyDown = (e) => {
157
201
  if (e.key === "Enter" && !e.shiftKey) {
@@ -159,14 +203,12 @@ var ChatInput = import_react.default.forwardRef(
159
203
  handleSubmit();
160
204
  }
161
205
  };
162
- import_react.default.useEffect(() => {
163
- updateHeight();
164
- }, [value, updateHeight]);
165
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: clsx_default("lib-xplat-chat-input", disabled && "disabled"), children: [
166
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
167
- "textarea",
206
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: clsx_default("lib-xplat-chat-input", disabled && "disabled"), children: [
207
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
208
+ AutoResizeTextArea_default,
168
209
  {
169
- ref: setRefs,
210
+ ref,
211
+ bare: true,
170
212
  className: "chat-input-textarea",
171
213
  placeholder,
172
214
  value,
@@ -176,10 +218,10 @@ var ChatInput = import_react.default.forwardRef(
176
218
  onKeyDown: handleKeyDown
177
219
  }
178
220
  ),
179
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
221
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
180
222
  IconButton_default,
181
223
  {
182
- icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MessageSquareIcon_default, {}),
224
+ icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MessageSquareIcon_default, {}),
183
225
  type: buttonType,
184
226
  size: "sm",
185
227
  disabled: !hasText || disabled,
@@ -76,6 +76,53 @@
76
76
  outline-offset: 2px;
77
77
  }
78
78
 
79
+ /* src/components/AutoResizeTextArea/autoResizeTextArea.scss */
80
+ .lib-xplat-auto-resize-textarea-wrapper {
81
+ display: flex;
82
+ flex-direction: column;
83
+ gap: var(--spacing-space-2);
84
+ }
85
+ .lib-xplat-auto-resize-textarea-wrapper .lib-xplat-auto-resize-textarea {
86
+ display: flex;
87
+ align-items: center;
88
+ border: 1px solid var(--semantic-border-default);
89
+ border-radius: var(--spacing-radius-md);
90
+ min-height: var(--spacing-control-height-md);
91
+ overflow: hidden;
92
+ background-color: var(--semantic-surface-neutral-default);
93
+ width: 100%;
94
+ transition: border-color 0.15s, box-shadow 0.15s;
95
+ }
96
+ .lib-xplat-auto-resize-textarea-wrapper .lib-xplat-auto-resize-textarea:hover:not(.disabled):not(:focus-within) {
97
+ border-color: var(--semantic-border-strong);
98
+ }
99
+ .lib-xplat-auto-resize-textarea-wrapper .lib-xplat-auto-resize-textarea:focus-within {
100
+ border-color: var(--semantic-interaction-focus-ring);
101
+ box-shadow: 0 0 0 2px var(--semantic-interaction-overlay-10);
102
+ }
103
+ .lib-xplat-auto-resize-textarea-wrapper .lib-xplat-auto-resize-textarea:has(> textarea:not(:placeholder-shown)):not(:focus-within) {
104
+ border-color: var(--semantic-border-strong);
105
+ }
106
+ .lib-xplat-auto-resize-textarea-wrapper .lib-xplat-auto-resize-textarea.disabled {
107
+ background-color: var(--semantic-surface-neutral-disabled);
108
+ cursor: not-allowed;
109
+ }
110
+ .lib-xplat-auto-resize-textarea-wrapper .lib-xplat-auto-resize-textarea > textarea {
111
+ border: none;
112
+ outline: none;
113
+ flex: 1;
114
+ padding: var(--spacing-space-2) var(--spacing-space-4);
115
+ width: 100%;
116
+ color: var(--semantic-text-subtle);
117
+ resize: none;
118
+ font-size: var(--semantic-typo-label-2-m-size);
119
+ line-height: var(--semantic-typo-label-2-m-lh);
120
+ font-family: inherit;
121
+ }
122
+ .lib-xplat-auto-resize-textarea-wrapper .lib-xplat-auto-resize-textarea > textarea:disabled {
123
+ cursor: not-allowed;
124
+ }
125
+
79
126
  /* src/components/ChatInput/chatInput.scss */
80
127
  .lib-xplat-chat-input {
81
128
  display: flex;
@@ -1,5 +1,5 @@
1
1
  // src/components/ChatInput/ChatInput.tsx
2
- import React from "react";
2
+ import React2 from "react";
3
3
 
4
4
  // ../../node_modules/clsx/dist/clsx.mjs
5
5
  function r(e) {
@@ -74,10 +74,70 @@ import { jsx as jsx7 } from "react/jsx-runtime";
74
74
  // src/tokens/svg/communication/SendIcon.tsx
75
75
  import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
76
76
 
77
+ // src/components/AutoResizeTextArea/AutoResizeTextArea.tsx
78
+ import React from "react";
79
+ import { jsx as jsx9 } from "react/jsx-runtime";
80
+ var MAX_HEIGHT = 400;
81
+ var AutoResizeTextArea = React.forwardRef(
82
+ (props, ref) => {
83
+ const { value, className, onChange, disabled, bare = false, ...textareaProps } = props;
84
+ const localRef = React.useRef(null);
85
+ const setRefs = (el) => {
86
+ localRef.current = el;
87
+ if (!ref) return;
88
+ if (typeof ref === "function") ref(el);
89
+ else if (ref && "current" in ref)
90
+ ref.current = el;
91
+ };
92
+ const updateHeight = () => {
93
+ const el = localRef.current;
94
+ if (!el) return;
95
+ el.style.height = "0px";
96
+ el.style.height = `${Math.min(el.scrollHeight, MAX_HEIGHT)}px`;
97
+ };
98
+ const handleChange = (e) => {
99
+ if (onChange) {
100
+ const event = {
101
+ ...e,
102
+ target: { value: e.target.value }
103
+ };
104
+ onChange(event);
105
+ }
106
+ };
107
+ React.useEffect(() => {
108
+ updateHeight();
109
+ }, [value]);
110
+ if (bare) {
111
+ return /* @__PURE__ */ jsx9(
112
+ "textarea",
113
+ {
114
+ ...textareaProps,
115
+ ref: setRefs,
116
+ className,
117
+ disabled,
118
+ value,
119
+ onChange: handleChange
120
+ }
121
+ );
122
+ }
123
+ return /* @__PURE__ */ jsx9("div", { className: clsx_default("lib-xplat-auto-resize-textarea-wrapper", className), children: /* @__PURE__ */ jsx9("div", { className: clsx_default("lib-xplat-auto-resize-textarea", disabled && "disabled"), children: /* @__PURE__ */ jsx9(
124
+ "textarea",
125
+ {
126
+ ...textareaProps,
127
+ ref: setRefs,
128
+ disabled,
129
+ value,
130
+ onChange: handleChange
131
+ }
132
+ ) }) });
133
+ }
134
+ );
135
+ AutoResizeTextArea.displayName = "AutoResizeTextArea";
136
+ var AutoResizeTextArea_default = AutoResizeTextArea;
137
+
77
138
  // src/components/ChatInput/ChatInput.tsx
78
- import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
79
- var MAX_HEIGHT = 200;
80
- var ChatInput = React.forwardRef(
139
+ import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
140
+ var ChatInput = React2.forwardRef(
81
141
  (props, ref) => {
82
142
  const {
83
143
  placeholder,
@@ -88,24 +148,9 @@ var ChatInput = React.forwardRef(
88
148
  onChange
89
149
  } = props;
90
150
  const isControlled = valueProp !== void 0;
91
- const [internalValue, setInternalValue] = React.useState("");
151
+ const [internalValue, setInternalValue] = React2.useState("");
92
152
  const value = isControlled ? valueProp : internalValue;
93
153
  const hasText = value.trim().length > 0;
94
- const textareaRef = React.useRef(null);
95
- const setRefs = React.useCallback(
96
- (el) => {
97
- textareaRef.current = el;
98
- if (typeof ref === "function") ref(el);
99
- else if (ref) ref.current = el;
100
- },
101
- [ref]
102
- );
103
- const updateHeight = React.useCallback(() => {
104
- const el = textareaRef.current;
105
- if (!el) return;
106
- el.style.height = "0px";
107
- el.style.height = `${Math.min(el.scrollHeight, MAX_HEIGHT)}px`;
108
- }, []);
109
154
  const handleChange = (e) => {
110
155
  const val = e.target.value;
111
156
  if (!isControlled) setInternalValue(val);
@@ -115,7 +160,6 @@ var ChatInput = React.forwardRef(
115
160
  if (!hasText || disabled) return;
116
161
  onSubmit?.(value);
117
162
  if (!isControlled) setInternalValue("");
118
- requestAnimationFrame(updateHeight);
119
163
  };
120
164
  const handleKeyDown = (e) => {
121
165
  if (e.key === "Enter" && !e.shiftKey) {
@@ -123,14 +167,12 @@ var ChatInput = React.forwardRef(
123
167
  handleSubmit();
124
168
  }
125
169
  };
126
- React.useEffect(() => {
127
- updateHeight();
128
- }, [value, updateHeight]);
129
170
  return /* @__PURE__ */ jsxs4("div", { className: clsx_default("lib-xplat-chat-input", disabled && "disabled"), children: [
130
- /* @__PURE__ */ jsx9(
131
- "textarea",
171
+ /* @__PURE__ */ jsx10(
172
+ AutoResizeTextArea_default,
132
173
  {
133
- ref: setRefs,
174
+ ref,
175
+ bare: true,
134
176
  className: "chat-input-textarea",
135
177
  placeholder,
136
178
  value,
@@ -140,10 +182,10 @@ var ChatInput = React.forwardRef(
140
182
  onKeyDown: handleKeyDown
141
183
  }
142
184
  ),
143
- /* @__PURE__ */ jsx9(
185
+ /* @__PURE__ */ jsx10(
144
186
  IconButton_default,
145
187
  {
146
- icon: /* @__PURE__ */ jsx9(MessageSquareIcon_default, {}),
188
+ icon: /* @__PURE__ */ jsx10(MessageSquareIcon_default, {}),
147
189
  type: buttonType,
148
190
  size: "sm",
149
191
  disabled: !hasText || disabled,
@@ -57,51 +57,23 @@ var clsx_default = clsx;
57
57
  var import_jsx_runtime = require("react/jsx-runtime");
58
58
  var TextArea = import_react.default.forwardRef(
59
59
  (props, ref) => {
60
- const { value, className, onChange, disabled, ...textareaProps } = props;
61
- const localRef = import_react.default.useRef(null);
62
- const setRefs = (el) => {
63
- localRef.current = el;
64
- if (!ref) return;
65
- if (typeof ref === "function") {
66
- ref(el);
67
- } else if (ref && typeof ref === "object" && "current" in ref) {
68
- ref.current = el;
69
- }
70
- };
71
- const handleOnChange = (e) => {
72
- const val = e.target.value;
73
- if (onChange) {
74
- const event = {
75
- ...e,
76
- target: { value: val }
77
- };
78
- onChange(event);
79
- }
80
- };
81
- import_react.default.useEffect(() => {
82
- const el = localRef.current;
83
- if (!el) return;
84
- el.style.height = "0px";
85
- const nextHeight = Math.min(el.scrollHeight, 400);
86
- el.style.height = `${nextHeight}px`;
87
- }, [value]);
88
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: clsx_default("lib-xplat-textarea-wrapper", className), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
89
- "div",
60
+ const {
61
+ className,
62
+ size = "md",
63
+ resize = "vertical",
64
+ rows = 3,
65
+ disabled,
66
+ ...textareaProps
67
+ } = props;
68
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: clsx_default("lib-xplat-textarea-wrap", className), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
69
+ "textarea",
90
70
  {
91
- className: clsx_default(
92
- "lib-xplat-textarea",
93
- disabled ? "disabled" : void 0
94
- ),
95
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
96
- "textarea",
97
- {
98
- ...textareaProps,
99
- ref: setRefs,
100
- disabled,
101
- value,
102
- onChange: handleOnChange
103
- }
104
- )
71
+ ...textareaProps,
72
+ ref,
73
+ rows,
74
+ disabled,
75
+ className: clsx_default("lib-xplat-textarea", size, disabled && "disabled"),
76
+ style: { resize }
105
77
  }
106
78
  ) });
107
79
  }