@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.js CHANGED
@@ -4945,10 +4945,39 @@ const borderColorClasses$3 = [
4945
4945
  /**
4946
4946
  * TextArea.
4947
4947
  */
4948
- const TextArea = ({ readonly = false, disabled = false, onChange, onKeyUp, onFocus, onBlur, onKeyDown, id, name, rows = 3, cols = undefined, value, placeholder, showError, extraClassNames, testId, autoFocus = false, }) => {
4948
+ const TextArea = React.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) => {
4949
4949
  const appliedClasses = `${baseClasses$4} ${extraClassNames} ${lightTheme$2} ${darkTheme$2} ${showError ? errorClasses$3 : borderColorClasses$3}`;
4950
- return (jsxRuntime.jsx("textarea", { "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 }));
4951
- };
4950
+ const textareaRef = React.useRef(null);
4951
+ // Handle selection change events
4952
+ React.useEffect(() => {
4953
+ if (!onSelectionChange || !textareaRef.current) {
4954
+ return;
4955
+ }
4956
+ const textarea = textareaRef.current;
4957
+ const handleSelectionChange = (e) => {
4958
+ onSelectionChange(e);
4959
+ };
4960
+ // Add event listeners for selection changes
4961
+ textarea.addEventListener('selectionchange', handleSelectionChange);
4962
+ // Also listen for mouse and keyboard events that change selection
4963
+ textarea.addEventListener('mouseup', handleSelectionChange);
4964
+ textarea.addEventListener('keyup', handleSelectionChange);
4965
+ return () => {
4966
+ textarea.removeEventListener('selectionchange', handleSelectionChange);
4967
+ textarea.removeEventListener('mouseup', handleSelectionChange);
4968
+ textarea.removeEventListener('keyup', handleSelectionChange);
4969
+ };
4970
+ }, [onSelectionChange]);
4971
+ return (jsxRuntime.jsx("textarea", { ref: (element) => {
4972
+ textareaRef.current = element;
4973
+ if (typeof ref === 'function') {
4974
+ ref(element);
4975
+ }
4976
+ else if (ref) {
4977
+ ref.current = element;
4978
+ }
4979
+ }, "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 }));
4980
+ });
4952
4981
 
4953
4982
  /**
4954
4983
  * @deprecated
@@ -16659,7 +16688,7 @@ const InputGroup = React.forwardRef((props, ref) => {
16659
16688
  const fieldAppliedClasses = `${fieldClasses} ${extraClassNames} ${lightTheme} ${darkTheme} ${fieldBorderRadius} ${showError ? errorClasses : borderColorClasses} `;
16660
16689
  const elementsToAppend = append.filter(Boolean);
16661
16690
  return (jsxRuntime.jsxs("div", { id: `input-group-${id}`, className: appliedClasses, children: [field ? (jsxRuntime.jsx("div", { "data-testid": testId, className: `tw-flex tw-flex-1 tw-cursor-pointer active:tw-z-50 ${fieldAppliedClasses}`, children: field })) : (jsxRuntime.jsx(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) => {
16662
- return item?.variant === 'button' ? (jsxRuntime.jsx(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)) : (jsxRuntime.jsx("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 tw-ml-[-1px] active:tw-z-30 active:tw-border tw-border`, children: item?.element }, index));
16691
+ return item?.variant === 'button' ? (jsxRuntime.jsx(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)) : (jsxRuntime.jsx("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));
16663
16692
  })] }));
16664
16693
  });
16665
16694