@synerise/ds-search-bar 1.0.0 → 1.0.2

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,22 @@
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.0.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search-bar@1.0.1...@synerise/ds-search-bar@1.0.2) (2025-03-26)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-search-bar
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.0.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search-bar@1.0.0...@synerise/ds-search-bar@1.0.1) (2025-03-18)
15
+
16
+ **Note:** Version bump only for package @synerise/ds-search-bar
17
+
18
+
19
+
20
+
21
+
6
22
  ## [0.8.9](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search-bar@0.8.8...@synerise/ds-search-bar@0.8.9) (2025-03-10)
7
23
 
8
24
  **Note:** Version bump only for package @synerise/ds-search-bar
package/README.md CHANGED
@@ -32,11 +32,11 @@ import SearchBar from '@synerise/ds-search-bar'
32
32
  | -------------- | ---------------------------------------- | ------------------------ | ------- |
33
33
  | autofocus | Whether the input is focused | boolean | `false` |
34
34
  | className | Optional class for the component | string | - |
35
- | clearTooltip | Tooltip description above clear button | string / React.ReactNode | - |
35
+ | clearTooltip | Tooltip description above clear button | string / React.ReactNode | - |
36
36
  | disabled | Whether the input is disabled. | boolean | - |
37
37
  | iconLeft | Place for optional icon on the left side | React.ReactNode | - |
38
38
  | onSearchChange | Callback when user input | () => void | - |
39
- | onClearInput | Callback when user press clear button | () => void | - |
40
- | placeholder | Placeholder | string / React.ReactNode | - |
39
+ | onClearInput | Callback when user press clear button | () => void | - |
40
+ | placeholder | Placeholder | React.ReactNode | - |
41
41
  | value | The input content value | string | - |
42
- | autofocusDelay | Delay (ms) of the focus on search input | number | 0 |
42
+ | autofocusDelay | Delay (ms) of the focus on search input | number | 0 |
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { SearchBarProps } from './SearchBar.types';
3
- declare const SearchBar: ({ value, className, onSearchChange, onClearInput, placeholder, iconLeft, autofocus, clearTooltip, disabled, borderRadius, handleInputRef, autofocusDelay, }: SearchBarProps) => React.JSX.Element;
3
+ declare const SearchBar: ({ value, className, onSearchChange, onClearInput, placeholder, iconLeft, autofocus, clearTooltip, disabled, borderRadius, handleInputRef, autofocusDelay, clearTooltipProps, ...htmlAttributes }: SearchBarProps) => React.JSX.Element;
4
4
  export default SearchBar;
package/dist/SearchBar.js CHANGED
@@ -1,9 +1,13 @@
1
+ var _excluded = ["value", "className", "onSearchChange", "onClearInput", "placeholder", "iconLeft", "autofocus", "clearTooltip", "disabled", "borderRadius", "handleInputRef", "autofocusDelay", "clearTooltipProps"];
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1
4
  import React, { useEffect, useState } from 'react';
2
5
  import { FormattedMessage } from 'react-intl';
3
6
  import Icon, { Close3M } from '@synerise/ds-icon';
4
7
  import { theme } from '@synerise/ds-core';
5
8
  import Tooltip from '@synerise/ds-tooltip';
6
9
  import * as S from './SearchBar.styles';
10
+ var DEFAULT_PLACEHOLDER_STRING = 'Search';
7
11
  var SearchBar = function SearchBar(_ref) {
8
12
  var value = _ref.value,
9
13
  className = _ref.className,
@@ -14,12 +18,15 @@ var SearchBar = function SearchBar(_ref) {
14
18
  autofocus = _ref.autofocus,
15
19
  _ref$clearTooltip = _ref.clearTooltip,
16
20
  clearTooltip = _ref$clearTooltip === void 0 ? /*#__PURE__*/React.createElement(FormattedMessage, {
17
- id: "DS.SEARCH-BAR.CLEAR-TOOLTIP"
21
+ id: "DS.SEARCH-BAR.CLEAR-TOOLTIP",
22
+ defaultMessage: "Clear"
18
23
  }) : _ref$clearTooltip,
19
24
  disabled = _ref.disabled,
20
25
  borderRadius = _ref.borderRadius,
21
26
  handleInputRef = _ref.handleInputRef,
22
- autofocusDelay = _ref.autofocusDelay;
27
+ autofocusDelay = _ref.autofocusDelay,
28
+ clearTooltipProps = _ref.clearTooltipProps,
29
+ htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
23
30
  var _useState = useState(false),
24
31
  isFocused = _useState[0],
25
32
  setFocus = _useState[1];
@@ -51,23 +58,24 @@ var SearchBar = function SearchBar(_ref) {
51
58
  }
52
59
  return undefined;
53
60
  }, [autofocus, autofocusDelay, input]);
