@synerise/ds-search-bar 0.6.78 → 0.6.80

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/CHANGELOG.md CHANGED
@@ -3,6 +3,25 @@
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
+ ## [0.6.80](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search-bar@0.6.79...@synerise/ds-search-bar@0.6.80) (2024-07-15)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-search-bar
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.6.79](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search-bar@0.6.78...@synerise/ds-search-bar@0.6.79) (2024-07-05)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * fixed missing dependencies ([f718fb7](https://github.com/Synerise/synerise-design/commit/f718fb7e954a19857ea4b6bbd417e3fe290fd2dc))
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.6.78](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search-bar@0.6.77...@synerise/ds-search-bar@0.6.78) (2024-07-02)
7
26
 
8
27
  **Note:** Version bump only for package @synerise/ds-search-bar
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  import { SearchBarProps } from './SearchBar.types';
3
- declare const SearchBar: React.FC<SearchBarProps>;
3
+ declare const SearchBar: ({ value, className, onSearchChange, onClearInput, placeholder, iconLeft, autofocus, clearTooltip, disabled, borderRadius, handleInputRef, autofocusDelay, }: SearchBarProps) => React.JSX.Element;
4
4
  export default SearchBar;
package/dist/SearchBar.js CHANGED
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import Icon, { Close3M } from '@synerise/ds-icon';
3
3
  import { theme } from '@synerise/ds-core';
4
4
  import Tooltip from '@synerise/ds-tooltip';
@@ -22,33 +22,42 @@ var SearchBar = function SearchBar(_ref) {
22
22
  handleInputRef = _ref.handleInputRef,
23
23
  autofocusDelay = _ref.autofocusDelay;
24
24
 
25
- var _React$useState = React.useState(false),
26
- isFocused = _React$useState[0],
27
- setFocus = _React$useState[1];
25
+ var _useState = useState(false),
26
+ isFocused = _useState[0],
27
+ setFocus = _useState[1];
28
28
 
29
- var _React$useState2 = React.useState(),
30
- inputRef = _React$useState2[0],
31
- setInputRef = _React$useState2[1];
29
+ var _useState2 = useState(),
30
+ input = _useState2[0],
31
+ setInput = _useState2[1];
32
32
 
33
- React.useEffect(function () {
34
- if (inputRef) {
35
- handleInputRef && handleInputRef(inputRef);
33
+ var handleRef = function handleRef(ref) {
34
+ // eslint-disable-next-line no-unused-expressions
35
+ handleInputRef == null || handleInputRef(ref);
36
+ if (ref.current) setInput(ref.current);
37
+ };
36
38
 
39
+ useEffect(function () {
40
+ if (input) {
37
41
  if (autofocus) {
38
42
  if (autofocusDelay) {
39
- setTimeout(function () {
40
- inputRef.current && inputRef.current.focus({
43
+ var timeout = setTimeout(function () {
44
+ input.focus({
41
45
  preventScroll: true
42
46
  });
43
- }, 50);
44
- } else {
45
- inputRef.current && inputRef.current.focus({
46
- preventScroll: true
47
- });
47
+ }, autofocusDelay);
48
+ return function () {
49
+ clearTimeout(timeout);
50
+ };
48
51
  }
52
+
53
+ input.focus({
54
+ preventScroll: true
55
+ });
49
56
  }
50
57
  }
51
- }, [autofocus, autofocusDelay, handleInputRef, inputRef]);
58
+
59
+ return undefined;
60
+ }, [autofocus, autofocusDelay, input]);
52
61
  return /*#__PURE__*/React.createElement(S.SearchBarWrapper, {
53
62
  iconLeft: iconLeft,
54
63
  isEmpty: !value,
@@ -66,8 +75,8 @@ var SearchBar = function SearchBar(_ref) {
66
75
  color: theme.palette['grey-500'],
67
76
  size: 18
68
77
  })), /*#__PURE__*/React.createElement(S.SearchBar, {
69
- onChange: function onChange(e) {
70
- return onSearchChange(e.currentTarget.value);
78
+ onChange: function onChange(event) {
79
+ return onSearchChange(event.currentTarget.value);
71
80
  },
72
81
  onFocus: function onFocus() {
73
82
  return setFocus(true);
@@ -79,7 +88,7 @@ var SearchBar = function SearchBar(_ref) {
79
88
  value: value,
80
89
  className: className,
81
90
  resetMargin: true,
82
- handleInputRef: setInputRef,
91
+ handleInputRef: handleRef,
83
92
  disabled: disabled,
84
93
  autoComplete: "off"
85
94
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-search-bar",
3
- "version": "0.6.78",
3
+ "version": "0.6.80",
4
4
  "description": "SearchBar UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -33,20 +33,16 @@
33
33
  ],
34
34
  "types": "dist/index.d.ts",
35
35
  "dependencies": {
36
- "@synerise/ds-icon": "^0.63.0",
37
- "@synerise/ds-input": "^0.23.0",
38
- "@synerise/ds-tooltip": "^0.14.31",
39
- "@synerise/ds-utils": "^0.27.0"
36
+ "@synerise/ds-icon": "^0.64.1",
37
+ "@synerise/ds-input": "^0.23.2",
38
+ "@synerise/ds-tooltip": "^0.14.33",
39
+ "@synerise/ds-utils": "^0.28.0",
40
+ "react-intl": "^3.12.0"
40
41
  },
41
42
  "peerDependencies": {
42
43
  "@synerise/ds-core": "*",
43
- "react": ">=16.9.0 < 17.0.0",
44
+ "react": ">=16.9.0 <= 17.0.2",
44
45
  "styled-components": "5.0.1"
45
46
  },
46
- "devDependencies": {
47
- "@testing-library/dom": "^7.0.2",
48
- "@testing-library/jest-dom": "5.1.1",
49
- "@testing-library/react": "10.0.1"
50
- },
51
- "gitHead": "0692552b018dc9c8042f18c773f88890c9ad3270"
47
+ "gitHead": "6f4996380356c1e5cb9a9d8b553069ad9cea7c27"
52
48
  }