@caratlogic/design-system 0.1.49 → 0.1.50
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/ui/select.d.ts.map +1 -1
- package/dist/index.cjs.js +10 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +10 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/ui.cjs.js +10 -2
- package/dist/ui.cjs.js.map +1 -1
- package/dist/ui.esm.js +10 -2
- package/dist/ui.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -42838,14 +42838,22 @@ searchPlaceholder = 'Search...', emptyMessage = 'No options available', ...props
|
|
|
42838
42838
|
const searchCtx = useSelectSearchContext();
|
|
42839
42839
|
const searchTerm = searchCtx?.searchTerm ?? '';
|
|
42840
42840
|
const setSearchTerm = searchCtx?.setSearchTerm;
|
|
42841
|
+
const searchInputRef = React.useRef(null);
|
|
42841
42842
|
// Clear search when the content unmounts (safety)
|
|
42842
42843
|
React.useEffect(() => {
|
|
42843
42844
|
return () => setSearchTerm?.('');
|
|
42844
42845
|
}, [setSearchTerm]);
|
|
42845
42846
|
return (jsx(SelectPrimitive.Portal, { children: jsxs(SelectPrimitive.Content, { "data-slot": "select-content", className: cn('bg-card cursor-pointer text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-border shadow-[0_10px_15px_-3px_rgba(0,0,0,0.10),0_4px_6px_-4px_rgba(0,0,0,0.10)]', position === 'popper' &&
|
|
42846
|
-
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1', className), position: position, ...props, children: [searchable && (jsx("div", { className: "p-2 pb-1", children: jsxs("div", { className: "flex h-9 w-full items-center gap-2 rounded-lg bg-secondary px-3", children: [jsx(Search, { className: "h-4 w-4 shrink-0 text-[#737373]", "aria-hidden": "true" }), jsx("input", { type: "search", className: "min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-placeholder", placeholder: searchPlaceholder, value: searchTerm, onChange: (e) => setSearchTerm?.(e.target.value),
|
|
42847
|
+
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1', className), position: position, ...props, children: [searchable && (jsx("div", { className: "p-2 pb-1", children: jsxs("div", { className: "flex h-9 w-full items-center gap-2 rounded-lg bg-secondary px-3", children: [jsx(Search, { className: "h-4 w-4 shrink-0 text-[#737373]", "aria-hidden": "true" }), jsx("input", { ref: searchInputRef, type: "search", className: "min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-placeholder", placeholder: searchPlaceholder, value: searchTerm, onChange: (e) => setSearchTerm?.(e.target.value),
|
|
42847
42848
|
// prevent keys from interfering with Radix keyboard nav
|
|
42848
|
-
onKeyDown: (e) => e.stopPropagation()
|
|
42849
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
42850
|
+
// When the search hides the selected item, Radix moves focus to
|
|
42851
|
+
// the list itself; keep it in the search box so typing goes on.
|
|
42852
|
+
onBlur: (e) => {
|
|
42853
|
+
if (e.relatedTarget?.getAttribute('role') === 'listbox') {
|
|
42854
|
+
searchInputRef.current?.focus();
|
|
42855
|
+
}
|
|
42856
|
+
} })] }) })), jsx(SelectScrollUpButton, {}), jsx(SelectPrimitive.Viewport, { "data-slot": "select-viewport", style: {
|
|
42849
42857
|
'--select-empty-message': JSON.stringify(searchTerm ? 'No matching options' : emptyMessage),
|
|
42850
42858
|
}, className: cn('p-1 max-h-[12.5rem] overflow-y-auto', 'empty:after:block empty:after:px-2 empty:after:py-4 empty:after:text-center empty:after:text-sm empty:after:text-muted-foreground empty:after:content-(--select-empty-message)', position === 'popper' &&
|
|
42851
42859
|
'w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1'), children: children }), jsx(SelectScrollDownButton, {})] }) }));
|