najm-kit 2.1.40 → 2.1.42
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/index.d.ts +3 -3
- package/dist/index.mjs +138 -84
- package/dist/json.mjs +12 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -921,8 +921,8 @@ declare function DropdownMenuRadioGroup({ ...props }: React$1.ComponentProps<typ
|
|
|
921
921
|
declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
922
922
|
inset?: boolean;
|
|
923
923
|
}): react_jsx_runtime.JSX.Element;
|
|
924
|
-
declare function DropdownMenuSubContent({ className, style, ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): react_jsx_runtime.JSX.Element;
|
|
925
|
-
declare function DropdownMenuContent({ className, sideOffset, style, ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.Content>): react_jsx_runtime.JSX.Element;
|
|
924
|
+
declare function DropdownMenuSubContent({ className, children, style, ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): react_jsx_runtime.JSX.Element;
|
|
925
|
+
declare function DropdownMenuContent({ className, children, sideOffset, style, ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.Content>): react_jsx_runtime.JSX.Element;
|
|
926
926
|
declare function DropdownMenuItem({ className, inset, variant, ...props }: React$1.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
927
927
|
inset?: boolean;
|
|
928
928
|
variant?: "default" | "destructive";
|
|
@@ -1221,7 +1221,7 @@ declare function Calendar(props: Record<string, any>): react_jsx_runtime.JSX.Ele
|
|
|
1221
1221
|
declare function Command({ className, ...props }: React$1.ComponentProps<typeof Command$1>): react_jsx_runtime.JSX.Element;
|
|
1222
1222
|
declare function CommandDialog({ children, ...props }: React$1.ComponentProps<typeof Dialog>): react_jsx_runtime.JSX.Element;
|
|
1223
1223
|
declare function CommandInput({ className, ...props }: React$1.ComponentProps<typeof Command$1.Input>): react_jsx_runtime.JSX.Element;
|
|
1224
|
-
declare function CommandList({ className, ...props }: React$1.ComponentProps<typeof Command$1.List>): react_jsx_runtime.JSX.Element;
|
|
1224
|
+
declare function CommandList({ className, children, ...props }: React$1.ComponentProps<typeof Command$1.List>): react_jsx_runtime.JSX.Element;
|
|
1225
1225
|
declare function CommandEmpty({ ...props }: React$1.ComponentProps<typeof Command$1.Empty>): react_jsx_runtime.JSX.Element;
|
|
1226
1226
|
declare function CommandGroup({ className, ...props }: React$1.ComponentProps<typeof Command$1.Group>): react_jsx_runtime.JSX.Element;
|
|
1227
1227
|
declare function CommandSeparator({ className, ...props }: React$1.ComponentProps<typeof Command$1.Separator>): react_jsx_runtime.JSX.Element;
|
package/dist/index.mjs
CHANGED
|
@@ -14,10 +14,11 @@ import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
|
14
14
|
import { converter, parse, formatHsl, formatRgb, formatHex } from 'culori';
|
|
15
15
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
16
16
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
17
|
+
import { OverlayScrollbars } from 'overlayscrollbars';
|
|
18
|
+
import { OverlayScrollbarsComponent } from 'overlayscrollbars-react';
|
|
17
19
|
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
18
20
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
19
21
|
import * as SheetPrimitive from '@radix-ui/react-dialog';
|
|
20
|
-
import { OverlayScrollbarsComponent } from 'overlayscrollbars-react';
|
|
21
22
|
import { create } from 'zustand';
|
|
22
23
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
23
24
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
@@ -1979,6 +1980,89 @@ function ResetButton({
|
|
|
1979
1980
|
}
|
|
1980
1981
|
);
|
|
1981
1982
|
}
|
|
1983
|
+
function assignRef(ref, node) {
|
|
1984
|
+
if (!ref) return;
|
|
1985
|
+
if (typeof ref === "function") ref(node);
|
|
1986
|
+
else ref.current = node;
|
|
1987
|
+
}
|
|
1988
|
+
function applyViewportLayout(node, axis) {
|
|
1989
|
+
node.style.width = "100%";
|
|
1990
|
+
node.style.height = "100%";
|
|
1991
|
+
node.style.minWidth = "0";
|
|
1992
|
+
node.style.minHeight = "0";
|
|
1993
|
+
node.style.overflowX = axis === "x" || axis === "both" ? "auto" : "hidden";
|
|
1994
|
+
node.style.overflowY = axis === "y" || axis === "both" ? "auto" : "hidden";
|
|
1995
|
+
}
|
|
1996
|
+
function najmScrollOptions(axis, autoHide, options) {
|
|
1997
|
+
return {
|
|
1998
|
+
scrollbars: { theme: "os-theme-najm", autoHide, autoHideDelay: 500, clickScroll: true },
|
|
1999
|
+
overflow: {
|
|
2000
|
+
x: axis === "x" || axis === "both" ? "scroll" : "hidden",
|
|
2001
|
+
y: axis === "y" || axis === "both" ? "scroll" : "hidden"
|
|
2002
|
+
},
|
|
2003
|
+
...options
|
|
2004
|
+
};
|
|
2005
|
+
}
|
|
2006
|
+
function useNajmScrollViewport({
|
|
2007
|
+
axis = "y",
|
|
2008
|
+
autoHide = "never",
|
|
2009
|
+
options
|
|
2010
|
+
} = {}) {
|
|
2011
|
+
const hostRef = React.useRef(null);
|
|
2012
|
+
const viewportRef = React.useRef(null);
|
|
2013
|
+
React.useEffect(() => {
|
|
2014
|
+
const target = hostRef.current;
|
|
2015
|
+
const viewport = viewportRef.current;
|
|
2016
|
+
if (!target || !viewport) return;
|
|
2017
|
+
const instance = OverlayScrollbars(
|
|
2018
|
+
{ target, elements: { viewport } },
|
|
2019
|
+
najmScrollOptions(axis, autoHide, options)
|
|
2020
|
+
);
|
|
2021
|
+
const containWheel = (event) => event.stopPropagation();
|
|
2022
|
+
viewport.addEventListener("wheel", containWheel, { passive: true });
|
|
2023
|
+
return () => {
|
|
2024
|
+
viewport.removeEventListener("wheel", containWheel);
|
|
2025
|
+
instance.destroy();
|
|
2026
|
+
};
|
|
2027
|
+
}, [axis, autoHide, options]);
|
|
2028
|
+
return { hostRef, viewportRef };
|
|
2029
|
+
}
|
|
2030
|
+
function NajmScroll({ className, axis = "y", autoHide = "never", viewportRef, events, options, element, children, style, ...props }) {
|
|
2031
|
+
return /* @__PURE__ */ jsx(
|
|
2032
|
+
OverlayScrollbarsComponent,
|
|
2033
|
+
{
|
|
2034
|
+
className: cn(className),
|
|
2035
|
+
style: {
|
|
2036
|
+
...style,
|
|
2037
|
+
overflow: "hidden",
|
|
2038
|
+
minHeight: 0,
|
|
2039
|
+
minWidth: 0
|
|
2040
|
+
},
|
|
2041
|
+
element,
|
|
2042
|
+
defer: true,
|
|
2043
|
+
options: najmScrollOptions(axis, autoHide, options || void 0),
|
|
2044
|
+
events: {
|
|
2045
|
+
...events,
|
|
2046
|
+
initialized: (instance, ...rest) => {
|
|
2047
|
+
const viewport = instance.elements().viewport;
|
|
2048
|
+
applyViewportLayout(viewport, axis);
|
|
2049
|
+
assignRef(viewportRef, viewport);
|
|
2050
|
+
events?.initialized?.(instance, ...rest);
|
|
2051
|
+
},
|
|
2052
|
+
updated: (instance, ...rest) => {
|
|
2053
|
+
applyViewportLayout(instance.elements().viewport, axis);
|
|
2054
|
+
events?.updated?.(instance, ...rest);
|
|
2055
|
+
},
|
|
2056
|
+
destroyed: (instance, ...rest) => {
|
|
2057
|
+
assignRef(viewportRef, null);
|
|
2058
|
+
events?.destroyed?.(instance, ...rest);
|
|
2059
|
+
}
|
|
2060
|
+
},
|
|
2061
|
+
...props,
|
|
2062
|
+
children
|
|
2063
|
+
}
|
|
2064
|
+
);
|
|
2065
|
+
}
|
|
1982
2066
|
function Select({ ...props }) {
|
|
1983
2067
|
return /* @__PURE__ */ jsx(SelectPrimitive.Root, { "data-slot": "select", ...props });
|
|
1984
2068
|
}
|
|
@@ -2025,10 +2109,12 @@ function SelectContent({ className, children, position = "popper", style, ...pro
|
|
|
2025
2109
|
borderColor: "var(--border)"
|
|
2026
2110
|
} : {}
|
|
2027
2111
|
};
|
|
2112
|
+
const { hostRef, viewportRef } = useNajmScrollViewport();
|
|
2028
2113
|
useNajmPortalLayerStyles();
|
|
2029
|
-
return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { container: container ?? void 0, children: /* @__PURE__ */
|
|
2114
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsx(
|
|
2030
2115
|
SelectPrimitive.Content,
|
|
2031
2116
|
{
|
|
2117
|
+
ref: hostRef,
|
|
2032
2118
|
"data-slot": "select-content",
|
|
2033
2119
|
className: cn(
|
|
2034
2120
|
"bg-popover 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-[10000] max-h-(--radix-select-content-available-height) min-w-[8rem] overflow-hidden rounded-md shadow-md",
|
|
@@ -2039,11 +2125,17 @@ function SelectContent({ className, children, position = "popper", style, ...pro
|
|
|
2039
2125
|
style: { ...recipeStyle, ...style },
|
|
2040
2126
|
position,
|
|
2041
2127
|
...props,
|
|
2042
|
-
children:
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2128
|
+
children: /* @__PURE__ */ jsx(
|
|
2129
|
+
SelectPrimitive.Viewport,
|
|
2130
|
+
{
|
|
2131
|
+
ref: viewportRef,
|
|
2132
|
+
className: cn(
|
|
2133
|
+
"max-h-[var(--radix-select-content-available-height)] overflow-x-hidden",
|
|
2134
|
+
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
2135
|
+
),
|
|
2136
|
+
children: /* @__PURE__ */ jsx("div", { className: "p-1", children })
|
|
2137
|
+
}
|
|
2138
|
+
)
|
|
2047
2139
|
}
|
|
2048
2140
|
) });
|
|
2049
2141
|
}
|
|
@@ -4452,62 +4544,6 @@ function SheetTitle({ className, ...props }) {
|
|
|
4452
4544
|
function SheetDescription({ className, ...props }) {
|
|
4453
4545
|
return /* @__PURE__ */ jsx(SheetPrimitive.Description, { "data-slot": "sheet-description", className: cn("text-muted-foreground text-sm", className), ...props });
|
|
4454
4546
|
}
|
|
4455
|
-
function assignRef(ref, node) {
|
|
4456
|
-
if (!ref) return;
|
|
4457
|
-
if (typeof ref === "function") ref(node);
|
|
4458
|
-
else ref.current = node;
|
|
4459
|
-
}
|
|
4460
|
-
function applyViewportLayout(node, axis) {
|
|
4461
|
-
node.style.width = "100%";
|
|
4462
|
-
node.style.height = "100%";
|
|
4463
|
-
node.style.minWidth = "0";
|
|
4464
|
-
node.style.minHeight = "0";
|
|
4465
|
-
node.style.overflowX = axis === "x" || axis === "both" ? "auto" : "hidden";
|
|
4466
|
-
node.style.overflowY = axis === "y" || axis === "both" ? "auto" : "hidden";
|
|
4467
|
-
}
|
|
4468
|
-
function NajmScroll({ className, axis = "y", autoHide = "never", viewportRef, events, options, element, children, style, ...props }) {
|
|
4469
|
-
return /* @__PURE__ */ jsx(
|
|
4470
|
-
OverlayScrollbarsComponent,
|
|
4471
|
-
{
|
|
4472
|
-
className: cn(className),
|
|
4473
|
-
style: {
|
|
4474
|
-
...style,
|
|
4475
|
-
overflow: "hidden",
|
|
4476
|
-
minHeight: 0,
|
|
4477
|
-
minWidth: 0
|
|
4478
|
-
},
|
|
4479
|
-
element,
|
|
4480
|
-
defer: true,
|
|
4481
|
-
options: {
|
|
4482
|
-
scrollbars: { theme: "os-theme-najm", autoHide, autoHideDelay: 500, clickScroll: true },
|
|
4483
|
-
overflow: {
|
|
4484
|
-
x: axis === "x" || axis === "both" ? "scroll" : "hidden",
|
|
4485
|
-
y: axis === "y" || axis === "both" ? "scroll" : "hidden"
|
|
4486
|
-
},
|
|
4487
|
-
...options
|
|
4488
|
-
},
|
|
4489
|
-
events: {
|
|
4490
|
-
...events,
|
|
4491
|
-
initialized: (instance, ...rest) => {
|
|
4492
|
-
const viewport = instance.elements().viewport;
|
|
4493
|
-
applyViewportLayout(viewport, axis);
|
|
4494
|
-
assignRef(viewportRef, viewport);
|
|
4495
|
-
events?.initialized?.(instance, ...rest);
|
|
4496
|
-
},
|
|
4497
|
-
updated: (instance, ...rest) => {
|
|
4498
|
-
applyViewportLayout(instance.elements().viewport, axis);
|
|
4499
|
-
events?.updated?.(instance, ...rest);
|
|
4500
|
-
},
|
|
4501
|
-
destroyed: (instance, ...rest) => {
|
|
4502
|
-
assignRef(viewportRef, null);
|
|
4503
|
-
events?.destroyed?.(instance, ...rest);
|
|
4504
|
-
}
|
|
4505
|
-
},
|
|
4506
|
-
...props,
|
|
4507
|
-
children
|
|
4508
|
-
}
|
|
4509
|
-
);
|
|
4510
|
-
}
|
|
4511
4547
|
var PortalScopeContext = createContext(void 0);
|
|
4512
4548
|
function NPortalScopeProvider({ className, children }) {
|
|
4513
4549
|
return /* @__PURE__ */ jsx(PortalScopeContext.Provider, { value: className, children });
|
|
@@ -5941,39 +5977,45 @@ function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
|
5941
5977
|
}
|
|
5942
5978
|
);
|
|
5943
5979
|
}
|
|
5944
|
-
function DropdownMenuSubContent({ className, style, ...props }) {
|
|
5980
|
+
function DropdownMenuSubContent({ className, children, style, ...props }) {
|
|
5945
5981
|
const surface = useDropdownSurfaceRecipe("subContent");
|
|
5982
|
+
const { hostRef, viewportRef } = useNajmScrollViewport();
|
|
5946
5983
|
useNajmPortalLayerStyles();
|
|
5947
5984
|
return /* @__PURE__ */ jsx(
|
|
5948
5985
|
DropdownMenuPrimitive.SubContent,
|
|
5949
5986
|
{
|
|
5987
|
+
ref: hostRef,
|
|
5950
5988
|
"data-slot": "dropdown-menu-sub-content",
|
|
5951
5989
|
className: cn(
|
|
5952
|
-
"bg-popover 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=top]:slide-in-from-bottom-2 data-[side=right]:slide-in-from-left-2 z-[10000] min-w-[8rem] overflow-hidden rounded-md border
|
|
5990
|
+
"bg-popover 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=top]:slide-in-from-bottom-2 data-[side=right]:slide-in-from-left-2 z-[10000] max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-hidden rounded-md border shadow-lg",
|
|
5953
5991
|
surface.className,
|
|
5954
5992
|
className
|
|
5955
5993
|
),
|
|
5956
5994
|
style: { ...surface.style, ...style },
|
|
5957
|
-
...props
|
|
5995
|
+
...props,
|
|
5996
|
+
children: /* @__PURE__ */ jsx("div", { ref: viewportRef, className: "max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-x-hidden", children: /* @__PURE__ */ jsx("div", { className: "p-1", children }) })
|
|
5958
5997
|
}
|
|
5959
5998
|
);
|
|
5960
5999
|
}
|
|
5961
|
-
function DropdownMenuContent({ className, sideOffset = 4, style, ...props }) {
|
|
6000
|
+
function DropdownMenuContent({ className, children, sideOffset = 4, style, ...props }) {
|
|
5962
6001
|
const container = React.useContext(NajmThemeContainerCtx);
|
|
5963
6002
|
const surface = useDropdownSurfaceRecipe("content");
|
|
6003
|
+
const { hostRef, viewportRef } = useNajmScrollViewport();
|
|
5964
6004
|
useNajmPortalLayerStyles();
|
|
5965
6005
|
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsx(
|
|
5966
6006
|
DropdownMenuPrimitive.Content,
|
|
5967
6007
|
{
|
|
6008
|
+
ref: hostRef,
|
|
5968
6009
|
"data-slot": "dropdown-menu-content",
|
|
5969
6010
|
sideOffset,
|
|
5970
6011
|
className: cn(
|
|
5971
|
-
"bg-popover 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 z-[10000] min-w-[8rem] overflow-hidden rounded-md border border-border
|
|
6012
|
+
"bg-popover 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 z-[10000] max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-hidden rounded-md border border-border shadow-md",
|
|
5972
6013
|
surface.className,
|
|
5973
6014
|
className
|
|
5974
6015
|
),
|
|
5975
6016
|
style: { ...surface.style, ...style },
|
|
5976
|
-
...props
|
|
6017
|
+
...props,
|
|
6018
|
+
children: /* @__PURE__ */ jsx("div", { ref: viewportRef, className: "max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-x-hidden", children: /* @__PURE__ */ jsx("div", { className: "p-1", children }) })
|
|
5977
6019
|
}
|
|
5978
6020
|
) });
|
|
5979
6021
|
}
|
|
@@ -6630,8 +6672,18 @@ function CommandInput({ className, ...props }) {
|
|
|
6630
6672
|
)
|
|
6631
6673
|
] });
|
|
6632
6674
|
}
|
|
6633
|
-
function CommandList({ className, ...props }) {
|
|
6634
|
-
|
|
6675
|
+
function CommandList({ className, children, ...props }) {
|
|
6676
|
+
const { hostRef, viewportRef } = useNajmScrollViewport();
|
|
6677
|
+
return /* @__PURE__ */ jsx(
|
|
6678
|
+
Command$1.List,
|
|
6679
|
+
{
|
|
6680
|
+
ref: hostRef,
|
|
6681
|
+
"data-slot": "command-list",
|
|
6682
|
+
className: cn("max-h-[300px] overflow-hidden", className),
|
|
6683
|
+
...props,
|
|
6684
|
+
children: /* @__PURE__ */ jsx("div", { ref: viewportRef, "data-slot": "command-list-viewport", className: "max-h-[300px] overflow-x-hidden", children })
|
|
6685
|
+
}
|
|
6686
|
+
);
|
|
6635
6687
|
}
|
|
6636
6688
|
function CommandEmpty({ ...props }) {
|
|
6637
6689
|
return /* @__PURE__ */ jsx(Command$1.Empty, { "data-slot": "command-empty", className: "py-6 text-center text-sm", ...props });
|
|
@@ -8735,7 +8787,7 @@ function FloatingSelectSegment({
|
|
|
8735
8787
|
]
|
|
8736
8788
|
}
|
|
8737
8789
|
),
|
|
8738
|
-
/* @__PURE__ */ jsx(DropdownMenuContent, { side: "top", align: "center", className: "max-h-72
|
|
8790
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { side: "top", align: "center", className: "max-h-72", children: action.options.map((o) => /* @__PURE__ */ jsx(
|
|
8739
8791
|
DropdownMenuItem,
|
|
8740
8792
|
{
|
|
8741
8793
|
onSelect: () => void onAction(action.id, o.value),
|
|
@@ -9181,16 +9233,18 @@ var MultiSelectInput = ({ placeholder = "Select items...", value = [], onChange,
|
|
|
9181
9233
|
},
|
|
9182
9234
|
children: /* @__PURE__ */ jsxs(Command, { children: [
|
|
9183
9235
|
showSearch && /* @__PURE__ */ jsx(CommandInput, { placeholder: searchPlaceholder, className: "h-9" }),
|
|
9184
|
-
/* @__PURE__ */
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
/* @__PURE__ */
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9236
|
+
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
9237
|
+
/* @__PURE__ */ jsx(CommandEmpty, { children: emptyMessage }),
|
|
9238
|
+
/* @__PURE__ */ jsx(CommandGroup, { children: items.map((item) => {
|
|
9239
|
+
const itemValue = typeof item === "string" ? item : item.value;
|
|
9240
|
+
const itemLabel = typeof item === "string" ? item : item.label;
|
|
9241
|
+
const isSelected = value.includes(itemValue);
|
|
9242
|
+
return /* @__PURE__ */ jsxs(CommandItem, { onSelect: () => handleSelect(itemValue), className: "flex items-center gap-2 cursor-pointer", children: [
|
|
9243
|
+
/* @__PURE__ */ jsx(Checkbox, { checked: isSelected, onCheckedChange: () => handleSelect(itemValue), className: "pointer-events-none" }),
|
|
9244
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1", children: itemLabel })
|
|
9245
|
+
] }, itemValue);
|
|
9246
|
+
}) })
|
|
9247
|
+
] })
|
|
9194
9248
|
] })
|
|
9195
9249
|
}
|
|
9196
9250
|
)
|
|
@@ -10428,7 +10482,7 @@ function Combobox({
|
|
|
10428
10482
|
}
|
|
10429
10483
|
)
|
|
10430
10484
|
] }),
|
|
10431
|
-
/* @__PURE__ */ jsx(
|
|
10485
|
+
/* @__PURE__ */ jsx(NajmScroll, { className: "max-h-64", onWheel: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx("div", { className: "py-1", children: filtered.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: allowFreeText && query.trim() ? `Press Enter to use "${query.trim()}"` : emptyText }) : filtered.map((opt, i) => /* @__PURE__ */ jsxs(
|
|
10432
10486
|
"button",
|
|
10433
10487
|
{
|
|
10434
10488
|
type: "button",
|
|
@@ -10445,7 +10499,7 @@ function Combobox({
|
|
|
10445
10499
|
]
|
|
10446
10500
|
},
|
|
10447
10501
|
opt.value
|
|
10448
|
-
)) })
|
|
10502
|
+
)) }) })
|
|
10449
10503
|
] })
|
|
10450
10504
|
] });
|
|
10451
10505
|
}
|
package/dist/json.mjs
CHANGED
|
@@ -13,6 +13,7 @@ import { Slot } from '@radix-ui/react-slot';
|
|
|
13
13
|
import * as LucideIcons from 'lucide-react';
|
|
14
14
|
import { LoaderCircleIcon, Loader2, AlertCircle, ClipboardPaste, Copy, RotateCcw } from 'lucide-react';
|
|
15
15
|
import { cva } from 'class-variance-authority';
|
|
16
|
+
import 'overlayscrollbars';
|
|
16
17
|
import { OverlayScrollbarsComponent } from 'overlayscrollbars-react';
|
|
17
18
|
|
|
18
19
|
// src/json/JsonViewer.tsx
|
|
@@ -977,6 +978,16 @@ function applyViewportLayout(node, axis) {
|
|
|
977
978
|
node.style.overflowX = axis === "x" || axis === "both" ? "auto" : "hidden";
|
|
978
979
|
node.style.overflowY = axis === "y" || axis === "both" ? "auto" : "hidden";
|
|
979
980
|
}
|
|
981
|
+
function najmScrollOptions(axis, autoHide, options) {
|
|
982
|
+
return {
|
|
983
|
+
scrollbars: { theme: "os-theme-najm", autoHide, autoHideDelay: 500, clickScroll: true },
|
|
984
|
+
overflow: {
|
|
985
|
+
x: axis === "x" || axis === "both" ? "scroll" : "hidden",
|
|
986
|
+
y: axis === "y" || axis === "both" ? "scroll" : "hidden"
|
|
987
|
+
},
|
|
988
|
+
...options
|
|
989
|
+
};
|
|
990
|
+
}
|
|
980
991
|
function NajmScroll({ className, axis = "y", autoHide = "never", viewportRef, events, options, element, children, style, ...props }) {
|
|
981
992
|
return /* @__PURE__ */ jsx(
|
|
982
993
|
OverlayScrollbarsComponent,
|
|
@@ -990,14 +1001,7 @@ function NajmScroll({ className, axis = "y", autoHide = "never", viewportRef, ev
|
|
|
990
1001
|
},
|
|
991
1002
|
element,
|
|
992
1003
|
defer: true,
|
|
993
|
-
options:
|
|
994
|
-
scrollbars: { theme: "os-theme-najm", autoHide, autoHideDelay: 500, clickScroll: true },
|
|
995
|
-
overflow: {
|
|
996
|
-
x: axis === "x" || axis === "both" ? "scroll" : "hidden",
|
|
997
|
-
y: axis === "y" || axis === "both" ? "scroll" : "hidden"
|
|
998
|
-
},
|
|
999
|
-
...options
|
|
1000
|
-
},
|
|
1004
|
+
options: najmScrollOptions(axis, autoHide, options || void 0),
|
|
1001
1005
|
events: {
|
|
1002
1006
|
...events,
|
|
1003
1007
|
initialized: (instance, ...rest) => {
|