najm-kit 2.1.53 → 2.1.56
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/CHANGELOG.md +8 -0
- package/README.md +8 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +15 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.1.55
|
|
4
|
+
|
|
5
|
+
- Honor `showIcon` on NTable `select` and `combobox` filters. The leading filter icon is still shown by default; pass `showIcon: false` on a filter to hide it.
|
|
6
|
+
|
|
7
|
+
## 2.1.54
|
|
8
|
+
|
|
9
|
+
- Added controlled remote-search and loading-state props to `ComboboxInput` and `FormInput type="combobox"` while preserving client filtering by default.
|
|
10
|
+
|
|
3
11
|
## 2.1.53 - 2026-08-05
|
|
4
12
|
|
|
5
13
|
- Add typed `NBarChart`, `NLineChart`, `NPieChart`, and `NStatusBreakdown`
|
package/README.md
CHANGED
|
@@ -147,7 +147,7 @@ import { Form, FormInput, useNForm } from 'najm-kit';
|
|
|
147
147
|
| Data | Table (NTable), StatCard, DetailList |
|
|
148
148
|
| Overlays | Command palette, Tooltip, Toast |
|
|
149
149
|
|
|
150
|
-
## ImageInput and AvatarInput
|
|
150
|
+
## ImageInput and AvatarInput
|
|
151
151
|
|
|
152
152
|
`ImageInput` and `AvatarInput` ship with a resilient preview contract so
|
|
153
153
|
consumers do not need to wrap them with application-specific preview
|
|
@@ -388,3 +388,10 @@ const data = [
|
|
|
388
388
|
]}
|
|
389
389
|
/>
|
|
390
390
|
```
|
|
391
|
+
|
|
392
|
+
### Server-backed combobox search
|
|
393
|
+
|
|
394
|
+
`ComboboxInput` and `FormInput type="combobox"` can delegate filtering to a
|
|
395
|
+
server by setting `shouldFilter={false}` and handling `onSearchChange`. Use
|
|
396
|
+
`loading` and `loadingMessage` while replacement options are being fetched.
|
|
397
|
+
Client-side filtering remains the default.
|
package/dist/index.d.ts
CHANGED
|
@@ -2153,6 +2153,10 @@ interface ComboboxInputProps extends BaseProps {
|
|
|
2153
2153
|
placeholder?: string;
|
|
2154
2154
|
searchPlaceholder?: string;
|
|
2155
2155
|
emptyMessage?: string;
|
|
2156
|
+
loading?: boolean;
|
|
2157
|
+
loadingMessage?: string;
|
|
2158
|
+
onSearchChange?: (query: string) => void;
|
|
2159
|
+
shouldFilter?: boolean;
|
|
2156
2160
|
icon?: InputIcon;
|
|
2157
2161
|
showIcon?: boolean;
|
|
2158
2162
|
disabled?: boolean;
|
package/dist/index.mjs
CHANGED
|
@@ -9810,7 +9810,7 @@ var TextAreaInput = ({ value, onChange, placeholder = "", className = "", varian
|
|
|
9810
9810
|
}
|
|
9811
9811
|
);
|
|
9812
9812
|
};
|
|
9813
|
-
var ComboboxInput = ({ placeholder = "Select...", searchPlaceholder = "Search...", emptyMessage = "No results found.", value, onChange, icon, showIcon = true, iconColor, items = [], className = "", variant = "default", status = "default", bordered, borderColor, disabled = false, allowFreeText = false }) => {
|
|
9813
|
+
var ComboboxInput = ({ placeholder = "Select...", searchPlaceholder = "Search...", emptyMessage = "No results found.", loading = false, loadingMessage = "Loading...", onSearchChange, shouldFilter = true, value, onChange, icon, showIcon = true, iconColor, items = [], className = "", variant = "default", status = "default", bordered, borderColor, disabled = false, allowFreeText = false }) => {
|
|
9814
9814
|
const [open, setOpen] = useState(false);
|
|
9815
9815
|
const triggerRef = React__default.useRef(null);
|
|
9816
9816
|
const pointerDismissedRef = React__default.useRef(false);
|
|
@@ -9827,10 +9827,18 @@ var ComboboxInput = ({ placeholder = "Select...", searchPlaceholder = "Search...
|
|
|
9827
9827
|
onChange(next);
|
|
9828
9828
|
setOpen(false);
|
|
9829
9829
|
setQuery("");
|
|
9830
|
+
onSearchChange?.("");
|
|
9831
|
+
};
|
|
9832
|
+
const updateQuery = (next) => {
|
|
9833
|
+
setQuery(next);
|
|
9834
|
+
onSearchChange?.(next);
|
|
9830
9835
|
};
|
|
9831
9836
|
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: (o) => {
|
|
9832
9837
|
setOpen(o);
|
|
9833
|
-
if (!o)
|
|
9838
|
+
if (!o) {
|
|
9839
|
+
setQuery("");
|
|
9840
|
+
onSearchChange?.("");
|
|
9841
|
+
}
|
|
9834
9842
|
}, children: [
|
|
9835
9843
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, disabled, children: /* @__PURE__ */ jsxs(
|
|
9836
9844
|
BaseInput,
|
|
@@ -9868,14 +9876,14 @@ var ComboboxInput = ({ placeholder = "Select...", searchPlaceholder = "Search...
|
|
|
9868
9876
|
pointerDismissedRef.current = false;
|
|
9869
9877
|
triggerRef.current?.blur();
|
|
9870
9878
|
},
|
|
9871
|
-
children: /* @__PURE__ */ jsxs(Command, { children: [
|
|
9879
|
+
children: /* @__PURE__ */ jsxs(Command, { shouldFilter, children: [
|
|
9872
9880
|
/* @__PURE__ */ jsx(
|
|
9873
9881
|
CommandInput,
|
|
9874
9882
|
{
|
|
9875
9883
|
placeholder: searchPlaceholder,
|
|
9876
9884
|
className: "h-9",
|
|
9877
9885
|
value: query,
|
|
9878
|
-
onValueChange:
|
|
9886
|
+
onValueChange: updateQuery,
|
|
9879
9887
|
onKeyDown: (e) => {
|
|
9880
9888
|
if (e.key === "Enter" && showFreeTextOption) {
|
|
9881
9889
|
e.preventDefault();
|
|
@@ -9885,7 +9893,7 @@ var ComboboxInput = ({ placeholder = "Select...", searchPlaceholder = "Search...
|
|
|
9885
9893
|
}
|
|
9886
9894
|
),
|
|
9887
9895
|
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
9888
|
-
/* @__PURE__ */ jsx(CommandEmpty, { children: emptyMessage }),
|
|
9896
|
+
/* @__PURE__ */ jsx(CommandEmpty, { children: loading ? loadingMessage : emptyMessage }),
|
|
9889
9897
|
/* @__PURE__ */ jsxs(CommandGroup, { children: [
|
|
9890
9898
|
showFreeTextOption && /* @__PURE__ */ jsxs(CommandItem, { value: trimmedQuery, onSelect: () => commit(trimmedQuery), className: "cursor-pointer", children: [
|
|
9891
9899
|
/* @__PURE__ */ jsx(Check, { className: "mr-2 h-4 w-4 opacity-0" }),
|
|
@@ -13530,7 +13538,7 @@ function RenderFilter({ filter, mobilePrimary = false }) {
|
|
|
13530
13538
|
searchPlaceholder: filter.searchPlaceholder,
|
|
13531
13539
|
emptyMessage: filter.emptyMessage,
|
|
13532
13540
|
icon: "filter",
|
|
13533
|
-
showIcon: true,
|
|
13541
|
+
showIcon: filter.showIcon ?? true,
|
|
13534
13542
|
disabled: filter.disabled,
|
|
13535
13543
|
bordered,
|
|
13536
13544
|
className: "w-full"
|
|
@@ -13545,7 +13553,7 @@ function RenderFilter({ filter, mobilePrimary = false }) {
|
|
|
13545
13553
|
items: filter.options || [],
|
|
13546
13554
|
placeholder: filter.placeholder,
|
|
13547
13555
|
icon: "filter",
|
|
13548
|
-
showIcon: true,
|
|
13556
|
+
showIcon: filter.showIcon ?? true,
|
|
13549
13557
|
disabled: filter.disabled,
|
|
13550
13558
|
bordered,
|
|
13551
13559
|
className: "w-full"
|