@seeqdev/qomponents 0.0.190 → 0.0.191

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/README.md CHANGED
@@ -47,16 +47,10 @@ To make sure all styles are properly applied be sure to include the qomponents c
47
47
 
48
48
  ```css
49
49
  @import '@seeqdev/qomponents/dist/styles.css';
50
-
51
- @font-face {
52
- font-family: 'fontCustom';
53
- src: url('@seeqdev/qomponents/dist/FontCustom.woff2') format('woff2'), url('@seeqdev/qomponents/dist/FontCustom.woff')
54
- format('woff');
55
- font-weight: normal;
56
- font-style: normal;
57
- }
58
50
  ```
59
51
 
52
+ **Note:** The styles.css file already includes the icon font definitions, so you don't need to manually add `@font-face` declarations.
53
+
60
54
  <b>A note on CSS:</b> Seeq's qomponents come fully styled and ready to use. While it is tempting to use the
61
55
  available <i>extraClassNames</i> property to provide yet additional styling we strongly advise you to use this
62
56
  property to provide only width, margins and padding. This will ensure for a smooth upgrade experience when
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as jsx$1, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import React__default, { useLayoutEffect, useState, useRef, useEffect, useCallback, forwardRef, useContext, useMemo, createContext, Component, Fragment as Fragment$1, useId as useId$1, useInsertionEffect as useInsertionEffect$2, Children, isValidElement, createElement } from 'react';
3
+ import React__default, { useLayoutEffect, useState, useCallback, useRef, useEffect, forwardRef, useContext, useMemo, createContext, Component, Fragment as Fragment$1, useId as useId$1, useInsertionEffect as useInsertionEffect$2, Children, isValidElement, createElement } from 'react';
4
4
  import * as ReactDOM from 'react-dom';
5
5
  import ReactDOM__default, { createPortal } from 'react-dom';
6
6
 
@@ -3843,7 +3843,7 @@ var removedBarSizeVariable = '--removed-body-scroll-bar-size';
3843
3843
  * assignRef(refObject, "refValue");
3844
3844
  * assignRef(refFn, "refValue");
3845
3845
  */
