najm-kit 2.1.39 → 2.1.41
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 +9 -5
- package/dist/index.mjs +150 -89
- 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;
|
|
@@ -2168,6 +2168,8 @@ interface ImageInputProps extends BaseProps {
|
|
|
2168
2168
|
icon?: InputIcon;
|
|
2169
2169
|
showIcon?: boolean;
|
|
2170
2170
|
uploadIcon?: React.ReactNode;
|
|
2171
|
+
/** Class applied to the component's outer layout container. */
|
|
2172
|
+
containerClassName?: string;
|
|
2171
2173
|
previewClassName?: string;
|
|
2172
2174
|
/** Inline styles applied to the preview container. */
|
|
2173
2175
|
previewStyle?: CSSProperties;
|
|
@@ -2197,6 +2199,8 @@ interface AvatarInputProps extends ImageInputProps {
|
|
|
2197
2199
|
radius?: AvatarInputRadius;
|
|
2198
2200
|
/** Exact width and height. Numbers are interpreted as pixels. */
|
|
2199
2201
|
size?: number | string;
|
|
2202
|
+
/** Fill the available width and remaining height of the form item. */
|
|
2203
|
+
fill?: boolean;
|
|
2200
2204
|
}
|
|
2201
2205
|
interface EmojiInputProps extends BaseProps {
|
|
2202
2206
|
value: number;
|
|
@@ -2294,10 +2298,10 @@ interface NUploaderProps {
|
|
|
2294
2298
|
}
|
|
2295
2299
|
declare function NUploader({ title, subtitle, accept, multiple, disabled, items, listTitle, className, dropzoneClassName, onFilesSelected, onCancel, onRemove, }: NUploaderProps): react_jsx_runtime.JSX.Element;
|
|
2296
2300
|
|
|
2297
|
-
declare function ImageInput({ value, onChange, previewClassName, previewStyle, contentClassName, showPreview, previewPosition, allowClear, accept, defaultImage, imageSize, imageVersion, disabled, uploadIcon, title, subtitle, titleClassName, subtitleClassName, replaceTitle, replaceSubtitle, trigger, buttonLabel, }: ImageInputProps): react_jsx_runtime.JSX.Element;
|
|
2301
|
+
declare function ImageInput({ value, onChange, containerClassName, previewClassName, previewStyle, contentClassName, showPreview, previewPosition, allowClear, accept, defaultImage, imageSize, imageVersion, disabled, uploadIcon, title, subtitle, titleClassName, subtitleClassName, replaceTitle, replaceSubtitle, trigger, buttonLabel, }: ImageInputProps): react_jsx_runtime.JSX.Element;
|
|
2298
2302
|
|
|
2299
2303
|
/** A circular image picker preset for profile photos and user avatars. */
|
|
2300
|
-
declare function AvatarInput({ imageSize, size, radius, previewClassName, previewStyle, contentClassName, uploadIcon, title, subtitleClassName, trigger, ...props }: AvatarInputProps): react_jsx_runtime.JSX.Element;
|
|
2304
|
+
declare function AvatarInput({ imageSize, size, fill, radius, containerClassName, previewClassName, previewStyle, contentClassName, uploadIcon, title, subtitleClassName, trigger, ...props }: AvatarInputProps): react_jsx_runtime.JSX.Element;
|
|
2301
2305
|
|
|
2302
2306
|
declare const StarRatingInput: React__default.FC<StarRatingInputProps>;
|
|
2303
2307
|
|
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,84 @@ 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
|
+
return () => instance.destroy();
|
|
2022
|
+
}, [axis, autoHide, options]);
|
|
2023
|
+
return { hostRef, viewportRef };
|
|
2024
|
+
}
|
|
2025
|
+
function NajmScroll({ className, axis = "y", autoHide = "never", viewportRef, events, options, element, children, style, ...props }) {
|
|
2026
|
+
return /* @__PURE__ */ jsx(
|
|
2027
|
+
OverlayScrollbarsComponent,
|
|
2028
|
+
{
|
|
2029
|
+
className: cn(className),
|
|
2030
|
+
style: {
|
|
2031
|
+
...style,
|
|
2032
|
+
overflow: "hidden",
|
|
2033
|
+
minHeight: 0,
|
|
2034
|
+
minWidth: 0
|
|
2035
|
+
},
|
|
2036
|
+
element,
|
|
2037
|
+
defer: true,
|
|
2038
|
+
options: najmScrollOptions(axis, autoHide, options || void 0),
|
|
2039
|
+
events: {
|
|
2040
|
+
...events,
|
|
2041
|
+
initialized: (instance, ...rest) => {
|
|
2042
|
+
const viewport = instance.elements().viewport;
|
|
2043
|
+
applyViewportLayout(viewport, axis);
|
|
2044
|
+
assignRef(viewportRef, viewport);
|
|
2045
|
+
events?.initialized?.(instance, ...rest);
|
|
2046
|
+
},
|
|
2047
|
+
updated: (instance, ...rest) => {
|
|
2048
|
+
applyViewportLayout(instance.elements().viewport, axis);
|
|
2049
|
+
events?.updated?.(instance, ...rest);
|
|
2050
|
+
},
|
|
2051
|
+
destroyed: (instance, ...rest) => {
|
|
2052
|
+
assignRef(viewportRef, null);
|
|
2053
|
+
events?.destroyed?.(instance, ...rest);
|
|
2054
|
+
}
|
|
2055
|
+
},
|
|
2056
|
+
...props,
|
|
2057
|
+
children
|
|
2058
|
+
}
|
|
2059
|
+
);
|
|
2060
|
+
}
|
|
1982
2061
|
function Select({ ...props }) {
|
|
1983
2062
|
return /* @__PURE__ */ jsx(SelectPrimitive.Root, { "data-slot": "select", ...props });
|
|
1984
2063
|
}
|
|
@@ -2025,10 +2104,12 @@ function SelectContent({ className, children, position = "popper", style, ...pro
|
|
|
2025
2104
|
borderColor: "var(--border)"
|
|
2026
2105
|
} : {}
|
|
2027
2106
|
};
|
|
2107
|
+
const { hostRef, viewportRef } = useNajmScrollViewport();
|
|
2028
2108
|
useNajmPortalLayerStyles();
|
|
2029
|
-
return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { container: container ?? void 0, children: /* @__PURE__ */
|
|
2109
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsx(
|
|
2030
2110
|
SelectPrimitive.Content,
|
|
2031
2111
|
{
|
|
2112
|
+
ref: hostRef,
|
|
2032
2113
|
"data-slot": "select-content",
|
|
2033
2114
|
className: cn(
|
|
2034
2115
|
"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 +2120,17 @@ function SelectContent({ className, children, position = "popper", style, ...pro
|
|
|
2039
2120
|
style: { ...recipeStyle, ...style },
|
|
2040
2121
|
position,
|
|
2041
2122
|
...props,
|
|
2042
|
-
children:
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2123
|
+
children: /* @__PURE__ */ jsx(
|
|
2124
|
+
SelectPrimitive.Viewport,
|
|
2125
|
+
{
|
|
2126
|
+
ref: viewportRef,
|
|
2127
|
+
className: cn(
|
|
2128
|
+
"max-h-[var(--radix-select-content-available-height)] overflow-x-hidden",
|
|
2129
|
+
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
2130
|
+
),
|
|
2131
|
+
children: /* @__PURE__ */ jsx("div", { className: "p-1", children })
|
|
2132
|
+
}
|
|
2133
|
+
)
|
|
2047
2134
|
}
|
|
2048
2135
|
) });
|
|
2049
2136
|
}
|
|
@@ -4452,62 +4539,6 @@ function SheetTitle({ className, ...props }) {
|
|
|
4452
4539
|
function SheetDescription({ className, ...props }) {
|
|
4453
4540
|
return /* @__PURE__ */ jsx(SheetPrimitive.Description, { "data-slot": "sheet-description", className: cn("text-muted-foreground text-sm", className), ...props });
|
|
4454
4541
|
}
|
|
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
4542
|
var PortalScopeContext = createContext(void 0);
|
|
4512
4543
|
function NPortalScopeProvider({ className, children }) {
|
|
4513
4544
|
return /* @__PURE__ */ jsx(PortalScopeContext.Provider, { value: className, children });
|
|
@@ -5941,39 +5972,45 @@ function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
|
5941
5972
|
}
|
|
5942
5973
|
);
|
|
5943
5974
|
}
|
|
5944
|
-
function DropdownMenuSubContent({ className, style, ...props }) {
|
|
5975
|
+
function DropdownMenuSubContent({ className, children, style, ...props }) {
|
|
5945
5976
|
const surface = useDropdownSurfaceRecipe("subContent");
|
|
5977
|
+
const { hostRef, viewportRef } = useNajmScrollViewport();
|
|
5946
5978
|
useNajmPortalLayerStyles();
|
|
5947
5979
|
return /* @__PURE__ */ jsx(
|
|
5948
5980
|
DropdownMenuPrimitive.SubContent,
|
|
5949
5981
|
{
|
|
5982
|
+
ref: hostRef,
|
|
5950
5983
|
"data-slot": "dropdown-menu-sub-content",
|
|
5951
5984
|
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
|
|
5985
|
+
"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
5986
|
surface.className,
|
|
5954
5987
|
className
|
|
5955
5988
|
),
|
|
5956
5989
|
style: { ...surface.style, ...style },
|
|
5957
|
-
...props
|
|
5990
|
+
...props,
|
|
5991
|
+
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
5992
|
}
|
|
5959
5993
|
);
|
|
5960
5994
|
}
|
|
5961
|
-
function DropdownMenuContent({ className, sideOffset = 4, style, ...props }) {
|
|
5995
|
+
function DropdownMenuContent({ className, children, sideOffset = 4, style, ...props }) {
|
|
5962
5996
|
const container = React.useContext(NajmThemeContainerCtx);
|
|
5963
5997
|
const surface = useDropdownSurfaceRecipe("content");
|
|
5998
|
+
const { hostRef, viewportRef } = useNajmScrollViewport();
|
|
5964
5999
|
useNajmPortalLayerStyles();
|
|
5965
6000
|
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsx(
|
|
5966
6001
|
DropdownMenuPrimitive.Content,
|
|
5967
6002
|
{
|
|
6003
|
+
ref: hostRef,
|
|
5968
6004
|
"data-slot": "dropdown-menu-content",
|
|
5969
6005
|
sideOffset,
|
|
5970
6006
|
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
|
|
6007
|
+
"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
6008
|
surface.className,
|
|
5973
6009
|
className
|
|
5974
6010
|
),
|
|
5975
6011
|
style: { ...surface.style, ...style },
|
|
5976
|
-
...props
|
|
6012
|
+
...props,
|
|
6013
|
+
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
6014
|
}
|
|
5978
6015
|
) });
|
|
5979
6016
|
}
|
|
@@ -6630,8 +6667,18 @@ function CommandInput({ className, ...props }) {
|
|
|
6630
6667
|
)
|
|
6631
6668
|
] });
|
|
6632
6669
|
}
|
|
6633
|
-
function CommandList({ className, ...props }) {
|
|
6634
|
-
|
|
6670
|
+
function CommandList({ className, children, ...props }) {
|
|
6671
|
+
const { hostRef, viewportRef } = useNajmScrollViewport();
|
|
6672
|
+
return /* @__PURE__ */ jsx(
|
|
6673
|
+
Command$1.List,
|
|
6674
|
+
{
|
|
6675
|
+
ref: hostRef,
|
|
6676
|
+
"data-slot": "command-list",
|
|
6677
|
+
className: cn("max-h-[300px] overflow-hidden", className),
|
|
6678
|
+
...props,
|
|
6679
|
+
children: /* @__PURE__ */ jsx("div", { ref: viewportRef, "data-slot": "command-list-viewport", className: "max-h-[300px] overflow-x-hidden", children })
|
|
6680
|
+
}
|
|
6681
|
+
);
|
|
6635
6682
|
}
|
|
6636
6683
|
function CommandEmpty({ ...props }) {
|
|
6637
6684
|
return /* @__PURE__ */ jsx(Command$1.Empty, { "data-slot": "command-empty", className: "py-6 text-center text-sm", ...props });
|
|
@@ -8735,7 +8782,7 @@ function FloatingSelectSegment({
|
|
|
8735
8782
|
]
|
|
8736
8783
|
}
|
|
8737
8784
|
),
|
|
8738
|
-
/* @__PURE__ */ jsx(DropdownMenuContent, { side: "top", align: "center", className: "max-h-72
|
|
8785
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { side: "top", align: "center", className: "max-h-72", children: action.options.map((o) => /* @__PURE__ */ jsx(
|
|
8739
8786
|
DropdownMenuItem,
|
|
8740
8787
|
{
|
|
8741
8788
|
onSelect: () => void onAction(action.id, o.value),
|
|
@@ -9181,16 +9228,18 @@ var MultiSelectInput = ({ placeholder = "Select items...", value = [], onChange,
|
|
|
9181
9228
|
},
|
|
9182
9229
|
children: /* @__PURE__ */ jsxs(Command, { children: [
|
|
9183
9230
|
showSearch && /* @__PURE__ */ jsx(CommandInput, { placeholder: searchPlaceholder, className: "h-9" }),
|
|
9184
|
-
/* @__PURE__ */
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
/* @__PURE__ */
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9231
|
+
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
9232
|
+
/* @__PURE__ */ jsx(CommandEmpty, { children: emptyMessage }),
|
|
9233
|
+
/* @__PURE__ */ jsx(CommandGroup, { children: items.map((item) => {
|
|
9234
|
+
const itemValue = typeof item === "string" ? item : item.value;
|
|
9235
|
+
const itemLabel = typeof item === "string" ? item : item.label;
|
|
9236
|
+
const isSelected = value.includes(itemValue);
|
|
9237
|
+
return /* @__PURE__ */ jsxs(CommandItem, { onSelect: () => handleSelect(itemValue), className: "flex items-center gap-2 cursor-pointer", children: [
|
|
9238
|
+
/* @__PURE__ */ jsx(Checkbox, { checked: isSelected, onCheckedChange: () => handleSelect(itemValue), className: "pointer-events-none" }),
|
|
9239
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1", children: itemLabel })
|
|
9240
|
+
] }, itemValue);
|
|
9241
|
+
}) })
|
|
9242
|
+
] })
|
|
9194
9243
|
] })
|
|
9195
9244
|
}
|
|
9196
9245
|
)
|
|
@@ -9494,6 +9543,7 @@ var IMAGE_SIZE_MAP = {
|
|
|
9494
9543
|
function ImageInput({
|
|
9495
9544
|
value,
|
|
9496
9545
|
onChange,
|
|
9546
|
+
containerClassName,
|
|
9497
9547
|
previewClassName,
|
|
9498
9548
|
previewStyle,
|
|
9499
9549
|
contentClassName,
|
|
@@ -9645,12 +9695,12 @@ function ImageInput({
|
|
|
9645
9695
|
);
|
|
9646
9696
|
if (!showPreview) return renderFileInput();
|
|
9647
9697
|
if (previewPosition === "left" || previewPosition === "right") {
|
|
9648
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-4", previewPosition === "right" && "flex-row-reverse"), children: [
|
|
9698
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-4", previewPosition === "right" && "flex-row-reverse", containerClassName), children: [
|
|
9649
9699
|
renderPreview(),
|
|
9650
9700
|
/* @__PURE__ */ jsx("div", { className: "flex-1", children: renderFileInput() })
|
|
9651
9701
|
] });
|
|
9652
9702
|
}
|
|
9653
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-3", previewPosition === "bottom" && "flex-col-reverse"), children: [
|
|
9703
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-3", previewPosition === "bottom" && "flex-col-reverse", containerClassName), children: [
|
|
9654
9704
|
renderPreview(),
|
|
9655
9705
|
renderFileInput()
|
|
9656
9706
|
] });
|
|
@@ -9673,7 +9723,9 @@ var AVATAR_RADIUS_MAP = {
|
|
|
9673
9723
|
function AvatarInput({
|
|
9674
9724
|
imageSize = "md",
|
|
9675
9725
|
size,
|
|
9726
|
+
fill = false,
|
|
9676
9727
|
radius = "full",
|
|
9728
|
+
containerClassName,
|
|
9677
9729
|
previewClassName,
|
|
9678
9730
|
previewStyle,
|
|
9679
9731
|
contentClassName,
|
|
@@ -9688,15 +9740,19 @@ function AvatarInput({
|
|
|
9688
9740
|
{
|
|
9689
9741
|
...props,
|
|
9690
9742
|
imageSize,
|
|
9743
|
+
containerClassName: cn(
|
|
9744
|
+
fill && "min-h-24 w-full flex-1",
|
|
9745
|
+
containerClassName
|
|
9746
|
+
),
|
|
9691
9747
|
previewClassName: cn(
|
|
9692
|
-
AVATAR_SIZE_MAP[imageSize],
|
|
9748
|
+
fill ? "size-full min-h-0" : AVATAR_SIZE_MAP[imageSize],
|
|
9693
9749
|
"shrink-0",
|
|
9694
9750
|
AVATAR_RADIUS_MAP[radius],
|
|
9695
9751
|
previewClassName
|
|
9696
9752
|
),
|
|
9697
9753
|
previewStyle: {
|
|
9698
9754
|
...previewStyle,
|
|
9699
|
-
...size != null ? { width: size, height: size } : null
|
|
9755
|
+
...size != null && !fill ? { width: size, height: size } : null
|
|
9700
9756
|
},
|
|
9701
9757
|
contentClassName: cn("gap-1 p-2", contentClassName),
|
|
9702
9758
|
uploadIcon: uploadIcon ?? /* @__PURE__ */ jsx(Camera, { className: "size-6" }),
|
|
@@ -10421,7 +10477,7 @@ function Combobox({
|
|
|
10421
10477
|
}
|
|
10422
10478
|
)
|
|
10423
10479
|
] }),
|
|
10424
|
-
/* @__PURE__ */ jsx(
|
|
10480
|
+
/* @__PURE__ */ jsx(NajmScroll, { className: "max-h-64", 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(
|
|
10425
10481
|
"button",
|
|
10426
10482
|
{
|
|
10427
10483
|
type: "button",
|
|
@@ -10438,7 +10494,7 @@ function Combobox({
|
|
|
10438
10494
|
]
|
|
10439
10495
|
},
|
|
10440
10496
|
opt.value
|
|
10441
|
-
)) })
|
|
10497
|
+
)) }) })
|
|
10442
10498
|
] })
|
|
10443
10499
|
] });
|
|
10444
10500
|
}
|
|
@@ -10584,8 +10640,13 @@ var FormInput = ({ name, type, formLabel, formDescription, required = false, dis
|
|
|
10584
10640
|
return "";
|
|
10585
10641
|
};
|
|
10586
10642
|
const presetInput = type === "textarea" ? preset.input?.replace(/\bh-\d+\b/g, "").trim() : preset.input;
|
|
10643
|
+
const isFillAvatar = type === "avatar" && inputRest.fill === true;
|
|
10587
10644
|
const slot = {
|
|
10588
|
-
item: cn(
|
|
10645
|
+
item: cn(
|
|
10646
|
+
preset.item,
|
|
10647
|
+
isFillAvatar && "flex h-full min-h-0 w-full flex-col",
|
|
10648
|
+
classNames?.item
|
|
10649
|
+
),
|
|
10589
10650
|
label: cn(preset.label, classNames?.label),
|
|
10590
10651
|
input: cn(presetInput, background && inputBackgroundClasses[background], classNames?.input, className),
|
|
10591
10652
|
description: cn(preset.description, classNames?.description),
|
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) => {
|