oa-componentbook 1.0.1-stage.428 → 1.0.1-stage.429
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.
|
@@ -16,7 +16,8 @@ var _styles = _interopRequireWildcard(require("./styles"));
|
|
|
16
16
|
var _ColorVariablesMap = _interopRequireDefault(require("../../global-css/ColorVariablesMap"));
|
|
17
17
|
var _MaterialIcon = _interopRequireDefault(require("../oa-component-icons/MaterialIcon"));
|
|
18
18
|
var _constants = require("./constants");
|
|
19
|
-
const _excluded = ["rows", "placeholder", "maxLength", "className", "variant",
|
|
19
|
+
const _excluded = ["rows", "placeholder", "maxLength", "className", "variant"],
|
|
20
|
+
_excluded2 = ["minRows", "maxRows", "sendIconConfig", "onSend", "value", "onChange", "disabled"];
|
|
20
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
21
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -57,26 +58,30 @@ function CustomTextArea(_ref) {
|
|
|
57
58
|
placeholder,
|
|
58
59
|
maxLength,
|
|
59
60
|
className,
|
|
60
|
-
variant = 'default'
|
|
61
|
-
minRows = _constants.DEFAULT_MIN_ROWS,
|
|
62
|
-
maxRows = _constants.DEFAULT_MAX_ROWS,
|
|
63
|
-
sendIconConfig = _constants.DEFAULT_SEND_ICON_CONFIG,
|
|
64
|
-
onSend,
|
|
65
|
-
value,
|
|
66
|
-
onChange
|
|
61
|
+
variant = 'default'
|
|
67
62
|
} = _ref,
|
|
68
63
|
antDesignProps = _objectWithoutProperties(_ref, _excluded);
|
|
69
64
|
// Render gradient variant
|
|
70
65
|
if (variant === 'gradient') {
|
|
71
|
-
//
|
|
72
|
-
const
|
|
66
|
+
// Extract gradient-specific props from antDesignProps
|
|
67
|
+
const _ref2 = antDesignProps || {},
|
|
68
|
+
{
|
|
69
|
+
minRows = _constants.DEFAULT_MIN_ROWS,
|
|
70
|
+
maxRows = _constants.DEFAULT_MAX_ROWS,
|
|
71
|
+
sendIconConfig = _constants.DEFAULT_SEND_ICON_CONFIG,
|
|
72
|
+
onSend,
|
|
73
|
+
value,
|
|
74
|
+
onChange,
|
|
75
|
+
disabled
|
|
76
|
+
} = _ref2,
|
|
77
|
+
restAntDesignProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
73
78
|
|
|
74
79
|
// Handle send icon click - gradient variant only
|
|
75
80
|
// Use value prop directly - no internal state management
|
|
76
81
|
const handleSendClick = () => {
|
|
77
82
|
const currentValue = value || '';
|
|
78
83
|
// Only allow click if textarea is enabled, icon config is not disabled, and has content
|
|
79
|
-
if (onSend && !
|
|
84
|
+
if (onSend && !disabled && !sendIconConfig.disabled && currentValue.trim()) {
|
|
80
85
|
onSend(currentValue);
|
|
81
86
|
}
|
|
82
87
|
};
|
|
@@ -85,7 +90,7 @@ function CustomTextArea(_ref) {
|
|
|
85
90
|
// Icon is enabled if: textarea is enabled AND config says it's not disabled AND there's content
|
|
86
91
|
// Use value prop directly - no internal state
|
|
87
92
|
const currentValue = value || '';
|
|
88
|
-
const isSendEnabled = !
|
|
93
|
+
const isSendEnabled = !disabled && !sendIconConfig.disabled && currentValue.trim().length > 0;
|
|
89
94
|
|
|
90
95
|
// Determine if icon should be shown - only for gradient variant
|
|
91
96
|
// Hidden by default, only show when explicitly requested via sendIconConfig.show
|
|
@@ -99,21 +104,22 @@ function CustomTextArea(_ref) {
|
|
|
99
104
|
}
|
|
100
105
|
}, /*#__PURE__*/_react.default.createElement(_styles.TextAreaWrapper, {
|
|
101
106
|
className: className,
|
|
102
|
-
$disabled:
|
|
107
|
+
$disabled: disabled
|
|
103
108
|
}, /*#__PURE__*/_react.default.createElement(_styles.default, _extends({
|
|
104
109
|
placeholder: placeholder,
|
|
105
110
|
maxLength: maxLength,
|
|
106
111
|
className: "custom-textarea-gradient",
|
|
107
112
|
value: value,
|
|
108
113
|
onChange: onChange,
|
|
114
|
+
disabled: disabled,
|
|
109
115
|
autoSize: maxRows ? {
|
|
110
116
|
minRows,
|
|
111
117
|
maxRows
|
|
112
118
|
} : {
|
|
113
119
|
minRows
|
|
114
120
|
}
|
|
115
|
-
},
|
|
116
|
-
className:
|
|
121
|
+
}, restAntDesignProps)), shouldShowIcon && /*#__PURE__*/_react.default.createElement(_styles.SendIconWrapper, {
|
|
122
|
+
className: disabled || sendIconConfig.disabled || !isSendEnabled ? 'icon-disabled' : 'icon-enabled'
|
|
117
123
|
}, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
|
|
118
124
|
icon: _SendRounded.default,
|
|
119
125
|
size: 24,
|
|
@@ -123,6 +129,7 @@ function CustomTextArea(_ref) {
|
|
|
123
129
|
}
|
|
124
130
|
|
|
125
131
|
// Render default variant (existing behavior - completely unchanged)
|
|
132
|
+
// All props including value, onChange pass through naturally via antDesignProps
|
|
126
133
|
return /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
127
134
|
theme: {
|
|
128
135
|
token: {
|
|
@@ -142,28 +149,13 @@ CustomTextArea.propTypes = {
|
|
|
142
149
|
placeholder: _propTypes.default.string,
|
|
143
150
|
maxLength: _propTypes.default.number,
|
|
144
151
|
className: _propTypes.default.string,
|
|
145
|
-
variant: _propTypes.default.oneOf(['default', 'gradient'])
|
|
146
|
-
minRows: _propTypes.default.number,
|
|
147
|
-
maxRows: _propTypes.default.number,
|
|
148
|
-
sendIconConfig: _propTypes.default.shape({
|
|
149
|
-
show: _propTypes.default.bool,
|
|
150
|
-
disabled: _propTypes.default.bool
|
|
151
|
-
}),
|
|
152
|
-
onSend: _propTypes.default.func,
|
|
153
|
-
value: _propTypes.default.string,
|
|
154
|
-
onChange: _propTypes.default.func
|
|
152
|
+
variant: _propTypes.default.oneOf(['default', 'gradient'])
|
|
155
153
|
};
|
|
156
154
|
CustomTextArea.defaultProps = {
|
|
157
155
|
rows: _constants.DEFAULT_ROWS,
|
|
158
156
|
placeholder: null,
|
|
159
157
|
maxLength: 5000,
|
|
160
158
|
className: '',
|
|
161
|
-
variant: 'default'
|
|
162
|
-
minRows: _constants.DEFAULT_MIN_ROWS,
|
|
163
|
-
maxRows: _constants.DEFAULT_MAX_ROWS,
|
|
164
|
-
sendIconConfig: _constants.DEFAULT_SEND_ICON_CONFIG,
|
|
165
|
-
onSend: null,
|
|
166
|
-
value: undefined,
|
|
167
|
-
onChange: null
|
|
159
|
+
variant: 'default'
|
|
168
160
|
};
|
|
169
161
|
var _default = exports.default = CustomTextArea;
|