@synerise/ds-input 1.6.9 → 1.6.10

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.
Files changed (66) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/AutosizeInput/AutosizeInput.d.ts +2 -2
  3. package/dist/AutosizeInput/AutosizeInput.js +80 -95
  4. package/dist/AutosizeInput/AutosizeInput.types.d.ts +1 -1
  5. package/dist/AutosizeInput/AutosizeInput.types.js +1 -1
  6. package/dist/AutosizeInput/utils/calculateInputWidth.d.ts +1 -1
  7. package/dist/AutosizeInput/utils/calculateInputWidth.js +13 -11
  8. package/dist/AutosizeInput/utils/index.js +4 -1
  9. package/dist/Input.d.ts +5 -7
  10. package/dist/Input.js +117 -174
  11. package/dist/Input.styles.d.ts +22 -22
  12. package/dist/Input.styles.js +98 -122
  13. package/dist/Input.types.d.ts +5 -5
  14. package/dist/Input.types.js +1 -1
  15. package/dist/InputGroup.d.ts +2 -2
  16. package/dist/InputGroup.js +21 -38
  17. package/dist/InputGroup.styles.d.ts +2 -2
  18. package/dist/InputGroup.styles.js +8 -8
  19. package/dist/InputGroup.types.d.ts +2 -2
  20. package/dist/InputGroup.types.js +1 -1
  21. package/dist/InputMultivalue/Elements/Value.d.ts +2 -2
  22. package/dist/InputMultivalue/Elements/Value.js +22 -34
  23. package/dist/InputMultivalue/Elements/Value.types.d.ts +2 -2
  24. package/dist/InputMultivalue/Elements/Value.types.js +1 -1
  25. package/dist/InputMultivalue/InputMultivalue.d.ts +2 -2
  26. package/dist/InputMultivalue/InputMultivalue.js +52 -74
  27. package/dist/InputMultivalue/InputMultivalue.styles.d.ts +10 -10
  28. package/dist/InputMultivalue/InputMultivalue.styles.js +48 -67
  29. package/dist/InputMultivalue/InputMultivalue.types.d.ts +1 -1
  30. package/dist/InputMultivalue/InputMultivalue.types.js +1 -1
  31. package/dist/PasswordInput.d.ts +2 -2
  32. package/dist/PasswordInput.js +31 -45
  33. package/dist/PasswordInput.types.d.ts +2 -2
  34. package/dist/PasswordInput.types.js +1 -1
  35. package/dist/TextArea.d.ts +4 -6
  36. package/dist/TextArea.js +53 -75
  37. package/dist/TextArea.types.d.ts +2 -2
  38. package/dist/TextArea.types.js +1 -1
  39. package/dist/Textarea/Textarea.d.ts +4 -4
  40. package/dist/Textarea/Textarea.js +32 -51
  41. package/dist/Textarea/Textarea.styles.d.ts +2 -2
  42. package/dist/Textarea/Textarea.styles.js +10 -9
  43. package/dist/Textarea/Textarea.types.d.ts +3 -3
  44. package/dist/Textarea/Textarea.types.js +1 -1
  45. package/dist/assets/style/index-tn0RQdqM.css +0 -0
  46. package/dist/components/AutosizeWrapper.d.ts +2 -2
  47. package/dist/components/AutosizeWrapper.js +16 -18
  48. package/dist/components/ElementIcons.d.ts +2 -2
  49. package/dist/components/ElementIcons.js +37 -51
  50. package/dist/components/ExpandableWrapper.d.ts +3 -3
  51. package/dist/components/ExpandableWrapper.js +20 -21
  52. package/dist/components/index.js +8 -3
  53. package/dist/hooks/index.js +6 -2
  54. package/dist/hooks/useCounterLimit.d.ts +2 -2
  55. package/dist/hooks/useCounterLimit.js +19 -14
  56. package/dist/hooks/useElementFocus.d.ts +2 -2
  57. package/dist/hooks/useElementFocus.js +6 -3
  58. package/dist/hooks/useInputAddonHeight.d.ts +2 -2
  59. package/dist/hooks/useInputAddonHeight.js +10 -10
  60. package/dist/index.js +24 -12
  61. package/dist/modules.d.js +1 -1
  62. package/dist/modules.d.ts +0 -0
  63. package/dist/utils/getCharCount.d.ts +2 -2
  64. package/dist/utils/getCharCount.js +5 -2
  65. package/dist/utils/index.js +4 -1
  66. package/package.json +9 -9
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.6.10](https://github.com/synerise/synerise-design/compare/@synerise/ds-input@1.6.9...@synerise/ds-input@1.6.10) (2026-03-24)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-input
9
+
6
10
  ## [1.6.9](https://github.com/synerise/synerise-design/compare/@synerise/ds-input@1.6.8...@synerise/ds-input@1.6.9) (2026-03-20)
7
11
 
8
12
  **Note:** Version bump only for package @synerise/ds-input
@@ -1,5 +1,5 @@
1
- import React, { type CSSProperties } from 'react';
2
- import type { AutosizeInputRefType } from './AutosizeInput.types';
1
+ import { default as React, CSSProperties } from 'react';
2
+ import { AutosizeInputRefType } from './AutosizeInput.types';
3
3
  declare const AutosizeInput: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & {
4
4
  placeholderIsMinWidth?: boolean;
5
5
  wrapperClassName?: string;
@@ -1,87 +1,80 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef } from 'react';
3
- import { useResizeObserver } from '@synerise/ds-utils';
4
- import { calculateInputWidth } from './utils';
5
- var sizerStyle = {
6
- position: 'absolute',
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useRef, useMemo, useCallback, useLayoutEffect, useEffect, useImperativeHandle } from "react";
3
+ import { useResizeObserver } from "@synerise/ds-utils";
4
+ import calculateInputWidth from "./utils/calculateInputWidth.js";
5
+ const sizerStyle = {
6
+ position: "absolute",
7
7
  top: 0,
8
8
  left: 0,
9
- visibility: 'hidden',
9
+ visibility: "hidden",
10
10
  height: 0,
11
- overflow: 'scroll',
12
- whiteSpace: 'pre'
11
+ overflow: "scroll",
12
+ whiteSpace: "pre"
13
13
  };
14
- var FONT_CSS_PROPS = ['fontSize', 'fontFamily', 'fontWeight', 'fontFeatureSettings', 'fontStyle', 'letterSpacing', 'fontStretch', 'textTransform'];
15
- var AutosizeInput = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
16
- var _ref2, _style$display;
17
- var _ref$extraWidth = _ref.extraWidth,
18
- extraWidth = _ref$extraWidth === void 0 ? 16 : _ref$extraWidth,
19
- wrapperClassName = _ref.wrapperClassName,
20
- wrapperStyleProp = _ref.wrapperStyle,
21
- onAutosize = _ref.onAutosize,
22
- preAutosize = _ref.preAutosize,
23
- placeholderIsMinWidth = _ref.placeholderIsMinWidth,
24
- _ref$minWidth = _ref.minWidth,
25
- minWidth = _ref$minWidth === void 0 ? 0 : _ref$minWidth,
26
- handleInputRef = _ref.handleInputRef,
27
- children = _ref.children,
28
- transformWrapperRef = _ref.transformWrapperRef,
29
- transformRef = _ref.transformRef,
30
- placeholder = _ref.placeholder,
31
- value = _ref.value,
32
- defaultValue = _ref.defaultValue,
33
- style = _ref.style;
34
- var usedValue = (_ref2 = value != null ? value : defaultValue) != null ? _ref2 : '';
35
- var inputRef = useRef(null);
36
- var inputWrapperRef = useRef(null);
37
- var sizerRef = useRef(null);
38
- var placeholderSizerRef = useRef(null);
39
- var wrapperRef = useRef(null);
40
- var transformWrapper = useMemo(function () {
41
- return transformWrapperRef || function (element) {
42
- return element;
43
- };
14
+ const FONT_CSS_PROPS = ["fontSize", "fontFamily", "fontWeight", "fontFeatureSettings", "fontStyle", "letterSpacing", "fontStretch", "textTransform"];
15
+ const AutosizeInput = forwardRef(({
16
+ extraWidth = 16,
17
+ wrapperClassName,
18
+ wrapperStyle: wrapperStyleProp,
19
+ onAutosize,
20
+ preAutosize,
21
+ placeholderIsMinWidth,
22
+ minWidth = 0,
23
+ handleInputRef,
24
+ children,
25
+ transformWrapperRef,
26
+ transformRef,
27
+ placeholder,
28
+ value,
29
+ defaultValue,
30
+ style
31
+ }, forwardedRef) => {
32
+ const usedValue = value ?? defaultValue ?? "";
33
+ const inputRef = useRef(null);
34
+ const inputWrapperRef = useRef(null);
35
+ const sizerRef = useRef(null);
36
+ const placeholderSizerRef = useRef(null);
37
+ const wrapperRef = useRef(null);
38
+ const transformWrapper = useMemo(() => {
39
+ return transformWrapperRef || ((element) => element);
44
40
  }, [transformWrapperRef]);
45
- var transformElement = useMemo(function () {
46
- return transformRef || function (element) {
47
- return element;
48
- };
41
+ const transformElement = useMemo(() => {
42
+ return transformRef || ((element) => element);
49
43
  }, [transformRef]);
50
- var contentWidth = useRef();
51
- var placeholderWidth = useRef();
52
- var applyNewWidth = useCallback(function () {
53
- var _sizerRef$current, _placeholderWidth$cur, _placeholderSizerRef$;
54
- var calculatedWidth = calculateInputWidth({
44
+ const contentWidth = useRef();
45
+ const placeholderWidth = useRef();
46
+ const applyNewWidth = useCallback(() => {
47
+ const calculatedWidth = calculateInputWidth({
55
48
  sizerWidth: contentWidth.current,
56
- hasValue: !!((_sizerRef$current = sizerRef.current) != null && _sizerRef$current.textContent),
57
- placeholderIsMinWidth: placeholderIsMinWidth,
58
- placeholderWidth: (_placeholderWidth$cur = placeholderWidth.current) != null ? _placeholderWidth$cur : (_placeholderSizerRef$ = placeholderSizerRef.current) == null ? void 0 : _placeholderSizerRef$.scrollWidth,
49
+ hasValue: !!sizerRef.current?.textContent,
50
+ placeholderIsMinWidth,
51
+ placeholderWidth: placeholderWidth.current ?? placeholderSizerRef.current?.scrollWidth,
59
52
  minWidth: +minWidth,
60
- placeholder: placeholder
53
+ placeholder
61
54
  });
62
55
  if (inputWrapperRef.current) {
63
- var finalWidth = calculatedWidth + +extraWidth;
56
+ const finalWidth = calculatedWidth + +extraWidth;
64
57
  if (finalWidth !== parseFloat(inputWrapperRef.current.style.width)) {
65
58
  preAutosize && preAutosize(calculatedWidth);
66
- inputWrapperRef.current.style.width = finalWidth + "px";
59
+ inputWrapperRef.current.style.width = `${finalWidth}px`;
67
60
  onAutosize && onAutosize(calculatedWidth);
68
61
  }
69
62
  }
70
63
  }, [extraWidth, minWidth, onAutosize, placeholder, placeholderIsMinWidth, preAutosize]);
71
- var resizeContentHandler = useCallback(function (newWidth) {
64
+ const resizeContentHandler = useCallback((newWidth) => {
72
65
  contentWidth.current = newWidth.width;
73
66
  applyNewWidth();
74
67
  }, [applyNewWidth]);
75
- var resizePlaceholderHandler = useCallback(function (newWidth) {
68
+ const resizePlaceholderHandler = useCallback((newWidth) => {
76
69
  placeholderWidth.current = newWidth.width;
77
70
  applyNewWidth();
78
71
  }, [applyNewWidth]);
79
72
  useResizeObserver(sizerRef, resizeContentHandler);
80
73
  useResizeObserver(placeholderSizerRef, resizePlaceholderHandler);
81
- var copyInputStyles = function copyInputStyles() {
74
+ const copyInputStyles = () => {
82
75
  if (inputRef.current) {
83
- var computedStyle = window.getComputedStyle(inputRef.current);
84
- FONT_CSS_PROPS.forEach(function (cssProperty) {
76
+ const computedStyle = window.getComputedStyle(inputRef.current);
77
+ FONT_CSS_PROPS.forEach((cssProperty) => {
85
78
  if (sizerRef.current) {
86
79
  sizerRef.current.style[cssProperty] = computedStyle[cssProperty];
87
80
  }
@@ -91,55 +84,47 @@ var AutosizeInput = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
91
84
  });
92
85
  }
93
86
  };
94
- useLayoutEffect(function () {
87
+ useLayoutEffect(() => {
95
88
  copyInputStyles();
96
89
  }, []);
97
- useEffect(function () {
90
+ useEffect(() => {
98
91
  if (sizerRef.current) {
99
- var sizerSibling = sizerRef.current.nextElementSibling;
100
- var inputElement = sizerSibling instanceof HTMLElement && transformElement(sizerSibling);
101
- var inputWrapperElement = sizerSibling instanceof HTMLElement && transformWrapper(sizerSibling);
92
+ const sizerSibling = sizerRef.current.nextElementSibling;
93
+ const inputElement = sizerSibling instanceof HTMLElement && transformElement(sizerSibling);
94
+ const inputWrapperElement = sizerSibling instanceof HTMLElement && transformWrapper(sizerSibling);
102
95
  if (inputWrapperElement && inputWrapperElement instanceof HTMLElement) {
103
96
  inputWrapperRef.current = inputWrapperElement;
104
97
  }
105
98
  if (inputElement && !inputRef.current) {
106
99
  if (inputElement && inputElement instanceof HTMLInputElement) {
107
100
  inputRef.current = inputElement;
108
- inputRef.current.style.boxSizing = 'content-box';
101
+ inputRef.current.style.boxSizing = "content-box";
109
102
  handleInputRef && handleInputRef(inputElement, sizerSibling);
110
103
  copyInputStyles();
111
104
  }
112
105
  }
113
106
  }
114
107
  }, [handleInputRef, transformElement, transformWrapper]);
115
- useImperativeHandle(forwardedRef, function () {
116
- return {
117
- inputRef: inputRef,
118
- sizerRef: sizerRef,
119
- wrapperRef: wrapperRef,
120
- inputWrapperRef: inputWrapperRef,
121
- placeholderSizerRef: placeholderSizerRef,
122
- copyInputStyles: copyInputStyles,
123
- updateInputWidth: applyNewWidth
124
- };
125
- });
126
- var wrapperStyle = _extends({}, wrapperStyleProp, {
127
- position: 'relative',
128
- display: (_style$display = style == null ? void 0 : style.display) != null ? _style$display : 'inline-block'
129
- });
130
- return /*#__PURE__*/React.createElement("div", {
131
- ref: wrapperRef,
132
- className: wrapperClassName,
133
- style: wrapperStyle,
134
- "data-testid": "wrapper"
135
- }, /*#__PURE__*/React.createElement("div", {
136
- style: sizerStyle,
137
- ref: sizerRef,
138
- "data-testid": "sizer"
139
- }, usedValue), children, placeholder ? /*#__PURE__*/React.createElement("div", {
140
- ref: placeholderSizerRef,
141
- style: sizerStyle,
142
- "data-testid": "placeholder-sizer"
143
- }, placeholder) : null);
108
+ useImperativeHandle(forwardedRef, () => ({
109
+ inputRef,
110
+ sizerRef,
111
+ wrapperRef,
112
+ inputWrapperRef,
113
+ placeholderSizerRef,
114
+ copyInputStyles,
115
+ updateInputWidth: applyNewWidth
116
+ }));
117
+ const wrapperStyle = {
118
+ ...wrapperStyleProp,
119
+ position: "relative",
120
+ display: style?.display ?? "inline-block"
121
+ };
122
+ return /* @__PURE__ */ jsxs("div", { ref: wrapperRef, className: wrapperClassName, style: wrapperStyle, "data-testid": "wrapper", children: [
123
+ /* @__PURE__ */ jsx("div", { style: sizerStyle, ref: sizerRef, "data-testid": "sizer", children: usedValue }),
124
+ children,
125
+ placeholder ? /* @__PURE__ */ jsx("div", { ref: placeholderSizerRef, style: sizerStyle, "data-testid": "placeholder-sizer", children: placeholder }) : null
126
+ ] });
144
127
  });
145
- export default AutosizeInput;
128
+ export {
129
+ AutosizeInput as default
130
+ };
@@ -1,4 +1,4 @@
1
- import type { CSSProperties, InputHTMLAttributes, MutableRefObject, ReactNode, RefObject } from 'react';
1
+ import { CSSProperties, InputHTMLAttributes, MutableRefObject, ReactNode, RefObject } from 'react';
2
2
  export type AutosizeInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> & {
3
3
  placeholderIsMinWidth?: boolean;
4
4
  wrapperClassName?: string;
@@ -1 +1 @@
1
- export {};
1
+
@@ -1,4 +1,4 @@
1
- import type { AutosizeInputProps } from '../AutosizeInput.types';
1
+ import { AutosizeInputProps } from '../AutosizeInput.types';
2
2
  type CalculateWidthProps = {
3
3
  sizerWidth?: number;
4
4
  hasValue?: boolean;
@@ -1,18 +1,18 @@
1
- var calculateInputWidth = function calculateInputWidth(_ref) {
2
- var sizerWidth = _ref.sizerWidth,
3
- hasValue = _ref.hasValue,
4
- placeholderIsMinWidth = _ref.placeholderIsMinWidth,
5
- placeholderWidth = _ref.placeholderWidth,
6
- minWidth = _ref.minWidth,
7
- placeholder = _ref.placeholder;
8
- var width = 0;
1
+ const calculateInputWidth = ({
2
+ sizerWidth,
3
+ hasValue,
4
+ placeholderIsMinWidth,
5
+ placeholderWidth,
6
+ minWidth,
7
+ placeholder
8
+ }) => {
9
+ let width = 0;
9
10
  if (sizerWidth && hasValue) {
10
- /* If the input field has content, update the sizer to match its width */
11
11
  width = sizerWidth;
12
12
  if (placeholderIsMinWidth && placeholderWidth && sizerWidth < placeholderWidth) {
13
13
  width = placeholderWidth;
14
14
  }
15
- if (minWidth !== undefined && width < minWidth) {
15
+ if (minWidth !== void 0 && width < minWidth) {
16
16
  width = minWidth;
17
17
  }
18
18
  } else if (placeholder && placeholderWidth) {
@@ -22,4 +22,6 @@ var calculateInputWidth = function calculateInputWidth(_ref) {
22
22
  }
23
23
  return width;
24
24
  };
25
- export default calculateInputWidth;
25
+ export {
26
+ calculateInputWidth as default
27
+ };
@@ -1 +1,4 @@
1
- export { default as calculateInputWidth } from './calculateInputWidth';
1
+ import { default as default2 } from "./calculateInputWidth.js";
2
+ export {
3
+ default2 as calculateInputWidth
4
+ };
package/dist/Input.d.ts CHANGED
@@ -1,7 +1,5 @@
1
- import React from 'react';
2
- import '@synerise/ds-core/dist/js/style';
3
- import type { InputProps } from './Input.types';
4
- import './style/index.less';
1
+ import { default as React } from 'react';
2
+ import { InputProps } from './Input.types';
5
3
  export declare const Input: React.ForwardRefExoticComponent<{
6
4
  error?: boolean;
7
5
  className?: string;
@@ -15,11 +13,11 @@ export declare const Input: React.ForwardRefExoticComponent<{
15
13
  handleInputRef?: ((ref: React.MutableRefObject<HTMLInputElement | null>) => void) | undefined;
16
14
  prefixel?: React.ReactNode;
17
15
  suffixel?: React.ReactNode;
18
- autoResize?: import("./Input.types").AutoResizeProp;
19
- autoResizeProps?: Partial<Pick<import("./AutosizeInput/AutosizeInput.types").AutosizeInputProps, "placeholderIsMinWidth" | "wrapperClassName" | "wrapperStyle" | "extraWidth">>;
16
+ autoResize?: import('./Input.types').AutoResizeProp;
17
+ autoResizeProps?: Partial<Pick<import('./AutosizeInput/AutosizeInput.types').AutosizeInputProps, "placeholderIsMinWidth" | "wrapperClassName" | "wrapperStyle" | "extraWidth">>;
20
18
  expandable?: boolean;
21
19
  expandableTooltip?: React.ReactNode;
22
- } & Omit<import("@synerise/ds-form-field").ContentAboveProps, "id" | "rightSide"> & import("@synerise/ds-form-field").ContentBelowProps & import("antd/lib/input").InputProps & React.RefAttributes<HTMLDivElement>>;
20
+ } & Omit<import('@synerise/ds-form-field').ContentAboveProps, "id" | "rightSide"> & import('@synerise/ds-form-field').ContentBelowProps & import('antd/lib/input').InputProps & React.RefAttributes<HTMLDivElement>>;
23
21
  export declare const RawInput: (props: InputProps) => React.JSX.Element;
24
22
  export { default as InputGroup } from './InputGroup';
25
23
  export { default as InputMultivalue } from './InputMultivalue/InputMultivalue';