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

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, searchIconClassName, }: SearchBarProps) => JSX.Element;
38
+ declare const SearchBar: ({ initialSearchText, handleSearchChange, handleEnter, inputProps, containerClassName, shouldDebounce, debounceTimeout, searchIconClassName, }: SearchBarProps) => JSX.Element;
39
39
  export default SearchBar;
@@ -36,13 +36,5 @@ export interface SearchBarProps {
36
36
  * Placeholder for the search input
37
37
  * @default 'Search'
38
38
  */
39
- placeholder?: string;
40
- /**
41
- * Class name for the input; can be used for handling input css
42
- */
43
- inputClassName?: string;
44
- /**
45
- * Icon for the search input
46
- */
47
39
  searchIconClassName?: string;
48
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.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];
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 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" }) })))] })) })));
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-16 ".concat(searchIconClassName) }), jsxRuntime.jsx("input", __assign({ placeholder: inputProps.placeholder || 'Search', "data-testid": "search-bar", type: "text" }, inputProps, { defaultValue: initialSearchText, className: "search-bar__input 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.58-beta-19",
3
+ "version": "0.0.58-beta-21",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -47,8 +47,6 @@ const SearchBar = ({
47
47
  containerClassName,
48
48
  shouldDebounce = false,
49
49
  debounceTimeout = 300,
50
- placeholder = 'Search',
51
- inputClassName = '',
52
50
  searchIconClassName = '',
53
51
  }: SearchBarProps) => {
54
52
  const [showClearButton, setShowClearButton] = useState(!!initialSearchText)
@@ -89,19 +87,19 @@ const SearchBar = ({
89
87
  }
90
88
  return (
91
89
  <div className={containerClassName}>
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">
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">
93
91
  <Search
94
- className={`search-bar__icon dc__position-abs icon-color-n6 icon-dim-18 ${searchIconClassName}`}
92
+ className={`search-bar__icon dc__position-abs icon-color-n6 icon-dim-16 ${searchIconClassName}`}
95
93
  />
96
94
  <input
97
- placeholder={placeholder}
95
+ placeholder={inputProps.placeholder || 'Search'}
98
96
  data-testid="search-bar"
99
97
  type="text"
100
98
  {...inputProps}
101
99
  defaultValue={initialSearchText}
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 ${
100
+ className={`search-bar__input 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 ${
103
101
  showClearButton ? 'pr-30' : 'pr-10'
104
- } ${inputClassName}`}
102
+ }`}
105
103
  onChange={handleChange}
106
104
  onKeyDown={handleKeyDown}
107
105
  ref={inputRef}
@@ -37,13 +37,5 @@ export interface SearchBarProps {
37
37
  * Placeholder for the search input
38
38
  * @default 'Search'
39
39
  */
40
- placeholder?: string
41
- /**
42
- * Class name for the input; can be used for handling input css
43
- */
44
- inputClassName?: string
45
- /**
46
- * Icon for the search input
47
- */
48
40
  searchIconClassName?: string
49
41
  }