@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/index.esm.js
CHANGED
|
@@ -42711,7 +42711,16 @@ const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
|
42711
42711
|
const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
42712
42712
|
const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
42713
42713
|
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
42714
|
-
|
|
42714
|
+
/**
|
|
42715
|
+
* A disabled item ignores the pointer, so the tooltip hangs off a wrapper.
|
|
42716
|
+
* Without a reason, a greyed-out item reads as a bug.
|
|
42717
|
+
*/
|
|
42718
|
+
function withDisabledReason(item, disabled, reason) {
|
|
42719
|
+
if (!disabled || !reason)
|
|
42720
|
+
return item;
|
|
42721
|
+
return (jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("div", { className: "cursor-not-allowed", children: item }) }), jsx(TooltipContent, { side: "left", children: reason })] }) }));
|
|
42722
|
+
}
|
|
42723
|
+
const DropdownMenuSubTrigger = React.forwardRef(({ className, inset, children, disabledReason, ...props }, ref) => withDisabledReason(jsxs(DropdownMenuPrimitive.SubTrigger, { ref: ref, className: cn('flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0', inset && 'pl-8', className), ...props, children: [children, jsx(ChevronRight, { className: "ml-auto", "aria-hidden": "true" })] }), props.disabled, disabledReason));
|
|
42715
42724
|
DropdownMenuSubTrigger.displayName =
|
|
42716
42725
|
DropdownMenuPrimitive.SubTrigger.displayName;
|
|
42717
42726
|
const DropdownMenuSubContent = React.forwardRef(({ className, ...props }, ref) => (jsx(DropdownMenuPrimitive.SubContent, { ref: ref, className: cn('z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-lg flex flex-col gap-1 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', className), ...props })));
|
|
@@ -42719,7 +42728,7 @@ DropdownMenuSubContent.displayName =
|
|
|
42719
42728
|
DropdownMenuPrimitive.SubContent.displayName;
|
|
42720
42729
|
const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 8, ...props }, ref) => (jsx(DropdownMenuPrimitive.Portal, { children: jsx(DropdownMenuPrimitive.Content, { ref: ref, sideOffset: sideOffset, className: cn('z-50 min-w-[12rem] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md flex flex-col gap-1 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', className), ...props }) })));
|
|
42721
42730
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
42722
|
-
const DropdownMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => (jsx(DropdownMenuPrimitive.Item, { ref: ref, className: cn('relative flex cursor-pointer select-none items-center gap-2 rounded-sm p-2 text-sm leading-5 outline-none transition-colors focus:bg-secondary dark:focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0', inset && 'pl-8', className), ...props })));
|
|
42731
|
+
const DropdownMenuItem = React.forwardRef(({ className, inset, disabledReason, ...props }, ref) => withDisabledReason(jsx(DropdownMenuPrimitive.Item, { ref: ref, className: cn('relative flex cursor-pointer select-none items-center gap-2 rounded-sm p-2 text-sm leading-5 outline-none transition-colors focus:bg-secondary dark:focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0', inset && 'pl-8', className), ...props }), props.disabled, disabledReason));
|
|
42723
42732
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
42724
42733
|
const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, checked, ...props }, ref) => (jsxs(DropdownMenuPrimitive.CheckboxItem, { ref: ref, className: cn('relative flex cursor-pointer select-none items-center gap-2 rounded-sm p-2 pl-8 text-sm leading-5 outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50', className), checked: checked, ...props, children: [jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: jsx(DropdownMenuPrimitive.ItemIndicator, { children: jsx(Check, { className: "h-4 w-4", "aria-hidden": "true" }) }) }), children] })));
|
|
42725
42734
|
DropdownMenuCheckboxItem.displayName =
|
|
@@ -42829,14 +42838,22 @@ searchPlaceholder = 'Search...', emptyMessage = 'No options available', ...props
|
|
|
42829
42838
|
const searchCtx = useSelectSearchContext();
|
|
42830
42839
|
const searchTerm = searchCtx?.searchTerm ?? '';
|
|
42831
42840
|
const setSearchTerm = searchCtx?.setSearchTerm;
|
|
42841
|
+
const searchInputRef = React.useRef(null);
|
|
42832
42842
|
// Clear search when the content unmounts (safety)
|
|
42833
42843
|
React.useEffect(() => {
|
|
42834
42844
|
return () => setSearchTerm?.('');
|
|
42835
42845
|
}, [setSearchTerm]);
|
|
42836
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' &&
|
|
42837
|
-
'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),
|
|
42838
42848
|
// prevent keys from interfering with Radix keyboard nav
|
|
42839
|
-
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: {
|
|
42840
42857
|
'--select-empty-message': JSON.stringify(searchTerm ? 'No matching options' : emptyMessage),
|
|
42841
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' &&
|
|
42842
42859
|
'w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1'), children: children }), jsx(SelectScrollDownButton, {})] }) }));
|