3846
- function assignRef(ref, value) {
3846
+ function assignRef$1(ref, value) {
3847
3847
  if (typeof ref === 'function') {
3848
3848
  ref(value);
3849
3849
  }
@@ -3910,7 +3910,7 @@ var currentValues = new WeakMap();
3910
3910
  */
3911
3911
  function useMergeRefs(refs, defaultValue) {
3912
3912
  var callbackRef = useCallbackRef(null, function (newValue) {
3913
- return refs.forEach(function (ref) { return assignRef(ref, newValue); });
3913
+ return refs.forEach(function (ref) { return assignRef$1(ref, newValue); });
3914
3914
  });
3915
3915
  // handle refs changes - added or removed
3916
3916
  useIsomorphicLayoutEffect$1(function () {
@@ -3921,12 +3921,12 @@ function useMergeRefs(refs, defaultValue) {
3921
3921
  var current_1 = callbackRef.current;
3922
3922
  prevRefs_1.forEach(function (ref) {
3923
3923
  if (!nextRefs_1.has(ref)) {
3924
- assignRef(ref, null);
3924
+ assignRef$1(ref, null);
3925
3925
  }
3926
3926
  });
3927
3927
  nextRefs_1.forEach(function (ref) {
3928
3928
  if (!prevRefs_1.has(ref)) {
3929
- assignRef(ref, current_1);
3929
+ assignRef$1(ref, current_1);
3930
3930
  }
3931
3931
  });
3932
3932
  }
@@ -4888,6 +4888,41 @@ const setValidInputDimension = (width, height) => {
4888
4888
  return inputStyle;
4889
4889
  };
4890
4890
 
4891
+ function assignRef(ref, value) {
4892
+ if (typeof ref === "function") {
4893
+ return ref(value);
4894
+ } else if (typeof ref === "object" && ref !== null && "current" in ref) {
4895
+ ref.current = value;
4896
+ }
4897
+ }
4898
+ function mergeRefs(...refs) {
4899
+ const cleanupMap = /* @__PURE__ */ new Map();
4900
+ return (node) => {
4901
+ refs.forEach((ref) => {
4902
+ const cleanup = assignRef(ref, node);
4903
+ if (cleanup) {
4904
+ cleanupMap.set(ref, cleanup);
4905
+ }
4906
+ });
4907
+ if (cleanupMap.size > 0) {
4908
+ return () => {
4909
+ refs.forEach((ref) => {
4910
+ const cleanup = cleanupMap.get(ref);
4911
+ if (cleanup && typeof cleanup === "function") {
4912
+ cleanup();
4913
+ } else {
4914
+ assignRef(ref, null);
4915
+ }
4916
+ });
4917
+ cleanupMap.clear();
4918
+ };
4919
+ }
4920
+ };
4921
+ }
4922
+ function useMergedRef(...refs) {
4923
+ return useCallback(mergeRefs(...refs), refs);
4924
+ }
4925
+
4891
4926
  const errorClasses$4 = 'tw:border-sq-danger';
4892
4927
  const borderColorClasses$4 = [
4893
4928
  'tw:border-sq-disabled-gray',
@@ -4913,13 +4948,9 @@ const sizeClasses = {
4913
4948
  const TextField = React__default.forwardRef((props, ref) => {
4914
4949
  const { readonly = false, disabled = false, onChange, onKeyUp, onFocus, onBlur, onKeyDown, id, name, size = 'sm', value, placeholder, extraClassNames, testId, type = 'text', inputGroup, step, showError, errorText, min, max, maxLength, minLength, required = false, autoComplete = 'off', inputWidth = undefined, inputHeight = undefined, autoFocus = false, ...tooltipProps } = props;
4915
4950
  const internalRef = useRef(null);
4951
+ const mergedRef = useMergedRef(ref, internalRef);
4916
4952
  const [cursor, setCursor] = useState(null);
4917
4953
  const tooltipData = getQTipData(tooltipProps);
4918
- const setAllRefs = (receivedRef) => {
4919
- if (ref)
4920
- ref.current = receivedRef;
4921
- internalRef.current = receivedRef;
4922
- };
4923
4954
  useEffect(() => {
4924
4955
  if (autoFocus) {
4925
4956
  setTimeout(() => {
@@ -4965,7 +4996,7 @@ const TextField = React__default.forwardRef((props, ref) => {
4965
4996
  inputLenghtProp.maxLength = maxLength;
4966
4997
  if (minLength)
4967
4998
  inputLenghtProp.minLength = minLength;
4968
- return (jsxs(Fragment, { children: [jsx$1("input", { ref: setAllRefs, "data-testid": testId, name: name, id: id, type: type, value: value, className: appliedClasses, placeholder: placeholder, disabled: disabled, readOnly: readonly, autoComplete: autoComplete, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onKeyUp: onKeyUp, step: step, required: required, min: min, max: max, ...inputLenghtProp, ...inputProp, ...tooltipData }), errorText && showError && jsx$1("div", { className: "tw:text-sq-danger tw:text-xs tw:mt-1", children: errorText })] }));
4999
+ return (jsxs(Fragment, { children: [jsx$1("input", { ref: mergedRef, "data-testid": testId, name: name, id: id, type: type, value: value, className: appliedClasses, placeholder: placeholder, disabled: disabled, readOnly: readonly, autoComplete: autoComplete, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onKeyUp: onKeyUp, step: step, required: required, min: min, max: max, ...inputLenghtProp, ...inputProp, ...tooltipData }), errorText && showError && jsx$1("div", { className: "tw:text-sq-danger tw:text-xs tw:mt-1", children: errorText })] }));
4969
5000
  });
4970
5001
 
4971
5002
  const alignment = 'tw:flex';
@@ -5010,6 +5041,7 @@ const borderColorClasses$3 = [
5010
5041
  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) => {
5011
5042
  const appliedClasses = `${baseClasses$4} ${extraClassNames} ${lightTheme$2} ${darkTheme$2} ${showError ? errorClasses$3 : borderColorClasses$3}`;
5012
5043
  const textareaRef = useRef(null);
5044
+ const mergedRef = useMergedRef(ref, textareaRef);
5013
5045
  // Handle selection change events
5014
5046
  useEffect(() => {
5015
5047
  if (!onSelectionChange || !textareaRef.current) {
@@ -5030,15 +5062,7 @@ const TextArea = React__default.forwardRef(({ readonly = false, disabled = false
5030
5062
  textarea.removeEventListener('keyup', handleSelectionChange);
5031
5063
  };
5032
5064
  }, [onSelectionChange]);
5033
- return (jsx$1("textarea", { ref: (element) => {
5034
- textareaRef.current = element;
5035
- if (typeof ref === 'function') {
5036
- ref(element);
5037
- }
5038
- else if (ref) {
5039
- ref.current = element;
5040
- }
5041
- }, "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 }));
5065
+ return (jsx$1("textarea", { ref: mergedRef, "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 }));
5042
5066
  });
5043
5067
 
5044
5068
  /**
@@ -29406,5 +29430,5 @@ const svgIconTypes = [...iconTypes, 'default'];
29406
29430
 
29407
29431
  const toolbarButtonVariants = ['outline', 'theme', 'theme-light', 'warning', 'danger', 'no-border'];
29408
29432
 
29409
- export { Accordion, Alert, Button, ButtonGroup, ButtonWithDropdown, ButtonWithPopover, Carousel, Checkbox, Collapse, DEFAULT_TOOL_TIP_DELAY, Icon, InputGroup, Modal, ProgressBar, QTip, SeeqActionDropdown, Select, components as SelectCompoents, Slider, Tabs, TextArea, TextField, ToolbarButton, Tooltip, buttonSizes, buttonTypes, buttonVariants, iconPositions, iconTypes, svgIconTypes, toolbarButtonVariants, tooltipPositions };
29433
+ export { Accordion, Alert, Button, ButtonGroup, ButtonWithDropdown, ButtonWithPopover, Carousel, Checkbox, Collapse, DEFAULT_TOOL_TIP_DELAY, Icon, InputGroup, Modal, ProgressBar, QTip, SeeqActionDropdown, Select, components as SelectComponents, Slider, Tabs, TextArea, TextField, ToolbarButton, Tooltip, buttonSizes, buttonTypes, buttonVariants, iconPositions, iconTypes, svgIconTypes, toolbarButtonVariants, tooltipPositions };
29410
29434
  //# sourceMappingURL=index.esm.js.map