@synerise/ds-search-bar 1.4.19 → 1.4.20
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 +4 -0
- package/dist/SearchBar.constants.js +18 -8
- package/dist/SearchBar.d.ts +4 -4
- package/dist/SearchBar.js +53 -96
- package/dist/SearchBar.styles.d.ts +7 -7
- package/dist/SearchBar.styles.js +36 -55
- package/dist/SearchBar.types.d.ts +5 -5
- package/dist/SearchBar.types.js +1 -1
- package/dist/ValuePrefix.d.ts +1 -1
- package/dist/ValuePrefix.js +17 -20
- package/dist/index.js +4 -1
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- 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.4.20](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search-bar@1.4.19...@synerise/ds-search-bar@1.4.20) (2026-03-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-search-bar
|
|
9
|
+
|
|
6
10
|
## [1.4.19](https://github.com/Synerise/synerise-design/compare/@synerise/ds-search-bar@1.4.18...@synerise/ds-search-bar@1.4.19) (2026-03-20)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @synerise/ds-search-bar
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
const SEARCH_BAR_PADDING_LEFT = 16;
|
|
2
|
+
const SEARCH_BAR_PADDING_RIGHT = 12;
|
|
3
|
+
const ICON_LEFT_SIZE = 24;
|
|
4
|
+
const ICON_LEFT_MARGIN_RIGHT = 12;
|
|
5
|
+
const CLEAR_ICON_SIZE = 18;
|
|
6
|
+
const CLEAR_ICON_MARGIN_LEFT = 12;
|
|
7
|
+
const VALUE_PREFIX_WRAPPER_LEFT_VALUE = SEARCH_BAR_PADDING_LEFT + ICON_LEFT_SIZE + ICON_LEFT_MARGIN_RIGHT;
|
|
8
|
+
const VALUE_PREFIX_WRAPPER_RIGHT_MARGIN = 4;
|
|
9
|
+
export {
|
|
10
|
+
CLEAR_ICON_MARGIN_LEFT,
|
|
11
|
+
CLEAR_ICON_SIZE,
|
|
12
|
+
ICON_LEFT_MARGIN_RIGHT,
|
|
13
|
+
ICON_LEFT_SIZE,
|
|
14
|
+
SEARCH_BAR_PADDING_LEFT,
|
|
15
|
+
SEARCH_BAR_PADDING_RIGHT,
|
|
16
|
+
VALUE_PREFIX_WRAPPER_LEFT_VALUE,
|
|
17
|
+
VALUE_PREFIX_WRAPPER_RIGHT_MARGIN
|
|
18
|
+
};
|
package/dist/SearchBar.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
declare const SearchBar: React.ForwardRefExoticComponent<Partial<Pick<import(
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
declare const SearchBar: React.ForwardRefExoticComponent<Partial<Pick<import('@synerise/ds-input').InputProps, "handleInputRef">> & {
|
|
3
3
|
onSearchChange: (value: string) => void;
|
|
4
4
|
onClearInput?: () => void;
|
|
5
5
|
placeholder: React.ReactNode;
|
|
@@ -10,7 +10,7 @@ declare const SearchBar: React.ForwardRefExoticComponent<Partial<Pick<import("@s
|
|
|
10
10
|
autofocusDelay?: number;
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
borderRadius?: boolean;
|
|
13
|
-
clearTooltipProps?: Partial<import(
|
|
13
|
+
clearTooltipProps?: Partial<import('@synerise/ds-tooltip').TooltipProps>;
|
|
14
14
|
valuePrefix?: React.ReactNode;
|
|
15
|
-
} & Omit<React.HTMLAttributes<HTMLDivElement>, "iconLeft" | "disabled" | "value" | "placeholder" | "handleInputRef" | "onSearchChange" | "onClearInput" | "clearTooltip" | "autofocus" | "autofocusDelay" | "
|
|
15
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "iconLeft" | "disabled" | "value" | "placeholder" | "handleInputRef" | "borderRadius" | "onSearchChange" | "onClearInput" | "clearTooltip" | "autofocus" | "autofocusDelay" | "clearTooltipProps" | "valuePrefix"> & import('@synerise/ds-utils').DataAttributes & React.RefAttributes<HTMLDivElement>>;
|
|
16
16
|
export default SearchBar;
|
package/dist/SearchBar.js
CHANGED
|
@@ -1,62 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var _useState = useState(false),
|
|
36
|
-
isFocused = _useState[0],
|
|
37
|
-
setFocus = _useState[1];
|
|
38
|
-
var _useState2 = useState(),
|
|
39
|
-
input = _useState2[0],
|
|
40
|
-
setInput = _useState2[1];
|
|
41
|
-
var _useState3 = useState(0),
|
|
42
|
-
valuePrefixWidth = _useState3[0],
|
|
43
|
-
setValuePrefixWidth = _useState3[1];
|
|
44
|
-
var handleRef = function handleRef(ref) {
|
|
45
|
-
handleInputRef == null || handleInputRef(ref);
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
import { forwardRef, useState, useEffect, useMemo } from "react";
|
|
4
|
+
import { FormattedMessage } from "react-intl";
|
|
5
|
+
import { useTheme } from "@synerise/ds-core";
|
|
6
|
+
import Icon, { Close3M } from "@synerise/ds-icon";
|
|
7
|
+
import Tooltip from "@synerise/ds-tooltip";
|
|
8
|
+
import { CLEAR_ICON_SIZE } from "./SearchBar.constants.js";
|
|
9
|
+
import { SearchBarWrapper, IconLeftWrapper, ClearInputWrapper, PlaceholderWrapper, SearchBar as SearchBar$1 } from "./SearchBar.styles.js";
|
|
10
|
+
import { ValuePrefix } from "./ValuePrefix.js";
|
|
11
|
+
const DEFAULT_PLACEHOLDER_STRING = "Search";
|
|
12
|
+
const SearchBar = forwardRef(({
|
|
13
|
+
value,
|
|
14
|
+
className,
|
|
15
|
+
onSearchChange,
|
|
16
|
+
onClearInput,
|
|
17
|
+
placeholder,
|
|
18
|
+
iconLeft,
|
|
19
|
+
autofocus,
|
|
20
|
+
clearTooltip = /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.SEARCH-BAR.CLEAR-TOOLTIP", defaultMessage: "Clear" }),
|
|
21
|
+
disabled,
|
|
22
|
+
borderRadius,
|
|
23
|
+
handleInputRef,
|
|
24
|
+
autofocusDelay,
|
|
25
|
+
clearTooltipProps,
|
|
26
|
+
valuePrefix,
|
|
27
|
+
...htmlAttributes
|
|
28
|
+
}, forwardedRef) => {
|
|
29
|
+
const theme = useTheme();
|
|
30
|
+
const [isFocused, setFocus] = useState(false);
|
|
31
|
+
const [input, setInput] = useState();
|
|
32
|
+
const [valuePrefixWidth, setValuePrefixWidth] = useState(0);
|
|
33
|
+
const handleRef = (ref) => {
|
|
34
|
+
handleInputRef?.(ref);
|
|
46
35
|
if (ref.current) {
|
|
47
36
|
setInput(ref.current);
|
|
48
37
|
}
|
|
49
38
|
};
|
|
50
|
-
useEffect(
|
|
39
|
+
useEffect(() => {
|
|
51
40
|
if (input) {
|
|
52
41
|
if (autofocus) {
|
|
53
42
|
if (autofocusDelay) {
|
|
54
|
-
|
|
43
|
+
const timeout = setTimeout(() => {
|
|
55
44
|
input.focus({
|
|
56
45
|
preventScroll: true
|
|
57
46
|
});
|
|
58
47
|
}, autofocusDelay);
|
|
59
|
-
return
|
|
48
|
+
return () => {
|
|
60
49
|
clearTimeout(timeout);
|
|
61
50
|
};
|
|
62
51
|
}
|
|
@@ -65,54 +54,22 @@ var SearchBar = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
|
65
54
|
});
|
|
66
55
|
}
|
|
67
56
|
}
|
|
68
|
-
return
|
|
57
|
+
return void 0;
|
|
69
58
|
}, [autofocus, autofocusDelay, input]);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
borderRadius: borderRadius,
|
|
81
|
-
"data-testid": "input-wrapper",
|
|
82
|
-
valuePrefixWidth: valuePrefixWidth
|
|
83
|
-
}, htmlAttributes, {
|
|
84
|
-
className: finalClassName,
|
|
85
|
-
ref: forwardedRef
|
|
86
|
-
}), iconLeft && /*#__PURE__*/React.createElement(S.IconLeftWrapper, null, iconLeft), onClearInput && (Boolean(valuePrefix) || Boolean(value)) && /*#__PURE__*/React.createElement(S.ClearInputWrapper, {
|
|
87
|
-
onClick: onClearInput,
|
|
88
|
-
"data-testid": "clear-btn"
|
|
89
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
90
|
-
component: /*#__PURE__*/React.createElement(Tooltip, _extends({
|
|
91
|
-
title: clearTooltip
|
|
92
|
-
}, clearTooltipProps), /*#__PURE__*/React.createElement(Close3M, null)),
|
|
93
|
-
color: theme.palette['grey-500'],
|
|
94
|
-
size: CLEAR_ICON_SIZE
|
|
95
|
-
})), !!valuePrefix && /*#__PURE__*/React.createElement(ValuePrefix, {
|
|
96
|
-
value: valuePrefix,
|
|
97
|
-
setValuePrefixWidth: setValuePrefixWidth
|
|
98
|
-
}), !value && /*#__PURE__*/React.createElement(S.PlaceholderWrapper, {
|
|
99
|
-
valuePrefixWidth: valuePrefixWidth
|
|
100
|
-
}, placeholder), /*#__PURE__*/React.createElement(S.SearchBar, {
|
|
101
|
-
onChange: function onChange(event) {
|
|
59
|
+
const placeholderString = typeof placeholder === "string" ? placeholder : DEFAULT_PLACEHOLDER_STRING;
|
|
60
|
+
const finalClassName = useMemo(() => classnames(className, {
|
|
61
|
+
"is-focused": isFocused
|
|
62
|
+
}), [className, isFocused]);
|
|
63
|
+
return /* @__PURE__ */ jsxs(SearchBarWrapper, { iconLeft, isEmpty: !value, disabled, borderRadius, "data-testid": "input-wrapper", valuePrefixWidth, ...htmlAttributes, className: finalClassName, ref: forwardedRef, children: [
|
|
64
|
+
iconLeft && /* @__PURE__ */ jsx(IconLeftWrapper, { children: iconLeft }),
|
|
65
|
+
onClearInput && (Boolean(valuePrefix) || Boolean(value)) && /* @__PURE__ */ jsx(ClearInputWrapper, { onClick: onClearInput, "data-testid": "clear-btn", children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(Tooltip, { title: clearTooltip, ...clearTooltipProps, children: /* @__PURE__ */ jsx(Close3M, {}) }), color: theme.palette["grey-500"], size: CLEAR_ICON_SIZE }) }),
|
|
66
|
+
!!valuePrefix && /* @__PURE__ */ jsx(ValuePrefix, { value: valuePrefix, setValuePrefixWidth }),
|
|
67
|
+
!value && /* @__PURE__ */ jsx(PlaceholderWrapper, { valuePrefixWidth, children: placeholder }),
|
|
68
|
+
/* @__PURE__ */ jsx(SearchBar$1, { onChange: (event) => {
|
|
102
69
|
onSearchChange(event.currentTarget.value);
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
return setFocus(true);
|
|
106
|
-
},
|
|
107
|
-
onBlur: function onBlur() {
|
|
108
|
-
return setFocus(false);
|
|
109
|
-
},
|
|
110
|
-
value: value,
|
|
111
|
-
resetMargin: true,
|
|
112
|
-
placeholder: placeholderString,
|
|
113
|
-
handleInputRef: handleRef,
|
|
114
|
-
disabled: disabled,
|
|
115
|
-
autoComplete: "off"
|
|
116
|
-
}));
|
|
70
|
+
}, onFocus: () => setFocus(true), onBlur: () => setFocus(false), value, resetMargin: true, placeholder: placeholderString, handleInputRef: handleRef, disabled, autoComplete: "off" })
|
|
71
|
+
] });
|
|
117
72
|
});
|
|
118
|
-
export
|
|
73
|
+
export {
|
|
74
|
+
SearchBar as default
|
|
75
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const IconLeftWrapper: import(
|
|
3
|
-
export declare const ValuePrefixWrapper: import(
|
|
4
|
-
export declare const ValuePrefixTitle: import(
|
|
5
|
-
export declare const ClearInputWrapper: import(
|
|
6
|
-
export declare const PlaceholderWrapper: import(
|
|
1
|
+
import { StyledInput } from '@synerise/ds-input';
|
|
2
|
+
export declare const IconLeftWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const ValuePrefixWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export declare const ValuePrefixTitle: import('styled-components').StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...antdProps }: import('@synerise/ds-typography/dist/Title.types').Props) => React.JSX.Element, any, {}, never>;
|
|
5
|
+
export declare const ClearInputWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
6
|
+
export declare const PlaceholderWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
7
7
|
valuePrefixWidth: number;
|
|
8
8
|
}, never>;
|
|
9
9
|
export declare const SearchBar: StyledInput;
|
|
10
|
-
export declare const SearchBarWrapper: import(
|
|
10
|
+
export declare const SearchBarWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
11
11
|
iconLeft: React.ReactNode;
|
|
12
12
|
isEmpty: boolean;
|
|
13
13
|
disabled: boolean;
|
package/dist/SearchBar.styles.js
CHANGED
|
@@ -1,74 +1,55 @@
|
|
|
1
|
-
import styled from
|
|
2
|
-
import { Input } from
|
|
3
|
-
import { Title } from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { Input } from "@synerise/ds-input";
|
|
3
|
+
import { Title } from "@synerise/ds-typography";
|
|
4
|
+
import { SEARCH_BAR_PADDING_LEFT, SEARCH_BAR_PADDING_RIGHT, VALUE_PREFIX_WRAPPER_LEFT_VALUE, VALUE_PREFIX_WRAPPER_RIGHT_MARGIN, CLEAR_ICON_SIZE, CLEAR_ICON_MARGIN_LEFT, ICON_LEFT_SIZE, ICON_LEFT_MARGIN_RIGHT } from "./SearchBar.constants.js";
|
|
5
|
+
const getPaddingAndWidthForSearchBarAntInput = ({
|
|
6
|
+
iconLeft,
|
|
7
|
+
isEmpty,
|
|
8
|
+
valuePrefixWidth
|
|
9
|
+
}) => {
|
|
10
|
+
const leftPadding = SEARCH_BAR_PADDING_LEFT + (iconLeft ? ICON_LEFT_SIZE + ICON_LEFT_MARGIN_RIGHT : 0) + valuePrefixWidth + (valuePrefixWidth ? VALUE_PREFIX_WRAPPER_RIGHT_MARGIN : 0);
|
|
11
|
+
const rightPadding = SEARCH_BAR_PADDING_RIGHT + (!isEmpty ? CLEAR_ICON_SIZE + CLEAR_ICON_MARGIN_LEFT : 0);
|
|
12
|
+
return `
|
|
13
|
+
padding: 0 ${rightPadding}px 0 ${leftPadding}px;
|
|
14
|
+
width: calc(100% - ${rightPadding + leftPadding}px);
|
|
15
|
+
`;
|
|
12
16
|
};
|
|
13
|
-
|
|
17
|
+
const IconLeftWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
14
18
|
displayName: "SearchBarstyles__IconLeftWrapper",
|
|
15
19
|
componentId: "sc-qhi5c4-0"
|
|
16
20
|
})(["position:absolute;left:", "px;display:flex;align-items:center;height:100%;z-index:3;"], SEARCH_BAR_PADDING_LEFT);
|
|
17
|
-
|
|
21
|
+
const ValuePrefixWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
18
22
|
displayName: "SearchBarstyles__ValuePrefixWrapper",
|
|
19
23
|
componentId: "sc-qhi5c4-1"
|
|
20
24
|
})(["position:absolute;left:", "px;display:flex;align-items:center;height:100%;z-index:3;"], VALUE_PREFIX_WRAPPER_LEFT_VALUE);
|
|
21
|
-
|
|
25
|
+
const ValuePrefixTitle = /* @__PURE__ */ styled(Title).withConfig({
|
|
22
26
|
displayName: "SearchBarstyles__ValuePrefixTitle",
|
|
23
27
|
componentId: "sc-qhi5c4-2"
|
|
24
28
|
})(["line-height:18px;"]);
|
|
25
|
-
|
|
29
|
+
const ClearInputWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
26
30
|
displayName: "SearchBarstyles__ClearInputWrapper",
|
|
27
31
|
componentId: "sc-qhi5c4-3"
|
|
28
32
|
})(["right:", "px;position:absolute;display:flex;align-items:center;height:100%;z-index:3;cursor:pointer;"], SEARCH_BAR_PADDING_RIGHT);
|
|
29
|
-
|
|
33
|
+
const PlaceholderWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
30
34
|
displayName: "SearchBarstyles__PlaceholderWrapper",
|
|
31
35
|
componentId: "sc-qhi5c4-4"
|
|
32
|
-
})(["pointer-events:none;position:absolute;display:flex;white-space:nowrap;align-items:center;z-index:2;height:52px;left:", "px;color:", ";line-height:18px;"],
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return props.theme.palette['grey-500'];
|
|
37
|
-
});
|
|
38
|
-
export var SearchBar = styled(Input).withConfig({
|
|
36
|
+
})(["pointer-events:none;position:absolute;display:flex;white-space:nowrap;align-items:center;z-index:2;height:52px;left:", "px;color:", ";line-height:18px;"], ({
|
|
37
|
+
valuePrefixWidth
|
|
38
|
+
}) => VALUE_PREFIX_WRAPPER_LEFT_VALUE + valuePrefixWidth + (valuePrefixWidth ? VALUE_PREFIX_WRAPPER_RIGHT_MARGIN : 0), (props) => props.theme.palette["grey-500"]);
|
|
39
|
+
const SearchBar = /* @__PURE__ */ styled(Input).withConfig({
|
|
39
40
|
displayName: "SearchBarstyles__SearchBar",
|
|
40
41
|
componentId: "sc-qhi5c4-5"
|
|
41
|
-
})(["&&&{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;}}}"],
|
|
42
|
-
|
|
43
|
-
}, function (props) {
|
|
44
|
-
return props.theme.palette['blue-600'];
|
|
45
|
-
});
|
|
46
|
-
// placeholder styling rules have to be separated
|
|
47
|
-
// https://stackoverflow.com/questions/44971077/why-do-comma-separated-placeholder-rules-not-get-applied-in-css
|
|
48
|
-
|
|
49
|
-
export var SearchBarWrapper = styled.div.withConfig({
|
|
42
|
+
})(["&&&{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;}}}"], (props) => props.theme.palette["grey-050"], (props) => props.theme.palette["blue-600"]);
|
|
43
|
+
const SearchBarWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
50
44
|
displayName: "SearchBarstyles__SearchBarWrapper",
|
|
51
45
|
componentId: "sc-qhi5c4-6"
|
|
52
|
-
})(["position:relative;overflow:hidden;border-bottom:1px solid ", ";pointer-events:", ";user-select:", ";border-radius:", ";min-width:150px;&&&{svg{transition:all 0.3s ease-out;fill:", ";}input.ant-input{border-radius:0;line-height:18px;", "}&:hover{", "{svg{fill:", ";}}", "{svg{fill:", ";}}", "{color:", ";}}}&.is-focused{", "{svg{fill:", ";}}", "{svg{fill:", ";}}", "{color:", ";}}"],
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, getPaddingAndWidthForSearchBarAntInput, IconLeftWrapper, function (props) {
|
|
63
|
-
return props.theme.palette['blue-600'];
|
|
64
|
-
}, ClearInputWrapper, function (props) {
|
|
65
|
-
return props.theme.palette['red-600'];
|
|
66
|
-
}, ValuePrefixTitle, function (props) {
|
|
67
|
-
return props.theme.palette['blue-600'];
|
|
68
|
-
}, IconLeftWrapper, function (props) {
|
|
69
|
-
return props.theme.palette['blue-600'];
|
|
70
|
-
}, ClearInputWrapper, function (props) {
|
|
71
|
-
return props.theme.palette['red-600'];
|
|
72
|
-
}, ValuePrefixTitle, function (props) {
|
|
73
|
-
return props.theme.palette['blue-600'];
|
|
74
|
-
});
|
|
46
|
+
})(["position:relative;overflow:hidden;border-bottom:1px solid ", ";pointer-events:", ";user-select:", ";border-radius:", ";min-width:150px;&&&{svg{transition:all 0.3s ease-out;fill:", ";}input.ant-input{border-radius:0;line-height:18px;", "}&:hover{", "{svg{fill:", ";}}", "{svg{fill:", ";}}", "{color:", ";}}}&.is-focused{", "{svg{fill:", ";}}", "{svg{fill:", ";}}", "{color:", ";}}"], (props) => props.theme.palette["grey-100"], (props) => props.disabled ? "none" : "", (props) => props.disabled ? "none" : "", (props) => props.borderRadius ? "3px" : "", (props) => props.disabled ? props.theme.palette["grey-400"] : "", getPaddingAndWidthForSearchBarAntInput, IconLeftWrapper, (props) => props.theme.palette["blue-600"], ClearInputWrapper, (props) => props.theme.palette["red-600"], ValuePrefixTitle, (props) => props.theme.palette["blue-600"], IconLeftWrapper, (props) => props.theme.palette["blue-600"], ClearInputWrapper, (props) => props.theme.palette["red-600"], ValuePrefixTitle, (props) => props.theme.palette["blue-600"]);
|
|
47
|
+
export {
|
|
48
|
+
ClearInputWrapper,
|
|
49
|
+
IconLeftWrapper,
|
|
50
|
+
PlaceholderWrapper,
|
|
51
|
+
SearchBar,
|
|
52
|
+
SearchBarWrapper,
|
|
53
|
+
ValuePrefixTitle,
|
|
54
|
+
ValuePrefixWrapper
|
|
55
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
|
|
2
|
+
import { StyledComponent } from 'styled-components';
|
|
3
|
+
import { InputProps } from '@synerise/ds-input';
|
|
4
|
+
import { TooltipProps } from '@synerise/ds-tooltip';
|
|
5
|
+
import { WithHTMLAttributes } from '@synerise/ds-utils';
|
|
6
6
|
export type SearchBarProps = WithHTMLAttributes<HTMLDivElement, Partial<Pick<InputProps, 'handleInputRef'>> & {
|
|
7
7
|
onSearchChange: (value: string) => void;
|
|
8
8
|
onClearInput?: () => void;
|
package/dist/SearchBar.types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
package/dist/ValuePrefix.d.ts
CHANGED
package/dist/ValuePrefix.js
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useCallback, useEffect } from "react";
|
|
3
|
+
import { useResizeObserver } from "@synerise/ds-utils";
|
|
4
|
+
import { ValuePrefixWrapper, ValuePrefixTitle } from "./SearchBar.styles.js";
|
|
5
|
+
const ValuePrefix = ({
|
|
6
|
+
value,
|
|
7
|
+
setValuePrefixWidth
|
|
8
|
+
}) => {
|
|
9
|
+
const valuePrefixRef = useRef(null);
|
|
10
|
+
const handleValuePrefixWidth = useCallback((dimensions) => {
|
|
9
11
|
setValuePrefixWidth(dimensions.width);
|
|
10
12
|
}, [setValuePrefixWidth]);
|
|
11
13
|
useResizeObserver(valuePrefixRef, handleValuePrefixWidth);
|
|
12
|
-
useEffect(
|
|
13
|
-
return
|
|
14
|
-
return setValuePrefixWidth(0);
|
|
15
|
-
};
|
|
16
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
return () => setValuePrefixWidth(0);
|
|
17
16
|
}, []);
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}, value));
|
|
24
|
-
};
|
|
17
|
+
return /* @__PURE__ */ jsx(ValuePrefixWrapper, { ref: valuePrefixRef, children: /* @__PURE__ */ jsx(ValuePrefixTitle, { level: 6, withoutMargin: true, children: value }) });
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
ValuePrefix
|
|
21
|
+
};
|
package/dist/index.js
CHANGED
package/dist/modules.d.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-search-bar",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.20",
|
|
4
4
|
"description": "SearchBar UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "
|
|
19
|
+
"build": "vite build",
|
|
20
20
|
"build:css": "node ../../../scripts/style/less.js",
|
|
21
21
|
"build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
|
|
22
|
-
"build:watch": "
|
|
22
|
+
"build:watch": "vite build --watch",
|
|
23
23
|
"defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
|
|
24
24
|
"pack:ci": "pnpm pack --pack-destination ../../storybook/storybook-static/static",
|
|
25
25
|
"prepublish": "pnpm run build",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
],
|
|
36
36
|
"types": "dist/index.d.ts",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@synerise/ds-icon": "^1.15.
|
|
39
|
-
"@synerise/ds-input": "^1.6.
|
|
40
|
-
"@synerise/ds-tooltip": "^1.4.
|
|
41
|
-
"@synerise/ds-typography": "^1.1.
|
|
42
|
-
"@synerise/ds-utils": "^1.7.
|
|
38
|
+
"@synerise/ds-icon": "^1.15.1",
|
|
39
|
+
"@synerise/ds-input": "^1.6.10",
|
|
40
|
+
"@synerise/ds-tooltip": "^1.4.10",
|
|
41
|
+
"@synerise/ds-typography": "^1.1.13",
|
|
42
|
+
"@synerise/ds-utils": "^1.7.1",
|
|
43
43
|
"classnames": "^2.5.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
49
49
|
"styled-components": "^5.3.3"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "e4ecca8944fc9b41c1b9d59c8bcad5e5e2013225"
|
|
52
52
|
}
|