najm-kit 2.1.26 → 2.1.28
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 +1 -1
- package/dist/index.mjs +34 -11
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -457,7 +457,7 @@ declare function DialogClose({ ...props }: React$1.ComponentProps<typeof DialogP
|
|
|
457
457
|
declare function DialogOverlay({ className, ...props }: React$1.ComponentProps<typeof DialogPrimitive.Overlay>): react_jsx_runtime.JSX.Element;
|
|
458
458
|
type DialogPadding = "none" | "sm" | "md" | "lg";
|
|
459
459
|
interface DialogContentProps extends React$1.ComponentProps<typeof DialogPrimitive.Content> {
|
|
460
|
-
/** Controls the padding of the dialog surface. `none` also collapses the header/body/footer gap. Defaults to `md`
|
|
460
|
+
/** Controls the padding of the dialog surface. `none` also collapses the header/body/footer gap. Defaults to `sm` on mobile, `md` on desktop. */
|
|
461
461
|
padding?: DialogPadding;
|
|
462
462
|
/** Hides the built-in top-right close (X). Use when the content provides its own close control (e.g. inside a page header). */
|
|
463
463
|
hideClose?: boolean;
|
package/dist/index.mjs
CHANGED
|
@@ -1913,7 +1913,29 @@ var dialogPaddingMap = {
|
|
|
1913
1913
|
md: "p-6",
|
|
1914
1914
|
lg: "p-8"
|
|
1915
1915
|
};
|
|
1916
|
-
|
|
1916
|
+
var MOBILE_PADDING_QUERY = "(max-width: 639.98px)";
|
|
1917
|
+
function getDefaultPadding() {
|
|
1918
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return "md";
|
|
1919
|
+
return window.matchMedia(MOBILE_PADDING_QUERY).matches ? "sm" : "md";
|
|
1920
|
+
}
|
|
1921
|
+
function useResponsivePadding(value) {
|
|
1922
|
+
const [resolved, setResolved] = React.useState(() => value ?? getDefaultPadding());
|
|
1923
|
+
React.useEffect(() => {
|
|
1924
|
+
if (value) {
|
|
1925
|
+
setResolved(value);
|
|
1926
|
+
return;
|
|
1927
|
+
}
|
|
1928
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
1929
|
+
const mql = window.matchMedia(MOBILE_PADDING_QUERY);
|
|
1930
|
+
const update = () => setResolved(mql.matches ? "sm" : "md");
|
|
1931
|
+
update();
|
|
1932
|
+
mql.addEventListener("change", update);
|
|
1933
|
+
return () => mql.removeEventListener("change", update);
|
|
1934
|
+
}, [value]);
|
|
1935
|
+
return resolved;
|
|
1936
|
+
}
|
|
1937
|
+
function DialogContent({ className, children, padding, hideClose = false, ...props }) {
|
|
1938
|
+
const resolvedPadding = useResponsivePadding(padding);
|
|
1917
1939
|
const portalClassName = useNPortalScope();
|
|
1918
1940
|
return /* @__PURE__ */ jsx(DialogPortal, { "data-slot": "dialog-portal", children: /* @__PURE__ */ jsxs("div", { className: portalClassName, children: [
|
|
1919
1941
|
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
@@ -1921,10 +1943,10 @@ function DialogContent({ className, children, padding = "md", hideClose = false,
|
|
|
1921
1943
|
SheetPrimitive.Content,
|
|
1922
1944
|
{
|
|
1923
1945
|
"data-slot": "dialog-content",
|
|
1924
|
-
"data-padding":
|
|
1946
|
+
"data-padding": resolvedPadding,
|
|
1925
1947
|
className: cn(
|
|
1926
|
-
"bg-card text-card-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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-sm translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg najm-border border-border shadow-lg duration-200",
|
|
1927
|
-
dialogPaddingMap[
|
|
1948
|
+
"bg-card text-card-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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-sm translate-x-[-50%] translate-y-[-50%] gap-4 rounded-none lg:rounded-lg najm-border border-border shadow-lg duration-200",
|
|
1949
|
+
dialogPaddingMap[resolvedPadding],
|
|
1928
1950
|
className
|
|
1929
1951
|
),
|
|
1930
1952
|
...props,
|
|
@@ -2444,12 +2466,12 @@ function parseDirectDialogSlots(children) {
|
|
|
2444
2466
|
return { ...parsed, body };
|
|
2445
2467
|
}
|
|
2446
2468
|
var dialogVariants = cva(
|
|
2447
|
-
"flex flex-col w-full max-w-
|
|
2469
|
+
"flex flex-col w-full max-w-full h-full max-h-screen",
|
|
2448
2470
|
{
|
|
2449
2471
|
variants: {
|
|
2450
2472
|
variant: {
|
|
2451
2473
|
default: "",
|
|
2452
|
-
window: "rounded-sm"
|
|
2474
|
+
window: "rounded-none lg:rounded-sm"
|
|
2453
2475
|
},
|
|
2454
2476
|
size: {
|
|
2455
2477
|
sm: "lg:max-w-md",
|
|
@@ -2546,10 +2568,11 @@ function DialogChrome({
|
|
|
2546
2568
|
contentRef,
|
|
2547
2569
|
children
|
|
2548
2570
|
}) {
|
|
2571
|
+
const resolvedPadding = useResponsivePadding(padding);
|
|
2549
2572
|
const noTitle = !title || title.trim() === "";
|
|
2550
2573
|
const noDescription = !description || description.trim() === "";
|
|
2551
2574
|
const noHeader = noTitle && noDescription;
|
|
2552
|
-
const flush =
|
|
2575
|
+
const flush = resolvedPadding === "none";
|
|
2553
2576
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2554
2577
|
pageHeader ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2555
2578
|
/* @__PURE__ */ jsx(DialogTitle, { className: cn("sr-only", titleClassName), children: pageHeader.title || title || "Dialog" }),
|
|
@@ -2570,7 +2593,7 @@ function DialogChrome({
|
|
|
2570
2593
|
{
|
|
2571
2594
|
className: cn(
|
|
2572
2595
|
"flex-row items-center justify-between gap-3 border-b border-border bg-secondary text-left text-secondary-foreground",
|
|
2573
|
-
windowHeaderSpacing[
|
|
2596
|
+
windowHeaderSpacing[resolvedPadding],
|
|
2574
2597
|
headerClassName
|
|
2575
2598
|
),
|
|
2576
2599
|
children: [
|
|
@@ -5856,7 +5879,7 @@ function NDonutCard({
|
|
|
5856
5879
|
iconColor,
|
|
5857
5880
|
bordered: true,
|
|
5858
5881
|
className: cn(className, classNames?.root),
|
|
5859
|
-
classNames: { content: "
|
|
5882
|
+
classNames: { content: "p-0" },
|
|
5860
5883
|
children: [
|
|
5861
5884
|
/* @__PURE__ */ jsxs(
|
|
5862
5885
|
"div",
|
|
@@ -5867,7 +5890,7 @@ function NDonutCard({
|
|
|
5867
5890
|
role: "group",
|
|
5868
5891
|
"aria-label": accessibleLabel,
|
|
5869
5892
|
className: cn(
|
|
5870
|
-
isHorizontal ? "grid grid-cols-
|
|
5893
|
+
isHorizontal ? "grid grid-cols-[auto_minmax(0,1fr)] items-center gap-5 p-2 lg:p-3 xl:p-4 2xl:p-5" : cn(
|
|
5871
5894
|
"flex flex-col items-center p-2 lg:p-3 xl:p-4 2xl:p-5",
|
|
5872
5895
|
isCompact ? "gap-2" : "gap-4"
|
|
5873
5896
|
),
|
|
@@ -5969,7 +5992,7 @@ function NDonutCard({
|
|
|
5969
5992
|
className: cn(
|
|
5970
5993
|
"flex flex-col gap-1.5 w-full",
|
|
5971
5994
|
isCompact && "gap-1",
|
|
5972
|
-
isHorizontal && "min-w-0 flex-1 gap-2 pt-0.5
|
|
5995
|
+
isHorizontal && "min-w-0 flex-1 gap-2 pt-0.5",
|
|
5973
5996
|
classNames?.legend
|
|
5974
5997
|
),
|
|
5975
5998
|
children: normalized.map((item) => /* @__PURE__ */ jsx(
|