maru_design2 2.24.3 → 2.25.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.25.0](https://github.com/42maru-ai/maru-design2/compare/v2.24.4...v2.25.0) (2025-04-08)
4
+
5
+
6
+ ### Features
7
+
8
+ * :sparkles: Textarea - add minRows, maxRows [#540](https://github.com/42maru-ai/maru-design2/issues/540) ([b907d40](https://github.com/42maru-ai/maru-design2/commit/b907d40834eb48baea693d94364940605478963a))
9
+ * :sparkles: Textarea - add resizable [#553](https://github.com/42maru-ai/maru-design2/issues/553) ([594031e](https://github.com/42maru-ai/maru-design2/commit/594031e12f14870708e691b1f59fc863c948aa20))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * :bug: Textarea - fix condition & update storybook ([7f14d1a](https://github.com/42maru-ai/maru-design2/commit/7f14d1a95f53956e2a5a6fcbcbdfc5a3ed9d440c))
15
+ * :bug: Textarea - fix init scrollHeight ([c6aa3cc](https://github.com/42maru-ai/maru-design2/commit/c6aa3ccf3f2b2e1b1947bf5a70943044ad2e9f40))
16
+
17
+ ## [2.24.4](https://github.com/42maru-ai/maru-design2/compare/v2.24.3...v2.24.4) (2025-03-31)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * :bento: Icon - add icons [#402](https://github.com/42maru-ai/maru-design2/issues/402) ([d14d4b1](https://github.com/42maru-ai/maru-design2/commit/d14d4b1cfd2ae1c58f4badb9f5c65eca814b60f4))
23
+
3
24
  ## [2.24.3](https://github.com/42maru-ai/maru-design2/compare/v2.24.2...v2.24.3) (2025-03-26)
4
25
 
5
26
 
@@ -114,6 +114,7 @@ export declare const ICONS: {
114
114
  readonly CodeSnippet02_s2420: "CodeSnippet02_s2420";
115
115
  readonly Connection_s1810: "Connection_s1810";
116
116
  readonly Copy03_s1615: "Copy03_s1615";
117
+ readonly Copy03_s1810: "Copy03_s1810";
117
118
  readonly Copy_s1413: "Copy_s1413";
118
119
  readonly Copy_s1613: "Copy_s1613";
119
120
  readonly CornerDownRight_s1615: "CornerDownRight_s1615";
@@ -233,6 +234,7 @@ export declare const ICONS: {
233
234
  readonly Loading02_s4830: "Loading02_s4830";
234
235
  readonly Lock01_s1615: "Lock01_s1615";
235
236
  readonly LogOut01_s1615: "LogOut01_s1615";
237
+ readonly MagicTool_s1513: "MagicTool_s1513";
236
238
  readonly Menu2_s1613: "Menu2_s1613";
237
239
  readonly Menu_s2415: "Menu_s2415";
238
240
  readonly MessageCheck_s1615: "MessageCheck_s1615";
@@ -308,6 +310,7 @@ export declare const ICONS: {
308
310
  readonly Star_s1613: "Star_s1613";
309
311
  readonly State_s1610: "State_s1610";
310
312
  readonly State_s1810: "State_s1810";
313
+ readonly StopCircleBg_s1513: "StopCircleBg_s1513";
311
314
  readonly StopCircle_s1413: "StopCircle_s1413";
312
315
  readonly StopCircle_s1615: "StopCircle_s1615";
313
316
  readonly StopCircle_s2420: "StopCircle_s2420";
@@ -21,5 +21,18 @@ export interface TextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTex
21
21
  */
22
22
  wrapperRef?: React.RefObject<HTMLDivElement>;
23
23
  className?: string;
24
+ /**
25
+ * 최소 높이. 없으면 props.rows 이거나 1로 설정.
26
+ */
27
+ minRows?: number;
28
+ /**
29
+ * 최대 높이. 없으면 무한대 늘어남.
30
+ */
31
+ maxRows?: number;
32
+ /**
33
+ * 바닥 선분을 마우스로 드래그해서 크기를 조절할 수 있는지 여부
34
+ * - 기본값은 false
35
+ */
36
+ resizable?: boolean;
24
37
  }
25
38
  export declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import React__default, { useState, useMemo, forwardRef, useEffect, useRef, createElement, Component, useLayoutEffect, createRef } from 'react';
3
+ import React__default, { useState, useMemo, forwardRef, useEffect, useRef, useCallback, createElement, Component, useLayoutEffect, createRef } from 'react';
4
4
  import * as ReactDOM from 'react-dom';
5
5
  import ReactDOM__default, { findDOMNode } from 'react-dom';
6
6
 
@@ -1427,6 +1427,20 @@ var iconmap = {
1427
1427
  "circles": [],
1428
1428
  "rects": []
1429
1429
  },
1430
+ "Copy03_s1810": {
1431
+ "width": "18",
1432
+ "height": "19",
1433
+ "viewBox": "0 0 18 19",
1434
+ "fill": "none",
1435
+ "paths": [{
1436
+ "d": "M6.3 6.8V4.91C6.3 4.15393 6.3 3.77589 6.44714 3.48711C6.57657 3.23309 6.78309 3.02657 7.03711 2.89714C7.32589 2.75 7.70393 2.75 8.46 2.75H13.59C14.3461 2.75 14.7241 2.75 15.0129 2.89714C15.2669 3.02657 15.4734 3.23309 15.6029 3.48711C15.75 3.77589 15.75 4.15393 15.75 4.91V10.04C15.75 10.7961 15.75 11.1741 15.6029 11.4629C15.4734 11.7169 15.2669 11.9234 15.0129 12.0529C14.7241 12.2 14.3461 12.2 13.59 12.2H11.7M4.41 16.25H9.54C10.2961 16.25 10.6741 16.25 10.9629 16.1029C11.2169 15.9734 11.4234 15.7669 11.5529 15.5129C11.7 15.2241 11.7 14.8461 11.7 14.09V8.96C11.7 8.20393 11.7 7.82589 11.5529 7.53711C11.4234 7.28309 11.2169 7.07657 10.9629 6.94714C10.6741 6.8 10.2961 6.8 9.54 6.8H4.41C3.65393 6.8 3.27589 6.8 2.98711 6.94714C2.73309 7.07657 2.52657 7.28309 2.39714 7.53711C2.25 7.82589 2.25 8.20393 2.25 8.96V14.09C2.25 14.8461 2.25 15.2241 2.39714 15.5129C2.52657 15.7669 2.73309 15.9734 2.98711 16.1029C3.27589 16.25 3.65393 16.25 4.41 16.25Z",
1437
+ "stroke": "#5C5C5C",
1438
+ "strokeLinecap": "round",
1439
+ "strokeLinejoin": "round"
1440
+ }],
1441
+ "circles": [],
1442
+ "rects": []
1443
+ },
1430
1444
  "Copy_s1413": {
1431
1445
  "width": "14",
1432
1446
  "height": "14",
@@ -3850,6 +3864,48 @@ var iconmap = {
3850
3864
  "circles": [],
3851
3865
  "rects": []
3852
3866
  },
3867
+ "MagicTool_s1513": {
3868
+ "width": "15",
3869
+ "height": "15",
3870
+ "viewBox": "0 0 15 15",
3871
+ "fill": "none",
3872
+ "paths": [{
3873
+ "d": "M5.14884 1.5C5.14884 1.88993 5.30374 2.2639 5.57947 2.53962C5.85519 2.81535 6.22915 2.97025 6.61909 2.97025C6.22915 2.97025 5.85519 3.12515 5.57947 3.40088C5.30374 3.6766 5.14884 4.05057 5.14884 4.4405C5.14884 4.05057 4.99394 3.6766 4.71821 3.40088C4.44249 3.12515 4.06852 2.97025 3.67859 2.97025C4.06852 2.97025 4.44249 2.81535 4.71821 2.53962C4.99394 2.2639 5.14884 1.88993 5.14884 1.5Z",
3874
+ "fill": "white",
3875
+ "stroke": "white",
3876
+ "strokeWidth": "1.3",
3877
+ "strokeLinecap": "round",
3878
+ "strokeLinejoin": "round"
3879
+ }, {
3880
+ "d": "M12.0269 1.5C12.0269 1.88993 12.1818 2.2639 12.4575 2.53962C12.7332 2.81535 13.1072 2.97025 13.4971 2.97025C13.1072 2.97025 12.7332 3.12515 12.4575 3.40088C12.1818 3.6766 12.0269 4.05057 12.0269 4.4405C12.0269 4.05057 11.872 3.6766 11.5963 3.40088C11.3205 3.12515 10.9466 2.97025 10.5566 2.97025C10.9466 2.97025 11.3205 2.81535 11.5963 2.53962C11.872 2.2639 12.0269 1.88993 12.0269 1.5Z",
3881
+ "fill": "white",
3882
+ "stroke": "white",
3883
+ "strokeWidth": "1.3",
3884
+ "strokeLinecap": "round",
3885
+ "strokeLinejoin": "round"
3886
+ }, {
3887
+ "d": "M12.2917 7.75C12.2917 8.13993 12.4466 8.5139 12.7223 8.78962C12.998 9.06535 13.372 9.22025 13.7619 9.22025C13.372 9.22025 12.998 9.37515 12.7223 9.65088C12.4466 9.9266 12.2917 10.3006 12.2917 10.6905C12.2917 10.3006 12.1368 9.9266 11.861 9.65088C11.5853 9.37515 11.2113 9.22025 10.8214 9.22025C11.2113 9.22025 11.5853 9.06535 11.861 8.78962C12.1368 8.5139 12.2917 8.13993 12.2917 7.75Z",
3888
+ "fill": "white",
3889
+ "stroke": "white",
3890
+ "strokeWidth": "1.3",
3891
+ "strokeLinecap": "round",
3892
+ "strokeLinejoin": "round"
3893
+ }, {
3894
+ "d": "M9.95935 5.63403L9.36206 5.03674C9.03219 4.70687 8.49735 4.70687 8.16748 5.03674L1.5973 11.6069C1.26742 11.9368 1.26742 12.4716 1.5973 12.8015L2.19459 13.3988C2.52446 13.7287 3.05929 13.7287 3.38917 13.3988L9.95935 6.82861C10.2892 6.49874 10.2892 5.96391 9.95935 5.63403Z",
3895
+ "stroke": "white",
3896
+ "strokeWidth": "1.3",
3897
+ "strokeLinecap": "round",
3898
+ "strokeLinejoin": "round"
3899
+ }, {
3900
+ "d": "M6.37695 6.83203L8.16882 8.6239L3.39051 13.4022C3.2321 13.5606 3.01724 13.6496 2.79322 13.6496C2.56919 13.6496 2.35434 13.5606 2.19593 13.4022L1.59864 12.8049C1.44023 12.6465 1.35123 12.4317 1.35123 12.2076C1.35123 11.9836 1.44023 11.7688 1.59864 11.6103L6.37695 6.83203V6.83203Z",
3901
+ "stroke": "white",
3902
+ "strokeWidth": "1.3",
3903
+ "strokeLinecap": "round",
3904
+ "strokeLinejoin": "round"
3905
+ }],
3906
+ "circles": [],
3907
+ "rects": []
3908
+ },
3853
3909
  "Menu2_s1613": {
3854
3910
  "width": "14",
3855
3911
  "height": "13",
@@ -5139,6 +5195,29 @@ var iconmap = {
5139
5195
  }],
5140
5196
  "rects": []
5141
5197
  },
5198
+ "StopCircleBg_s1513": {
5199
+ "width": "15",
5200
+ "height": "16",
5201
+ "viewBox": "0 0 15 16",
5202
+ "fill": "none",
5203
+ "paths": [{
5204
+ "d": "M7.5 14.5C11.0899 14.5 14 11.5899 14 8C14 4.41015 11.0899 1.5 7.5 1.5C3.91015 1.5 1 4.41015 1 8C1 11.5899 3.91015 14.5 7.5 14.5Z",
5205
+ "fill": "#213A78",
5206
+ "stroke": "#213A78",
5207
+ "strokeWidth": "1.3",
5208
+ "strokeLinecap": "round",
5209
+ "strokeLinejoin": "round"
5210
+ }],
5211
+ "circles": [],
5212
+ "rects": [{
5213
+ "x": "5",
5214
+ "y": "5.5",
5215
+ "width": "5",
5216
+ "height": "5",
5217
+ "rx": "1",
5218
+ "fill": "#213A78"
5219
+ }]
5220
+ },
5142
5221
  "StopCircle_s1413": {
5143
5222
  "width": "14",
5144
5223
  "height": "14",
@@ -5923,6 +6002,7 @@ var ICONS = {
5923
6002
  "CodeSnippet02_s2420": "CodeSnippet02_s2420",
5924
6003
  "Connection_s1810": "Connection_s1810",
5925
6004
  "Copy03_s1615": "Copy03_s1615",
6005
+ "Copy03_s1810": "Copy03_s1810",
5926
6006
  "Copy_s1413": "Copy_s1413",
5927
6007
  "Copy_s1613": "Copy_s1613",
5928
6008
  "CornerDownRight_s1615": "CornerDownRight_s1615",
@@ -6042,6 +6122,7 @@ var ICONS = {
6042
6122
  "Loading02_s4830": "Loading02_s4830",
6043
6123
  "Lock01_s1615": "Lock01_s1615",
6044
6124
  "LogOut01_s1615": "LogOut01_s1615",
6125
+ "MagicTool_s1513": "MagicTool_s1513",
6045
6126
  "Menu2_s1613": "Menu2_s1613",
6046
6127
  "Menu_s2415": "Menu_s2415",
6047
6128
  "MessageCheck_s1615": "MessageCheck_s1615",
@@ -6117,6 +6198,7 @@ var ICONS = {
6117
6198
  "Star_s1613": "Star_s1613",
6118
6199
  "State_s1610": "State_s1610",
6119
6200
  "State_s1810": "State_s1810",
6201
+ "StopCircleBg_s1513": "StopCircleBg_s1513",
6120
6202
  "StopCircle_s1413": "StopCircle_s1413",
6121
6203
  "StopCircle_s1615": "StopCircle_s1615",
6122
6204
  "StopCircle_s2420": "StopCircle_s2420",
@@ -6204,6 +6286,12 @@ function Icon(_a) {
6204
6286
  var staticPathStorke = useMemo(function () {
6205
6287
  return name === ICONS.ChevronLeftCircleBg_s2415 || name === ICONS.ChevronRightCircleBg_s2415 || name === ICONS.CheckCircleBg_s1612 || name === ICONS.XCircleBg_s1612 || name === ICONS.XDiamondBg_s2415 || name === ICONS.UserCircleBg_s2415 || name === ICONS.BarChartSquare01Bg_s1810;
6206
6288
  }, [name]);
6289
+ /**
6290
+ * path.fill를 svg에 있는대로 두고 싶으면 true
6291
+ */
6292
+ var staticPathFill = useMemo(function () {
6293
+ return name === ICONS.StopCircleBg_s1513;
6294
+ }, [name]);
6207
6295
  return jsxs("svg", __assign({
6208
6296
  width: width,
6209
6297
  height: height,
@@ -6242,7 +6330,7 @@ function Icon(_a) {
6242
6330
  }), paths.map(function (path, idx) {
6243
6331
  return jsx("path", {
6244
6332
  d: path.d,
6245
- fill: path.fill && iconColor,
6333
+ fill: path.fill && (staticPathFill ? undefined : iconColor),
6246
6334
  fillRule: path.fillRule,
6247
6335
  clipRule: path.clipRule,
6248
6336
  stroke: path.stroke && (staticPathStorke && idx === paths.length - 1 ? path.stroke : iconColor),
@@ -8803,7 +8891,7 @@ function Slider(_a) {
8803
8891
  }));
8804
8892
  }
8805
8893
 
8806
- var css_248z$b = ".maru-textarea-wrapper .maru-textarea {\n display: flex;\n justify-content: center;\n align-items: flex-start;\n flex-direction: row;\n padding: 8px 8px 8px 12px;\n border: 1px solid #e4e4e4;\n border-radius: 6px;\n gap: 8px;\n}\n.maru-textarea-wrapper .maru-textarea > textarea {\n width: 100%;\n border: unset;\n outline: unset;\n background-color: transparent;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 400;\n color: #5c5c5c;\n resize: none;\n}\n.maru-textarea-wrapper .maru-textarea > textarea::-webkit-input-placeholder {\n font-weight: 300;\n color: #8c8c8c;\n}\n.maru-textarea-wrapper .maru-textarea > textarea::-moz-placeholder {\n font-weight: 300;\n color: #8c8c8c;\n}\n.maru-textarea-wrapper .maru-textarea > textarea:-ms-input-placeholder {\n font-weight: 300;\n color: #8c8c8c;\n}\n.maru-textarea-wrapper .maru-textarea > textarea::-ms-input-placeholder {\n font-weight: 300;\n color: #8c8c8c;\n}\n.maru-textarea-wrapper .maru-textarea > textarea::placeholder {\n font-weight: 300;\n color: #8c8c8c;\n}\n.maru-textarea-wrapper .maru-textarea:focus-visible, .maru-textarea-wrapper .maru-textarea:focus-within {\n border-color: #5c5c5c;\n background-color: #fafafa;\n}\n.maru-textarea-wrapper .maru-textarea.errored {\n outline: 1px solid #e53e3e;\n border-color: #e53e3e;\n}\n.maru-textarea-wrapper .maru-textarea:hover {\n outline: 1px solid #e4e4e4;\n border-color: #e4e4e4;\n background-color: #fafafa;\n}\n.maru-textarea-wrapper .maru-textarea.disabled {\n background-color: #fafafa;\n}\n.maru-textarea-wrapper .maru-textarea.disabled > textarea {\n color: #bdbdbd;\n}\n.maru-textarea-wrapper .maru-textarea.disabled > textarea::-webkit-input-placeholder {\n color: #bdbdbd;\n}\n.maru-textarea-wrapper .maru-textarea.disabled > textarea::-moz-placeholder {\n color: #bdbdbd;\n}\n.maru-textarea-wrapper .maru-textarea.disabled > textarea:-ms-input-placeholder {\n color: #bdbdbd;\n}\n.maru-textarea-wrapper .maru-textarea.disabled > textarea::-ms-input-placeholder {\n color: #bdbdbd;\n}\n.maru-textarea-wrapper .maru-textarea.disabled > textarea::placeholder {\n color: #bdbdbd;\n}\n.maru-textarea-wrapper .maru-textarea.disabled:hover {\n outline: unset;\n}\n.maru-textarea-wrapper .maru-textarea-end-node-wrapper {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n.maru-textarea-wrapper .maru-textarea-end-node-wrapper > button {\n padding: unset;\n margin: unset;\n border: unset;\n background-color: unset;\n cursor: pointer;\n width: 16px;\n height: 16px;\n}\n.maru-textarea-wrapper .maru-textarea-footer {\n display: block;\n margin-top: 4px;\n}\n.maru-textarea-wrapper .maru-textarea-footer > span {\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 12px;\n letter-spacing: -0.48px;\n font-weight: 500;\n color: #e53e3e;\n}";
8894
+ var css_248z$b = ".maru-textarea-wrapper .maru-textarea-resizable-wrapper {\n position: relative;\n}\n.maru-textarea-wrapper .maru-textarea {\n display: flex;\n justify-content: center;\n align-items: flex-start;\n flex-direction: row;\n padding: 8px 8px 8px 12px;\n border: 1px solid #e4e4e4;\n border-radius: 6px;\n gap: 8px;\n}\n.maru-textarea-wrapper .maru-textarea > textarea {\n width: 100%;\n border: unset;\n outline: unset;\n background-color: transparent;\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 14px;\n letter-spacing: -0.56px;\n font-weight: 400;\n color: #5c5c5c;\n resize: none;\n}\n.maru-textarea-wrapper .maru-textarea > textarea::-webkit-input-placeholder {\n font-weight: 300;\n color: #8c8c8c;\n}\n.maru-textarea-wrapper .maru-textarea > textarea::-moz-placeholder {\n font-weight: 300;\n color: #8c8c8c;\n}\n.maru-textarea-wrapper .maru-textarea > textarea:-ms-input-placeholder {\n font-weight: 300;\n color: #8c8c8c;\n}\n.maru-textarea-wrapper .maru-textarea > textarea::-ms-input-placeholder {\n font-weight: 300;\n color: #8c8c8c;\n}\n.maru-textarea-wrapper .maru-textarea > textarea::placeholder {\n font-weight: 300;\n color: #8c8c8c;\n}\n.maru-textarea-wrapper .maru-textarea:focus-visible, .maru-textarea-wrapper .maru-textarea:focus-within {\n border-color: #5c5c5c;\n background-color: #fafafa;\n}\n.maru-textarea-wrapper .maru-textarea.errored {\n outline: 1px solid #e53e3e;\n border-color: #e53e3e;\n}\n.maru-textarea-wrapper .maru-textarea:hover {\n outline: 1px solid #e4e4e4;\n border-color: #e4e4e4;\n background-color: #fafafa;\n}\n.maru-textarea-wrapper .maru-textarea.disabled {\n background-color: #fafafa;\n}\n.maru-textarea-wrapper .maru-textarea.disabled > textarea {\n color: #bdbdbd;\n}\n.maru-textarea-wrapper .maru-textarea.disabled > textarea::-webkit-input-placeholder {\n color: #bdbdbd;\n}\n.maru-textarea-wrapper .maru-textarea.disabled > textarea::-moz-placeholder {\n color: #bdbdbd;\n}\n.maru-textarea-wrapper .maru-textarea.disabled > textarea:-ms-input-placeholder {\n color: #bdbdbd;\n}\n.maru-textarea-wrapper .maru-textarea.disabled > textarea::-ms-input-placeholder {\n color: #bdbdbd;\n}\n.maru-textarea-wrapper .maru-textarea.disabled > textarea::placeholder {\n color: #bdbdbd;\n}\n.maru-textarea-wrapper .maru-textarea.disabled:hover {\n outline: unset;\n}\n.maru-textarea-wrapper .maru-textarea-end-node-wrapper {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n.maru-textarea-wrapper .maru-textarea-end-node-wrapper > button {\n padding: unset;\n margin: unset;\n border: unset;\n background-color: unset;\n cursor: pointer;\n width: 16px;\n height: 16px;\n}\n.maru-textarea-wrapper .resizer {\n position: absolute;\n bottom: 0;\n left: 0;\n height: 5px;\n width: 100%;\n cursor: ns-resize;\n background: transparent;\n}\n.maru-textarea-wrapper .maru-textarea-footer {\n display: block;\n margin-top: 4px;\n}\n.maru-textarea-wrapper .maru-textarea-footer > span {\n font-family: Pretendard;\n font-style: normal;\n line-height: 150%;\n font-size: 12px;\n letter-spacing: -0.48px;\n font-weight: 500;\n color: #e53e3e;\n}";
8807
8895
  styleInject(css_248z$b);
8808
8896
 
8809
8897
  var Textarea = /*#__PURE__*/forwardRef(function (_a, textareaRef) {
@@ -8812,15 +8900,40 @@ var Textarea = /*#__PURE__*/forwardRef(function (_a, textareaRef) {
8812
8900
  hiddenClearButton = _a.hiddenClearButton,
8813
8901
  wrapperRef = _a.wrapperRef,
8814
8902
  className = _a.className,
8815
- props = __rest(_a, ["invalid", "onClear", "hiddenClearButton", "wrapperRef", "className"]);
8816
- var _b = useState(false),
8817
- showClearButton = _b[0],
8818
- setShowClearButton = _b[1];
8903
+ minRows = _a.minRows,
8904
+ maxRows = _a.maxRows,
8905
+ _b = _a.resizable,
8906
+ resizable = _b === void 0 ? false : _b,
8907
+ props = __rest(_a, ["invalid", "onClear", "hiddenClearButton", "wrapperRef", "className", "minRows", "maxRows", "resizable"]);
8908
+ var _c = useState(false),
8909
+ showClearButton = _c[0],
8910
+ setShowClearButton = _c[1];
8819
8911
  var combineRef = useCombineRef(textareaRef);
8912
+ var minHeight = useCallback(function (lineHeight) {
8913
+ return minRows ? minRows * lineHeight : 0;
8914
+ }, [minRows]);
8915
+ var maxHeight = useCallback(function (lineHeight) {
8916
+ return maxRows ? maxRows * lineHeight : Infinity;
8917
+ }, [maxRows]);
8918
+ /**
8919
+ * textarea의 높이를 조절하는 함수
8920
+ * - rows는 기본적으로 초기 높이 설정하는데에만 쓰임
8921
+ * - 동적 높이 조정은 css height 속성 변경으로 조정해야함
8922
+ */
8820
8923
  var resizeHeight = function resizeHeight() {
8821
8924
  if (combineRef.current) {
8925
+ // 항상 그때의 scrollHeight를 가져오도록 높이를 초기화
8822
8926
  combineRef.current.style.height = 'auto';
8823
- combineRef.current.style.height = "".concat(combineRef.current.scrollHeight, "px");
8927
+ var lineHeight = parseInt(window.getComputedStyle(combineRef.current).lineHeight || '0', 10);
8928
+ var scrollHeight = combineRef.current.scrollHeight;
8929
+ if (lineHeight) {
8930
+ var min = minHeight(lineHeight);
8931
+ var max = maxHeight(lineHeight);
8932
+ var newHeight = Math.min(Math.max(scrollHeight, min), max);
8933
+ combineRef.current.style.height = "".concat(newHeight, "px");
8934
+ } else {
8935
+ combineRef.current.style.height = "".concat(scrollHeight, "px");
8936
+ }
8824
8937
  }
8825
8938
  };
8826
8939
  useEffect(function () {
@@ -8867,33 +8980,65 @@ var Textarea = /*#__PURE__*/forwardRef(function (_a, textareaRef) {
8867
8980
  onClear === null || onClear === void 0 ? void 0 : onClear();
8868
8981
  resizeHeight();
8869
8982
  };
8983
+ var handleResizerMouseDown = function handleResizerMouseDown(e) {
8984
+ var combine = combineRef === null || combineRef === void 0 ? void 0 : combineRef.current;
8985
+ if (resizable && combine) {
8986
+ var startY_1 = e.clientY;
8987
+ var startHeight_1 = combine.clientHeight;
8988
+ document.body.style.userSelect = 'none';
8989
+ var lineHeight = parseInt(window.getComputedStyle(combine).lineHeight || '0', 10);
8990
+ var min_1 = minHeight(lineHeight);
8991
+ var max_1 = maxHeight(lineHeight);
8992
+ var handleMouseMove_1 = function handleMouseMove_1(moveEvent) {
8993
+ var newHeight = startHeight_1 + moveEvent.clientY - startY_1;
8994
+ if (min_1 <= newHeight && newHeight <= max_1) {
8995
+ combine.style.height = "".concat(newHeight, "px");
8996
+ }
8997
+ };
8998
+ var handleMouseUp_1 = function handleMouseUp_1() {
8999
+ document.body.style.userSelect = '';
9000
+ document.removeEventListener('mousemove', handleMouseMove_1);
9001
+ document.removeEventListener('mouseup', handleMouseUp_1);
9002
+ };
9003
+ document.addEventListener('mousemove', handleMouseMove_1);
9004
+ document.addEventListener('mouseup', handleMouseUp_1);
9005
+ }
9006
+ };
8870
9007
  return jsxs("div", __assign({
8871
9008
  ref: wrapperRef,
8872
9009
  className: classNames('maru-textarea-wrapper', className)
8873
9010
  }, {
8874
9011
  children: [jsxs("div", __assign({
8875
- className: classNames('maru-textarea', {
8876
- errored: invalid === null || invalid === void 0 ? void 0 : invalid.on,
8877
- disabled: props.disabled
8878
- })
9012
+ className: "maru-textarea-resizable-wrapper"
8879
9013
  }, {
8880
- children: [jsx("textarea", __assign({}, props, {
8881
- ref: combineRef,
8882
- onChange: handleTextareaChange
8883
- })), jsx("div", __assign({
8884
- className: "maru-textarea-end-node-wrapper"
9014
+ children: [jsxs("div", __assign({
9015
+ className: classNames('maru-textarea', {
9016
+ errored: invalid === null || invalid === void 0 ? void 0 : invalid.on,
9017
+ disabled: props.disabled
9018
+ })
8885
9019
  }, {
8886
- children: showClearButton && !props.disabled && jsx("button", __assign({
8887
- type: "button",
8888
- onClick: handleClearClick,
8889
- tabIndex: -1
9020
+ children: [jsx("textarea", __assign({}, props, {
9021
+ ref: combineRef,
9022
+ onChange: handleTextareaChange,
9023
+ rows: props.rows || minRows || 1
9024
+ })), jsx("div", __assign({
9025
+ className: "maru-textarea-end-node-wrapper"
8890
9026
  }, {
8891
- children: jsx(Icon, {
8892
- name: ICONS.X_s1615,
8893
- color: "#5c5c5c"
8894
- })
8895
- }))
8896
- }))]
9027
+ children: showClearButton && !props.disabled && jsx("button", __assign({
9028
+ type: "button",
9029
+ onClick: handleClearClick,
9030
+ tabIndex: -1
9031
+ }, {
9032
+ children: jsx(Icon, {
9033
+ name: ICONS.X_s1615,
9034
+ color: "#5c5c5c"
9035
+ })
9036
+ }))
9037
+ }))]
9038
+ })), resizable && jsx("div", {
9039
+ className: "resizer",
9040
+ onMouseDown: handleResizerMouseDown
9041
+ })]
8897
9042
  })), invalid && invalid.on && jsx("div", __assign({
8898
9043
  className: "maru-textarea-footer"
8899
9044
  }, {
@@ -8908,7 +9053,10 @@ Textarea.defaultProps = {
8908
9053
  onClear: undefined,
8909
9054
  hiddenClearButton: undefined,
8910
9055
  wrapperRef: undefined,
8911
- className: undefined
9056
+ className: undefined,
9057
+ minRows: undefined,
9058
+ maxRows: undefined,
9059
+ resizable: false
8912
9060
  };
8913
9061
  Textarea.displayName = 'Textarea';
8914
9062
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maru_design2",
3
- "version": "2.24.3",
3
+ "version": "2.25.0",
4
4
  "main": "./dist/index.js",
5
5
  "author": "zena-42maru",
6
6
  "license": "MIT",