@seeqdev/qomponents 0.0.166 → 0.0.168
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/dist/index.esm.js +33 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +33 -4
- package/dist/index.js.map +1 -1
- package/dist/src/TextArea/TextArea.types.d.ts +11 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -4925,10 +4925,39 @@ const borderColorClasses$3 = [
|
|
|
4925
4925
|
/**
|
|
4926
4926
|
* TextArea.
|
|
4927
4927
|
*/
|
|
4928
|
-
const TextArea = ({ readonly = false, disabled = false, onChange, onKeyUp, onFocus, onBlur, onKeyDown, id, name, rows = 3, cols = undefined, value, placeholder, showError, extraClassNames, testId, autoFocus = false, }) => {
|
|
4928
|
+
const TextArea = React__default.forwardRef(({ readonly = false, disabled = false, onChange, onKeyUp, onFocus, onBlur, onKeyDown, onSelectionChange, id, name, rows = 3, cols = undefined, value, placeholder, showError, extraClassNames, testId, autoFocus = false, }, ref) => {
|
|
4929
4929
|
const appliedClasses = `${baseClasses$4} ${extraClassNames} ${lightTheme$2} ${darkTheme$2} ${showError ? errorClasses$3 : borderColorClasses$3}`;
|
|
4930
|
-
|
|
4931
|
-
|
|
4930
|
+
const textareaRef = useRef(null);
|
|
4931
|
+
// Handle selection change events
|
|
4932
|
+
useEffect(() => {
|
|
4933
|
+
if (!onSelectionChange || !textareaRef.current) {
|
|
4934
|
+
return;
|
|
4935
|
+
}
|
|
4936
|
+
const textarea = textareaRef.current;
|
|
4937
|
+
const handleSelectionChange = (e) => {
|
|
4938
|
+
onSelectionChange(e);
|
|
4939
|
+
};
|
|
4940
|
+
// Add event listeners for selection changes
|
|
4941
|
+
textarea.addEventListener('selectionchange', handleSelectionChange);
|
|
4942
|
+
// Also listen for mouse and keyboard events that change selection
|
|
4943
|
+
textarea.addEventListener('mouseup', handleSelectionChange);
|
|
4944
|
+
textarea.addEventListener('keyup', handleSelectionChange);
|
|
4945
|
+
return () => {
|
|
4946
|
+
textarea.removeEventListener('selectionchange', handleSelectionChange);
|
|
4947
|
+
textarea.removeEventListener('mouseup', handleSelectionChange);
|
|
4948
|
+
textarea.removeEventListener('keyup', handleSelectionChange);
|
|
4949
|
+
};
|
|
4950
|
+
}, [onSelectionChange]);
|
|
4951
|
+
return (jsx$1("textarea", { ref: (element) => {
|
|
4952
|
+
textareaRef.current = element;
|
|
4953
|
+
if (typeof ref === 'function') {
|
|
4954
|
+
ref(element);
|
|
4955
|
+
}
|
|
4956
|
+
else if (ref) {
|
|
4957
|
+
ref.current = element;
|
|
4958
|
+
}
|
|
4959
|
+
}, "data-testid": testId, name: name, id: id, value: value, className: appliedClasses, placeholder: placeholder, disabled: disabled, readOnly: readonly, onChange: onChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onKeyUp: onKeyUp, rows: rows, cols: cols, autoFocus: autoFocus }));
|
|
4960
|
+
});
|
|
4932
4961
|
|
|
4933
4962
|
/**
|
|
4934
4963
|
* @deprecated
|
|
@@ -16639,7 +16668,7 @@ const InputGroup = React__default.forwardRef((props, ref) => {
|
|
|
16639
16668
|
const fieldAppliedClasses = `${fieldClasses} ${extraClassNames} ${lightTheme} ${darkTheme} ${fieldBorderRadius} ${showError ? errorClasses : borderColorClasses} `;
|
|
16640
16669
|
const elementsToAppend = append.filter(Boolean);
|
|
16641
16670
|
return (jsxs("div", { id: `input-group-${id}`, className: appliedClasses, children: [field ? (jsx$1("div", { "data-testid": testId, className: `tw-flex tw-flex-1 tw-cursor-pointer active:tw-z-50 ${fieldAppliedClasses}`, children: field })) : (jsx$1(TextField, { testId: testId, readonly: readonly, onChange: onChange, onKeyUp: onKeyUp, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, name: name, ref: ref, showError: showError, value: value, required: required, placeholder: placeholder, autoComplete: autoComplete, autoFocus: autoFocus, id: id, type: type, disabled: disabled, step: step, min: min, max: max, maxLength: maxLength, minLength: minLength, extraClassNames: `tw-flex tw-flex-1 tw-w-full focus:tw-z-30 tw-rounded-r-none last:tw-rounded-r-md ${extraClassNames}`, ...tooltipData })), elementsToAppend.map((item, index) => {
|
|
16642
|
-
return item?.variant === 'button' ? (jsx$1(Button, { extraClassNames: `${index ? 'tw-ml-[-1px]' : 'tw-ml-0'} focus:tw-z-40 focus:tw-border tw-rounded-none last:tw-rounded-r-md`, ...item.buttonProps }, index)) : (jsx$1("div", { className: `${borderColorClasses} ${index ? 'tw-ml-[-1px]' : 'tw-ml-0'} tw-flex tw-items-center tw-justify-center tw-rounded-none last:tw-rounded-r-md
|
|
16671
|
+
return item?.variant === 'button' ? (jsx$1(Button, { extraClassNames: `${index ? 'tw-ml-[-1px]' : 'tw-ml-0'} focus:tw-z-40 focus:tw-border tw-rounded-none last:tw-rounded-r-md`, ...item.buttonProps }, index)) : (jsx$1("div", { className: `${borderColorClasses} ${index ? 'tw-ml-[-1px]' : 'tw-ml-0'} tw-flex tw-items-center tw-justify-center tw-rounded-none last:tw-rounded-r-md active:tw-z-30 active:tw-border tw-border`, children: item?.element }, index));
|
|
16643
16672
|
})] }));
|
|
16644
16673
|
});
|
|
16645
16674
|
|