@caratlogic/design-system 0.1.48 → 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/molecules/DropdownMenu/DropdownMenu.parts.d.ts +4 -0
- package/dist/components/molecules/DropdownMenu/DropdownMenu.parts.d.ts.map +1 -1
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/index.cjs.js +21 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +21 -4
- 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/ui.cjs.js
CHANGED
|
@@ -3322,14 +3322,22 @@ searchPlaceholder = 'Search...', emptyMessage = 'No options available', ...props
|
|
|
3322
3322
|
const searchCtx = useSelectSearchContext();
|
|
3323
3323
|
const searchTerm = searchCtx?.searchTerm ?? '';
|
|
3324
3324
|
const setSearchTerm = searchCtx?.setSearchTerm;
|
|
3325
|
+
const searchInputRef = t__namespace.useRef(null);
|
|
3325
3326
|
// Clear search when the content unmounts (safety)
|
|
3326
3327
|
t__namespace.useEffect(() => {
|
|
3327
3328
|
return () => setSearchTerm?.('');
|
|
3328
3329
|
}, [setSearchTerm]);
|
|
3329
3330
|
return (jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: jsxRuntime.jsxs(SelectPrimitive__namespace.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' &&
|
|
3330
|
-
'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 && (jsxRuntime.jsx("div", { className: "p-2 pb-1", children: jsxRuntime.jsxs("div", { className: "flex h-9 w-full items-center gap-2 rounded-lg bg-secondary px-3", children: [jsxRuntime.jsx(Search, { className: "h-4 w-4 shrink-0 text-[#737373]", "aria-hidden": "true" }), jsxRuntime.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),
|
|
3331
|
+
'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 && (jsxRuntime.jsx("div", { className: "p-2 pb-1", children: jsxRuntime.jsxs("div", { className: "flex h-9 w-full items-center gap-2 rounded-lg bg-secondary px-3", children: [jsxRuntime.jsx(Search, { className: "h-4 w-4 shrink-0 text-[#737373]", "aria-hidden": "true" }), jsxRuntime.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),
|
|
3331
3332
|
// prevent keys from interfering with Radix keyboard nav
|
|
3332
|
-
onKeyDown: (e) => e.stopPropagation()
|
|
3333
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
3334
|
+
// When the search hides the selected item, Radix moves focus to
|
|
3335
|
+
// the list itself; keep it in the search box so typing goes on.
|
|
3336
|
+
onBlur: (e) => {
|
|
3337
|
+
if (e.relatedTarget?.getAttribute('role') === 'listbox') {
|
|
3338
|
+
searchInputRef.current?.focus();
|
|
3339
|
+
}
|
|
3340
|
+
} })] }) })), jsxRuntime.jsx(SelectScrollUpButton, {}), jsxRuntime.jsx(SelectPrimitive__namespace.Viewport, { "data-slot": "select-viewport", style: {
|
|
3333
3341
|
'--select-empty-message': JSON.stringify(searchTerm ? 'No matching options' : emptyMessage),
|
|
3334
3342
|
}, 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' &&
|
|
3335
3343
|
'w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1'), children: children }), jsxRuntime.jsx(SelectScrollDownButton, {})] }) }));
|