@devtron-labs/devtron-fe-common-lib 0.0.58-beta-18 → 0.0.58-beta-19

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, placeholder, inputClassName, }: SearchBarProps) => JSX.Element;
38
+ declare const SearchBar: ({ initialSearchText, handleSearchChange, handleEnter, inputProps, containerClassName, shouldDebounce, debounceTimeout, placeholder, inputClassName, searchIconClassName, }: SearchBarProps) => JSX.Element;
39
39
  export default SearchBar;
@@ -41,4 +41,8 @@ export interface SearchBarProps {
41
41
  * Class name for the input; can be used for handling input css
42
42
  */
43
43
  inputClassName?: string;
44
+ /**
45
+ * Icon for the search input
46
+ */
47
+ searchIconClassName?: string;
44
48
  }
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.placeholder, placeholder = _h === void 0 ? 'Search' : _h, _j = _a.inputClassName, inputClassName = _j === void 0 ? '' : _j;
24672
- var _k = __read(React.useState(!!initialSearchText), 2), showClearButton = _k[0], setShowClearButton = _k[1];
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.placeholder, placeholder = _h === void 0 ? 'Search' : _h, _j = _a.inputClassName, inputClassName = _j === void 0 ? '' : _j, _k = _a.searchIconClassName, searchIconClassName = _k === void 0 ? '' : _k;
24672
+ var _l = __read(React.useState(!!initialSearchText), 2), showClearButton = _l[0], setShowClearButton = _l[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 bcn-0 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" }), jsxRuntime.jsx("input", __assign({ placeholder: placeholder, "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', " ").concat(inputClassName, "}"), 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" }) })))] })) })));
24704
+ return (jsxRuntime.jsx("div", __assign({ className: containerClassName }, { children: jsxRuntime.jsxs("div", __assign({ className: "search-bar bcn-0 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: placeholder, "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', " ").concat(inputClassName), 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.58-beta-18",
3
+ "version": "0.0.58-beta-19",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -49,6 +49,7 @@ const SearchBar = ({
49
49
  debounceTimeout = 300,
50
50
  placeholder = 'Search',
51
51
  inputClassName = '',
52
+ searchIconClassName = '',
52
53
  }: SearchBarProps) => {
53
54
  const [showClearButton, setShowClearButton] = useState(!!initialSearchText)
54
55
  const inputRef = useRef<HTMLInputElement>()
@@ -86,11 +87,12 @@ const SearchBar = ({
86
87
  inputRef.current.value = ''
87
88
  _applySearch('')
88
89
  }
89
-
90
90
  return (
91
91
  <div className={containerClassName}>
92
92
  <div className="search-bar bcn-0 dc__block w-100 min-w-200 dc__position-rel en-2 bw-1 br-4 h-32">
93
- <Search className="search-bar__icon dc__position-abs icon-color-n6 icon-dim-18" />
93
+ <Search
94
+ className={`search-bar__icon dc__position-abs icon-color-n6 icon-dim-18 ${searchIconClassName}`}
95
+ />
94
96
  <input
95
97
  placeholder={placeholder}
96
98
  data-testid="search-bar"
@@ -99,7 +101,7 @@ const SearchBar = ({
99
101
  defaultValue={initialSearchText}
100
102
  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
103
  showClearButton ? 'pr-30' : 'pr-10'
102
- } ${inputClassName}}`}
104
+ } ${inputClassName}`}
103
105
  onChange={handleChange}
104
106
  onKeyDown={handleKeyDown}
105
107
  ref={inputRef}
@@ -42,4 +42,8 @@ export interface SearchBarProps {
42
42
  * Class name for the input; can be used for handling input css
43
43
  */
44
44
  inputClassName?: string
45
+ /**
46
+ * Icon for the search input
47
+ */
48
+ searchIconClassName?: string
45
49
  }