unifyedx-storybook-new 0.1.4 → 0.1.5

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.
@@ -43082,6 +43082,57 @@ function requireDebounce () {
43082
43082
  return debounce_1;
43083
43083
  }
43084
43084
 
43085
- requireDebounce();
43085
+ var debounceExports = requireDebounce();
43086
+ const debounce = /*@__PURE__*/getDefaultExportFromCjs(debounceExports);
43087
+
43088
+ const SearchBar = ({
43089
+ value = "",
43090
+ onDebouncedChange,
43091
+ debounceDelay = 400,
43092
+ placeholder = "Enter text...",
43093
+ label = "Search",
43094
+ // Added a default label for accessibility
43095
+ customClass = "",
43096
+ ...inputProps
43097
+ }) => {
43098
+ const [inputValue, setInputValue] = useState(value);
43099
+ useEffect(() => {
43100
+ setInputValue(value);
43101
+ }, [value]);
43102
+ const debouncedHandler = useCallback(
43103
+ debounce((nextValue) => {
43104
+ onDebouncedChange?.(nextValue);
43105
+ }, debounceDelay),
43106
+ [debounceDelay, onDebouncedChange]
43107
+ );
43108
+ useEffect(() => {
43109
+ if (inputValue !== value) {
43110
+ debouncedHandler(inputValue);
43111
+ }
43112
+ return () => {
43113
+ debouncedHandler.cancel();
43114
+ };
43115
+ }, [inputValue, debouncedHandler, value]);
43116
+ const handleChange = (event) => {
43117
+ setInputValue(event.target.value);
43118
+ };
43119
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `search-bar-wrapper ${customClass}`, children: [
43120
+ label && /* @__PURE__ */ jsxRuntimeExports.jsx("label", { htmlFor: "search-field", className: "sr-only", children: label }),
43121
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "search-bar-icon-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Search, { size: 20, className: "search-bar-icon", "aria-hidden": "true" }) }),
43122
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
43123
+ "input",
43124
+ {
43125
+ id: "search-field",
43126
+ className: "search-bar-input",
43127
+ placeholder,
43128
+ type: "search",
43129
+ name: "search",
43130
+ value: inputValue,
43131
+ onChange: handleChange,
43132
+ ...inputProps
43133
+ }
43134
+ )
43135
+ ] });
43136
+ };
43086
43137
 
43087
- export { Avatar, AvatarGroup, Badge, Breadcrumbs, Button$1 as Button, Checkbox, DatePicker, DateRangePicker$1 as DateRangePicker, FileUploadModal, FullScreenLoader, GenericFilter, Input, Modal, Pagination, RadioGroup, Select, Sidebar, Spinner, Textarea, ToggleSwitch, Tooltip, WizardModal };
43138
+ export { Avatar, AvatarGroup, Badge, Breadcrumbs, Button$1 as Button, Checkbox, DatePicker, DateRangePicker$1 as DateRangePicker, FileUploadModal, FullScreenLoader, GenericFilter, Input, Modal, Pagination, RadioGroup, SearchBar, Select, Sidebar, Spinner, Textarea, ToggleSwitch, Tooltip, WizardModal };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unifyedx-storybook-new",
3
3
  "private": false,
4
- "version": "0.1.4",
4
+ "version": "0.1.5",
5
5
  "type": "module",
6
6
  "main": "dist/unifyedx-storybook-new.es.js",
7
7
  "module": "dist/unifyedx-storybook-new.es.js",