@wallarm-org/design-system 0.86.0 → 0.87.0
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/components/Select/SelectEmptyState.d.ts +5 -2
- package/dist/components/Select/SelectEmptyState.js +2 -2
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Select/index.js +2 -0
- package/dist/components/Select/useSelectSearch.d.ts +16 -0
- package/dist/components/Select/useSelectSearch.js +20 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/metadata/components.json +14 -3
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { EmptyState, EmptyStateDescription, EmptyStateMessage } from "../EmptyState/index.js";
|
|
3
|
-
const SelectEmptyState = ()=>/*#__PURE__*/ jsx(EmptyState, {
|
|
3
|
+
const SelectEmptyState = ({ description = 'No results' })=>/*#__PURE__*/ jsx(EmptyState, {
|
|
4
4
|
type: "no-results",
|
|
5
5
|
children: /*#__PURE__*/ jsx(EmptyStateMessage, {
|
|
6
6
|
children: /*#__PURE__*/ jsx(EmptyStateDescription, {
|
|
7
|
-
children:
|
|
7
|
+
children: description
|
|
8
8
|
})
|
|
9
9
|
})
|
|
10
10
|
});
|
|
@@ -4,6 +4,7 @@ export { SelectButton } from './SelectButton';
|
|
|
4
4
|
export { SelectButtonTag, SelectButtonTagValue } from './SelectButtonTag';
|
|
5
5
|
export { SelectClearTrigger } from './SelectClearTrigger';
|
|
6
6
|
export { SelectContent } from './SelectContent';
|
|
7
|
+
export { SelectEmptyState, type SelectEmptyStateProps } from './SelectEmptyState';
|
|
7
8
|
export { SelectFooter } from './SelectFooter';
|
|
8
9
|
export { SelectGroup } from './SelectGroup';
|
|
9
10
|
export { SelectGroupLabel } from './SelectGroupLabel';
|
|
@@ -17,3 +18,4 @@ export { SelectPositioner } from './SelectPositioner';
|
|
|
17
18
|
export { SelectSearchInput, type SelectSearchInputProps } from './SelectSearchInput';
|
|
18
19
|
export { SelectSeparator, type SelectSeparatorProps } from './SelectSeparator';
|
|
19
20
|
export type { SelectDataItem } from './types';
|
|
21
|
+
export { type UseSelectSearchOptions, type UseSelectSearchResult, useSelectSearch, } from './useSelectSearch';
|
|
@@ -4,6 +4,7 @@ export { SelectButton } from "./SelectButton.js";
|
|
|
4
4
|
export { SelectButtonTag, SelectButtonTagValue } from "./SelectButtonTag/index.js";
|
|
5
5
|
export { SelectClearTrigger } from "./SelectClearTrigger.js";
|
|
6
6
|
export { SelectContent } from "./SelectContent.js";
|
|
7
|
+
export { SelectEmptyState } from "./SelectEmptyState.js";
|
|
7
8
|
export { SelectFooter } from "./SelectFooter.js";
|
|
8
9
|
export { SelectGroup } from "./SelectGroup.js";
|
|
9
10
|
export { SelectGroupLabel } from "./SelectGroupLabel.js";
|
|
@@ -16,3 +17,4 @@ export { SelectOptionText } from "./SelectOptionText.js";
|
|
|
16
17
|
export { SelectPositioner } from "./SelectPositioner.js";
|
|
17
18
|
export { SelectSearchInput } from "./SelectSearchInput.js";
|
|
18
19
|
export { SelectSeparator } from "./SelectSeparator.js";
|
|
20
|
+
export { useSelectSearch } from "./useSelectSearch.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CollectionItem, ListCollection } from '@ark-ui/react/collection';
|
|
2
|
+
export interface UseSelectSearchOptions<T extends CollectionItem> {
|
|
3
|
+
/**
|
|
4
|
+
* Overrides the default case-insensitive substring match against the
|
|
5
|
+
* item's stringified label. Receives the same `itemString` `collection`
|
|
6
|
+
* already computes via `itemToString`, plus the raw item for matching on
|
|
7
|
+
* other fields (e.g. `description`).
|
|
8
|
+
*/
|
|
9
|
+
filterFn?: (itemString: string, item: T, query: string) => boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface UseSelectSearchResult<T extends CollectionItem> {
|
|
12
|
+
searchValue: string;
|
|
13
|
+
onSearchChange: (value: string) => void;
|
|
14
|
+
filteredCollection: ListCollection<T>;
|
|
15
|
+
}
|
|
16
|
+
export declare const useSelectSearch: <T extends CollectionItem>(collection: ListCollection<T>, options?: UseSelectSearchOptions<T>) => UseSelectSearchResult<T>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useMemo, useState } from "react";
|
|
2
|
+
const defaultFilterFn = (itemString, query)=>itemString.toLowerCase().includes(query.toLowerCase());
|
|
3
|
+
const useSelectSearch = (collection, options)=>{
|
|
4
|
+
const [searchValue, setSearchValue] = useState('');
|
|
5
|
+
const filterFn = options?.filterFn;
|
|
6
|
+
const filteredCollection = useMemo(()=>{
|
|
7
|
+
if (!searchValue) return collection;
|
|
8
|
+
return collection.filter((itemString, _index, item)=>filterFn ? filterFn(itemString, item, searchValue) : defaultFilterFn(itemString, searchValue));
|
|
9
|
+
}, [
|
|
10
|
+
collection,
|
|
11
|
+
searchValue,
|
|
12
|
+
filterFn
|
|
13
|
+
]);
|
|
14
|
+
return {
|
|
15
|
+
searchValue,
|
|
16
|
+
onSearchChange: setSearchValue,
|
|
17
|
+
filteredCollection
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export { useSelectSearch };
|
package/dist/index.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export { getResponseCodeCategory, RESPONSE_CODE_COLOR, ResponseCode, type Respon
|
|
|
62
62
|
export { ScrollArea, ScrollAreaContent, type ScrollAreaContentProps, ScrollAreaCorner, type ScrollAreaProps, ScrollAreaScrollbar, type ScrollAreaScrollbarProps, ScrollAreaViewport, type ScrollAreaViewportProps, } from './components/ScrollArea';
|
|
63
63
|
export { SegmentedControl, SegmentedControlButton, type SegmentedControlButtonProps, SegmentedControlItem, type SegmentedControlItemProps, type SegmentedControlProps, SegmentedControlSeparator, type SegmentedControlSeparatorProps, } from './components/SegmentedControl';
|
|
64
64
|
export { SegmentedTabs, SegmentedTabsButton, SegmentedTabsContent, SegmentedTabsList, SegmentedTabsSeparator, SegmentedTabsTrigger, SegmentedTabsTriggerButton, } from './components/SegmentedTabs';
|
|
65
|
-
export { createListCollection, Select, SelectButton, SelectClearTrigger, SelectContent, type SelectDataItem, SelectFooter, SelectGroup, SelectGroupLabel, SelectHeader, SelectInput, SelectOption, SelectOptionDescription, SelectOptionIndicator, SelectOptionText, SelectPositioner, SelectSearchInput, SelectSeparator, } from './components/Select';
|
|
65
|
+
export { createListCollection, Select, SelectButton, SelectClearTrigger, SelectContent, type SelectDataItem, SelectEmptyState, type SelectEmptyStateProps, SelectFooter, SelectGroup, SelectGroupLabel, SelectHeader, SelectInput, SelectOption, SelectOptionDescription, SelectOptionIndicator, SelectOptionText, SelectPositioner, SelectSearchInput, SelectSeparator, type UseSelectSearchOptions, type UseSelectSearchResult, useSelectSearch, } from './components/Select';
|
|
66
66
|
export { Selection, SelectionAll, type SelectionAllProps, SelectionBulkBar, type SelectionBulkBarPlacement, type SelectionBulkBarProps, type SelectionContextValue, SelectionItem, type SelectionItemProps, type SelectionProps, useSelectionContext, } from './components/Selection';
|
|
67
67
|
export { Separator, type SeparatorProps } from './components/Separator';
|
|
68
68
|
export { Skeleton, type SkeletonProps } from './components/Skeleton';
|
package/dist/index.js
CHANGED
|
@@ -51,7 +51,7 @@ export { RESPONSE_CODE_COLOR, ResponseCode, getResponseCodeCategory } from "./co
|
|
|
51
51
|
export { ScrollArea, ScrollAreaContent, ScrollAreaCorner, ScrollAreaScrollbar, ScrollAreaViewport } from "./components/ScrollArea/index.js";
|
|
52
52
|
export { SegmentedControl, SegmentedControlButton, SegmentedControlItem, SegmentedControlSeparator } from "./components/SegmentedControl/index.js";
|
|
53
53
|
export { SegmentedTabs, SegmentedTabsButton, SegmentedTabsContent, SegmentedTabsList, SegmentedTabsSeparator, SegmentedTabsTrigger, SegmentedTabsTriggerButton } from "./components/SegmentedTabs/index.js";
|
|
54
|
-
export { Select, SelectButton, SelectClearTrigger, SelectContent, SelectFooter, SelectGroup, SelectGroupLabel, SelectHeader, SelectInput, SelectOption, SelectOptionDescription, SelectOptionIndicator, SelectOptionText, SelectPositioner, SelectSearchInput, SelectSeparator, createListCollection } from "./components/Select/index.js";
|
|
54
|
+
export { Select, SelectButton, SelectClearTrigger, SelectContent, SelectEmptyState, SelectFooter, SelectGroup, SelectGroupLabel, SelectHeader, SelectInput, SelectOption, SelectOptionDescription, SelectOptionIndicator, SelectOptionText, SelectPositioner, SelectSearchInput, SelectSeparator, createListCollection, useSelectSearch } from "./components/Select/index.js";
|
|
55
55
|
export { Selection, SelectionAll, SelectionBulkBar, SelectionItem, useSelectionContext } from "./components/Selection/index.js";
|
|
56
56
|
export { Separator } from "./components/Separator/index.js";
|
|
57
57
|
export { Skeleton } from "./components/Skeleton/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
3
|
-
"generatedAt": "2026-08-
|
|
2
|
+
"version": "0.86.0",
|
|
3
|
+
"generatedAt": "2026-08-07T08:01:47.254Z",
|
|
4
4
|
"components": [
|
|
5
5
|
{
|
|
6
6
|
"name": "Accordion",
|
|
@@ -53952,6 +53952,17 @@
|
|
|
53952
53952
|
"props": [],
|
|
53953
53953
|
"variants": [],
|
|
53954
53954
|
"subComponents": [
|
|
53955
|
+
{
|
|
53956
|
+
"name": "SelectEmptyState",
|
|
53957
|
+
"props": [
|
|
53958
|
+
{
|
|
53959
|
+
"name": "description",
|
|
53960
|
+
"type": "ReactNode",
|
|
53961
|
+
"required": false,
|
|
53962
|
+
"defaultValue": "No results"
|
|
53963
|
+
}
|
|
53964
|
+
]
|
|
53965
|
+
},
|
|
53955
53966
|
{
|
|
53956
53967
|
"name": "SelectSearchInput",
|
|
53957
53968
|
"props": [
|
|
@@ -54554,7 +54565,7 @@
|
|
|
54554
54565
|
},
|
|
54555
54566
|
{
|
|
54556
54567
|
"name": "WithSearch",
|
|
54557
|
-
"code": "() => {\n const
|
|
54568
|
+
"code": "() => {\n const collection = createListCollection({\n items: skillsWithoutIcons,\n groupBy: item => item.category ?? '',\n itemToString: item => item.label,\n });\n\n const { searchValue, onSearchChange, filteredCollection } = useSelectSearch(collection);\n\n return (\n <div className='w-300'>\n <Select collection={collection}>\n <SelectButton />\n\n <SelectPositioner>\n <SelectHeader>\n <SelectSearchInput value={searchValue} onChange={onSearchChange} />\n </SelectHeader>\n\n <SelectContent>\n {filteredCollection.size === 0 ? (\n <SelectEmptyState description={`No results for \"${searchValue}\"`} />\n ) : (\n filteredCollection.group().map(([category, group], index) => (\n <SelectGroup key={category}>\n <SelectGroupLabel>\n {category}\n {index === 0 && <SelectClearTrigger>Clear all</SelectClearTrigger>}\n </SelectGroupLabel>\n {group.map(skill => (\n <SelectOption key={skill.value} item={skill}>\n <SelectOptionText>{skill.label}</SelectOptionText>\n {skill.description && (\n <SelectOptionDescription>{skill.description}</SelectOptionDescription>\n )}\n <SelectOptionIndicator />\n </SelectOption>\n ))}\n </SelectGroup>\n ))\n )}\n </SelectContent>\n\n <SelectFooter>\n <HStack justify='between'>\n <Button variant='ghost' color='neutral' size='small'>\n <SquareArrowOutUpRight />\n See all\n </Button>\n\n <HStack justify='end'>\n <Button variant='ghost' color='neutral' size='small'>\n Cancel\n </Button>\n\n <Button variant='primary' color='brand' size='small'>\n Apply\n </Button>\n </HStack>\n </HStack>\n </SelectFooter>\n </SelectPositioner>\n </Select>\n </div>\n );\n}"
|
|
54558
54569
|
},
|
|
54559
54570
|
{
|
|
54560
54571
|
"name": "WithFormField",
|