@karakuri-ui/react 0.2.4 → 0.3.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/ui/accordion.d.mts +1 -10
- package/dist/components/ui/accordion.d.ts +1 -10
- package/dist/components/ui/accordion.js +2 -7
- package/dist/components/ui/accordion.js.map +1 -1
- package/dist/components/ui/accordion.mjs +2 -7
- package/dist/components/ui/accordion.mjs.map +1 -1
- package/dist/components/ui/alert.d.mts +3 -12
- package/dist/components/ui/alert.d.ts +3 -12
- package/dist/components/ui/alert.js +2 -8
- package/dist/components/ui/alert.js.map +1 -1
- package/dist/components/ui/alert.mjs +2 -7
- package/dist/components/ui/alert.mjs.map +1 -1
- package/dist/components/ui/avatar.d.mts +1 -10
- package/dist/components/ui/avatar.d.ts +1 -10
- package/dist/components/ui/avatar.js +3 -8
- package/dist/components/ui/avatar.js.map +1 -1
- package/dist/components/ui/avatar.mjs +3 -8
- package/dist/components/ui/avatar.mjs.map +1 -1
- package/dist/components/ui/breadcrumb.d.mts +1 -12
- package/dist/components/ui/breadcrumb.d.ts +1 -12
- package/dist/components/ui/breadcrumb.js +2 -10
- package/dist/components/ui/breadcrumb.js.map +1 -1
- package/dist/components/ui/breadcrumb.mjs +2 -10
- package/dist/components/ui/breadcrumb.mjs.map +1 -1
- package/dist/components/ui/card.d.mts +1 -18
- package/dist/components/ui/card.d.ts +1 -18
- package/dist/components/ui/card.js +2 -11
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/card.mjs +2 -11
- package/dist/components/ui/card.mjs.map +1 -1
- package/dist/components/ui/chart.d.mts +2 -18
- package/dist/components/ui/chart.d.ts +2 -18
- package/dist/components/ui/chart.js +2 -17
- package/dist/components/ui/chart.js.map +1 -1
- package/dist/components/ui/chart.mjs +2 -16
- package/dist/components/ui/chart.mjs.map +1 -1
- package/dist/components/ui/drawer.d.mts +2 -17
- package/dist/components/ui/drawer.d.ts +2 -17
- package/dist/components/ui/drawer.js +1 -15
- package/dist/components/ui/drawer.js.map +1 -1
- package/dist/components/ui/drawer.mjs +1 -14
- package/dist/components/ui/drawer.mjs.map +1 -1
- package/dist/components/ui/dropdown.d.mts +1 -26
- package/dist/components/ui/dropdown.d.ts +1 -26
- package/dist/components/ui/dropdown.js +1 -16
- package/dist/components/ui/dropdown.js.map +1 -1
- package/dist/components/ui/dropdown.mjs +1 -16
- package/dist/components/ui/dropdown.mjs.map +1 -1
- package/dist/components/ui/field.d.mts +1 -8
- package/dist/components/ui/field.d.ts +1 -8
- package/dist/components/ui/field.js +2 -7
- package/dist/components/ui/field.js.map +1 -1
- package/dist/components/ui/field.mjs +2 -7
- package/dist/components/ui/field.mjs.map +1 -1
- package/dist/components/ui/index.d.mts +4 -4
- package/dist/components/ui/index.d.ts +4 -4
- package/dist/components/ui/index.js +0 -8
- package/dist/components/ui/index.js.map +1 -1
- package/dist/components/ui/index.mjs +4 -8
- package/dist/components/ui/index.mjs.map +1 -1
- package/dist/components/ui/metric-card.d.mts +1 -16
- package/dist/components/ui/metric-card.d.ts +1 -16
- package/dist/components/ui/metric-card.js +2 -10
- package/dist/components/ui/metric-card.js.map +1 -1
- package/dist/components/ui/metric-card.mjs +2 -10
- package/dist/components/ui/metric-card.mjs.map +1 -1
- package/dist/components/ui/modal.d.mts +2 -32
- package/dist/components/ui/modal.d.ts +2 -32
- package/dist/components/ui/modal.js +2 -27
- package/dist/components/ui/modal.js.map +1 -1
- package/dist/components/ui/modal.mjs +2 -27
- package/dist/components/ui/modal.mjs.map +1 -1
- package/dist/components/ui/navigation-menu.d.mts +1 -20
- package/dist/components/ui/navigation-menu.d.ts +1 -20
- package/dist/components/ui/navigation-menu.js +2 -12
- package/dist/components/ui/navigation-menu.js.map +1 -1
- package/dist/components/ui/navigation-menu.mjs +2 -12
- package/dist/components/ui/navigation-menu.mjs.map +1 -1
- package/dist/components/ui/pagination.d.mts +1 -18
- package/dist/components/ui/pagination.d.ts +1 -18
- package/dist/components/ui/pagination.js +2 -13
- package/dist/components/ui/pagination.js.map +1 -1
- package/dist/components/ui/pagination.mjs +2 -13
- package/dist/components/ui/pagination.mjs.map +1 -1
- package/dist/components/ui/popover.d.mts +3 -15
- package/dist/components/ui/popover.d.ts +3 -15
- package/dist/components/ui/popover.js +1 -11
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/popover.mjs +1 -10
- package/dist/components/ui/popover.mjs.map +1 -1
- package/dist/components/ui/radio-group.d.mts +1 -6
- package/dist/components/ui/radio-group.d.ts +1 -6
- package/dist/components/ui/radio-group.js +2 -5
- package/dist/components/ui/radio-group.js.map +1 -1
- package/dist/components/ui/radio-group.mjs +2 -5
- package/dist/components/ui/radio-group.mjs.map +1 -1
- package/dist/components/ui/segmented.d.mts +1 -6
- package/dist/components/ui/segmented.d.ts +1 -6
- package/dist/components/ui/segmented.js +2 -5
- package/dist/components/ui/segmented.js.map +1 -1
- package/dist/components/ui/segmented.mjs +2 -5
- package/dist/components/ui/segmented.mjs.map +1 -1
- package/dist/components/ui/select.d.mts +4 -15
- package/dist/components/ui/select.d.ts +4 -15
- package/dist/components/ui/select.js +5 -14
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/select.mjs +5 -14
- package/dist/components/ui/select.mjs.map +1 -1
- package/dist/components/ui/table.d.mts +1 -15
- package/dist/components/ui/table.d.ts +1 -15
- package/dist/components/ui/table.js +2 -11
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/table.mjs +2 -11
- package/dist/components/ui/table.mjs.map +1 -1
- package/dist/components/ui/tabs.d.mts +1 -10
- package/dist/components/ui/tabs.d.ts +1 -10
- package/dist/components/ui/tabs.js +1 -6
- package/dist/components/ui/tabs.js.map +1 -1
- package/dist/components/ui/tabs.mjs +1 -6
- package/dist/components/ui/tabs.mjs.map +1 -1
- package/dist/components/ui/toggle-group.d.mts +1 -6
- package/dist/components/ui/toggle-group.d.ts +1 -6
- package/dist/components/ui/toggle-group.js +2 -5
- package/dist/components/ui/toggle-group.js.map +1 -1
- package/dist/components/ui/toggle-group.mjs +2 -5
- package/dist/components/ui/toggle-group.mjs.map +1 -1
- package/dist/components/ui/tooltip.d.mts +3 -14
- package/dist/components/ui/tooltip.d.ts +3 -14
- package/dist/components/ui/tooltip.js +1 -10
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/components/ui/tooltip.mjs +1 -9
- package/dist/components/ui/tooltip.mjs.map +1 -1
- package/dist/lib/code-generator.d.mts +60 -0
- package/dist/lib/code-generator.d.ts +60 -0
- package/dist/lib/code-generator.js +224 -0
- package/dist/lib/code-generator.js.map +1 -0
- package/dist/lib/code-generator.mjs +159 -0
- package/dist/lib/code-generator.mjs.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ui/pagination.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// ─── Built-in Icons ──────────────────────────────────────\n\nfunction ChevronLeftIcon({ className }: { className?: string }) {\n return (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M15 19l-7-7 7-7\" />\n </svg>\n )\n}\n\nfunction ChevronRightIcon({ className }: { className?: string }) {\n return (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M9 5l7 7-7 7\" />\n </svg>\n )\n}\n\nfunction ChevronsLeftIcon({ className }: { className?: string }) {\n return (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M11 17l-5-5 5-5M18 17l-5-5 5-5\" />\n </svg>\n )\n}\n\nfunction ChevronsRightIcon({ className }: { className?: string }) {\n return (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M13 7l5 5-5 5M6 7l5 5-5 5\" />\n </svg>\n )\n}\n\nfunction EllipsisIcon({ className }: { className?: string }) {\n return (\n <svg\n className={className}\n fill=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <circle cx=\"6\" cy=\"12\" r=\"1.5\" />\n <circle cx=\"12\" cy=\"12\" r=\"1.5\" />\n <circle cx=\"18\" cy=\"12\" r=\"1.5\" />\n </svg>\n )\n}\n\n// ─── usePagination Hook ──────────────────────────────────\n\nexport type PaginationRange = (number | 'dots')[]\n\nexport interface UsePaginationProps {\n /** Total number of pages */\n total: number\n /** Number of siblings on each side of current page */\n siblings?: number\n /** Number of boundary pages at start/end */\n boundaries?: number\n /** Current active page (1-based) */\n page: number\n}\n\nfunction range(start: number, end: number): number[] {\n const result: number[] = []\n for (let i = start; i <= end; i++) result.push(i)\n return result\n}\n\nexport function usePagination({\n total,\n siblings = 1,\n boundaries = 1,\n page,\n}: UsePaginationProps): PaginationRange {\n if (total <= 0) return []\n\n const totalPageNumbers = siblings * 2 + 3 + boundaries * 2\n if (totalPageNumbers >= total) {\n return range(1, total)\n }\n\n const leftSiblingIndex = Math.max(page - siblings, boundaries + 1)\n const rightSiblingIndex = Math.min(page + siblings, total - boundaries)\n\n const showLeftDots = leftSiblingIndex > boundaries + 2\n const showRightDots = rightSiblingIndex < total - boundaries - 1\n\n if (!showLeftDots && showRightDots) {\n const leftItemCount = 3 + 2 * siblings + boundaries\n const leftRange = range(1, leftItemCount)\n return [...leftRange, 'dots' as const, ...range(total - boundaries + 1, total)]\n }\n\n if (showLeftDots && !showRightDots) {\n const rightItemCount = 3 + 2 * siblings + boundaries\n const rightRange = range(total - rightItemCount + 1, total)\n return [...range(1, boundaries), 'dots' as const, ...rightRange]\n }\n\n return [\n ...range(1, boundaries),\n 'dots' as const,\n ...range(leftSiblingIndex, rightSiblingIndex),\n 'dots' as const,\n ...range(total - boundaries + 1, total),\n ]\n}\n\n// ─── Context ─────────────────────────────────────────────\n\nexport type PaginationSize = 'xs' | 'sm' | 'default' | 'lg' | 'xl'\nexport type PaginationVariant = 'default' | 'outline' | 'ghost'\nexport type PaginationColor = 'default' | 'primary'\nexport type PaginationRadius = 'sm' | 'base' | 'md' | 'lg' | 'xl' | 'full'\n\ntype PaginationContextValue = {\n page: number\n total: number\n siblings: number\n boundaries: number\n size: PaginationSize\n variant: PaginationVariant\n color: PaginationColor\n radius: PaginationRadius\n disabled: boolean\n loop: boolean\n onPageChange: (page: number) => void\n paginationRange: PaginationRange\n}\n\nconst PaginationContext = React.createContext<PaginationContextValue | null>(null)\n\nfunction usePaginationContext() {\n const ctx = React.useContext(PaginationContext)\n if (!ctx) throw new Error('Pagination components must be used within <Pagination>')\n return ctx\n}\n\n// ─── Size Map ────────────────────────────────────────────\n\nconst paginationSizeMap = {\n xs: { item: 'h-7 min-w-7 text-xs', icon: 'icon-xs', gap: 'gap-1' },\n sm: { item: 'h-8 min-w-8 text-sm', icon: 'icon-xs', gap: 'gap-1' },\n default: { item: 'h-9 min-w-9 text-md', icon: 'icon-sm', gap: 'gap-1' },\n lg: { item: 'h-10 min-w-10 text-md', icon: 'icon-sm', gap: 'gap-1.5' },\n xl: { item: 'h-12 min-w-12 text-base', icon: 'icon-sm', gap: 'gap-1.5' },\n} as const\n\n// ─── Item Variants (CVA) ─────────────────────────────────\n\nconst paginationItemVariants = cva(\n 'inline-flex items-center justify-center select-none transition-colors duration-fast font-semibold focus-visible:focus-ring',\n {\n variants: {\n radius: {\n sm: 'rounded-sm',\n base: 'rounded',\n md: 'rounded-md',\n lg: 'rounded-lg',\n xl: 'rounded-xl',\n full: 'rounded-full',\n },\n },\n defaultVariants: {\n radius: 'md',\n },\n }\n)\n\n// ─── Variant Style Helpers ───────────────────────────────\n\n// Active color maps\nconst activeColorMap = {\n default: 'bg-foreground text-background',\n primary: 'bg-primary text-primary-foreground',\n} as const\n\nconst ghostActiveColorMap = {\n default: 'bg-background-muted text-foreground font-bold',\n primary: 'bg-background-muted text-primary',\n} as const\n\nfunction getItemClasses(variant: PaginationVariant, color: PaginationColor, isActive: boolean, disabled: boolean) {\n if (disabled) {\n return variant === 'outline'\n ? 'border border-border text-disabled-foreground pointer-events-none opacity-50'\n : 'border border-transparent text-disabled-foreground pointer-events-none opacity-50'\n }\n if (isActive) {\n switch (variant) {\n case 'outline':\n return `border ${color === 'default' ? 'border-foreground' : 'border-primary'} ${activeColorMap[color]}`\n case 'ghost':\n return `border border-transparent ${ghostActiveColorMap[color]}`\n case 'default':\n default:\n return `border border-transparent ${activeColorMap[color]}`\n }\n }\n switch (variant) {\n case 'outline':\n return 'border border-border text-text-muted hover:bg-background-muted hover:text-foreground'\n case 'ghost':\n return 'border border-transparent text-text-muted hover:bg-background-muted hover:text-foreground'\n case 'default':\n default:\n return 'border border-transparent text-text-muted hover:bg-background-muted hover:text-foreground'\n }\n}\n\n// ─── Pagination (Root) ───────────────────────────────────\n\nexport interface PaginationProps extends Omit<React.ComponentPropsWithoutRef<'nav'>, 'onChange'> {\n /** Total number of pages */\n total?: number\n /** Controlled active page (1-based) */\n value?: number\n /** Initial page for uncontrolled mode */\n defaultValue?: number\n /** Page change callback */\n onChange?: (page: number) => void\n /** Number of siblings on each side of current page */\n siblings?: number\n /** Number of boundary pages at start/end */\n boundaries?: number\n /** Component size */\n size?: PaginationSize\n /** Visual variant */\n variant?: PaginationVariant\n /** Active page color */\n color?: PaginationColor\n /** Border radius */\n radius?: PaginationRadius\n /** Disable all interactions */\n disabled?: boolean\n /** Show previous/next controls */\n withControls?: boolean\n /** Show first/last controls */\n withEdges?: boolean\n /** Loop from last to first and vice versa */\n loop?: boolean\n}\n\nconst PaginationRoot = React.forwardRef<HTMLElement, PaginationProps>(\n ({\n className,\n total = 1,\n value,\n defaultValue = 1,\n onChange,\n siblings = 1,\n boundaries = 1,\n size = 'default',\n variant = 'default',\n color = 'default',\n radius = 'md',\n disabled = false,\n withControls = true,\n withEdges = false,\n loop = false,\n children,\n ...props\n }, ref) => {\n // Controlled / Uncontrolled\n const [internalPage, setInternalPage] = React.useState(defaultValue)\n const isControlled = value !== undefined\n const page = isControlled ? value : internalPage\n\n const handlePageChange = React.useCallback((newPage: number) => {\n if (disabled) return\n const clamped = Math.max(1, Math.min(total, newPage))\n if (!isControlled) setInternalPage(clamped)\n onChange?.(clamped)\n }, [disabled, total, isControlled, onChange])\n\n const paginationRange = usePagination({ total, siblings, boundaries, page })\n\n const contextValue = React.useMemo<PaginationContextValue>(() => ({\n page,\n total,\n siblings,\n boundaries,\n size,\n variant,\n color,\n radius,\n disabled,\n loop,\n onPageChange: handlePageChange,\n paginationRange,\n }), [page, total, siblings, boundaries, size, variant, color, radius, disabled, loop, handlePageChange, paginationRange])\n\n return (\n <PaginationContext.Provider value={contextValue}>\n <nav\n ref={ref}\n role=\"navigation\"\n aria-label=\"pagination\"\n className={cn('', className)}\n {...props}\n >\n {children ?? (\n <PaginationContent>\n {withEdges && <PaginationItem><PaginationFirst /></PaginationItem>}\n {withControls && <PaginationItem><PaginationPrevious /></PaginationItem>}\n <PaginationItems />\n {withControls && <PaginationItem><PaginationNext /></PaginationItem>}\n {withEdges && <PaginationItem><PaginationLast /></PaginationItem>}\n </PaginationContent>\n )}\n </nav>\n </PaginationContext.Provider>\n )\n }\n)\nPaginationRoot.displayName = 'Pagination'\n\n// ─── PaginationContent ───────────────────────────────────\n\nconst PaginationContent = React.forwardRef<HTMLUListElement, React.ComponentPropsWithoutRef<'ul'>>(\n ({ className, ...props }, ref) => {\n const { size } = usePaginationContext()\n const sizeClass = paginationSizeMap[size]\n return (\n <ul\n ref={ref}\n className={cn('flex flex-wrap items-center', sizeClass.gap, className)}\n {...props}\n />\n )\n }\n)\nPaginationContent.displayName = 'PaginationContent'\n\n// ─── PaginationItem ──────────────────────────────────────\n\nconst PaginationItem = React.forwardRef<HTMLLIElement, React.ComponentPropsWithoutRef<'li'>>(\n ({ className, ...props }, ref) => (\n <li ref={ref} className={cn('', className)} {...props} />\n )\n)\nPaginationItem.displayName = 'PaginationItem'\n\n// ─── PaginationLink ──────────────────────────────────────\n\nexport interface PaginationLinkProps extends React.ComponentPropsWithoutRef<'button'> {\n /** Page number this link navigates to */\n page: number\n /** Whether this page is currently active (auto-detected from context if omitted) */\n isActive?: boolean\n}\n\nconst PaginationLink = React.forwardRef<HTMLButtonElement, PaginationLinkProps>(\n ({ className, page: targetPage, isActive: isActiveProp, ...props }, ref) => {\n const ctx = usePaginationContext()\n const isActive = isActiveProp ?? (ctx.page === targetPage)\n const sizeClass = paginationSizeMap[ctx.size]\n\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-current={isActive ? 'page' : undefined}\n aria-label={`Go to page ${targetPage}`}\n disabled={ctx.disabled}\n onClick={() => ctx.onPageChange(targetPage)}\n className={cn(\n paginationItemVariants({ radius: ctx.radius }),\n sizeClass.item,\n getItemClasses(ctx.variant, ctx.color, isActive, ctx.disabled),\n className\n )}\n {...props}\n >\n {targetPage}\n </button>\n )\n }\n)\nPaginationLink.displayName = 'PaginationLink'\n\n// ─── PaginationPrevious ──────────────────────────────────\n\nexport interface PaginationPreviousProps extends React.ComponentPropsWithoutRef<'button'> {\n /** Custom icon */\n icon?: React.ReactNode\n}\n\nconst PaginationPrevious = React.forwardRef<HTMLButtonElement, PaginationPreviousProps>(\n ({ className, icon, ...props }, ref) => {\n const ctx = usePaginationContext()\n const sizeClass = paginationSizeMap[ctx.size]\n const isDisabled = ctx.disabled || (!ctx.loop && ctx.page <= 1)\n\n const handleClick = () => {\n if (ctx.page <= 1) {\n if (ctx.loop) ctx.onPageChange(ctx.total)\n } else {\n ctx.onPageChange(ctx.page - 1)\n }\n }\n\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-label=\"Go to previous page\"\n disabled={isDisabled}\n onClick={handleClick}\n className={cn(\n paginationItemVariants({ radius: ctx.radius }),\n sizeClass.item,\n getItemClasses(ctx.variant, ctx.color, false, isDisabled),\n className\n )}\n {...props}\n >\n {icon ?? <ChevronLeftIcon className={sizeClass.icon} />}\n </button>\n )\n }\n)\nPaginationPrevious.displayName = 'PaginationPrevious'\n\n// ─── PaginationNext ──────────────────────────────────────\n\nexport interface PaginationNextProps extends React.ComponentPropsWithoutRef<'button'> {\n /** Custom icon */\n icon?: React.ReactNode\n}\n\nconst PaginationNext = React.forwardRef<HTMLButtonElement, PaginationNextProps>(\n ({ className, icon, ...props }, ref) => {\n const ctx = usePaginationContext()\n const sizeClass = paginationSizeMap[ctx.size]\n const isDisabled = ctx.disabled || (!ctx.loop && ctx.page >= ctx.total)\n\n const handleClick = () => {\n if (ctx.page >= ctx.total) {\n if (ctx.loop) ctx.onPageChange(1)\n } else {\n ctx.onPageChange(ctx.page + 1)\n }\n }\n\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-label=\"Go to next page\"\n disabled={isDisabled}\n onClick={handleClick}\n className={cn(\n paginationItemVariants({ radius: ctx.radius }),\n sizeClass.item,\n getItemClasses(ctx.variant, ctx.color, false, isDisabled),\n className\n )}\n {...props}\n >\n {icon ?? <ChevronRightIcon className={sizeClass.icon} />}\n </button>\n )\n }\n)\nPaginationNext.displayName = 'PaginationNext'\n\n// ─── PaginationFirst ─────────────────────────────────────\n\nexport interface PaginationFirstProps extends React.ComponentPropsWithoutRef<'button'> {\n /** Custom icon */\n icon?: React.ReactNode\n}\n\nconst PaginationFirst = React.forwardRef<HTMLButtonElement, PaginationFirstProps>(\n ({ className, icon, ...props }, ref) => {\n const ctx = usePaginationContext()\n const sizeClass = paginationSizeMap[ctx.size]\n const isDisabled = ctx.disabled || ctx.page <= 1\n\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-label=\"Go to first page\"\n disabled={isDisabled}\n onClick={() => ctx.onPageChange(1)}\n className={cn(\n paginationItemVariants({ radius: ctx.radius }),\n sizeClass.item,\n getItemClasses(ctx.variant, ctx.color, false, isDisabled),\n className\n )}\n {...props}\n >\n {icon ?? <ChevronsLeftIcon className={sizeClass.icon} />}\n </button>\n )\n }\n)\nPaginationFirst.displayName = 'PaginationFirst'\n\n// ─── PaginationLast ──────────────────────────────────────\n\nexport interface PaginationLastProps extends React.ComponentPropsWithoutRef<'button'> {\n /** Custom icon */\n icon?: React.ReactNode\n}\n\nconst PaginationLast = React.forwardRef<HTMLButtonElement, PaginationLastProps>(\n ({ className, icon, ...props }, ref) => {\n const ctx = usePaginationContext()\n const sizeClass = paginationSizeMap[ctx.size]\n const isDisabled = ctx.disabled || ctx.page >= ctx.total\n\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-label=\"Go to last page\"\n disabled={isDisabled}\n onClick={() => ctx.onPageChange(ctx.total)}\n className={cn(\n paginationItemVariants({ radius: ctx.radius }),\n sizeClass.item,\n getItemClasses(ctx.variant, ctx.color, false, isDisabled),\n className\n )}\n {...props}\n >\n {icon ?? <ChevronsRightIcon className={sizeClass.icon} />}\n </button>\n )\n }\n)\nPaginationLast.displayName = 'PaginationLast'\n\n// ─── PaginationEllipsis ──────────────────────────────────\n\nconst PaginationEllipsis = React.forwardRef<HTMLSpanElement, React.ComponentPropsWithoutRef<'span'>>(\n ({ className, ...props }, ref) => {\n const ctx = usePaginationContext()\n const sizeClass = paginationSizeMap[ctx.size]\n return (\n <span\n ref={ref}\n aria-hidden=\"true\"\n className={cn(\n 'inline-flex items-center justify-center text-text-muted',\n sizeClass.item,\n className\n )}\n {...props}\n >\n <EllipsisIcon className={sizeClass.icon} />\n <span className=\"sr-only\">More pages</span>\n </span>\n )\n }\n)\nPaginationEllipsis.displayName = 'PaginationEllipsis'\n\n// ─── PaginationItems (Convenience) ───────────────────────\n\nconst PaginationItems = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(\n ({ className, ...props }, ref) => {\n const ctx = usePaginationContext()\n return (\n <div ref={ref} className={cn('contents', className)} {...props}>\n {ctx.paginationRange.map((item, index) => (\n <PaginationItem key={`${item}-${index}`}>\n {item === 'dots' ? (\n <PaginationEllipsis />\n ) : (\n <PaginationLink page={item} />\n )}\n </PaginationItem>\n ))}\n </div>\n )\n }\n)\nPaginationItems.displayName = 'PaginationItems'\n\n// ─── Exports ─────────────────────────────────────────────\n\n// ─── Namespace ──────────────────────────────────────────\nconst Pagination = Object.assign(PaginationRoot, {\n Content: PaginationContent,\n Item: PaginationItem,\n Link: PaginationLink,\n Previous: PaginationPrevious,\n Next: PaginationNext,\n First: PaginationFirst,\n Last: PaginationLast,\n Ellipsis: PaginationEllipsis,\n Items: PaginationItems,\n})\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace Pagination {\n export type LinkProps = PaginationLinkProps\n export type PreviousProps = PaginationPreviousProps\n export type NextProps = PaginationNextProps\n export type FirstProps = PaginationFirstProps\n export type LastProps = PaginationLastProps\n}\n\nexport {\n Pagination,\n PaginationContent,\n PaginationItem,\n PaginationLink,\n PaginationPrevious,\n PaginationNext,\n PaginationFirst,\n PaginationLast,\n PaginationEllipsis,\n PaginationItems,\n paginationItemVariants,\n paginationSizeMap,\n}\n"],"mappings":";AAEA,YAAY,WAAW;AACvB,SAAS,WAA8B;AACvC,SAAS,UAAU;AAInB,SAAS,gBAAgB,EAAE,UAAU,GAA2B;AAC9D,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,QAAO;AAAA,MACP,aAAa;AAAA;AAAA,IAEb,oCAAC,UAAK,eAAc,SAAQ,gBAAe,SAAQ,GAAE,mBAAkB;AAAA,EACzE;AAEJ;AAEA,SAAS,iBAAiB,EAAE,UAAU,GAA2B;AAC/D,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,QAAO;AAAA,MACP,aAAa;AAAA;AAAA,IAEb,oCAAC,UAAK,eAA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AM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,UAAU;AAAA,EACV,OAAO;AACT,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/pagination.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// ─── Built-in Icons ──────────────────────────────────────\n\nfunction ChevronLeftIcon({ className }: { className?: string }) {\n return (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M15 19l-7-7 7-7\" />\n </svg>\n )\n}\n\nfunction ChevronRightIcon({ className }: { className?: string }) {\n return (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M9 5l7 7-7 7\" />\n </svg>\n )\n}\n\nfunction ChevronsLeftIcon({ className }: { className?: string }) {\n return (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M11 17l-5-5 5-5M18 17l-5-5 5-5\" />\n </svg>\n )\n}\n\nfunction ChevronsRightIcon({ className }: { className?: string }) {\n return (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M13 7l5 5-5 5M6 7l5 5-5 5\" />\n </svg>\n )\n}\n\nfunction EllipsisIcon({ className }: { className?: string }) {\n return (\n <svg\n className={className}\n fill=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <circle cx=\"6\" cy=\"12\" r=\"1.5\" />\n <circle cx=\"12\" cy=\"12\" r=\"1.5\" />\n <circle cx=\"18\" cy=\"12\" r=\"1.5\" />\n </svg>\n )\n}\n\n// ─── usePagination Hook ──────────────────────────────────\n\nexport type PaginationRange = (number | 'dots')[]\n\nexport interface UsePaginationProps {\n /** Total number of pages */\n total: number\n /** Number of siblings on each side of current page */\n siblings?: number\n /** Number of boundary pages at start/end */\n boundaries?: number\n /** Current active page (1-based) */\n page: number\n}\n\nfunction range(start: number, end: number): number[] {\n const result: number[] = []\n for (let i = start; i <= end; i++) result.push(i)\n return result\n}\n\nexport function usePagination({\n total,\n siblings = 1,\n boundaries = 1,\n page,\n}: UsePaginationProps): PaginationRange {\n if (total <= 0) return []\n\n const totalPageNumbers = siblings * 2 + 3 + boundaries * 2\n if (totalPageNumbers >= total) {\n return range(1, total)\n }\n\n const leftSiblingIndex = Math.max(page - siblings, boundaries + 1)\n const rightSiblingIndex = Math.min(page + siblings, total - boundaries)\n\n const showLeftDots = leftSiblingIndex > boundaries + 2\n const showRightDots = rightSiblingIndex < total - boundaries - 1\n\n if (!showLeftDots && showRightDots) {\n const leftItemCount = 3 + 2 * siblings + boundaries\n const leftRange = range(1, leftItemCount)\n return [...leftRange, 'dots' as const, ...range(total - boundaries + 1, total)]\n }\n\n if (showLeftDots && !showRightDots) {\n const rightItemCount = 3 + 2 * siblings + boundaries\n const rightRange = range(total - rightItemCount + 1, total)\n return [...range(1, boundaries), 'dots' as const, ...rightRange]\n }\n\n return [\n ...range(1, boundaries),\n 'dots' as const,\n ...range(leftSiblingIndex, rightSiblingIndex),\n 'dots' as const,\n ...range(total - boundaries + 1, total),\n ]\n}\n\n// ─── Context ─────────────────────────────────────────────\n\nexport type PaginationSize = 'xs' | 'sm' | 'default' | 'lg' | 'xl'\nexport type PaginationVariant = 'default' | 'outline' | 'ghost'\nexport type PaginationColor = 'default' | 'primary'\nexport type PaginationRadius = 'sm' | 'base' | 'md' | 'lg' | 'xl' | 'full'\n\ntype PaginationContextValue = {\n page: number\n total: number\n siblings: number\n boundaries: number\n size: PaginationSize\n variant: PaginationVariant\n color: PaginationColor\n radius: PaginationRadius\n disabled: boolean\n loop: boolean\n onPageChange: (page: number) => void\n paginationRange: PaginationRange\n}\n\nconst PaginationContext = React.createContext<PaginationContextValue | null>(null)\n\nfunction usePaginationContext() {\n const ctx = React.useContext(PaginationContext)\n if (!ctx) throw new Error('Pagination components must be used within <Pagination>')\n return ctx\n}\n\n// ─── Size Map ────────────────────────────────────────────\n\nconst paginationSizeMap = {\n xs: { item: 'h-7 min-w-7 text-xs', icon: 'icon-xs', gap: 'gap-1' },\n sm: { item: 'h-8 min-w-8 text-sm', icon: 'icon-xs', gap: 'gap-1' },\n default: { item: 'h-9 min-w-9 text-md', icon: 'icon-sm', gap: 'gap-1' },\n lg: { item: 'h-10 min-w-10 text-md', icon: 'icon-sm', gap: 'gap-1.5' },\n xl: { item: 'h-12 min-w-12 text-base', icon: 'icon-sm', gap: 'gap-1.5' },\n} as const\n\n// ─── Item Variants (CVA) ─────────────────────────────────\n\nconst paginationItemVariants = cva(\n 'inline-flex items-center justify-center select-none transition-colors duration-fast font-semibold focus-visible:focus-ring',\n {\n variants: {\n radius: {\n sm: 'rounded-sm',\n base: 'rounded',\n md: 'rounded-md',\n lg: 'rounded-lg',\n xl: 'rounded-xl',\n full: 'rounded-full',\n },\n },\n defaultVariants: {\n radius: 'md',\n },\n }\n)\n\n// ─── Variant Style Helpers ───────────────────────────────\n\n// Active color maps\nconst activeColorMap = {\n default: 'bg-foreground text-background',\n primary: 'bg-primary text-primary-foreground',\n} as const\n\nconst ghostActiveColorMap = {\n default: 'bg-background-muted text-foreground font-bold',\n primary: 'bg-background-muted text-primary',\n} as const\n\nfunction getItemClasses(variant: PaginationVariant, color: PaginationColor, isActive: boolean, disabled: boolean) {\n if (disabled) {\n return variant === 'outline'\n ? 'border border-border text-disabled-foreground pointer-events-none opacity-50'\n : 'border border-transparent text-disabled-foreground pointer-events-none opacity-50'\n }\n if (isActive) {\n switch (variant) {\n case 'outline':\n return `border ${color === 'default' ? 'border-foreground' : 'border-primary'} ${activeColorMap[color]}`\n case 'ghost':\n return `border border-transparent ${ghostActiveColorMap[color]}`\n case 'default':\n default:\n return `border border-transparent ${activeColorMap[color]}`\n }\n }\n switch (variant) {\n case 'outline':\n return 'border border-border text-text-muted hover:bg-background-muted hover:text-foreground'\n case 'ghost':\n return 'border border-transparent text-text-muted hover:bg-background-muted hover:text-foreground'\n case 'default':\n default:\n return 'border border-transparent text-text-muted hover:bg-background-muted hover:text-foreground'\n }\n}\n\n// ─── Pagination (Root) ───────────────────────────────────\n\nexport interface PaginationProps extends Omit<React.ComponentPropsWithoutRef<'nav'>, 'onChange'> {\n /** Total number of pages */\n total?: number\n /** Controlled active page (1-based) */\n value?: number\n /** Initial page for uncontrolled mode */\n defaultValue?: number\n /** Page change callback */\n onChange?: (page: number) => void\n /** Number of siblings on each side of current page */\n siblings?: number\n /** Number of boundary pages at start/end */\n boundaries?: number\n /** Component size */\n size?: PaginationSize\n /** Visual variant */\n variant?: PaginationVariant\n /** Active page color */\n color?: PaginationColor\n /** Border radius */\n radius?: PaginationRadius\n /** Disable all interactions */\n disabled?: boolean\n /** Show previous/next controls */\n withControls?: boolean\n /** Show first/last controls */\n withEdges?: boolean\n /** Loop from last to first and vice versa */\n loop?: boolean\n}\n\nconst Pagination = React.forwardRef<HTMLElement, PaginationProps>(\n ({\n className,\n total = 1,\n value,\n defaultValue = 1,\n onChange,\n siblings = 1,\n boundaries = 1,\n size = 'default',\n variant = 'default',\n color = 'default',\n radius = 'md',\n disabled = false,\n withControls = true,\n withEdges = false,\n loop = false,\n children,\n ...props\n }, ref) => {\n // Controlled / Uncontrolled\n const [internalPage, setInternalPage] = React.useState(defaultValue)\n const isControlled = value !== undefined\n const page = isControlled ? value : internalPage\n\n const handlePageChange = React.useCallback((newPage: number) => {\n if (disabled) return\n const clamped = Math.max(1, Math.min(total, newPage))\n if (!isControlled) setInternalPage(clamped)\n onChange?.(clamped)\n }, [disabled, total, isControlled, onChange])\n\n const paginationRange = usePagination({ total, siblings, boundaries, page })\n\n const contextValue = React.useMemo<PaginationContextValue>(() => ({\n page,\n total,\n siblings,\n boundaries,\n size,\n variant,\n color,\n radius,\n disabled,\n loop,\n onPageChange: handlePageChange,\n paginationRange,\n }), [page, total, siblings, boundaries, size, variant, color, radius, disabled, loop, handlePageChange, paginationRange])\n\n return (\n <PaginationContext.Provider value={contextValue}>\n <nav\n ref={ref}\n role=\"navigation\"\n aria-label=\"pagination\"\n className={cn('', className)}\n {...props}\n >\n {children ?? (\n <PaginationContent>\n {withEdges && <PaginationItem><PaginationFirst /></PaginationItem>}\n {withControls && <PaginationItem><PaginationPrevious /></PaginationItem>}\n <PaginationItems />\n {withControls && <PaginationItem><PaginationNext /></PaginationItem>}\n {withEdges && <PaginationItem><PaginationLast /></PaginationItem>}\n </PaginationContent>\n )}\n </nav>\n </PaginationContext.Provider>\n )\n }\n)\nPagination.displayName = 'Pagination'\n\n// ─── PaginationContent ───────────────────────────────────\n\nconst PaginationContent = React.forwardRef<HTMLUListElement, React.ComponentPropsWithoutRef<'ul'>>(\n ({ className, ...props }, ref) => {\n const { size } = usePaginationContext()\n const sizeClass = paginationSizeMap[size]\n return (\n <ul\n ref={ref}\n className={cn('flex flex-wrap items-center', sizeClass.gap, className)}\n {...props}\n />\n )\n }\n)\nPaginationContent.displayName = 'PaginationContent'\n\n// ─── PaginationItem ──────────────────────────────────────\n\nconst PaginationItem = React.forwardRef<HTMLLIElement, React.ComponentPropsWithoutRef<'li'>>(\n ({ className, ...props }, ref) => (\n <li ref={ref} className={cn('', className)} {...props} />\n )\n)\nPaginationItem.displayName = 'PaginationItem'\n\n// ─── PaginationLink ──────────────────────────────────────\n\nexport interface PaginationLinkProps extends React.ComponentPropsWithoutRef<'button'> {\n /** Page number this link navigates to */\n page: number\n /** Whether this page is currently active (auto-detected from context if omitted) */\n isActive?: boolean\n}\n\nconst PaginationLink = React.forwardRef<HTMLButtonElement, PaginationLinkProps>(\n ({ className, page: targetPage, isActive: isActiveProp, ...props }, ref) => {\n const ctx = usePaginationContext()\n const isActive = isActiveProp ?? (ctx.page === targetPage)\n const sizeClass = paginationSizeMap[ctx.size]\n\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-current={isActive ? 'page' : undefined}\n aria-label={`Go to page ${targetPage}`}\n disabled={ctx.disabled}\n onClick={() => ctx.onPageChange(targetPage)}\n className={cn(\n paginationItemVariants({ radius: ctx.radius }),\n sizeClass.item,\n getItemClasses(ctx.variant, ctx.color, isActive, ctx.disabled),\n className\n )}\n {...props}\n >\n {targetPage}\n </button>\n )\n }\n)\nPaginationLink.displayName = 'PaginationLink'\n\n// ─── PaginationPrevious ──────────────────────────────────\n\nexport interface PaginationPreviousProps extends React.ComponentPropsWithoutRef<'button'> {\n /** Custom icon */\n icon?: React.ReactNode\n}\n\nconst PaginationPrevious = React.forwardRef<HTMLButtonElement, PaginationPreviousProps>(\n ({ className, icon, ...props }, ref) => {\n const ctx = usePaginationContext()\n const sizeClass = paginationSizeMap[ctx.size]\n const isDisabled = ctx.disabled || (!ctx.loop && ctx.page <= 1)\n\n const handleClick = () => {\n if (ctx.page <= 1) {\n if (ctx.loop) ctx.onPageChange(ctx.total)\n } else {\n ctx.onPageChange(ctx.page - 1)\n }\n }\n\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-label=\"Go to previous page\"\n disabled={isDisabled}\n onClick={handleClick}\n className={cn(\n paginationItemVariants({ radius: ctx.radius }),\n sizeClass.item,\n getItemClasses(ctx.variant, ctx.color, false, isDisabled),\n className\n )}\n {...props}\n >\n {icon ?? <ChevronLeftIcon className={sizeClass.icon} />}\n </button>\n )\n }\n)\nPaginationPrevious.displayName = 'PaginationPrevious'\n\n// ─── PaginationNext ──────────────────────────────────────\n\nexport interface PaginationNextProps extends React.ComponentPropsWithoutRef<'button'> {\n /** Custom icon */\n icon?: React.ReactNode\n}\n\nconst PaginationNext = React.forwardRef<HTMLButtonElement, PaginationNextProps>(\n ({ className, icon, ...props }, ref) => {\n const ctx = usePaginationContext()\n const sizeClass = paginationSizeMap[ctx.size]\n const isDisabled = ctx.disabled || (!ctx.loop && ctx.page >= ctx.total)\n\n const handleClick = () => {\n if (ctx.page >= ctx.total) {\n if (ctx.loop) ctx.onPageChange(1)\n } else {\n ctx.onPageChange(ctx.page + 1)\n }\n }\n\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-label=\"Go to next page\"\n disabled={isDisabled}\n onClick={handleClick}\n className={cn(\n paginationItemVariants({ radius: ctx.radius }),\n sizeClass.item,\n getItemClasses(ctx.variant, ctx.color, false, isDisabled),\n className\n )}\n {...props}\n >\n {icon ?? <ChevronRightIcon className={sizeClass.icon} />}\n </button>\n )\n }\n)\nPaginationNext.displayName = 'PaginationNext'\n\n// ─── PaginationFirst ─────────────────────────────────────\n\nexport interface PaginationFirstProps extends React.ComponentPropsWithoutRef<'button'> {\n /** Custom icon */\n icon?: React.ReactNode\n}\n\nconst PaginationFirst = React.forwardRef<HTMLButtonElement, PaginationFirstProps>(\n ({ className, icon, ...props }, ref) => {\n const ctx = usePaginationContext()\n const sizeClass = paginationSizeMap[ctx.size]\n const isDisabled = ctx.disabled || ctx.page <= 1\n\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-label=\"Go to first page\"\n disabled={isDisabled}\n onClick={() => ctx.onPageChange(1)}\n className={cn(\n paginationItemVariants({ radius: ctx.radius }),\n sizeClass.item,\n getItemClasses(ctx.variant, ctx.color, false, isDisabled),\n className\n )}\n {...props}\n >\n {icon ?? <ChevronsLeftIcon className={sizeClass.icon} />}\n </button>\n )\n }\n)\nPaginationFirst.displayName = 'PaginationFirst'\n\n// ─── PaginationLast ──────────────────────────────────────\n\nexport interface PaginationLastProps extends React.ComponentPropsWithoutRef<'button'> {\n /** Custom icon */\n icon?: React.ReactNode\n}\n\nconst PaginationLast = React.forwardRef<HTMLButtonElement, PaginationLastProps>(\n ({ className, icon, ...props }, ref) => {\n const ctx = usePaginationContext()\n const sizeClass = paginationSizeMap[ctx.size]\n const isDisabled = ctx.disabled || ctx.page >= ctx.total\n\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-label=\"Go to last page\"\n disabled={isDisabled}\n onClick={() => ctx.onPageChange(ctx.total)}\n className={cn(\n paginationItemVariants({ radius: ctx.radius }),\n sizeClass.item,\n getItemClasses(ctx.variant, ctx.color, false, isDisabled),\n className\n )}\n {...props}\n >\n {icon ?? <ChevronsRightIcon className={sizeClass.icon} />}\n </button>\n )\n }\n)\nPaginationLast.displayName = 'PaginationLast'\n\n// ─── PaginationEllipsis ──────────────────────────────────\n\nconst PaginationEllipsis = React.forwardRef<HTMLSpanElement, React.ComponentPropsWithoutRef<'span'>>(\n ({ className, ...props }, ref) => {\n const ctx = usePaginationContext()\n const sizeClass = paginationSizeMap[ctx.size]\n return (\n <span\n ref={ref}\n aria-hidden=\"true\"\n className={cn(\n 'inline-flex items-center justify-center text-text-muted',\n sizeClass.item,\n className\n )}\n {...props}\n >\n <EllipsisIcon className={sizeClass.icon} />\n <span className=\"sr-only\">More pages</span>\n </span>\n )\n }\n)\nPaginationEllipsis.displayName = 'PaginationEllipsis'\n\n// ─── PaginationItems (Convenience) ───────────────────────\n\nconst PaginationItems = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(\n ({ className, ...props }, ref) => {\n const ctx = usePaginationContext()\n return (\n <div ref={ref} className={cn('contents', className)} {...props}>\n {ctx.paginationRange.map((item, index) => (\n <PaginationItem key={`${item}-${index}`}>\n {item === 'dots' ? (\n <PaginationEllipsis />\n ) : (\n <PaginationLink page={item} />\n )}\n </PaginationItem>\n ))}\n </div>\n )\n }\n)\nPaginationItems.displayName = 'PaginationItems'\n\n// ─── Exports ─────────────────────────────────────────────\n\nexport {\n Pagination,\n PaginationContent,\n PaginationItem,\n PaginationLink,\n PaginationPrevious,\n PaginationNext,\n PaginationFirst,\n PaginationLast,\n PaginationEllipsis,\n PaginationItems,\n paginationItemVariants,\n paginationSizeMap,\n}\n"],"mappings":";AAE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C5B,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAAQ;AAChC,UAAM,MAAM,qBAAqB;AACjC,WACE,oCAAC,SAAI,KAAU,WAAW,GAAG,YAAY,SAAS,GAAI,GAAG,SACtD,IAAI,gBAAgB,IAAI,CAAC,MAAM,UAC9B,oCAAC,kBAAe,KAAK,GAAG,IAAI,IAAI,KAAK,MAClC,SAAS,SACR,oCAAC,wBAAmB,IAEpB,oCAAC,kBAAe,MAAM,MAAM,CAEhC,CACD,CACH;AAAA,EAEJ;AACF;AACA,gBAAgB,cAAc;","names":[]}
|
|
@@ -8,9 +8,9 @@ declare const popoverContentVariants: (props?: ({
|
|
|
8
8
|
variant?: "default" | "elevated" | null | undefined;
|
|
9
9
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
10
10
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
11
|
-
interface
|
|
11
|
+
interface PopoverProps extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Root> {
|
|
12
12
|
}
|
|
13
|
-
declare function
|
|
13
|
+
declare function Popover(props: PopoverProps): React.JSX.Element;
|
|
14
14
|
declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
15
15
|
declare const PopoverPortal: React.FC<PopoverPrimitive.PopoverPortalProps>;
|
|
16
16
|
declare const PopoverAnchor: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -25,17 +25,5 @@ interface PopoverContentProps extends React.ComponentPropsWithoutRef<typeof Popo
|
|
|
25
25
|
}
|
|
26
26
|
declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
27
27
|
declare const PopoverArrow: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverArrowProps & React.RefAttributes<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
28
|
-
declare const Popover: typeof PopoverRoot & {
|
|
29
|
-
Trigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
30
|
-
Content: React.ForwardRefExoticComponent<PopoverContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
-
Arrow: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverArrowProps & React.RefAttributes<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
32
|
-
Close: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
33
|
-
Anchor: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
-
Portal: React.FC<PopoverPrimitive.PopoverPortalProps>;
|
|
35
|
-
};
|
|
36
|
-
declare namespace Popover {
|
|
37
|
-
type ContentProps = PopoverContentProps;
|
|
38
|
-
type RootProps = PopoverRootProps;
|
|
39
|
-
}
|
|
40
28
|
|
|
41
|
-
export { Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, type PopoverContentProps, PopoverPortal,
|
|
29
|
+
export { Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, type PopoverContentProps, PopoverPortal, type PopoverProps, type PopoverSide, PopoverTrigger, popoverContentVariants };
|
|
@@ -8,9 +8,9 @@ declare const popoverContentVariants: (props?: ({
|
|
|
8
8
|
variant?: "default" | "elevated" | null | undefined;
|
|
9
9
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
10
10
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
11
|
-
interface
|
|
11
|
+
interface PopoverProps extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Root> {
|
|
12
12
|
}
|
|
13
|
-
declare function
|
|
13
|
+
declare function Popover(props: PopoverProps): React.JSX.Element;
|
|
14
14
|
declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
15
15
|
declare const PopoverPortal: React.FC<PopoverPrimitive.PopoverPortalProps>;
|
|
16
16
|
declare const PopoverAnchor: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -25,17 +25,5 @@ interface PopoverContentProps extends React.ComponentPropsWithoutRef<typeof Popo
|
|
|
25
25
|
}
|
|
26
26
|
declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
27
27
|
declare const PopoverArrow: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverArrowProps & React.RefAttributes<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
28
|
-
declare const Popover: typeof PopoverRoot & {
|
|
29
|
-
Trigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
30
|
-
Content: React.ForwardRefExoticComponent<PopoverContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
-
Arrow: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverArrowProps & React.RefAttributes<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
32
|
-
Close: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
33
|
-
Anchor: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
-
Portal: React.FC<PopoverPrimitive.PopoverPortalProps>;
|
|
35
|
-
};
|
|
36
|
-
declare namespace Popover {
|
|
37
|
-
type ContentProps = PopoverContentProps;
|
|
38
|
-
type RootProps = PopoverRootProps;
|
|
39
|
-
}
|
|
40
28
|
|
|
41
|
-
export { Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, type PopoverContentProps, PopoverPortal,
|
|
29
|
+
export { Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, type PopoverContentProps, PopoverPortal, type PopoverProps, type PopoverSide, PopoverTrigger, popoverContentVariants };
|
|
@@ -35,7 +35,6 @@ __export(popover_exports, {
|
|
|
35
35
|
PopoverClose: () => PopoverClose,
|
|
36
36
|
PopoverContent: () => PopoverContent,
|
|
37
37
|
PopoverPortal: () => PopoverPortal,
|
|
38
|
-
PopoverRoot: () => PopoverRoot,
|
|
39
38
|
PopoverTrigger: () => PopoverTrigger,
|
|
40
39
|
popoverContentVariants: () => popoverContentVariants
|
|
41
40
|
});
|
|
@@ -89,7 +88,7 @@ const CSS_ARROW_CLASSES = {
|
|
|
89
88
|
left: "-right-[5px] top-1/2 -translate-y-1/2 border-t border-r border-border"
|
|
90
89
|
};
|
|
91
90
|
const ARROW_ELEVATED = "fill-background-paper drop-shadow-sm";
|
|
92
|
-
function
|
|
91
|
+
function Popover(props) {
|
|
93
92
|
return /* @__PURE__ */ React.createElement(PopoverPrimitive.Root, { ...props });
|
|
94
93
|
}
|
|
95
94
|
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
@@ -152,14 +151,6 @@ const PopoverArrow = React.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
152
151
|
}
|
|
153
152
|
));
|
|
154
153
|
PopoverArrow.displayName = "PopoverArrow";
|
|
155
|
-
const Popover = Object.assign(PopoverRoot, {
|
|
156
|
-
Trigger: PopoverTrigger,
|
|
157
|
-
Content: PopoverContent,
|
|
158
|
-
Arrow: PopoverArrow,
|
|
159
|
-
Close: PopoverClose,
|
|
160
|
-
Anchor: PopoverAnchor,
|
|
161
|
-
Portal: PopoverPortal
|
|
162
|
-
});
|
|
163
154
|
// Annotate the CommonJS export names for ESM import in node:
|
|
164
155
|
0 && (module.exports = {
|
|
165
156
|
Popover,
|
|
@@ -168,7 +159,6 @@ const Popover = Object.assign(PopoverRoot, {
|
|
|
168
159
|
PopoverClose,
|
|
169
160
|
PopoverContent,
|
|
170
161
|
PopoverPortal,
|
|
171
|
-
PopoverRoot,
|
|
172
162
|
PopoverTrigger,
|
|
173
163
|
popoverContentVariants
|
|
174
164
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ui/popover.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as PopoverPrimitive from '@radix-ui/react-popover'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// ─── Default Close Icon (built-in, no external dependency) ──\nconst DefaultCloseIcon = ({ className }: { className?: string }) => (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n aria-hidden=\"true\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n)\n\n// ─── Types ──────────────────────────────────────────────────\nexport type PopoverSide = 'top' | 'right' | 'bottom' | 'left'\n\n// ─── Animation class mapping (static strings for Tailwind scanner) ──\nconst ANIMATION_CLASSES: Record<PopoverSide, string> = {\n top: 'data-[state=open]:animate-popover-top-enter data-[state=closed]:animate-popover-top-exit',\n bottom: 'data-[state=open]:animate-popover-bottom-enter data-[state=closed]:animate-popover-bottom-exit',\n left: 'data-[state=open]:animate-popover-left-enter data-[state=closed]:animate-popover-left-exit',\n right: 'data-[state=open]:animate-popover-right-enter data-[state=closed]:animate-popover-right-exit',\n}\n\n// ─── Content variants ────────────────────────────────────────\nconst popoverContentVariants = cva(\n 'relative z-popover font-normal select-none w-auto max-w-[calc(100vw-16px)] outline-none',\n {\n variants: {\n variant: {\n default: 'bg-background-paper text-foreground border border-border shadow-lg',\n elevated: 'bg-background-paper/95 text-foreground border border-border-subtle shadow-xl backdrop-blur-sm',\n },\n size: {\n sm: 'text-sm p-3 rounded-lg',\n default: 'text-sm p-4 rounded-xl',\n lg: 'text-md p-5 rounded-xl',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n)\n\n// ─── Arrow styles ──────────────────────────────────────────────\n// default: CSS rotated square with 2-side border (seamless connection)\n// elevated: Radix SVG arrow with drop-shadow (glassmorphism, subtle border)\nconst CSS_ARROW_CLASSES: Record<PopoverSide, string> = {\n bottom: '-top-[5px] left-1/2 -translate-x-1/2 border-t border-l border-border',\n top: '-bottom-[5px] left-1/2 -translate-x-1/2 border-b border-r border-border',\n right: '-left-[5px] top-1/2 -translate-y-1/2 border-b border-l border-border',\n left: '-right-[5px] top-1/2 -translate-y-1/2 border-t border-r border-border',\n}\n\nconst ARROW_ELEVATED = 'fill-background-paper drop-shadow-sm'\n\n// ═══════════════════════════════════════════════════════════════\n// Popover\n// ═══════════════════════════════════════════════════════════════\n\n// ───
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/popover.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as PopoverPrimitive from '@radix-ui/react-popover'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// ─── Default Close Icon (built-in, no external dependency) ──\nconst DefaultCloseIcon = ({ className }: { className?: string }) => (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n aria-hidden=\"true\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n)\n\n// ─── Types ──────────────────────────────────────────────────\nexport type PopoverSide = 'top' | 'right' | 'bottom' | 'left'\n\n// ─── Animation class mapping (static strings for Tailwind scanner) ──\nconst ANIMATION_CLASSES: Record<PopoverSide, string> = {\n top: 'data-[state=open]:animate-popover-top-enter data-[state=closed]:animate-popover-top-exit',\n bottom: 'data-[state=open]:animate-popover-bottom-enter data-[state=closed]:animate-popover-bottom-exit',\n left: 'data-[state=open]:animate-popover-left-enter data-[state=closed]:animate-popover-left-exit',\n right: 'data-[state=open]:animate-popover-right-enter data-[state=closed]:animate-popover-right-exit',\n}\n\n// ─── Content variants ────────────────────────────────────────\nconst popoverContentVariants = cva(\n 'relative z-popover font-normal select-none w-auto max-w-[calc(100vw-16px)] outline-none',\n {\n variants: {\n variant: {\n default: 'bg-background-paper text-foreground border border-border shadow-lg',\n elevated: 'bg-background-paper/95 text-foreground border border-border-subtle shadow-xl backdrop-blur-sm',\n },\n size: {\n sm: 'text-sm p-3 rounded-lg',\n default: 'text-sm p-4 rounded-xl',\n lg: 'text-md p-5 rounded-xl',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n)\n\n// ─── Arrow styles ──────────────────────────────────────────────\n// default: CSS rotated square with 2-side border (seamless connection)\n// elevated: Radix SVG arrow with drop-shadow (glassmorphism, subtle border)\nconst CSS_ARROW_CLASSES: Record<PopoverSide, string> = {\n bottom: '-top-[5px] left-1/2 -translate-x-1/2 border-t border-l border-border',\n top: '-bottom-[5px] left-1/2 -translate-x-1/2 border-b border-r border-border',\n right: '-left-[5px] top-1/2 -translate-y-1/2 border-b border-l border-border',\n left: '-right-[5px] top-1/2 -translate-y-1/2 border-t border-r border-border',\n}\n\nconst ARROW_ELEVATED = 'fill-background-paper drop-shadow-sm'\n\n// ═══════════════════════════════════════════════════════════════\n// Popover\n// ═══════════════════════════════════════════════════════════════\n\n// ─── Popover (Root) — wrapper to keep our own component identity separate from Radix primitive ──\nexport interface PopoverProps extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Root> {}\n\nfunction Popover(props: PopoverProps) {\n return <PopoverPrimitive.Root {...props} />\n}\n\n// ─── PopoverTrigger ──────────────────────────────────────────\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\n// ─── PopoverPortal ───────────────────────────────────────────\nconst PopoverPortal = PopoverPrimitive.Portal\n\n// ─── PopoverAnchor ───────────────────────────────────────────\nconst PopoverAnchor = PopoverPrimitive.Anchor\n\n// ─── PopoverClose ────────────────────────────────────────────\nconst PopoverClose = PopoverPrimitive.Close\n\n// ─── PopoverContent ──────────────────────────────────────────\nexport interface PopoverContentProps\n extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>,\n VariantProps<typeof popoverContentVariants> {\n /** Show arrow pointing to trigger */\n showArrow?: boolean\n /** Show built-in close button */\n showClose?: boolean\n /** Custom close icon (replaces default X icon) */\n closeIcon?: React.ReactNode\n}\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n PopoverContentProps\n>(({ className, variant = 'default', size, side = 'bottom', sideOffset, showArrow = true, showClose = false, closeIcon, children, ...props }, ref) => {\n const resolvedSide = side as PopoverSide\n // CSS arrow (default) needs more gap since it doesn't occupy layout space\n const resolvedOffset = sideOffset ?? (variant === 'default' && showArrow ? 12 : 6)\n\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n side={side}\n sideOffset={resolvedOffset}\n className={cn(\n popoverContentVariants({ variant, size }),\n ANIMATION_CLASSES[resolvedSide],\n className,\n )}\n {...props}\n >\n {showClose && (\n <PopoverPrimitive.Close\n className=\"absolute top-3 right-3 rounded-md p-1 text-text-muted hover:text-foreground hover:bg-background-muted transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring\"\n aria-label=\"Close\"\n >\n {closeIcon || <DefaultCloseIcon className=\"icon-sm\" />}\n </PopoverPrimitive.Close>\n )}\n {children}\n {showArrow && variant === 'default' && (\n <div\n className={cn(\n 'absolute w-2.5 h-2.5 rotate-45 bg-background-paper',\n CSS_ARROW_CLASSES[resolvedSide],\n )}\n />\n )}\n {showArrow && variant === 'elevated' && (\n <PopoverPrimitive.Arrow\n className={ARROW_ELEVATED}\n width={12}\n height={6}\n />\n )}\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n )\n})\nPopoverContent.displayName = 'PopoverContent'\n\n// ─── PopoverArrow (standalone, for manual placement outside Content) ──\nconst PopoverArrow = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Arrow>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Arrow>\n>(({ className, ...props }, ref) => (\n <PopoverPrimitive.Arrow\n ref={ref}\n className={cn('fill-background-paper', className)}\n width={10}\n height={5}\n {...props}\n />\n))\nPopoverArrow.displayName = 'PopoverArrow'\n\n// ─── Exports ────────────────────────────────────────────────\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverArrow,\n PopoverClose,\n PopoverAnchor,\n PopoverPortal,\n popoverContentVariants,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AACvB,uBAAkC;AAClC,sCAAuC;AACvC,mBAAmB;AAGnB,MAAM,mBAAmB,CAAC,EAAE,UAAU,MACpC;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,QAAO;AAAA,IACP,aAAa;AAAA,IACb,eAAY;AAAA;AAAA,EAEZ,oCAAC,UAAK,eAAc,SAAQ,gBAAe,SAAQ,GAAE,wBAAuB;AAC9E;AAOF,MAAM,oBAAiD;AAAA,EACrD,KAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAQ;AAAA,EACR,OAAQ;AACV;AAGA,MAAM,6BAAyB;AAAA,EAC7B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,MACN;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAKA,MAAM,oBAAiD;AAAA,EACrD,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,OAAO;AAAA,EACP,MAAM;AACR;AAEA,MAAM,iBAAiB;AASvB,SAAS,QAAQ,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IACC;AAAA,IACA,eAAW,iBAAG,yBAAyB,SAAS;AAAA,IAChD,OAAO;AAAA,IACP,QAAQ;AAAA,IACP,GAAG;AAAA;AACN,CACD;AACD,aAAa,cAAc;","names":[]}
|
|
@@ -48,7 +48,7 @@ const CSS_ARROW_CLASSES = {
|
|
|
48
48
|
left: "-right-[5px] top-1/2 -translate-y-1/2 border-t border-r border-border"
|
|
49
49
|
};
|
|
50
50
|
const ARROW_ELEVATED = "fill-background-paper drop-shadow-sm";
|
|
51
|
-
function
|
|
51
|
+
function Popover(props) {
|
|
52
52
|
return /* @__PURE__ */ React.createElement(PopoverPrimitive.Root, { ...props });
|
|
53
53
|
}
|
|
54
54
|
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
@@ -111,14 +111,6 @@ const PopoverArrow = React.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
111
111
|
}
|
|
112
112
|
));
|
|
113
113
|
PopoverArrow.displayName = "PopoverArrow";
|
|
114
|
-
const Popover = Object.assign(PopoverRoot, {
|
|
115
|
-
Trigger: PopoverTrigger,
|
|
116
|
-
Content: PopoverContent,
|
|
117
|
-
Arrow: PopoverArrow,
|
|
118
|
-
Close: PopoverClose,
|
|
119
|
-
Anchor: PopoverAnchor,
|
|
120
|
-
Portal: PopoverPortal
|
|
121
|
-
});
|
|
122
114
|
export {
|
|
123
115
|
Popover,
|
|
124
116
|
PopoverAnchor,
|
|
@@ -126,7 +118,6 @@ export {
|
|
|
126
118
|
PopoverClose,
|
|
127
119
|
PopoverContent,
|
|
128
120
|
PopoverPortal,
|
|
129
|
-
PopoverRoot,
|
|
130
121
|
PopoverTrigger,
|
|
131
122
|
popoverContentVariants
|
|
132
123
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ui/popover.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as PopoverPrimitive from '@radix-ui/react-popover'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// ─── Default Close Icon (built-in, no external dependency) ──\nconst DefaultCloseIcon = ({ className }: { className?: string }) => (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n aria-hidden=\"true\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n)\n\n// ─── Types ──────────────────────────────────────────────────\nexport type PopoverSide = 'top' | 'right' | 'bottom' | 'left'\n\n// ─── Animation class mapping (static strings for Tailwind scanner) ──\nconst ANIMATION_CLASSES: Record<PopoverSide, string> = {\n top: 'data-[state=open]:animate-popover-top-enter data-[state=closed]:animate-popover-top-exit',\n bottom: 'data-[state=open]:animate-popover-bottom-enter data-[state=closed]:animate-popover-bottom-exit',\n left: 'data-[state=open]:animate-popover-left-enter data-[state=closed]:animate-popover-left-exit',\n right: 'data-[state=open]:animate-popover-right-enter data-[state=closed]:animate-popover-right-exit',\n}\n\n// ─── Content variants ────────────────────────────────────────\nconst popoverContentVariants = cva(\n 'relative z-popover font-normal select-none w-auto max-w-[calc(100vw-16px)] outline-none',\n {\n variants: {\n variant: {\n default: 'bg-background-paper text-foreground border border-border shadow-lg',\n elevated: 'bg-background-paper/95 text-foreground border border-border-subtle shadow-xl backdrop-blur-sm',\n },\n size: {\n sm: 'text-sm p-3 rounded-lg',\n default: 'text-sm p-4 rounded-xl',\n lg: 'text-md p-5 rounded-xl',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n)\n\n// ─── Arrow styles ──────────────────────────────────────────────\n// default: CSS rotated square with 2-side border (seamless connection)\n// elevated: Radix SVG arrow with drop-shadow (glassmorphism, subtle border)\nconst CSS_ARROW_CLASSES: Record<PopoverSide, string> = {\n bottom: '-top-[5px] left-1/2 -translate-x-1/2 border-t border-l border-border',\n top: '-bottom-[5px] left-1/2 -translate-x-1/2 border-b border-r border-border',\n right: '-left-[5px] top-1/2 -translate-y-1/2 border-b border-l border-border',\n left: '-right-[5px] top-1/2 -translate-y-1/2 border-t border-r border-border',\n}\n\nconst ARROW_ELEVATED = 'fill-background-paper drop-shadow-sm'\n\n// ═══════════════════════════════════════════════════════════════\n// Popover\n// ═══════════════════════════════════════════════════════════════\n\n// ───
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/popover.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as PopoverPrimitive from '@radix-ui/react-popover'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// ─── Default Close Icon (built-in, no external dependency) ──\nconst DefaultCloseIcon = ({ className }: { className?: string }) => (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n aria-hidden=\"true\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n)\n\n// ─── Types ──────────────────────────────────────────────────\nexport type PopoverSide = 'top' | 'right' | 'bottom' | 'left'\n\n// ─── Animation class mapping (static strings for Tailwind scanner) ──\nconst ANIMATION_CLASSES: Record<PopoverSide, string> = {\n top: 'data-[state=open]:animate-popover-top-enter data-[state=closed]:animate-popover-top-exit',\n bottom: 'data-[state=open]:animate-popover-bottom-enter data-[state=closed]:animate-popover-bottom-exit',\n left: 'data-[state=open]:animate-popover-left-enter data-[state=closed]:animate-popover-left-exit',\n right: 'data-[state=open]:animate-popover-right-enter data-[state=closed]:animate-popover-right-exit',\n}\n\n// ─── Content variants ────────────────────────────────────────\nconst popoverContentVariants = cva(\n 'relative z-popover font-normal select-none w-auto max-w-[calc(100vw-16px)] outline-none',\n {\n variants: {\n variant: {\n default: 'bg-background-paper text-foreground border border-border shadow-lg',\n elevated: 'bg-background-paper/95 text-foreground border border-border-subtle shadow-xl backdrop-blur-sm',\n },\n size: {\n sm: 'text-sm p-3 rounded-lg',\n default: 'text-sm p-4 rounded-xl',\n lg: 'text-md p-5 rounded-xl',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n)\n\n// ─── Arrow styles ──────────────────────────────────────────────\n// default: CSS rotated square with 2-side border (seamless connection)\n// elevated: Radix SVG arrow with drop-shadow (glassmorphism, subtle border)\nconst CSS_ARROW_CLASSES: Record<PopoverSide, string> = {\n bottom: '-top-[5px] left-1/2 -translate-x-1/2 border-t border-l border-border',\n top: '-bottom-[5px] left-1/2 -translate-x-1/2 border-b border-r border-border',\n right: '-left-[5px] top-1/2 -translate-y-1/2 border-b border-l border-border',\n left: '-right-[5px] top-1/2 -translate-y-1/2 border-t border-r border-border',\n}\n\nconst ARROW_ELEVATED = 'fill-background-paper drop-shadow-sm'\n\n// ═══════════════════════════════════════════════════════════════\n// Popover\n// ═══════════════════════════════════════════════════════════════\n\n// ─── Popover (Root) — wrapper to keep our own component identity separate from Radix primitive ──\nexport interface PopoverProps extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Root> {}\n\nfunction Popover(props: PopoverProps) {\n return <PopoverPrimitive.Root {...props} />\n}\n\n// ─── PopoverTrigger ──────────────────────────────────────────\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\n// ─── PopoverPortal ───────────────────────────────────────────\nconst PopoverPortal = PopoverPrimitive.Portal\n\n// ─── PopoverAnchor ───────────────────────────────────────────\nconst PopoverAnchor = PopoverPrimitive.Anchor\n\n// ─── PopoverClose ────────────────────────────────────────────\nconst PopoverClose = PopoverPrimitive.Close\n\n// ─── PopoverContent ──────────────────────────────────────────\nexport interface PopoverContentProps\n extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>,\n VariantProps<typeof popoverContentVariants> {\n /** Show arrow pointing to trigger */\n showArrow?: boolean\n /** Show built-in close button */\n showClose?: boolean\n /** Custom close icon (replaces default X icon) */\n closeIcon?: React.ReactNode\n}\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n PopoverContentProps\n>(({ className, variant = 'default', size, side = 'bottom', sideOffset, showArrow = true, showClose = false, closeIcon, children, ...props }, ref) => {\n const resolvedSide = side as PopoverSide\n // CSS arrow (default) needs more gap since it doesn't occupy layout space\n const resolvedOffset = sideOffset ?? (variant === 'default' && showArrow ? 12 : 6)\n\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n side={side}\n sideOffset={resolvedOffset}\n className={cn(\n popoverContentVariants({ variant, size }),\n ANIMATION_CLASSES[resolvedSide],\n className,\n )}\n {...props}\n >\n {showClose && (\n <PopoverPrimitive.Close\n className=\"absolute top-3 right-3 rounded-md p-1 text-text-muted hover:text-foreground hover:bg-background-muted transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring\"\n aria-label=\"Close\"\n >\n {closeIcon || <DefaultCloseIcon className=\"icon-sm\" />}\n </PopoverPrimitive.Close>\n )}\n {children}\n {showArrow && variant === 'default' && (\n <div\n className={cn(\n 'absolute w-2.5 h-2.5 rotate-45 bg-background-paper',\n CSS_ARROW_CLASSES[resolvedSide],\n )}\n />\n )}\n {showArrow && variant === 'elevated' && (\n <PopoverPrimitive.Arrow\n className={ARROW_ELEVATED}\n width={12}\n height={6}\n />\n )}\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n )\n})\nPopoverContent.displayName = 'PopoverContent'\n\n// ─── PopoverArrow (standalone, for manual placement outside Content) ──\nconst PopoverArrow = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Arrow>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Arrow>\n>(({ className, ...props }, ref) => (\n <PopoverPrimitive.Arrow\n ref={ref}\n className={cn('fill-background-paper', className)}\n width={10}\n height={5}\n {...props}\n />\n))\nPopoverArrow.displayName = 'PopoverArrow'\n\n// ─── Exports ────────────────────────────────────────────────\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverArrow,\n PopoverClose,\n PopoverAnchor,\n PopoverPortal,\n popoverContentVariants,\n}\n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e,YAAY,aAAa,YAAY,KAAK;AAEhF,SACE,oCAAC,iBAAiB,QAAjB,MACC;AAAA,IAAC,iBAAiB;AAAA,IAAjB;AAAA,MACC;AAAA,MACA;AAAA,MACA,YAAY;AAAA,MACZ,WAAW;AAAA,QACT,uBAAuB,EAAE,SAAS,KAAK,CAAC;AAAA,QACxC,kBAAkB,YAAY;AAAA,QAC9B;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,IAEH,aACC;AAAA,MAAC,iBAAiB;AAAA,MAAjB;AAAA,QACC,WAAU;AAAA,QACV,cAAW;AAAA;AAAA,MAEV,aAAa,oCAAC,oBAAiB,WAAU,WAAU;AAAA,IACtD;AAAA,IAED;AAAA,IACA,aAAa,YAAY,aACxB;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA,kBAAkB,YAAY;AAAA,QAChC;AAAA;AAAA,IACF;AAAA,IAED,aAAa,YAAY,cACxB;AAAA,MAAC,iBAAiB;AAAA,MAAjB;AAAA,QACC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,QAAQ;AAAA;AAAA,IACV;AAAA,EAEJ,CACF;AAEJ,CAAC;AACD,eAAe,cAAc;AAG7B,MAAM,eAAe,MAAM,WAGzB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC,iBAAiB;AAAA,EAAjB;AAAA,IACC;AAAA,IACA,WAAW,GAAG,yBAAyB,SAAS;AAAA,IAChD,OAAO;AAAA,IACP,QAAQ;AAAA,IACP,GAAG;AAAA;AACN,CACD;AACD,aAAa,cAAc;","names":[]}
|
|
@@ -22,6 +22,7 @@ interface RadioGroupProps extends React.ComponentPropsWithoutRef<typeof RadioGro
|
|
|
22
22
|
/** Checked state color */
|
|
23
23
|
color?: RadioColor;
|
|
24
24
|
}
|
|
25
|
+
declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
25
26
|
declare const radioItemVariants: (props?: ({
|
|
26
27
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
27
28
|
weight?: "bold" | "thin" | null | undefined;
|
|
@@ -30,11 +31,5 @@ interface RadioGroupItemProps extends React.ComponentPropsWithoutRef<typeof Radi
|
|
|
30
31
|
label?: string;
|
|
31
32
|
}
|
|
32
33
|
declare const RadioGroupItem: React.ForwardRefExoticComponent<RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
33
|
-
declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>> & {
|
|
34
|
-
Item: React.ForwardRefExoticComponent<RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
35
|
-
};
|
|
36
|
-
declare namespace RadioGroup {
|
|
37
|
-
type ItemProps = RadioGroupItemProps;
|
|
38
|
-
}
|
|
39
34
|
|
|
40
35
|
export { type RadioColor, RadioGroup, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps, radioGroupVariants, radioItemVariants };
|
|
@@ -22,6 +22,7 @@ interface RadioGroupProps extends React.ComponentPropsWithoutRef<typeof RadioGro
|
|
|
22
22
|
/** Checked state color */
|
|
23
23
|
color?: RadioColor;
|
|
24
24
|
}
|
|
25
|
+
declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
25
26
|
declare const radioItemVariants: (props?: ({
|
|
26
27
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
27
28
|
weight?: "bold" | "thin" | null | undefined;
|
|
@@ -30,11 +31,5 @@ interface RadioGroupItemProps extends React.ComponentPropsWithoutRef<typeof Radi
|
|
|
30
31
|
label?: string;
|
|
31
32
|
}
|
|
32
33
|
declare const RadioGroupItem: React.ForwardRefExoticComponent<RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
33
|
-
declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>> & {
|
|
34
|
-
Item: React.ForwardRefExoticComponent<RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
35
|
-
};
|
|
36
|
-
declare namespace RadioGroup {
|
|
37
|
-
type ItemProps = RadioGroupItemProps;
|
|
38
|
-
}
|
|
39
34
|
|
|
40
35
|
export { type RadioColor, RadioGroup, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps, radioGroupVariants, radioItemVariants };
|
|
@@ -62,7 +62,7 @@ const radioGroupVariants = (0, import_class_variance_authority.cva)("grid gap-3"
|
|
|
62
62
|
orientation: "vertical"
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
|
-
const
|
|
65
|
+
const RadioGroup = React.forwardRef(({ className, orientation, size = "default", weight = "bold", color = "default", disabled, ...props }, ref) => {
|
|
66
66
|
const fieldContext = (0, import_field.useFieldContext)();
|
|
67
67
|
const resolvedDisabled = disabled ?? fieldContext?.disabled;
|
|
68
68
|
return /* @__PURE__ */ React.createElement(RadioGroupContext.Provider, { value: { size, weight, color, disabled: resolvedDisabled } }, /* @__PURE__ */ React.createElement(
|
|
@@ -76,7 +76,7 @@ const RadioGroupRoot = React.forwardRef(({ className, orientation, size = "defau
|
|
|
76
76
|
}
|
|
77
77
|
));
|
|
78
78
|
});
|
|
79
|
-
|
|
79
|
+
RadioGroup.displayName = "RadioGroup";
|
|
80
80
|
const radioItemVariants = (0, import_class_variance_authority.cva)(
|
|
81
81
|
[
|
|
82
82
|
"relative shrink-0 rounded-full border-border-form hover:border-border-form-strong transition-all duration-micro ease-out",
|
|
@@ -164,9 +164,6 @@ const RadioGroupItem = React.forwardRef(({ className, label, disabled, ...props
|
|
|
164
164
|
));
|
|
165
165
|
});
|
|
166
166
|
RadioGroupItem.displayName = "RadioGroupItem";
|
|
167
|
-
const RadioGroup = Object.assign(RadioGroupRoot, {
|
|
168
|
-
Item: RadioGroupItem
|
|
169
|
-
});
|
|
170
167
|
// Annotate the CommonJS export names for ESM import in node:
|
|
171
168
|
0 && (module.exports = {
|
|
172
169
|
RadioGroup,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ui/radio-group.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as RadioGroupPrimitive from '@radix-ui/react-radio-group'\nimport { cva } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\nimport { useFieldContext } from './field'\n\n// Color maps for checked state\nconst radioColorMap = {\n default: {\n border: 'data-[state=checked]:border-foreground',\n dot: 'bg-foreground',\n },\n primary: {\n border: 'data-[state=checked]:border-primary',\n dot: 'bg-primary',\n },\n} as const\n\nexport type RadioColor = keyof typeof radioColorMap\n\n// Context to pass size, weight, color from RadioGroup to RadioGroupItem\ntype RadioGroupContextValue = {\n size: 'sm' | 'default' | 'lg'\n weight: 'thin' | 'bold'\n color: RadioColor\n disabled?: boolean\n}\nconst RadioGroupContext = React.createContext<RadioGroupContextValue>({ size: 'default', weight: 'bold', color: 'default' })\n\n// RadioGroup container\nconst radioGroupVariants = cva('grid gap-3', {\n variants: {\n orientation: {\n vertical: 'grid-cols-1',\n horizontal: 'grid-flow-col auto-cols-max gap-4',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n})\n\nexport interface RadioGroupProps\n extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root> {\n size?: 'sm' | 'default' | 'lg'\n weight?: 'thin' | 'bold'\n /** Checked state color */\n color?: RadioColor\n}\n\nconst
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/radio-group.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as RadioGroupPrimitive from '@radix-ui/react-radio-group'\nimport { cva } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\nimport { useFieldContext } from './field'\n\n// Color maps for checked state\nconst radioColorMap = {\n default: {\n border: 'data-[state=checked]:border-foreground',\n dot: 'bg-foreground',\n },\n primary: {\n border: 'data-[state=checked]:border-primary',\n dot: 'bg-primary',\n },\n} as const\n\nexport type RadioColor = keyof typeof radioColorMap\n\n// Context to pass size, weight, color from RadioGroup to RadioGroupItem\ntype RadioGroupContextValue = {\n size: 'sm' | 'default' | 'lg'\n weight: 'thin' | 'bold'\n color: RadioColor\n disabled?: boolean\n}\nconst RadioGroupContext = React.createContext<RadioGroupContextValue>({ size: 'default', weight: 'bold', color: 'default' })\n\n// RadioGroup container\nconst radioGroupVariants = cva('grid gap-3', {\n variants: {\n orientation: {\n vertical: 'grid-cols-1',\n horizontal: 'grid-flow-col auto-cols-max gap-4',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n})\n\nexport interface RadioGroupProps\n extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root> {\n size?: 'sm' | 'default' | 'lg'\n weight?: 'thin' | 'bold'\n /** Checked state color */\n color?: RadioColor\n}\n\nconst RadioGroup = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Root>,\n RadioGroupProps\n>(({ className, orientation, size = 'default', weight = 'bold', color = 'default', disabled, ...props }, ref) => {\n const fieldContext = useFieldContext()\n const resolvedDisabled = disabled ?? fieldContext?.disabled\n\n return (\n <RadioGroupContext.Provider value={{ size, weight, color, disabled: resolvedDisabled }}>\n <RadioGroupPrimitive.Root\n ref={ref}\n className={cn(radioGroupVariants({ orientation }), className)}\n orientation={orientation || undefined}\n disabled={resolvedDisabled}\n {...props}\n />\n </RadioGroupContext.Provider>\n )\n})\nRadioGroup.displayName = 'RadioGroup'\n\n// RadioGroupItem circle variants\nconst radioItemVariants = cva(\n [\n 'relative shrink-0 rounded-full border-border-form hover:border-border-form-strong transition-all duration-micro ease-out',\n 'focus-visible:focus-ring',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n // Transparent hit area expansion via ::after\n \"after:absolute after:content-['']\",\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'w-3.5 h-3.5 after:-inset-[5px]', // 14px circle → 24px click\n default: 'w-4 h-4 after:-inset-2', // 16px circle → 32px click\n lg: 'w-5 h-5 after:-inset-2', // 20px circle → 36px click\n },\n weight: {\n thin: 'border', // 1px\n bold: 'border-2', // 2px\n },\n },\n defaultVariants: {\n size: 'default',\n weight: 'bold',\n },\n }\n)\n\n// Dot sizes per radio size\nconst dotSizes = {\n sm: 'w-1.5 h-1.5', // 6px\n default: 'w-2 h-2', // 8px\n lg: 'w-2.5 h-2.5', // 10px\n}\n\n// Label font sizes\nconst labelSizes = {\n sm: 'text-xs', // 12px\n default: 'text-md', // 14px\n lg: 'text-base', // 16px\n}\n\n// Gap between radio and label\nconst gapSizes = {\n sm: 'gap-1.5',\n default: 'gap-2',\n lg: 'gap-2.5',\n}\n\nexport interface RadioGroupItemProps\n extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> {\n label?: string\n}\n\nconst RadioGroupItem = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\n RadioGroupItemProps\n>(({ className, label, disabled, ...props }, ref) => {\n const { size, weight, color, disabled: groupDisabled } = React.useContext(RadioGroupContext)\n const resolvedDisabled = disabled ?? groupDisabled\n const itemId = React.useId()\n\n const radio = (\n <RadioGroupPrimitive.Item\n ref={ref}\n id={label ? itemId : undefined}\n disabled={resolvedDisabled}\n className={cn(\n radioItemVariants({ size, weight }),\n radioColorMap[color].border,\n className\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator className=\"flex items-center justify-center animate-radio-enter\">\n <div className={cn('rounded-full', radioColorMap[color].dot, dotSizes[size])} />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n\n if (!label) return radio\n\n return (\n <div className={cn('group flex items-center', gapSizes[size])}>\n <div className=\"flex items-center\">\n {radio}\n </div>\n <label\n htmlFor={itemId}\n className={cn(\n labelSizes[size],\n 'text-text-muted cursor-pointer select-none transition-colors duration-micro',\n 'group-hover:text-foreground',\n resolvedDisabled && 'opacity-50 cursor-not-allowed'\n )}\n >\n {label}\n </label>\n </div>\n )\n})\nRadioGroupItem.displayName = 'RadioGroupItem'\n\nexport { RadioGroup, RadioGroupItem, radioGroupV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B,SAAS,IAAI,CAAC,KAC1D,oCAAC,SAAI,WAAU,uBACZ,KACH,GACA;AAAA,IAAC;AAAA;AAAA,MACC,SAAS;AAAA,MACT,eAAW;AAAA,QACT,WAAW,IAAI;AAAA,QACf;AAAA,QACA;AAAA,QACA,oBAAoB;AAAA,MACtB;AAAA;AAAA,IAEC;AAAA,EACH,CACF;AAEJ,CAAC;AACD,eAAe,cAAc;","names":[]}
|
|
@@ -26,7 +26,7 @@ const radioGroupVariants = cva("grid gap-3", {
|
|
|
26
26
|
orientation: "vertical"
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
-
const
|
|
29
|
+
const RadioGroup = React.forwardRef(({ className, orientation, size = "default", weight = "bold", color = "default", disabled, ...props }, ref) => {
|
|
30
30
|
const fieldContext = useFieldContext();
|
|
31
31
|
const resolvedDisabled = disabled ?? fieldContext?.disabled;
|
|
32
32
|
return /* @__PURE__ */ React.createElement(RadioGroupContext.Provider, { value: { size, weight, color, disabled: resolvedDisabled } }, /* @__PURE__ */ React.createElement(
|
|
@@ -40,7 +40,7 @@ const RadioGroupRoot = React.forwardRef(({ className, orientation, size = "defau
|
|
|
40
40
|
}
|
|
41
41
|
));
|
|
42
42
|
});
|
|
43
|
-
|
|
43
|
+
RadioGroup.displayName = "RadioGroup";
|
|
44
44
|
const radioItemVariants = cva(
|
|
45
45
|
[
|
|
46
46
|
"relative shrink-0 rounded-full border-border-form hover:border-border-form-strong transition-all duration-micro ease-out",
|
|
@@ -128,9 +128,6 @@ const RadioGroupItem = React.forwardRef(({ className, label, disabled, ...props
|
|
|
128
128
|
));
|
|
129
129
|
});
|
|
130
130
|
RadioGroupItem.displayName = "RadioGroupItem";
|
|
131
|
-
const RadioGroup = Object.assign(RadioGroupRoot, {
|
|
132
|
-
Item: RadioGroupItem
|
|
133
|
-
});
|
|
134
131
|
export {
|
|
135
132
|
RadioGroup,
|
|
136
133
|
RadioGroupItem,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ui/radio-group.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as RadioGroupPrimitive from '@radix-ui/react-radio-group'\nimport { cva } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\nimport { useFieldContext } from './field'\n\n// Color maps for checked state\nconst radioColorMap = {\n default: {\n border: 'data-[state=checked]:border-foreground',\n dot: 'bg-foreground',\n },\n primary: {\n border: 'data-[state=checked]:border-primary',\n dot: 'bg-primary',\n },\n} as const\n\nexport type RadioColor = keyof typeof radioColorMap\n\n// Context to pass size, weight, color from RadioGroup to RadioGroupItem\ntype RadioGroupContextValue = {\n size: 'sm' | 'default' | 'lg'\n weight: 'thin' | 'bold'\n color: RadioColor\n disabled?: boolean\n}\nconst RadioGroupContext = React.createContext<RadioGroupContextValue>({ size: 'default', weight: 'bold', color: 'default' })\n\n// RadioGroup container\nconst radioGroupVariants = cva('grid gap-3', {\n variants: {\n orientation: {\n vertical: 'grid-cols-1',\n horizontal: 'grid-flow-col auto-cols-max gap-4',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n})\n\nexport interface RadioGroupProps\n extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root> {\n size?: 'sm' | 'default' | 'lg'\n weight?: 'thin' | 'bold'\n /** Checked state color */\n color?: RadioColor\n}\n\nconst
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/radio-group.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as RadioGroupPrimitive from '@radix-ui/react-radio-group'\nimport { cva } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\nimport { useFieldContext } from './field'\n\n// Color maps for checked state\nconst radioColorMap = {\n default: {\n border: 'data-[state=checked]:border-foreground',\n dot: 'bg-foreground',\n },\n primary: {\n border: 'data-[state=checked]:border-primary',\n dot: 'bg-primary',\n },\n} as const\n\nexport type RadioColor = keyof typeof radioColorMap\n\n// Context to pass size, weight, color from RadioGroup to RadioGroupItem\ntype RadioGroupContextValue = {\n size: 'sm' | 'default' | 'lg'\n weight: 'thin' | 'bold'\n color: RadioColor\n disabled?: boolean\n}\nconst RadioGroupContext = React.createContext<RadioGroupContextValue>({ size: 'default', weight: 'bold', color: 'default' })\n\n// RadioGroup container\nconst radioGroupVariants = cva('grid gap-3', {\n variants: {\n orientation: {\n vertical: 'grid-cols-1',\n horizontal: 'grid-flow-col auto-cols-max gap-4',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n})\n\nexport interface RadioGroupProps\n extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root> {\n size?: 'sm' | 'default' | 'lg'\n weight?: 'thin' | 'bold'\n /** Checked state color */\n color?: RadioColor\n}\n\nconst RadioGroup = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Root>,\n RadioGroupProps\n>(({ className, orientation, size = 'default', weight = 'bold', color = 'default', disabled, ...props }, ref) => {\n const fieldContext = useFieldContext()\n const resolvedDisabled = disabled ?? fieldContext?.disabled\n\n return (\n <RadioGroupContext.Provider value={{ size, weight, color, disabled: resolvedDisabled }}>\n <RadioGroupPrimitive.Root\n ref={ref}\n className={cn(radioGroupVariants({ orientation }), className)}\n orientation={orientation || undefined}\n disabled={resolvedDisabled}\n {...props}\n />\n </RadioGroupContext.Provider>\n )\n})\nRadioGroup.displayName = 'RadioGroup'\n\n// RadioGroupItem circle variants\nconst radioItemVariants = cva(\n [\n 'relative shrink-0 rounded-full border-border-form hover:border-border-form-strong transition-all duration-micro ease-out',\n 'focus-visible:focus-ring',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n // Transparent hit area expansion via ::after\n \"after:absolute after:content-['']\",\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'w-3.5 h-3.5 after:-inset-[5px]', // 14px circle → 24px click\n default: 'w-4 h-4 after:-inset-2', // 16px circle → 32px click\n lg: 'w-5 h-5 after:-inset-2', // 20px circle → 36px click\n },\n weight: {\n thin: 'border', // 1px\n bold: 'border-2', // 2px\n },\n },\n defaultVariants: {\n size: 'default',\n weight: 'bold',\n },\n }\n)\n\n// Dot sizes per radio size\nconst dotSizes = {\n sm: 'w-1.5 h-1.5', // 6px\n default: 'w-2 h-2', // 8px\n lg: 'w-2.5 h-2.5', // 10px\n}\n\n// Label font sizes\nconst labelSizes = {\n sm: 'text-xs', // 12px\n default: 'text-md', // 14px\n lg: 'text-base', // 16px\n}\n\n// Gap between radio and label\nconst gapSizes = {\n sm: 'gap-1.5',\n default: 'gap-2',\n lg: 'gap-2.5',\n}\n\nexport interface RadioGroupItemProps\n extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> {\n label?: string\n}\n\nconst RadioGroupItem = React.forwardRef<\n React.ElementRef<typeof RadioGroupPrimitive.Item>,\n RadioGroupItemProps\n>(({ className, label, disabled, ...props }, ref) => {\n const { size, weight, color, disabled: groupDisabled } = React.useContext(RadioGroupContext)\n const resolvedDisabled = disabled ?? groupDisabled\n const itemId = React.useId()\n\n const radio = (\n <RadioGroupPrimitive.Item\n ref={ref}\n id={label ? itemId : undefined}\n disabled={resolvedDisabled}\n className={cn(\n radioItemVariants({ size, weight }),\n radioColorMap[color].border,\n className\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator className=\"flex items-center justify-center animate-radio-enter\">\n <div className={cn('rounded-full', radioColorMap[color].dot, dotSizes[size])} />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n\n if (!label) return radio\n\n return (\n <div className={cn('group flex items-center', gapSizes[size])}>\n <div className=\"flex items-center\">\n {radio}\n </div>\n <label\n htmlFor={itemId}\n className={cn(\n labelSizes[size],\n 'text-text-muted cursor-pointer select-none transition-colors duration-micro',\n 'group-hover:text-foreground',\n resolvedDisabled && 'opacity-50 cursor-not-allowed'\n )}\n >\n {label}\n </label>\n </div>\n )\n})\nRadioGroupItem.displayName = 'RadioGroupItem'\n\nexport { RadioGroup, RadioGroupItem, radioGroupVariants, radioItemVariants }\n"],"mappings":";AAEA,YAAY,WAAW;AAC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WAAW;AAAA,QACT,WAAW,IAAI;AAAA,QACf;AAAA,QACA;AAAA,QACA,oBAAoB;AAAA,MACtB;AAAA;AAAA,IAEC;AAAA,EACH,CACF;AAEJ,CAAC;AACD,eAAe,cAAc;","names":[]}
|
|
@@ -17,14 +17,9 @@ declare const segmentedItemVariants: (props?: ({
|
|
|
17
17
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
18
18
|
interface SegmentedProps extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>, VariantProps<typeof segmentedVariants> {
|
|
19
19
|
}
|
|
20
|
+
declare const Segmented: React.ForwardRefExoticComponent<SegmentedProps & React.RefAttributes<HTMLDivElement>>;
|
|
20
21
|
interface SegmentedItemProps extends React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>, Omit<VariantProps<typeof segmentedItemVariants>, 'variant'> {
|
|
21
22
|
}
|
|
22
23
|
declare const SegmentedItem: React.ForwardRefExoticComponent<SegmentedItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
23
|
-
declare const Segmented: React.ForwardRefExoticComponent<SegmentedProps & React.RefAttributes<HTMLDivElement>> & {
|
|
24
|
-
Item: React.ForwardRefExoticComponent<SegmentedItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
25
|
-
};
|
|
26
|
-
declare namespace Segmented {
|
|
27
|
-
type ItemProps = SegmentedItemProps;
|
|
28
|
-
}
|
|
29
24
|
|
|
30
25
|
export { Segmented, SegmentedItem, type SegmentedItemProps, type SegmentedProps, segmentedItemVariants, segmentedVariants };
|