@jbpark/ui-kit 4.0.0 → 4.1.0
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/atoms/float-button/back-top.mjs +1 -1
- package/dist/components/atoms/input/search.mjs +1 -1
- package/dist/components/atoms/skeleton/skeleton.mjs +1 -1
- package/dist/components/atoms/spin.mjs +1 -1
- package/dist/components/organisms/drawer.mjs +1 -1
- package/dist/components/templates/layout/sider.mjs +1 -1
- package/dist/core/badge.d.mts +1 -1
- package/dist/core/button.d.mts +1 -1
- package/dist/core/dialog.d.mts.map +1 -1
- package/dist/core/dialog.mjs +4 -1
- package/dist/core/dialog.mjs.map +1 -1
- package/dist/core/drawer.d.mts +1 -0
- package/dist/core/drawer.d.mts.map +1 -1
- package/dist/core/drawer.mjs +4 -1
- package/dist/core/drawer.mjs.map +1 -1
- package/dist/core/popover.d.mts +4 -1
- package/dist/core/popover.d.mts.map +1 -1
- package/dist/core/popover.mjs +13 -8
- package/dist/core/popover.mjs.map +1 -1
- package/dist/core/select.d.mts +4 -1
- package/dist/core/select.d.mts.map +1 -1
- package/dist/core/select.mjs +21 -16
- package/dist/core/select.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/providers/{Config/index.d.mts → config/config.d.mts} +4 -2
- package/dist/providers/config/config.d.mts.map +1 -0
- package/dist/providers/{Config/index.mjs → config/config.mjs} +25 -8
- package/dist/providers/config/config.mjs.map +1 -0
- package/dist/providers/{Config → config}/context.d.mts +1 -1
- package/dist/providers/config/context.d.mts.map +1 -0
- package/dist/providers/{Config → config}/context.mjs +3 -2
- package/dist/providers/{Config → config}/context.mjs.map +1 -1
- package/dist/providers/config/index.d.mts +3 -0
- package/dist/providers/{Config → config}/types.d.mts +2 -1
- package/dist/providers/{Config → config}/types.d.mts.map +1 -1
- package/dist/providers.d.mts +4 -3
- package/dist/providers.mjs +2 -2
- package/package.json +1 -1
- package/dist/providers/Config/context.d.mts.map +0 -1
- package/dist/providers/Config/index.d.mts.map +0 -1
- package/dist/providers/Config/index.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { cn } from "../../../utils.mjs";
|
|
4
|
-
import { DEFAULT_LOCALE, useConfig } from "../../../providers/
|
|
4
|
+
import { DEFAULT_LOCALE, useConfig } from "../../../providers/config/context.mjs";
|
|
5
5
|
import FloatButton from "./float-button.mjs";
|
|
6
6
|
import { ArrowUp } from "lucide-react";
|
|
7
7
|
import { useRef } from "react";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { cn } from "../../../utils.mjs";
|
|
4
|
+
import { DEFAULT_LOCALE, useConfig } from "../../../providers/config/context.mjs";
|
|
4
5
|
import { input_exports } from "../../../core/input.mjs";
|
|
5
6
|
import Button from "../../../Button.mjs";
|
|
6
|
-
import { DEFAULT_LOCALE, useConfig } from "../../../providers/Config/context.mjs";
|
|
7
7
|
import { CircleX, Search } from "lucide-react";
|
|
8
8
|
import { useRef, useState } from "react";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { cn } from "../../../utils.mjs";
|
|
4
|
+
import { DEFAULT_LOCALE, useConfig } from "../../../providers/config/context.mjs";
|
|
4
5
|
import { skeleton_exports } from "../../../core/skeleton.mjs";
|
|
5
|
-
import { DEFAULT_LOCALE, useConfig } from "../../../providers/Config/context.mjs";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
|
|
8
8
|
//#region src/components/atoms/skeleton/skeleton.tsx
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { cn } from "../../utils.mjs";
|
|
4
|
-
import { DEFAULT_LOCALE, useConfig } from "../../providers/
|
|
4
|
+
import { DEFAULT_LOCALE, useConfig } from "../../providers/config/context.mjs";
|
|
5
5
|
import { Loader2 } from "lucide-react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { cn, renderConditional } from "../../utils.mjs";
|
|
4
|
+
import { DEFAULT_LOCALE, useConfig } from "../../providers/config/context.mjs";
|
|
4
5
|
import { drawer_exports } from "../../core/drawer.mjs";
|
|
5
6
|
import Button from "../../Button.mjs";
|
|
6
|
-
import { DEFAULT_LOCALE, useConfig } from "../../providers/Config/context.mjs";
|
|
7
7
|
import { X } from "lucide-react";
|
|
8
8
|
import { useEffect } from "react";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { cn } from "../../../utils.mjs";
|
|
4
|
-
import { DEFAULT_LOCALE, useConfig } from "../../../providers/
|
|
4
|
+
import { DEFAULT_LOCALE, useConfig } from "../../../providers/config/context.mjs";
|
|
5
5
|
import { useRegisterSider } from "./sider-context.mjs";
|
|
6
6
|
import { PanelLeftClose, PanelLeftOpen } from "lucide-react";
|
|
7
7
|
import { useId, useLayoutEffect } from "react";
|
package/dist/core/badge.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ declare namespace badge_d_exports {
|
|
|
8
8
|
export { Badge, Props, badgeVariants };
|
|
9
9
|
}
|
|
10
10
|
declare const badgeVariants: (props?: ({
|
|
11
|
-
variant?: "
|
|
11
|
+
variant?: "outline" | "default" | "destructive" | "secondary" | null | undefined;
|
|
12
12
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
13
13
|
type Props = React$1.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & {
|
|
14
14
|
asChild?: boolean;
|
package/dist/core/button.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ declare namespace button_d_exports {
|
|
|
8
8
|
export { Button, Props, buttonVariants };
|
|
9
9
|
}
|
|
10
10
|
declare const buttonVariants: (props?: ({
|
|
11
|
-
variant?: "link" | "
|
|
11
|
+
variant?: "link" | "outline" | "default" | "destructive" | "secondary" | "ghost" | null | undefined;
|
|
12
12
|
size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
13
13
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
14
14
|
type Props = React$1.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.mts","names":[],"sources":["../../src/core/dialog.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"dialog.d.mts","names":[],"sources":["../../src/core/dialog.tsx"],"mappings":";;;;;;;;iBAYS,MAAA,CAAA;EAAA,GACJ;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,eAAA,CAAgB,IAAA,IAAK,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI3C,aAAA,CAAA;EAAA,GACJ;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,eAAA,CAAgB,OAAA,IAAQ,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI9C,YAAA,CAAA;EAAA,GACJ;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,eAAA,CAAgB,MAAA,IAAO,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI7C,WAAA,CAAA;EAAA,GACJ;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,eAAA,CAAgB,KAAA,IAAM,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI5C,aAAA,CAAA;EACP,SAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,eAAA,CAAgB,OAAA,IAAQ,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,UAe7C,kBAAA;EACR,UAAA,GAAa,MAAA;EACb,SAAA,GAAY,OAAA,CAAM,SAAA;EAClB,QAAA;IAAuB,QAAA;EAAA;EACvB,SAAA,GAAY,WAAA;AAAA;AAAA,iBAGL,aAAA,CAAA;EACP,SAAA;EACA,QAAA;EACA,UAAA;EACA,SAAA,EAAW,UAAA;EACX,QAAA;EACA,SAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,eAAA,CAAgB,OAAA,IAAW,kBAAA,GAAkB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBA4CnE,YAAA,CAAA;EAAe,SAAA;EAAA,GAAc;AAAA,GAAS,OAAA,CAAM,cAAA,UAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAUjE,YAAA,CAAA;EACP,SAAA;EACA,eAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA;EACP,eAAA;AAAA,IACD,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAoBQ,WAAA,CAAA;EACP,SAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,eAAA,CAAgB,KAAA,IAAM,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAU5C,iBAAA,CAAA;EACP,SAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,eAAA,CAAgB,WAAA,IAAY,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/core/dialog.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
4
4
|
import { cn } from "../utils.mjs";
|
|
5
|
+
import { useConfig } from "../providers/config/context.mjs";
|
|
5
6
|
import Button from "../Button.mjs";
|
|
6
7
|
import { XIcon } from "lucide-react";
|
|
7
8
|
import "react";
|
|
@@ -55,6 +56,8 @@ function DialogOverlay({ className, ...props }) {
|
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
function DialogContent({ className, children, classNames, closeIcon: _closeIcon, closable, container, ...props }) {
|
|
59
|
+
const { getContainer } = useConfig();
|
|
60
|
+
const resolvedContainer = container ?? getContainer();
|
|
58
61
|
const closeIcon = /* @__PURE__ */ jsxs(DialogPrimitive.Close, {
|
|
59
62
|
"data-slot": "dialog-close",
|
|
60
63
|
className: "ring-offset-background focus:ring-ring\n data-[state=open]:bg-accent data-[state=open]:text-muted-foreground\n absolute top-4 right-4 rounded-xs opacity-70 transition-opacity\n hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden\n disabled:pointer-events-none [&_svg]:pointer-events-none\n [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
@@ -66,7 +69,7 @@ function DialogContent({ className, children, classNames, closeIcon: _closeIcon,
|
|
|
66
69
|
});
|
|
67
70
|
return /* @__PURE__ */ jsxs(DialogPortal, {
|
|
68
71
|
"data-slot": "dialog-portal",
|
|
69
|
-
container,
|
|
72
|
+
container: resolvedContainer,
|
|
70
73
|
children: [/* @__PURE__ */ jsx(DialogOverlay, { className: cn(classNames?.mask) }), /* @__PURE__ */ jsxs(DialogPrimitive.Content, {
|
|
71
74
|
"data-slot": "dialog-content",
|
|
72
75
|
className: cn(`bg-background data-[state=open]:animate-in
|
package/dist/core/dialog.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.mjs","names":[],"sources":["../../src/core/dialog.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { XIcon } from 'lucide-react';\n\nimport { cn } from '@repo/ui/utils';\n\nimport Button from '../components/atoms/button';\n\nfunction Dialog({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />;\n}\n\nfunction DialogTrigger({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nfunction DialogPortal({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\n}\n\nfunction DialogClose({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n `data-[state=open]:animate-in data-[state=closed]:animate-out\n data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0\n z-50 bg-black/50`,\n className,\n )}\n {...props}\n />\n );\n}\n\ninterface CustomContentProps {\n classNames?: Record<string, string>;\n closeIcon?: React.ReactNode;\n closable?: boolean | { disabled?: boolean };\n container?: HTMLElement;\n}\n\nfunction DialogContent({\n className,\n children,\n classNames,\n closeIcon: _closeIcon,\n closable,\n container,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & CustomContentProps) {\n const closeIcon = (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className=\"ring-offset-background focus:ring-ring\n data-[state=open]:bg-accent data-[state=open]:text-muted-foreground\n absolute top-4 right-4 rounded-xs opacity-70 transition-opacity\n hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden\n disabled:pointer-events-none [&_svg]:pointer-events-none\n [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\"\n disabled={typeof closable === 'object' && closable.disabled}\n >\n {_closeIcon || <XIcon />}\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n );\n\n return (\n <DialogPortal data-slot=\"dialog-portal\" container={
|
|
1
|
+
{"version":3,"file":"dialog.mjs","names":[],"sources":["../../src/core/dialog.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { XIcon } from 'lucide-react';\n\nimport { useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nimport Button from '../components/atoms/button';\n\nfunction Dialog({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />;\n}\n\nfunction DialogTrigger({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nfunction DialogPortal({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\n}\n\nfunction DialogClose({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n `data-[state=open]:animate-in data-[state=closed]:animate-out\n data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0\n z-50 bg-black/50`,\n className,\n )}\n {...props}\n />\n );\n}\n\ninterface CustomContentProps {\n classNames?: Record<string, string>;\n closeIcon?: React.ReactNode;\n closable?: boolean | { disabled?: boolean };\n container?: HTMLElement;\n}\n\nfunction DialogContent({\n className,\n children,\n classNames,\n closeIcon: _closeIcon,\n closable,\n container,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & CustomContentProps) {\n const { getContainer } = useConfig();\n const resolvedContainer = container ?? getContainer();\n\n const closeIcon = (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className=\"ring-offset-background focus:ring-ring\n data-[state=open]:bg-accent data-[state=open]:text-muted-foreground\n absolute top-4 right-4 rounded-xs opacity-70 transition-opacity\n hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden\n disabled:pointer-events-none [&_svg]:pointer-events-none\n [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\"\n disabled={typeof closable === 'object' && closable.disabled}\n >\n {_closeIcon || <XIcon />}\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n );\n\n return (\n <DialogPortal data-slot=\"dialog-portal\" container={resolvedContainer}>\n <DialogOverlay className={cn(classNames?.mask)} />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n `bg-background data-[state=open]:animate-in\n data-[state=closed]:animate-out data-[state=closed]:fade-out-0\n data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95\n data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid\n w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%]\n gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none\n sm:max-w-lg`,\n className,\n )}\n {...props}\n >\n {children}\n {closable && closeIcon}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn('flex flex-col gap-2 text-center sm:text-left', className)}\n {...props}\n />\n );\n}\n\nfunction DialogFooter({\n className,\n showCloseButton = false,\n children,\n ...props\n}: React.ComponentProps<'div'> & {\n showCloseButton?: boolean;\n}) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',\n className,\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close asChild>\n <Button variant=\"outlined\">Close</Button>\n </DialogPrimitive.Close>\n )}\n </div>\n );\n}\n\nfunction DialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn('text-lg leading-none font-semibold', className)}\n {...props}\n />\n );\n}\n\nfunction DialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn('text-muted-foreground text-sm', className)}\n {...props}\n />\n );\n}\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAYA,SAAS,OAAO,EACd,GAAG,SACiD;AACpD,QAAO,oBAAC,gBAAgB;EAAK,aAAU;EAAS,GAAI;GAAS;;AAG/D,SAAS,cAAc,EACrB,GAAG,SACoD;AACvD,QAAO,oBAAC,gBAAgB;EAAQ,aAAU;EAAiB,GAAI;GAAS;;AAG1E,SAAS,aAAa,EACpB,GAAG,SACmD;AACtD,QAAO,oBAAC,gBAAgB;EAAO,aAAU;EAAgB,GAAI;GAAS;;AAGxE,SAAS,YAAY,EACnB,GAAG,SACkD;AACrD,QAAO,oBAAC,gBAAgB;EAAM,aAAU;EAAe,GAAI;GAAS;;AAGtE,SAAS,cAAc,EACrB,WACA,GAAG,SACoD;AACvD,QACE,oBAAC,gBAAgB;EACf,aAAU;EACV,WAAW,GACT;;2BAGA,UACD;EACD,GAAI;GACJ;;AAWN,SAAS,cAAc,EACrB,WACA,UACA,YACA,WAAW,YACX,UACA,WACA,GAAG,SACyE;CAC5E,MAAM,EAAE,iBAAiB,WAAW;CACpC,MAAM,oBAAoB,aAAa,cAAc;CAErD,MAAM,YACJ,qBAAC,gBAAgB;EACf,aAAU;EACV,WAAU;EAMV,UAAU,OAAO,aAAa,YAAY,SAAS;aAElD,cAAc,oBAAC,UAAQ,EACxB,oBAAC;GAAK,WAAU;aAAU;IAAY;GAChB;AAG1B,QACE,qBAAC;EAAa,aAAU;EAAgB,WAAW;aACjD,oBAAC,iBAAc,WAAW,GAAG,YAAY,KAAK,GAAI,EAClD,qBAAC,gBAAgB;GACf,aAAU;GACV,WAAW,GACT;;;;;;wBAOA,UACD;GACD,GAAI;cAEH,UACA,YAAY;IACW;GACb;;AAInB,SAAS,aAAa,EAAE,WAAW,GAAG,SAAsC;AAC1E,QACE,oBAAC;EACC,aAAU;EACV,WAAW,GAAG,gDAAgD,UAAU;EACxE,GAAI;GACJ;;AAIN,SAAS,aAAa,EACpB,WACA,kBAAkB,OAClB,UACA,GAAG,SAGF;AACD,QACE,qBAAC;EACC,aAAU;EACV,WAAW,GACT,0DACA,UACD;EACD,GAAI;aAEH,UACA,mBACC,oBAAC,gBAAgB;GAAM;aACrB,oBAAC;IAAO,SAAQ;cAAW;KAAc;IACnB;GAEtB;;AAIV,SAAS,YAAY,EACnB,WACA,GAAG,SACkD;AACrD,QACE,oBAAC,gBAAgB;EACf,aAAU;EACV,WAAW,GAAG,sCAAsC,UAAU;EAC9D,GAAI;GACJ;;AAIN,SAAS,kBAAkB,EACzB,WACA,GAAG,SACwD;AAC3D,QACE,oBAAC,gBAAgB;EACf,aAAU;EACV,WAAW,GAAG,iCAAiC,UAAU;EACzD,GAAI;GACJ"}
|
package/dist/core/drawer.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.mts","names":[],"sources":["../../src/core/drawer.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"drawer.d.mts","names":[],"sources":["../../src/core/drawer.tsx"],"mappings":";;;;;;;;UASU,WAAA;EACR,SAAA;AAAA;AAAA,iBAGO,QAAA,CAAA;EACP,SAAA;EACA,SAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,MAAA,CAAgB,IAAA,IAAQ,WAAA,GAAW,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAazD,aAAA,CAAA;EAAA,GACJ;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,MAAA,CAAgB,OAAA,IAAQ,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI9C,YAAA,CAAA;EAAA,GACJ;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,MAAA,CAAgB,MAAA,IAAO,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI7C,WAAA,CAAA;EAAA,GACJ;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,MAAA,CAAgB,KAAA,IAAM,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI5C,aAAA,CAAA;EACP,SAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,MAAA,CAAgB,OAAA,IAAQ,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,UAe7C,kBAAA;EACR,UAAA,GAAa,MAAA;EACb,SAAA;EACA,IAAA;AAAA;AAAA,iBAGO,aAAA,CAAA;EACP,SAAA;EACA,QAAA;EACA,UAAA;EACA,SAAA;EACA,IAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,MAAA,CAAgB,OAAA,IAAW,kBAAA,GAAkB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBA2DnE,YAAA,CAAA;EAAe,SAAA;EAAA,GAAc;AAAA,GAAS,OAAA,CAAM,cAAA,UAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAgBjE,YAAA,CAAA;EAAe,SAAA;EAAA,GAAc;AAAA,GAAS,OAAA,CAAM,cAAA,UAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAUjE,WAAA,CAAA;EACP,SAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,MAAA,CAAgB,KAAA,IAAM,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAU5C,iBAAA,CAAA;EACP,SAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,MAAA,CAAgB,WAAA,IAAY,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/core/drawer.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
4
4
|
import { cn } from "../utils.mjs";
|
|
5
|
+
import { useConfig } from "../providers/config/context.mjs";
|
|
5
6
|
import "react";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import { Drawer } from "vaul";
|
|
@@ -19,10 +20,12 @@ var drawer_exports = /* @__PURE__ */ __exportAll({
|
|
|
19
20
|
DrawerTitle: () => DrawerTitle,
|
|
20
21
|
DrawerTrigger: () => DrawerTrigger
|
|
21
22
|
});
|
|
22
|
-
function Drawer$1({ draggable, ...props }) {
|
|
23
|
+
function Drawer$1({ draggable, container, ...props }) {
|
|
24
|
+
const { getContainer } = useConfig();
|
|
23
25
|
return /* @__PURE__ */ jsx(Drawer.Root, {
|
|
24
26
|
"data-slot": "drawer",
|
|
25
27
|
handleOnly: !draggable,
|
|
28
|
+
container: container ?? getContainer(),
|
|
26
29
|
...props
|
|
27
30
|
});
|
|
28
31
|
}
|
package/dist/core/drawer.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.mjs","names":["Drawer","DrawerPrimitive"],"sources":["../../src/core/drawer.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport { Drawer as DrawerPrimitive } from 'vaul';\n\nimport { cn } from '@repo/ui/utils';\n\ninterface CustomProps {\n draggable?: boolean;\n}\n\nfunction Drawer({\n draggable,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Root> & CustomProps) {\n return (\n <DrawerPrimitive.Root\n data-slot=\"drawer\"\n handleOnly={!draggable}\n {...props}\n />\n );\n}\n\nfunction DrawerTrigger({\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {\n return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} />;\n}\n\nfunction DrawerPortal({\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {\n return <DrawerPrimitive.Portal data-slot=\"drawer-portal\" {...props} />;\n}\n\nfunction DrawerClose({\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Close>) {\n return <DrawerPrimitive.Close data-slot=\"drawer-close\" {...props} />;\n}\n\nfunction DrawerOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {\n return (\n <DrawerPrimitive.Overlay\n data-slot=\"drawer-overlay\"\n className={cn(\n `data-[state=open]:animate-in data-[state=closed]:animate-out\n data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0\n z-50 bg-black/50`,\n className,\n )}\n {...props}\n />\n );\n}\n\ninterface CustomContentProps {\n classNames?: Record<string, string>;\n handlebar?: boolean;\n mask?: boolean;\n}\n\nfunction DrawerContent({\n className,\n children,\n classNames = {},\n handlebar,\n mask,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Content> & CustomContentProps) {\n return (\n <DrawerPortal data-slot=\"drawer-portal\">\n <DrawerOverlay\n className={cn(\n classNames?.mask || '',\n !mask && 'hidden',\n //\n )}\n />\n <DrawerPrimitive.Content\n data-slot=\"drawer-content\"\n className={cn(\n 'group/drawer-content bg-background fixed z-50 flex h-auto flex-col',\n `data-[vaul-drawer-direction=top]:inset-x-0\n data-[vaul-drawer-direction=top]:top-0\n data-[vaul-drawer-direction=top]:mb-24\n data-[vaul-drawer-direction=top]:max-h-[80vh]\n data-[vaul-drawer-direction=top]:rounded-b-lg\n data-[vaul-drawer-direction=top]:border-b`,\n `data-[vaul-drawer-direction=bottom]:inset-x-0\n data-[vaul-drawer-direction=bottom]:bottom-0\n data-[vaul-drawer-direction=bottom]:mt-24\n data-[vaul-drawer-direction=bottom]:max-h-[80vh]\n data-[vaul-drawer-direction=bottom]:rounded-t-lg\n data-[vaul-drawer-direction=bottom]:border-t`,\n `data-[vaul-drawer-direction=right]:inset-y-0\n data-[vaul-drawer-direction=right]:right-0\n data-[vaul-drawer-direction=right]:w-3/4\n data-[vaul-drawer-direction=right]:border-l\n data-[vaul-drawer-direction=right]:sm:max-w-sm`,\n `data-[vaul-drawer-direction=left]:inset-y-0\n data-[vaul-drawer-direction=left]:left-0\n data-[vaul-drawer-direction=left]:w-3/4\n data-[vaul-drawer-direction=left]:border-r\n data-[vaul-drawer-direction=left]:sm:max-w-sm`,\n className,\n )}\n {...props}\n >\n {handlebar && (\n <div\n className={cn(\n `bg-muted mx-auto mt-4 hidden h-2 w-25 shrink-0 rounded-full\n group-data-[vaul-drawer-direction=bottom]/drawer-content:block`,\n classNames?.handlebar,\n )}\n />\n )}\n {/* <div\n className=\"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full\n group-data-[vaul-drawer-direction=bottom]/drawer-content:block\"\n /> */}\n {children}\n </DrawerPrimitive.Content>\n </DrawerPortal>\n );\n}\n\nfunction DrawerHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"drawer-header\"\n className={cn(\n `flex flex-col gap-0.5 p-4\n group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center\n group-data-[vaul-drawer-direction=top]/drawer-content:text-center\n md:gap-1.5 md:text-left`,\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction DrawerFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"drawer-footer\"\n className={cn('mt-auto flex flex-col gap-2 p-4', className)}\n {...props}\n />\n );\n}\n\nfunction DrawerTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Title>) {\n return (\n <DrawerPrimitive.Title\n data-slot=\"drawer-title\"\n className={cn('text-foreground font-semibold', className)}\n {...props}\n />\n );\n}\n\nfunction DrawerDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Description>) {\n return (\n <DrawerPrimitive.Description\n data-slot=\"drawer-description\"\n className={cn('text-muted-foreground text-sm', className)}\n {...props}\n />\n );\n}\n\nexport {\n Drawer,\n DrawerPortal,\n DrawerOverlay,\n DrawerTrigger,\n DrawerClose,\n DrawerContent,\n DrawerHeader,\n DrawerFooter,\n DrawerTitle,\n DrawerDescription,\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"drawer.mjs","names":["Drawer","DrawerPrimitive"],"sources":["../../src/core/drawer.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport { Drawer as DrawerPrimitive } from 'vaul';\n\nimport { useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\ninterface CustomProps {\n draggable?: boolean;\n}\n\nfunction Drawer({\n draggable,\n container,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Root> & CustomProps) {\n const { getContainer } = useConfig();\n\n return (\n <DrawerPrimitive.Root\n data-slot=\"drawer\"\n handleOnly={!draggable}\n container={container ?? getContainer()}\n {...props}\n />\n );\n}\n\nfunction DrawerTrigger({\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {\n return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} />;\n}\n\nfunction DrawerPortal({\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {\n return <DrawerPrimitive.Portal data-slot=\"drawer-portal\" {...props} />;\n}\n\nfunction DrawerClose({\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Close>) {\n return <DrawerPrimitive.Close data-slot=\"drawer-close\" {...props} />;\n}\n\nfunction DrawerOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {\n return (\n <DrawerPrimitive.Overlay\n data-slot=\"drawer-overlay\"\n className={cn(\n `data-[state=open]:animate-in data-[state=closed]:animate-out\n data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0\n z-50 bg-black/50`,\n className,\n )}\n {...props}\n />\n );\n}\n\ninterface CustomContentProps {\n classNames?: Record<string, string>;\n handlebar?: boolean;\n mask?: boolean;\n}\n\nfunction DrawerContent({\n className,\n children,\n classNames = {},\n handlebar,\n mask,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Content> & CustomContentProps) {\n return (\n <DrawerPortal data-slot=\"drawer-portal\">\n <DrawerOverlay\n className={cn(\n classNames?.mask || '',\n !mask && 'hidden',\n //\n )}\n />\n <DrawerPrimitive.Content\n data-slot=\"drawer-content\"\n className={cn(\n 'group/drawer-content bg-background fixed z-50 flex h-auto flex-col',\n `data-[vaul-drawer-direction=top]:inset-x-0\n data-[vaul-drawer-direction=top]:top-0\n data-[vaul-drawer-direction=top]:mb-24\n data-[vaul-drawer-direction=top]:max-h-[80vh]\n data-[vaul-drawer-direction=top]:rounded-b-lg\n data-[vaul-drawer-direction=top]:border-b`,\n `data-[vaul-drawer-direction=bottom]:inset-x-0\n data-[vaul-drawer-direction=bottom]:bottom-0\n data-[vaul-drawer-direction=bottom]:mt-24\n data-[vaul-drawer-direction=bottom]:max-h-[80vh]\n data-[vaul-drawer-direction=bottom]:rounded-t-lg\n data-[vaul-drawer-direction=bottom]:border-t`,\n `data-[vaul-drawer-direction=right]:inset-y-0\n data-[vaul-drawer-direction=right]:right-0\n data-[vaul-drawer-direction=right]:w-3/4\n data-[vaul-drawer-direction=right]:border-l\n data-[vaul-drawer-direction=right]:sm:max-w-sm`,\n `data-[vaul-drawer-direction=left]:inset-y-0\n data-[vaul-drawer-direction=left]:left-0\n data-[vaul-drawer-direction=left]:w-3/4\n data-[vaul-drawer-direction=left]:border-r\n data-[vaul-drawer-direction=left]:sm:max-w-sm`,\n className,\n )}\n {...props}\n >\n {handlebar && (\n <div\n className={cn(\n `bg-muted mx-auto mt-4 hidden h-2 w-25 shrink-0 rounded-full\n group-data-[vaul-drawer-direction=bottom]/drawer-content:block`,\n classNames?.handlebar,\n )}\n />\n )}\n {/* <div\n className=\"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full\n group-data-[vaul-drawer-direction=bottom]/drawer-content:block\"\n /> */}\n {children}\n </DrawerPrimitive.Content>\n </DrawerPortal>\n );\n}\n\nfunction DrawerHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"drawer-header\"\n className={cn(\n `flex flex-col gap-0.5 p-4\n group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center\n group-data-[vaul-drawer-direction=top]/drawer-content:text-center\n md:gap-1.5 md:text-left`,\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction DrawerFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"drawer-footer\"\n className={cn('mt-auto flex flex-col gap-2 p-4', className)}\n {...props}\n />\n );\n}\n\nfunction DrawerTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Title>) {\n return (\n <DrawerPrimitive.Title\n data-slot=\"drawer-title\"\n className={cn('text-foreground font-semibold', className)}\n {...props}\n />\n );\n}\n\nfunction DrawerDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Description>) {\n return (\n <DrawerPrimitive.Description\n data-slot=\"drawer-description\"\n className={cn('text-muted-foreground text-sm', className)}\n {...props}\n />\n );\n}\n\nexport {\n Drawer,\n DrawerPortal,\n DrawerOverlay,\n DrawerTrigger,\n DrawerClose,\n DrawerContent,\n DrawerHeader,\n DrawerFooter,\n DrawerTitle,\n DrawerDescription,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAaA,SAASA,SAAO,EACd,WACA,WACA,GAAG,SAC+D;CAClE,MAAM,EAAE,iBAAiB,WAAW;AAEpC,QACE,oBAACC,OAAgB;EACf,aAAU;EACV,YAAY,CAAC;EACb,WAAW,aAAa,cAAc;EACtC,GAAI;GACJ;;AAIN,SAAS,cAAc,EACrB,GAAG,SACoD;AACvD,QAAO,oBAACA,OAAgB;EAAQ,aAAU;EAAiB,GAAI;GAAS;;AAG1E,SAAS,aAAa,EACpB,GAAG,SACmD;AACtD,QAAO,oBAACA,OAAgB;EAAO,aAAU;EAAgB,GAAI;GAAS;;AAGxE,SAAS,YAAY,EACnB,GAAG,SACkD;AACrD,QAAO,oBAACA,OAAgB;EAAM,aAAU;EAAe,GAAI;GAAS;;AAGtE,SAAS,cAAc,EACrB,WACA,GAAG,SACoD;AACvD,QACE,oBAACA,OAAgB;EACf,aAAU;EACV,WAAW,GACT;;2BAGA,UACD;EACD,GAAI;GACJ;;AAUN,SAAS,cAAc,EACrB,WACA,UACA,aAAa,EAAE,EACf,WACA,MACA,GAAG,SACyE;AAC5E,QACE,qBAAC;EAAa,aAAU;aACtB,oBAAC,iBACC,WAAW,GACT,YAAY,QAAQ,IACpB,CAAC,QAAQ,SAEV,GACD,EACF,qBAACA,OAAgB;GACf,aAAU;GACV,WAAW,GACT,sEACA;;;;;sDAMA;;;;;yDAMA;;;;2DAKA;;;;0DAKA,UACD;GACD,GAAI;cAEH,aACC,oBAAC,SACC,WAAW,GACT;+EAEA,YAAY,UACb,GACD,EAMH;IACuB;GACb;;AAInB,SAAS,aAAa,EAAE,WAAW,GAAG,SAAsC;AAC1E,QACE,oBAAC;EACC,aAAU;EACV,WAAW,GACT;;;kCAIA,UACD;EACD,GAAI;GACJ;;AAIN,SAAS,aAAa,EAAE,WAAW,GAAG,SAAsC;AAC1E,QACE,oBAAC;EACC,aAAU;EACV,WAAW,GAAG,mCAAmC,UAAU;EAC3D,GAAI;GACJ;;AAIN,SAAS,YAAY,EACnB,WACA,GAAG,SACkD;AACrD,QACE,oBAACA,OAAgB;EACf,aAAU;EACV,WAAW,GAAG,iCAAiC,UAAU;EACzD,GAAI;GACJ;;AAIN,SAAS,kBAAkB,EACzB,WACA,GAAG,SACwD;AAC3D,QACE,oBAACA,OAAgB;EACf,aAAU;EACV,WAAW,GAAG,iCAAiC,UAAU;EACzD,GAAI;GACJ"}
|
package/dist/core/popover.d.mts
CHANGED
|
@@ -16,8 +16,11 @@ declare function PopoverContent({
|
|
|
16
16
|
className,
|
|
17
17
|
align,
|
|
18
18
|
sideOffset,
|
|
19
|
+
container,
|
|
19
20
|
...props
|
|
20
|
-
}: React$1.ComponentProps<typeof PopoverPrimitive.Content>
|
|
21
|
+
}: React$1.ComponentProps<typeof PopoverPrimitive.Content> & {
|
|
22
|
+
container?: HTMLElement;
|
|
23
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
21
24
|
declare function PopoverAnchor({
|
|
22
25
|
...props
|
|
23
26
|
}: React$1.ComponentProps<typeof PopoverPrimitive.Anchor>): react_jsx_runtime0.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.d.mts","names":[],"sources":["../../src/core/popover.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"popover.d.mts","names":[],"sources":["../../src/core/popover.tsx"],"mappings":";;;;;;;;iBASS,OAAA,CAAA;EAAA,GACJ;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,gBAAA,CAAiB,IAAA,IAAK,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI5C,cAAA,CAAA;EAAA,GACJ;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,gBAAA,CAAiB,OAAA,IAAQ,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI/C,cAAA,CAAA;EACP,SAAA;EACA,KAAA;EACA,UAAA;EACA,SAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,gBAAA,CAAiB,OAAA;EAC9C,SAAA,GAAY,WAAA;AAAA,IACb,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBA2BQ,aAAA,CAAA;EAAA,GACJ;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,gBAAA,CAAiB,MAAA,IAAO,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI9C,aAAA,CAAA;EAAgB,SAAA;EAAA,GAAc;AAAA,GAAS,OAAA,CAAM,cAAA,UAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAUlE,YAAA,CAAA;EAAe,SAAA;EAAA,GAAc;AAAA,GAAS,OAAA,CAAM,cAAA,SAAoB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAUhE,kBAAA,CAAA;EACP,SAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,QAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/core/popover.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
4
4
|
import { cn } from "../utils.mjs";
|
|
5
|
+
import { useConfig } from "../providers/config/context.mjs";
|
|
5
6
|
import "react";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
8
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
@@ -28,12 +29,15 @@ function PopoverTrigger({ ...props }) {
|
|
|
28
29
|
...props
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
|
-
function PopoverContent({ className, align = "center", sideOffset = 4, ...props }) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
function PopoverContent({ className, align = "center", sideOffset = 4, container, ...props }) {
|
|
33
|
+
const { getContainer } = useConfig();
|
|
34
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, {
|
|
35
|
+
container: container ?? getContainer(),
|
|
36
|
+
children: /* @__PURE__ */ jsx(PopoverPrimitive.Content, {
|
|
37
|
+
"data-slot": "popover-content",
|
|
38
|
+
align,
|
|
39
|
+
sideOffset,
|
|
40
|
+
className: cn(`bg-popover text-popover-foreground data-[state=open]:animate-in
|
|
37
41
|
data-[state=closed]:animate-out data-[state=closed]:fade-out-0
|
|
38
42
|
data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95
|
|
39
43
|
data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2
|
|
@@ -42,8 +46,9 @@ function PopoverContent({ className, align = "center", sideOffset = 4, ...props
|
|
|
42
46
|
data-[side=top]:slide-in-from-bottom-2 z-50 w-72
|
|
43
47
|
origin-(--radix-popover-content-transform-origin) rounded-md border
|
|
44
48
|
p-4 shadow-md outline-hidden`, className),
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
...props
|
|
50
|
+
})
|
|
51
|
+
});
|
|
47
52
|
}
|
|
48
53
|
function PopoverAnchor({ ...props }) {
|
|
49
54
|
return /* @__PURE__ */ jsx(PopoverPrimitive.Anchor, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.mjs","names":[],"sources":["../../src/core/popover.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nimport { cn } from '@repo/ui/utils';\n\nfunction Popover({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\n}\n\nfunction PopoverTrigger({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />;\n}\n\nfunction PopoverContent({\n className,\n align = 'center',\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Content>) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n `bg-popover text-popover-foreground data-[state=open]:animate-in\n data-[state=closed]:animate-out data-[state=closed]:fade-out-0\n data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95\n data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2\n data-[side=left]:slide-in-from-right-2\n data-[side=right]:slide-in-from-left-2\n data-[side=top]:slide-in-from-bottom-2 z-50 w-72\n origin-(--radix-popover-content-transform-origin) rounded-md border\n p-4 shadow-md outline-hidden`,\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n );\n}\n\nfunction PopoverAnchor({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {\n return <PopoverPrimitive.Anchor data-slot=\"popover-anchor\" {...props} />;\n}\n\nfunction PopoverHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"popover-header\"\n className={cn('flex flex-col gap-1 text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction PopoverTitle({ className, ...props }: React.ComponentProps<'h2'>) {\n return (\n <div\n data-slot=\"popover-title\"\n className={cn('font-medium', className)}\n {...props}\n />\n );\n}\n\nfunction PopoverDescription({\n className,\n ...props\n}: React.ComponentProps<'p'>) {\n return (\n <p\n data-slot=\"popover-description\"\n className={cn('text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverAnchor,\n PopoverHeader,\n PopoverTitle,\n PopoverDescription,\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"popover.mjs","names":[],"sources":["../../src/core/popover.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nimport { useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nfunction Popover({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\n}\n\nfunction PopoverTrigger({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />;\n}\n\nfunction PopoverContent({\n className,\n align = 'center',\n sideOffset = 4,\n container,\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Content> & {\n container?: HTMLElement;\n}) {\n const { getContainer } = useConfig();\n\n return (\n <PopoverPrimitive.Portal container={container ?? getContainer()}>\n <PopoverPrimitive.Content\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n `bg-popover text-popover-foreground data-[state=open]:animate-in\n data-[state=closed]:animate-out data-[state=closed]:fade-out-0\n data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95\n data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2\n data-[side=left]:slide-in-from-right-2\n data-[side=right]:slide-in-from-left-2\n data-[side=top]:slide-in-from-bottom-2 z-50 w-72\n origin-(--radix-popover-content-transform-origin) rounded-md border\n p-4 shadow-md outline-hidden`,\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n );\n}\n\nfunction PopoverAnchor({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {\n return <PopoverPrimitive.Anchor data-slot=\"popover-anchor\" {...props} />;\n}\n\nfunction PopoverHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"popover-header\"\n className={cn('flex flex-col gap-1 text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction PopoverTitle({ className, ...props }: React.ComponentProps<'h2'>) {\n return (\n <div\n data-slot=\"popover-title\"\n className={cn('font-medium', className)}\n {...props}\n />\n );\n}\n\nfunction PopoverDescription({\n className,\n ...props\n}: React.ComponentProps<'p'>) {\n return (\n <p\n data-slot=\"popover-description\"\n className={cn('text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverAnchor,\n PopoverHeader,\n PopoverTitle,\n PopoverDescription,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AASA,SAAS,QAAQ,EACf,GAAG,SACkD;AACrD,QAAO,oBAAC,iBAAiB;EAAK,aAAU;EAAU,GAAI;GAAS;;AAGjE,SAAS,eAAe,EACtB,GAAG,SACqD;AACxD,QAAO,oBAAC,iBAAiB;EAAQ,aAAU;EAAkB,GAAI;GAAS;;AAG5E,SAAS,eAAe,EACtB,WACA,QAAQ,UACR,aAAa,GACb,WACA,GAAG,SAGF;CACD,MAAM,EAAE,iBAAiB,WAAW;AAEpC,QACE,oBAAC,iBAAiB;EAAO,WAAW,aAAa,cAAc;YAC7D,oBAAC,iBAAiB;GAChB,aAAU;GACH;GACK;GACZ,WAAW,GACT;;;;;;;;yCASA,UACD;GACD,GAAI;IACJ;GACsB;;AAI9B,SAAS,cAAc,EACrB,GAAG,SACoD;AACvD,QAAO,oBAAC,iBAAiB;EAAO,aAAU;EAAiB,GAAI;GAAS;;AAG1E,SAAS,cAAc,EAAE,WAAW,GAAG,SAAsC;AAC3E,QACE,oBAAC;EACC,aAAU;EACV,WAAW,GAAG,+BAA+B,UAAU;EACvD,GAAI;GACJ;;AAIN,SAAS,aAAa,EAAE,WAAW,GAAG,SAAqC;AACzE,QACE,oBAAC;EACC,aAAU;EACV,WAAW,GAAG,eAAe,UAAU;EACvC,GAAI;GACJ;;AAIN,SAAS,mBAAmB,EAC1B,WACA,GAAG,SACyB;AAC5B,QACE,oBAAC;EACC,aAAU;EACV,WAAW,GAAG,yBAAyB,UAAU;EACjD,GAAI;GACJ"}
|
package/dist/core/select.d.mts
CHANGED
|
@@ -28,8 +28,11 @@ declare function SelectContent({
|
|
|
28
28
|
children,
|
|
29
29
|
position,
|
|
30
30
|
align,
|
|
31
|
+
container,
|
|
31
32
|
...props
|
|
32
|
-
}: React$1.ComponentProps<typeof Select.Content>
|
|
33
|
+
}: React$1.ComponentProps<typeof Select.Content> & {
|
|
34
|
+
container?: HTMLElement;
|
|
35
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
33
36
|
declare function SelectLabel({
|
|
34
37
|
className,
|
|
35
38
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.mts","names":[],"sources":["../../src/core/select.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"select.d.mts","names":[],"sources":["../../src/core/select.tsx"],"mappings":";;;;;;;;iBAUS,QAAA,CAAA;EAAA,GACJ;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,MAAA,CAAgB,IAAA,IAAK,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI3C,WAAA,CAAA;EAAA,GACJ;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,MAAA,CAAgB,KAAA,IAAM,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI5C,WAAA,CAAA;EAAA,GACJ;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,MAAA,CAAgB,KAAA,IAAM,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAI5C,aAAA,CAAA;EACP,SAAA;EACA,IAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,MAAA,CAAgB,OAAA;EAC7C,IAAA;AAAA,IACD,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBA+BQ,aAAA,CAAA;EACP,SAAA;EACA,QAAA;EACA,QAAA;EACA,KAAA;EACA,SAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,MAAA,CAAgB,OAAA;EAC7C,SAAA,GAAY,WAAA;AAAA,IACb,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBA4CQ,WAAA,CAAA;EACP,SAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,MAAA,CAAgB,KAAA,IAAM,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAU5C,UAAA,CAAA;EACP,SAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,MAAA,CAAgB,IAAA,IAAK,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBA6B3C,eAAA,CAAA;EACP,SAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,MAAA,CAAgB,SAAA,IAAU,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAUhD,oBAAA,CAAA;EACP,SAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,MAAA,CAAgB,cAAA,IAAe,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAerD,sBAAA,CAAA;EACP,SAAA;EAAA,GACG;AAAA,GACF,OAAA,CAAM,cAAA,QAAsB,MAAA,CAAgB,gBAAA,IAAiB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/core/select.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
4
4
|
import { cn } from "../utils.mjs";
|
|
5
|
+
import { useConfig } from "../providers/config/context.mjs";
|
|
5
6
|
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
|
6
7
|
import "react";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -62,10 +63,13 @@ function SelectTrigger({ className, size = "default", children, ...props }) {
|
|
|
62
63
|
})]
|
|
63
64
|
});
|
|
64
65
|
}
|
|
65
|
-
function SelectContent({ className, children, position = "item-aligned", align = "center", ...props }) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
function SelectContent({ className, children, position = "item-aligned", align = "center", container, ...props }) {
|
|
67
|
+
const { getContainer } = useConfig();
|
|
68
|
+
return /* @__PURE__ */ jsx(Select.Portal, {
|
|
69
|
+
container: container ?? getContainer(),
|
|
70
|
+
children: /* @__PURE__ */ jsxs(Select.Content, {
|
|
71
|
+
"data-slot": "select-content",
|
|
72
|
+
className: cn(`bg-popover text-popover-foreground data-[state=open]:animate-in
|
|
69
73
|
data-[state=closed]:animate-out data-[state=closed]:fade-out-0
|
|
70
74
|
data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95
|
|
71
75
|
data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2
|
|
@@ -76,19 +80,20 @@ function SelectContent({ className, children, position = "item-aligned", align =
|
|
|
76
80
|
origin-(--radix-select-content-transform-origin) overflow-x-hidden
|
|
77
81
|
overflow-y-auto rounded-md border shadow-md`, position === "popper" && `data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1
|
|
78
82
|
data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`, className),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
position,
|
|
84
|
+
align,
|
|
85
|
+
...props,
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
88
|
+
/* @__PURE__ */ jsx(Select.Viewport, {
|
|
89
|
+
className: cn("p-1", position === "popper" && `h-[var(--radix-select-trigger-height)] w-full
|
|
86
90
|
min-w-[var(--radix-select-trigger-width)] scroll-my-1`),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
children
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
94
|
+
]
|
|
95
|
+
})
|
|
96
|
+
});
|
|
92
97
|
}
|
|
93
98
|
function SelectLabel({ className, ...props }) {
|
|
94
99
|
return /* @__PURE__ */ jsx(Select.Label, {
|
package/dist/core/select.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.mjs","names":["Select","SelectPrimitive"],"sources":["../../src/core/select.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';\nimport { Select as SelectPrimitive } from 'radix-ui';\n\nimport { cn } from '@repo/ui/utils';\n\nfunction Select({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Root>) {\n return <SelectPrimitive.Root data-slot=\"select\" {...props} />;\n}\n\nfunction SelectGroup({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Group>) {\n return <SelectPrimitive.Group data-slot=\"select-group\" {...props} />;\n}\n\nfunction SelectValue({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Value>) {\n return <SelectPrimitive.Value data-slot=\"select-value\" {...props} />;\n}\n\nfunction SelectTrigger({\n className,\n size = 'default',\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {\n size?: 'sm' | 'default';\n}) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"select-trigger\"\n data-size={size}\n className={cn(\n `border-input data-[placeholder]:text-muted-foreground\n [&_svg:not([class*='text-'])]:text-muted-foreground\n focus-visible:border-ring focus-visible:ring-ring/50\n aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40\n aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50\n flex w-fit items-center justify-between gap-2 rounded-md border\n bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs\n transition-[color,box-shadow] outline-none focus-visible:ring-[3px]\n disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9\n data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1\n *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center\n *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none\n [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,\n className,\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon className=\"size-4 opacity-50\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n );\n}\n\nfunction SelectContent({\n className,\n children,\n position = 'item-aligned',\n align = 'center',\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Content>) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n data-slot=\"select-content\"\n className={cn(\n `bg-popover text-popover-foreground data-[state=open]:animate-in\n data-[state=closed]:animate-out data-[state=closed]:fade-out-0\n data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95\n data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2\n data-[side=left]:slide-in-from-right-2\n data-[side=right]:slide-in-from-left-2\n data-[side=top]:slide-in-from-bottom-2 relative z-50\n max-h-(--radix-select-content-available-height) min-w-[8rem]\n origin-(--radix-select-content-transform-origin) overflow-x-hidden\n overflow-y-auto rounded-md border shadow-md`,\n position === 'popper' &&\n `data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1\n data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,\n className,\n )}\n position={position}\n align={align}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n 'p-1',\n position === 'popper' &&\n `h-[var(--radix-select-trigger-height)] w-full\n min-w-[var(--radix-select-trigger-width)] scroll-my-1`,\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n}\n\nfunction SelectLabel({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Label>) {\n return (\n <SelectPrimitive.Label\n data-slot=\"select-label\"\n className={cn('text-muted-foreground px-2 py-1.5 text-xs', className)}\n {...props}\n />\n );\n}\n\nfunction SelectItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Item>) {\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n `focus:bg-accent focus:text-accent-foreground\n [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full\n cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm\n outline-hidden select-none data-[disabled]:pointer-events-none\n data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0\n [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex\n *:[span]:last:items-center *:[span]:last:gap-2`,\n className,\n )}\n {...props}\n >\n <span\n data-slot=\"select-item-indicator\"\n className=\"absolute right-2 flex size-3.5 items-center justify-center\"\n >\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\nfunction SelectSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Separator>) {\n return (\n <SelectPrimitive.Separator\n data-slot=\"select-separator\"\n className={cn('bg-border pointer-events-none -mx-1 my-1 h-px', className)}\n {...props}\n />\n );\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {\n return (\n <SelectPrimitive.ScrollUpButton\n data-slot=\"select-scroll-up-button\"\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className,\n )}\n {...props}\n >\n <ChevronUpIcon className=\"size-4\" />\n </SelectPrimitive.ScrollUpButton>\n );\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {\n return (\n <SelectPrimitive.ScrollDownButton\n data-slot=\"select-scroll-down-button\"\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className,\n )}\n {...props}\n >\n <ChevronDownIcon className=\"size-4\" />\n </SelectPrimitive.ScrollDownButton>\n );\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"select.mjs","names":["Select","SelectPrimitive"],"sources":["../../src/core/select.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';\nimport { Select as SelectPrimitive } from 'radix-ui';\n\nimport { useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nfunction Select({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Root>) {\n return <SelectPrimitive.Root data-slot=\"select\" {...props} />;\n}\n\nfunction SelectGroup({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Group>) {\n return <SelectPrimitive.Group data-slot=\"select-group\" {...props} />;\n}\n\nfunction SelectValue({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Value>) {\n return <SelectPrimitive.Value data-slot=\"select-value\" {...props} />;\n}\n\nfunction SelectTrigger({\n className,\n size = 'default',\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {\n size?: 'sm' | 'default';\n}) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"select-trigger\"\n data-size={size}\n className={cn(\n `border-input data-[placeholder]:text-muted-foreground\n [&_svg:not([class*='text-'])]:text-muted-foreground\n focus-visible:border-ring focus-visible:ring-ring/50\n aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40\n aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50\n flex w-fit items-center justify-between gap-2 rounded-md border\n bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs\n transition-[color,box-shadow] outline-none focus-visible:ring-[3px]\n disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9\n data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1\n *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center\n *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none\n [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,\n className,\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon className=\"size-4 opacity-50\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n );\n}\n\nfunction SelectContent({\n className,\n children,\n position = 'item-aligned',\n align = 'center',\n container,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Content> & {\n container?: HTMLElement;\n}) {\n const { getContainer } = useConfig();\n\n return (\n <SelectPrimitive.Portal container={container ?? getContainer()}>\n <SelectPrimitive.Content\n data-slot=\"select-content\"\n className={cn(\n `bg-popover text-popover-foreground data-[state=open]:animate-in\n data-[state=closed]:animate-out data-[state=closed]:fade-out-0\n data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95\n data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2\n data-[side=left]:slide-in-from-right-2\n data-[side=right]:slide-in-from-left-2\n data-[side=top]:slide-in-from-bottom-2 relative z-50\n max-h-(--radix-select-content-available-height) min-w-[8rem]\n origin-(--radix-select-content-transform-origin) overflow-x-hidden\n overflow-y-auto rounded-md border shadow-md`,\n position === 'popper' &&\n `data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1\n data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,\n className,\n )}\n position={position}\n align={align}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n 'p-1',\n position === 'popper' &&\n `h-[var(--radix-select-trigger-height)] w-full\n min-w-[var(--radix-select-trigger-width)] scroll-my-1`,\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n}\n\nfunction SelectLabel({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Label>) {\n return (\n <SelectPrimitive.Label\n data-slot=\"select-label\"\n className={cn('text-muted-foreground px-2 py-1.5 text-xs', className)}\n {...props}\n />\n );\n}\n\nfunction SelectItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Item>) {\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n `focus:bg-accent focus:text-accent-foreground\n [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full\n cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm\n outline-hidden select-none data-[disabled]:pointer-events-none\n data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0\n [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex\n *:[span]:last:items-center *:[span]:last:gap-2`,\n className,\n )}\n {...props}\n >\n <span\n data-slot=\"select-item-indicator\"\n className=\"absolute right-2 flex size-3.5 items-center justify-center\"\n >\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\nfunction SelectSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Separator>) {\n return (\n <SelectPrimitive.Separator\n data-slot=\"select-separator\"\n className={cn('bg-border pointer-events-none -mx-1 my-1 h-px', className)}\n {...props}\n />\n );\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {\n return (\n <SelectPrimitive.ScrollUpButton\n data-slot=\"select-scroll-up-button\"\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className,\n )}\n {...props}\n >\n <ChevronUpIcon className=\"size-4\" />\n </SelectPrimitive.ScrollUpButton>\n );\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {\n return (\n <SelectPrimitive.ScrollDownButton\n data-slot=\"select-scroll-down-button\"\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className,\n )}\n {...props}\n >\n <ChevronDownIcon className=\"size-4\" />\n </SelectPrimitive.ScrollDownButton>\n );\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAUA,SAASA,SAAO,EACd,GAAG,SACiD;AACpD,QAAO,oBAACC,OAAgB;EAAK,aAAU;EAAS,GAAI;GAAS;;AAG/D,SAAS,YAAY,EACnB,GAAG,SACkD;AACrD,QAAO,oBAACA,OAAgB;EAAM,aAAU;EAAe,GAAI;GAAS;;AAGtE,SAAS,YAAY,EACnB,GAAG,SACkD;AACrD,QAAO,oBAACA,OAAgB;EAAM,aAAU;EAAe,GAAI;GAAS;;AAGtE,SAAS,cAAc,EACrB,WACA,OAAO,WACP,UACA,GAAG,SAGF;AACD,QACE,qBAACA,OAAgB;EACf,aAAU;EACV,aAAW;EACX,WAAW,GACT;;;;;;;;;;;;gEAaA,UACD;EACD,GAAI;aAEH,UACD,oBAACA,OAAgB;GAAK;aACpB,oBAAC,mBAAgB,WAAU,sBAAsB;IAC5B;GACC;;AAI9B,SAAS,cAAc,EACrB,WACA,UACA,WAAW,gBACX,QAAQ,UACR,WACA,GAAG,SAGF;CACD,MAAM,EAAE,iBAAiB,WAAW;AAEpC,QACE,oBAACA,OAAgB;EAAO,WAAW,aAAa,cAAc;YAC5D,qBAACA,OAAgB;GACf,aAAU;GACV,WAAW,GACT;;;;;;;;;wDAUA,aAAa,YACX;6EAEF,UACD;GACS;GACH;GACP,GAAI;;IAEJ,oBAAC,yBAAuB;IACxB,oBAACA,OAAgB;KACf,WAAW,GACT,OACA,aAAa,YACX;qEAEH;KAEA;MACwB;IAC3B,oBAAC,2BAAyB;;IACF;GACH;;AAI7B,SAAS,YAAY,EACnB,WACA,GAAG,SACkD;AACrD,QACE,oBAACA,OAAgB;EACf,aAAU;EACV,WAAW,GAAG,6CAA6C,UAAU;EACrE,GAAI;GACJ;;AAIN,SAAS,WAAW,EAClB,WACA,UACA,GAAG,SACiD;AACpD,QACE,qBAACA,OAAgB;EACf,aAAU;EACV,WAAW,GACT;;;;;;yDAOA,UACD;EACD,GAAI;aAEJ,oBAAC;GACC,aAAU;GACV,WAAU;aAEV,oBAACA,OAAgB,2BACf,oBAAC,aAAU,WAAU,WAAW,GACF;IAC3B,EACP,oBAACA,OAAgB,YAAU,WAAoC;GAC1C;;AAI3B,SAAS,gBAAgB,EACvB,WACA,GAAG,SACsD;AACzD,QACE,oBAACA,OAAgB;EACf,aAAU;EACV,WAAW,GAAG,iDAAiD,UAAU;EACzE,GAAI;GACJ;;AAIN,SAAS,qBAAqB,EAC5B,WACA,GAAG,SAC2D;AAC9D,QACE,oBAACA,OAAgB;EACf,aAAU;EACV,WAAW,GACT,wDACA,UACD;EACD,GAAI;YAEJ,oBAAC,iBAAc,WAAU,WAAW;GACL;;AAIrC,SAAS,uBAAuB,EAC9B,WACA,GAAG,SAC6D;AAChE,QACE,oBAACA,OAAgB;EACf,aAAU;EACV,WAAW,GACT,wDACA,UACD;EACD,GAAI;YAEJ,oBAAC,mBAAgB,WAAU,WAAW;GACL"}
|
package/dist/index.d.mts
CHANGED
|
@@ -48,8 +48,8 @@ import { PageHeader, Props as Props$16 } from "./components/templates/page-heade
|
|
|
48
48
|
import { Props as Props$19, Row } from "./components/templates/grid/row.mjs";
|
|
49
49
|
import { Col, Props as Props$1 } from "./components/templates/grid/col.mjs";
|
|
50
50
|
import "./components/templates/index.mjs";
|
|
51
|
-
import { Locale, ThemeConfig, ThemeToken } from "./providers/
|
|
52
|
-
import { DEFAULT_LOCALE, useConfig } from "./providers/
|
|
53
|
-
import { Config, Props as Props$3 } from "./providers/
|
|
51
|
+
import { Locale, ThemeConfig, ThemeToken } from "./providers/config/types.mjs";
|
|
52
|
+
import { DEFAULT_LOCALE, useConfig } from "./providers/config/context.mjs";
|
|
53
|
+
import { Config, Props as Props$3 } from "./providers/config/config.mjs";
|
|
54
54
|
import "./providers.mjs";
|
|
55
55
|
export { Button, Card, Props as CardProps, Checkbox, Col, Props$1 as ColProps, Collapse, Props$2 as CollapseProps, ColorPicker, Config, Props$3 as ConfigProps, Container, Props$4 as ContainerProps, Props$5 as ContentProps, DEFAULT_LOCALE, DatePicker, Drawer, Props$6 as DrawerProps, Dropdown, Props$7 as DropdownProps, Empty, Props$8 as EmptyProps, FloatButton, Props$9 as FooterProps, Props$10 as HeaderProps, Input, Layout, Props$11 as LayoutProps, List, Props$12 as ListProps, Locale, Marquees, Props$13 as MarqueesProps, Menu, Props$14 as MenuProps, Modal, Props$15 as ModalProps, PageHeader, Props$16 as PageHeaderProps, Popover, Progress, Radio, Result, Props$17 as ResultProps, Reveals, Props$18 as RevealsProps, Row, Props$19 as RowProps, Select, Props$20 as SiderProps, Skeleton, Space, Props$21 as SpaceProps, Spin, Splitter, Props$22 as SplitterProps, Swiper, Props$23 as SwiperProps, Switch, Tag, ThemeConfig, ThemeToken, Toast, StaticProps as ToastOptions, Typography, Upload, UploadFile, Props$24 as UploadProps, useConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "./style.mjs";
|
|
2
|
+
import { DEFAULT_LOCALE, useConfig } from "./providers/config/context.mjs";
|
|
3
|
+
import Config from "./providers/config/config.mjs";
|
|
2
4
|
import Button from "./Button.mjs";
|
|
3
5
|
import Checkbox from "./components/atoms/checkbox/index.mjs";
|
|
4
6
|
import Typography from "./Typography.mjs";
|
|
5
7
|
import Popover from "./components/atoms/popover.mjs";
|
|
6
8
|
import ColorPicker from "./components/atoms/color-picker.mjs";
|
|
7
9
|
import DatePicker from "./components/atoms/date-picker.mjs";
|
|
8
|
-
import { DEFAULT_LOCALE, useConfig } from "./providers/Config/context.mjs";
|
|
9
|
-
import Config from "./providers/Config/index.mjs";
|
|
10
10
|
import FloatButton from "./components/atoms/float-button/index.mjs";
|
|
11
11
|
import Input from "./components/atoms/input/index.mjs";
|
|
12
12
|
import Progress from "./components/atoms/progress.mjs";
|
|
@@ -2,19 +2,21 @@ import { Locale, ThemeConfig, ThemeToken } from "./types.mjs";
|
|
|
2
2
|
import { DEFAULT_LOCALE, useConfig } from "./context.mjs";
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
|
-
//#region src/providers/
|
|
5
|
+
//#region src/providers/config/config.d.ts
|
|
6
6
|
interface Props {
|
|
7
7
|
theme?: ThemeConfig;
|
|
8
8
|
locale?: Locale;
|
|
9
|
+
getContainer?: () => HTMLElement;
|
|
9
10
|
className?: string;
|
|
10
11
|
children: React.ReactNode;
|
|
11
12
|
}
|
|
12
13
|
declare const Config: ({
|
|
13
14
|
theme,
|
|
14
15
|
locale,
|
|
16
|
+
getContainer,
|
|
15
17
|
className,
|
|
16
18
|
children
|
|
17
19
|
}: Props) => react_jsx_runtime0.JSX.Element;
|
|
18
20
|
//#endregion
|
|
19
21
|
export { Config, type Props };
|
|
20
|
-
//# sourceMappingURL=
|
|
22
|
+
//# sourceMappingURL=config.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.mts","names":[],"sources":["../../../src/providers/config/config.tsx"],"mappings":";;;;;UAmDU,KAAA;EACR,KAAA,GAAQ,WAAA;EACR,MAAA,GAAS,MAAA;EACT,YAAA,SAAqB,WAAA;EACrB,SAAA;EACA,QAAA,EAAU,KAAA,CAAM,SAAA;AAAA;AAAA,cAGZ,MAAA;EAAU,KAAA;EAAA,MAAA;EAAA,YAAA;EAAA,SAAA;EAAA;AAAA,GAMb,KAAA,KAAK,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import { cn } from "../../utils.mjs";
|
|
4
4
|
import { Context, DEFAULT_LOCALE, useConfig } from "./context.mjs";
|
|
5
|
-
import { useMemo } from "react";
|
|
5
|
+
import { useCallback, useMemo, useState } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
|
|
8
|
-
//#region src/providers/
|
|
8
|
+
//#region src/providers/config/config.tsx
|
|
9
9
|
const tokenToCssVar = {
|
|
10
10
|
colorPrimary: "--primary",
|
|
11
11
|
colorPrimaryForeground: "--primary-foreground",
|
|
@@ -37,8 +37,9 @@ const buildCssVars = (token) => {
|
|
|
37
37
|
}
|
|
38
38
|
return vars;
|
|
39
39
|
};
|
|
40
|
-
const Config = ({ theme = {}, locale = {}, className, children }) => {
|
|
40
|
+
const Config = ({ theme = {}, locale = {}, getContainer, className, children }) => {
|
|
41
41
|
const parent = useConfig();
|
|
42
|
+
const [wrapperEl, setWrapperEl] = useState(null);
|
|
42
43
|
const themeKey = JSON.stringify(theme);
|
|
43
44
|
const parentThemeKey = JSON.stringify(parent.theme);
|
|
44
45
|
const localeKey = JSON.stringify(locale);
|
|
@@ -55,17 +56,33 @@ const Config = ({ theme = {}, locale = {}, className, children }) => {
|
|
|
55
56
|
...parent.locale,
|
|
56
57
|
...locale
|
|
57
58
|
}), [parentLocaleKey, localeKey]);
|
|
58
|
-
const contextValue = useMemo(() => ({
|
|
59
|
-
theme: mergedTheme,
|
|
60
|
-
locale: mergedLocale
|
|
61
|
-
}), [mergedTheme, mergedLocale]);
|
|
62
59
|
const cssVars = useMemo(() => buildCssVars(mergedTheme.token), [mergedTheme.token]);
|
|
63
60
|
const hasCssVars = Object.keys(cssVars).length > 0;
|
|
64
61
|
const hasDarkMode = mergedTheme.dark !== void 0;
|
|
65
62
|
const needsWrapper = hasCssVars || hasDarkMode || className;
|
|
63
|
+
const resolvedGetContainer = useCallback(() => {
|
|
64
|
+
if (getContainer) return getContainer();
|
|
65
|
+
if (needsWrapper && wrapperEl) return wrapperEl;
|
|
66
|
+
return parent.getContainer();
|
|
67
|
+
}, [
|
|
68
|
+
getContainer,
|
|
69
|
+
needsWrapper,
|
|
70
|
+
wrapperEl,
|
|
71
|
+
parent
|
|
72
|
+
]);
|
|
73
|
+
const contextValue = useMemo(() => ({
|
|
74
|
+
theme: mergedTheme,
|
|
75
|
+
locale: mergedLocale,
|
|
76
|
+
getContainer: resolvedGetContainer
|
|
77
|
+
}), [
|
|
78
|
+
mergedTheme,
|
|
79
|
+
mergedLocale,
|
|
80
|
+
resolvedGetContainer
|
|
81
|
+
]);
|
|
66
82
|
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
67
83
|
value: contextValue,
|
|
68
84
|
children: needsWrapper ? /* @__PURE__ */ jsx("div", {
|
|
85
|
+
ref: setWrapperEl,
|
|
69
86
|
className: cn(mergedTheme.dark && "dark", className),
|
|
70
87
|
style: {
|
|
71
88
|
...hasCssVars ? cssVars : void 0,
|
|
@@ -78,4 +95,4 @@ const Config = ({ theme = {}, locale = {}, className, children }) => {
|
|
|
78
95
|
|
|
79
96
|
//#endregion
|
|
80
97
|
export { Config as default };
|
|
81
|
-
//# sourceMappingURL=
|
|
98
|
+
//# sourceMappingURL=config.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.mjs","names":[],"sources":["../../../src/providers/config/config.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback, useMemo, useState } from 'react';\n\nimport { cn } from '@repo/ui/utils';\n\nimport { Context, DEFAULT_LOCALE, useConfig } from './context';\nimport type { Locale, ThemeConfig, ThemeToken } from './types';\n\nconst tokenToCssVar: Record<keyof ThemeToken, string> = {\n colorPrimary: '--primary',\n colorPrimaryForeground: '--primary-foreground',\n colorBackground: '--background',\n colorForeground: '--foreground',\n colorCard: '--card',\n colorCardForeground: '--card-foreground',\n colorPopover: '--popover',\n colorPopoverForeground: '--popover-foreground',\n colorSecondary: '--secondary',\n colorSecondaryForeground: '--secondary-foreground',\n colorMuted: '--muted',\n colorMutedForeground: '--muted-foreground',\n colorAccent: '--accent',\n colorAccentForeground: '--accent-foreground',\n colorDestructive: '--destructive',\n colorBorder: '--border',\n colorInput: '--input',\n colorRing: '--ring',\n borderRadius: '--radius',\n};\n\nconst buildCssVars = (token?: ThemeToken): React.CSSProperties => {\n if (!token) {\n return {};\n }\n\n const vars: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(token)) {\n if (value === undefined) {\n continue;\n }\n const cssVar = tokenToCssVar[key as keyof ThemeToken];\n if (cssVar) {\n vars[cssVar] = value;\n }\n }\n\n return vars as React.CSSProperties;\n};\n\ninterface Props {\n theme?: ThemeConfig;\n locale?: Locale;\n getContainer?: () => HTMLElement;\n className?: string;\n children: React.ReactNode;\n}\n\nconst Config = ({\n theme = {},\n locale = {},\n getContainer,\n className,\n children,\n}: Props) => {\n const parent = useConfig();\n const [wrapperEl, setWrapperEl] = useState<HTMLDivElement | null>(null);\n\n // `theme` is typically a fresh inline object literal at the call site\n // (and `parent.theme` inherits the same problem from its own Config\n // ancestor), so depending on them directly meant mergedTheme/contextValue\n // got a new identity on every render regardless of whether the actual\n // values changed — every useConfig() consumer in the tree re-rendered on\n // every render of whatever's above this Config, which for the common\n // app-root usage is everything. Depend on a serialized key instead so\n // the memo only invalidates when the content actually changes; these\n // are small, string/boolean-only objects, so JSON.stringify is cheap.\n const themeKey = JSON.stringify(theme);\n const parentThemeKey = JSON.stringify(parent.theme);\n const localeKey = JSON.stringify(locale);\n const parentLocaleKey = JSON.stringify(parent.locale);\n\n const mergedTheme = useMemo<ThemeConfig>(\n () => ({\n ...parent.theme,\n ...theme,\n token: {\n ...parent.theme.token,\n ...theme.token,\n },\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [parentThemeKey, themeKey],\n );\n\n const mergedLocale = useMemo<Locale>(\n () => ({\n ...parent.locale,\n ...locale,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [parentLocaleKey, localeKey],\n );\n\n const cssVars = useMemo(\n () => buildCssVars(mergedTheme.token),\n [mergedTheme.token],\n );\n\n const hasCssVars = Object.keys(cssVars).length > 0;\n const hasDarkMode = mergedTheme.dark !== undefined;\n const needsWrapper = hasCssVars || hasDarkMode || className;\n\n // Resolution order: an explicit `getContainer` prop on this Config wins;\n // otherwise, if this Config renders its own themed wrapper below, that's\n // the default (portaled content appended into it still inherits its CSS\n // custom properties and matches the `.dark` selector — `display:\n // contents` only removes the element from the layout box tree, not from\n // the DOM/cascade); otherwise defer to the parent Config's resolution,\n // so an inner Config that only sets e.g. `locale` doesn't shadow an\n // outer one's theme container.\n const resolvedGetContainer = useCallback((): HTMLElement | undefined => {\n if (getContainer) {\n return getContainer();\n }\n if (needsWrapper && wrapperEl) {\n return wrapperEl;\n }\n return parent.getContainer();\n }, [getContainer, needsWrapper, wrapperEl, parent]);\n\n const contextValue = useMemo(\n () => ({\n theme: mergedTheme,\n locale: mergedLocale,\n getContainer: resolvedGetContainer,\n }),\n [mergedTheme, mergedLocale, resolvedGetContainer],\n );\n\n return (\n <Context.Provider value={contextValue}>\n {needsWrapper ? (\n <div\n ref={setWrapperEl}\n className={cn(mergedTheme.dark && 'dark', className)}\n style={{\n ...(hasCssVars ? cssVars : undefined),\n // Keeps this element out of the layout box tree — so it\n // doesn't intercept flex/grid child relationships or break\n // height chains like min-h-screen — while custom properties\n // and the `dark` class selector still cascade to children\n // normally (inheritance and box generation are separate\n // mechanisms in CSS). Note this means className shouldn't be\n // used here for anything that needs a real box (padding,\n // background, borders); Config's className is meant for\n // theming hooks (the `dark` class, arbitrary selector hooks),\n // not layout.\n display: 'contents',\n }}\n >\n {children}\n </div>\n ) : (\n children\n )}\n </Context.Provider>\n );\n};\n\nexport default Config;\nexport { useConfig, DEFAULT_LOCALE };\nexport type { Props, Locale, ThemeConfig, ThemeToken };\n"],"mappings":";;;;;;;;AASA,MAAM,gBAAkD;CACtD,cAAc;CACd,wBAAwB;CACxB,iBAAiB;CACjB,iBAAiB;CACjB,WAAW;CACX,qBAAqB;CACrB,cAAc;CACd,wBAAwB;CACxB,gBAAgB;CAChB,0BAA0B;CAC1B,YAAY;CACZ,sBAAsB;CACtB,aAAa;CACb,uBAAuB;CACvB,kBAAkB;CAClB,aAAa;CACb,YAAY;CACZ,WAAW;CACX,cAAc;CACf;AAED,MAAM,gBAAgB,UAA4C;AAChE,KAAI,CAAC,MACH,QAAO,EAAE;CAGX,MAAM,OAA+B,EAAE;AAEvC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,EAAE;AAChD,MAAI,UAAU,OACZ;EAEF,MAAM,SAAS,cAAc;AAC7B,MAAI,OACF,MAAK,UAAU;;AAInB,QAAO;;AAWT,MAAM,UAAU,EACd,QAAQ,EAAE,EACV,SAAS,EAAE,EACX,cACA,WACA,eACW;CACX,MAAM,SAAS,WAAW;CAC1B,MAAM,CAAC,WAAW,gBAAgB,SAAgC,KAAK;CAWvE,MAAM,WAAW,KAAK,UAAU,MAAM;CACtC,MAAM,iBAAiB,KAAK,UAAU,OAAO,MAAM;CACnD,MAAM,YAAY,KAAK,UAAU,OAAO;CACxC,MAAM,kBAAkB,KAAK,UAAU,OAAO,OAAO;CAErD,MAAM,cAAc,eACX;EACL,GAAG,OAAO;EACV,GAAG;EACH,OAAO;GACL,GAAG,OAAO,MAAM;GAChB,GAAG,MAAM;GACV;EACF,GAED,CAAC,gBAAgB,SAAS,CAC3B;CAED,MAAM,eAAe,eACZ;EACL,GAAG,OAAO;EACV,GAAG;EACJ,GAED,CAAC,iBAAiB,UAAU,CAC7B;CAED,MAAM,UAAU,cACR,aAAa,YAAY,MAAM,EACrC,CAAC,YAAY,MAAM,CACpB;CAED,MAAM,aAAa,OAAO,KAAK,QAAQ,CAAC,SAAS;CACjD,MAAM,cAAc,YAAY,SAAS;CACzC,MAAM,eAAe,cAAc,eAAe;CAUlD,MAAM,uBAAuB,kBAA2C;AACtE,MAAI,aACF,QAAO,cAAc;AAEvB,MAAI,gBAAgB,UAClB,QAAO;AAET,SAAO,OAAO,cAAc;IAC3B;EAAC;EAAc;EAAc;EAAW;EAAO,CAAC;CAEnD,MAAM,eAAe,eACZ;EACL,OAAO;EACP,QAAQ;EACR,cAAc;EACf,GACD;EAAC;EAAa;EAAc;EAAqB,CAClD;AAED,QACE,oBAAC,QAAQ;EAAS,OAAO;YACtB,eACC,oBAAC;GACC,KAAK;GACL,WAAW,GAAG,YAAY,QAAQ,QAAQ,UAAU;GACpD,OAAO;IACL,GAAI,aAAa,UAAU;IAW3B,SAAS;IACV;GAEA;IACG,GAEN;GAEe"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ContextValue, Locale } from "./types.mjs";
|
|
2
2
|
import "react";
|
|
3
3
|
|
|
4
|
-
//#region src/providers/
|
|
4
|
+
//#region src/providers/config/context.d.ts
|
|
5
5
|
declare const DEFAULT_LOCALE: Required<Locale>;
|
|
6
6
|
declare const useConfig: () => ContextValue;
|
|
7
7
|
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.mts","names":[],"sources":["../../../src/providers/config/context.ts"],"mappings":";;;;cAMa,cAAA,EAAgB,QAAA,CAAS,MAAA;AAAA,cAezB,SAAA,QAAS,YAAA"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { createContext, useContext } from "react";
|
|
4
4
|
|
|
5
|
-
//#region src/providers/
|
|
5
|
+
//#region src/providers/config/context.ts
|
|
6
6
|
const DEFAULT_LOCALE = {
|
|
7
7
|
close: "닫기",
|
|
8
8
|
clear: "지우기",
|
|
@@ -13,7 +13,8 @@ const DEFAULT_LOCALE = {
|
|
|
13
13
|
};
|
|
14
14
|
const Context = createContext({
|
|
15
15
|
theme: {},
|
|
16
|
-
locale: DEFAULT_LOCALE
|
|
16
|
+
locale: DEFAULT_LOCALE,
|
|
17
|
+
getContainer: () => void 0
|
|
17
18
|
});
|
|
18
19
|
const useConfig = () => useContext(Context);
|
|
19
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.mjs","names":[],"sources":["../../../src/providers/
|
|
1
|
+
{"version":3,"file":"context.mjs","names":[],"sources":["../../../src/providers/config/context.ts"],"sourcesContent":["'use client';\n\nimport { createContext, useContext } from 'react';\n\nimport type { ContextValue, Locale } from './types';\n\nexport const DEFAULT_LOCALE: Required<Locale> = {\n close: '닫기',\n clear: '지우기',\n backToTop: '맨 위로',\n loading: '로딩 중',\n expand: '펼치기',\n collapse: '접기',\n};\n\nexport const Context = createContext<ContextValue>({\n theme: {},\n locale: DEFAULT_LOCALE,\n getContainer: () => undefined,\n});\n\nexport const useConfig = () => useContext(Context);\n"],"mappings":";;;;;AAMA,MAAa,iBAAmC;CAC9C,OAAO;CACP,OAAO;CACP,WAAW;CACX,SAAS;CACT,QAAQ;CACR,UAAU;CACX;AAED,MAAa,UAAU,cAA4B;CACjD,OAAO,EAAE;CACT,QAAQ;CACR,oBAAoB;CACrB,CAAC;AAEF,MAAa,kBAAkB,WAAW,QAAQ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region src/providers/
|
|
1
|
+
//#region src/providers/config/types.d.ts
|
|
2
2
|
interface ThemeToken {
|
|
3
3
|
colorPrimary?: string;
|
|
4
4
|
colorPrimaryForeground?: string;
|
|
@@ -35,6 +35,7 @@ interface Locale {
|
|
|
35
35
|
interface ContextValue {
|
|
36
36
|
theme: ThemeConfig;
|
|
37
37
|
locale: Locale;
|
|
38
|
+
getContainer: () => HTMLElement | undefined;
|
|
38
39
|
}
|
|
39
40
|
//#endregion
|
|
40
41
|
export { ContextValue, Locale, ThemeConfig, ThemeToken };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../src/providers/
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../src/providers/config/types.ts"],"mappings":";UAAiB,UAAA;EAEf,YAAA;EACA,sBAAA;EACA,eAAA;EACA,eAAA;EACA,SAAA;EACA,mBAAA;EACA,YAAA;EACA,sBAAA;EACA,cAAA;EACA,wBAAA;EACA,UAAA;EACA,oBAAA;EACA,WAAA;EACA,qBAAA;EACA,gBAAA;EACA,WAAA;EACA,UAAA;EACA,SAAA;EAGA,YAAA;AAAA;AAAA,UAGe,WAAA;EACf,KAAA,GAAQ,UAAA;EACR,IAAA;AAAA;AAAA,UAQe,MAAA;EACf,KAAA;EACA,KAAA;EACA,SAAA;EACA,OAAA;EACA,MAAA;EACA,QAAA;AAAA;AAAA,UAGe,YAAA;EACf,KAAA,EAAO,WAAA;EACP,MAAA,EAAQ,MAAA;EAUR,YAAA,QAAoB,WAAA;AAAA"}
|
package/dist/providers.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Locale, ThemeConfig, ThemeToken } from "./providers/
|
|
2
|
-
import { DEFAULT_LOCALE, useConfig } from "./providers/
|
|
3
|
-
import { Config, Props } from "./providers/
|
|
1
|
+
import { Locale, ThemeConfig, ThemeToken } from "./providers/config/types.mjs";
|
|
2
|
+
import { DEFAULT_LOCALE, useConfig } from "./providers/config/context.mjs";
|
|
3
|
+
import { Config, Props } from "./providers/config/config.mjs";
|
|
4
|
+
import "./providers/config/index.mjs";
|
|
4
5
|
export { Config, type Props as ConfigProps, DEFAULT_LOCALE, type Locale, type ThemeConfig, type ThemeToken, useConfig };
|
package/dist/providers.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_LOCALE, useConfig } from "./providers/
|
|
2
|
-
import Config from "./providers/
|
|
1
|
+
import { DEFAULT_LOCALE, useConfig } from "./providers/config/context.mjs";
|
|
2
|
+
import Config from "./providers/config/config.mjs";
|
|
3
3
|
|
|
4
4
|
export { Config, DEFAULT_LOCALE, useConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbpark/ui-kit",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Modern React UI component library built with TypeScript, Tailwind CSS, and Radix UI. Featuring atoms, molecules, organisms and layout templates for building beautiful interfaces.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.mts","names":[],"sources":["../../../src/providers/Config/context.ts"],"mappings":";;;;cAMa,cAAA,EAAgB,QAAA,CAAS,MAAA;AAAA,cAczB,SAAA,QAAS,YAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/providers/Config/index.tsx"],"mappings":";;;;;UAmDU,KAAA;EACR,KAAA,GAAQ,WAAA;EACR,MAAA,GAAS,MAAA;EACT,SAAA;EACA,QAAA,EAAU,KAAA,CAAM,SAAA;AAAA;AAAA,cAGZ,MAAA;EAAU,KAAA;EAAA,MAAA;EAAA,SAAA;EAAA;AAAA,GAAkD,KAAA,KAAK,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/providers/Config/index.tsx"],"sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\n\nimport { cn } from '@repo/ui/utils';\n\nimport { Context, DEFAULT_LOCALE, useConfig } from './context';\nimport type { Locale, ThemeConfig, ThemeToken } from './types';\n\nconst tokenToCssVar: Record<keyof ThemeToken, string> = {\n colorPrimary: '--primary',\n colorPrimaryForeground: '--primary-foreground',\n colorBackground: '--background',\n colorForeground: '--foreground',\n colorCard: '--card',\n colorCardForeground: '--card-foreground',\n colorPopover: '--popover',\n colorPopoverForeground: '--popover-foreground',\n colorSecondary: '--secondary',\n colorSecondaryForeground: '--secondary-foreground',\n colorMuted: '--muted',\n colorMutedForeground: '--muted-foreground',\n colorAccent: '--accent',\n colorAccentForeground: '--accent-foreground',\n colorDestructive: '--destructive',\n colorBorder: '--border',\n colorInput: '--input',\n colorRing: '--ring',\n borderRadius: '--radius',\n};\n\nconst buildCssVars = (token?: ThemeToken): React.CSSProperties => {\n if (!token) {\n return {};\n }\n\n const vars: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(token)) {\n if (value === undefined) {\n continue;\n }\n const cssVar = tokenToCssVar[key as keyof ThemeToken];\n if (cssVar) {\n vars[cssVar] = value;\n }\n }\n\n return vars as React.CSSProperties;\n};\n\ninterface Props {\n theme?: ThemeConfig;\n locale?: Locale;\n className?: string;\n children: React.ReactNode;\n}\n\nconst Config = ({ theme = {}, locale = {}, className, children }: Props) => {\n const parent = useConfig();\n\n // `theme` is typically a fresh inline object literal at the call site\n // (and `parent.theme` inherits the same problem from its own Config\n // ancestor), so depending on them directly meant mergedTheme/contextValue\n // got a new identity on every render regardless of whether the actual\n // values changed — every useConfig() consumer in the tree re-rendered on\n // every render of whatever's above this Config, which for the common\n // app-root usage is everything. Depend on a serialized key instead so\n // the memo only invalidates when the content actually changes; these\n // are small, string/boolean-only objects, so JSON.stringify is cheap.\n const themeKey = JSON.stringify(theme);\n const parentThemeKey = JSON.stringify(parent.theme);\n const localeKey = JSON.stringify(locale);\n const parentLocaleKey = JSON.stringify(parent.locale);\n\n const mergedTheme = useMemo<ThemeConfig>(\n () => ({\n ...parent.theme,\n ...theme,\n token: {\n ...parent.theme.token,\n ...theme.token,\n },\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [parentThemeKey, themeKey],\n );\n\n const mergedLocale = useMemo<Locale>(\n () => ({\n ...parent.locale,\n ...locale,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [parentLocaleKey, localeKey],\n );\n\n const contextValue = useMemo(\n () => ({ theme: mergedTheme, locale: mergedLocale }),\n [mergedTheme, mergedLocale],\n );\n\n const cssVars = useMemo(\n () => buildCssVars(mergedTheme.token),\n [mergedTheme.token],\n );\n\n const hasCssVars = Object.keys(cssVars).length > 0;\n const hasDarkMode = mergedTheme.dark !== undefined;\n const needsWrapper = hasCssVars || hasDarkMode || className;\n\n return (\n <Context.Provider value={contextValue}>\n {needsWrapper ? (\n <div\n className={cn(mergedTheme.dark && 'dark', className)}\n style={{\n ...(hasCssVars ? cssVars : undefined),\n // Keeps this element out of the layout box tree — so it\n // doesn't intercept flex/grid child relationships or break\n // height chains like min-h-screen — while custom properties\n // and the `dark` class selector still cascade to children\n // normally (inheritance and box generation are separate\n // mechanisms in CSS). Note this means className shouldn't be\n // used here for anything that needs a real box (padding,\n // background, borders); Config's className is meant for\n // theming hooks (the `dark` class, arbitrary selector hooks),\n // not layout.\n display: 'contents',\n }}\n >\n {children}\n </div>\n ) : (\n children\n )}\n </Context.Provider>\n );\n};\n\nexport default Config;\nexport { useConfig, DEFAULT_LOCALE };\nexport type { Props, Locale, ThemeConfig, ThemeToken };\n"],"mappings":";;;;;;;;AASA,MAAM,gBAAkD;CACtD,cAAc;CACd,wBAAwB;CACxB,iBAAiB;CACjB,iBAAiB;CACjB,WAAW;CACX,qBAAqB;CACrB,cAAc;CACd,wBAAwB;CACxB,gBAAgB;CAChB,0BAA0B;CAC1B,YAAY;CACZ,sBAAsB;CACtB,aAAa;CACb,uBAAuB;CACvB,kBAAkB;CAClB,aAAa;CACb,YAAY;CACZ,WAAW;CACX,cAAc;CACf;AAED,MAAM,gBAAgB,UAA4C;AAChE,KAAI,CAAC,MACH,QAAO,EAAE;CAGX,MAAM,OAA+B,EAAE;AAEvC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,EAAE;AAChD,MAAI,UAAU,OACZ;EAEF,MAAM,SAAS,cAAc;AAC7B,MAAI,OACF,MAAK,UAAU;;AAInB,QAAO;;AAUT,MAAM,UAAU,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,EAAE,WAAW,eAAsB;CAC1E,MAAM,SAAS,WAAW;CAW1B,MAAM,WAAW,KAAK,UAAU,MAAM;CACtC,MAAM,iBAAiB,KAAK,UAAU,OAAO,MAAM;CACnD,MAAM,YAAY,KAAK,UAAU,OAAO;CACxC,MAAM,kBAAkB,KAAK,UAAU,OAAO,OAAO;CAErD,MAAM,cAAc,eACX;EACL,GAAG,OAAO;EACV,GAAG;EACH,OAAO;GACL,GAAG,OAAO,MAAM;GAChB,GAAG,MAAM;GACV;EACF,GAED,CAAC,gBAAgB,SAAS,CAC3B;CAED,MAAM,eAAe,eACZ;EACL,GAAG,OAAO;EACV,GAAG;EACJ,GAED,CAAC,iBAAiB,UAAU,CAC7B;CAED,MAAM,eAAe,eACZ;EAAE,OAAO;EAAa,QAAQ;EAAc,GACnD,CAAC,aAAa,aAAa,CAC5B;CAED,MAAM,UAAU,cACR,aAAa,YAAY,MAAM,EACrC,CAAC,YAAY,MAAM,CACpB;CAED,MAAM,aAAa,OAAO,KAAK,QAAQ,CAAC,SAAS;CACjD,MAAM,cAAc,YAAY,SAAS;CACzC,MAAM,eAAe,cAAc,eAAe;AAElD,QACE,oBAAC,QAAQ;EAAS,OAAO;YACtB,eACC,oBAAC;GACC,WAAW,GAAG,YAAY,QAAQ,QAAQ,UAAU;GACpD,OAAO;IACL,GAAI,aAAa,UAAU;IAW3B,SAAS;IACV;GAEA;IACG,GAEN;GAEe"}
|