@digital-ai/dot-components 4.24.0 → 4.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/index.esm.js +32 -28
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -7267,10 +7267,14 @@ const DotAutoComplete = ({
|
|
|
7267
7267
|
}
|
|
7268
7268
|
});
|
|
7269
7269
|
// Create handler only if 'onInputChange' or 'actionItem' prop is defined
|
|
7270
|
-
|
|
7271
|
-
|
|
7270
|
+
// Custom input change handler for AI mode
|
|
7271
|
+
const handleInputChange = (event, currentInputValue, reason) => {
|
|
7272
|
+
if (isActionItemDefined || ai) {
|
|
7273
|
+
setInputText(currentInputValue); // fallback for action item
|
|
7274
|
+
}
|
|
7275
|
+
|
|
7272
7276
|
onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(event, currentInputValue, reason);
|
|
7273
|
-
}
|
|
7277
|
+
};
|
|
7274
7278
|
// Create callback when action item click event handler is defined,
|
|
7275
7279
|
// free-solo mode is NOT set and 'Enter' key has been pressed
|
|
7276
7280
|
const handleKeyDown = allowActionButtonClick && (event => {
|
|
@@ -7317,29 +7321,27 @@ const DotAutoComplete = ({
|
|
|
7317
7321
|
}), getInputAdornment(), nativeEndAdornment]
|
|
7318
7322
|
});
|
|
7319
7323
|
};
|
|
7320
|
-
const renderAISendAdornment =
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7324
|
+
const renderAISendAdornment = useMemo(() => {
|
|
7325
|
+
return jsx(DotIconButton, {
|
|
7326
|
+
iconId: "send-airplane",
|
|
7327
|
+
tooltip: "Send",
|
|
7328
|
+
"data-testid": dataTestId && `${dataTestId}-send-airplane-icon`,
|
|
7329
|
+
shape: "square",
|
|
7330
|
+
color: "ai",
|
|
7331
|
+
disabled: !inputText,
|
|
7332
|
+
onClick: () => {
|
|
7333
|
+
if (inputText) {
|
|
7334
|
+
handleAiAction(inputText);
|
|
7335
|
+
setInputText('');
|
|
7336
|
+
onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange({
|
|
7337
|
+
target: {
|
|
7338
|
+
value: ''
|
|
7339
|
+
}
|
|
7340
|
+
}, '', 'clear');
|
|
7336
7341
|
}
|
|
7337
|
-
}
|
|
7338
|
-
className: "ai-text-clear-icon",
|
|
7339
|
-
children: params.InputProps.endAdornment
|
|
7340
|
-
})]
|
|
7342
|
+
}
|
|
7341
7343
|
});
|
|
7342
|
-
};
|
|
7344
|
+
}, [inputText]);
|
|
7343
7345
|
const renderTrimmedLongOptions = (props, option) => {
|
|
7344
7346
|
const key = 'id' in option ? option.id : option.title;
|
|
7345
7347
|
return jsx(DotTooltip, {
|
|
@@ -7360,7 +7362,7 @@ const DotAutoComplete = ({
|
|
|
7360
7362
|
};
|
|
7361
7363
|
const getEndAdornment = params => {
|
|
7362
7364
|
if (ai) {
|
|
7363
|
-
return renderAISendAdornment
|
|
7365
|
+
return renderAISendAdornment;
|
|
7364
7366
|
}
|
|
7365
7367
|
if (!readOnly) {
|
|
7366
7368
|
return renderEndAdornment(params.InputProps.endAdornment);
|
|
@@ -7448,7 +7450,8 @@ const DotAutoComplete = ({
|
|
|
7448
7450
|
'data-testid': dataTestId && `${dataTestId}-input`,
|
|
7449
7451
|
id: inputId,
|
|
7450
7452
|
className: useStylesWithRootClass(inputProps.className, 'dot-input'),
|
|
7451
|
-
readOnly
|
|
7453
|
+
readOnly,
|
|
7454
|
+
value: ai ? inputText : inputProps.value
|
|
7452
7455
|
}),
|
|
7453
7456
|
InputLabelProps: {
|
|
7454
7457
|
htmlFor: inputId
|
|
@@ -7469,8 +7472,9 @@ const DotAutoComplete = ({
|
|
|
7469
7472
|
if (event.key === 'Enter' && ai) {
|
|
7470
7473
|
event.stopPropagation();
|
|
7471
7474
|
event.preventDefault();
|
|
7472
|
-
|
|
7473
|
-
|
|
7475
|
+
handleAiAction(inputText);
|
|
7476
|
+
setInputText(''); // Clear input after enter
|
|
7477
|
+
onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(event, '', 'clear');
|
|
7474
7478
|
}
|
|
7475
7479
|
},
|
|
7476
7480
|
placeholder: showPlaceholder ? placeholder : undefined,
|