shadcn-ui-react 0.6.7 → 0.6.9
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/dist/index.cjs +13 -12
- package/dist/index.js +15 -14
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7475,30 +7475,31 @@ var import_react34 = __toESM(require("react"), 1);
|
|
|
7475
7475
|
var import_use_debounce = require("use-debounce");
|
|
7476
7476
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
7477
7477
|
function SearchInput({
|
|
7478
|
-
value,
|
|
7478
|
+
value = "",
|
|
7479
7479
|
placeholder,
|
|
7480
7480
|
className,
|
|
7481
7481
|
classNameDefault,
|
|
7482
7482
|
debounceTime = 750,
|
|
7483
7483
|
onSearch
|
|
7484
7484
|
}) {
|
|
7485
|
-
const [searchTerm, setSearchTerm] = import_react34.default.useState(value);
|
|
7486
|
-
const
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
}, []);
|
|
7485
|
+
const [searchTerm, setSearchTerm] = import_react34.default.useState(value != null ? value : "");
|
|
7486
|
+
const debouncedSearch = (0, import_use_debounce.useDebouncedCallback)((nextValue) => {
|
|
7487
|
+
onSearch(nextValue);
|
|
7488
|
+
}, debounceTime);
|
|
7490
7489
|
import_react34.default.useEffect(() => {
|
|
7491
|
-
|
|
7492
|
-
}, [debouncedValue, handleSettingSearchParams]);
|
|
7493
|
-
import_react34.default.useEffect(() => {
|
|
7494
|
-
setSearchTerm(value);
|
|
7490
|
+
setSearchTerm(value != null ? value : "");
|
|
7495
7491
|
}, [value]);
|
|
7492
|
+
const handleChange = (event) => {
|
|
7493
|
+
const nextValue = event.target.value;
|
|
7494
|
+
setSearchTerm(nextValue);
|
|
7495
|
+
debouncedSearch(nextValue);
|
|
7496
|
+
};
|
|
7496
7497
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
7497
7498
|
Input,
|
|
7498
7499
|
{
|
|
7499
|
-
placeholder: placeholder ||
|
|
7500
|
+
placeholder: placeholder || "Search...",
|
|
7500
7501
|
value: searchTerm,
|
|
7501
|
-
onChange:
|
|
7502
|
+
onChange: handleChange,
|
|
7502
7503
|
className: cn("w-full md:max-w-sm", className),
|
|
7503
7504
|
classNameDefault
|
|
7504
7505
|
}
|
package/dist/index.js
CHANGED
|
@@ -7256,34 +7256,35 @@ var ScrollBar = React52.forwardRef((_a, ref) => {
|
|
|
7256
7256
|
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
7257
7257
|
|
|
7258
7258
|
// src/components/search-input.tsx
|
|
7259
|
-
import React53
|
|
7260
|
-
import {
|
|
7259
|
+
import React53 from "react";
|
|
7260
|
+
import { useDebouncedCallback } from "use-debounce";
|
|
7261
7261
|
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
7262
7262
|
function SearchInput({
|
|
7263
|
-
value,
|
|
7263
|
+
value = "",
|
|
7264
7264
|
placeholder,
|
|
7265
7265
|
className,
|
|
7266
7266
|
classNameDefault,
|
|
7267
7267
|
debounceTime = 750,
|
|
7268
7268
|
onSearch
|
|
7269
7269
|
}) {
|
|
7270
|
-
const [searchTerm, setSearchTerm] = React53.useState(value);
|
|
7271
|
-
const
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
}, []);
|
|
7270
|
+
const [searchTerm, setSearchTerm] = React53.useState(value != null ? value : "");
|
|
7271
|
+
const debouncedSearch = useDebouncedCallback((nextValue) => {
|
|
7272
|
+
onSearch(nextValue);
|
|
7273
|
+
}, debounceTime);
|
|
7275
7274
|
React53.useEffect(() => {
|
|
7276
|
-
|
|
7277
|
-
}, [debouncedValue, handleSettingSearchParams]);
|
|
7278
|
-
React53.useEffect(() => {
|
|
7279
|
-
setSearchTerm(value);
|
|
7275
|
+
setSearchTerm(value != null ? value : "");
|
|
7280
7276
|
}, [value]);
|
|
7277
|
+
const handleChange = (event) => {
|
|
7278
|
+
const nextValue = event.target.value;
|
|
7279
|
+
setSearchTerm(nextValue);
|
|
7280
|
+
debouncedSearch(nextValue);
|
|
7281
|
+
};
|
|
7281
7282
|
return /* @__PURE__ */ jsx31(
|
|
7282
7283
|
Input,
|
|
7283
7284
|
{
|
|
7284
|
-
placeholder: placeholder ||
|
|
7285
|
+
placeholder: placeholder || "Search...",
|
|
7285
7286
|
value: searchTerm,
|
|
7286
|
-
onChange:
|
|
7287
|
+
onChange: handleChange,
|
|
7287
7288
|
className: cn("w-full md:max-w-sm", className),
|
|
7288
7289
|
classNameDefault
|
|
7289
7290
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shadcn-ui-react",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Bleker Cordova <bleker@gliyen.com>",
|
|
6
6
|
"description": "A collection of components for building beautiful and accessible user interfaces with React and Tailwind CSS.",
|