@seeqdev/qomponents 0.0.163 → 0.0.165

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
@@ -100,7 +100,7 @@ const colorClassesThemeDark = {
100
100
  * - access to Seeq custom icons by providing the desired icon
101
101
  * - leverage "type" to style your icon
102
102
  */
103
- const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClassNames, id, large, small, color, testId, customId, number, ...tooltipProps }) => {
103
+ const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClassNames, id, large, small, size, color, testId, customId, number, ...tooltipProps }) => {
104
104
  if ((type === 'color' && (color === undefined || color === '')) || (color && type !== 'color')) {
105
105
  const errorMessage = color === undefined || color === ''
106
106
  ? 'Icon with type="color" must have prop color specified.'
@@ -110,7 +110,8 @@ const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClas
110
110
  const fontAwesomePrefix = iconPrefix ? iconPrefix : 'fa-sharp fa-regular';
111
111
  const iconPrefixString = icon.startsWith('fc') ? 'fc' : fontAwesomePrefix;
112
112
  const style = type === 'color' && color ? { color } : {};
113
- const appliedClassNames = `${iconPrefixString} ${icon} ${small ? 'fa-sm' : ''} ${large ? 'fa-lg' : ''}
113
+ const sizeClass = size ? `fa-${size}` : small ? 'fa-sm' : large ? 'fa-lg' : '';
114
+ const appliedClassNames = `${iconPrefixString} ${icon} ${sizeClass}
114
115
  ${colorClassesThemeLight[type]} ${colorClassesThemeDark[type]} ${onClick ? 'tw-cursor-pointer' : ''} ${extraClassNames} focus:tw-outline-none focus-visible:tw-outline-none tw-outline-none`;
115
116
  const tooltipData = getQTipData(tooltipProps);
116
117
  return (jsxRuntime.jsx("i", { className: appliedClassNames, style: style, onClick: onClick, "data-testid": testId, "data-customid": customId, id: id, "data-number": number, ...tooltipData }));
@@ -4944,10 +4945,39 @@ const borderColorClasses$3 = [
4944
4945
  /**
4945
4946
  * TextArea.
4946
4947
  */
4947
- 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) => {
4948
4949
  const appliedClasses = `${baseClasses$4} ${extraClassNames} ${lightTheme$2} ${darkTheme$2} ${showError ? errorClasses$3 : borderColorClasses$3}`;
4949
- 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 }));
4950
- };
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
+ });
4951
4981
 
4952
4982
  /**
4953
4983
  * @deprecated