@devtron-labs/devtron-fe-common-lib 0.0.58-beta-18 → 0.0.58-beta-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.
|
@@ -35,5 +35,5 @@ import './searchBar.scss';
|
|
|
35
35
|
* <SearchBar inputProps={{ placeholder: 'Enter search text' }} />
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
|
-
declare const SearchBar: ({ initialSearchText, handleSearchChange, handleEnter, inputProps, containerClassName, shouldDebounce, debounceTimeout,
|
|
38
|
+
declare const SearchBar: ({ initialSearchText, handleSearchChange, handleEnter, inputProps, containerClassName, shouldDebounce, debounceTimeout, searchIconClassName, }: SearchBarProps) => JSX.Element;
|
|
39
39
|
export default SearchBar;
|
|
@@ -36,9 +36,5 @@ export interface SearchBarProps {
|
|
|
36
36
|
* Placeholder for the search input
|
|
37
37
|
* @default 'Search'
|
|
38
38
|
*/
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Class name for the input; can be used for handling input css
|
|
42
|
-
*/
|
|
43
|
-
inputClassName?: string;
|
|
39
|
+
searchIconClassName?: string;
|
|
44
40
|
}
|
package/dist/index.js
CHANGED
|
@@ -24668,8 +24668,8 @@ styleInject(css_248z$5);
|
|
|
24668
24668
|
* ```
|
|
24669
24669
|
*/
|
|
24670
24670
|
var SearchBar = function (_a) {
|
|
24671
|
-
var _b = _a.initialSearchText, initialSearchText = _b === void 0 ? '' : _b, _c = _a.handleSearchChange, handleSearchChange = _c === void 0 ? function () { } : _c, _d = _a.handleEnter, handleEnter = _d === void 0 ? function () { } : _d, _e = _a.inputProps, inputProps = _e === void 0 ? {} : _e, containerClassName = _a.containerClassName, _f = _a.shouldDebounce, shouldDebounce = _f === void 0 ? false : _f, _g = _a.debounceTimeout, debounceTimeout = _g === void 0 ? 300 : _g, _h = _a.
|
|
24672
|
-
var
|
|
24671
|
+
var _b = _a.initialSearchText, initialSearchText = _b === void 0 ? '' : _b, _c = _a.handleSearchChange, handleSearchChange = _c === void 0 ? function () { } : _c, _d = _a.handleEnter, handleEnter = _d === void 0 ? function () { } : _d, _e = _a.inputProps, inputProps = _e === void 0 ? {} : _e, containerClassName = _a.containerClassName, _f = _a.shouldDebounce, shouldDebounce = _f === void 0 ? false : _f, _g = _a.debounceTimeout, debounceTimeout = _g === void 0 ? 300 : _g, _h = _a.searchIconClassName, searchIconClassName = _h === void 0 ? '' : _h;
|
|
24672
|
+
var _j = __read(React.useState(!!initialSearchText), 2), showClearButton = _j[0], setShowClearButton = _j[1];
|
|
24673
24673
|
var inputRef = React.useRef();
|
|
24674
24674
|
var debouncedSearchChange = React.useCallback(debounce$2(handleSearchChange, debounceTimeout), [
|
|
24675
24675
|
handleSearchChange,
|
|
@@ -24701,7 +24701,7 @@ var SearchBar = function (_a) {
|
|
|
24701
24701
|
inputRef.current.value = '';
|
|
24702
24702
|
_applySearch('');
|
|
24703
24703
|
};
|
|
24704
|
-
return (jsxRuntime.jsx("div", __assign({ className: containerClassName }, { children: jsxRuntime.jsxs("div", __assign({ className: "search-bar
|
|
24704
|
+
return (jsxRuntime.jsx("div", __assign({ className: containerClassName }, { children: jsxRuntime.jsxs("div", __assign({ className: "search-bar bc-n50 focus-within-border-b5 dc__hover-border-n300 dc__block w-100 min-w-200 dc__position-rel en-2 bw-1 br-4 h-32" }, { children: [jsxRuntime.jsx(SvgIcSearch, { className: "search-bar__icon dc__position-abs icon-color-n6 icon-dim-18 ".concat(searchIconClassName) }), jsxRuntime.jsx("input", __assign({ placeholder: inputProps.placeholder || 'Search', "data-testid": "search-bar", type: "text" }, inputProps, { defaultValue: initialSearchText, className: "search-bar__input bcn-0 dc__position-abs w-100 h-100 br-4 dc__no-border pt-6 pr-10 pb-6 pl-30 fs-13 lh-20 fw-4 cn-9 placeholder-cn5 ".concat(showClearButton ? 'pr-30' : 'pr-10'), onChange: handleChange, onKeyDown: handleKeyDown, ref: inputRef })), showClearButton && (jsxRuntime.jsx("button", __assign({ className: "flex search-bar__clear-button dc__position-abs dc__transparent mt-0 mb-0 mr-5 ml-5", type: "button", onClick: clearSearch, "aria-label": "Clear search" }, { children: jsxRuntime.jsx(SvgIcErrorCross, { className: "icon-dim-18 icon-n4 dc__vertical-align-middle" }) })))] })) })));
|
|
24705
24705
|
};
|
|
24706
24706
|
|
|
24707
24707
|
var css_248z$4 = ".toggle__switch {\n position: relative;\n display: inline-block;\n width: 100%;\n height: 100%;\n}\n.toggle__switch.disabled {\n cursor: not-allowed;\n}\n.toggle__switch.disabled .toggle__slider {\n cursor: not-allowed;\n}\n\n/* Hide default HTML checkbox */\n.toggle__switch input {\n opacity: 0;\n width: 0;\n height: 0;\n}\n\n/* The slider */\n.toggle__slider {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: #ccc;\n transition: all 0.4s ease;\n}\n.toggle__slider.round {\n border-radius: 34px;\n}\n.toggle__slider.round:before {\n border-radius: 50%;\n}\n.toggle__slider:before {\n position: absolute;\n content: \"\";\n height: calc(100% - 8px);\n width: calc(50% - 4px);\n left: 4px;\n bottom: 4px;\n background-color: white;\n transition: all 0.4s ease;\n}\n.toggle__slider.with-icon {\n background-color: var(--N000) !important;\n}\n.toggle__slider.with-icon svg {\n position: absolute;\n content: \"\";\n top: -1px;\n left: -1px;\n background-color: var(--N300);\n transition: all 0.4s ease;\n}\n\ninput:checked + .toggle__slider {\n background-color: var(--color);\n}\ninput:checked + .toggle__slider:before {\n transform: translateX(100%);\n}\ninput:checked + .toggle__slider.with-icon svg {\n transform: translateX(100%);\n background-color: var(--color);\n}\n\ninput:focus + .toggle__slider {\n box-shadow: 0 0 1px var(--color);\n}";
|
package/package.json
CHANGED
|
@@ -47,8 +47,7 @@ const SearchBar = ({
|
|
|
47
47
|
containerClassName,
|
|
48
48
|
shouldDebounce = false,
|
|
49
49
|
debounceTimeout = 300,
|
|
50
|
-
|
|
51
|
-
inputClassName = '',
|
|
50
|
+
searchIconClassName = '',
|
|
52
51
|
}: SearchBarProps) => {
|
|
53
52
|
const [showClearButton, setShowClearButton] = useState(!!initialSearchText)
|
|
54
53
|
const inputRef = useRef<HTMLInputElement>()
|
|
@@ -86,20 +85,21 @@ const SearchBar = ({
|
|
|
86
85
|
inputRef.current.value = ''
|
|
87
86
|
_applySearch('')
|
|
88
87
|
}
|
|
89
|
-
|
|
90
88
|
return (
|
|
91
89
|
<div className={containerClassName}>
|
|
92
|
-
<div className="search-bar
|
|
93
|
-
<Search
|
|
90
|
+
<div className="search-bar bc-n50 focus-within-border-b5 dc__hover-border-n300 dc__block w-100 min-w-200 dc__position-rel en-2 bw-1 br-4 h-32">
|
|
91
|
+
<Search
|
|
92
|
+
className={`search-bar__icon dc__position-abs icon-color-n6 icon-dim-18 ${searchIconClassName}`}
|
|
93
|
+
/>
|
|
94
94
|
<input
|
|
95
|
-
placeholder={placeholder}
|
|
95
|
+
placeholder={inputProps.placeholder || 'Search'}
|
|
96
96
|
data-testid="search-bar"
|
|
97
97
|
type="text"
|
|
98
98
|
{...inputProps}
|
|
99
99
|
defaultValue={initialSearchText}
|
|
100
100
|
className={`search-bar__input bcn-0 dc__position-abs w-100 h-100 br-4 dc__no-border pt-6 pr-10 pb-6 pl-30 fs-13 lh-20 fw-4 cn-9 placeholder-cn5 ${
|
|
101
101
|
showClearButton ? 'pr-30' : 'pr-10'
|
|
102
|
-
}
|
|
102
|
+
}`}
|
|
103
103
|
onChange={handleChange}
|
|
104
104
|
onKeyDown={handleKeyDown}
|
|
105
105
|
ref={inputRef}
|
|
@@ -37,9 +37,5 @@ export interface SearchBarProps {
|
|
|
37
37
|
* Placeholder for the search input
|
|
38
38
|
* @default 'Search'
|
|
39
39
|
*/
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Class name for the input; can be used for handling input css
|
|
43
|
-
*/
|
|
44
|
-
inputClassName?: string
|
|
40
|
+
searchIconClassName?: string
|
|
45
41
|
}
|