54
- return /*#__PURE__*/React.createElement(S.SearchBarWrapper, {
61
+ var placeholderString = typeof placeholder === 'string' ? placeholder : DEFAULT_PLACEHOLDER_STRING;
62
+ return /*#__PURE__*/React.createElement(S.SearchBarWrapper, _extends({
55
63
  iconLeft: iconLeft,
56
64
  isEmpty: !value,
57
65
  className: isFocused ? 'is-focused' : '',
58
66
  disabled: disabled,
59
67
  borderRadius: borderRadius,
60
68
  "data-testid": "input-wrapper"
61
- }, iconLeft && /*#__PURE__*/React.createElement(S.IconLeftWrapper, null, iconLeft), onClearInput && Boolean(value) && /*#__PURE__*/React.createElement(S.ClearInputWrapper, {
69
+ }, htmlAttributes), iconLeft && /*#__PURE__*/React.createElement(S.IconLeftWrapper, null, iconLeft), onClearInput && Boolean(value) && /*#__PURE__*/React.createElement(S.ClearInputWrapper, {
62
70
  onClick: onClearInput,
63
71
  "data-testid": "clear-btn"
64
72
  }, /*#__PURE__*/React.createElement(Icon, {
65
- component: /*#__PURE__*/React.createElement(Tooltip, {
73
+ component: /*#__PURE__*/React.createElement(Tooltip, _extends({
66
74
  title: clearTooltip
67
- }, /*#__PURE__*/React.createElement(Close3M, null)),
75
+ }, clearTooltipProps), /*#__PURE__*/React.createElement(Close3M, null)),
68
76
  color: theme.palette['grey-500'],
69
77
  size: 18
70
- })), /*#__PURE__*/React.createElement(S.SearchBar, {
78
+ })), !value && /*#__PURE__*/React.createElement(S.PlaceholderWrapper, null, placeholder), /*#__PURE__*/React.createElement(S.SearchBar, {
71
79
  onChange: function onChange(event) {
72
80
  return onSearchChange(event.currentTarget.value);
73
81
  },
@@ -77,10 +85,10 @@ var SearchBar = function SearchBar(_ref) {
77
85
  onBlur: function onBlur() {
78
86
  return setFocus(false);
79
87
  },
80
- placeholder: placeholder,
81
88
  value: value,
82
89
  className: className,
83
90
  resetMargin: true,
91
+ placeholder: placeholderString,
84
92
  handleInputRef: handleRef,
85
93
  disabled: disabled,
86
94
  autoComplete: "off"
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export declare const IconLeftWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
3
3
  export declare const ClearInputWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const PlaceholderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
4
5
  export declare const SearchBar: import("styled-components").StyledComponent<({ className, errorText, label, description, counterLimit, tooltip, tooltipConfig, icon1, icon1Tooltip, autoResize, icon2, icon2Tooltip, resetMargin, handleInputRef, prefixel, suffixel, error, expandable, expandableTooltip, renderCustomCounter, ...antdInputProps }: import("@synerise/ds-input").InputProps) => import("react").JSX.Element, any, {}, never>;
5
6
  export declare const SearchBarWrapper: import("styled-components").StyledComponent<"div", any, {
6
7
  iconLeft: React.ReactNode;
@@ -8,10 +8,16 @@ export var ClearInputWrapper = styled.div.withConfig({
8
8
  displayName: "SearchBarstyles__ClearInputWrapper",
9
9
  componentId: "sc-qhi5c4-1"
10
10
  })(["right:14px;position:absolute;display:flex;align-items:center;height:100%;z-index:3;cursor:pointer;"]);
11
+ export var PlaceholderWrapper = styled.div.withConfig({
12
+ displayName: "SearchBarstyles__PlaceholderWrapper",
13
+ componentId: "sc-qhi5c4-2"
14
+ })(["pointer-events:none;position:absolute;display:flex;align-items:center;z-index:2;height:52px;left:52px;color:", ";"], function (props) {
15
+ return props.theme.palette['grey-500'];
16
+ });
11
17
  export var SearchBar = styled(Input).withConfig({
12
18
  displayName: "SearchBarstyles__SearchBar",
13
- componentId: "sc-qhi5c4-2"
14
- })(["&&&{position:relative;height:52px;padding:0;input.ant-input{position:absolute;top:0;left:0;max-width:100%;height:52px;border:0;background:", ";box-sizing:content-box;&:focus{box-shadow:inset 0px -2px 0px 0px ", ";}::-webkit-input-placeholder{line-height:52px;}:-moz-placeholder{line-height:52px;}::-moz-placeholder{line-height:52px;}:-ms-input-placeholder{line-height:52px;}}}"], function (props) {
19
+ componentId: "sc-qhi5c4-3"
20
+ })(["&&&{position:relative;height:52px;padding:0;input.ant-input{position:absolute;top:0;left:0;max-width:100%;height:52px;border:0;background:", ";box-sizing:content-box;&:focus{box-shadow:inset 0px -2px 0px 0px ", ";}::-webkit-input-placeholder{line-height:52px;color:transparent;}:-moz-placeholder{line-height:52px;color:transparent;}::-moz-placeholder{line-height:52px;color:transparent;}:-ms-input-placeholder{line-height:52px;color:transparent;}}}"], function (props) {
15
21
  return props.theme.palette['grey-050'];
16
22
  }, function (props) {
17
23
  return props.theme.palette['blue-600'];
@@ -21,7 +27,7 @@ export var SearchBar = styled(Input).withConfig({
21
27
 
22
28
  export var SearchBarWrapper = styled.div.withConfig({
23
29
  displayName: "SearchBarstyles__SearchBarWrapper",
24
- componentId: "sc-qhi5c4-3"
30
+ componentId: "sc-qhi5c4-4"
25
31
  })(["position:relative;overflow:hidden;border-bottom:1px solid ", ";pointer-events:", ";user-select:", ";border-radius:", ";&&&{svg{transition:all 0.3s ease-out;fill:", ";}input.ant-input{border-radius:0;line-height:18px;padding:", ";width:", ";}&:hover{", "{svg{fill:", ";}}", "{svg{fill:", ";}}}}&.is-focused{", "{svg{fill:", ";}}", "{svg{fill:", ";}}}"], function (props) {
26
32
  return props.theme.palette['grey-100'];
27
33
  }, function (props) {
@@ -1,9 +1,11 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { InputProps } from '@synerise/ds-input';
3
- export type SearchBarProps = Pick<InputProps, 'handleInputRef'> & {
3
+ import type { TooltipProps } from '@synerise/ds-tooltip';
4
+ import type { WithHTMLAttributes } from '@synerise/ds-utils';
5
+ export type SearchBarProps = WithHTMLAttributes<HTMLDivElement, Pick<InputProps, 'handleInputRef'> & {
4
6
  onSearchChange: (value: string) => void;
5
7
  onClearInput?: () => void;
6
- placeholder: string;
8
+ placeholder: ReactNode;
7
9
  className?: string;
8
10
  clearTooltip?: ReactNode;
9
11
  value: string;
@@ -12,4 +14,5 @@ export type SearchBarProps = Pick<InputProps, 'handleInputRef'> & {
12
14
  autofocusDelay?: number;
13
15
  disabled?: boolean;
14
16
  borderRadius?: boolean;
15
- };
17
+ clearTooltipProps?: Partial<TooltipProps>;
18
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-search-bar",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "SearchBar UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -34,10 +34,10 @@
34
34
  ],
35
35
  "types": "dist/index.d.ts",
36
36
  "dependencies": {
37
- "@synerise/ds-icon": "^1.0.0",
38
- "@synerise/ds-input": "^1.0.0",
39
- "@synerise/ds-tooltip": "^1.0.0",
40
- "@synerise/ds-utils": "^1.0.0"
37
+ "@synerise/ds-icon": "^1.1.0",
38
+ "@synerise/ds-input": "^1.0.2",
39
+ "@synerise/ds-tooltip": "^1.1.1",
40
+ "@synerise/ds-utils": "^1.0.1"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@synerise/ds-core": "*",
@@ -45,5 +45,5 @@
45
45
  "react-intl": ">=3.12.0 <= 6.8",
46
46
  "styled-components": "^5.3.3"
47
47
  },
48
- "gitHead": "e4c3690238a44b584b9ea41e4aa52b1eec42174b"
48
+ "gitHead": "47960dcd849dc47c85bd134bcfeb90a5505656a7"
49
49
  }