@sarunyu/system-one 2.0.2 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -3
- package/llms.txt +259 -274
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/lib/utils.ts","../src/components/button.tsx","../src/components/card.tsx","../src/components/layout.tsx","../src/components/chip.tsx","../src/components/ui/use-mobile.ts","../src/components/ui/drawer.tsx","../src/components/date-input.tsx","../src/components/dropdown.tsx","../src/components/dropdown-multiple.tsx","../src/components/input.tsx","../src/components/option-list.tsx","../src/components/search-input.tsx","../src/components/tab.tsx","../src/components/tag.tsx","../src/components/textarea.tsx","../src/components/time-input.tsx"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport React, { useState, forwardRef } from \"react\";\nimport { cn } from \"../lib/utils\";\n\nexport type ButtonLabelSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type ButtonIconSize = \"icon-xs\" | \"icon-sm\" | \"icon-md\" | \"icon-lg\" | \"icon-xl\";\nexport type ButtonSize = ButtonLabelSize | ButtonIconSize;\n\nexport type ButtonVariant = \"primary\" | \"outline\" | \"plain\" | \"outline-black\" | \"plain-black\" | \"disabled\";\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Button size. Label sizes: xs, sm, md, lg, xl. Icon-only sizes: icon-xs through icon-xl. Default: \"md\". */\n size?: ButtonSize;\n /** Visual style. Use \"primary\" for the main CTA, \"outline\" for secondary, \"plain\" for tertiary. Default: \"primary\". */\n variant?: ButtonVariant;\n children?: React.ReactNode;\n /** Icon element rendered to the left of the label. Only applies to label-size buttons. */\n leftIcon?: React.ReactNode;\n /** Icon element rendered to the right of the label. Only applies to label-size buttons. */\n rightIcon?: React.ReactNode;\n}\n\n// ─── Label-size maps (use token-based Tailwind classes) ───────────────────────\nconst labelIconSizeClass: Record<ButtonLabelSize, string> = {\n xs: \"h-4 w-4\", // 16px\n sm: \"h-4.5 w-4.5\", // ~18px\n md: \"h-4.5 w-4.5\",\n lg: \"h-5 w-5\", // 20px\n xl: \"h-5 w-5\",\n};\n\nconst gapClass: Record<ButtonLabelSize, string> = {\n xs: \"gap-0.5\", // 2px\n sm: \"gap-0.5\",\n md: \"gap-0.5\",\n lg: \"gap-1\", // 4px\n xl: \"gap-1\",\n};\n\nconst textSizeClass: Record<ButtonLabelSize, string> = {\n xs: \"text-xs leading-4\",\n sm: \"text-sm leading-5\",\n md: \"text-sm leading-5\",\n lg: \"text-sm leading-5\",\n xl: \"text-sm leading-5\",\n};\n\nconst roundedLabelClass: Record<ButtonLabelSize, string> = {\n xs: \"rounded\",\n sm: \"rounded-md\",\n md: \"rounded-md\",\n lg: \"rounded-lg\",\n xl: \"rounded-lg\",\n};\n\nfunction getPaddingClasses(\n size: ButtonLabelSize,\n hasLeft: boolean,\n hasRight: boolean,\n): readonly [string, string, string] {\n const pyMap: Record<ButtonLabelSize, string> = {\n xs: \"py-1\", // 4px\n sm: \"py-1\", // 4px\n md: \"py-1.5\", // 6px\n lg: \"py-2\", // 8px\n xl: \"py-2.5\", // 10px\n };\n const pxMap: Record<ButtonLabelSize, { l: string; r: string }> = {\n xs: { l: \"pl-1.5\", r: \"pr-1.5\" }, // 6px\n sm: { l: \"pl-2\", r: \"pr-2\" }, // 8px\n md: { l: \"pl-2.5\", r: \"pr-2.5\" }, // 10px\n lg: { l: \"pl-3.5\", r: \"pr-3.5\" }, // 14px\n xl: { l: \"pl-4\", r: \"pr-4\" }, // 16px\n };\n const reducedMap: Record<ButtonLabelSize, { l: string; r: string }> = {\n xs: { l: \"pl-1.5\", r: \"pr-1.5\" },\n sm: { l: \"pl-1.5\", r: \"pr-1.5\" },\n md: { l: \"pl-2\", r: \"pr-2\" },\n lg: { l: \"pl-2.5\", r: \"pr-2.5\" },\n xl: { l: \"pl-3\", r: \"pr-3\" },\n };\n return [\n hasLeft ? reducedMap[size].l : pxMap[size].l,\n hasRight ? reducedMap[size].r : pxMap[size].r,\n pyMap[size],\n ] as const;\n}\n\n// ─── Icon-size specs (from Figma) ─────────────────────────────────────────────\nconst iconSizeSpec: Record<ButtonIconSize, { btn: string; icon: number; rounded: string }> = {\n \"icon-xs\": { btn: \"h-6 w-6\", icon: 16, rounded: \"rounded\" },\n \"icon-sm\": { btn: \"h-7 w-7\", icon: 18, rounded: \"rounded-md\" },\n \"icon-md\": { btn: \"h-8 w-8\", icon: 18, rounded: \"rounded-md\" },\n \"icon-lg\": { btn: \"h-9 w-9\", icon: 20, rounded: \"rounded-lg\" },\n \"icon-xl\": { btn: \"h-10 w-10\", icon: 20, rounded: \"rounded-lg\" },\n};\n\n// ─── Variant colours ──────────────────────────────────────────────────────────\nfunction getVariantClasses(variant: ButtonVariant, isDisabled: boolean): string {\n if (isDisabled) {\n if (variant === \"outline\" || variant === \"outline-black\")\n return \"bg-disabled-bg text-disabled border border-border-disabled cursor-not-allowed\";\n return \"bg-disabled-bg text-disabled cursor-not-allowed\";\n }\n if (variant === \"outline\")\n return \"bg-background text-primary-action border border-border hover:bg-hover-bg active:bg-disabled-bg\";\n if (variant === \"plain\")\n return \"bg-transparent text-primary-action hover:bg-hover-bg active:bg-disabled-bg\";\n // Black label variants — hover only, no active state (by design)\n if (variant === \"outline-black\")\n return \"bg-background text-foreground border border-border hover:bg-hover-bg\";\n if (variant === \"plain-black\")\n return \"bg-transparent text-foreground hover:bg-hover-bg\";\n // primary\n return \"bg-primary-action text-on-primary-action hover:bg-primary-action-hover active:bg-primary-action-active\";\n}\n\n// ─── Component ────────────────────────────────────────────────────────────────\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n size = \"md\",\n variant = \"primary\",\n children,\n leftIcon,\n rightIcon,\n disabled,\n className = \"\",\n // Destructure pointer events so we can merge with ghost-icon active handlers\n onPointerDown,\n onPointerUp,\n onPointerLeave,\n ...props\n },\n ref,\n) {\n const isDisabled = variant === \"disabled\" || !!disabled;\n const isGhost = variant === \"outline-black\" || variant === \"plain-black\";\n const isIconOnly = size.startsWith(\"icon-\");\n\n // ── Ghost icon-only active state ──────────────────────────────────────────\n // Ghost icon-only buttons have a Press state: disabled-bg + disabled icon color.\n // We drive this via React state so it works regardless of Tailwind cascade order.\n // Ghost LABEL buttons have no active state (by design).\n const [ghostPressed, setGhostPressed] = useState(false);\n\n const needsGhostPress = isGhost && isIconOnly && !isDisabled;\n\n const ghostPressStyle: React.CSSProperties | undefined = needsGhostPress && ghostPressed\n ? { backgroundColor: \"var(--disabled-bg)\", color: \"var(--disabled)\" }\n : undefined;\n\n // Merged pointer handlers (preserve any consumer-supplied handlers)\n const handlePointerDown = needsGhostPress\n ? (e: React.PointerEvent<HTMLButtonElement>) => { setGhostPressed(true); onPointerDown?.(e); }\n : onPointerDown;\n const handlePointerUp = needsGhostPress\n ? (e: React.PointerEvent<HTMLButtonElement>) => { setGhostPressed(false); onPointerUp?.(e); }\n : onPointerUp;\n const handlePointerLeave = needsGhostPress\n ? (e: React.PointerEvent<HTMLButtonElement>) => { setGhostPressed(false); onPointerLeave?.(e); }\n : onPointerLeave;\n\n const variantClasses = getVariantClasses(variant, isDisabled);\n const cursorClass = isDisabled ? \"cursor-not-allowed\" : \"cursor-pointer\";\n const baseClasses =\n \"inline-flex items-center justify-center font-medium whitespace-nowrap transition-colors duration-150 select-none\";\n\n // ── Icon-only (size = \"icon-*\") ────────────────────────────────────────────\n if (isIconOnly) {\n const spec = iconSizeSpec[size as ButtonIconSize];\n return (\n <button\n ref={ref}\n className={cn(\n baseClasses,\n spec.rounded,\n spec.btn,\n \"shrink-0\",\n variantClasses,\n cursorClass,\n className,\n )}\n style={ghostPressStyle}\n disabled={isDisabled}\n aria-label=\"icon button\"\n onPointerDown={handlePointerDown}\n onPointerUp={handlePointerUp}\n onPointerLeave={handlePointerLeave}\n {...props}\n >\n <span\n className={cn(\"flex items-center justify-center\")}\n aria-hidden=\"true\"\n style={{ width: spec.icon, height: spec.icon }}\n >\n {children}\n </span>\n </button>\n );\n }\n\n // ── Labelled button ────────────────────────────────────────────────────────\n const labelSize = size as ButtonLabelSize;\n const hasLeft = Boolean(leftIcon);\n const hasRight = Boolean(rightIcon);\n const paddingParts = getPaddingClasses(labelSize, hasLeft, hasRight);\n\n return (\n <button\n ref={ref}\n className={cn(\n baseClasses,\n roundedLabelClass[labelSize],\n paddingParts[0],\n paddingParts[1],\n paddingParts[2],\n hasLeft || hasRight ? gapClass[labelSize] : undefined,\n variantClasses,\n cursorClass,\n textSizeClass[labelSize],\n className,\n )}\n disabled={isDisabled}\n onPointerDown={onPointerDown}\n onPointerUp={onPointerUp}\n onPointerLeave={onPointerLeave}\n {...props}\n >\n {hasLeft && (\n <span\n className={cn(\n \"flex items-center justify-center shrink-0 overflow-hidden\",\n labelIconSizeClass[labelSize],\n )}\n aria-hidden=\"true\"\n >\n {leftIcon}\n </span>\n )}\n\n {children ?? \"Button\"}\n\n {hasRight && (\n <span\n className={cn(\n \"flex items-center justify-center shrink-0 overflow-hidden\",\n labelIconSizeClass[labelSize],\n )}\n aria-hidden=\"true\"\n >\n {rightIcon}\n </span>\n )}\n </button>\n );\n});\n\nButton.displayName = \"Button\";\n","\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { CalendarBlank, Lock, MapPin, Users } from \"@phosphor-icons/react\";\nimport { cn } from \"../lib/utils\";\n\nconst imgBanner = \"\";\n\nexport type CardVariant = \"desktop\" | \"tablet\" | \"mobile\";\nexport type CardTagStatus = \"not-registered\" | \"registered\" | \"full\";\n\nexport interface CardProps {\n /** Responsive layout preset. desktop=308px, tablet=224px, mobile=163px. Default: \"desktop\". */\n variant?: CardVariant;\n /** Event title (clamped to 2 lines). */\n title?: string;\n /** Formatted date string, e.g. \"Jun 23, 2024\". */\n date?: string;\n /** Time range string, e.g. \"08:30 - 12:00\". */\n time?: string;\n /** Location/venue name. */\n location?: string;\n /** Whether to show the location row. Default: true. */\n showLocation?: boolean;\n /** Whether to show the audience count row. Default: true. */\n showAudience?: boolean;\n /** Audience count string, e.g. \"200/200\". */\n count?: string;\n /** Shows a lock badge on the banner image. */\n locked?: boolean;\n /** Registration status shown as a colored tag at the bottom. */\n tagStatus?: CardTagStatus;\n /** URL for the banner image. */\n image?: string;\n className?: string;\n}\n\nfunction LockIcon() {\n return <Lock size={16} weight=\"regular\" color=\"var(--subtle-text)\" />;\n}\nfunction CalendarIcon() {\n return <CalendarBlank size={16} weight=\"regular\" color=\"var(--accent-orange)\" />;\n}\nfunction LocationIcon() {\n return <MapPin size={16} weight=\"regular\" color=\"var(--subtle-text)\" />;\n}\nfunction AudienceIcon() {\n return <Users size={16} weight=\"regular\" color=\"var(--subtle-text)\" />;\n}\n\nconst tagConfig: Record<CardTagStatus, { bg: string; text: string; label: string }> = {\n \"not-registered\": {\n bg: \"var(--disabled-bg)\",\n text: \"var(--disabled)\",\n label: \"ยังไม่ลงทะเบียน\",\n },\n registered: {\n bg: \"var(--success-bg)\",\n text: \"var(--success)\",\n label: \"ลงทะเบียนแล้ว\",\n },\n full: {\n bg: \"var(--error-bg)\",\n text: \"var(--destructive)\",\n label: \"เต็มแล้ว\",\n },\n};\n\nexport const Card = forwardRef<HTMLDivElement, CardProps>(function Card(\n {\n variant = \"desktop\",\n title = \"Lorem ipsum dolor sit amet consectetur. Lectus viverraasdasd\",\n date = \"23 มิ.ย. 2567\",\n time = \"08.30 - 12.00\",\n location = \"ณ หอประชุมศาสตราจารย์สังเวียน อินทรวิชัย ชั้น 7 ตลาดหลักทรัพย์แห่งประเทศไทย\",\n showLocation = true,\n showAudience = true,\n count = \"200/200\",\n locked = true,\n tagStatus = \"not-registered\",\n image,\n className,\n },\n ref,\n) {\n const widthClass =\n variant === \"desktop\" ? \"w-[308px]\" : variant === \"tablet\" ? \"w-[224px]\" : \"w-[163px]\";\n const padding =\n variant === \"desktop\" ? \"p-4\" : variant === \"tablet\" ? \"p-3\" : \"p-2.5\";\n const titleGap = variant === \"desktop\" ? \"gap-1.5\" : \"gap-1\";\n const bannerClass = variant === \"desktop\" ? \"h-[173px]\" : \"aspect-video w-full\";\n const tag = tagConfig[tagStatus];\n const bannerSrc = image ?? imgBanner;\n\n return (\n <div\n ref={ref}\n className={cn(\n \"flex min-h-[120px] flex-col items-start overflow-clip rounded-[8px]\",\n \"shadow-card\",\n widthClass,\n className,\n )}\n >\n <div className={cn(\"relative w-full shrink-0 overflow-clip\", bannerClass)}>\n <img\n alt=\"event banner\"\n className=\"pointer-events-none absolute inset-0 size-full object-cover\"\n src={bannerSrc}\n />\n {locked && (\n <div\n className={cn(\n \"absolute left-[8px] top-[8px] flex items-center gap-[4px] rounded-[4px] bg-hover-bg px-[6px] py-[4px]\",\n )}\n >\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-0 rounded-[4px] border border-solid border-border\"\n />\n <LockIcon />\n <p className=\"whitespace-nowrap text-[12px] leading-[18px] text-subtle-text\">Lock</p>\n </div>\n )}\n </div>\n <div className={cn(\"w-full shrink-0 bg-card\", padding)}>\n <div className={cn(\"flex w-full flex-col items-start\", titleGap)}>\n <div className=\"flex w-full flex-col items-start gap-1\">\n <p\n className={cn(\n \"line-clamp-2 w-full overflow-hidden text-ellipsis text-sm leading-5 text-foreground\",\n )}\n >\n {title}\n </p>\n <div className=\"flex w-full items-center gap-2\">\n <div className=\"flex h-[22px] shrink-0 items-center gap-1\">\n <CalendarIcon />\n <p className=\"whitespace-nowrap text-xs leading-4 text-accent-orange\">\n {date}\n </p>\n </div>\n <div className=\"h-[14px] w-px shrink-0 bg-border\" />\n <p\n className={cn(\n \"min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-xs leading-4 text-subtle-text\",\n )}\n >\n {time}\n </p>\n </div>\n {showLocation && (\n <div className=\"flex h-[22px] w-full items-center gap-1\">\n <LocationIcon />\n <p\n className={cn(\n \"min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-xs leading-4 text-subtle-text\",\n )}\n >\n {location}\n </p>\n </div>\n )}\n {showAudience && (\n <div className=\"flex h-[22px] w-full items-center gap-1\">\n <AudienceIcon />\n <p className=\"shrink-0 whitespace-nowrap text-xs leading-4 text-subtle-text\">\n ผู้เข้าร่วม\n </p>\n <p className=\"shrink-0 whitespace-nowrap text-xs leading-4 text-primary-action\">\n {count}\n </p>\n </div>\n )}\n </div>\n <div className=\"flex shrink-0 items-start\">\n <div\n className=\"flex items-center justify-center gap-[2px] overflow-clip rounded-[4px] px-[8px] py-[4px]\"\n style={{ backgroundColor: tag.bg }}\n >\n <p className=\"whitespace-nowrap text-[12px] leading-[16px]\" style={{ color: tag.text }}>\n {tag.label}\n </p>\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n});\n\nCard.displayName = \"Card\";\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { cn } from \"../lib/utils\";\n\n// ─── Page ────────────────────────────────────────────────────────────────────\n\nexport type PageWidth = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"full\";\n\nconst pageWidthClass: Record<PageWidth, string> = {\n sm: \"max-w-[640px]\",\n md: \"max-w-[960px]\",\n lg: \"max-w-[1200px]\",\n xl: \"max-w-[1440px]\",\n full: \"max-w-none\",\n};\n\nexport interface PageProps extends React.HTMLAttributes<HTMLElement> {\n /** Container max-width. Default \"lg\" (1200px). */\n width?: PageWidth;\n}\n\nexport const Page = forwardRef<HTMLElement, PageProps>(function Page(\n { width = \"lg\", className, children, ...rest },\n ref,\n) {\n return (\n <main\n ref={ref}\n className={cn(\n \"mx-auto w-full px-6 md:px-8 py-10 flex flex-col gap-12\",\n pageWidthClass[width],\n className,\n )}\n {...rest}\n >\n {children}\n </main>\n );\n});\n\n// ─── PageHeader ──────────────────────────────────────────────────────────────\n\nexport interface PageHeaderProps\n extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n title: React.ReactNode;\n description?: React.ReactNode;\n /** Right-aligned actions (buttons, links). */\n actions?: React.ReactNode;\n /** Content above the title (badges, breadcrumb). */\n eyebrow?: React.ReactNode;\n}\n\nexport const PageHeader = forwardRef<HTMLElement, PageHeaderProps>(\n function PageHeader(\n { title, description, actions, eyebrow, className, ...rest },\n ref,\n ) {\n return (\n <header\n ref={ref}\n className={cn(\n \"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between\",\n className,\n )}\n {...rest}\n >\n <div className=\"flex flex-col gap-2 min-w-0\">\n {eyebrow && (\n <div className=\"flex flex-wrap items-center gap-2\">{eyebrow}</div>\n )}\n <h1>{title}</h1>\n {description && (\n <p className=\"text-muted-foreground max-w-[720px]\">{description}</p>\n )}\n </div>\n {actions && (\n <div className=\"flex flex-wrap items-center gap-3 shrink-0\">\n {actions}\n </div>\n )}\n </header>\n );\n },\n);\n\n// ─── Section ─────────────────────────────────────────────────────────────────\n\nexport interface SectionProps\n extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n title?: React.ReactNode;\n description?: React.ReactNode;\n /** Right-aligned actions beside the title. */\n actions?: React.ReactNode;\n}\n\nexport const Section = forwardRef<HTMLElement, SectionProps>(function Section(\n { title, description, actions, className, children, ...rest },\n ref,\n) {\n const hasHeader = Boolean(title || description || actions);\n return (\n <section\n ref={ref}\n className={cn(\"flex flex-col gap-6\", className)}\n {...rest}\n >\n {hasHeader && (\n <div className=\"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between\">\n <div className=\"flex flex-col gap-1 min-w-0\">\n {title && <h2>{title}</h2>}\n {description && (\n <p className=\"text-muted-foreground max-w-[720px]\">\n {description}\n </p>\n )}\n </div>\n {actions && (\n <div className=\"flex flex-wrap items-center gap-3 shrink-0\">\n {actions}\n </div>\n )}\n </div>\n )}\n {children}\n </section>\n );\n});\n\n// ─── Toolbar ─────────────────────────────────────────────────────────────────\n\nexport interface ToolbarProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Right-aligned cluster (pushed with ml-auto). */\n end?: React.ReactNode;\n}\n\nexport const Toolbar = forwardRef<HTMLDivElement, ToolbarProps>(\n function Toolbar({ end, className, children, ...rest }, ref) {\n return (\n <div\n ref={ref}\n className={cn(\n \"flex flex-wrap items-center gap-3\",\n className,\n )}\n {...rest}\n >\n {children}\n {end && <div className=\"ml-auto flex items-center gap-3\">{end}</div>}\n </div>\n );\n },\n);\n\n// ─── CardGrid ────────────────────────────────────────────────────────────────\n\nexport type CardGridCols = 2 | 3 | 4;\n\nconst cardGridColsClass: Record<CardGridCols, string> = {\n 2: \"grid-cols-1 sm:grid-cols-2\",\n 3: \"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3\",\n 4: \"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4\",\n};\n\nexport interface CardGridProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Max columns at wide breakpoints. Default 3. */\n cols?: CardGridCols;\n}\n\nexport const CardGrid = forwardRef<HTMLDivElement, CardGridProps>(\n function CardGrid({ cols = 3, className, children, ...rest }, ref) {\n return (\n <div\n ref={ref}\n className={cn(\"grid gap-6\", cardGridColsClass[cols], className)}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\n\n// ─── Stack ───────────────────────────────────────────────────────────────────\n\nexport type StackGap = 1 | 2 | 3 | 4 | 6 | 8 | 10 | 12;\nexport type StackDirection = \"row\" | \"col\";\nexport type StackAlign = \"start\" | \"center\" | \"end\" | \"stretch\";\nexport type StackJustify =\n | \"start\"\n | \"center\"\n | \"end\"\n | \"between\"\n | \"around\";\n\nconst stackGapClass: Record<StackGap, string> = {\n 1: \"gap-1\",\n 2: \"gap-2\",\n 3: \"gap-3\",\n 4: \"gap-4\",\n 6: \"gap-6\",\n 8: \"gap-8\",\n 10: \"gap-10\",\n 12: \"gap-12\",\n};\n\nconst stackAlignClass: Record<StackAlign, string> = {\n start: \"items-start\",\n center: \"items-center\",\n end: \"items-end\",\n stretch: \"items-stretch\",\n};\n\nconst stackJustifyClass: Record<StackJustify, string> = {\n start: \"justify-start\",\n center: \"justify-center\",\n end: \"justify-end\",\n between: \"justify-between\",\n around: \"justify-around\",\n};\n\nexport interface StackProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Flex direction. Default \"col\". */\n direction?: StackDirection;\n /** Spacing scale (maps to Tailwind gap-*). Default 4 (16px). */\n gap?: StackGap;\n align?: StackAlign;\n justify?: StackJustify;\n /** Wrap children on row direction. */\n wrap?: boolean;\n}\n\nexport const Stack = forwardRef<HTMLDivElement, StackProps>(function Stack(\n {\n direction = \"col\",\n gap = 4,\n align,\n justify,\n wrap,\n className,\n children,\n ...rest\n },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cn(\n \"flex\",\n direction === \"col\" ? \"flex-col\" : \"flex-row\",\n stackGapClass[gap],\n align && stackAlignClass[align],\n justify && stackJustifyClass[justify],\n wrap && \"flex-wrap\",\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n );\n});\n","\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { Check, Plus } from \"@phosphor-icons/react\";\nimport { cn } from \"../lib/utils\";\n\nexport type ChipType = \"single\" | \"multiple\";\nexport type ChipSize = \"large\" | \"medium\" | \"small\";\n\nexport interface ChipProps {\n /** Label text displayed inside the chip. Default: \"Chips Text\". */\n label?: string;\n /** \"single\" shows no icon; \"multiple\" shows Plus (unselected) / Check (selected). Default: \"single\". */\n type?: ChipType;\n /** Visual size of the chip. Default: \"large\". */\n size?: ChipSize;\n /** Whether the chip is in the selected/active state. */\n selected?: boolean;\n /** Whether the chip is non-interactive. */\n disabled?: boolean;\n onClick?: () => void;\n className?: string;\n}\n\nconst sizeStyles: Record<\n ChipSize,\n {\n container: string;\n text: string;\n icon: string;\n }\n> = {\n large: {\n container: \"h-9 px-3 gap-1\",\n text: \"text-sm leading-5\",\n icon: \"icon-lg\",\n },\n medium: {\n container: \"h-8 px-3 gap-1\",\n text: \"text-sm leading-5\",\n icon: \"icon-lg\",\n },\n small: {\n container: \"h-7 px-2.5 gap-0.5\",\n text: \"text-xs leading-4\",\n icon: \"icon-md\",\n },\n};\n\nconst multiplePaddingBySize: Record<ChipSize, string> = {\n large: \"pl-[8px] pr-[12px]\",\n medium: \"pl-[8px] pr-[12px]\",\n small: \"pl-[6px] pr-[10px]\",\n};\n\nexport const Chip = forwardRef<HTMLButtonElement, ChipProps>(function Chip(\n {\n label = \"Chips Text\",\n type = \"single\",\n size = \"large\",\n selected = false,\n disabled = false,\n onClick,\n className,\n },\n ref\n) {\n const s = sizeStyles[size];\n const isMultiple = type === \"multiple\";\n const state = disabled\n ? selected\n ? \"selected-disabled\"\n : \"disabled\"\n : selected\n ? \"selected\"\n : \"default\";\n\n const containerClass =\n state === \"selected\"\n ? \"bg-primary-action border border-primary-action\"\n : state === \"selected-disabled\"\n ? \"bg-selected-light-bg border border-transparent\"\n : state === \"disabled\"\n ? \"bg-disabled-bg border border-transparent\"\n : \"bg-background border border-border\";\n\n const textClass =\n state === \"selected\"\n ? \"text-on-primary-action\"\n : state === \"selected-disabled\"\n ? \"text-primary-action/40\"\n : state === \"disabled\"\n ? \"text-disabled\"\n : \"text-subtle-text\";\n\n const iconClass =\n state === \"selected\"\n ? \"text-on-primary-action\"\n : state === \"selected-disabled\"\n ? \"text-primary-action/40\"\n : state === \"disabled\"\n ? \"text-disabled\"\n : \"text-subtle-text\";\n\n const icon =\n isMultiple && selected ? (\n <Check aria-hidden=\"true\" weight=\"regular\" className={cn(\"shrink-0\", s.icon, iconClass)} />\n ) : isMultiple ? (\n <Plus aria-hidden=\"true\" weight=\"regular\" className={cn(\"shrink-0\", s.icon, iconClass)} />\n ) : null;\n\n return (\n <button\n ref={ref}\n type=\"button\"\n onClick={!disabled ? onClick : undefined}\n disabled={disabled}\n aria-pressed={selected}\n className={cn(\n \"inline-flex items-center justify-center rounded-full whitespace-nowrap border transition-colors\",\n s.container,\n isMultiple && multiplePaddingBySize[size],\n containerClass,\n disabled ? \"cursor-not-allowed\" : \"cursor-pointer\",\n className\n )}\n >\n {icon}\n <span className={cn(\"font-normal\", s.text, textClass)}>{label}</span>\n </button>\n );\n});\n\nChip.displayName = \"Chip\";\n","import * as React from \"react\";\n\nconst MOBILE_BREAKPOINT = 768;\n\nexport function useIsMobile() {\n const [isMobile, setIsMobile] = React.useState<boolean | undefined>(\n undefined,\n );\n\n React.useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n };\n mql.addEventListener(\"change\", onChange);\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return !!isMobile;\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Drawer as DrawerPrimitive } from \"vaul\";\n\nimport { cn } from \"../../lib/utils\";\n\nfunction Drawer({\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Root>) {\n return <DrawerPrimitive.Root data-slot=\"drawer\" {...props} />;\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 data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction DrawerContent({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Content>) {\n return (\n <DrawerPortal data-slot=\"drawer-portal\">\n <DrawerOverlay />\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 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b\",\n \"data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t\",\n \"data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm\",\n \"data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm\",\n className,\n )}\n {...props}\n >\n <div className=\"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block\" />\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(\"flex flex-col gap-1.5 p-4\", className)}\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","\"use client\";\n\nimport React, {\n useState,\n useRef,\n useEffect,\n useCallback,\n forwardRef,\n} from \"react\";\nimport type { DateRange, CaptionProps } from \"react-day-picker\";\nimport { DayPicker, useNavigation } from \"react-day-picker\";\nimport * as Popover from \"@radix-ui/react-popover\";\nimport {\n CalendarBlank,\n CaretDoubleLeft,\n CaretDoubleRight,\n CaretLeft,\n CaretRight,\n Minus,\n} from \"@phosphor-icons/react\";\nimport { cn } from \"../lib/utils\";\nimport { useIsMobile } from \"./ui/use-mobile\";\nimport { Button } from \"./button\";\nimport {\n Drawer,\n DrawerContent,\n DrawerTrigger,\n DrawerTitle,\n} from \"./ui/drawer\";\n\nexport type { DateRange };\nexport type DateInputState =\n | \"default\"\n | \"focus\"\n | \"error\"\n | \"disabled\";\nexport type DateInputMode = \"single\" | \"range\";\n/** \"calendar\" = DayPicker grid (default), \"scroll\" = drum-scroll picker (single mode only) */\nexport type DatePickerVariant = \"calendar\" | \"scroll\";\n\nexport interface DateInputProps {\n mode?: DateInputMode;\n /** Floating label / placeholder text */\n placeholder?: string;\n /** Shows red asterisk */\n required?: boolean;\n /** Override visual state (for showcase) */\n forceState?: DateInputState;\n /** Error message shown below in error state */\n errorMessage?: string;\n /** Helper text shown below */\n helperText?: string;\n /** \"calendar\" (default) or \"scroll\" drum picker. Scroll only works with mode=\"single\". */\n pickerVariant?: DatePickerVariant;\n /** Controlled value – single mode */\n value?: Date;\n onChange?: (date: Date | undefined) => void;\n /** Controlled value – range mode */\n dateRange?: DateRange;\n onRangeChange?: (range: DateRange | undefined) => void;\n /** Gregorian years that are disabled in the year picker grid */\n disabledYears?: number[];\n className?: string;\n}\n\n// ─── Constants ────────────────────────────────────────────────────────────────\n\nconst THAI_MONTHS_SHORT = [\n \"ม.ค.\",\n \"ก.พ.\",\n \"มี.ค.\",\n \"เม.ย.\",\n \"พ.ค.\",\n \"มิ.ย.\",\n \"ก.ค.\",\n \"ส.ค.\",\n \"ก.ย.\",\n \"ต.ค.\",\n \"พ.ย.\",\n \"ธ.ค.\",\n];\nconst THAI_MONTHS_FULL = [\n \"มกราคม\",\n \"กุมภาพันธ์\",\n \"มีนาคม\",\n \"เมษายน\",\n \"พฤษภาคม\",\n \"มิถุนายน\",\n \"กรกฎาคม\",\n \"สิงหาคม\",\n \"กันยายน\",\n \"ตุลาคม\",\n \"พฤศจิกายน\",\n \"ธันวาคม\",\n];\nconst THAI_WEEKDAYS = [\"อา\", \"จ\", \"อ\", \"พ\", \"พฤ\", \"ศ\", \"ส\"];\n\nfunction formatThaiDate(date: Date): string {\n return `${date.getDate()} ${THAI_MONTHS_SHORT[date.getMonth()]} ${date.getFullYear() + 543}`;\n}\n\n// ─── Context: tells Caption it's inside a Drawer range picker ────────────────\nconst DrawerRangeCtx = React.createContext(false);\n\n// ─── Context: disabled years / months passed into CustomCaption ──────────────\ninterface DisabledDatesCtxValue {\n disabledYears?: number[];\n}\nconst DisabledDatesCtx = React.createContext<DisabledDatesCtxValue>({});\n\n// ─── Custom Caption with << < label > >> ─────────────────────────────────────\nconst NAV_BTN_CLASS = cn(\n \"h-[28px] w-[28px] inline-flex items-center justify-center\",\n \"rounded-[6px] bg-transparent border border-border cursor-pointer\",\n \"text-muted-foreground hover:bg-disabled-bg transition-colors duration-100\",\n \"p-0 outline-none\",\n);\n\ntype CaptionView = \"days\" | \"months\" | \"years\";\n\nfunction CustomCaption({\n displayMonth,\n displayIndex,\n}: CaptionProps) {\n const { goToMonth, previousMonth, nextMonth, displayMonths } =\n useNavigation();\n const isDrawerRange = React.useContext(DrawerRangeCtx);\n const { disabledYears = [] } = React.useContext(DisabledDatesCtx);\n const [view, setView] = useState<CaptionView>(\"days\");\n const [pickerYear, setPickerYear] = useState(\n displayMonth.getFullYear(),\n );\n const [yearRangeStart, setYearRangeStart] = useState(\n Math.floor(displayMonth.getFullYear() / 12) * 12,\n );\n\n const isFirst =\n displayMonths[0].getTime() === displayMonth.getTime();\n const isLast =\n displayMonths[displayMonths.length - 1].getTime() ===\n displayMonth.getTime();\n const idx = displayIndex ?? 0;\n\n const handlePrevYear = () => {\n const d = new Date(displayMonth);\n d.setFullYear(d.getFullYear() - 1);\n goToMonth(d);\n };\n const handleNextYear = () => {\n const d = new Date(displayMonth);\n d.setFullYear(d.getFullYear() + 1);\n goToMonth(d);\n };\n\n // ── Drawer range: non-first months show only centered label ──\n if (isDrawerRange && !isFirst) {\n return (\n <div className=\"flex items-center justify-center pt-3 mb-2\">\n <button\n type=\"button\"\n className=\"text-[14px] leading-[20px] text-foreground font-medium hover:text-primary-action cursor-pointer bg-transparent border-0 outline-none transition-colors\"\n onClick={() => {\n setPickerYear(displayMonth.getFullYear());\n setView(\"months\");\n }}\n >\n {THAI_MONTHS_FULL[displayMonth.getMonth()]}{\" \"}\n {displayMonth.getFullYear() + 543}\n </button>\n </div>\n );\n }\n\n // ── Header text & click per view ────────────────────────────\n let headerText: string;\n let onHeaderClick: () => void;\n\n if (view === \"years\") {\n headerText = `${yearRangeStart + 543} - ${yearRangeStart + 11 + 543}`;\n onHeaderClick = () => setView(\"months\");\n } else if (view === \"months\") {\n headerText = `${pickerYear + 543}`;\n onHeaderClick = () => {\n setYearRangeStart(Math.floor(pickerYear / 12) * 12);\n setView(\"years\");\n };\n } else {\n headerText = `${THAI_MONTHS_FULL[displayMonth.getMonth()]} ${displayMonth.getFullYear() + 543}`;\n onHeaderClick = () => {\n setPickerYear(displayMonth.getFullYear());\n setView(\"months\");\n };\n }\n\n // ── Nav buttons per view ────────────────────────────────────\n let leftNav: React.ReactNode = null;\n let rightNav: React.ReactNode = null;\n\n if (view === \"years\") {\n leftNav = (\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={() => setYearRangeStart((s) => s - 12)}\n >\n <CaretLeft size={16} className=\"text-primary-action\" />\n </button>\n );\n rightNav = (\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={() => setYearRangeStart((s) => s + 12)}\n >\n <CaretRight size={16} className=\"text-primary-action\" />\n </button>\n );\n } else if (view === \"months\") {\n leftNav = (\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={() => setPickerYear((y) => y - 1)}\n >\n <CaretLeft size={16} className=\"text-primary-action\" />\n </button>\n );\n rightNav = (\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={() => setPickerYear((y) => y + 1)}\n >\n <CaretRight size={16} className=\"text-primary-action\" />\n </button>\n );\n } else if (isDrawerRange) {\n leftNav = (\n <>\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={handlePrevYear}\n >\n <CaretDoubleLeft size={16} className=\"text-primary-action\" />\n </button>\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={() =>\n previousMonth && goToMonth(previousMonth)\n }\n >\n <CaretLeft size={16} className=\"text-primary-action\" />\n </button>\n </>\n );\n rightNav = (\n <>\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={() => nextMonth && goToMonth(nextMonth)}\n >\n <CaretRight size={16} className=\"text-primary-action\" />\n </button>\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={handleNextYear}\n >\n <CaretDoubleRight size={16} className=\"text-primary-action\" />\n </button>\n </>\n );\n } else {\n if (isFirst) {\n leftNav = (\n <>\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={handlePrevYear}\n >\n <CaretDoubleLeft\n size={16}\n className=\"text-primary-action\"\n />\n </button>\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={() =>\n previousMonth && goToMonth(previousMonth)\n }\n >\n <CaretLeft size={16} className=\"text-primary-action\" />\n </button>\n </>\n );\n }\n if (isLast) {\n rightNav = (\n <>\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={() => nextMonth && goToMonth(nextMonth)}\n >\n <CaretRight\n size={16}\n className=\"text-primary-action\"\n />\n </button>\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={handleNextYear}\n >\n <CaretDoubleRight\n size={16}\n className=\"text-primary-action\"\n />\n </button>\n </>\n );\n }\n }\n\n // ── Shared grid button style ────────────────────────────────\n const now = new Date();\n const gridBtnClass = (\n active: boolean,\n isToday: boolean,\n isItemDisabled = false,\n ) =>\n cn(\n \"py-[10px] text-[13px] rounded-[6px] border-0 outline-none transition-colors\",\n isItemDisabled\n ? \"bg-disabled-bg text-disabled cursor-not-allowed\"\n : active\n ? \"bg-primary-action text-on-primary-action cursor-pointer\"\n : isToday\n ? \"bg-primary-action-muted text-primary-action cursor-pointer\"\n : \"bg-transparent text-foreground hover:bg-disabled-bg cursor-pointer\",\n );\n\n return (\n <>\n <div className=\"flex items-center justify-between pt-1 mb-2\">\n <div className=\"flex gap-1\">{leftNav}</div>\n <button\n type=\"button\"\n className=\"text-[14px] leading-[20px] text-foreground font-medium hover:text-primary-action cursor-pointer bg-transparent border-0 outline-none transition-colors\"\n onClick={onHeaderClick}\n >\n {headerText}\n </button>\n <div className=\"flex gap-1\">{rightNav}</div>\n </div>\n\n {view === \"months\" && (\n <div\n className=\"absolute left-0 right-0 z-10 bg-background grid grid-cols-3 gap-1 p-2 content-center\"\n style={{ top: \"42px\", bottom: \"0\" }}\n >\n {THAI_MONTHS_SHORT.map((name, i) => {\n const isCurrent =\n pickerYear === displayMonth.getFullYear() &&\n i === displayMonth.getMonth();\n const isToday =\n pickerYear === now.getFullYear() &&\n i === now.getMonth();\n return (\n <button\n key={i}\n type=\"button\"\n onClick={() => {\n goToMonth(new Date(pickerYear, i - idx));\n setView(\"days\");\n }}\n className={gridBtnClass(isCurrent, isToday)}\n >\n {name}\n </button>\n );\n })}\n </div>\n )}\n\n {view === \"years\" && (\n <div\n className=\"absolute left-0 right-0 z-10 bg-background grid grid-cols-3 gap-1 p-2 content-center\"\n style={{ top: \"42px\", bottom: \"0\" }}\n >\n {Array.from({ length: 12 }, (_, i) => {\n const year = yearRangeStart + i;\n const isCurrent =\n year === displayMonth.getFullYear();\n const isToday = year === now.getFullYear();\n const isYearDisabled = disabledYears.includes(year);\n return (\n <button\n key={year}\n type=\"button\"\n disabled={isYearDisabled}\n onClick={() => {\n if (isYearDisabled) return;\n setPickerYear(year);\n setView(\"months\");\n }}\n className={gridBtnClass(isCurrent, isToday, isYearDisabled)}\n >\n {year + 543}\n </button>\n );\n })}\n </div>\n )}\n </>\n );\n}\n\n// ─── DayPicker classNames ─────────────────────────────────────────────────────\nconst DAY_PICKER_CLASSES = {\n months: \"flex flex-col sm:flex-row sm:gap-6\",\n month: \"space-y-2 relative\",\n caption:\n \"flex justify-center pt-1 relative items-center mb-2\",\n caption_label: \"text-[14px] leading-[20px] text-foreground\",\n nav: \"hidden\",\n nav_button: cn(\n \"h-[28px] w-[28px] inline-flex items-center justify-center\",\n \"rounded-[6px] bg-transparent border border-border cursor-pointer\",\n \"text-muted-foreground hover:bg-disabled-bg transition-colors duration-100\",\n \"p-0 outline-none\",\n ),\n nav_button_previous: \"absolute left-1\",\n nav_button_next: \"absolute right-1\",\n table: \"w-full border-collapse\",\n head_row: \"flex\",\n head_cell:\n \"w-[36px] h-[32px] inline-flex items-center justify-center text-[12px] text-disabled font-normal\",\n row: \"flex w-full mt-1\",\n cell: cn(\n \"h-[36px] w-[36px] text-center p-0 relative overflow-hidden\",\n \"[&:has(.day-range-middle)]:bg-range-bg\",\n \"[&:has(.day-range-start)]:bg-range-bg\",\n \"[&:has(.day-range-end)]:bg-range-bg\",\n \"[&:has(.day-range-start)]:rounded-l-[6px]\",\n \"[&:has(.day-range-end)]:rounded-r-[6px]\",\n \"[&:first-child:has(.day-range-middle)]:rounded-l-[6px]\",\n \"[&:last-child:has(.day-range-middle)]:rounded-r-[6px]\",\n \"[&:first-child:has(.day-range-end)]:rounded-l-[6px]\",\n \"[&:last-child:has(.day-range-start)]:rounded-r-[6px]\",\n \"focus-within:relative focus-within:z-20\",\n ),\n day: cn(\n \"h-[36px] w-[36px] inline-flex items-center justify-center\",\n \"text-[14px] text-foreground rounded-[6px]\",\n \"border-0 bg-transparent cursor-pointer\",\n \"hover:bg-disabled-bg transition-colors duration-100\",\n \"outline-none aria-selected:opacity-100 p-0\",\n ),\n day_range_start:\n \"day-range-start !bg-primary-action !text-on-primary-action !rounded-l-[6px] !rounded-r-none\",\n day_range_end:\n \"day-range-end !bg-primary-action !text-on-primary-action !rounded-r-[6px] !rounded-l-none\",\n day_selected:\n \"!bg-primary-action text-on-primary-action hover:!bg-primary-action focus:!bg-primary-action rounded-[6px]\",\n day_today:\n \"[&:not([aria-selected=true])]:!bg-primary-action-light [&:not([aria-selected=true])]:text-foreground rounded-[6px]\",\n day_outside:\n \"day-outside text-disabled opacity-50 aria-selected:bg-transparent aria-selected:opacity-30\",\n day_disabled: \"text-disabled opacity-50 cursor-not-allowed\",\n day_range_middle:\n \"day-range-middle !bg-range-bg !text-range-text !rounded-none\",\n day_hidden: \"invisible\",\n};\n\nconst DRAWER_DAY_PICKER_CLASSES: typeof DAY_PICKER_CLASSES = {\n ...DAY_PICKER_CLASSES,\n months: \"flex flex-col gap-6 w-full\",\n month: \"space-y-2 relative w-full\",\n table: \"w-full border-collapse table-fixed\",\n head_row: \"flex w-full\",\n head_cell:\n \"flex-1 h-[40px] inline-flex items-center justify-center text-[13px] text-disabled font-normal\",\n row: \"flex w-full mt-1\",\n cell: cn(\n \"h-[44px] flex-1 text-center p-0 relative overflow-hidden\",\n \"[&:has(.day-range-middle)]:bg-range-bg\",\n \"[&:has(.day-range-start)]:bg-range-bg\",\n \"[&:has(.day-range-end)]:bg-range-bg\",\n \"[&:has(.day-range-start)]:rounded-l-[8px]\",\n \"[&:has(.day-range-end)]:rounded-r-[8px]\",\n \"[&:first-child:has(.day-range-middle)]:rounded-l-[8px]\",\n \"[&:last-child:has(.day-range-middle)]:rounded-r-[8px]\",\n \"[&:first-child:has(.day-range-end)]:rounded-l-[8px]\",\n \"[&:last-child:has(.day-range-start)]:rounded-r-[8px]\",\n \"focus-within:relative focus-within:z-20\",\n ),\n day: cn(\n \"h-[44px] w-full inline-flex items-center justify-center\",\n \"text-[16px] text-foreground rounded-[8px]\",\n \"border-0 bg-transparent cursor-pointer\",\n \"hover:bg-disabled-bg transition-colors duration-100\",\n \"outline-none aria-selected:opacity-100 p-0\",\n ),\n};\n\n// ─── Scroll Date Picker ────────────────────────────────────────────────────────\nconst DATE_ITEM_H = 40;\nconst DATE_DRUM_H = 200; // shows 5 items\nconst DATE_SPACER = (DATE_DRUM_H - DATE_ITEM_H) / 2;\n\nconst SCROLL_YEAR_START = 1950;\nconst SCROLL_YEAR_END = 2060;\nconst YEAR_ITEMS = Array.from(\n { length: SCROLL_YEAR_END - SCROLL_YEAR_START + 1 },\n (_, i) => String(SCROLL_YEAR_START + i),\n);\n\nfunction getDaysInMonth(year: number, month: number): number {\n return new Date(year, month, 0).getDate();\n}\n\nfunction dateToScrollValue(date: Date | undefined): {\n year: number;\n month: number;\n day: number;\n} {\n const d = date ?? new Date();\n return {\n year: d.getFullYear(),\n month: d.getMonth() + 1,\n day: d.getDate(),\n };\n}\n\nfunction scrollValueToDate(v: {\n year: number;\n month: number;\n day: number;\n}): Date {\n return new Date(v.year, v.month - 1, v.day);\n}\n\nfunction DateScrollColumn({\n items,\n selectedIndex,\n onChange,\n flex = 1,\n}: {\n items: string[];\n selectedIndex: number;\n onChange: (index: number) => void;\n /** flex-grow value; columns share available width proportionally */\n flex?: number;\n}) {\n const containerRef = useRef<HTMLDivElement>(null);\n const debounceRef = useRef<\n ReturnType<typeof setTimeout> | undefined\n >(undefined);\n const [localIndex, setLocalIndex] = useState(selectedIndex);\n const isUserScrolling = useRef(false);\n\n useEffect(() => {\n const el = containerRef.current;\n if (el) {\n el.scrollTop = selectedIndex * DATE_ITEM_H;\n setLocalIndex(selectedIndex);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (isUserScrolling.current) return;\n const el = containerRef.current;\n if (el) {\n el.scrollTo({\n top: selectedIndex * DATE_ITEM_H,\n behavior: \"smooth\",\n });\n setLocalIndex(selectedIndex);\n }\n }, [selectedIndex]);\n\n const handleScroll = useCallback(() => {\n isUserScrolling.current = true;\n const el = containerRef.current;\n if (!el) return;\n\n const rawIdx = el.scrollTop / DATE_ITEM_H;\n const idx = Math.max(\n 0,\n Math.min(Math.round(rawIdx), items.length - 1),\n );\n setLocalIndex(idx);\n\n clearTimeout(debounceRef.current);\n debounceRef.current = setTimeout(() => {\n isUserScrolling.current = false;\n const finalIdx = Math.max(\n 0,\n Math.min(\n Math.round(el.scrollTop / DATE_ITEM_H),\n items.length - 1,\n ),\n );\n el.scrollTo({\n top: finalIdx * DATE_ITEM_H,\n behavior: \"smooth\",\n });\n onChange(finalIdx);\n setLocalIndex(finalIdx);\n }, 120);\n }, [items.length, onChange]);\n\n const handleItemClick = useCallback(\n (idx: number) => {\n setLocalIndex(idx);\n onChange(idx);\n containerRef.current?.scrollTo({\n top: idx * DATE_ITEM_H,\n behavior: \"smooth\",\n });\n },\n [onChange],\n );\n\n return (\n <div\n ref={containerRef}\n className=\"relative [&::-webkit-scrollbar]:hidden min-w-0\"\n style={{\n flex,\n height: DATE_DRUM_H,\n overflowY: \"scroll\",\n scrollSnapType: \"y mandatory\",\n scrollbarWidth: \"none\",\n }}\n onScroll={handleScroll}\n >\n <div style={{ height: DATE_SPACER, flexShrink: 0 }} />\n {items.map((label, idx) => {\n const isSel = idx === localIndex;\n return (\n <div\n key={idx}\n style={{\n height: DATE_ITEM_H,\n scrollSnapAlign: \"center\",\n }}\n className=\"flex items-center justify-center cursor-pointer select-none\"\n onClick={() => handleItemClick(idx)}\n >\n <span\n style={{\n fontSize: isSel ? 32 : 14,\n lineHeight: 1,\n color: isSel ? \"var(--foreground)\" : \"var(--disabled)\",\n transition: \"font-size 0.1s, color 0.1s\",\n whiteSpace: \"nowrap\",\n }}\n >\n {label}\n </span>\n </div>\n );\n })}\n <div style={{ height: DATE_SPACER, flexShrink: 0 }} />\n </div>\n );\n}\n\nfunction ScrollDatePickerContent({\n value,\n onChange,\n}: {\n value: { year: number; month: number; day: number };\n onChange: (v: { year: number; month: number; day: number }) => void;\n}) {\n const daysInMonth = getDaysInMonth(value.year, value.month);\n const dayItems = Array.from({ length: daysInMonth }, (_, i) =>\n String(i + 1).padStart(2, \"0\"),\n );\n const monthIndex = value.month - 1;\n const dayIndex = Math.min(value.day, daysInMonth) - 1;\n const yearIndex = value.year - SCROLL_YEAR_START;\n\n const handleMonthChange = useCallback(\n (idx: number) => {\n const newMonth = idx + 1;\n const maxDay = getDaysInMonth(value.year, newMonth);\n onChange({\n ...value,\n month: newMonth,\n day: Math.min(value.day, maxDay),\n });\n },\n [value, onChange],\n );\n\n const handleDayChange = useCallback(\n (idx: number) => {\n onChange({ ...value, day: idx + 1 });\n },\n [value, onChange],\n );\n\n const handleYearChange = useCallback(\n (idx: number) => {\n const newYear = SCROLL_YEAR_START + idx;\n const maxDay = getDaysInMonth(newYear, value.month);\n onChange({\n ...value,\n year: newYear,\n day: Math.min(value.day, maxDay),\n });\n },\n [value, onChange],\n );\n\n return (\n <div className=\"relative w-full\">\n {/* Highlight band – centred over the selected row */}\n <div\n className=\"absolute left-0 right-0 rounded-[4px] bg-selected-light-bg pointer-events-none\"\n style={{\n top: \"50%\",\n transform: \"translateY(-50%)\",\n height: DATE_ITEM_H,\n zIndex: 0,\n }}\n />\n <div\n className=\"relative flex gap-[8px] items-center w-full min-w-[340px] px-4\"\n style={{ zIndex: 1 }}\n >\n <DateScrollColumn\n items={THAI_MONTHS_FULL}\n selectedIndex={monthIndex}\n onChange={handleMonthChange}\n flex={108}\n />\n <DateScrollColumn\n items={dayItems}\n selectedIndex={dayIndex}\n onChange={handleDayChange}\n flex={38}\n />\n <DateScrollColumn\n items={YEAR_ITEMS}\n selectedIndex={yearIndex}\n onChange={handleYearChange}\n flex={85}\n />\n </div>\n </div>\n );\n}\n\n// ─── Main component ───────────────────────────────────────────────────────────\nexport const DateInput = forwardRef<HTMLDivElement, DateInputProps>(\n function DateInput(\n {\n mode = \"single\",\n placeholder = \"Text label\",\n required = false,\n forceState,\n errorMessage = \"Error message\",\n helperText,\n pickerVariant = \"calendar\",\n value,\n onChange,\n dateRange,\n onRangeChange,\n disabledYears,\n className,\n },\n ref,\n ) {\n const [open, setOpen] = useState(false);\n const [internalDate, setInternalDate] = useState<\n Date | undefined\n >(undefined);\n const [internalRange, setInternalRange] = useState<\n DateRange | undefined\n >(undefined);\n const isMobile = useIsMobile();\n\n // Draft values – live-updated while picker is open; committed on ตกลง\n const [draftDate, setDraftDate] = useState<Date | undefined>(\n undefined,\n );\n const [draftRange, setDraftRange] = useState<\n DateRange | undefined\n >(undefined);\n const [draftScrollValue, setDraftScrollValue] = useState<{\n year: number;\n month: number;\n day: number;\n }>(dateToScrollValue(undefined));\n\n const isStatic = Boolean(forceState);\n const isDisabled = forceState === \"disabled\";\n\n // Controlled vs uncontrolled\n const currentDate =\n value !== undefined ? value : internalDate;\n const currentRange =\n dateRange !== undefined ? dateRange : internalRange;\n\n const state: DateInputState =\n forceState ?? (open ? \"focus\" : \"default\");\n const isError = state === \"error\";\n const isFocus = state === \"focus\";\n\n const isFilled =\n mode === \"single\"\n ? Boolean(currentDate)\n : Boolean(currentRange?.from);\n\n // ── Colours ─────────────────────────────────────────────────────────────────\n const bgClass = isDisabled ? \"bg-disabled-bg\" : \"bg-background\";\n const labelColor = isDisabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n const valueColor = isDisabled ? \"var(--disabled)\" : \"var(--foreground)\";\n const iconColor = isDisabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n const minusColor = isDisabled ? \"var(--disabled)\" : \"var(--foreground)\";\n const asteriskColorEmpty = isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\";\n const asteriskColorFilled = isDisabled\n ? \"var(--disabled)\"\n : \"var(--error-dark)\";\n\n // ── Border overlay ───────────────────────────────────────────────────────────\n const borderInset = isFocus || isError ? \"-1px\" : \"0px\";\n const borderRad = isFocus || isError ? \"9px\" : \"8px\";\n const borderColor = isDisabled\n ? \"var(--border-disabled)\"\n : isError\n ? \"var(--destructive)\"\n : isFocus\n ? \"var(--primary-action)\"\n : \"var(--border)\";\n\n const showBelow = isError || Boolean(helperText);\n const leftText = isError ? errorMessage : (helperText ?? \"\");\n const leftColor = isError ? \"var(--error-dark)\" : \"var(--muted-foreground)\";\n\n // ── Handlers ─────────────────────────────────────────────────────────────────\n const handleDateSelect = (date: Date | undefined) => {\n setDraftDate(date);\n };\n\n const handleRangeSelect = (range: DateRange | undefined) => {\n setDraftRange(range);\n };\n\n const handleCancel = () => setOpen(false);\n\n const handleConfirm = () => {\n if (pickerVariant === \"scroll\") {\n const d = scrollValueToDate(draftScrollValue);\n if (value === undefined) setInternalDate(d);\n onChange?.(d);\n } else if (mode === \"single\") {\n if (value === undefined) setInternalDate(draftDate);\n onChange?.(draftDate);\n } else {\n if (dateRange === undefined) setInternalRange(draftRange);\n onRangeChange?.(draftRange);\n }\n setOpen(false);\n };\n\n // ── Trigger content ──────────────────────────────────────────────────────────\n const renderContent = () => {\n if (isFilled) {\n // Floating label row\n const floatingLabel = required ? (\n <div className=\"flex gap-[2px] items-center relative shrink-0 w-full\">\n <p\n className=\"leading-[16px] not-italic relative shrink-0 text-[12px] whitespace-nowrap\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n <p\n className=\"leading-[1.5] not-italic relative shrink-0 text-[9px] w-[7px]\"\n style={{ color: asteriskColorFilled }}\n >\n *\n </p>\n </div>\n ) : (\n <p\n className=\"leading-[16px] not-italic relative shrink-0 text-[12px] w-full\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n );\n\n // Value row\n const valueRow =\n mode === \"single\" && currentDate ? (\n <p\n className=\"leading-[20px] not-italic relative text-[16px] w-full min-w-0 overflow-hidden text-ellipsis whitespace-nowrap\"\n style={{ color: valueColor }}\n >\n {formatThaiDate(currentDate)}\n </p>\n ) : mode === \"range\" && currentRange?.from ? (\n <div className=\"flex gap-[8px] items-center relative w-full min-w-0\">\n <p\n className=\"leading-[20px] not-italic relative text-[16px] min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap\"\n style={{ color: valueColor }}\n >\n {formatThaiDate(currentRange.from)}\n </p>\n <Minus\n size={20}\n color={minusColor}\n className=\"shrink-0\"\n />\n <p\n className=\"leading-[20px] not-italic relative text-[16px] min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap\"\n style={{ color: valueColor }}\n >\n {currentRange.to\n ? formatThaiDate(currentRange.to)\n : \"...\"}\n </p>\n </div>\n ) : null;\n\n return (\n <div className=\"content-stretch flex flex-1 flex-col items-center justify-center min-h-px min-w-0 overflow-hidden relative w-full\">\n {floatingLabel}\n {valueRow}\n </div>\n );\n }\n\n // Empty – required\n if (required) {\n return (\n <div className=\"content-stretch flex flex-1 min-w-px min-h-px gap-[2px] items-center relative\">\n <p\n className=\"leading-[20px] not-italic relative shrink-0 text-[16px] whitespace-nowrap\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n <p\n className=\"font-normal h-full leading-[1.5] not-italic relative shrink-0 text-[12px] w-[7px]\"\n style={{ color: asteriskColorEmpty }}\n >\n *\n </p>\n </div>\n );\n }\n\n // Empty – plain placeholder\n return (\n <p\n className=\"flex-1 min-w-0 min-h-px text-[16px] leading-[20px] not-italic overflow-hidden text-ellipsis whitespace-nowrap relative\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n );\n };\n\n // ── Shared trigger inner markup (used by both static div and interactive button)\n const triggerInner = (\n <>\n {/* Border overlay */}\n <div\n aria-hidden=\"true\"\n className=\"absolute pointer-events-none border border-solid\"\n style={{\n inset: borderInset,\n borderRadius: borderRad,\n borderColor,\n }}\n />\n {renderContent()}\n {/* Calendar icon */}\n <div\n className={cn(\n \"flex flex-row items-center shrink-0\",\n isFilled && \"self-stretch\",\n )}\n >\n {isFilled ? (\n <CalendarBlank size={22} weight=\"regular\" color={iconColor} />\n ) : (\n <CalendarBlank size={24} weight=\"regular\" color={iconColor} />\n )}\n </div>\n </>\n );\n\n const triggerBaseClasses = cn(\n \"relative flex gap-2 items-center rounded-lg min-w-0\",\n bgClass,\n \"px-3.5\",\n isFilled ? \"py-1.5\" : \"py-3\",\n \"w-full\",\n );\n\n // ── Below message ─────────────────────────────────────────────────────────────\n const belowMessage = showBelow && (\n <div className=\"flex items-start px-1 text-xs leading-4\">\n <span\n className=\"flex-1 min-w-0\"\n style={{ color: leftColor }}\n >\n {leftText}\n </span>\n </div>\n );\n\n // ── Static showcase (forceState set) ─────────────────────────────────────────\n if (isStatic) {\n return (\n <div\n ref={ref}\n className={cn(\"flex flex-col gap-[4px] w-full\", className)}\n >\n <div className={triggerBaseClasses}>{triggerInner}</div>\n {belowMessage}\n </div>\n );\n }\n\n // ── Picker content ────────────────────────────────────────────────────────────\n const isScrollVariant = pickerVariant === \"scroll\" && mode === \"single\";\n\n const pickerClasses = isMobile\n ? DRAWER_DAY_PICKER_CLASSES\n : DAY_PICKER_CLASSES;\n\n const pickerInner = isScrollVariant ? (\n <ScrollDatePickerContent\n value={draftScrollValue}\n onChange={setDraftScrollValue}\n />\n ) : mode === \"single\" ? (\n <DayPicker\n mode=\"single\"\n selected={draftDate}\n onSelect={handleDateSelect}\n showOutsideDays\n classNames={pickerClasses}\n formatters={{\n formatWeekdayName: (date) =>\n THAI_WEEKDAYS[date.getDay()],\n }}\n components={{ Caption: CustomCaption }}\n />\n ) : (\n <DayPicker\n mode=\"range\"\n selected={draftRange}\n onSelect={handleRangeSelect}\n numberOfMonths={2}\n showOutsideDays\n classNames={pickerClasses}\n formatters={{\n formatWeekdayName: (date) =>\n THAI_WEEKDAYS[date.getDay()],\n }}\n components={{ Caption: CustomCaption }}\n />\n );\n\n const calendarContent = (\n <DisabledDatesCtx.Provider value={{ disabledYears }}>\n {pickerInner}\n </DisabledDatesCtx.Provider>\n );\n\n const actionButtons = (\n <div className=\"flex gap-[12px] items-center pt-[12px]\">\n <Button\n variant=\"outline\"\n size=\"lg\"\n className=\"flex-1\"\n onClick={handleCancel}\n >\n ยกเลิก\n </Button>\n <Button\n variant=\"primary\"\n size=\"lg\"\n className=\"flex-1\"\n onClick={handleConfirm}\n >\n ตกลง\n </Button>\n </div>\n );\n\n const triggerButton = (\n <button\n type=\"button\"\n disabled={isDisabled}\n className={cn(\n triggerBaseClasses,\n \"text-left cursor-pointer disabled:cursor-default\",\n )}\n >\n {triggerInner}\n </button>\n );\n\n const handleOpenChange = (o: boolean) => {\n if (!isDisabled) {\n if (o) {\n // Snapshot committed values into draft when picker opens\n setDraftDate(currentDate);\n setDraftRange(currentRange);\n setDraftScrollValue(dateToScrollValue(currentDate));\n }\n setOpen(o);\n }\n };\n\n // ── Interactive ──────────────────────────────────────────────────────────────\n return (\n <div\n ref={ref}\n className={cn(\"flex flex-col gap-[4px] w-full\", className)}\n >\n {isMobile ? (\n <Drawer open={open} onOpenChange={handleOpenChange}>\n <DrawerTrigger asChild>{triggerButton}</DrawerTrigger>\n <DrawerContent>\n <DrawerTitle className=\"sr-only\">\n เลือกวันที่\n </DrawerTitle>\n <div className=\"overflow-auto px-4 pt-2 pb-8 w-full\">\n <DrawerRangeCtx.Provider value={mode === \"range\"}>\n {calendarContent}\n </DrawerRangeCtx.Provider>\n {actionButtons}\n </div>\n </DrawerContent>\n </Drawer>\n ) : (\n <Popover.Root\n open={open}\n onOpenChange={handleOpenChange}\n >\n <Popover.Trigger asChild>\n {triggerButton}\n </Popover.Trigger>\n\n <Popover.Portal>\n <Popover.Content\n align=\"start\"\n sideOffset={4}\n className=\"z-50 rounded-[8px] bg-popover p-3 outline-none text-popover-foreground\"\n style={{\n boxShadow: \"var(--elevation-popover)\",\n border: \"1px solid var(--border)\",\n }}\n onOpenAutoFocus={(e) => e.preventDefault()}\n >\n {calendarContent}\n {actionButtons}\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n )}\n\n {belowMessage}\n </div>\n );\n },\n);\n\nDateInput.displayName = \"DateInput\";\n","\"use client\";\n\nimport React, { useState, useRef, useEffect, forwardRef } from \"react\";\nimport { CaretDown, CaretUp } from \"@phosphor-icons/react\";\nimport { cn } from \"../lib/utils\";\n\nexport type DropdownState = \"default\" | \"focus\" | \"error\" | \"disabled\";\n\nexport interface DropdownOption {\n label: string;\n value: string;\n}\n\nexport interface DropdownProps {\n /** Placeholder / floating-label text */\n placeholder?: string;\n /** External label rendered above the trigger */\n label?: string;\n /** Appends a red asterisk */\n required?: boolean;\n /** Override the visual state (for showcase) */\n forceState?: DropdownState;\n /** Error message shown below when state is \"error\" */\n errorMessage?: string;\n /** Helper text shown below */\n helperText?: string;\n /** Controlled selected value */\n value?: string;\n onChange?: (value: string) => void;\n /** Options list */\n options?: DropdownOption[];\n className?: string;\n}\n\n// ── Component ───────────────────────────────────────────────────────────────\n\nconst Dropdown = forwardRef<HTMLDivElement, DropdownProps>(\n (\n {\n placeholder = \"Text label\",\n label,\n required = false,\n forceState,\n errorMessage = \"Error message\",\n helperText,\n value,\n onChange,\n options = [],\n className,\n },\n ref\n ) => {\n const [open, setOpen] = useState(false);\n const [internalValue, setInternalValue] = useState(\"\");\n const [search, setSearch] = useState(\"\");\n const containerRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n\n const controlled = value !== undefined;\n const currentValue = controlled ? value : internalValue;\n const isDisabled = forceState === \"disabled\";\n const selectedLabel = options.find((o) => o.value === currentValue)?.label;\n const isFilled = Boolean(selectedLabel);\n\n // Derive visual state\n const state: DropdownState = forceState ?? (open ? \"focus\" : \"default\");\n const isError = state === \"error\";\n const isFocus = state === \"focus\";\n\n // ── Colours ─────────────────────────────────────────────────────────────\n const bg = isDisabled ? \"bg-disabled-bg\" : \"bg-background\";\n const labelColor = isDisabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n const filledColor = isDisabled ? \"var(--disabled)\" : \"var(--foreground)\";\n const caretClassName = isDisabled ? \"text-disabled\" : \"text-muted-foreground\";\n\n const hasExternalLabel = Boolean(label);\n\n // ── Border overlay ──────────────────────────────────────────────────────\n const borderInset = (isFocus || isError) ? \"-1px\" : \"0px\";\n const borderRad = (isFocus || isError) ? \"9px\" : \"8px\";\n const borderColor = isDisabled\n ? \"var(--border-disabled)\"\n : isError\n ? \"var(--destructive)\"\n : isFocus\n ? \"var(--primary-action)\"\n : \"var(--border)\";\n\n const showBelow = isError || Boolean(helperText);\n const leftText = isError ? errorMessage : (helperText ?? \"\");\n const leftColor = isError ? \"var(--destructive)\" : \"var(--muted-foreground)\";\n\n // ── Filtered options ────────────────────────────────────────────────────\n const filteredOptions = search.trim()\n ? options.filter((o) =>\n o.label.toLowerCase().includes(search.trim().toLowerCase())\n )\n : options;\n\n // Auto-focus input when open\n useEffect(() => {\n if (open && inputRef.current) {\n inputRef.current.focus();\n }\n }, [open]);\n\n // Clear search when closing\n useEffect(() => {\n if (!open) setSearch(\"\");\n }, [open]);\n\n // Close on outside click\n useEffect(() => {\n if (!open) return;\n const handler = (e: MouseEvent) => {\n if (containerRef.current && !containerRef.current.contains(e.target as Node)) {\n setOpen(false);\n }\n };\n document.addEventListener(\"mousedown\", handler);\n return () => document.removeEventListener(\"mousedown\", handler);\n }, [open]);\n\n const handleSelect = (val: string) => {\n if (!controlled) setInternalValue(val);\n onChange?.(val);\n setOpen(false);\n };\n\n const handleToggle = () => {\n if (isDisabled) return;\n if (forceState) return;\n setOpen((prev) => !prev);\n };\n\n const handleInputKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === \"Escape\") {\n setOpen(false);\n } else if (e.key === \"Enter\" && filteredOptions.length === 1) {\n handleSelect(filteredOptions[0].value);\n }\n };\n\n // ── Required asterisk helper ────────────────────────────────────────────\n const Asterisk = ({ color }: { color: string }) => (\n <span className=\"leading-[16px] not-italic text-[12px]\" style={{ color }}>\n {\" \"}*\n </span>\n );\n\n return (\n <div\n ref={(node) => {\n (containerRef as React.MutableRefObject<HTMLDivElement | null>).current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }}\n className={cn(\"flex flex-col gap-1 w-full\", className)}\n >\n {/* ── External label ── */}\n {label && (\n <div className=\"relative shrink-0 w-full\">\n <div className=\"flex items-start px-1 w-full\">\n <p className=\"leading-5 not-italic relative shrink-0 text-foreground text-sm font-bold whitespace-nowrap\">\n {label}\n </p>\n </div>\n </div>\n )}\n\n {/* ── Trigger ── */}\n <div\n onClick={handleToggle}\n className={cn(\n \"relative flex gap-2 items-center rounded-lg px-3.5\",\n bg,\n hasExternalLabel\n ? \"h-[38px]\"\n : isFilled && !open\n ? \"py-1.5\"\n : \"p-3.5\",\n !isDisabled && !forceState && \"cursor-pointer\"\n )}\n >\n {/* Border overlay */}\n <div\n aria-hidden=\"true\"\n className=\"absolute pointer-events-none border border-solid\"\n style={{ inset: borderInset, borderRadius: borderRad, borderColor }}\n />\n\n {open && !forceState ? (\n /* ─── Open: search input ─── */\n hasExternalLabel ? (\n /* External label + open → single-line search input */\n <input\n ref={inputRef}\n type=\"text\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n onKeyDown={handleInputKeyDown}\n placeholder={isFilled ? selectedLabel : placeholder + (required ? \" *\" : \"\")}\n className=\"flex-1 min-w-0 min-h-[1px] text-sm leading-5 not-italic bg-transparent outline-none border-none p-0 m-0 placeholder:text-disabled\"\n style={{\n color: filledColor,\n caretColor: \"var(--caret-color)\",\n }}\n onClick={(e) => e.stopPropagation()}\n />\n ) : isFilled ? (\n /* Filled + open → floating label + search input */\n <div className=\"flex flex-col items-start justify-center flex-1 min-w-0 min-h-[1px]\">\n <p\n className=\"shrink-0 w-full leading-[16px] not-italic text-[12px]\"\n style={{ color: labelColor }}\n >\n {placeholder}\n {required && <Asterisk color={isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\"} />}\n </p>\n <input\n ref={inputRef}\n type=\"text\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n onKeyDown={handleInputKeyDown}\n placeholder={selectedLabel}\n className=\"w-full leading-[20px] not-italic text-[14px] min-w-0 bg-transparent outline-none border-none p-0 m-0 placeholder:text-disabled\"\n style={{\n color: filledColor,\n caretColor: \"var(--caret-color)\",\n }}\n onClick={(e) => e.stopPropagation()}\n />\n </div>\n ) : (\n /* Empty + open → inline search input */\n <input\n ref={inputRef}\n type=\"text\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n onKeyDown={handleInputKeyDown}\n placeholder={placeholder + (required ? \" *\" : \"\")}\n className=\"flex-1 min-w-0 min-h-[1px] text-base leading-5 not-italic bg-transparent outline-none border-none p-0 m-0 placeholder:text-muted-foreground\"\n style={{\n color: \"var(--foreground)\",\n caretColor: \"var(--caret-color)\",\n }}\n onClick={(e) => e.stopPropagation()}\n />\n )\n ) : isFilled ? (\n /* ─── Closed + Filled ─── */\n hasExternalLabel ? (\n /* External label → single-line selected value */\n <p\n className=\"flex-1 min-w-0 min-h-[1px] leading-5 not-italic text-sm overflow-hidden text-ellipsis whitespace-nowrap\"\n style={{ color: filledColor }}\n >\n {selectedLabel}\n {required && <Asterisk color={isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\"} />}\n </p>\n ) : (\n /* Default → floating label + selected value */\n <div className=\"flex flex-col items-start justify-center flex-1 min-w-0 min-h-[1px]\">\n <p\n className=\"shrink-0 w-full leading-4 not-italic text-xs\"\n style={{ color: labelColor }}\n >\n {placeholder}\n {required && <Asterisk color={isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\"} />}\n </p>\n <p\n className=\"w-full leading-5 not-italic text-sm min-w-0 min-h-[1px]\"\n style={{ color: filledColor }}\n >\n {selectedLabel}\n </p>\n </div>\n )\n ) : (\n /* ─── Closed + Empty: placeholder ─── */\n required ? (\n <div className=\"flex flex-1 min-w-0 min-h-[1px] gap-[2px] items-center\">\n <p\n className=\"leading-5 not-italic text-base whitespace-nowrap\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n <p\n className=\"leading-4 not-italic text-xs w-[7px]\"\n style={{ color: isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\" }}\n >\n *\n </p>\n </div>\n ) : (\n <p\n className=\"flex-1 min-w-0 min-h-[1px] text-base leading-5 not-italic overflow-hidden text-ellipsis whitespace-nowrap\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n )\n )}\n\n {/* Caret */}\n {isFocus ? (\n <CaretUp size={22} className={cn(\"shrink-0\", caretClassName)} />\n ) : (\n <CaretDown size={22} className={cn(\"shrink-0\", caretClassName)} />\n )}\n </div>\n\n {/* ── Dropdown menu ── */}\n {open && !forceState && options.length > 0 && (\n <div\n className={cn(\n \"relative bg-popover rounded-lg overflow-clip p-2 z-20 flex flex-col items-start text-popover-foreground\",\n filteredOptions.length > 10 && \"overflow-y-auto\"\n )}\n style={{\n boxShadow: \"var(--elevation-popover)\",\n ...(filteredOptions.length > 10 ? { maxHeight: 10 * 48 + 16 } : {}),\n }}\n >\n {filteredOptions.length > 0 ? (\n filteredOptions.map((opt) => (\n <div\n key={opt.value}\n onClick={() => handleSelect(opt.value)}\n className={cn(\n \"w-full shrink-0 rounded-[4px] cursor-pointer transition-colors duration-100\",\n opt.value === currentValue\n ? \"bg-primary-action-light\"\n : \"bg-popover hover:bg-disabled-bg\"\n )}\n >\n <div className=\"flex flex-row items-center size-full\">\n <div className=\"flex items-center p-3.5 relative w-full\">\n <p\n className={cn(\n \"flex-1 min-w-0 min-h-[1px] leading-5 not-italic overflow-hidden text-sm text-ellipsis whitespace-nowrap\",\n opt.value === currentValue ? \"text-primary-action\" : \"text-foreground\"\n )}\n >\n {opt.label}\n </p>\n </div>\n </div>\n </div>\n ))\n ) : (\n <div className=\"w-full shrink-0 bg-popover\">\n <div className=\"flex flex-row items-center size-full\">\n <div className=\"flex items-center p-[14px] relative w-full\">\n <p className=\"flex-1 min-w-0 min-h-[1px] leading-[20px] not-italic text-[14px] text-disabled\">\n No results found\n </p>\n </div>\n </div>\n </div>\n )}\n </div>\n )}\n\n {/* ── Below: helper / error ── */}\n {showBelow && (\n <div className=\"flex items-start px-[4px] text-[12px] leading-[16px]\">\n <span className=\"flex-1 min-w-0\" style={{ color: leftColor }}>\n {leftText}\n </span>\n </div>\n )}\n </div>\n );\n }\n);\n\nDropdown.displayName = \"Dropdown\";\n\nexport { Dropdown };\n","\"use client\";\n\nimport React, {\n forwardRef,\n useState,\n useRef,\n useEffect,\n useCallback,\n useMemo,\n useLayoutEffect,\n} from \"react\";\nimport { CaretDown, CaretUp, Check, X } from \"@phosphor-icons/react\";\nimport { cn } from \"../lib/utils\";\n\nexport type DropdownMultipleState =\n | \"default\"\n | \"focus\"\n | \"error\"\n | \"disabled\";\n\nexport interface DropdownMultipleOption {\n label: string;\n value: string;\n}\n\nexport interface DropdownMultipleProps {\n /** Placeholder / floating-label text */\n placeholder?: string;\n /** Text label rendered above the input */\n label?: string;\n /** Appends a red asterisk */\n required?: boolean;\n /** Override the visual state (for showcase) */\n forceState?: DropdownMultipleState;\n /** Error message shown below when state is \"error\" */\n errorMessage?: string;\n /** Helper text shown below */\n helperText?: string;\n /** Controlled selected values */\n value?: string[];\n onChange?: (value: string[]) => void;\n /** Options list */\n options?: DropdownMultipleOption[];\n className?: string;\n}\n\nconst TAG_GAP = 4;\nconst MAX_COMPONENT_WIDTH = 343;\n\n// ── Tag chip (removable) ────────────────────────────────────────────────────\nfunction RemovableTag({\n label,\n disabled,\n onRemove,\n maxWidth,\n}: {\n label: string;\n disabled?: boolean;\n onRemove?: () => void;\n maxWidth?: number;\n}) {\n const textColor = disabled ? \"var(--disabled)\" : \"var(--subtle-text)\";\n const iconColor = disabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n\n return (\n <div\n className=\"bg-disabled-bg flex items-center overflow-hidden pl-[8px] pr-[8px] py-[4px] rounded-[4px] shrink-0 relative group\"\n style={\n maxWidth !== undefined\n ? { maxWidth, flexShrink: 1 }\n : undefined\n }\n >\n <p\n className=\"leading-[16px] not-italic text-[12px] whitespace-nowrap overflow-hidden text-ellipsis pr-[4px]\"\n style={{ color: textColor }}\n >\n {label}{\" \"}\n </p>\n\n {!disabled && onRemove && (\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n onRemove();\n }}\n className=\"absolute right-[4px] top-1/2 -translate-y-1/2 flex items-center justify-center rounded-[2px] p-[1px] cursor-pointer opacity-0 group-hover:opacity-100 transition-all duration-150 bg-surface-clear-hover\"\n >\n <X\n size={12}\n weight=\"bold\"\n color={iconColor}\n className=\"shrink-0\"\n />\n </button>\n )}\n </div>\n );\n}\n\n// ── Tag chip (static, for showcase forceState) ──────────────────────────────\nfunction StaticTag({\n label,\n disabled,\n maxWidth,\n}: {\n label: string;\n disabled?: boolean;\n maxWidth?: number;\n}) {\n const textColor = disabled ? \"var(--disabled)\" : \"var(--subtle-text)\";\n return (\n <div\n className=\"bg-disabled-bg flex items-center justify-center overflow-clip px-[8px] py-[4px] rounded-[4px] shrink-0\"\n style={\n maxWidth !== undefined\n ? { maxWidth, flexShrink: 1 }\n : undefined\n }\n >\n <p\n className=\"leading-[16px] not-italic text-[12px] whitespace-nowrap overflow-hidden text-ellipsis\"\n style={{ color: textColor }}\n >\n {label}\n </p>\n </div>\n );\n}\n\n// ── Overflow count badge ────────────────────────────────────────────────────\nfunction OverflowBadge({\n count,\n disabled,\n}: {\n count: number;\n disabled?: boolean;\n}) {\n const bg = disabled ? \"bg-surface-chip-disabled\" : \"bg-selected-bg\";\n const textColor = disabled ? \"var(--disabled)\" : \"var(--primary-action)\";\n return (\n <div\n className={cn(\n bg,\n \"flex items-center justify-center overflow-clip px-[8px] py-[4px] rounded-[4px] shrink-0\",\n )}\n >\n <p\n className=\"leading-[16px] not-italic text-[12px] whitespace-nowrap\"\n style={{ color: textColor }}\n >\n +{count}\n </p>\n </div>\n );\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// Hook: measure how many tags fit within the available width\n// ════════════════════════════════════════════════════════════════════════════\ninterface ChipLayout {\n visibleCount: number;\n lastTagMaxWidth: number | undefined;\n}\n\nfunction useChipLayout(\n selectedOptions: DropdownMultipleOption[],\n measureRef: React.RefObject<HTMLDivElement | null>,\n containerRef: React.RefObject<HTMLDivElement | null>,\n): ChipLayout {\n const [layout, setLayout] = useState<ChipLayout>({\n visibleCount: selectedOptions.length,\n lastTagMaxWidth: undefined,\n });\n\n useLayoutEffect(() => {\n const calculate = () => {\n const total = selectedOptions.length;\n\n if (!measureRef.current || total === 0) {\n setLayout({\n visibleCount: total,\n lastTagMaxWidth: undefined,\n });\n return;\n }\n\n const tagEls = Array.from(\n measureRef.current.children,\n ) as HTMLElement[];\n\n const containerWidth =\n containerRef.current?.offsetWidth ??\n MAX_COMPONENT_WIDTH;\n\n const RIGHT_SECTION_WIDTH = 60;\n\n const budget =\n containerWidth * 0.72 - RIGHT_SECTION_WIDTH;\n\n let used = 0;\n let count = 0;\n\n for (let i = 0; i < tagEls.length; i++) {\n const w = tagEls[i].offsetWidth;\n const gap = count > 0 ? TAG_GAP : 0;\n const nextUsed = used + gap + w;\n\n if (nextUsed <= budget) {\n used = nextUsed;\n count++;\n } else {\n count++;\n break;\n }\n }\n\n count = Math.max(1, count);\n\n const overflowCount = total - count;\n\n const isFullWidth = used >= budget * 0.98;\n let lastTagMaxWidth: number | undefined;\n\n if (overflowCount > 0 || isFullWidth) {\n const prevTagsWidth = tagEls\n .slice(0, count - 1)\n .reduce(\n (sum, el, i) =>\n sum + el.offsetWidth + (i > 0 ? TAG_GAP : 0),\n 0,\n );\n\n const gapBeforeLast = count > 1 ? TAG_GAP : 0;\n\n const remaining =\n budget - prevTagsWidth - gapBeforeLast;\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const lastNaturalW =\n tagEls[count - 1]?.offsetWidth ?? 0;\n\n if (remaining > 0) {\n lastTagMaxWidth = remaining;\n }\n }\n\n setLayout({ visibleCount: count, lastTagMaxWidth });\n };\n\n calculate();\n document.fonts?.ready?.then(calculate);\n }, [selectedOptions, measureRef, containerRef]);\n\n return layout;\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// Main component\n// ════════════════════════════════════════════════════════════════════════════\nexport const DropdownMultiple = forwardRef<HTMLDivElement, DropdownMultipleProps>(\n function DropdownMultiple(\n {\n placeholder = \"Placeholder\",\n label,\n required = false,\n forceState,\n errorMessage = \"Error message\",\n helperText,\n value,\n onChange,\n options = [],\n className = \"\",\n },\n ref,\n ) {\n const [open, setOpen] = useState(false);\n const [internalValue, setInternalValue] = useState<string[]>([]);\n const [search, setSearch] = useState(\"\");\n const containerRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const measureRef = useRef<HTMLDivElement>(null);\n\n React.useImperativeHandle(ref, () => containerRef.current as HTMLDivElement);\n\n const controlled = value !== undefined;\n const currentValue = controlled ? value : internalValue;\n const isDisabled = forceState === \"disabled\";\n const isStatic = Boolean(forceState);\n const isFilled = currentValue.length > 0;\n\n const state: DropdownMultipleState =\n forceState ?? (open ? \"focus\" : \"default\");\n const isError = state === \"error\";\n const isFocus = state === \"focus\";\n\n // ── Colours ─────────────────────────────────────────────────────────────\n const bg = isDisabled ? \"bg-disabled-bg\" : \"bg-background\";\n const labelColor = isDisabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n const caretColor = isDisabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n\n // ── Border overlay ──────────────────────────────────────────────────────\n const borderInset = isFocus || isError ? \"-1px\" : \"0px\";\n const borderRad = isFocus || isError ? \"9px\" : \"8px\";\n const borderColor = isDisabled\n ? \"var(--border-disabled)\"\n : isError\n ? \"var(--destructive)\"\n : isFocus\n ? \"var(--primary-action)\"\n : \"var(--border)\";\n\n const showBelow = isError || Boolean(helperText);\n const leftText = isError ? errorMessage : (helperText ?? \"\");\n const leftColor = isError ? \"var(--destructive)\" : \"var(--muted-foreground)\";\n\n // ── Selected options ────────────────────────────────────────────────────\n const selectedOptions = useMemo(\n () =>\n currentValue\n .map((v) => options.find((o) => o.value === v))\n .filter(Boolean) as DropdownMultipleOption[],\n [currentValue, options],\n );\n\n // ── Dynamic visible count ───────────────────────────────────────────────\n const { visibleCount, lastTagMaxWidth } = useChipLayout(\n selectedOptions,\n measureRef,\n containerRef,\n );\n\n const visibleTags = selectedOptions.slice(0, visibleCount);\n const overflowCount = Math.max(\n 0,\n selectedOptions.length - visibleCount,\n );\n\n // ── Filtered options ────────────────────────────────────────────────────\n const filteredOptions = useMemo(() => {\n if (!search.trim()) return options;\n const q = search.trim().toLowerCase();\n return options.filter((o) =>\n o.label.toLowerCase().includes(q),\n );\n }, [search, options]);\n\n useEffect(() => {\n if (open && inputRef.current) inputRef.current.focus();\n }, [open]);\n\n useEffect(() => {\n if (!open) setSearch(\"\");\n }, [open]);\n\n useEffect(() => {\n if (!open) return;\n const handler = (e: MouseEvent) => {\n if (\n containerRef.current &&\n !containerRef.current.contains(e.target as Node)\n ) {\n setOpen(false);\n }\n };\n document.addEventListener(\"mousedown\", handler);\n return () =>\n document.removeEventListener(\"mousedown\", handler);\n }, [open]);\n\n const updateValue = useCallback(\n (next: string[]) => {\n if (!controlled) setInternalValue(next);\n onChange?.(next);\n },\n [controlled, onChange],\n );\n\n const handleToggleOption = useCallback(\n (val: string) => {\n const next = currentValue.includes(val)\n ? currentValue.filter((v) => v !== val)\n : [...currentValue, val];\n updateValue(next);\n },\n [currentValue, updateValue],\n );\n\n const handleRemoveTag = useCallback(\n (val: string) => {\n updateValue(currentValue.filter((v) => v !== val));\n },\n [currentValue, updateValue],\n );\n\n const handleTriggerClick = () => {\n if (isDisabled || isStatic) return;\n if (!open) setOpen(true);\n inputRef.current?.focus();\n };\n\n const handleInputKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === \"Escape\") setOpen(false);\n if (\n e.key === \"Backspace\" &&\n search === \"\" &&\n currentValue.length > 0\n ) {\n updateValue(currentValue.slice(0, -1));\n }\n };\n\n // ── Floating label ──────────────────────────────────────────────────────\n const FloatingLabel = () =>\n required ? (\n <div className=\"flex gap-[2px] items-center shrink-0 w-full\">\n <p\n className=\"shrink-0 leading-4 not-italic text-xs\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n <p\n className=\"leading-[1.5] not-italic text-[9px] w-[7px]\"\n style={{\n color: isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\",\n }}\n >\n *\n </p>\n </div>\n ) : (\n <p\n className=\"shrink-0 w-full leading-4 not-italic text-xs\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n );\n\n // ── Placeholder (empty state) ───────────────────────────────────────────\n const Placeholder = () =>\n required ? (\n <div className=\"flex flex-1 min-w-0 min-h-[1px] gap-[2px] items-center\">\n <p\n className=\"leading-5 not-italic text-base whitespace-nowrap\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n <p\n className=\"leading-4 not-italic text-xs w-[7px]\"\n style={{ color: isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\" }}\n >\n *\n </p>\n </div>\n ) : (\n <p\n className=\"flex-1 min-w-0 min-h-[1px] text-base leading-5 not-italic overflow-hidden text-ellipsis whitespace-nowrap py-[7px]\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n );\n\n // ── Hidden measurement layer ────────────────────────────────────────────\n const MeasurementLayer = () => (\n <div\n ref={measureRef}\n aria-hidden\n className=\"absolute flex gap-1 items-center pointer-events-none\"\n style={{\n visibility: \"hidden\",\n top: 0,\n left: 0,\n height: 0,\n overflow: \"hidden\",\n }}\n >\n {selectedOptions.map((opt) =>\n isStatic ? (\n <StaticTag\n key={opt.value}\n label={opt.label}\n disabled={isDisabled}\n />\n ) : (\n <RemovableTag\n key={opt.value}\n label={opt.label}\n disabled={isDisabled}\n />\n ),\n )}\n </div>\n );\n\n // ── Render: trigger content ─────────────────────────────────────────────\n const renderTriggerContent = () => {\n const hasExternalLabel = Boolean(label);\n\n // ─── STATIC SHOWCASE ───\n if (isStatic) {\n if (isFilled) {\n return (\n <div className=\"flex flex-col items-start flex-1 min-w-0 min-h-[1px] relative\">\n <MeasurementLayer />{\" \"}\n {!hasExternalLabel && <FloatingLabel />}\n <div\n className=\"flex gap-[4px] items-center shrink-0 overflow-hidden\"\n style={{ maxWidth: \"100%\" }}\n >\n {visibleTags.map((opt, i) => (\n <StaticTag\n key={opt.value}\n label={opt.label}\n disabled={isDisabled}\n maxWidth={\n i === visibleTags.length - 1\n ? lastTagMaxWidth\n : undefined\n }\n />\n ))}\n </div>\n </div>\n );\n }\n if (!isFilled) {\n return <Placeholder />;\n }\n\n return null;\n }\n\n // ─── INTERACTIVE FILLED ───\n if (isFilled) {\n return (\n <div className=\"flex flex-col items-start flex-1 min-w-0 min-h-[1px] relative\">\n <MeasurementLayer />\n {!hasExternalLabel && <FloatingLabel />}\n <div\n className=\"flex gap-[4px] items-center overflow-hidden\"\n style={{ maxWidth: \"100%\" }}\n >\n {visibleTags.map((opt, i) => (\n <RemovableTag\n key={opt.value}\n label={opt.label}\n onRemove={() => handleRemoveTag(opt.value)}\n maxWidth={\n i === visibleTags.length - 1\n ? lastTagMaxWidth\n : undefined\n }\n />\n ))}\n\n {open && (\n <input\n ref={inputRef}\n type=\"text\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n onKeyDown={handleInputKeyDown}\n className=\"flex-1 min-w-[40px] outline-none border-none bg-transparent text-[14px] leading-[20px]\"\n style={{\n color: \"var(--foreground)\",\n caretColor: \"var(--caret-color)\",\n }}\n onClick={(e) => e.stopPropagation()}\n />\n )}\n </div>\n </div>\n );\n }\n\n // ─── EMPTY OPEN ───\n if (open) {\n return (\n <input\n ref={inputRef}\n type=\"text\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n onKeyDown={handleInputKeyDown}\n className=\"flex-1 min-w-[40px] outline-none border-none bg-transparent text-[14px] leading-[20px]\"\n style={{\n color: \"var(--foreground)\",\n caretColor: \"var(--caret-color)\",\n }}\n onClick={(e) => e.stopPropagation()}\n />\n );\n }\n\n // ─── EMPTY CLOSED ───\n if (!isFilled) {\n return <Placeholder />;\n }\n\n return null;\n };\n\n const hasExternalLabel = Boolean(label);\n\n return (\n <div\n ref={containerRef}\n className={cn(\"flex flex-col gap-[4px] w-full max-w-[343px]\", className)}\n >\n {label && (\n <div className=\"relative shrink-0 w-full\">\n <div className=\"flex items-start px-[4px] w-full\">\n <p\n className=\"leading-[20px] not-italic relative shrink-0 text-foreground text-[14px] whitespace-nowrap\"\n style={{ fontWeight: 700 }}\n >\n {label}\n </p>\n </div>\n </div>\n )}\n\n <div\n onClick={handleTriggerClick}\n className={cn(\n \"relative flex gap-[8px] items-center rounded-[8px]\",\n bg,\n \"px-3.5\",\n hasExternalLabel ? \"h-10\" : \"py-1 min-h-12\",\n !isDisabled && !isStatic && \"cursor-pointer\",\n )}\n >\n <div\n aria-hidden=\"true\"\n className=\"absolute pointer-events-none border border-solid\"\n style={{\n inset: borderInset,\n borderRadius: borderRad,\n borderColor,\n }}\n />\n {renderTriggerContent()}\n\n {isFilled && overflowCount > 0 && (\n <div\n className={hasExternalLabel ? \"self-center\" : \"self-end\"}\n >\n <OverflowBadge\n count={overflowCount}\n disabled={isDisabled}\n />\n </div>\n )}\n\n <span className=\"shrink-0\" style={{ color: caretColor }}>\n {isFocus ? <CaretUp size={22} /> : <CaretDown size={22} />}\n </span>\n </div>\n\n {open && !isStatic && options.length > 0 && (\n <div\n className=\"relative bg-popover rounded-[8px] overflow-clip p-[8px] z-20 flex flex-col items-start text-popover-foreground\"\n style={{\n boxShadow: \"var(--elevation-popover)\",\n }}\n >\n <div\n className={cn(\n \"w-full flex flex-col\",\n filteredOptions.length > 10 && \"overflow-y-auto\",\n )}\n style={\n filteredOptions.length > 10\n ? { maxHeight: 10 * 48 }\n : undefined\n }\n >\n {filteredOptions.length > 0 ? (\n filteredOptions.map((opt) => {\n const isSelected = currentValue.includes(opt.value);\n return (\n <div\n key={opt.value}\n onClick={(e) => {\n e.stopPropagation();\n handleToggleOption(opt.value);\n inputRef.current?.focus();\n }}\n className={cn(\n \"w-full shrink-0 rounded-[4px] cursor-pointer transition-colors duration-100\",\n isSelected\n ? \"bg-primary-action-light\"\n : \"bg-popover hover:bg-disabled-bg\",\n )}\n >\n <div className=\"flex flex-row items-center size-full\">\n <div className=\"flex items-center gap-[8px] p-[14px] relative w-full\">\n <p\n className={cn(\n \"flex-1 min-w-0 min-h-[1px] leading-[20px] not-italic overflow-hidden text-[14px] text-ellipsis whitespace-nowrap\",\n isSelected\n ? \"text-primary-action\"\n : \"text-foreground\",\n )}\n >\n {opt.label}\n </p>\n <div\n className={cn(\n \"shrink-0 w-[16px] h-[16px] rounded-[3px] flex items-center justify-center transition-colors duration-100\",\n \"bg-transparent\",\n )}\n >\n {isSelected && (\n <Check\n size={12}\n weight=\"bold\"\n className=\"text-primary-action\"\n />\n )}\n </div>\n </div>\n </div>\n </div>\n );\n })\n ) : (\n <div className=\"w-full shrink-0 bg-popover\">\n <div className=\"flex flex-row items-center size-full\">\n <div className=\"flex items-center p-[14px] relative w-full\">\n <p className=\"flex-1 min-w-0 min-h-[1px] leading-[20px] not-italic text-[14px] text-disabled\">\n No results found\n </p>\n </div>\n </div>\n </div>\n )}\n </div>\n </div>\n )}\n\n {showBelow && (\n <div className=\"flex items-start px-[4px] text-[12px] leading-[16px]\">\n <span\n className=\"flex-1 min-w-0\"\n style={{ color: leftColor }}\n >\n {leftText}\n </span>\n </div>\n )}\n </div>\n );\n },\n);\n\nDropdownMultiple.displayName = \"DropdownMultiple\";\n","\"use client\";\n\nimport React, { forwardRef, useState } from \"react\";\nimport { cn } from \"../lib/utils\";\n\nexport type InputState = \"default\" | \"focus\" | \"error\" | \"disabled\";\n\nexport interface InputProps\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"onChange\" | \"value\"> {\n /** Override the visual state of the input. Useful for form validation. */\n forceState?: InputState;\n /** Error message displayed below the input when forceState is \"error\". Default: \"Error message\". */\n errorMessage?: string;\n value?: string;\n /** Called with the new string value on every change. */\n onChange?: (value: string) => void;\n /** Icon element rendered on the right side of the input. */\n rightIcon?: React.ReactNode;\n /** Unit label on the right side, e.g. \"kg\" or \"THB\". */\n unit?: string;\n /** Helper text displayed below the input in the default state. */\n helperText?: string;\n /** Show a character count (charCount / maxCount) below the input. */\n showCount?: boolean;\n /** Maximum character count enforced when showCount is true. Default: 100. */\n maxCount?: number;\n}\n\nexport const Input = forwardRef<HTMLDivElement, InputProps>(function Input(\n {\n placeholder = \"Text label\",\n required = false,\n forceState,\n errorMessage = \"Error message\",\n value,\n onChange,\n rightIcon,\n unit,\n helperText,\n showCount = false,\n maxCount = 100,\n className = \"\",\n type = \"text\",\n style: inputStyleProp,\n onFocus: onFocusProp,\n onBlur: onBlurProp,\n disabled: _disabledProp,\n maxLength: maxLengthProp,\n ...inputRest\n },\n ref,\n) {\n const [focused, setFocused] = useState(false);\n const [internalValue, setInternalValue] = useState(\"\");\n\n const controlled = value !== undefined;\n const currentValue = controlled ? value : internalValue;\n const isDisabled = forceState === \"disabled\";\n\n const state: InputState = forceState ?? (focused ? \"focus\" : \"default\");\n const isError = state === \"error\";\n const isFocus = state === \"focus\";\n const isFilled = currentValue.length > 0;\n\n const bg = isDisabled ? \"bg-disabled-bg\" : \"bg-background\";\n const floatLabel = isDisabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n const filledValue = isDisabled ? \"var(--disabled)\" : \"var(--foreground)\";\n const unitColor = isDisabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n\n const borderInset = isFocus || isError ? \"-1px\" : \"0px\";\n const borderRad = isFocus || isError ? \"9px\" : \"8px\";\n const borderColor = isDisabled\n ? \"var(--border-disabled)\"\n : isError\n ? \"var(--destructive)\"\n : isFocus\n ? \"var(--primary-action)\"\n : \"var(--border)\";\n\n const hasRight = Boolean(rightIcon) || Boolean(unit);\n const padding = isFilled\n ? \"px-[14px] py-[6px]\"\n : hasRight\n ? \"px-[14px] py-[14px]\"\n : \"p-[14px]\";\n\n const charCount = currentValue.length;\n const showBelow = isError || Boolean(helperText) || showCount;\n const leftText = isError ? errorMessage : (helperText ?? \"\");\n const leftColor = isError ? \"var(--destructive)\" : \"var(--muted-foreground)\";\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (isDisabled) return;\n let next = e.target.value;\n if (showCount && maxCount >= 0 && next.length > maxCount) {\n next = next.slice(0, maxCount);\n }\n if (!controlled) setInternalValue(next);\n onChange?.(next);\n };\n\n const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n onFocusProp?.(e);\n setFocused(true);\n };\n\n const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n onBlurProp?.(e);\n setFocused(false);\n };\n\n const containerFlex = isFilled\n ? !hasRight\n ? \"flex-col items-start justify-center\"\n : rightIcon\n ? \"flex items-center gap-[8px]\"\n : \"flex items-end gap-[8px]\"\n : cn(\"flex items-center\", hasRight && \"gap-[8px]\");\n\n const inputCaretStyle: React.CSSProperties = {\n caretColor: \"var(--caret-color)\",\n };\n\n return (\n <div ref={ref} className={cn(\"flex flex-col gap-1 w-full\", className)}>\n <div\n className={cn(\n \"relative rounded-lg\",\n padding,\n bg,\n containerFlex,\n )}\n >\n <div\n aria-hidden=\"true\"\n className=\"absolute pointer-events-none border border-solid\"\n style={{\n inset: borderInset,\n borderRadius: borderRad,\n borderColor,\n }}\n />\n\n <div\n className={cn(\n \"flex flex-col min-w-0 min-h-[1px]\",\n hasRight ? \"flex-1 justify-center\" : \"w-full justify-center\",\n )}\n >\n <p\n className={cn(\n \"shrink-0 w-full not-italic\",\n isFilled\n ? \"leading-4 text-xs\"\n : \"text-base leading-5 pointer-events-none\",\n )}\n style={{ color: floatLabel }}\n >\n {placeholder}\n {required && (\n <span\n className=\"text-xs leading-4\"\n style={{\n color: isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\",\n }}\n >\n {\" *\"}\n </span>\n )}\n </p>\n <input\n {...inputRest}\n type={type}\n value={currentValue}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n disabled={isDisabled}\n maxLength={showCount ? maxCount : maxLengthProp}\n aria-label={placeholder}\n className={cn(\n \"w-full bg-transparent outline-none border-none min-w-0\",\n isFilled\n ? \"leading-5 not-italic text-sm p-0 m-0\"\n : cn(\n \"absolute inset-0 h-full text-base\",\n isDisabled ? \"cursor-not-allowed\" : \"cursor-text\",\n ),\n )}\n style={\n isFilled\n ? { ...inputStyleProp, color: filledValue, ...inputCaretStyle }\n : {\n ...inputStyleProp,\n color: \"transparent\",\n caretColor: isFocus ? \"var(--caret-color)\" : \"transparent\",\n padding: hasRight ? \"12px 14px\" : \"14px\",\n }\n }\n />\n </div>\n\n {rightIcon && (\n <div\n className={cn(\n \"shrink-0 flex items-center\",\n isFilled && \"self-stretch\",\n !isFilled && \"relative\",\n )}\n >\n <span className=\"flex items-center justify-center size-[24px] overflow-hidden\">\n {rightIcon}\n </span>\n </div>\n )}\n {unit && !rightIcon && (\n <p\n className={cn(\n \"shrink-0 whitespace-nowrap text-[16px] leading-[20px]\",\n !isFilled && \"relative\",\n )}\n style={{\n color: unitColor,\n lineHeight: \"1.5\",\n fontVariationSettings: \"'wdth' 100\",\n }}\n >\n {unit}\n </p>\n )}\n </div>\n {showBelow && (\n <div className=\"flex items-start gap-2 px-1 text-xs leading-4\">\n {leftText ? (\n <span className=\"flex-1 min-w-0\" style={{ color: leftColor }}>\n {leftText}\n </span>\n ) : (\n showCount && <span className=\"flex-1\" />\n )}\n {showCount && (\n <span\n className=\"shrink-0 text-right whitespace-nowrap\"\n style={{ color: \"var(--muted-foreground)\" }}\n >\n {charCount}/{maxCount}\n </span>\n )}\n </div>\n )}\n </div>\n );\n});\n\nInput.displayName = \"Input\";\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { Check } from \"@phosphor-icons/react\";\nimport { cn } from \"../lib/utils\";\n\nexport interface OptionItem {\n /** Display label for the option. */\n label: string;\n /** Unique value identifier for the option. */\n value: string;\n /** Optional icon element shown before the label. */\n icon?: React.ReactNode;\n disabled?: boolean;\n}\n\nexport interface OptionListProps {\n /** Array of selectable options. */\n options: OptionItem[];\n /** Currently selected value in single-select mode. */\n selectedValue?: string;\n /** Currently selected values in multi-select mode. */\n selectedValues?: string[];\n /** Called with the selected value in single-select mode. */\n onSelect?: (value: string) => void;\n /** Called with the toggled value in multi-select mode. */\n onToggle?: (value: string) => void;\n /** Max number of items visible before the list scrolls. Default: 10. */\n maxVisible?: number;\n /** Text displayed when the options array is empty. Default: \"No results found\". */\n emptyText?: string;\n className?: string;\n}\n\nexport const OptionList = forwardRef<HTMLDivElement, OptionListProps>(\n function OptionList(\n {\n options,\n selectedValue,\n selectedValues,\n onSelect,\n onToggle,\n maxVisible = 10,\n emptyText = \"No results found\",\n className,\n },\n ref\n ) {\n const isMulti =\n selectedValues !== undefined || onToggle !== undefined;\n const isScrollable = options.length > maxVisible;\n const maxHeight = isScrollable ? maxVisible * 48 + 16 : undefined;\n const isSelected = (val: string) =>\n isMulti\n ? (selectedValues ?? []).includes(val)\n : val === selectedValue;\n const handleClick = (opt: OptionItem) => {\n if (opt.disabled) return;\n if (isMulti) {\n onToggle?.(opt.value);\n } else {\n onSelect?.(opt.value);\n }\n };\n\n return (\n <div\n ref={ref}\n className={cn(\n \"flex flex-col items-start overflow-clip rounded-lg bg-popover px-2 py-2 text-popover-foreground\",\n className\n )}\n style={{\n boxShadow: \"var(--elevation-popover)\",\n ...(isScrollable\n ? { maxHeight, overflowY: \"auto\" as const }\n : {}),\n }}\n >\n {options.length > 0 ? (\n options.map((opt) => {\n const selected = isSelected(opt.value);\n const disabled = opt.disabled === true;\n const rowBg = disabled\n ? \"bg-disabled-bg\"\n : selected\n ? \"bg-selected-bg\"\n : \"bg-popover hover:bg-selected-bg\";\n return (\n <div\n key={opt.value}\n onClick={() => handleClick(opt)}\n className={cn(\n \"w-full shrink-0 rounded-[4px] transition-colors duration-100\",\n rowBg,\n disabled ? \"cursor-default\" : \"cursor-pointer\"\n )}\n >\n <div className=\"flex w-full items-center gap-2 p-3.5\">\n {opt.icon && (\n <span\n className=\"flex h-5 w-5 shrink-0 items-center justify-center overflow-clip\"\n style={{\n color: disabled\n ? \"var(--disabled)\"\n : \"var(--muted-foreground)\",\n }}\n >\n {opt.icon}\n </span>\n )}\n <p\n className=\"min-h-[1px] min-w-0 flex-1 overflow-hidden text-sm leading-5 text-ellipsis whitespace-nowrap not-italic\"\n style={{\n color: disabled\n ? \"var(--disabled)\"\n : \"var(--foreground)\",\n }}\n >\n {opt.label}\n </p>\n {selected && (\n <span className=\"flex h-5 w-5 shrink-0 items-center justify-center\">\n <Check\n size={16}\n weight=\"bold\"\n className=\"text-primary-action\"\n />\n </span>\n )}\n </div>\n </div>\n );\n })\n ) : (\n <div className=\"w-full shrink-0 bg-popover\">\n <div className=\"flex w-full items-center p-3.5\">\n <p className=\"min-h-[1px] min-w-0 flex-1 text-sm leading-5 not-italic text-disabled\">\n {emptyText}\n </p>\n </div>\n </div>\n )}\n </div>\n );\n }\n);\n\nOptionList.displayName = \"OptionList\";\n","\"use client\";\n\nimport { MagnifyingGlass, X } from \"@phosphor-icons/react\";\nimport { forwardRef, useRef, useState } from \"react\";\nimport { cn } from \"../lib/utils\";\n\nexport type SearchInputSize = \"lg\" | \"sm\";\n\nexport interface SearchInputProps {\n /** Placeholder text shown when the input is empty. Default: \"Placeholder\". */\n placeholder?: string;\n value?: string;\n /** Called with the new search string on every keystroke. */\n onChange?: (value: string) => void;\n /** Visual size of the search input. Default: \"lg\". */\n size?: SearchInputSize;\n className?: string;\n /** Called when the user clicks the clear (×) button. */\n onClear?: () => void;\n}\n\nexport const SearchInput = forwardRef<HTMLDivElement, SearchInputProps>(\n function SearchInput(\n {\n placeholder = \"Placeholder\",\n value,\n onChange,\n size = \"lg\",\n className,\n onClear,\n },\n ref\n ) {\n const [focused, setFocused] = useState(false);\n const [internalValue, setInternalValue] = useState(\"\");\n const inputRef = useRef<HTMLInputElement>(null);\n const controlled = value !== undefined;\n const currentValue = controlled ? value : internalValue;\n const isFilled = currentValue.length > 0;\n const iconSize = size === \"lg\" ? 24 : 22;\n const minHeight = size === \"sm\" ? \"h-[38px]\" : \"\";\n const padding =\n size === \"sm\" ? \"px-3.5 py-2\" : \"px-3.5 py-3\";\n const borderInset = focused ? \"-1px\" : \"0px\";\n const borderRad = focused ? \"9px\" : \"8px\";\n const borderColor = focused\n ? \"var(--primary-action)\"\n : \"var(--border)\";\n const handleChange = (next: string) => {\n if (!controlled) setInternalValue(next);\n onChange?.(next);\n };\n const handleClear = () => {\n if (!controlled) setInternalValue(\"\");\n onChange?.(\"\");\n onClear?.();\n inputRef.current?.focus();\n };\n\n return (\n <div\n ref={ref}\n className={cn(\n \"relative flex cursor-text items-center gap-2 rounded-lg bg-background\",\n padding,\n minHeight,\n className\n )}\n onClick={() => inputRef.current?.focus()}\n >\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute border border-solid\"\n style={{\n inset: borderInset,\n borderRadius: borderRad,\n borderColor,\n }}\n />\n <span className=\"flex shrink-0 items-center justify-center\">\n <MagnifyingGlass\n size={iconSize}\n color={\n focused ? \"var(--subtle-text)\" : \"var(--muted-foreground)\"\n }\n weight=\"regular\"\n />\n </span>\n <div className=\"relative min-w-0 flex-1\">\n {!isFilled && (\n <p\n className=\"pointer-events-none absolute inset-0 flex items-center text-base leading-5 not-italic\"\n style={{ color: \"var(--muted-foreground)\" }}\n >\n {placeholder}\n </p>\n )}\n <input\n ref={inputRef}\n type=\"text\"\n aria-label={placeholder}\n value={currentValue}\n onChange={(e) => handleChange(e.target.value)}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n className=\"m-0 w-full border-none bg-transparent p-0 text-base leading-5 outline-none\"\n style={{\n color: isFilled ? \"var(--foreground)\" : \"transparent\",\n caretColor: \"var(--caret-color)\",\n }}\n />\n </div>\n {focused && isFilled && (\n <button\n type=\"button\"\n aria-label=\"Clear search\"\n onMouseDown={(e) => e.preventDefault()}\n onClick={handleClear}\n className=\"m-0 flex shrink-0 cursor-pointer items-center justify-center border-none bg-transparent p-0\"\n >\n <X\n size={iconSize}\n color=\"var(--muted-foreground)\"\n weight=\"regular\"\n />\n </button>\n )}\n </div>\n );\n }\n);\n\nSearchInput.displayName = \"SearchInput\";\n","\"use client\";\n\nimport { forwardRef, type ReactNode } from \"react\";\nimport { Circle } from \"@phosphor-icons/react\";\nimport { cn } from \"../lib/utils\";\n\nexport type TabSize = \"lg\" | \"md\" | \"sm\";\n\nexport interface TabItem {\n id: string;\n title: string;\n disabled?: boolean;\n icon?: ReactNode | boolean;\n notification?: string | number;\n}\n\nexport interface TabProps {\n /** Tab label text. Default: \"Tab\". */\n title?: string;\n /** Size of the tab. Default: \"md\". */\n size?: TabSize;\n /** Whether this tab is currently selected/active. */\n active?: boolean;\n /** Whether the tab is non-interactive. */\n disabled?: boolean;\n onClick?: () => void;\n className?: string;\n /** Icon rendered before the label. Pass `true` for a default placeholder icon. */\n icon?: ReactNode | boolean;\n /** Notification badge shown after the label (count or short text). */\n notification?: string | number;\n}\n\nconst sizeClasses: Record<\n TabSize,\n {\n pad: string;\n text: string;\n leading: string;\n font: string;\n gap: string;\n iconSize: string;\n badgeClass: string;\n }\n> = {\n lg: {\n pad: \"px-3 py-2.5\",\n text: \"text-sm\",\n leading: \"leading-5\",\n font: \"font-bold\",\n gap: \"gap-1.5\",\n iconSize: \"h-5 w-5\",\n badgeClass:\n \"min-w-[16px] h-[16px] px-[3px] text-[length:var(--text-xs)] leading-[var(--leading-4)]\",\n },\n md: {\n pad: \"px-2.5 py-2\",\n text: \"text-sm\",\n leading: \"leading-5\",\n font: \"font-bold\",\n gap: \"gap-1.5\",\n iconSize: \"h-[18px] w-[18px]\",\n badgeClass:\n \"min-w-[16px] h-[16px] px-[3px] text-[length:var(--text-xs)] leading-[var(--leading-4)]\",\n },\n sm: {\n pad: \"px-2 py-1.5\",\n text: \"text-xs\",\n leading: \"leading-4\",\n font: \"font-semibold\",\n gap: \"gap-1\",\n iconSize: \"h-4 w-4\",\n badgeClass:\n \"min-w-[14px] h-[14px] px-1 text-[length:var(--text-xxs)] leading-[var(--leading-3)]\",\n },\n};\n\nfunction DefaultTabIcon({ className }: { className?: string }) {\n return <Circle aria-hidden=\"true\" weight=\"regular\" className={cn(\"shrink-0\", className)} />;\n}\n\nexport const Tab = forwardRef<HTMLDivElement, TabProps>(function Tab(\n {\n title = \"Tab\",\n size = \"md\",\n active = false,\n disabled = false,\n onClick,\n className,\n icon,\n notification,\n },\n ref\n) {\n const s = sizeClasses[size] ?? sizeClasses.md;\n const hasIcon = Boolean(icon);\n const hasNotification = notification !== undefined && notification !== null;\n const renderedIcon = icon === true ? <DefaultTabIcon className={s.iconSize} /> : icon;\n const textColor = disabled\n ? \"text-disabled\"\n : active\n ? \"text-primary-action\"\n : \"text-muted-foreground\";\n const borderColor = disabled\n ? \"border-border-disabled\"\n : active\n ? \"border-primary-action\"\n : \"border-border\";\n const cursor = disabled ? \"cursor-not-allowed\" : \"cursor-pointer\";\n const hoverBg = !disabled && !active ? \"hover:bg-hover-bg\" : \"\";\n\n return (\n <div\n ref={ref}\n role=\"tab\"\n aria-selected={active}\n aria-disabled={disabled}\n onClick={!disabled ? onClick : undefined}\n className={cn(\n \"relative flex min-w-[80px] select-none items-center justify-center bg-background transition-colors duration-150\",\n s.pad,\n (hasIcon || hasNotification) && s.gap,\n cursor,\n hoverBg,\n className\n )}\n >\n <div\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 border-b-[1.5px] border-solid\",\n borderColor\n )}\n />\n {hasIcon && (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"relative shrink-0\",\n s.iconSize,\n disabled ? \"text-disabled\" : active ? \"text-primary-action\" : \"text-muted-foreground\"\n )}\n >\n {renderedIcon}\n </span>\n )}\n <span\n className={cn(\n \"relative overflow-hidden text-ellipsis whitespace-nowrap text-center\",\n hasIcon && hasNotification && \"flex-1 min-w-px\",\n s.text,\n s.leading,\n s.font,\n textColor\n )}\n >\n {title}\n </span>\n {hasNotification && (\n <span\n className={cn(\n \"relative flex shrink-0 items-center justify-center rounded-[60px] bg-visual-red-default text-center font-normal text-on-visual-red\",\n s.badgeClass\n )}\n >\n {notification}\n </span>\n )}\n </div>\n );\n});\n\nTab.displayName = \"Tab\";\n\nexport interface TabGroupProps {\n /** Array of tab definitions. Each item needs at minimum `id` and `title`. */\n items?: TabItem[];\n /** ID of the currently active tab. */\n activeId?: string;\n /** Size applied to all tabs in the group. Default: \"md\". */\n size?: TabSize;\n /** Called with the tab ID when a tab is clicked. */\n onChange?: (id: string) => void;\n className?: string;\n}\n\nexport const TabGroup = forwardRef<HTMLDivElement, TabGroupProps>(\n function TabGroup(\n { items = [], activeId, size = \"md\", onChange, className },\n ref\n ) {\n return (\n <div ref={ref} role=\"tablist\" className={cn(\"flex\", className)}>\n {items.map((item) => (\n <Tab\n key={item.id}\n title={item.title}\n size={size}\n active={item.id === activeId}\n disabled={item.disabled}\n icon={item.icon}\n notification={item.notification}\n onClick={() => onChange?.(item.id)}\n />\n ))}\n </div>\n );\n }\n);\n\nTabGroup.displayName = \"TabGroup\";\n","\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { Circle, X } from \"@phosphor-icons/react\";\nimport { cn } from \"../lib/utils\";\n\nexport type TagSize = \"large\" | \"small\";\nexport type TagState = \"default\" | \"hover\" | \"disabled\";\nexport type TagVariant = \"blue\" | \"green\" | \"yellow\" | \"red\" | \"gray\" | \"lime\";\nexport type StatusTagType = \"stop\" | \"success\" | \"hold\" | \"processing\" | \"error\";\n\nexport interface TagProps {\n /** Label text displayed inside the tag. Default: \"Tag\". */\n text?: string;\n /** Size of the tag. Default: \"large\". */\n size?: TagSize;\n /** Visual state. Default: \"default\". */\n state?: TagState;\n /** Color variant. Use green=positive, red=danger, yellow=warning, gray=neutral. Default: \"gray\". */\n variant?: TagVariant;\n /** Show a small circle dot icon on the left side of the label. */\n icon?: boolean;\n /** Show a close/remove (×) button on the right side. */\n close?: boolean;\n className?: string;\n}\n\nconst sizeStyles: Record<\n TagSize,\n {\n container: string;\n text: string;\n closeIcon: string;\n closeButton: string;\n }\n> = {\n large: {\n container: \"px-2 py-1\",\n text: \"text-xs leading-4\",\n closeIcon: \"h-4 w-4\",\n closeButton: \"h-4 w-4\",\n },\n small: {\n container: \"px-1 py-0.5\",\n text: \"text-[length:var(--text-xxs)] leading-[var(--leading-3)]\",\n closeIcon: \"h-3.5 w-3.5\",\n closeButton: \"h-3.5 w-3.5\",\n },\n};\n\nconst variantStyles: Record<\n TagVariant,\n {\n bg: string;\n text: string;\n }\n> = {\n blue: {\n bg: \"bg-[var(--fill-blue-50)]\",\n text: \"text-[var(--fill-blue-700)]\",\n },\n green: {\n bg: \"bg-[var(--fill-green-100)]\",\n text: \"text-[var(--fill-green-600)]\",\n },\n yellow: {\n bg: \"bg-[var(--fill-yellow-100)]\",\n text: \"text-[var(--fill-yellow-600)]\",\n },\n red: {\n bg: \"bg-[var(--fill-red-100)]\",\n text: \"text-[var(--fill-red-600)]\",\n },\n gray: {\n bg: \"bg-[var(--fill-gray-100)]\",\n text: \"text-subtle-text\",\n },\n lime: {\n bg: \"bg-[var(--fill-lime-100)]\",\n text: \"text-[var(--fill-lime-600)]\",\n },\n};\n\nfunction CircleIcon({ disabled }: { disabled: boolean }) {\n return (\n <Circle\n aria-hidden=\"true\"\n weight=\"regular\"\n className=\"h-3.5 w-3.5 shrink-0\"\n color={disabled ? \"var(--disabled)\" : \"var(--subtle-text)\"}\n />\n );\n}\n\nfunction CloseIcon({ disabled, className }: { disabled: boolean; className?: string }) {\n return (\n <X\n aria-hidden=\"true\"\n weight=\"regular\"\n className={cn(\"shrink-0\", className)}\n color={disabled ? \"var(--disabled)\" : \"var(--subtle-text)\"}\n />\n );\n}\n\nexport const Tag = forwardRef<HTMLDivElement, TagProps>(function Tag(\n {\n text = \"Tag\",\n size = \"large\",\n state = \"default\",\n variant = \"gray\",\n icon = false,\n close = false,\n className,\n },\n ref\n) {\n const isDisabled = state === \"disabled\";\n const s = sizeStyles[size] ?? sizeStyles.large;\n const v = variantStyles[variant] ?? variantStyles.gray;\n const bgClass = state === \"disabled\" ? \"bg-disabled-bg\" : state === \"hover\" ? \"bg-hover-bg\" : v.bg;\n const textClass = isDisabled ? \"text-disabled\" : v.text;\n\n return (\n <div\n ref={ref}\n className={cn(\n \"inline-flex items-center justify-center rounded-[4px]\",\n (icon || close) && \"gap-[2px]\",\n s.container,\n bgClass,\n className\n )}\n >\n {icon && <CircleIcon disabled={isDisabled} />}\n <span className={cn(\"whitespace-nowrap font-normal\", s.text, textClass)}>\n {text}\n </span>\n {close && (\n <span\n className={cn(\n \"inline-flex items-center justify-center rounded-[2px] transition-colors\",\n s.closeButton,\n !isDisabled && \"cursor-pointer hover:bg-black/10\"\n )}\n >\n <CloseIcon disabled={isDisabled} className={s.closeIcon} />\n </span>\n )}\n </div>\n );\n});\n\nTag.displayName = \"Tag\";\n\nexport interface StatusTagProps {\n /** Process status type — drives the dot color and default label. Default: \"stop\". */\n type?: StatusTagType;\n /** Override the default label for the given type. */\n text?: string;\n className?: string;\n}\n\nconst statusTagStyles: Record<\n StatusTagType,\n {\n label: string;\n dot: string;\n }\n> = {\n stop: {\n label: \"Stop\",\n dot: \"var(--fill-gray-500)\",\n },\n success: {\n label: \"Success\",\n dot: \"var(--fill-emerald-500)\",\n },\n hold: {\n label: \"Hold\",\n dot: \"var(--fill-yellow-500)\",\n },\n processing: {\n label: \"Processing\",\n dot: \"var(--fill-blue-500)\",\n },\n error: {\n label: \"Error\",\n dot: \"var(--fill-rose-500)\",\n },\n};\n\nexport function StatusTag({ type = \"stop\", text, className }: StatusTagProps) {\n const style = statusTagStyles[type] ?? statusTagStyles.stop;\n\n return (\n <div\n className={cn(\n \"inline-flex items-center justify-center gap-1 rounded-[8px] px-2 py-1\",\n className\n )}\n >\n <Circle aria-hidden=\"true\" weight=\"fill\" className=\"size-[8px] shrink-0\" color={style.dot} />\n <span className=\"whitespace-nowrap text-[14px] leading-[20px] font-normal text-disabled\">\n {text ?? style.label}\n </span>\n </div>\n );\n}\n","\"use client\";\n\nimport React, { forwardRef, useState } from \"react\";\nimport { cn } from \"../lib/utils\";\n\nexport type TextAreaState = \"default\" | \"focus\" | \"error\" | \"disabled\";\n\nexport interface TextAreaProps\n extends Omit<\n React.TextareaHTMLAttributes<HTMLTextAreaElement>,\n \"onChange\" | \"value\" | \"rows\"\n > {\n /** Override the visual state of the textarea. Useful for form validation. */\n forceState?: TextAreaState;\n /** Error message displayed below when forceState is \"error\". Default: \"Error message\". */\n errorMessage?: string;\n value?: string;\n /** Called with the new string value on every change. */\n onChange?: (value: string) => void;\n /** Helper text shown below the textarea in the default state. */\n helperText?: string;\n /** Show a character count (charCount / maxCount) below the textarea. */\n showCount?: boolean;\n /** Maximum character count enforced when showCount is true. Default: 100. */\n maxCount?: number;\n /** Number of visible text rows. Default: 4. */\n rows?: number;\n}\n\nexport const TextArea = forwardRef<HTMLDivElement, TextAreaProps>(\n function TextArea(\n {\n placeholder = \"Text label\",\n required = false,\n forceState,\n errorMessage = \"Error message\",\n value,\n onChange,\n helperText,\n showCount = false,\n maxCount = 100,\n rows = 4,\n className,\n ...textareaProps\n },\n ref,\n ) {\n const [focused, setFocused] = useState(false);\n const [internalValue, setInternalValue] = useState(\"\");\n\n const controlled = value !== undefined;\n const currentValue = controlled ? value : internalValue;\n const isDisabled = forceState === \"disabled\";\n\n const state: TextAreaState = forceState ?? (focused ? \"focus\" : \"default\");\n const isError = state === \"error\";\n const isFocus = state === \"focus\";\n const isFilled = currentValue.length > 0;\n\n const floatLabel = isDisabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n const filledValue = isDisabled ? \"var(--disabled)\" : \"var(--foreground)\";\n\n const borderInset = isFocus || isError ? \"-1px\" : \"0px\";\n const borderRad = isFocus || isError ? \"9px\" : \"8px\";\n const borderColor = isDisabled\n ? \"var(--border-disabled)\"\n : isError\n ? \"var(--destructive)\"\n : isFocus\n ? \"var(--primary-action)\"\n : \"var(--border)\";\n\n const charCount = currentValue.length;\n const showBelow = isError || Boolean(helperText) || showCount;\n const leftText = isError ? errorMessage : (helperText ?? \"\");\n const leftColor = isError ? \"var(--destructive)\" : \"var(--muted-foreground)\";\n const countColor = isDisabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n\n const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n let newValue = e.target.value;\n if (showCount && newValue.length > maxCount) {\n newValue = newValue.slice(0, maxCount);\n }\n if (!controlled) setInternalValue(newValue);\n onChange?.(newValue);\n };\n\n return (\n <div ref={ref} className={cn(\"flex w-full flex-col gap-1\", className)}>\n <div\n className={cn(\n \"relative h-[116px] rounded-lg\",\n isDisabled ? \"bg-disabled-bg\" : \"bg-background\",\n )}\n >\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute border border-solid\"\n style={{ inset: borderInset, borderRadius: borderRad, borderColor }}\n />\n {isFilled ? (\n <div className=\"flex h-full w-full flex-col px-3.5 pt-3.5 pb-1.5\">\n <p\n className=\"w-full shrink-0 text-xs leading-4 not-italic\"\n style={{ color: floatLabel }}\n >\n {placeholder}\n {required && (\n <span\n style={{\n color: isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\",\n }}\n >\n {\" \"}\n *\n </span>\n )}\n </p>\n <textarea\n {...textareaProps}\n value={currentValue}\n onChange={handleChange}\n onFocus={(e) => {\n textareaProps.onFocus?.(e);\n setFocused(true);\n }}\n onBlur={(e) => {\n textareaProps.onBlur?.(e);\n setFocused(false);\n }}\n disabled={isDisabled}\n rows={rows}\n aria-label={placeholder}\n className={cn(\n \"m-0 min-h-0 min-w-0 w-full flex-1 resize-none border-none bg-transparent p-0 text-sm leading-5 not-italic outline-none\",\n )}\n style={{\n ...textareaProps.style,\n color: filledValue,\n caretColor: \"var(--caret-color)\",\n }}\n />\n </div>\n ) : (\n <div className=\"relative flex size-full items-start p-3.5\">\n <p\n className=\"pointer-events-none relative h-full min-h-[1px] min-w-0 flex-1 text-base leading-5 not-italic\"\n style={{ color: floatLabel }}\n >\n {placeholder}\n {required && (\n <span\n style={{\n color: isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\",\n }}\n >\n {\" \"}\n *\n </span>\n )}\n </p>\n {!isDisabled && (\n <textarea\n {...textareaProps}\n value={currentValue}\n onChange={handleChange}\n onFocus={(e) => {\n textareaProps.onFocus?.(e);\n setFocused(true);\n }}\n onBlur={(e) => {\n textareaProps.onBlur?.(e);\n setFocused(false);\n }}\n rows={rows}\n className={cn(\n \"absolute inset-0 h-full w-full cursor-text resize-none border-none bg-transparent text-base outline-none\",\n )}\n style={{\n ...textareaProps.style,\n color: \"transparent\",\n caretColor: isFocus ? \"var(--caret-color)\" : \"transparent\",\n padding: \"14px\",\n }}\n aria-label={placeholder}\n />\n )}\n </div>\n )}\n </div>\n {showBelow && (\n <div className=\"flex items-start gap-2 px-1 text-xs leading-4\">\n {leftText ? (\n <span className=\"min-w-0 flex-1\" style={{ color: leftColor }}>\n {leftText}\n </span>\n ) : (\n showCount && <span className=\"flex-1\" />\n )}\n {showCount && (\n <span\n className=\"shrink-0 whitespace-nowrap text-right\"\n style={{ color: countColor }}\n >\n {charCount}/{maxCount}\n </span>\n )}\n </div>\n )}\n </div>\n );\n },\n);\n\nTextArea.displayName = \"TextArea\";\n","\"use client\";\n\nimport { Clock, Minus } from \"@phosphor-icons/react\";\nimport * as Popover from \"@radix-ui/react-popover\";\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { cn } from \"../lib/utils\";\nimport { Button } from \"./button\";\nimport {\n Drawer,\n DrawerContent,\n DrawerTitle,\n DrawerTrigger,\n} from \"./ui/drawer\";\nimport { useIsMobile } from \"./ui/use-mobile\";\n\n// ─── Types ─────────────────────────────────────────────────────────────────────\nexport type TimeInputState =\n | \"default\"\n | \"focus\"\n | \"error\"\n | \"disabled\";\nexport type TimeInputMode = \"single\" | \"range\";\n\nexport interface TimeValue {\n hour: number; // 0–23\n minute: number; // 0–59\n}\n\nexport interface TimeInputProps {\n mode?: TimeInputMode;\n /** Floating label / placeholder text */\n placeholder?: string;\n /** Shows red asterisk */\n required?: boolean;\n /** Override visual state (for showcase) */\n forceState?: TimeInputState;\n /** Error message shown below in error state */\n errorMessage?: string;\n /** Helper text shown below */\n helperText?: string;\n /** Single mode value */\n value?: TimeValue;\n onChange?: (v: TimeValue) => void;\n /** Range mode values */\n startTime?: TimeValue;\n endTime?: TimeValue;\n onStartChange?: (v: TimeValue) => void;\n onEndChange?: (v: TimeValue) => void;\n className?: string;\n}\n\n// ─── Constants ─────────────────────────────────────────────────────────────────\nconst HOURS = Array.from({ length: 24 }, (_, i) => i);\nconst MINUTES = Array.from({ length: 60 }, (_, i) => i);\nconst ITEM_H = 40;\nconst DRUM_H = 248;\nconst SPACER = (DRUM_H - ITEM_H) / 2;\n\n// ─── Time Slot helpers (range mode) ───────────────────────────────────────────\nexport interface TimeSlot {\n start: TimeValue;\n end: TimeValue;\n label: string; // \"HH:MM - HH:MM\"\n}\n\n/** Generate 1-hour slots for the full day (00:00-01:00 … 23:00-00:00) */\nfunction generateHourlySlots(): TimeSlot[] {\n return Array.from({ length: 24 }, (_, i) => ({\n start: { hour: i, minute: 0 },\n end: { hour: (i + 1) % 24, minute: 0 },\n label: `${pad2(i)}:00 - ${pad2((i + 1) % 24)}:00`,\n }));\n}\n\nfunction slotMatches(\n slot: TimeSlot,\n start: TimeValue,\n end: TimeValue,\n) {\n return (\n slot.start.hour === start.hour &&\n slot.start.minute === start.minute &&\n slot.end.hour === end.hour &&\n slot.end.minute === end.minute\n );\n}\n\nfunction pad2(n: number) {\n return n.toString().padStart(2, \"0\");\n}\nfunction formatTime(v: TimeValue) {\n return `${pad2(v.hour)}:${pad2(v.minute)}`;\n}\n\n// ─── Scroll Drum Column ────────────────────────────────────────────────────────\nfunction ScrollColumn({\n items,\n value,\n onChange,\n}: {\n items: number[];\n value: number;\n onChange: (v: number) => void;\n}) {\n const containerRef = useRef<HTMLDivElement>(null);\n const debounceRef = useRef<\n ReturnType<typeof setTimeout> | undefined\n >(undefined);\n const [localValue, setLocalValue] = useState(value);\n const isUserScrolling = useRef(false);\n\n useEffect(() => {\n const el = containerRef.current;\n if (el) {\n el.scrollTop = items.indexOf(value) * ITEM_H;\n setLocalValue(value);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (isUserScrolling.current) return;\n const el = containerRef.current;\n if (el) {\n const idx = items.indexOf(value);\n if (idx >= 0) {\n el.scrollTo({ top: idx * ITEM_H, behavior: \"smooth\" });\n setLocalValue(value);\n }\n }\n }, [value, items]);\n\n const handleScroll = useCallback(() => {\n isUserScrolling.current = true;\n const el = containerRef.current;\n if (!el) return;\n\n const rawIdx = el.scrollTop / ITEM_H;\n const idx = Math.max(\n 0,\n Math.min(Math.round(rawIdx), items.length - 1),\n );\n setLocalValue(items[idx]);\n\n clearTimeout(debounceRef.current);\n debounceRef.current = setTimeout(() => {\n isUserScrolling.current = false;\n const finalIdx = Math.max(\n 0,\n Math.min(\n Math.round(el.scrollTop / ITEM_H),\n items.length - 1,\n ),\n );\n const finalValue = items[finalIdx];\n el.scrollTo({\n top: finalIdx * ITEM_H,\n behavior: \"smooth\",\n });\n onChange(finalValue);\n setLocalValue(finalValue);\n }, 120);\n }, [items, onChange]);\n\n const handleItemClick = useCallback(\n (item: number) => {\n const idx = items.indexOf(item);\n setLocalValue(item);\n onChange(item);\n containerRef.current?.scrollTo({\n top: idx * ITEM_H,\n behavior: \"smooth\",\n });\n },\n [items, onChange],\n );\n\n return (\n <div\n ref={containerRef}\n className=\"relative [&::-webkit-scrollbar]:hidden\"\n style={{\n width: 39,\n height: DRUM_H,\n overflowY: \"scroll\",\n scrollSnapType: \"y mandatory\",\n scrollbarWidth: \"none\",\n }}\n onScroll={handleScroll}\n >\n <div style={{ height: SPACER, flexShrink: 0 }} />\n\n {items.map((item) => {\n const isSel = item === localValue;\n return (\n <div\n key={item}\n style={{\n height: ITEM_H,\n scrollSnapAlign: \"center\",\n }}\n className=\"flex items-center justify-center cursor-pointer select-none\"\n onClick={() => handleItemClick(item)}\n >\n <span\n style={{\n fontSize: isSel ? 32 : 14,\n lineHeight: 1,\n color: isSel\n ? \"var(--foreground)\"\n : \"var(--disabled)\",\n transition: \"font-size 0.1s, color 0.1s\",\n }}\n >\n {pad2(item)}\n </span>\n </div>\n );\n })}\n\n <div style={{ height: SPACER, flexShrink: 0 }} />\n </div>\n );\n}\n\n// ─── Range Slot Grid (PopupCalendar design) ────────────────────────────────────\nconst DEFAULT_SLOTS = generateHourlySlots();\n\nfunction RangeSlotPicker({\n slots = DEFAULT_SLOTS,\n startValue,\n endValue,\n onSelect,\n}: {\n slots?: TimeSlot[];\n startValue: TimeValue;\n endValue: TimeValue;\n onSelect: (slot: TimeSlot) => void;\n}) {\n return (\n <div\n className=\"overflow-y-auto [&::-webkit-scrollbar]:hidden\"\n style={{ maxHeight: 320, scrollbarWidth: \"none\", minWidth: 300 }}\n >\n <div\n className=\"content-center grid grid-cols-2 gap-x-[20px] gap-y-[32px] items-center justify-between overflow-clip relative\"\n style={{ padding: \"24px 40px\" }}\n >\n {slots.map((slot, idx) => {\n const isSelected = slotMatches(\n slot,\n startValue,\n endValue,\n );\n return (\n <div\n key={idx}\n onClick={() => onSelect(slot)}\n className={cn(\n \"content-stretch flex h-[25px] items-center justify-center relative rounded-[4px] shrink-0 cursor-pointer select-none transition-colors duration-100\",\n isSelected\n ? \"bg-primary-action\"\n : \"hover:bg-primary-action-light\",\n )}\n style={{ padding: \"2px 8px\" }}\n >\n <p\n className=\"leading-[22px] relative shrink-0 text-[14px] text-center whitespace-nowrap\"\n style={{\n fontVariationSettings: \"'wdth' 100\",\n color: isSelected\n ? \"var(--on-primary-action)\"\n : \"var(--foreground)\",\n }}\n >\n {slot.label}\n </p>\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n\n// ─── Action Buttons (ยกเลิก / ตกลง) ────────────────────────────────────────────\nfunction PickerActions({\n onCancel,\n onConfirm,\n px = 24,\n}: {\n onCancel?: () => void;\n onConfirm?: () => void;\n px?: number;\n}) {\n return (\n <div\n className=\"flex gap-[12px] items-center\"\n style={{ padding: `16px ${px}px` }}\n >\n <Button\n variant=\"outline\"\n size=\"lg\"\n className=\"flex-1\"\n onClick={onCancel}\n >\n ยกเลิก\n </Button>\n <Button\n variant=\"primary\"\n size=\"lg\"\n className=\"flex-1\"\n onClick={onConfirm}\n >\n ตกลง\n </Button>\n </div>\n );\n}\n\n// ─── Time Picker Content (drums / slots only — no bg, no buttons) ──────────────\nfunction TimePickerContent({\n mode,\n singleValue,\n onSingleChange,\n startValue,\n endValue,\n onStartChange,\n onEndChange,\n}: {\n mode: TimeInputMode;\n singleValue: TimeValue;\n onSingleChange: (v: TimeValue) => void;\n startValue: TimeValue;\n endValue: TimeValue;\n onStartChange: (v: TimeValue) => void;\n onEndChange: (v: TimeValue) => void;\n}) {\n // ── Range mode → slot grid ─────────────────────────────────────────────────\n if (mode === \"range\") {\n return (\n <RangeSlotPicker\n startValue={startValue}\n endValue={endValue}\n onSelect={(slot) => {\n onStartChange(slot.start);\n onEndChange(slot.end);\n }}\n />\n );\n }\n\n // ── Single mode → drum scroll ──────────────────────────────────────────────\n const handleHour = (h: number) =>\n onSingleChange({ ...singleValue, hour: h });\n const handleMinute = (m: number) =>\n onSingleChange({ ...singleValue, minute: m });\n\n return (\n <div className=\"relative w-full\">\n {/* Highlight band */}\n <div\n className=\"absolute left-0 right-0 rounded-[4px] bg-selected-light-bg pointer-events-none\"\n style={{\n top: \"50%\",\n transform: \"translateY(-50%)\",\n height: ITEM_H,\n zIndex: 0,\n }}\n />\n <div\n className=\"relative flex gap-[8px] items-center justify-center\"\n style={{ zIndex: 1 }}\n >\n <ScrollColumn\n items={HOURS}\n value={singleValue.hour}\n onChange={handleHour}\n />\n <div\n className=\"flex items-center justify-center shrink-0\"\n style={{ height: ITEM_H, width: 8 }}\n >\n <span\n style={{\n fontSize: 32,\n lineHeight: 1,\n color: \"var(--foreground)\",\n }}\n >\n :\n </span>\n </div>\n <ScrollColumn\n items={MINUTES}\n value={singleValue.minute}\n onChange={handleMinute}\n />\n </div>\n </div>\n );\n}\n\n// ─── Main Component ────────────────────────────────────────────────────────────\nconst TimeInput = forwardRef<HTMLDivElement, TimeInputProps>(\n (\n {\n mode = \"single\",\n placeholder = \"Text label\",\n required = false,\n forceState,\n errorMessage = \"Error message\",\n helperText,\n value,\n onChange,\n startTime,\n endTime,\n onStartChange,\n onEndChange,\n className,\n },\n ref,\n ) => {\n const [open, setOpen] = useState(false);\n const isMobile = useIsMobile();\n\n const [internalSingle, setInternalSingle] = useState<\n TimeValue | undefined\n >(undefined);\n const [internalStart, setInternalStart] = useState<TimeValue>({\n hour: 0,\n minute: 0,\n });\n const [internalEnd, setInternalEnd] = useState<TimeValue>({\n hour: 0,\n minute: 0,\n });\n\n const [draftSingle, setDraftSingle] = useState<TimeValue>({\n hour: 0,\n minute: 0,\n });\n const [draftStart, setDraftStart] = useState<TimeValue>({\n hour: 0,\n minute: 0,\n });\n const [draftEnd, setDraftEnd] = useState<TimeValue>({\n hour: 0,\n minute: 0,\n });\n\n const isStatic = Boolean(forceState);\n const isDisabled = forceState === \"disabled\";\n\n const currentValue =\n value !== undefined ? value : internalSingle;\n const currentStart =\n startTime !== undefined ? startTime : internalStart;\n const currentEnd =\n endTime !== undefined ? endTime : internalEnd;\n\n const state: TimeInputState =\n forceState ?? (open ? \"focus\" : \"default\");\n const isError = state === \"error\";\n const isFocus = state === \"focus\";\n\n const isFilled =\n mode === \"single\" ? Boolean(currentValue) : true;\n\n // ── Colours ──────────────────────────────────────────────────────────────────\n const bgClass = isDisabled ? \"bg-disabled-bg\" : \"bg-background\";\n const labelColor = isDisabled\n ? \"var(--disabled)\"\n : \"var(--muted-foreground)\";\n const valueColor = isDisabled\n ? \"var(--disabled)\"\n : \"var(--foreground)\";\n const iconColor = isDisabled\n ? \"var(--disabled)\"\n : \"var(--muted-foreground)\";\n const minusColor = isDisabled\n ? \"var(--disabled)\"\n : \"var(--muted-foreground)\";\n const asteriskColor = isDisabled\n ? \"var(--disabled)\"\n : \"var(--error-dark)\";\n const asteriskSmall = isDisabled\n ? \"var(--disabled)\"\n : \"var(--error-dark)\";\n\n // ── Border ────────────────────────────────────────────────────────────────────\n const borderInset = isFocus || isError ? \"-1px\" : \"0px\";\n const borderRad = isFocus || isError ? \"9px\" : \"8px\";\n const borderColor = isDisabled\n ? \"var(--border-disabled)\"\n : isError\n ? \"var(--destructive)\"\n : isFocus\n ? \"var(--primary-action)\"\n : \"var(--border)\";\n\n const showBelow = isError || Boolean(helperText);\n const leftText = isError ? errorMessage : (helperText ?? \"\");\n const leftColor = isError\n ? \"var(--error-dark)\"\n : \"var(--muted-foreground)\";\n\n // ── Handlers ─────────────────────────────────────────────────────────────────\n const commitSingle = useCallback(\n (v: TimeValue) => {\n if (value === undefined) setInternalSingle(v);\n onChange?.(v);\n },\n [value, onChange],\n );\n const commitStart = useCallback(\n (v: TimeValue) => {\n if (startTime === undefined) setInternalStart(v);\n onStartChange?.(v);\n },\n [startTime, onStartChange],\n );\n const commitEnd = useCallback(\n (v: TimeValue) => {\n if (endTime === undefined) setInternalEnd(v);\n onEndChange?.(v);\n },\n [endTime, onEndChange],\n );\n\n // ── Trigger content ───────────────────────────────────────────────────────────\n const renderContent = () => {\n if (isFilled && (mode === \"range\" || currentValue)) {\n const floatLabel = required ? (\n <div className=\"flex gap-[2px] items-center shrink-0 w-full\">\n <p\n className=\"leading-[16px] not-italic shrink-0 text-[12px] whitespace-nowrap\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n <p\n className=\"leading-[1.5] not-italic shrink-0 text-[9px] w-[7px]\"\n style={{ color: asteriskSmall }}\n >\n *\n </p>\n </div>\n ) : (\n <p\n className=\"leading-[16px] not-italic shrink-0 text-[12px] w-full\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n );\n\n const valueRow =\n mode === \"single\" && currentValue ? (\n <p\n className=\"leading-[20px] not-italic shrink-0 text-[16px] w-full\"\n style={{ color: valueColor }}\n >\n {formatTime(currentValue)}\n </p>\n ) : mode === \"range\" ? (\n <div className=\"flex gap-[8px] items-center shrink-0 w-full\">\n <p\n className=\"leading-[20px] not-italic shrink-0 text-[16px] whitespace-nowrap\"\n style={{ color: valueColor }}\n >\n {formatTime(currentStart)}\n </p>\n <Minus\n size={20}\n color={minusColor}\n />\n <p\n className=\"leading-[20px] not-italic shrink-0 text-[16px] whitespace-nowrap\"\n style={{ color: valueColor }}\n >\n {formatTime(currentEnd)}\n </p>\n </div>\n ) : null;\n\n return (\n <div className=\"content-stretch flex flex-1 flex-col items-center justify-center min-h-px min-w-px relative\">\n {floatLabel}\n {valueRow}\n </div>\n );\n }\n\n if (required) {\n return (\n <div className=\"content-stretch flex flex-1 min-w-px min-h-px gap-[2px] items-center relative\">\n <p\n className=\"leading-[20px] not-italic shrink-0 text-[16px] whitespace-nowrap\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n <p\n className=\"font-normal h-full leading-[1.5] not-italic shrink-0 text-[12px] w-[7px]\"\n style={{ color: asteriskColor }}\n >\n *\n </p>\n </div>\n );\n }\n\n return (\n <p\n className=\"flex-1 min-w-0 min-h-px text-[16px] leading-[20px] not-italic overflow-hidden text-ellipsis whitespace-nowrap relative\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n );\n };\n\n const isTriggerFilled =\n isFilled && (mode === \"range\" || currentValue);\n const triggerPadding = isTriggerFilled\n ? \"py-1.5\"\n : \"py-3\";\n const triggerBase = cn(\n \"relative flex gap-2 items-center rounded-lg px-3.5 w-full\",\n bgClass,\n triggerPadding,\n );\n\n const triggerInner = (\n <>\n <div\n aria-hidden=\"true\"\n className=\"absolute pointer-events-none border border-solid\"\n style={{\n inset: borderInset,\n borderRadius: borderRad,\n borderColor,\n }}\n />\n {renderContent()}\n <div\n className={cn(\n \"flex flex-row items-center shrink-0\",\n isTriggerFilled && \"self-stretch\",\n )}\n >\n <Clock\n size={isTriggerFilled ? 22 : 24}\n color={iconColor}\n weight=\"regular\"\n />\n </div>\n </>\n );\n\n const belowMsg = showBelow && (\n <div className=\"flex items-start px-1 text-xs leading-4\">\n <span\n className=\"flex-1 min-w-0\"\n style={{ color: leftColor }}\n >\n {leftText}\n </span>\n </div>\n );\n\n // ── Static (forceState) ───────────────────────────────────────────────────────\n if (isStatic) {\n return (\n <div\n ref={ref}\n className={cn(\n \"flex flex-col gap-[4px] w-full\",\n className,\n )}\n >\n <div className={triggerBase}>{triggerInner}</div>\n {belowMsg}\n </div>\n );\n }\n\n const handleOpenChange = (o: boolean) => {\n if (!isDisabled) {\n if (o) {\n setDraftSingle(\n currentValue ?? { hour: 0, minute: 0 },\n );\n setDraftStart(currentStart);\n setDraftEnd(currentEnd);\n }\n setOpen(o);\n }\n };\n\n const handleCancel = () => setOpen(false);\n\n const handleConfirm = () => {\n if (mode === \"single\") {\n commitSingle(draftSingle);\n } else {\n commitStart(draftStart);\n commitEnd(draftEnd);\n }\n setOpen(false);\n };\n\n const triggerButton = (\n <button\n type=\"button\"\n disabled={isDisabled}\n className={cn(\n triggerBase,\n \"text-left cursor-pointer disabled:cursor-default\",\n )}\n >\n {triggerInner}\n </button>\n );\n\n const pickerContent = (\n <TimePickerContent\n mode={mode}\n singleValue={draftSingle}\n onSingleChange={setDraftSingle}\n startValue={draftStart}\n endValue={draftEnd}\n onStartChange={setDraftStart}\n onEndChange={setDraftEnd}\n />\n );\n\n const actionButtons = (\n <div className=\"flex gap-[12px] items-center pt-[12px]\">\n <Button\n variant=\"outline\"\n size=\"lg\"\n className=\"flex-1\"\n onClick={handleCancel}\n >\n ยกเลิก\n </Button>\n <Button\n variant=\"primary\"\n size=\"lg\"\n className=\"flex-1\"\n onClick={handleConfirm}\n >\n ตกลง\n </Button>\n </div>\n );\n\n // ── Interactive ───────────────────────────────────────────────────────────────\n return (\n <div\n ref={ref}\n className={cn(\n \"flex flex-col gap-[4px] w-full\",\n className,\n )}\n >\n {isMobile ? (\n <Drawer open={open} onOpenChange={handleOpenChange}>\n <DrawerTrigger asChild>\n {triggerButton}\n </DrawerTrigger>\n <DrawerContent>\n <DrawerTitle className=\"sr-only\">\n เลือกเวลา\n </DrawerTitle>\n <div className=\"overflow-auto px-4 pt-2 pb-8 w-full\">\n {pickerContent}\n {actionButtons}\n </div>\n </DrawerContent>\n </Drawer>\n ) : (\n <Popover.Root\n open={open}\n onOpenChange={handleOpenChange}\n >\n <Popover.Trigger asChild>\n {triggerButton}\n </Popover.Trigger>\n\n <Popover.Portal>\n <Popover.Content\n align=\"start\"\n sideOffset={4}\n className=\"z-50 rounded-[8px] bg-popover p-3 outline-none max-w-[340px] text-popover-foreground\"\n style={{\n boxShadow: \"var(--elevation-popover)\",\n border: \"1px solid var(--border)\",\n minWidth:\n mode === \"single\" ? 327 : undefined,\n }}\n onOpenAutoFocus={(e) => e.preventDefault()}\n >\n {pickerContent}\n {actionButtons}\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n )}\n {belowMsg}\n </div>\n );\n },\n);\n\nTimeInput.displayName = \"TimeInput\";\n\nexport { TimeInput };\n"],"names":["Button","Card","Page","PageHeader","Section","Toolbar","CardGrid","Stack","sizeStyles","Chip","DrawerPr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CACH;AAAA,YAAA,EAAA,CACF;AAAA,UAAA,EAAA,CACF,IAEA;AAAA,YAAC,QAAQ;AAAA,YAAR;AAAA,cACC;AAAA,cACA,cAAc;AAAA,cAEd,UAAA;AAAA,gBAAA,oBAAC,QAAQ,SAAR,EAAgB,SAAO,MACrB,UAAA,eACH;AAAA,gBAEA,oBAAC,QAAQ,QAAR,EACC,UAAA;AAAA,kBAAC,QAAQ;AAAA,kBAAR;AAAA,oBACC,OAAM;AAAA,oBACN,YAAY;AAAA,oBACZ,WAAU;AAAA,oBACV,OAAO;AAAA,sBACL,WAAW;AAAA,sBACX,QAAQ;AAAA,sBACR,UACE,SAAS,WAAW,MAAM;AAAA,oBAAA;AAAA,oBAE9B,iBAAiB,CAAC,MAAM,EAAE,eAAA;AAAA,oBAEzB,UAAA;AAAA,sBAAA;AAAA,sBACA;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBAAA,EACH,CACF;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAGH;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,UAAU,cAAc;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/lib/utils.ts","../src/components/button.tsx","../src/components/card.tsx","../src/components/layout.tsx","../src/components/chip.tsx","../src/components/ui/use-mobile.ts","../src/components/ui/drawer.tsx","../src/components/date-input.tsx","../src/components/dropdown.tsx","../src/components/dropdown-multiple.tsx","../src/components/input.tsx","../src/components/option-list.tsx","../src/components/search-input.tsx","../src/components/tab.tsx","../src/components/tag.tsx","../src/components/textarea.tsx","../src/components/time-input.tsx"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport React, { useState, forwardRef } from \"react\";\nimport { cn } from \"../lib/utils\";\n\nexport type ButtonLabelSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type ButtonIconSize = \"icon-xs\" | \"icon-sm\" | \"icon-md\" | \"icon-lg\" | \"icon-xl\";\nexport type ButtonSize = ButtonLabelSize | ButtonIconSize;\n\nexport type ButtonVariant = \"primary\" | \"outline\" | \"plain\" | \"outline-black\" | \"plain-black\" | \"disabled\";\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Button size. Label sizes: xs, sm, md, lg, xl. Icon-only sizes: icon-xs through icon-xl. Default: \"md\". */\n size?: ButtonSize;\n /** Visual style. Use \"primary\" for the main CTA, \"outline\" for secondary, \"plain\" for tertiary. Default: \"primary\". */\n variant?: ButtonVariant;\n children?: React.ReactNode;\n /** Icon element rendered to the left of the label. Only applies to label-size buttons. */\n leftIcon?: React.ReactNode;\n /** Icon element rendered to the right of the label. Only applies to label-size buttons. */\n rightIcon?: React.ReactNode;\n}\n\n// ─── Label-size maps (use token-based Tailwind classes) ───────────────────────\nconst labelIconSizeClass: Record<ButtonLabelSize, string> = {\n xs: \"h-4 w-4\", // 16px\n sm: \"h-4.5 w-4.5\", // ~18px\n md: \"h-4.5 w-4.5\",\n lg: \"h-5 w-5\", // 20px\n xl: \"h-5 w-5\",\n};\n\nconst gapClass: Record<ButtonLabelSize, string> = {\n xs: \"gap-0.5\", // 2px\n sm: \"gap-0.5\",\n md: \"gap-0.5\",\n lg: \"gap-1\", // 4px\n xl: \"gap-1\",\n};\n\nconst textSizeClass: Record<ButtonLabelSize, string> = {\n xs: \"text-xs leading-4\",\n sm: \"text-sm leading-5\",\n md: \"text-sm leading-5\",\n lg: \"text-sm leading-5\",\n xl: \"text-sm leading-5\",\n};\n\nconst roundedLabelClass: Record<ButtonLabelSize, string> = {\n xs: \"rounded\",\n sm: \"rounded-md\",\n md: \"rounded-md\",\n lg: \"rounded-lg\",\n xl: \"rounded-lg\",\n};\n\nfunction getPaddingClasses(\n size: ButtonLabelSize,\n hasLeft: boolean,\n hasRight: boolean,\n): readonly [string, string, string] {\n const pyMap: Record<ButtonLabelSize, string> = {\n xs: \"py-1\", // 4px\n sm: \"py-1\", // 4px\n md: \"py-1.5\", // 6px\n lg: \"py-2\", // 8px\n xl: \"py-2.5\", // 10px\n };\n const pxMap: Record<ButtonLabelSize, { l: string; r: string }> = {\n xs: { l: \"pl-1.5\", r: \"pr-1.5\" }, // 6px\n sm: { l: \"pl-2\", r: \"pr-2\" }, // 8px\n md: { l: \"pl-2.5\", r: \"pr-2.5\" }, // 10px\n lg: { l: \"pl-3.5\", r: \"pr-3.5\" }, // 14px\n xl: { l: \"pl-4\", r: \"pr-4\" }, // 16px\n };\n const reducedMap: Record<ButtonLabelSize, { l: string; r: string }> = {\n xs: { l: \"pl-1.5\", r: \"pr-1.5\" },\n sm: { l: \"pl-1.5\", r: \"pr-1.5\" },\n md: { l: \"pl-2\", r: \"pr-2\" },\n lg: { l: \"pl-2.5\", r: \"pr-2.5\" },\n xl: { l: \"pl-3\", r: \"pr-3\" },\n };\n return [\n hasLeft ? reducedMap[size].l : pxMap[size].l,\n hasRight ? reducedMap[size].r : pxMap[size].r,\n pyMap[size],\n ] as const;\n}\n\n// ─── Icon-size specs (from Figma) ─────────────────────────────────────────────\nconst iconSizeSpec: Record<ButtonIconSize, { btn: string; icon: number; rounded: string }> = {\n \"icon-xs\": { btn: \"h-6 w-6\", icon: 16, rounded: \"rounded\" },\n \"icon-sm\": { btn: \"h-7 w-7\", icon: 18, rounded: \"rounded-md\" },\n \"icon-md\": { btn: \"h-8 w-8\", icon: 18, rounded: \"rounded-md\" },\n \"icon-lg\": { btn: \"h-9 w-9\", icon: 20, rounded: \"rounded-lg\" },\n \"icon-xl\": { btn: \"h-10 w-10\", icon: 20, rounded: \"rounded-lg\" },\n};\n\n// ─── Variant colours ──────────────────────────────────────────────────────────\nfunction getVariantClasses(variant: ButtonVariant, isDisabled: boolean): string {\n if (isDisabled) {\n if (variant === \"outline\" || variant === \"outline-black\")\n return \"bg-disabled-bg text-disabled border border-border-disabled cursor-not-allowed\";\n return \"bg-disabled-bg text-disabled cursor-not-allowed\";\n }\n if (variant === \"outline\")\n return \"bg-background text-primary-action border border-border hover:bg-hover-bg active:bg-disabled-bg\";\n if (variant === \"plain\")\n return \"bg-transparent text-primary-action hover:bg-hover-bg active:bg-disabled-bg\";\n // Black label variants — hover only, no active state (by design)\n if (variant === \"outline-black\")\n return \"bg-background text-foreground border border-border hover:bg-hover-bg\";\n if (variant === \"plain-black\")\n return \"bg-transparent text-foreground hover:bg-hover-bg\";\n // primary\n return \"bg-primary-action text-on-primary-action hover:bg-primary-action-hover active:bg-primary-action-active\";\n}\n\n// ─── Component ────────────────────────────────────────────────────────────────\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n size = \"md\",\n variant = \"primary\",\n children,\n leftIcon,\n rightIcon,\n disabled,\n className = \"\",\n // Destructure pointer events so we can merge with ghost-icon active handlers\n onPointerDown,\n onPointerUp,\n onPointerLeave,\n ...props\n },\n ref,\n) {\n const isDisabled = variant === \"disabled\" || !!disabled;\n const isGhost = variant === \"outline-black\" || variant === \"plain-black\";\n const isIconOnly = size.startsWith(\"icon-\");\n\n // ── Ghost icon-only active state ──────────────────────────────────────────\n // Ghost icon-only buttons have a Press state: disabled-bg + disabled icon color.\n // We drive this via React state so it works regardless of Tailwind cascade order.\n // Ghost LABEL buttons have no active state (by design).\n const [ghostPressed, setGhostPressed] = useState(false);\n\n const needsGhostPress = isGhost && isIconOnly && !isDisabled;\n\n const ghostPressStyle: React.CSSProperties | undefined = needsGhostPress && ghostPressed\n ? { backgroundColor: \"var(--disabled-bg)\", color: \"var(--disabled)\" }\n : undefined;\n\n // Merged pointer handlers (preserve any consumer-supplied handlers)\n const handlePointerDown = needsGhostPress\n ? (e: React.PointerEvent<HTMLButtonElement>) => { setGhostPressed(true); onPointerDown?.(e); }\n : onPointerDown;\n const handlePointerUp = needsGhostPress\n ? (e: React.PointerEvent<HTMLButtonElement>) => { setGhostPressed(false); onPointerUp?.(e); }\n : onPointerUp;\n const handlePointerLeave = needsGhostPress\n ? (e: React.PointerEvent<HTMLButtonElement>) => { setGhostPressed(false); onPointerLeave?.(e); }\n : onPointerLeave;\n\n const variantClasses = getVariantClasses(variant, isDisabled);\n const cursorClass = isDisabled ? \"cursor-not-allowed\" : \"cursor-pointer\";\n const baseClasses =\n \"inline-flex items-center justify-center font-medium whitespace-nowrap transition-colors duration-150 select-none\";\n\n // ── Icon-only (size = \"icon-*\") ────────────────────────────────────────────\n if (isIconOnly) {\n const spec = iconSizeSpec[size as ButtonIconSize];\n return (\n <button\n ref={ref}\n className={cn(\n baseClasses,\n spec.rounded,\n spec.btn,\n \"shrink-0\",\n variantClasses,\n cursorClass,\n className,\n )}\n style={ghostPressStyle}\n disabled={isDisabled}\n aria-label=\"icon button\"\n onPointerDown={handlePointerDown}\n onPointerUp={handlePointerUp}\n onPointerLeave={handlePointerLeave}\n {...props}\n >\n <span\n className={cn(\"flex items-center justify-center\")}\n aria-hidden=\"true\"\n style={{ width: spec.icon, height: spec.icon }}\n >\n {children}\n </span>\n </button>\n );\n }\n\n // ── Labelled button ────────────────────────────────────────────────────────\n const labelSize = size as ButtonLabelSize;\n const hasLeft = Boolean(leftIcon);\n const hasRight = Boolean(rightIcon);\n const paddingParts = getPaddingClasses(labelSize, hasLeft, hasRight);\n\n return (\n <button\n ref={ref}\n className={cn(\n baseClasses,\n roundedLabelClass[labelSize],\n paddingParts[0],\n paddingParts[1],\n paddingParts[2],\n hasLeft || hasRight ? gapClass[labelSize] : undefined,\n variantClasses,\n cursorClass,\n textSizeClass[labelSize],\n className,\n )}\n disabled={isDisabled}\n onPointerDown={onPointerDown}\n onPointerUp={onPointerUp}\n onPointerLeave={onPointerLeave}\n {...props}\n >\n {hasLeft && (\n <span\n className={cn(\n \"flex items-center justify-center shrink-0 overflow-hidden\",\n labelIconSizeClass[labelSize],\n )}\n aria-hidden=\"true\"\n >\n {leftIcon}\n </span>\n )}\n\n {children ?? \"Button\"}\n\n {hasRight && (\n <span\n className={cn(\n \"flex items-center justify-center shrink-0 overflow-hidden\",\n labelIconSizeClass[labelSize],\n )}\n aria-hidden=\"true\"\n >\n {rightIcon}\n </span>\n )}\n </button>\n );\n});\n\nButton.displayName = \"Button\";\n","\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { CalendarBlank, Lock, MapPin, Users } from \"@phosphor-icons/react\";\nimport { cn } from \"../lib/utils\";\n\nconst imgBanner = \"\";\n\nexport type CardVariant = \"desktop\" | \"tablet\" | \"mobile\";\nexport type CardTagStatus = \"not-registered\" | \"registered\" | \"full\";\n\nexport interface CardProps {\n /** Responsive layout preset. desktop=308px, tablet=224px, mobile=163px. Default: \"desktop\". */\n variant?: CardVariant;\n /** Event title (clamped to 2 lines). */\n title?: string;\n /** Formatted date string, e.g. \"Jun 23, 2024\". */\n date?: string;\n /** Time range string, e.g. \"08:30 - 12:00\". */\n time?: string;\n /** Location/venue name. */\n location?: string;\n /** Whether to show the location row. Default: true. */\n showLocation?: boolean;\n /** Whether to show the audience count row. Default: true. */\n showAudience?: boolean;\n /** Audience count string, e.g. \"200/200\". */\n count?: string;\n /** Shows a lock badge on the banner image. */\n locked?: boolean;\n /** Registration status shown as a colored tag at the bottom. */\n tagStatus?: CardTagStatus;\n /** URL for the banner image. */\n image?: string;\n className?: string;\n}\n\nfunction LockIcon() {\n return <Lock size={16} weight=\"regular\" color=\"var(--subtle-text)\" />;\n}\nfunction CalendarIcon() {\n return <CalendarBlank size={16} weight=\"regular\" color=\"var(--accent-orange)\" />;\n}\nfunction LocationIcon() {\n return <MapPin size={16} weight=\"regular\" color=\"var(--subtle-text)\" />;\n}\nfunction AudienceIcon() {\n return <Users size={16} weight=\"regular\" color=\"var(--subtle-text)\" />;\n}\n\nconst tagConfig: Record<CardTagStatus, { bg: string; text: string; label: string }> = {\n \"not-registered\": {\n bg: \"var(--disabled-bg)\",\n text: \"var(--disabled)\",\n label: \"ยังไม่ลงทะเบียน\",\n },\n registered: {\n bg: \"var(--success-bg)\",\n text: \"var(--success)\",\n label: \"ลงทะเบียนแล้ว\",\n },\n full: {\n bg: \"var(--error-bg)\",\n text: \"var(--destructive)\",\n label: \"เต็มแล้ว\",\n },\n};\n\nexport const Card = forwardRef<HTMLDivElement, CardProps>(function Card(\n {\n variant = \"desktop\",\n title = \"Lorem ipsum dolor sit amet consectetur. Lectus viverraasdasd\",\n date = \"23 มิ.ย. 2567\",\n time = \"08.30 - 12.00\",\n location = \"ณ หอประชุมศาสตราจารย์สังเวียน อินทรวิชัย ชั้น 7 ตลาดหลักทรัพย์แห่งประเทศไทย\",\n showLocation = true,\n showAudience = true,\n count = \"200/200\",\n locked = true,\n tagStatus = \"not-registered\",\n image,\n className,\n },\n ref,\n) {\n const widthClass =\n variant === \"desktop\" ? \"w-[308px]\" : variant === \"tablet\" ? \"w-[224px]\" : \"w-[163px]\";\n const padding =\n variant === \"desktop\" ? \"p-4\" : variant === \"tablet\" ? \"p-3\" : \"p-2.5\";\n const titleGap = variant === \"desktop\" ? \"gap-1.5\" : \"gap-1\";\n const bannerClass = variant === \"desktop\" ? \"h-[173px]\" : \"aspect-video w-full\";\n const tag = tagConfig[tagStatus];\n const bannerSrc = image ?? imgBanner;\n\n return (\n <div\n ref={ref}\n className={cn(\n \"flex min-h-[120px] flex-col items-start overflow-clip rounded-[8px]\",\n \"shadow-card\",\n widthClass,\n className,\n )}\n >\n <div className={cn(\"relative w-full shrink-0 overflow-clip\", bannerClass)}>\n <img\n alt=\"event banner\"\n className=\"pointer-events-none absolute inset-0 size-full object-cover\"\n src={bannerSrc}\n />\n {locked && (\n <div\n className={cn(\n \"absolute left-[8px] top-[8px] flex items-center gap-[4px] rounded-[4px] bg-hover-bg px-[6px] py-[4px]\",\n )}\n >\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-0 rounded-[4px] border border-solid border-border\"\n />\n <LockIcon />\n <p className=\"whitespace-nowrap text-[12px] leading-[18px] text-subtle-text\">Lock</p>\n </div>\n )}\n </div>\n <div className={cn(\"w-full shrink-0 bg-card\", padding)}>\n <div className={cn(\"flex w-full flex-col items-start\", titleGap)}>\n <div className=\"flex w-full flex-col items-start gap-1\">\n <p\n className={cn(\n \"line-clamp-2 w-full overflow-hidden text-ellipsis text-sm leading-5 text-foreground\",\n )}\n >\n {title}\n </p>\n <div className=\"flex w-full items-center gap-2\">\n <div className=\"flex h-[22px] shrink-0 items-center gap-1\">\n <CalendarIcon />\n <p className=\"whitespace-nowrap text-xs leading-4 text-accent-orange\">\n {date}\n </p>\n </div>\n <div className=\"h-[14px] w-px shrink-0 bg-border\" />\n <p\n className={cn(\n \"min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-xs leading-4 text-subtle-text\",\n )}\n >\n {time}\n </p>\n </div>\n {showLocation && (\n <div className=\"flex h-[22px] w-full items-center gap-1\">\n <LocationIcon />\n <p\n className={cn(\n \"min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-xs leading-4 text-subtle-text\",\n )}\n >\n {location}\n </p>\n </div>\n )}\n {showAudience && (\n <div className=\"flex h-[22px] w-full items-center gap-1\">\n <AudienceIcon />\n <p className=\"shrink-0 whitespace-nowrap text-xs leading-4 text-subtle-text\">\n ผู้เข้าร่วม\n </p>\n <p className=\"shrink-0 whitespace-nowrap text-xs leading-4 text-primary-action\">\n {count}\n </p>\n </div>\n )}\n </div>\n <div className=\"flex shrink-0 items-start\">\n <div\n className=\"flex items-center justify-center gap-[2px] overflow-clip rounded-[4px] px-[8px] py-[4px]\"\n style={{ backgroundColor: tag.bg }}\n >\n <p className=\"whitespace-nowrap text-[12px] leading-[16px]\" style={{ color: tag.text }}>\n {tag.label}\n </p>\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n});\n\nCard.displayName = \"Card\";\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { cn } from \"../lib/utils\";\n\n// ─── Page ────────────────────────────────────────────────────────────────────\n\nexport type PageWidth = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"full\";\n\nconst pageWidthClass: Record<PageWidth, string> = {\n sm: \"max-w-[640px]\",\n md: \"max-w-[960px]\",\n lg: \"max-w-[1200px]\",\n xl: \"max-w-[1440px]\",\n full: \"max-w-none\",\n};\n\nexport interface PageProps extends React.HTMLAttributes<HTMLElement> {\n /** Container max-width. Default \"lg\" (1200px). */\n width?: PageWidth;\n}\n\nexport const Page = forwardRef<HTMLElement, PageProps>(function Page(\n { width = \"lg\", className, children, ...rest },\n ref,\n) {\n return (\n <main\n ref={ref}\n className={cn(\n \"mx-auto w-full px-6 md:px-8 py-10 flex flex-col gap-12\",\n pageWidthClass[width],\n className,\n )}\n {...rest}\n >\n {children}\n </main>\n );\n});\n\n// ─── PageHeader ──────────────────────────────────────────────────────────────\n\nexport interface PageHeaderProps\n extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n title: React.ReactNode;\n description?: React.ReactNode;\n /** Right-aligned actions (buttons, links). */\n actions?: React.ReactNode;\n /** Content above the title (badges, breadcrumb). */\n eyebrow?: React.ReactNode;\n}\n\nexport const PageHeader = forwardRef<HTMLElement, PageHeaderProps>(\n function PageHeader(\n { title, description, actions, eyebrow, className, ...rest },\n ref,\n ) {\n return (\n <header\n ref={ref}\n className={cn(\n \"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between\",\n className,\n )}\n {...rest}\n >\n <div className=\"flex flex-col gap-2 min-w-0\">\n {eyebrow && (\n <div className=\"flex flex-wrap items-center gap-2\">{eyebrow}</div>\n )}\n <h1>{title}</h1>\n {description && (\n <p className=\"text-muted-foreground max-w-[720px]\">{description}</p>\n )}\n </div>\n {actions && (\n <div className=\"flex flex-wrap items-center gap-3 shrink-0\">\n {actions}\n </div>\n )}\n </header>\n );\n },\n);\n\n// ─── Section ─────────────────────────────────────────────────────────────────\n\nexport interface SectionProps\n extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n title?: React.ReactNode;\n description?: React.ReactNode;\n /** Right-aligned actions beside the title. */\n actions?: React.ReactNode;\n}\n\nexport const Section = forwardRef<HTMLElement, SectionProps>(function Section(\n { title, description, actions, className, children, ...rest },\n ref,\n) {\n const hasHeader = Boolean(title || description || actions);\n return (\n <section\n ref={ref}\n className={cn(\"flex flex-col gap-6\", className)}\n {...rest}\n >\n {hasHeader && (\n <div className=\"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between\">\n <div className=\"flex flex-col gap-1 min-w-0\">\n {title && <h2>{title}</h2>}\n {description && (\n <p className=\"text-muted-foreground max-w-[720px]\">\n {description}\n </p>\n )}\n </div>\n {actions && (\n <div className=\"flex flex-wrap items-center gap-3 shrink-0\">\n {actions}\n </div>\n )}\n </div>\n )}\n {children}\n </section>\n );\n});\n\n// ─── Toolbar ─────────────────────────────────────────────────────────────────\n\nexport interface ToolbarProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Right-aligned cluster (pushed with ml-auto). */\n end?: React.ReactNode;\n}\n\nexport const Toolbar = forwardRef<HTMLDivElement, ToolbarProps>(\n function Toolbar({ end, className, children, ...rest }, ref) {\n return (\n <div\n ref={ref}\n className={cn(\n \"flex flex-wrap items-center gap-3\",\n className,\n )}\n {...rest}\n >\n {children}\n {end && <div className=\"ml-auto flex items-center gap-3\">{end}</div>}\n </div>\n );\n },\n);\n\n// ─── CardGrid ────────────────────────────────────────────────────────────────\n\nexport type CardGridCols = 2 | 3 | 4;\n\nconst cardGridColsClass: Record<CardGridCols, string> = {\n 2: \"grid-cols-1 sm:grid-cols-2\",\n 3: \"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3\",\n 4: \"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4\",\n};\n\nexport interface CardGridProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Max columns at wide breakpoints. Default 3. */\n cols?: CardGridCols;\n}\n\nexport const CardGrid = forwardRef<HTMLDivElement, CardGridProps>(\n function CardGrid({ cols = 3, className, children, ...rest }, ref) {\n return (\n <div\n ref={ref}\n className={cn(\"grid gap-6\", cardGridColsClass[cols], className)}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\n\n// ─── Stack ───────────────────────────────────────────────────────────────────\n\nexport type StackGap = 1 | 2 | 3 | 4 | 6 | 8 | 10 | 12;\nexport type StackDirection = \"row\" | \"col\";\nexport type StackAlign = \"start\" | \"center\" | \"end\" | \"stretch\";\nexport type StackJustify =\n | \"start\"\n | \"center\"\n | \"end\"\n | \"between\"\n | \"around\";\n\nconst stackGapClass: Record<StackGap, string> = {\n 1: \"gap-1\",\n 2: \"gap-2\",\n 3: \"gap-3\",\n 4: \"gap-4\",\n 6: \"gap-6\",\n 8: \"gap-8\",\n 10: \"gap-10\",\n 12: \"gap-12\",\n};\n\nconst stackAlignClass: Record<StackAlign, string> = {\n start: \"items-start\",\n center: \"items-center\",\n end: \"items-end\",\n stretch: \"items-stretch\",\n};\n\nconst stackJustifyClass: Record<StackJustify, string> = {\n start: \"justify-start\",\n center: \"justify-center\",\n end: \"justify-end\",\n between: \"justify-between\",\n around: \"justify-around\",\n};\n\nexport interface StackProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Flex direction. Default \"col\". */\n direction?: StackDirection;\n /** Spacing scale (maps to Tailwind gap-*). Default 4 (16px). */\n gap?: StackGap;\n align?: StackAlign;\n justify?: StackJustify;\n /** Wrap children on row direction. */\n wrap?: boolean;\n}\n\nexport const Stack = forwardRef<HTMLDivElement, StackProps>(function Stack(\n {\n direction = \"col\",\n gap = 4,\n align,\n justify,\n wrap,\n className,\n children,\n ...rest\n },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={cn(\n \"flex\",\n direction === \"col\" ? \"flex-col\" : \"flex-row\",\n stackGapClass[gap],\n align && stackAlignClass[align],\n justify && stackJustifyClass[justify],\n wrap && \"flex-wrap\",\n className,\n )}\n {...rest}\n >\n {children}\n </div>\n );\n});\n","\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { Check, Plus } from \"@phosphor-icons/react\";\nimport { cn } from \"../lib/utils\";\n\nexport type ChipType = \"single\" | \"multiple\";\nexport type ChipSize = \"large\" | \"medium\" | \"small\";\n\nexport interface ChipProps {\n /** Label text displayed inside the chip. Default: \"Chips Text\". */\n label?: string;\n /** \"single\" shows no icon; \"multiple\" shows Plus (unselected) / Check (selected). Default: \"single\". */\n type?: ChipType;\n /** Visual size of the chip. Default: \"large\". */\n size?: ChipSize;\n /** Whether the chip is in the selected/active state. */\n selected?: boolean;\n /** Whether the chip is non-interactive. */\n disabled?: boolean;\n onClick?: () => void;\n className?: string;\n}\n\nconst sizeStyles: Record<\n ChipSize,\n {\n container: string;\n text: string;\n icon: string;\n }\n> = {\n large: {\n container: \"h-9 px-3 gap-1\",\n text: \"text-sm leading-5\",\n icon: \"icon-lg\",\n },\n medium: {\n container: \"h-8 px-3 gap-1\",\n text: \"text-sm leading-5\",\n icon: \"icon-lg\",\n },\n small: {\n container: \"h-7 px-2.5 gap-0.5\",\n text: \"text-xs leading-4\",\n icon: \"icon-md\",\n },\n};\n\nconst multiplePaddingBySize: Record<ChipSize, string> = {\n large: \"pl-[8px] pr-[12px]\",\n medium: \"pl-[8px] pr-[12px]\",\n small: \"pl-[6px] pr-[10px]\",\n};\n\nexport const Chip = forwardRef<HTMLButtonElement, ChipProps>(function Chip(\n {\n label = \"Chips Text\",\n type = \"single\",\n size = \"large\",\n selected = false,\n disabled = false,\n onClick,\n className,\n },\n ref\n) {\n const s = sizeStyles[size];\n const isMultiple = type === \"multiple\";\n const state = disabled\n ? selected\n ? \"selected-disabled\"\n : \"disabled\"\n : selected\n ? \"selected\"\n : \"default\";\n\n const containerClass =\n state === \"selected\"\n ? \"bg-primary-action border border-primary-action\"\n : state === \"selected-disabled\"\n ? \"bg-selected-light-bg border border-transparent\"\n : state === \"disabled\"\n ? \"bg-disabled-bg border border-transparent\"\n : \"bg-background border border-border\";\n\n const textClass =\n state === \"selected\"\n ? \"text-on-primary-action\"\n : state === \"selected-disabled\"\n ? \"text-primary-action/40\"\n : state === \"disabled\"\n ? \"text-disabled\"\n : \"text-subtle-text\";\n\n const iconClass =\n state === \"selected\"\n ? \"text-on-primary-action\"\n : state === \"selected-disabled\"\n ? \"text-primary-action/40\"\n : state === \"disabled\"\n ? \"text-disabled\"\n : \"text-subtle-text\";\n\n const icon =\n isMultiple && selected ? (\n <Check aria-hidden=\"true\" weight=\"regular\" className={cn(\"shrink-0\", s.icon, iconClass)} />\n ) : isMultiple ? (\n <Plus aria-hidden=\"true\" weight=\"regular\" className={cn(\"shrink-0\", s.icon, iconClass)} />\n ) : null;\n\n return (\n <button\n ref={ref}\n type=\"button\"\n onClick={!disabled ? onClick : undefined}\n disabled={disabled}\n aria-pressed={selected}\n className={cn(\n \"inline-flex items-center justify-center rounded-full whitespace-nowrap border transition-colors\",\n s.container,\n isMultiple && multiplePaddingBySize[size],\n containerClass,\n disabled ? \"cursor-not-allowed\" : \"cursor-pointer\",\n className\n )}\n >\n {icon}\n <span className={cn(\"font-normal\", s.text, textClass)}>{label}</span>\n </button>\n );\n});\n\nChip.displayName = \"Chip\";\n","import * as React from \"react\";\n\nconst MOBILE_BREAKPOINT = 768;\n\nexport function useIsMobile() {\n const [isMobile, setIsMobile] = React.useState<boolean | undefined>(\n undefined,\n );\n\n React.useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n };\n mql.addEventListener(\"change\", onChange);\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return !!isMobile;\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { Drawer as DrawerPrimitive } from \"vaul\";\n\nimport { cn } from \"../../lib/utils\";\n\nfunction Drawer({\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Root>) {\n return <DrawerPrimitive.Root data-slot=\"drawer\" {...props} />;\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 data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction DrawerContent({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Content>) {\n return (\n <DrawerPortal data-slot=\"drawer-portal\">\n <DrawerOverlay />\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 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b\",\n \"data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t\",\n \"data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm\",\n \"data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm\",\n className,\n )}\n {...props}\n >\n <div className=\"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block\" />\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(\"flex flex-col gap-1.5 p-4\", className)}\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","\"use client\";\n\nimport React, {\n useState,\n useRef,\n useEffect,\n useCallback,\n forwardRef,\n} from \"react\";\nimport type { DateRange, CaptionProps } from \"react-day-picker\";\nimport { DayPicker, useNavigation } from \"react-day-picker\";\nimport * as Popover from \"@radix-ui/react-popover\";\nimport {\n CalendarBlank,\n CaretDoubleLeft,\n CaretDoubleRight,\n CaretLeft,\n CaretRight,\n Minus,\n} from \"@phosphor-icons/react\";\nimport { cn } from \"../lib/utils\";\nimport { useIsMobile } from \"./ui/use-mobile\";\nimport { Button } from \"./button\";\nimport {\n Drawer,\n DrawerContent,\n DrawerTrigger,\n DrawerTitle,\n} from \"./ui/drawer\";\n\nexport type { DateRange };\nexport type DateInputState =\n | \"default\"\n | \"focus\"\n | \"error\"\n | \"disabled\";\nexport type DateInputMode = \"single\" | \"range\";\n/** \"calendar\" = DayPicker grid (default), \"scroll\" = drum-scroll picker (single mode only) */\nexport type DatePickerVariant = \"calendar\" | \"scroll\";\n\nexport interface DateInputProps {\n mode?: DateInputMode;\n /** Floating label / placeholder text */\n placeholder?: string;\n /** Shows red asterisk */\n required?: boolean;\n /** Override visual state (for showcase) */\n forceState?: DateInputState;\n /** Error message shown below in error state */\n errorMessage?: string;\n /** Helper text shown below */\n helperText?: string;\n /** \"calendar\" (default) or \"scroll\" drum picker. Scroll only works with mode=\"single\". */\n pickerVariant?: DatePickerVariant;\n /** Controlled value – single mode */\n value?: Date;\n onChange?: (date: Date | undefined) => void;\n /** Controlled value – range mode */\n dateRange?: DateRange;\n onRangeChange?: (range: DateRange | undefined) => void;\n /** Gregorian years that are disabled in the year picker grid */\n disabledYears?: number[];\n className?: string;\n}\n\n// ─── Constants ────────────────────────────────────────────────────────────────\n\nconst THAI_MONTHS_SHORT = [\n \"ม.ค.\",\n \"ก.พ.\",\n \"มี.ค.\",\n \"เม.ย.\",\n \"พ.ค.\",\n \"มิ.ย.\",\n \"ก.ค.\",\n \"ส.ค.\",\n \"ก.ย.\",\n \"ต.ค.\",\n \"พ.ย.\",\n \"ธ.ค.\",\n];\nconst THAI_MONTHS_FULL = [\n \"มกราคม\",\n \"กุมภาพันธ์\",\n \"มีนาคม\",\n \"เมษายน\",\n \"พฤษภาคม\",\n \"มิถุนายน\",\n \"กรกฎาคม\",\n \"สิงหาคม\",\n \"กันยายน\",\n \"ตุลาคม\",\n \"พฤศจิกายน\",\n \"ธันวาคม\",\n];\nconst THAI_WEEKDAYS = [\"อา\", \"จ\", \"อ\", \"พ\", \"พฤ\", \"ศ\", \"ส\"];\n\nfunction formatThaiDate(date: Date): string {\n return `${date.getDate()} ${THAI_MONTHS_SHORT[date.getMonth()]} ${date.getFullYear() + 543}`;\n}\n\n// ─── Context: tells Caption it's inside a Drawer range picker ────────────────\nconst DrawerRangeCtx = React.createContext(false);\n\n// ─── Context: disabled years / months passed into CustomCaption ──────────────\ninterface DisabledDatesCtxValue {\n disabledYears?: number[];\n}\nconst DisabledDatesCtx = React.createContext<DisabledDatesCtxValue>({});\n\n// ─── Custom Caption with << < label > >> ─────────────────────────────────────\nconst NAV_BTN_CLASS = cn(\n \"h-[28px] w-[28px] inline-flex items-center justify-center\",\n \"rounded-[6px] bg-transparent border border-border cursor-pointer\",\n \"text-muted-foreground hover:bg-disabled-bg transition-colors duration-100\",\n \"p-0 outline-none\",\n);\n\ntype CaptionView = \"days\" | \"months\" | \"years\";\n\nfunction CustomCaption({\n displayMonth,\n displayIndex,\n}: CaptionProps) {\n const { goToMonth, previousMonth, nextMonth, displayMonths } =\n useNavigation();\n const isDrawerRange = React.useContext(DrawerRangeCtx);\n const { disabledYears = [] } = React.useContext(DisabledDatesCtx);\n const [view, setView] = useState<CaptionView>(\"days\");\n const [pickerYear, setPickerYear] = useState(\n displayMonth.getFullYear(),\n );\n const [yearRangeStart, setYearRangeStart] = useState(\n Math.floor(displayMonth.getFullYear() / 12) * 12,\n );\n\n const isFirst =\n displayMonths[0].getTime() === displayMonth.getTime();\n const isLast =\n displayMonths[displayMonths.length - 1].getTime() ===\n displayMonth.getTime();\n const idx = displayIndex ?? 0;\n\n const handlePrevYear = () => {\n const d = new Date(displayMonth);\n d.setFullYear(d.getFullYear() - 1);\n goToMonth(d);\n };\n const handleNextYear = () => {\n const d = new Date(displayMonth);\n d.setFullYear(d.getFullYear() + 1);\n goToMonth(d);\n };\n\n // ── Drawer range: non-first months show only centered label ──\n if (isDrawerRange && !isFirst) {\n return (\n <div className=\"flex items-center justify-center pt-3 mb-2\">\n <button\n type=\"button\"\n className=\"text-[14px] leading-[20px] text-foreground font-medium hover:text-primary-action cursor-pointer bg-transparent border-0 outline-none transition-colors\"\n onClick={() => {\n setPickerYear(displayMonth.getFullYear());\n setView(\"months\");\n }}\n >\n {THAI_MONTHS_FULL[displayMonth.getMonth()]}{\" \"}\n {displayMonth.getFullYear() + 543}\n </button>\n </div>\n );\n }\n\n // ── Header text & click per view ────────────────────────────\n let headerText: string;\n let onHeaderClick: () => void;\n\n if (view === \"years\") {\n headerText = `${yearRangeStart + 543} - ${yearRangeStart + 11 + 543}`;\n onHeaderClick = () => setView(\"months\");\n } else if (view === \"months\") {\n headerText = `${pickerYear + 543}`;\n onHeaderClick = () => {\n setYearRangeStart(Math.floor(pickerYear / 12) * 12);\n setView(\"years\");\n };\n } else {\n headerText = `${THAI_MONTHS_FULL[displayMonth.getMonth()]} ${displayMonth.getFullYear() + 543}`;\n onHeaderClick = () => {\n setPickerYear(displayMonth.getFullYear());\n setView(\"months\");\n };\n }\n\n // ── Nav buttons per view ────────────────────────────────────\n let leftNav: React.ReactNode = null;\n let rightNav: React.ReactNode = null;\n\n if (view === \"years\") {\n leftNav = (\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={() => setYearRangeStart((s) => s - 12)}\n >\n <CaretLeft size={16} className=\"text-primary-action\" />\n </button>\n );\n rightNav = (\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={() => setYearRangeStart((s) => s + 12)}\n >\n <CaretRight size={16} className=\"text-primary-action\" />\n </button>\n );\n } else if (view === \"months\") {\n leftNav = (\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={() => setPickerYear((y) => y - 1)}\n >\n <CaretLeft size={16} className=\"text-primary-action\" />\n </button>\n );\n rightNav = (\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={() => setPickerYear((y) => y + 1)}\n >\n <CaretRight size={16} className=\"text-primary-action\" />\n </button>\n );\n } else if (isDrawerRange) {\n leftNav = (\n <>\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={handlePrevYear}\n >\n <CaretDoubleLeft size={16} className=\"text-primary-action\" />\n </button>\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={() =>\n previousMonth && goToMonth(previousMonth)\n }\n >\n <CaretLeft size={16} className=\"text-primary-action\" />\n </button>\n </>\n );\n rightNav = (\n <>\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={() => nextMonth && goToMonth(nextMonth)}\n >\n <CaretRight size={16} className=\"text-primary-action\" />\n </button>\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={handleNextYear}\n >\n <CaretDoubleRight size={16} className=\"text-primary-action\" />\n </button>\n </>\n );\n } else {\n if (isFirst) {\n leftNav = (\n <>\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={handlePrevYear}\n >\n <CaretDoubleLeft\n size={16}\n className=\"text-primary-action\"\n />\n </button>\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={() =>\n previousMonth && goToMonth(previousMonth)\n }\n >\n <CaretLeft size={16} className=\"text-primary-action\" />\n </button>\n </>\n );\n }\n if (isLast) {\n rightNav = (\n <>\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={() => nextMonth && goToMonth(nextMonth)}\n >\n <CaretRight\n size={16}\n className=\"text-primary-action\"\n />\n </button>\n <button\n type=\"button\"\n className={NAV_BTN_CLASS}\n onClick={handleNextYear}\n >\n <CaretDoubleRight\n size={16}\n className=\"text-primary-action\"\n />\n </button>\n </>\n );\n }\n }\n\n // ── Shared grid button style ────────────────────────────────\n const now = new Date();\n const gridBtnClass = (\n active: boolean,\n isToday: boolean,\n isItemDisabled = false,\n ) =>\n cn(\n \"py-[10px] text-[13px] rounded-[6px] border-0 outline-none transition-colors\",\n isItemDisabled\n ? \"bg-disabled-bg text-disabled cursor-not-allowed\"\n : active\n ? \"bg-primary-action text-on-primary-action cursor-pointer\"\n : isToday\n ? \"bg-primary-action-muted text-primary-action cursor-pointer\"\n : \"bg-transparent text-foreground hover:bg-disabled-bg cursor-pointer\",\n );\n\n return (\n <>\n <div className=\"flex items-center justify-between pt-1 mb-2\">\n <div className=\"flex gap-1\">{leftNav}</div>\n <button\n type=\"button\"\n className=\"text-[14px] leading-[20px] text-foreground font-medium hover:text-primary-action cursor-pointer bg-transparent border-0 outline-none transition-colors\"\n onClick={onHeaderClick}\n >\n {headerText}\n </button>\n <div className=\"flex gap-1\">{rightNav}</div>\n </div>\n\n {view === \"months\" && (\n <div\n className=\"absolute left-0 right-0 z-10 bg-background grid grid-cols-3 gap-1 p-2 content-center\"\n style={{ top: \"42px\", bottom: \"0\" }}\n >\n {THAI_MONTHS_SHORT.map((name, i) => {\n const isCurrent =\n pickerYear === displayMonth.getFullYear() &&\n i === displayMonth.getMonth();\n const isToday =\n pickerYear === now.getFullYear() &&\n i === now.getMonth();\n return (\n <button\n key={i}\n type=\"button\"\n onClick={() => {\n goToMonth(new Date(pickerYear, i - idx));\n setView(\"days\");\n }}\n className={gridBtnClass(isCurrent, isToday)}\n >\n {name}\n </button>\n );\n })}\n </div>\n )}\n\n {view === \"years\" && (\n <div\n className=\"absolute left-0 right-0 z-10 bg-background grid grid-cols-3 gap-1 p-2 content-center\"\n style={{ top: \"42px\", bottom: \"0\" }}\n >\n {Array.from({ length: 12 }, (_, i) => {\n const year = yearRangeStart + i;\n const isCurrent =\n year === displayMonth.getFullYear();\n const isToday = year === now.getFullYear();\n const isYearDisabled = disabledYears.includes(year);\n return (\n <button\n key={year}\n type=\"button\"\n disabled={isYearDisabled}\n onClick={() => {\n if (isYearDisabled) return;\n setPickerYear(year);\n setView(\"months\");\n }}\n className={gridBtnClass(isCurrent, isToday, isYearDisabled)}\n >\n {year + 543}\n </button>\n );\n })}\n </div>\n )}\n </>\n );\n}\n\n// ─── DayPicker classNames ─────────────────────────────────────────────────────\nconst DAY_PICKER_CLASSES = {\n months: \"flex flex-col sm:flex-row sm:gap-6\",\n month: \"space-y-2 relative\",\n caption:\n \"flex justify-center pt-1 relative items-center mb-2\",\n caption_label: \"text-[14px] leading-[20px] text-foreground\",\n nav: \"hidden\",\n nav_button: cn(\n \"h-[28px] w-[28px] inline-flex items-center justify-center\",\n \"rounded-[6px] bg-transparent border border-border cursor-pointer\",\n \"text-muted-foreground hover:bg-disabled-bg transition-colors duration-100\",\n \"p-0 outline-none\",\n ),\n nav_button_previous: \"absolute left-1\",\n nav_button_next: \"absolute right-1\",\n table: \"w-full border-collapse\",\n head_row: \"flex\",\n head_cell:\n \"w-[36px] h-[32px] inline-flex items-center justify-center text-[12px] text-disabled font-normal\",\n row: \"flex w-full mt-1\",\n cell: cn(\n \"h-[36px] w-[36px] text-center p-0 relative overflow-hidden\",\n \"[&:has(.day-range-middle)]:bg-range-bg\",\n \"[&:has(.day-range-start)]:bg-range-bg\",\n \"[&:has(.day-range-end)]:bg-range-bg\",\n \"[&:has(.day-range-start)]:rounded-l-[6px]\",\n \"[&:has(.day-range-end)]:rounded-r-[6px]\",\n \"[&:first-child:has(.day-range-middle)]:rounded-l-[6px]\",\n \"[&:last-child:has(.day-range-middle)]:rounded-r-[6px]\",\n \"[&:first-child:has(.day-range-end)]:rounded-l-[6px]\",\n \"[&:last-child:has(.day-range-start)]:rounded-r-[6px]\",\n \"focus-within:relative focus-within:z-20\",\n ),\n day: cn(\n \"h-[36px] w-[36px] inline-flex items-center justify-center\",\n \"text-[14px] text-foreground rounded-[6px]\",\n \"border-0 bg-transparent cursor-pointer\",\n \"hover:bg-disabled-bg transition-colors duration-100\",\n \"outline-none aria-selected:opacity-100 p-0\",\n ),\n day_range_start:\n \"day-range-start !bg-primary-action !text-on-primary-action !rounded-l-[6px] !rounded-r-none\",\n day_range_end:\n \"day-range-end !bg-primary-action !text-on-primary-action !rounded-r-[6px] !rounded-l-none\",\n day_selected:\n \"!bg-primary-action text-on-primary-action hover:!bg-primary-action focus:!bg-primary-action rounded-[6px]\",\n day_today:\n \"[&:not([aria-selected=true])]:!bg-primary-action-light [&:not([aria-selected=true])]:text-foreground rounded-[6px]\",\n day_outside:\n \"day-outside text-disabled opacity-50 aria-selected:bg-transparent aria-selected:opacity-30\",\n day_disabled: \"text-disabled opacity-50 cursor-not-allowed\",\n day_range_middle:\n \"day-range-middle !bg-range-bg !text-range-text !rounded-none\",\n day_hidden: \"invisible\",\n};\n\nconst DRAWER_DAY_PICKER_CLASSES: typeof DAY_PICKER_CLASSES = {\n ...DAY_PICKER_CLASSES,\n months: \"flex flex-col gap-6 w-full\",\n month: \"space-y-2 relative w-full\",\n table: \"w-full border-collapse table-fixed\",\n head_row: \"flex w-full\",\n head_cell:\n \"flex-1 h-[40px] inline-flex items-center justify-center text-[13px] text-disabled font-normal\",\n row: \"flex w-full mt-1\",\n cell: cn(\n \"h-[44px] flex-1 text-center p-0 relative overflow-hidden\",\n \"[&:has(.day-range-middle)]:bg-range-bg\",\n \"[&:has(.day-range-start)]:bg-range-bg\",\n \"[&:has(.day-range-end)]:bg-range-bg\",\n \"[&:has(.day-range-start)]:rounded-l-[8px]\",\n \"[&:has(.day-range-end)]:rounded-r-[8px]\",\n \"[&:first-child:has(.day-range-middle)]:rounded-l-[8px]\",\n \"[&:last-child:has(.day-range-middle)]:rounded-r-[8px]\",\n \"[&:first-child:has(.day-range-end)]:rounded-l-[8px]\",\n \"[&:last-child:has(.day-range-start)]:rounded-r-[8px]\",\n \"focus-within:relative focus-within:z-20\",\n ),\n day: cn(\n \"h-[44px] w-full inline-flex items-center justify-center\",\n \"text-[16px] text-foreground rounded-[8px]\",\n \"border-0 bg-transparent cursor-pointer\",\n \"hover:bg-disabled-bg transition-colors duration-100\",\n \"outline-none aria-selected:opacity-100 p-0\",\n ),\n};\n\n// ─── Scroll Date Picker ────────────────────────────────────────────────────────\nconst DATE_ITEM_H = 40;\nconst DATE_DRUM_H = 200; // shows 5 items\nconst DATE_SPACER = (DATE_DRUM_H - DATE_ITEM_H) / 2;\n\nconst SCROLL_YEAR_START = 1950;\nconst SCROLL_YEAR_END = 2060;\nconst YEAR_ITEMS = Array.from(\n { length: SCROLL_YEAR_END - SCROLL_YEAR_START + 1 },\n (_, i) => String(SCROLL_YEAR_START + i),\n);\n\nfunction getDaysInMonth(year: number, month: number): number {\n return new Date(year, month, 0).getDate();\n}\n\nfunction dateToScrollValue(date: Date | undefined): {\n year: number;\n month: number;\n day: number;\n} {\n const d = date ?? new Date();\n return {\n year: d.getFullYear(),\n month: d.getMonth() + 1,\n day: d.getDate(),\n };\n}\n\nfunction scrollValueToDate(v: {\n year: number;\n month: number;\n day: number;\n}): Date {\n return new Date(v.year, v.month - 1, v.day);\n}\n\nfunction DateScrollColumn({\n items,\n selectedIndex,\n onChange,\n flex = 1,\n}: {\n items: string[];\n selectedIndex: number;\n onChange: (index: number) => void;\n /** flex-grow value; columns share available width proportionally */\n flex?: number;\n}) {\n const containerRef = useRef<HTMLDivElement>(null);\n const debounceRef = useRef<\n ReturnType<typeof setTimeout> | undefined\n >(undefined);\n const [localIndex, setLocalIndex] = useState(selectedIndex);\n const isUserScrolling = useRef(false);\n\n useEffect(() => {\n const el = containerRef.current;\n if (el) {\n el.scrollTop = selectedIndex * DATE_ITEM_H;\n setLocalIndex(selectedIndex);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (isUserScrolling.current) return;\n const el = containerRef.current;\n if (el) {\n el.scrollTo({\n top: selectedIndex * DATE_ITEM_H,\n behavior: \"smooth\",\n });\n setLocalIndex(selectedIndex);\n }\n }, [selectedIndex]);\n\n const handleScroll = useCallback(() => {\n isUserScrolling.current = true;\n const el = containerRef.current;\n if (!el) return;\n\n const rawIdx = el.scrollTop / DATE_ITEM_H;\n const idx = Math.max(\n 0,\n Math.min(Math.round(rawIdx), items.length - 1),\n );\n setLocalIndex(idx);\n\n clearTimeout(debounceRef.current);\n debounceRef.current = setTimeout(() => {\n isUserScrolling.current = false;\n const finalIdx = Math.max(\n 0,\n Math.min(\n Math.round(el.scrollTop / DATE_ITEM_H),\n items.length - 1,\n ),\n );\n el.scrollTo({\n top: finalIdx * DATE_ITEM_H,\n behavior: \"smooth\",\n });\n onChange(finalIdx);\n setLocalIndex(finalIdx);\n }, 120);\n }, [items.length, onChange]);\n\n const handleItemClick = useCallback(\n (idx: number) => {\n setLocalIndex(idx);\n onChange(idx);\n containerRef.current?.scrollTo({\n top: idx * DATE_ITEM_H,\n behavior: \"smooth\",\n });\n },\n [onChange],\n );\n\n return (\n <div\n ref={containerRef}\n className=\"relative [&::-webkit-scrollbar]:hidden min-w-0\"\n style={{\n flex,\n height: DATE_DRUM_H,\n overflowY: \"scroll\",\n scrollSnapType: \"y mandatory\",\n scrollbarWidth: \"none\",\n }}\n onScroll={handleScroll}\n >\n <div style={{ height: DATE_SPACER, flexShrink: 0 }} />\n {items.map((label, idx) => {\n const isSel = idx === localIndex;\n return (\n <div\n key={idx}\n style={{\n height: DATE_ITEM_H,\n scrollSnapAlign: \"center\",\n }}\n className=\"flex items-center justify-center cursor-pointer select-none\"\n onClick={() => handleItemClick(idx)}\n >\n <span\n style={{\n fontSize: isSel ? 32 : 14,\n lineHeight: 1,\n color: isSel ? \"var(--foreground)\" : \"var(--disabled)\",\n transition: \"font-size 0.1s, color 0.1s\",\n whiteSpace: \"nowrap\",\n }}\n >\n {label}\n </span>\n </div>\n );\n })}\n <div style={{ height: DATE_SPACER, flexShrink: 0 }} />\n </div>\n );\n}\n\nfunction ScrollDatePickerContent({\n value,\n onChange,\n}: {\n value: { year: number; month: number; day: number };\n onChange: (v: { year: number; month: number; day: number }) => void;\n}) {\n const daysInMonth = getDaysInMonth(value.year, value.month);\n const dayItems = Array.from({ length: daysInMonth }, (_, i) =>\n String(i + 1).padStart(2, \"0\"),\n );\n const monthIndex = value.month - 1;\n const dayIndex = Math.min(value.day, daysInMonth) - 1;\n const yearIndex = value.year - SCROLL_YEAR_START;\n\n const handleMonthChange = useCallback(\n (idx: number) => {\n const newMonth = idx + 1;\n const maxDay = getDaysInMonth(value.year, newMonth);\n onChange({\n ...value,\n month: newMonth,\n day: Math.min(value.day, maxDay),\n });\n },\n [value, onChange],\n );\n\n const handleDayChange = useCallback(\n (idx: number) => {\n onChange({ ...value, day: idx + 1 });\n },\n [value, onChange],\n );\n\n const handleYearChange = useCallback(\n (idx: number) => {\n const newYear = SCROLL_YEAR_START + idx;\n const maxDay = getDaysInMonth(newYear, value.month);\n onChange({\n ...value,\n year: newYear,\n day: Math.min(value.day, maxDay),\n });\n },\n [value, onChange],\n );\n\n return (\n <div className=\"relative w-full\">\n {/* Highlight band – centred over the selected row */}\n <div\n className=\"absolute left-0 right-0 rounded-[4px] bg-selected-light-bg pointer-events-none\"\n style={{\n top: \"50%\",\n transform: \"translateY(-50%)\",\n height: DATE_ITEM_H,\n zIndex: 0,\n }}\n />\n <div\n className=\"relative flex gap-[8px] items-center w-full min-w-[340px] px-4\"\n style={{ zIndex: 1 }}\n >\n <DateScrollColumn\n items={THAI_MONTHS_FULL}\n selectedIndex={monthIndex}\n onChange={handleMonthChange}\n flex={108}\n />\n <DateScrollColumn\n items={dayItems}\n selectedIndex={dayIndex}\n onChange={handleDayChange}\n flex={38}\n />\n <DateScrollColumn\n items={YEAR_ITEMS}\n selectedIndex={yearIndex}\n onChange={handleYearChange}\n flex={85}\n />\n </div>\n </div>\n );\n}\n\n// ─── Main component ───────────────────────────────────────────────────────────\nexport const DateInput = forwardRef<HTMLDivElement, DateInputProps>(\n function DateInput(\n {\n mode = \"single\",\n placeholder = \"Text label\",\n required = false,\n forceState,\n errorMessage = \"Error message\",\n helperText,\n pickerVariant = \"calendar\",\n value,\n onChange,\n dateRange,\n onRangeChange,\n disabledYears,\n className,\n },\n ref,\n ) {\n const [open, setOpen] = useState(false);\n const [internalDate, setInternalDate] = useState<\n Date | undefined\n >(undefined);\n const [internalRange, setInternalRange] = useState<\n DateRange | undefined\n >(undefined);\n const isMobile = useIsMobile();\n\n // Draft values – live-updated while picker is open; committed on ตกลง\n const [draftDate, setDraftDate] = useState<Date | undefined>(\n undefined,\n );\n const [draftRange, setDraftRange] = useState<\n DateRange | undefined\n >(undefined);\n const [draftScrollValue, setDraftScrollValue] = useState<{\n year: number;\n month: number;\n day: number;\n }>(dateToScrollValue(undefined));\n\n const isStatic = Boolean(forceState);\n const isDisabled = forceState === \"disabled\";\n\n // Controlled vs uncontrolled\n const currentDate =\n value !== undefined ? value : internalDate;\n const currentRange =\n dateRange !== undefined ? dateRange : internalRange;\n\n const state: DateInputState =\n forceState ?? (open ? \"focus\" : \"default\");\n const isError = state === \"error\";\n const isFocus = state === \"focus\";\n\n const isFilled =\n mode === \"single\"\n ? Boolean(currentDate)\n : Boolean(currentRange?.from);\n\n // ── Colours ─────────────────────────────────────────────────────────────────\n const bgClass = isDisabled ? \"bg-disabled-bg\" : \"bg-background\";\n const labelColor = isDisabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n const valueColor = isDisabled ? \"var(--disabled)\" : \"var(--foreground)\";\n const iconColor = isDisabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n const minusColor = isDisabled ? \"var(--disabled)\" : \"var(--foreground)\";\n const asteriskColorEmpty = isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\";\n const asteriskColorFilled = isDisabled\n ? \"var(--disabled)\"\n : \"var(--error-dark)\";\n\n // ── Border overlay ───────────────────────────────────────────────────────────\n const borderInset = isFocus || isError ? \"-1px\" : \"0px\";\n const borderRad = isFocus || isError ? \"9px\" : \"8px\";\n const borderColor = isDisabled\n ? \"var(--border-disabled)\"\n : isError\n ? \"var(--destructive)\"\n : isFocus\n ? \"var(--primary-action)\"\n : \"var(--border)\";\n\n const showBelow = isError || Boolean(helperText);\n const leftText = isError ? errorMessage : (helperText ?? \"\");\n const leftColor = isError ? \"var(--error-dark)\" : \"var(--muted-foreground)\";\n\n // ── Handlers ─────────────────────────────────────────────────────────────────\n const handleDateSelect = (date: Date | undefined) => {\n setDraftDate(date);\n };\n\n const handleRangeSelect = (range: DateRange | undefined) => {\n setDraftRange(range);\n };\n\n const handleCancel = () => setOpen(false);\n\n const handleConfirm = () => {\n if (pickerVariant === \"scroll\") {\n const d = scrollValueToDate(draftScrollValue);\n if (value === undefined) setInternalDate(d);\n onChange?.(d);\n } else if (mode === \"single\") {\n if (value === undefined) setInternalDate(draftDate);\n onChange?.(draftDate);\n } else {\n if (dateRange === undefined) setInternalRange(draftRange);\n onRangeChange?.(draftRange);\n }\n setOpen(false);\n };\n\n // ── Trigger content ──────────────────────────────────────────────────────────\n const renderContent = () => {\n if (isFilled) {\n // Floating label row\n const floatingLabel = required ? (\n <div className=\"flex gap-[2px] items-center relative shrink-0 w-full\">\n <p\n className=\"leading-[16px] not-italic relative shrink-0 text-[12px] whitespace-nowrap\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n <p\n className=\"leading-[1.5] not-italic relative shrink-0 text-[9px] w-[7px]\"\n style={{ color: asteriskColorFilled }}\n >\n *\n </p>\n </div>\n ) : (\n <p\n className=\"leading-[16px] not-italic relative shrink-0 text-[12px] w-full\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n );\n\n // Value row\n const valueRow =\n mode === \"single\" && currentDate ? (\n <p\n className=\"leading-[20px] not-italic relative text-[16px] w-full min-w-0 overflow-hidden text-ellipsis whitespace-nowrap\"\n style={{ color: valueColor }}\n >\n {formatThaiDate(currentDate)}\n </p>\n ) : mode === \"range\" && currentRange?.from ? (\n <div className=\"flex gap-[8px] items-center relative w-full min-w-0\">\n <p\n className=\"leading-[20px] not-italic relative text-[16px] min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap\"\n style={{ color: valueColor }}\n >\n {formatThaiDate(currentRange.from)}\n </p>\n <Minus\n size={20}\n color={minusColor}\n className=\"shrink-0\"\n />\n <p\n className=\"leading-[20px] not-italic relative text-[16px] min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap\"\n style={{ color: valueColor }}\n >\n {currentRange.to\n ? formatThaiDate(currentRange.to)\n : \"...\"}\n </p>\n </div>\n ) : null;\n\n return (\n <div className=\"content-stretch flex flex-1 flex-col items-center justify-center min-h-px min-w-0 overflow-hidden relative w-full\">\n {floatingLabel}\n {valueRow}\n </div>\n );\n }\n\n // Empty – required\n if (required) {\n return (\n <div className=\"content-stretch flex flex-1 min-w-px min-h-px gap-[2px] items-center relative\">\n <p\n className=\"leading-[20px] not-italic relative shrink-0 text-[16px] whitespace-nowrap\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n <p\n className=\"font-normal h-full leading-[1.5] not-italic relative shrink-0 text-[12px] w-[7px]\"\n style={{ color: asteriskColorEmpty }}\n >\n *\n </p>\n </div>\n );\n }\n\n // Empty – plain placeholder\n return (\n <p\n className=\"flex-1 min-w-0 min-h-px text-[16px] leading-[20px] not-italic overflow-hidden text-ellipsis whitespace-nowrap relative\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n );\n };\n\n // ── Shared trigger inner markup (used by both static div and interactive button)\n const triggerInner = (\n <>\n {/* Border overlay */}\n <div\n aria-hidden=\"true\"\n className=\"absolute pointer-events-none border border-solid\"\n style={{\n inset: borderInset,\n borderRadius: borderRad,\n borderColor,\n }}\n />\n {renderContent()}\n {/* Calendar icon */}\n <div\n className={cn(\n \"flex flex-row items-center shrink-0\",\n isFilled && \"self-stretch\",\n )}\n >\n {isFilled ? (\n <CalendarBlank size={22} weight=\"regular\" color={iconColor} />\n ) : (\n <CalendarBlank size={24} weight=\"regular\" color={iconColor} />\n )}\n </div>\n </>\n );\n\n const triggerBaseClasses = cn(\n \"relative flex gap-2 items-center rounded-lg min-w-0\",\n bgClass,\n \"px-3.5\",\n isFilled ? \"py-1.5\" : \"py-3\",\n \"w-full\",\n );\n\n // ── Below message ─────────────────────────────────────────────────────────────\n const belowMessage = showBelow && (\n <div className=\"flex items-start px-1 text-xs leading-4\">\n <span\n className=\"flex-1 min-w-0\"\n style={{ color: leftColor }}\n >\n {leftText}\n </span>\n </div>\n );\n\n // ── Static showcase (forceState set) ─────────────────────────────────────────\n if (isStatic) {\n return (\n <div\n ref={ref}\n className={cn(\"flex flex-col gap-[4px] w-full\", className)}\n >\n <div className={triggerBaseClasses}>{triggerInner}</div>\n {belowMessage}\n </div>\n );\n }\n\n // ── Picker content ────────────────────────────────────────────────────────────\n const isScrollVariant = pickerVariant === \"scroll\" && mode === \"single\";\n\n const pickerClasses = isMobile\n ? DRAWER_DAY_PICKER_CLASSES\n : DAY_PICKER_CLASSES;\n\n const pickerInner = isScrollVariant ? (\n <ScrollDatePickerContent\n value={draftScrollValue}\n onChange={setDraftScrollValue}\n />\n ) : mode === \"single\" ? (\n <DayPicker\n mode=\"single\"\n selected={draftDate}\n onSelect={handleDateSelect}\n showOutsideDays\n classNames={pickerClasses}\n formatters={{\n formatWeekdayName: (date) =>\n THAI_WEEKDAYS[date.getDay()],\n }}\n components={{ Caption: CustomCaption }}\n />\n ) : (\n <DayPicker\n mode=\"range\"\n selected={draftRange}\n onSelect={handleRangeSelect}\n numberOfMonths={2}\n showOutsideDays\n classNames={pickerClasses}\n formatters={{\n formatWeekdayName: (date) =>\n THAI_WEEKDAYS[date.getDay()],\n }}\n components={{ Caption: CustomCaption }}\n />\n );\n\n const calendarContent = (\n <DisabledDatesCtx.Provider value={{ disabledYears }}>\n {pickerInner}\n </DisabledDatesCtx.Provider>\n );\n\n const actionButtons = (\n <div className=\"flex gap-[12px] items-center pt-[12px]\">\n <Button\n variant=\"outline\"\n size=\"lg\"\n className=\"flex-1\"\n onClick={handleCancel}\n >\n ยกเลิก\n </Button>\n <Button\n variant=\"primary\"\n size=\"lg\"\n className=\"flex-1\"\n onClick={handleConfirm}\n >\n ตกลง\n </Button>\n </div>\n );\n\n const triggerButton = (\n <button\n type=\"button\"\n disabled={isDisabled}\n className={cn(\n triggerBaseClasses,\n \"text-left cursor-pointer disabled:cursor-default\",\n )}\n >\n {triggerInner}\n </button>\n );\n\n const handleOpenChange = (o: boolean) => {\n if (!isDisabled) {\n if (o) {\n // Snapshot committed values into draft when picker opens\n setDraftDate(currentDate);\n setDraftRange(currentRange);\n setDraftScrollValue(dateToScrollValue(currentDate));\n }\n setOpen(o);\n }\n };\n\n // ── Interactive ──────────────────────────────────────────────────────────────\n return (\n <div\n ref={ref}\n className={cn(\"flex flex-col gap-[4px] w-full\", className)}\n >\n {isMobile ? (\n <Drawer open={open} onOpenChange={handleOpenChange}>\n <DrawerTrigger asChild>{triggerButton}</DrawerTrigger>\n <DrawerContent>\n <DrawerTitle className=\"sr-only\">\n เลือกวันที่\n </DrawerTitle>\n <div className=\"overflow-auto px-4 pt-2 pb-8 w-full\">\n <DrawerRangeCtx.Provider value={mode === \"range\"}>\n {calendarContent}\n </DrawerRangeCtx.Provider>\n {actionButtons}\n </div>\n </DrawerContent>\n </Drawer>\n ) : (\n <Popover.Root\n open={open}\n onOpenChange={handleOpenChange}\n >\n <Popover.Trigger asChild>\n {triggerButton}\n </Popover.Trigger>\n\n <Popover.Portal>\n <Popover.Content\n align=\"start\"\n sideOffset={4}\n className=\"z-50 rounded-[8px] bg-popover p-3 outline-none text-popover-foreground\"\n style={{\n boxShadow: \"var(--elevation-popover)\",\n border: \"1px solid var(--border)\",\n }}\n onOpenAutoFocus={(e) => e.preventDefault()}\n >\n {calendarContent}\n {actionButtons}\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n )}\n\n {belowMessage}\n </div>\n );\n },\n);\n\nDateInput.displayName = \"DateInput\";\n","\"use client\";\n\nimport React, { useState, useRef, useEffect, forwardRef } from \"react\";\nimport { CaretDown, CaretUp } from \"@phosphor-icons/react\";\nimport { cn } from \"../lib/utils\";\n\nexport type DropdownState = \"default\" | \"focus\" | \"error\" | \"disabled\";\n\nexport interface DropdownOption {\n label: string;\n value: string;\n}\n\nexport interface DropdownProps {\n /** Placeholder / floating-label text */\n placeholder?: string;\n /** External label rendered above the trigger */\n label?: string;\n /** Appends a red asterisk */\n required?: boolean;\n /** Override the visual state (for showcase) */\n forceState?: DropdownState;\n /** Error message shown below when state is \"error\" */\n errorMessage?: string;\n /** Helper text shown below */\n helperText?: string;\n /** Controlled selected value */\n value?: string;\n onChange?: (value: string) => void;\n /** Options list */\n options?: DropdownOption[];\n className?: string;\n}\n\n// ── Component ───────────────────────────────────────────────────────────────\n\nconst Dropdown = forwardRef<HTMLDivElement, DropdownProps>(\n (\n {\n placeholder = \"Text label\",\n label,\n required = false,\n forceState,\n errorMessage = \"Error message\",\n helperText,\n value,\n onChange,\n options = [],\n className,\n },\n ref\n ) => {\n const [open, setOpen] = useState(false);\n const [internalValue, setInternalValue] = useState(\"\");\n const [search, setSearch] = useState(\"\");\n const containerRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n\n const controlled = value !== undefined;\n const currentValue = controlled ? value : internalValue;\n const isDisabled = forceState === \"disabled\";\n const selectedLabel = options.find((o) => o.value === currentValue)?.label;\n const isFilled = Boolean(selectedLabel);\n\n // Derive visual state\n const state: DropdownState = forceState ?? (open ? \"focus\" : \"default\");\n const isError = state === \"error\";\n const isFocus = state === \"focus\";\n\n // ── Colours ─────────────────────────────────────────────────────────────\n const bg = isDisabled ? \"bg-disabled-bg\" : \"bg-background\";\n const labelColor = isDisabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n const filledColor = isDisabled ? \"var(--disabled)\" : \"var(--foreground)\";\n const caretClassName = isDisabled ? \"text-disabled\" : \"text-muted-foreground\";\n\n const hasExternalLabel = Boolean(label);\n\n // ── Border overlay ──────────────────────────────────────────────────────\n const borderInset = (isFocus || isError) ? \"-1px\" : \"0px\";\n const borderRad = (isFocus || isError) ? \"9px\" : \"8px\";\n const borderColor = isDisabled\n ? \"var(--border-disabled)\"\n : isError\n ? \"var(--destructive)\"\n : isFocus\n ? \"var(--primary-action)\"\n : \"var(--border)\";\n\n const showBelow = isError || Boolean(helperText);\n const leftText = isError ? errorMessage : (helperText ?? \"\");\n const leftColor = isError ? \"var(--destructive)\" : \"var(--muted-foreground)\";\n\n // ── Filtered options ────────────────────────────────────────────────────\n const filteredOptions = search.trim()\n ? options.filter((o) =>\n o.label.toLowerCase().includes(search.trim().toLowerCase())\n )\n : options;\n\n // Auto-focus input when open\n useEffect(() => {\n if (open && inputRef.current) {\n inputRef.current.focus();\n }\n }, [open]);\n\n // Clear search when closing\n useEffect(() => {\n if (!open) setSearch(\"\");\n }, [open]);\n\n // Close on outside click\n useEffect(() => {\n if (!open) return;\n const handler = (e: MouseEvent) => {\n if (containerRef.current && !containerRef.current.contains(e.target as Node)) {\n setOpen(false);\n }\n };\n document.addEventListener(\"mousedown\", handler);\n return () => document.removeEventListener(\"mousedown\", handler);\n }, [open]);\n\n const handleSelect = (val: string) => {\n if (!controlled) setInternalValue(val);\n onChange?.(val);\n setOpen(false);\n };\n\n const handleToggle = () => {\n if (isDisabled) return;\n if (forceState) return;\n setOpen((prev) => !prev);\n };\n\n const handleInputKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === \"Escape\") {\n setOpen(false);\n } else if (e.key === \"Enter\" && filteredOptions.length === 1) {\n handleSelect(filteredOptions[0].value);\n }\n };\n\n // ── Required asterisk helper ────────────────────────────────────────────\n const Asterisk = ({ color }: { color: string }) => (\n <span className=\"leading-[16px] not-italic text-[12px]\" style={{ color }}>\n {\" \"}*\n </span>\n );\n\n return (\n <div\n ref={(node) => {\n (containerRef as React.MutableRefObject<HTMLDivElement | null>).current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }}\n className={cn(\"flex flex-col gap-1 w-full\", className)}\n >\n {/* ── External label ── */}\n {label && (\n <div className=\"relative shrink-0 w-full\">\n <div className=\"flex items-start px-1 w-full\">\n <p className=\"leading-5 not-italic relative shrink-0 text-foreground text-sm font-bold whitespace-nowrap\">\n {label}\n </p>\n </div>\n </div>\n )}\n\n {/* ── Trigger ── */}\n <div\n onClick={handleToggle}\n className={cn(\n \"relative flex gap-2 items-center rounded-lg px-3.5\",\n bg,\n hasExternalLabel\n ? \"h-[38px]\"\n : isFilled && !open\n ? \"py-1.5\"\n : \"p-3.5\",\n !isDisabled && !forceState && \"cursor-pointer\"\n )}\n >\n {/* Border overlay */}\n <div\n aria-hidden=\"true\"\n className=\"absolute pointer-events-none border border-solid\"\n style={{ inset: borderInset, borderRadius: borderRad, borderColor }}\n />\n\n {open && !forceState ? (\n /* ─── Open: search input ─── */\n hasExternalLabel ? (\n /* External label + open → single-line search input */\n <input\n ref={inputRef}\n type=\"text\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n onKeyDown={handleInputKeyDown}\n placeholder={isFilled ? selectedLabel : placeholder + (required ? \" *\" : \"\")}\n className=\"flex-1 min-w-0 min-h-[1px] text-sm leading-5 not-italic bg-transparent outline-none border-none p-0 m-0 placeholder:text-disabled\"\n style={{\n color: filledColor,\n caretColor: \"var(--caret-color)\",\n }}\n onClick={(e) => e.stopPropagation()}\n />\n ) : isFilled ? (\n /* Filled + open → floating label + search input */\n <div className=\"flex flex-col items-start justify-center flex-1 min-w-0 min-h-[1px]\">\n <p\n className=\"shrink-0 w-full leading-[16px] not-italic text-[12px]\"\n style={{ color: labelColor }}\n >\n {placeholder}\n {required && <Asterisk color={isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\"} />}\n </p>\n <input\n ref={inputRef}\n type=\"text\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n onKeyDown={handleInputKeyDown}\n placeholder={selectedLabel}\n className=\"w-full leading-[20px] not-italic text-[14px] min-w-0 bg-transparent outline-none border-none p-0 m-0 placeholder:text-disabled\"\n style={{\n color: filledColor,\n caretColor: \"var(--caret-color)\",\n }}\n onClick={(e) => e.stopPropagation()}\n />\n </div>\n ) : (\n /* Empty + open → inline search input */\n <input\n ref={inputRef}\n type=\"text\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n onKeyDown={handleInputKeyDown}\n placeholder={placeholder + (required ? \" *\" : \"\")}\n className=\"flex-1 min-w-0 min-h-[1px] text-base leading-5 not-italic bg-transparent outline-none border-none p-0 m-0 placeholder:text-muted-foreground\"\n style={{\n color: \"var(--foreground)\",\n caretColor: \"var(--caret-color)\",\n }}\n onClick={(e) => e.stopPropagation()}\n />\n )\n ) : isFilled ? (\n /* ─── Closed + Filled ─── */\n hasExternalLabel ? (\n /* External label → single-line selected value */\n <p\n className=\"flex-1 min-w-0 min-h-[1px] leading-5 not-italic text-sm overflow-hidden text-ellipsis whitespace-nowrap\"\n style={{ color: filledColor }}\n >\n {selectedLabel}\n {required && <Asterisk color={isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\"} />}\n </p>\n ) : (\n /* Default → floating label + selected value */\n <div className=\"flex flex-col items-start justify-center flex-1 min-w-0 min-h-[1px]\">\n <p\n className=\"shrink-0 w-full leading-4 not-italic text-xs\"\n style={{ color: labelColor }}\n >\n {placeholder}\n {required && <Asterisk color={isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\"} />}\n </p>\n <p\n className=\"w-full leading-5 not-italic text-sm min-w-0 min-h-[1px]\"\n style={{ color: filledColor }}\n >\n {selectedLabel}\n </p>\n </div>\n )\n ) : (\n /* ─── Closed + Empty: placeholder ─── */\n required ? (\n <div className=\"flex flex-1 min-w-0 min-h-[1px] gap-[2px] items-center\">\n <p\n className=\"leading-5 not-italic text-base whitespace-nowrap\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n <p\n className=\"leading-4 not-italic text-xs w-[7px]\"\n style={{ color: isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\" }}\n >\n *\n </p>\n </div>\n ) : (\n <p\n className=\"flex-1 min-w-0 min-h-[1px] text-base leading-5 not-italic overflow-hidden text-ellipsis whitespace-nowrap\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n )\n )}\n\n {/* Caret */}\n {isFocus ? (\n <CaretUp size={22} className={cn(\"shrink-0\", caretClassName)} />\n ) : (\n <CaretDown size={22} className={cn(\"shrink-0\", caretClassName)} />\n )}\n </div>\n\n {/* ── Dropdown menu ── */}\n {open && !forceState && options.length > 0 && (\n <div\n className={cn(\n \"relative bg-popover rounded-lg overflow-clip p-2 z-20 flex flex-col items-start text-popover-foreground\",\n filteredOptions.length > 10 && \"overflow-y-auto\"\n )}\n style={{\n boxShadow: \"var(--elevation-popover)\",\n ...(filteredOptions.length > 10 ? { maxHeight: 10 * 48 + 16 } : {}),\n }}\n >\n {filteredOptions.length > 0 ? (\n filteredOptions.map((opt) => (\n <div\n key={opt.value}\n onClick={() => handleSelect(opt.value)}\n className={cn(\n \"w-full shrink-0 rounded-[4px] cursor-pointer transition-colors duration-100\",\n opt.value === currentValue\n ? \"bg-primary-action-light\"\n : \"bg-popover hover:bg-disabled-bg\"\n )}\n >\n <div className=\"flex flex-row items-center size-full\">\n <div className=\"flex items-center p-3.5 relative w-full\">\n <p\n className={cn(\n \"flex-1 min-w-0 min-h-[1px] leading-5 not-italic overflow-hidden text-sm text-ellipsis whitespace-nowrap\",\n opt.value === currentValue ? \"text-primary-action\" : \"text-foreground\"\n )}\n >\n {opt.label}\n </p>\n </div>\n </div>\n </div>\n ))\n ) : (\n <div className=\"w-full shrink-0 bg-popover\">\n <div className=\"flex flex-row items-center size-full\">\n <div className=\"flex items-center p-[14px] relative w-full\">\n <p className=\"flex-1 min-w-0 min-h-[1px] leading-[20px] not-italic text-[14px] text-disabled\">\n No results found\n </p>\n </div>\n </div>\n </div>\n )}\n </div>\n )}\n\n {/* ── Below: helper / error ── */}\n {showBelow && (\n <div className=\"flex items-start px-[4px] text-[12px] leading-[16px]\">\n <span className=\"flex-1 min-w-0\" style={{ color: leftColor }}>\n {leftText}\n </span>\n </div>\n )}\n </div>\n );\n }\n);\n\nDropdown.displayName = \"Dropdown\";\n\nexport { Dropdown };\n","\"use client\";\n\nimport React, {\n forwardRef,\n useState,\n useRef,\n useEffect,\n useCallback,\n useMemo,\n useLayoutEffect,\n} from \"react\";\nimport { CaretDown, CaretUp, Check, X } from \"@phosphor-icons/react\";\nimport { cn } from \"../lib/utils\";\n\nexport type DropdownMultipleState =\n | \"default\"\n | \"focus\"\n | \"error\"\n | \"disabled\";\n\nexport interface DropdownMultipleOption {\n label: string;\n value: string;\n}\n\nexport interface DropdownMultipleProps {\n /** Placeholder / floating-label text */\n placeholder?: string;\n /** Text label rendered above the input */\n label?: string;\n /** Appends a red asterisk */\n required?: boolean;\n /** Override the visual state (for showcase) */\n forceState?: DropdownMultipleState;\n /** Error message shown below when state is \"error\" */\n errorMessage?: string;\n /** Helper text shown below */\n helperText?: string;\n /** Controlled selected values */\n value?: string[];\n onChange?: (value: string[]) => void;\n /** Options list */\n options?: DropdownMultipleOption[];\n className?: string;\n}\n\nconst TAG_GAP = 4;\nconst MAX_COMPONENT_WIDTH = 343;\n\n// ── Tag chip (removable) ────────────────────────────────────────────────────\nfunction RemovableTag({\n label,\n disabled,\n onRemove,\n maxWidth,\n}: {\n label: string;\n disabled?: boolean;\n onRemove?: () => void;\n maxWidth?: number;\n}) {\n const textColor = disabled ? \"var(--disabled)\" : \"var(--subtle-text)\";\n const iconColor = disabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n\n return (\n <div\n className=\"bg-disabled-bg flex items-center overflow-hidden pl-[8px] pr-[8px] py-[4px] rounded-[4px] shrink-0 relative group\"\n style={\n maxWidth !== undefined\n ? { maxWidth, flexShrink: 1 }\n : undefined\n }\n >\n <p\n className=\"leading-[16px] not-italic text-[12px] whitespace-nowrap overflow-hidden text-ellipsis pr-[4px]\"\n style={{ color: textColor }}\n >\n {label}{\" \"}\n </p>\n\n {!disabled && onRemove && (\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n onRemove();\n }}\n className=\"absolute right-[4px] top-1/2 -translate-y-1/2 flex items-center justify-center rounded-[2px] p-[1px] cursor-pointer opacity-0 group-hover:opacity-100 transition-all duration-150 bg-surface-clear-hover\"\n >\n <X\n size={12}\n weight=\"bold\"\n color={iconColor}\n className=\"shrink-0\"\n />\n </button>\n )}\n </div>\n );\n}\n\n// ── Tag chip (static, for showcase forceState) ──────────────────────────────\nfunction StaticTag({\n label,\n disabled,\n maxWidth,\n}: {\n label: string;\n disabled?: boolean;\n maxWidth?: number;\n}) {\n const textColor = disabled ? \"var(--disabled)\" : \"var(--subtle-text)\";\n return (\n <div\n className=\"bg-disabled-bg flex items-center justify-center overflow-clip px-[8px] py-[4px] rounded-[4px] shrink-0\"\n style={\n maxWidth !== undefined\n ? { maxWidth, flexShrink: 1 }\n : undefined\n }\n >\n <p\n className=\"leading-[16px] not-italic text-[12px] whitespace-nowrap overflow-hidden text-ellipsis\"\n style={{ color: textColor }}\n >\n {label}\n </p>\n </div>\n );\n}\n\n// ── Overflow count badge ────────────────────────────────────────────────────\nfunction OverflowBadge({\n count,\n disabled,\n}: {\n count: number;\n disabled?: boolean;\n}) {\n const bg = disabled ? \"bg-surface-chip-disabled\" : \"bg-selected-bg\";\n const textColor = disabled ? \"var(--disabled)\" : \"var(--primary-action)\";\n return (\n <div\n className={cn(\n bg,\n \"flex items-center justify-center overflow-clip px-[8px] py-[4px] rounded-[4px] shrink-0\",\n )}\n >\n <p\n className=\"leading-[16px] not-italic text-[12px] whitespace-nowrap\"\n style={{ color: textColor }}\n >\n +{count}\n </p>\n </div>\n );\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// Hook: measure how many tags fit within the available width\n// ════════════════════════════════════════════════════════════════════════════\ninterface ChipLayout {\n visibleCount: number;\n lastTagMaxWidth: number | undefined;\n}\n\nfunction useChipLayout(\n selectedOptions: DropdownMultipleOption[],\n measureRef: React.RefObject<HTMLDivElement | null>,\n containerRef: React.RefObject<HTMLDivElement | null>,\n): ChipLayout {\n const [layout, setLayout] = useState<ChipLayout>({\n visibleCount: selectedOptions.length,\n lastTagMaxWidth: undefined,\n });\n\n useLayoutEffect(() => {\n const calculate = () => {\n const total = selectedOptions.length;\n\n if (!measureRef.current || total === 0) {\n setLayout({\n visibleCount: total,\n lastTagMaxWidth: undefined,\n });\n return;\n }\n\n const tagEls = Array.from(\n measureRef.current.children,\n ) as HTMLElement[];\n\n const containerWidth =\n containerRef.current?.offsetWidth ??\n MAX_COMPONENT_WIDTH;\n\n const RIGHT_SECTION_WIDTH = 60;\n\n const budget =\n containerWidth * 0.72 - RIGHT_SECTION_WIDTH;\n\n let used = 0;\n let count = 0;\n\n for (let i = 0; i < tagEls.length; i++) {\n const w = tagEls[i].offsetWidth;\n const gap = count > 0 ? TAG_GAP : 0;\n const nextUsed = used + gap + w;\n\n if (nextUsed <= budget) {\n used = nextUsed;\n count++;\n } else {\n count++;\n break;\n }\n }\n\n count = Math.max(1, count);\n\n const overflowCount = total - count;\n\n const isFullWidth = used >= budget * 0.98;\n let lastTagMaxWidth: number | undefined;\n\n if (overflowCount > 0 || isFullWidth) {\n const prevTagsWidth = tagEls\n .slice(0, count - 1)\n .reduce(\n (sum, el, i) =>\n sum + el.offsetWidth + (i > 0 ? TAG_GAP : 0),\n 0,\n );\n\n const gapBeforeLast = count > 1 ? TAG_GAP : 0;\n\n const remaining =\n budget - prevTagsWidth - gapBeforeLast;\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const lastNaturalW =\n tagEls[count - 1]?.offsetWidth ?? 0;\n\n if (remaining > 0) {\n lastTagMaxWidth = remaining;\n }\n }\n\n setLayout({ visibleCount: count, lastTagMaxWidth });\n };\n\n calculate();\n document.fonts?.ready?.then(calculate);\n }, [selectedOptions, measureRef, containerRef]);\n\n return layout;\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// Main component\n// ════════════════════════════════════════════════════════════════════════════\nexport const DropdownMultiple = forwardRef<HTMLDivElement, DropdownMultipleProps>(\n function DropdownMultiple(\n {\n placeholder = \"Placeholder\",\n label,\n required = false,\n forceState,\n errorMessage = \"Error message\",\n helperText,\n value,\n onChange,\n options = [],\n className = \"\",\n },\n ref,\n ) {\n const [open, setOpen] = useState(false);\n const [internalValue, setInternalValue] = useState<string[]>([]);\n const [search, setSearch] = useState(\"\");\n const containerRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const measureRef = useRef<HTMLDivElement>(null);\n\n React.useImperativeHandle(ref, () => containerRef.current as HTMLDivElement);\n\n const controlled = value !== undefined;\n const currentValue = controlled ? value : internalValue;\n const isDisabled = forceState === \"disabled\";\n const isStatic = Boolean(forceState);\n const isFilled = currentValue.length > 0;\n\n const state: DropdownMultipleState =\n forceState ?? (open ? \"focus\" : \"default\");\n const isError = state === \"error\";\n const isFocus = state === \"focus\";\n\n // ── Colours ─────────────────────────────────────────────────────────────\n const bg = isDisabled ? \"bg-disabled-bg\" : \"bg-background\";\n const labelColor = isDisabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n const caretColor = isDisabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n\n // ── Border overlay ──────────────────────────────────────────────────────\n const borderInset = isFocus || isError ? \"-1px\" : \"0px\";\n const borderRad = isFocus || isError ? \"9px\" : \"8px\";\n const borderColor = isDisabled\n ? \"var(--border-disabled)\"\n : isError\n ? \"var(--destructive)\"\n : isFocus\n ? \"var(--primary-action)\"\n : \"var(--border)\";\n\n const showBelow = isError || Boolean(helperText);\n const leftText = isError ? errorMessage : (helperText ?? \"\");\n const leftColor = isError ? \"var(--destructive)\" : \"var(--muted-foreground)\";\n\n // ── Selected options ────────────────────────────────────────────────────\n const selectedOptions = useMemo(\n () =>\n currentValue\n .map((v) => options.find((o) => o.value === v))\n .filter(Boolean) as DropdownMultipleOption[],\n [currentValue, options],\n );\n\n // ── Dynamic visible count ───────────────────────────────────────────────\n const { visibleCount, lastTagMaxWidth } = useChipLayout(\n selectedOptions,\n measureRef,\n containerRef,\n );\n\n const visibleTags = selectedOptions.slice(0, visibleCount);\n const overflowCount = Math.max(\n 0,\n selectedOptions.length - visibleCount,\n );\n\n // ── Filtered options ────────────────────────────────────────────────────\n const filteredOptions = useMemo(() => {\n if (!search.trim()) return options;\n const q = search.trim().toLowerCase();\n return options.filter((o) =>\n o.label.toLowerCase().includes(q),\n );\n }, [search, options]);\n\n useEffect(() => {\n if (open && inputRef.current) inputRef.current.focus();\n }, [open]);\n\n useEffect(() => {\n if (!open) setSearch(\"\");\n }, [open]);\n\n useEffect(() => {\n if (!open) return;\n const handler = (e: MouseEvent) => {\n if (\n containerRef.current &&\n !containerRef.current.contains(e.target as Node)\n ) {\n setOpen(false);\n }\n };\n document.addEventListener(\"mousedown\", handler);\n return () =>\n document.removeEventListener(\"mousedown\", handler);\n }, [open]);\n\n const updateValue = useCallback(\n (next: string[]) => {\n if (!controlled) setInternalValue(next);\n onChange?.(next);\n },\n [controlled, onChange],\n );\n\n const handleToggleOption = useCallback(\n (val: string) => {\n const next = currentValue.includes(val)\n ? currentValue.filter((v) => v !== val)\n : [...currentValue, val];\n updateValue(next);\n },\n [currentValue, updateValue],\n );\n\n const handleRemoveTag = useCallback(\n (val: string) => {\n updateValue(currentValue.filter((v) => v !== val));\n },\n [currentValue, updateValue],\n );\n\n const handleTriggerClick = () => {\n if (isDisabled || isStatic) return;\n if (!open) setOpen(true);\n inputRef.current?.focus();\n };\n\n const handleInputKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === \"Escape\") setOpen(false);\n if (\n e.key === \"Backspace\" &&\n search === \"\" &&\n currentValue.length > 0\n ) {\n updateValue(currentValue.slice(0, -1));\n }\n };\n\n // ── Floating label ──────────────────────────────────────────────────────\n const FloatingLabel = () =>\n required ? (\n <div className=\"flex gap-[2px] items-center shrink-0 w-full\">\n <p\n className=\"shrink-0 leading-4 not-italic text-xs\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n <p\n className=\"leading-[1.5] not-italic text-[9px] w-[7px]\"\n style={{\n color: isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\",\n }}\n >\n *\n </p>\n </div>\n ) : (\n <p\n className=\"shrink-0 w-full leading-4 not-italic text-xs\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n );\n\n // ── Placeholder (empty state) ───────────────────────────────────────────\n const Placeholder = () =>\n required ? (\n <div className=\"flex flex-1 min-w-0 min-h-[1px] gap-[2px] items-center\">\n <p\n className=\"leading-5 not-italic text-base whitespace-nowrap\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n <p\n className=\"leading-4 not-italic text-xs w-[7px]\"\n style={{ color: isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\" }}\n >\n *\n </p>\n </div>\n ) : (\n <p\n className=\"flex-1 min-w-0 min-h-[1px] text-base leading-5 not-italic overflow-hidden text-ellipsis whitespace-nowrap py-[7px]\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n );\n\n // ── Hidden measurement layer ────────────────────────────────────────────\n const MeasurementLayer = () => (\n <div\n ref={measureRef}\n aria-hidden\n className=\"absolute flex gap-1 items-center pointer-events-none\"\n style={{\n visibility: \"hidden\",\n top: 0,\n left: 0,\n height: 0,\n overflow: \"hidden\",\n }}\n >\n {selectedOptions.map((opt) =>\n isStatic ? (\n <StaticTag\n key={opt.value}\n label={opt.label}\n disabled={isDisabled}\n />\n ) : (\n <RemovableTag\n key={opt.value}\n label={opt.label}\n disabled={isDisabled}\n />\n ),\n )}\n </div>\n );\n\n // ── Render: trigger content ─────────────────────────────────────────────\n const renderTriggerContent = () => {\n const hasExternalLabel = Boolean(label);\n\n // ─── STATIC SHOWCASE ───\n if (isStatic) {\n if (isFilled) {\n return (\n <div className=\"flex flex-col items-start flex-1 min-w-0 min-h-[1px] relative\">\n <MeasurementLayer />{\" \"}\n {!hasExternalLabel && <FloatingLabel />}\n <div\n className=\"flex gap-[4px] items-center shrink-0 overflow-hidden\"\n style={{ maxWidth: \"100%\" }}\n >\n {visibleTags.map((opt, i) => (\n <StaticTag\n key={opt.value}\n label={opt.label}\n disabled={isDisabled}\n maxWidth={\n i === visibleTags.length - 1\n ? lastTagMaxWidth\n : undefined\n }\n />\n ))}\n </div>\n </div>\n );\n }\n if (!isFilled) {\n return <Placeholder />;\n }\n\n return null;\n }\n\n // ─── INTERACTIVE FILLED ───\n if (isFilled) {\n return (\n <div className=\"flex flex-col items-start flex-1 min-w-0 min-h-[1px] relative\">\n <MeasurementLayer />\n {!hasExternalLabel && <FloatingLabel />}\n <div\n className=\"flex gap-[4px] items-center overflow-hidden\"\n style={{ maxWidth: \"100%\" }}\n >\n {visibleTags.map((opt, i) => (\n <RemovableTag\n key={opt.value}\n label={opt.label}\n onRemove={() => handleRemoveTag(opt.value)}\n maxWidth={\n i === visibleTags.length - 1\n ? lastTagMaxWidth\n : undefined\n }\n />\n ))}\n\n {open && (\n <input\n ref={inputRef}\n type=\"text\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n onKeyDown={handleInputKeyDown}\n className=\"flex-1 min-w-[40px] outline-none border-none bg-transparent text-[14px] leading-[20px]\"\n style={{\n color: \"var(--foreground)\",\n caretColor: \"var(--caret-color)\",\n }}\n onClick={(e) => e.stopPropagation()}\n />\n )}\n </div>\n </div>\n );\n }\n\n // ─── EMPTY OPEN ───\n if (open) {\n return (\n <input\n ref={inputRef}\n type=\"text\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n onKeyDown={handleInputKeyDown}\n className=\"flex-1 min-w-[40px] outline-none border-none bg-transparent text-[14px] leading-[20px]\"\n style={{\n color: \"var(--foreground)\",\n caretColor: \"var(--caret-color)\",\n }}\n onClick={(e) => e.stopPropagation()}\n />\n );\n }\n\n // ─── EMPTY CLOSED ───\n if (!isFilled) {\n return <Placeholder />;\n }\n\n return null;\n };\n\n const hasExternalLabel = Boolean(label);\n\n return (\n <div\n ref={containerRef}\n className={cn(\"flex flex-col gap-[4px] w-full max-w-[343px]\", className)}\n >\n {label && (\n <div className=\"relative shrink-0 w-full\">\n <div className=\"flex items-start px-[4px] w-full\">\n <p\n className=\"leading-[20px] not-italic relative shrink-0 text-foreground text-[14px] whitespace-nowrap\"\n style={{ fontWeight: 700 }}\n >\n {label}\n </p>\n </div>\n </div>\n )}\n\n <div\n onClick={handleTriggerClick}\n className={cn(\n \"relative flex gap-[8px] items-center rounded-[8px]\",\n bg,\n \"px-3.5\",\n hasExternalLabel ? \"h-10\" : \"py-1 min-h-12\",\n !isDisabled && !isStatic && \"cursor-pointer\",\n )}\n >\n <div\n aria-hidden=\"true\"\n className=\"absolute pointer-events-none border border-solid\"\n style={{\n inset: borderInset,\n borderRadius: borderRad,\n borderColor,\n }}\n />\n {renderTriggerContent()}\n\n {isFilled && overflowCount > 0 && (\n <div\n className={hasExternalLabel ? \"self-center\" : \"self-end\"}\n >\n <OverflowBadge\n count={overflowCount}\n disabled={isDisabled}\n />\n </div>\n )}\n\n <span className=\"shrink-0\" style={{ color: caretColor }}>\n {isFocus ? <CaretUp size={22} /> : <CaretDown size={22} />}\n </span>\n </div>\n\n {open && !isStatic && options.length > 0 && (\n <div\n className=\"relative bg-popover rounded-[8px] overflow-clip p-[8px] z-20 flex flex-col items-start text-popover-foreground\"\n style={{\n boxShadow: \"var(--elevation-popover)\",\n }}\n >\n <div\n className={cn(\n \"w-full flex flex-col\",\n filteredOptions.length > 10 && \"overflow-y-auto\",\n )}\n style={\n filteredOptions.length > 10\n ? { maxHeight: 10 * 48 }\n : undefined\n }\n >\n {filteredOptions.length > 0 ? (\n filteredOptions.map((opt) => {\n const isSelected = currentValue.includes(opt.value);\n return (\n <div\n key={opt.value}\n onClick={(e) => {\n e.stopPropagation();\n handleToggleOption(opt.value);\n inputRef.current?.focus();\n }}\n className={cn(\n \"w-full shrink-0 rounded-[4px] cursor-pointer transition-colors duration-100\",\n isSelected\n ? \"bg-primary-action-light\"\n : \"bg-popover hover:bg-disabled-bg\",\n )}\n >\n <div className=\"flex flex-row items-center size-full\">\n <div className=\"flex items-center gap-[8px] p-[14px] relative w-full\">\n <p\n className={cn(\n \"flex-1 min-w-0 min-h-[1px] leading-[20px] not-italic overflow-hidden text-[14px] text-ellipsis whitespace-nowrap\",\n isSelected\n ? \"text-primary-action\"\n : \"text-foreground\",\n )}\n >\n {opt.label}\n </p>\n <div\n className={cn(\n \"shrink-0 w-[16px] h-[16px] rounded-[3px] flex items-center justify-center transition-colors duration-100\",\n \"bg-transparent\",\n )}\n >\n {isSelected && (\n <Check\n size={12}\n weight=\"bold\"\n className=\"text-primary-action\"\n />\n )}\n </div>\n </div>\n </div>\n </div>\n );\n })\n ) : (\n <div className=\"w-full shrink-0 bg-popover\">\n <div className=\"flex flex-row items-center size-full\">\n <div className=\"flex items-center p-[14px] relative w-full\">\n <p className=\"flex-1 min-w-0 min-h-[1px] leading-[20px] not-italic text-[14px] text-disabled\">\n No results found\n </p>\n </div>\n </div>\n </div>\n )}\n </div>\n </div>\n )}\n\n {showBelow && (\n <div className=\"flex items-start px-[4px] text-[12px] leading-[16px]\">\n <span\n className=\"flex-1 min-w-0\"\n style={{ color: leftColor }}\n >\n {leftText}\n </span>\n </div>\n )}\n </div>\n );\n },\n);\n\nDropdownMultiple.displayName = \"DropdownMultiple\";\n","\"use client\";\n\nimport React, { forwardRef, useState } from \"react\";\nimport { cn } from \"../lib/utils\";\n\nexport type InputState = \"default\" | \"focus\" | \"error\" | \"disabled\";\n\nexport interface InputProps\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"onChange\" | \"value\"> {\n /** Override the visual state of the input. Useful for form validation. */\n forceState?: InputState;\n /** Error message displayed below the input when forceState is \"error\". Default: \"Error message\". */\n errorMessage?: string;\n value?: string;\n /** Called with the new string value on every change. */\n onChange?: (value: string) => void;\n /** Icon element rendered on the right side of the input. */\n rightIcon?: React.ReactNode;\n /** Unit label on the right side, e.g. \"kg\" or \"THB\". */\n unit?: string;\n /** Helper text displayed below the input in the default state. */\n helperText?: string;\n /** Show a character count (charCount / maxCount) below the input. */\n showCount?: boolean;\n /** Maximum character count enforced when showCount is true. Default: 100. */\n maxCount?: number;\n}\n\nexport const Input = forwardRef<HTMLDivElement, InputProps>(function Input(\n {\n placeholder = \"Text label\",\n required = false,\n forceState,\n errorMessage = \"Error message\",\n value,\n onChange,\n rightIcon,\n unit,\n helperText,\n showCount = false,\n maxCount = 100,\n className = \"\",\n type = \"text\",\n style: inputStyleProp,\n onFocus: onFocusProp,\n onBlur: onBlurProp,\n disabled: _disabledProp,\n maxLength: maxLengthProp,\n ...inputRest\n },\n ref,\n) {\n const [focused, setFocused] = useState(false);\n const [internalValue, setInternalValue] = useState(\"\");\n\n const controlled = value !== undefined;\n const currentValue = controlled ? value : internalValue;\n const isDisabled = forceState === \"disabled\";\n\n const state: InputState = forceState ?? (focused ? \"focus\" : \"default\");\n const isError = state === \"error\";\n const isFocus = state === \"focus\";\n const isFilled = currentValue.length > 0;\n\n const bg = isDisabled ? \"bg-disabled-bg\" : \"bg-background\";\n const floatLabel = isDisabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n const filledValue = isDisabled ? \"var(--disabled)\" : \"var(--foreground)\";\n const unitColor = isDisabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n\n const borderInset = isFocus || isError ? \"-1px\" : \"0px\";\n const borderRad = isFocus || isError ? \"9px\" : \"8px\";\n const borderColor = isDisabled\n ? \"var(--border-disabled)\"\n : isError\n ? \"var(--destructive)\"\n : isFocus\n ? \"var(--primary-action)\"\n : \"var(--border)\";\n\n const hasRight = Boolean(rightIcon) || Boolean(unit);\n const padding = isFilled\n ? \"px-[14px] py-[6px]\"\n : hasRight\n ? \"px-[14px] py-[14px]\"\n : \"p-[14px]\";\n\n const charCount = currentValue.length;\n const showBelow = isError || Boolean(helperText) || showCount;\n const leftText = isError ? errorMessage : (helperText ?? \"\");\n const leftColor = isError ? \"var(--destructive)\" : \"var(--muted-foreground)\";\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (isDisabled) return;\n let next = e.target.value;\n if (showCount && maxCount >= 0 && next.length > maxCount) {\n next = next.slice(0, maxCount);\n }\n if (!controlled) setInternalValue(next);\n onChange?.(next);\n };\n\n const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n onFocusProp?.(e);\n setFocused(true);\n };\n\n const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n onBlurProp?.(e);\n setFocused(false);\n };\n\n const containerFlex = isFilled\n ? !hasRight\n ? \"flex-col items-start justify-center\"\n : rightIcon\n ? \"flex items-center gap-[8px]\"\n : \"flex items-end gap-[8px]\"\n : cn(\"flex items-center\", hasRight && \"gap-[8px]\");\n\n const inputCaretStyle: React.CSSProperties = {\n caretColor: \"var(--caret-color)\",\n };\n\n return (\n <div ref={ref} className={cn(\"flex flex-col gap-1 w-full\", className)}>\n <div\n className={cn(\n \"relative rounded-lg\",\n padding,\n bg,\n containerFlex,\n )}\n >\n <div\n aria-hidden=\"true\"\n className=\"absolute pointer-events-none border border-solid\"\n style={{\n inset: borderInset,\n borderRadius: borderRad,\n borderColor,\n }}\n />\n\n <div\n className={cn(\n \"flex flex-col min-w-0 min-h-[1px]\",\n hasRight ? \"flex-1 justify-center\" : \"w-full justify-center\",\n )}\n >\n <p\n className={cn(\n \"shrink-0 w-full not-italic\",\n isFilled\n ? \"leading-4 text-xs\"\n : \"text-base leading-5 pointer-events-none\",\n )}\n style={{ color: floatLabel }}\n >\n {placeholder}\n {required && (\n <span\n className=\"text-xs leading-4\"\n style={{\n color: isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\",\n }}\n >\n {\" *\"}\n </span>\n )}\n </p>\n <input\n {...inputRest}\n type={type}\n value={currentValue}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n disabled={isDisabled}\n maxLength={showCount ? maxCount : maxLengthProp}\n aria-label={placeholder}\n className={cn(\n \"w-full bg-transparent outline-none border-none min-w-0\",\n isFilled\n ? \"leading-5 not-italic text-sm p-0 m-0\"\n : cn(\n \"absolute inset-0 h-full text-base\",\n isDisabled ? \"cursor-not-allowed\" : \"cursor-text\",\n ),\n )}\n style={\n isFilled\n ? { ...inputStyleProp, color: filledValue, ...inputCaretStyle }\n : {\n ...inputStyleProp,\n color: \"transparent\",\n caretColor: isFocus ? \"var(--caret-color)\" : \"transparent\",\n padding: hasRight ? \"12px 14px\" : \"14px\",\n }\n }\n />\n </div>\n\n {rightIcon && (\n <div\n className={cn(\n \"shrink-0 flex items-center\",\n isFilled && \"self-stretch\",\n !isFilled && \"relative\",\n )}\n >\n <span className=\"flex items-center justify-center size-[24px] overflow-hidden\">\n {rightIcon}\n </span>\n </div>\n )}\n {unit && !rightIcon && (\n <p\n className={cn(\n \"shrink-0 whitespace-nowrap text-[16px] leading-[20px]\",\n !isFilled && \"relative\",\n )}\n style={{\n color: unitColor,\n lineHeight: \"1.5\",\n fontVariationSettings: \"'wdth' 100\",\n }}\n >\n {unit}\n </p>\n )}\n </div>\n {showBelow && (\n <div className=\"flex items-start gap-2 px-1 text-xs leading-4\">\n {leftText ? (\n <span className=\"flex-1 min-w-0\" style={{ color: leftColor }}>\n {leftText}\n </span>\n ) : (\n showCount && <span className=\"flex-1\" />\n )}\n {showCount && (\n <span\n className=\"shrink-0 text-right whitespace-nowrap\"\n style={{ color: \"var(--muted-foreground)\" }}\n >\n {charCount}/{maxCount}\n </span>\n )}\n </div>\n )}\n </div>\n );\n});\n\nInput.displayName = \"Input\";\n","\"use client\";\n\nimport React, { forwardRef } from \"react\";\nimport { Check } from \"@phosphor-icons/react\";\nimport { cn } from \"../lib/utils\";\n\nexport interface OptionItem {\n /** Display label for the option. */\n label: string;\n /** Unique value identifier for the option. */\n value: string;\n /** Optional icon element shown before the label. */\n icon?: React.ReactNode;\n disabled?: boolean;\n}\n\nexport interface OptionListProps {\n /** Array of selectable options. */\n options: OptionItem[];\n /** Currently selected value in single-select mode. */\n selectedValue?: string;\n /** Currently selected values in multi-select mode. */\n selectedValues?: string[];\n /** Called with the selected value in single-select mode. */\n onSelect?: (value: string) => void;\n /** Called with the toggled value in multi-select mode. */\n onToggle?: (value: string) => void;\n /** Max number of items visible before the list scrolls. Default: 10. */\n maxVisible?: number;\n /** Text displayed when the options array is empty. Default: \"No results found\". */\n emptyText?: string;\n className?: string;\n}\n\nexport const OptionList = forwardRef<HTMLDivElement, OptionListProps>(\n function OptionList(\n {\n options,\n selectedValue,\n selectedValues,\n onSelect,\n onToggle,\n maxVisible = 10,\n emptyText = \"No results found\",\n className,\n },\n ref\n ) {\n const isMulti =\n selectedValues !== undefined || onToggle !== undefined;\n const isScrollable = options.length > maxVisible;\n const maxHeight = isScrollable ? maxVisible * 48 + 16 : undefined;\n const isSelected = (val: string) =>\n isMulti\n ? (selectedValues ?? []).includes(val)\n : val === selectedValue;\n const handleClick = (opt: OptionItem) => {\n if (opt.disabled) return;\n if (isMulti) {\n onToggle?.(opt.value);\n } else {\n onSelect?.(opt.value);\n }\n };\n\n return (\n <div\n ref={ref}\n className={cn(\n \"flex flex-col items-start overflow-clip rounded-lg bg-popover px-2 py-2 text-popover-foreground\",\n className\n )}\n style={{\n boxShadow: \"var(--elevation-popover)\",\n ...(isScrollable\n ? { maxHeight, overflowY: \"auto\" as const }\n : {}),\n }}\n >\n {options.length > 0 ? (\n options.map((opt) => {\n const selected = isSelected(opt.value);\n const disabled = opt.disabled === true;\n const rowBg = disabled\n ? \"bg-disabled-bg\"\n : selected\n ? \"bg-selected-bg\"\n : \"bg-popover hover:bg-selected-bg\";\n return (\n <div\n key={opt.value}\n onClick={() => handleClick(opt)}\n className={cn(\n \"w-full shrink-0 rounded-[4px] transition-colors duration-100\",\n rowBg,\n disabled ? \"cursor-default\" : \"cursor-pointer\"\n )}\n >\n <div className=\"flex w-full items-center gap-2 p-3.5\">\n {opt.icon && (\n <span\n className=\"flex h-5 w-5 shrink-0 items-center justify-center overflow-clip\"\n style={{\n color: disabled\n ? \"var(--disabled)\"\n : \"var(--muted-foreground)\",\n }}\n >\n {opt.icon}\n </span>\n )}\n <p\n className=\"min-h-[1px] min-w-0 flex-1 overflow-hidden text-sm leading-5 text-ellipsis whitespace-nowrap not-italic\"\n style={{\n color: disabled\n ? \"var(--disabled)\"\n : \"var(--foreground)\",\n }}\n >\n {opt.label}\n </p>\n {selected && (\n <span className=\"flex h-5 w-5 shrink-0 items-center justify-center\">\n <Check\n size={16}\n weight=\"bold\"\n className=\"text-primary-action\"\n />\n </span>\n )}\n </div>\n </div>\n );\n })\n ) : (\n <div className=\"w-full shrink-0 bg-popover\">\n <div className=\"flex w-full items-center p-3.5\">\n <p className=\"min-h-[1px] min-w-0 flex-1 text-sm leading-5 not-italic text-disabled\">\n {emptyText}\n </p>\n </div>\n </div>\n )}\n </div>\n );\n }\n);\n\nOptionList.displayName = \"OptionList\";\n","\"use client\";\n\nimport { MagnifyingGlass, X } from \"@phosphor-icons/react\";\nimport { forwardRef, useRef, useState } from \"react\";\nimport { cn } from \"../lib/utils\";\n\nexport type SearchInputSize = \"lg\" | \"sm\";\n\nexport interface SearchInputProps {\n /** Placeholder text shown when the input is empty. Default: \"Placeholder\". */\n placeholder?: string;\n value?: string;\n /** Called with the new search string on every keystroke. */\n onChange?: (value: string) => void;\n /** Visual size of the search input. Default: \"lg\". */\n size?: SearchInputSize;\n className?: string;\n /** Called when the user clicks the clear (×) button. */\n onClear?: () => void;\n}\n\nexport const SearchInput = forwardRef<HTMLDivElement, SearchInputProps>(\n function SearchInput(\n {\n placeholder = \"Placeholder\",\n value,\n onChange,\n size = \"lg\",\n className,\n onClear,\n },\n ref\n ) {\n const [focused, setFocused] = useState(false);\n const [internalValue, setInternalValue] = useState(\"\");\n const inputRef = useRef<HTMLInputElement>(null);\n const controlled = value !== undefined;\n const currentValue = controlled ? value : internalValue;\n const isFilled = currentValue.length > 0;\n const iconSize = size === \"lg\" ? 24 : 22;\n const minHeight = size === \"sm\" ? \"h-[38px]\" : \"\";\n const padding =\n size === \"sm\" ? \"px-3.5 py-2\" : \"px-3.5 py-3\";\n const borderInset = focused ? \"-1px\" : \"0px\";\n const borderRad = focused ? \"9px\" : \"8px\";\n const borderColor = focused\n ? \"var(--primary-action)\"\n : \"var(--border)\";\n const handleChange = (next: string) => {\n if (!controlled) setInternalValue(next);\n onChange?.(next);\n };\n const handleClear = () => {\n if (!controlled) setInternalValue(\"\");\n onChange?.(\"\");\n onClear?.();\n inputRef.current?.focus();\n };\n\n return (\n <div\n ref={ref}\n className={cn(\n \"relative flex cursor-text items-center gap-2 rounded-lg bg-background\",\n padding,\n minHeight,\n className\n )}\n onClick={() => inputRef.current?.focus()}\n >\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute border border-solid\"\n style={{\n inset: borderInset,\n borderRadius: borderRad,\n borderColor,\n }}\n />\n <span className=\"flex shrink-0 items-center justify-center\">\n <MagnifyingGlass\n size={iconSize}\n color={\n focused ? \"var(--subtle-text)\" : \"var(--muted-foreground)\"\n }\n weight=\"regular\"\n />\n </span>\n <div className=\"relative min-w-0 flex-1\">\n {!isFilled && (\n <p\n className=\"pointer-events-none absolute inset-0 flex items-center text-base leading-5 not-italic\"\n style={{ color: \"var(--muted-foreground)\" }}\n >\n {placeholder}\n </p>\n )}\n <input\n ref={inputRef}\n type=\"text\"\n aria-label={placeholder}\n value={currentValue}\n onChange={(e) => handleChange(e.target.value)}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n className=\"m-0 w-full border-none bg-transparent p-0 text-base leading-5 outline-none\"\n style={{\n color: isFilled ? \"var(--foreground)\" : \"transparent\",\n caretColor: \"var(--caret-color)\",\n }}\n />\n </div>\n {focused && isFilled && (\n <button\n type=\"button\"\n aria-label=\"Clear search\"\n onMouseDown={(e) => e.preventDefault()}\n onClick={handleClear}\n className=\"m-0 flex shrink-0 cursor-pointer items-center justify-center border-none bg-transparent p-0\"\n >\n <X\n size={iconSize}\n color=\"var(--muted-foreground)\"\n weight=\"regular\"\n />\n </button>\n )}\n </div>\n );\n }\n);\n\nSearchInput.displayName = \"SearchInput\";\n","\"use client\";\n\nimport { forwardRef, type ReactNode } from \"react\";\nimport { Circle } from \"@phosphor-icons/react\";\nimport { cn } from \"../lib/utils\";\n\nexport type TabSize = \"lg\" | \"md\" | \"sm\";\n\nexport interface TabItem {\n id: string;\n title: string;\n disabled?: boolean;\n icon?: ReactNode | boolean;\n notification?: string | number;\n}\n\nexport interface TabProps {\n /** Tab label text. Default: \"Tab\". */\n title?: string;\n /** Size of the tab. Default: \"md\". */\n size?: TabSize;\n /** Whether this tab is currently selected/active. */\n active?: boolean;\n /** Whether the tab is non-interactive. */\n disabled?: boolean;\n onClick?: () => void;\n className?: string;\n /** Icon rendered before the label. Pass `true` for a default placeholder icon. */\n icon?: ReactNode | boolean;\n /** Notification badge shown after the label (count or short text). */\n notification?: string | number;\n}\n\nconst sizeClasses: Record<\n TabSize,\n {\n pad: string;\n text: string;\n leading: string;\n font: string;\n gap: string;\n iconSize: string;\n badgeClass: string;\n }\n> = {\n lg: {\n pad: \"px-3 py-2.5\",\n text: \"text-sm\",\n leading: \"leading-5\",\n font: \"font-bold\",\n gap: \"gap-1.5\",\n iconSize: \"h-5 w-5\",\n badgeClass:\n \"min-w-[16px] h-[16px] px-[3px] text-[length:var(--text-xs)] leading-[var(--leading-4)]\",\n },\n md: {\n pad: \"px-2.5 py-2\",\n text: \"text-sm\",\n leading: \"leading-5\",\n font: \"font-bold\",\n gap: \"gap-1.5\",\n iconSize: \"h-[18px] w-[18px]\",\n badgeClass:\n \"min-w-[16px] h-[16px] px-[3px] text-[length:var(--text-xs)] leading-[var(--leading-4)]\",\n },\n sm: {\n pad: \"px-2 py-1.5\",\n text: \"text-xs\",\n leading: \"leading-4\",\n font: \"font-semibold\",\n gap: \"gap-1\",\n iconSize: \"h-4 w-4\",\n badgeClass:\n \"min-w-[14px] h-[14px] px-1 text-[length:var(--text-xxs)] leading-[var(--leading-3)]\",\n },\n};\n\nfunction DefaultTabIcon({ className }: { className?: string }) {\n return <Circle aria-hidden=\"true\" weight=\"regular\" className={cn(\"shrink-0\", className)} />;\n}\n\nexport const Tab = forwardRef<HTMLDivElement, TabProps>(function Tab(\n {\n title = \"Tab\",\n size = \"md\",\n active = false,\n disabled = false,\n onClick,\n className,\n icon,\n notification,\n },\n ref\n) {\n const s = sizeClasses[size] ?? sizeClasses.md;\n const hasIcon = Boolean(icon);\n const hasNotification = notification !== undefined && notification !== null;\n const renderedIcon = icon === true ? <DefaultTabIcon className={s.iconSize} /> : icon;\n const textColor = disabled\n ? \"text-disabled\"\n : active\n ? \"text-primary-action\"\n : \"text-muted-foreground\";\n const borderColor = disabled\n ? \"border-border-disabled\"\n : active\n ? \"border-primary-action\"\n : \"border-border\";\n const cursor = disabled ? \"cursor-not-allowed\" : \"cursor-pointer\";\n const hoverBg = !disabled && !active ? \"hover:bg-hover-bg\" : \"\";\n\n return (\n <div\n ref={ref}\n role=\"tab\"\n aria-selected={active}\n aria-disabled={disabled}\n onClick={!disabled ? onClick : undefined}\n className={cn(\n \"relative flex min-w-[80px] select-none items-center justify-center bg-background transition-colors duration-150\",\n s.pad,\n (hasIcon || hasNotification) && s.gap,\n cursor,\n hoverBg,\n className\n )}\n >\n <div\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 border-b-[1.5px] border-solid\",\n borderColor\n )}\n />\n {hasIcon && (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"relative shrink-0\",\n s.iconSize,\n disabled ? \"text-disabled\" : active ? \"text-primary-action\" : \"text-muted-foreground\"\n )}\n >\n {renderedIcon}\n </span>\n )}\n <span\n className={cn(\n \"relative overflow-hidden text-ellipsis whitespace-nowrap text-center\",\n hasIcon && hasNotification && \"flex-1 min-w-px\",\n s.text,\n s.leading,\n s.font,\n textColor\n )}\n >\n {title}\n </span>\n {hasNotification && (\n <span\n className={cn(\n \"relative flex shrink-0 items-center justify-center rounded-[60px] bg-visual-red-default text-center font-normal text-on-visual-red\",\n s.badgeClass\n )}\n >\n {notification}\n </span>\n )}\n </div>\n );\n});\n\nTab.displayName = \"Tab\";\n\nexport interface TabGroupProps {\n /** Array of tab definitions. Each item needs at minimum `id` and `title`. */\n items?: TabItem[];\n /** ID of the currently active tab. */\n activeId?: string;\n /** Size applied to all tabs in the group. Default: \"md\". */\n size?: TabSize;\n /** Called with the tab ID when a tab is clicked. */\n onChange?: (id: string) => void;\n className?: string;\n}\n\nexport const TabGroup = forwardRef<HTMLDivElement, TabGroupProps>(\n function TabGroup(\n { items = [], activeId, size = \"md\", onChange, className },\n ref\n ) {\n return (\n <div ref={ref} role=\"tablist\" className={cn(\"flex\", className)}>\n {items.map((item) => (\n <Tab\n key={item.id}\n title={item.title}\n size={size}\n active={item.id === activeId}\n disabled={item.disabled}\n icon={item.icon}\n notification={item.notification}\n onClick={() => onChange?.(item.id)}\n />\n ))}\n </div>\n );\n }\n);\n\nTabGroup.displayName = \"TabGroup\";\n","\"use client\";\n\nimport { forwardRef } from \"react\";\nimport { Circle, X } from \"@phosphor-icons/react\";\nimport { cn } from \"../lib/utils\";\n\nexport type TagSize = \"large\" | \"small\";\nexport type TagState = \"default\" | \"hover\" | \"disabled\";\nexport type TagVariant = \"blue\" | \"green\" | \"yellow\" | \"red\" | \"gray\" | \"lime\";\nexport type StatusTagType = \"stop\" | \"success\" | \"hold\" | \"processing\" | \"error\";\n\nexport interface TagProps {\n /** Label text displayed inside the tag. Default: \"Tag\". */\n text?: string;\n /** Size of the tag. Default: \"large\". */\n size?: TagSize;\n /** Visual state. Default: \"default\". */\n state?: TagState;\n /** Color variant. Use green=positive, red=danger, yellow=warning, gray=neutral. Default: \"gray\". */\n variant?: TagVariant;\n /** Show a small circle dot icon on the left side of the label. */\n icon?: boolean;\n /** Show a close/remove (×) button on the right side. */\n close?: boolean;\n className?: string;\n}\n\nconst sizeStyles: Record<\n TagSize,\n {\n container: string;\n text: string;\n closeIcon: string;\n closeButton: string;\n }\n> = {\n large: {\n container: \"px-2 py-1\",\n text: \"text-xs leading-4\",\n closeIcon: \"h-4 w-4\",\n closeButton: \"h-4 w-4\",\n },\n small: {\n container: \"px-1 py-0.5\",\n text: \"text-[9px] leading-3\",\n closeIcon: \"h-3.5 w-3.5\",\n closeButton: \"h-3.5 w-3.5\",\n },\n};\n\nconst variantStyles: Record<\n TagVariant,\n {\n bg: string;\n text: string;\n }\n> = {\n blue: {\n bg: \"bg-[var(--fill-blue-50)]\",\n text: \"text-[var(--fill-blue-700)]\",\n },\n green: {\n bg: \"bg-[var(--fill-green-100)]\",\n text: \"text-[var(--fill-green-600)]\",\n },\n yellow: {\n bg: \"bg-[var(--fill-yellow-100)]\",\n text: \"text-[var(--fill-yellow-600)]\",\n },\n red: {\n bg: \"bg-[var(--fill-red-100)]\",\n text: \"text-[var(--fill-red-600)]\",\n },\n gray: {\n bg: \"bg-[var(--fill-gray-100)]\",\n text: \"text-subtle-text\",\n },\n lime: {\n bg: \"bg-[var(--fill-lime-100)]\",\n text: \"text-[var(--fill-lime-600)]\",\n },\n};\n\nfunction CircleIcon({ disabled }: { disabled: boolean }) {\n return (\n <Circle\n aria-hidden=\"true\"\n weight=\"regular\"\n className=\"h-3.5 w-3.5 shrink-0\"\n color={disabled ? \"var(--disabled)\" : \"var(--subtle-text)\"}\n />\n );\n}\n\nfunction CloseIcon({ disabled, className }: { disabled: boolean; className?: string }) {\n return (\n <X\n aria-hidden=\"true\"\n weight=\"regular\"\n className={cn(\"shrink-0\", className)}\n color={disabled ? \"var(--disabled)\" : \"var(--subtle-text)\"}\n />\n );\n}\n\nexport const Tag = forwardRef<HTMLDivElement, TagProps>(function Tag(\n {\n text = \"Tag\",\n size = \"large\",\n state = \"default\",\n variant = \"gray\",\n icon = false,\n close = false,\n className,\n },\n ref\n) {\n const isDisabled = state === \"disabled\";\n const s = sizeStyles[size] ?? sizeStyles.large;\n const v = variantStyles[variant] ?? variantStyles.gray;\n const bgClass = state === \"disabled\" ? \"bg-disabled-bg\" : state === \"hover\" ? \"bg-hover-bg\" : v.bg;\n const textClass = isDisabled ? \"text-disabled\" : v.text;\n\n return (\n <div\n ref={ref}\n className={cn(\n \"inline-flex items-center justify-center rounded-[4px]\",\n (icon || close) && \"gap-[2px]\",\n s.container,\n bgClass,\n className\n )}\n >\n {icon && <CircleIcon disabled={isDisabled} />}\n <span className={cn(\"whitespace-nowrap font-normal\", s.text, textClass)}>\n {text}\n </span>\n {close && (\n <span\n className={cn(\n \"inline-flex items-center justify-center rounded-[2px] transition-colors\",\n s.closeButton,\n !isDisabled && \"cursor-pointer hover:bg-black/10\"\n )}\n >\n <CloseIcon disabled={isDisabled} className={s.closeIcon} />\n </span>\n )}\n </div>\n );\n});\n\nTag.displayName = \"Tag\";\n\nexport interface StatusTagProps {\n /** Process status type — drives the dot color and default label. Default: \"stop\". */\n type?: StatusTagType;\n /** Override the default label for the given type. */\n text?: string;\n className?: string;\n}\n\nconst statusTagStyles: Record<\n StatusTagType,\n {\n label: string;\n dot: string;\n }\n> = {\n stop: {\n label: \"Stop\",\n dot: \"var(--fill-gray-500)\",\n },\n success: {\n label: \"Success\",\n dot: \"var(--fill-emerald-500)\",\n },\n hold: {\n label: \"Hold\",\n dot: \"var(--fill-yellow-500)\",\n },\n processing: {\n label: \"Processing\",\n dot: \"var(--fill-blue-500)\",\n },\n error: {\n label: \"Error\",\n dot: \"var(--fill-rose-500)\",\n },\n};\n\nexport function StatusTag({ type = \"stop\", text, className }: StatusTagProps) {\n const style = statusTagStyles[type] ?? statusTagStyles.stop;\n\n return (\n <div\n className={cn(\n \"inline-flex items-center justify-center gap-1 rounded-[8px] px-2 py-1\",\n className\n )}\n >\n <Circle aria-hidden=\"true\" weight=\"fill\" className=\"size-[8px] shrink-0\" color={style.dot} />\n <span className=\"whitespace-nowrap text-[14px] leading-[20px] font-normal text-disabled\">\n {text ?? style.label}\n </span>\n </div>\n );\n}\n","\"use client\";\n\nimport React, { forwardRef, useState } from \"react\";\nimport { cn } from \"../lib/utils\";\n\nexport type TextAreaState = \"default\" | \"focus\" | \"error\" | \"disabled\";\n\nexport interface TextAreaProps\n extends Omit<\n React.TextareaHTMLAttributes<HTMLTextAreaElement>,\n \"onChange\" | \"value\" | \"rows\"\n > {\n /** Override the visual state of the textarea. Useful for form validation. */\n forceState?: TextAreaState;\n /** Error message displayed below when forceState is \"error\". Default: \"Error message\". */\n errorMessage?: string;\n value?: string;\n /** Called with the new string value on every change. */\n onChange?: (value: string) => void;\n /** Helper text shown below the textarea in the default state. */\n helperText?: string;\n /** Show a character count (charCount / maxCount) below the textarea. */\n showCount?: boolean;\n /** Maximum character count enforced when showCount is true. Default: 100. */\n maxCount?: number;\n /** Number of visible text rows. Default: 4. */\n rows?: number;\n}\n\nexport const TextArea = forwardRef<HTMLDivElement, TextAreaProps>(\n function TextArea(\n {\n placeholder = \"Text label\",\n required = false,\n forceState,\n errorMessage = \"Error message\",\n value,\n onChange,\n helperText,\n showCount = false,\n maxCount = 100,\n rows = 4,\n className,\n ...textareaProps\n },\n ref,\n ) {\n const [focused, setFocused] = useState(false);\n const [internalValue, setInternalValue] = useState(\"\");\n\n const controlled = value !== undefined;\n const currentValue = controlled ? value : internalValue;\n const isDisabled = forceState === \"disabled\";\n\n const state: TextAreaState = forceState ?? (focused ? \"focus\" : \"default\");\n const isError = state === \"error\";\n const isFocus = state === \"focus\";\n const isFilled = currentValue.length > 0;\n\n const floatLabel = isDisabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n const filledValue = isDisabled ? \"var(--disabled)\" : \"var(--foreground)\";\n\n const borderInset = isFocus || isError ? \"-1px\" : \"0px\";\n const borderRad = isFocus || isError ? \"9px\" : \"8px\";\n const borderColor = isDisabled\n ? \"var(--border-disabled)\"\n : isError\n ? \"var(--destructive)\"\n : isFocus\n ? \"var(--primary-action)\"\n : \"var(--border)\";\n\n const charCount = currentValue.length;\n const showBelow = isError || Boolean(helperText) || showCount;\n const leftText = isError ? errorMessage : (helperText ?? \"\");\n const leftColor = isError ? \"var(--destructive)\" : \"var(--muted-foreground)\";\n const countColor = isDisabled ? \"var(--disabled)\" : \"var(--muted-foreground)\";\n\n const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n let newValue = e.target.value;\n if (showCount && newValue.length > maxCount) {\n newValue = newValue.slice(0, maxCount);\n }\n if (!controlled) setInternalValue(newValue);\n onChange?.(newValue);\n };\n\n return (\n <div ref={ref} className={cn(\"flex w-full flex-col gap-1\", className)}>\n <div\n className={cn(\n \"relative h-[116px] rounded-lg\",\n isDisabled ? \"bg-disabled-bg\" : \"bg-background\",\n )}\n >\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute border border-solid\"\n style={{ inset: borderInset, borderRadius: borderRad, borderColor }}\n />\n {isFilled ? (\n <div className=\"flex h-full w-full flex-col px-3.5 pt-3.5 pb-1.5\">\n <p\n className=\"w-full shrink-0 text-xs leading-4 not-italic\"\n style={{ color: floatLabel }}\n >\n {placeholder}\n {required && (\n <span\n style={{\n color: isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\",\n }}\n >\n {\" \"}\n *\n </span>\n )}\n </p>\n <textarea\n {...textareaProps}\n value={currentValue}\n onChange={handleChange}\n onFocus={(e) => {\n textareaProps.onFocus?.(e);\n setFocused(true);\n }}\n onBlur={(e) => {\n textareaProps.onBlur?.(e);\n setFocused(false);\n }}\n disabled={isDisabled}\n rows={rows}\n aria-label={placeholder}\n className={cn(\n \"m-0 min-h-0 min-w-0 w-full flex-1 resize-none border-none bg-transparent p-0 text-sm leading-5 not-italic outline-none\",\n )}\n style={{\n ...textareaProps.style,\n color: filledValue,\n caretColor: \"var(--caret-color)\",\n }}\n />\n </div>\n ) : (\n <div className=\"relative flex size-full items-start p-3.5\">\n <p\n className=\"pointer-events-none relative h-full min-h-[1px] min-w-0 flex-1 text-base leading-5 not-italic\"\n style={{ color: floatLabel }}\n >\n {placeholder}\n {required && (\n <span\n style={{\n color: isDisabled ? \"var(--disabled)\" : \"var(--error-dark)\",\n }}\n >\n {\" \"}\n *\n </span>\n )}\n </p>\n {!isDisabled && (\n <textarea\n {...textareaProps}\n value={currentValue}\n onChange={handleChange}\n onFocus={(e) => {\n textareaProps.onFocus?.(e);\n setFocused(true);\n }}\n onBlur={(e) => {\n textareaProps.onBlur?.(e);\n setFocused(false);\n }}\n rows={rows}\n className={cn(\n \"absolute inset-0 h-full w-full cursor-text resize-none border-none bg-transparent text-base outline-none\",\n )}\n style={{\n ...textareaProps.style,\n color: \"transparent\",\n caretColor: isFocus ? \"var(--caret-color)\" : \"transparent\",\n padding: \"14px\",\n }}\n aria-label={placeholder}\n />\n )}\n </div>\n )}\n </div>\n {showBelow && (\n <div className=\"flex items-start gap-2 px-1 text-xs leading-4\">\n {leftText ? (\n <span className=\"min-w-0 flex-1\" style={{ color: leftColor }}>\n {leftText}\n </span>\n ) : (\n showCount && <span className=\"flex-1\" />\n )}\n {showCount && (\n <span\n className=\"shrink-0 whitespace-nowrap text-right\"\n style={{ color: countColor }}\n >\n {charCount}/{maxCount}\n </span>\n )}\n </div>\n )}\n </div>\n );\n },\n);\n\nTextArea.displayName = \"TextArea\";\n","\"use client\";\n\nimport { Clock, Minus } from \"@phosphor-icons/react\";\nimport * as Popover from \"@radix-ui/react-popover\";\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { cn } from \"../lib/utils\";\nimport { Button } from \"./button\";\nimport {\n Drawer,\n DrawerContent,\n DrawerTitle,\n DrawerTrigger,\n} from \"./ui/drawer\";\nimport { useIsMobile } from \"./ui/use-mobile\";\n\n// ─── Types ─────────────────────────────────────────────────────────────────────\nexport type TimeInputState =\n | \"default\"\n | \"focus\"\n | \"error\"\n | \"disabled\";\nexport type TimeInputMode = \"single\" | \"range\";\n\nexport interface TimeValue {\n hour: number; // 0–23\n minute: number; // 0–59\n}\n\nexport interface TimeInputProps {\n mode?: TimeInputMode;\n /** Floating label / placeholder text */\n placeholder?: string;\n /** Shows red asterisk */\n required?: boolean;\n /** Override visual state (for showcase) */\n forceState?: TimeInputState;\n /** Error message shown below in error state */\n errorMessage?: string;\n /** Helper text shown below */\n helperText?: string;\n /** Single mode value */\n value?: TimeValue;\n onChange?: (v: TimeValue) => void;\n /** Range mode values */\n startTime?: TimeValue;\n endTime?: TimeValue;\n onStartChange?: (v: TimeValue) => void;\n onEndChange?: (v: TimeValue) => void;\n className?: string;\n}\n\n// ─── Constants ─────────────────────────────────────────────────────────────────\nconst HOURS = Array.from({ length: 24 }, (_, i) => i);\nconst MINUTES = Array.from({ length: 60 }, (_, i) => i);\nconst ITEM_H = 40;\nconst DRUM_H = 248;\nconst SPACER = (DRUM_H - ITEM_H) / 2;\n\n// ─── Time Slot helpers (range mode) ───────────────────────────────────────────\nexport interface TimeSlot {\n start: TimeValue;\n end: TimeValue;\n label: string; // \"HH:MM - HH:MM\"\n}\n\n/** Generate 1-hour slots for the full day (00:00-01:00 … 23:00-00:00) */\nfunction generateHourlySlots(): TimeSlot[] {\n return Array.from({ length: 24 }, (_, i) => ({\n start: { hour: i, minute: 0 },\n end: { hour: (i + 1) % 24, minute: 0 },\n label: `${pad2(i)}:00 - ${pad2((i + 1) % 24)}:00`,\n }));\n}\n\nfunction slotMatches(\n slot: TimeSlot,\n start: TimeValue,\n end: TimeValue,\n) {\n return (\n slot.start.hour === start.hour &&\n slot.start.minute === start.minute &&\n slot.end.hour === end.hour &&\n slot.end.minute === end.minute\n );\n}\n\nfunction pad2(n: number) {\n return n.toString().padStart(2, \"0\");\n}\nfunction formatTime(v: TimeValue) {\n return `${pad2(v.hour)}:${pad2(v.minute)}`;\n}\n\n// ─── Scroll Drum Column ────────────────────────────────────────────────────────\nfunction ScrollColumn({\n items,\n value,\n onChange,\n}: {\n items: number[];\n value: number;\n onChange: (v: number) => void;\n}) {\n const containerRef = useRef<HTMLDivElement>(null);\n const debounceRef = useRef<\n ReturnType<typeof setTimeout> | undefined\n >(undefined);\n const [localValue, setLocalValue] = useState(value);\n const isUserScrolling = useRef(false);\n\n useEffect(() => {\n const el = containerRef.current;\n if (el) {\n el.scrollTop = items.indexOf(value) * ITEM_H;\n setLocalValue(value);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (isUserScrolling.current) return;\n const el = containerRef.current;\n if (el) {\n const idx = items.indexOf(value);\n if (idx >= 0) {\n el.scrollTo({ top: idx * ITEM_H, behavior: \"smooth\" });\n setLocalValue(value);\n }\n }\n }, [value, items]);\n\n const handleScroll = useCallback(() => {\n isUserScrolling.current = true;\n const el = containerRef.current;\n if (!el) return;\n\n const rawIdx = el.scrollTop / ITEM_H;\n const idx = Math.max(\n 0,\n Math.min(Math.round(rawIdx), items.length - 1),\n );\n setLocalValue(items[idx]);\n\n clearTimeout(debounceRef.current);\n debounceRef.current = setTimeout(() => {\n isUserScrolling.current = false;\n const finalIdx = Math.max(\n 0,\n Math.min(\n Math.round(el.scrollTop / ITEM_H),\n items.length - 1,\n ),\n );\n const finalValue = items[finalIdx];\n el.scrollTo({\n top: finalIdx * ITEM_H,\n behavior: \"smooth\",\n });\n onChange(finalValue);\n setLocalValue(finalValue);\n }, 120);\n }, [items, onChange]);\n\n const handleItemClick = useCallback(\n (item: number) => {\n const idx = items.indexOf(item);\n setLocalValue(item);\n onChange(item);\n containerRef.current?.scrollTo({\n top: idx * ITEM_H,\n behavior: \"smooth\",\n });\n },\n [items, onChange],\n );\n\n return (\n <div\n ref={containerRef}\n className=\"relative [&::-webkit-scrollbar]:hidden\"\n style={{\n width: 39,\n height: DRUM_H,\n overflowY: \"scroll\",\n scrollSnapType: \"y mandatory\",\n scrollbarWidth: \"none\",\n }}\n onScroll={handleScroll}\n >\n <div style={{ height: SPACER, flexShrink: 0 }} />\n\n {items.map((item) => {\n const isSel = item === localValue;\n return (\n <div\n key={item}\n style={{\n height: ITEM_H,\n scrollSnapAlign: \"center\",\n }}\n className=\"flex items-center justify-center cursor-pointer select-none\"\n onClick={() => handleItemClick(item)}\n >\n <span\n style={{\n fontSize: isSel ? 32 : 14,\n lineHeight: 1,\n color: isSel\n ? \"var(--foreground)\"\n : \"var(--disabled)\",\n transition: \"font-size 0.1s, color 0.1s\",\n }}\n >\n {pad2(item)}\n </span>\n </div>\n );\n })}\n\n <div style={{ height: SPACER, flexShrink: 0 }} />\n </div>\n );\n}\n\n// ─── Range Slot Grid (PopupCalendar design) ────────────────────────────────────\nconst DEFAULT_SLOTS = generateHourlySlots();\n\nfunction RangeSlotPicker({\n slots = DEFAULT_SLOTS,\n startValue,\n endValue,\n onSelect,\n}: {\n slots?: TimeSlot[];\n startValue: TimeValue;\n endValue: TimeValue;\n onSelect: (slot: TimeSlot) => void;\n}) {\n return (\n <div\n className=\"overflow-y-auto [&::-webkit-scrollbar]:hidden\"\n style={{ maxHeight: 320, scrollbarWidth: \"none\", minWidth: 300 }}\n >\n <div\n className=\"content-center grid grid-cols-2 gap-x-[20px] gap-y-[32px] items-center justify-between overflow-clip relative\"\n style={{ padding: \"24px 40px\" }}\n >\n {slots.map((slot, idx) => {\n const isSelected = slotMatches(\n slot,\n startValue,\n endValue,\n );\n return (\n <div\n key={idx}\n onClick={() => onSelect(slot)}\n className={cn(\n \"content-stretch flex h-[25px] items-center justify-center relative rounded-[4px] shrink-0 cursor-pointer select-none transition-colors duration-100\",\n isSelected\n ? \"bg-primary-action\"\n : \"hover:bg-primary-action-light\",\n )}\n style={{ padding: \"2px 8px\" }}\n >\n <p\n className=\"leading-[22px] relative shrink-0 text-[14px] text-center whitespace-nowrap\"\n style={{\n fontVariationSettings: \"'wdth' 100\",\n color: isSelected\n ? \"var(--on-primary-action)\"\n : \"var(--foreground)\",\n }}\n >\n {slot.label}\n </p>\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n\n// ─── Action Buttons (ยกเลิก / ตกลง) ────────────────────────────────────────────\nfunction PickerActions({\n onCancel,\n onConfirm,\n px = 24,\n}: {\n onCancel?: () => void;\n onConfirm?: () => void;\n px?: number;\n}) {\n return (\n <div\n className=\"flex gap-[12px] items-center\"\n style={{ padding: `16px ${px}px` }}\n >\n <Button\n variant=\"outline\"\n size=\"lg\"\n className=\"flex-1\"\n onClick={onCancel}\n >\n ยกเลิก\n </Button>\n <Button\n variant=\"primary\"\n size=\"lg\"\n className=\"flex-1\"\n onClick={onConfirm}\n >\n ตกลง\n </Button>\n </div>\n );\n}\n\n// ─── Time Picker Content (drums / slots only — no bg, no buttons) ──────────────\nfunction TimePickerContent({\n mode,\n singleValue,\n onSingleChange,\n startValue,\n endValue,\n onStartChange,\n onEndChange,\n}: {\n mode: TimeInputMode;\n singleValue: TimeValue;\n onSingleChange: (v: TimeValue) => void;\n startValue: TimeValue;\n endValue: TimeValue;\n onStartChange: (v: TimeValue) => void;\n onEndChange: (v: TimeValue) => void;\n}) {\n // ── Range mode → slot grid ─────────────────────────────────────────────────\n if (mode === \"range\") {\n return (\n <RangeSlotPicker\n startValue={startValue}\n endValue={endValue}\n onSelect={(slot) => {\n onStartChange(slot.start);\n onEndChange(slot.end);\n }}\n />\n );\n }\n\n // ── Single mode → drum scroll ──────────────────────────────────────────────\n const handleHour = (h: number) =>\n onSingleChange({ ...singleValue, hour: h });\n const handleMinute = (m: number) =>\n onSingleChange({ ...singleValue, minute: m });\n\n return (\n <div className=\"relative w-full\">\n {/* Highlight band */}\n <div\n className=\"absolute left-0 right-0 rounded-[4px] bg-selected-light-bg pointer-events-none\"\n style={{\n top: \"50%\",\n transform: \"translateY(-50%)\",\n height: ITEM_H,\n zIndex: 0,\n }}\n />\n <div\n className=\"relative flex gap-[8px] items-center justify-center\"\n style={{ zIndex: 1 }}\n >\n <ScrollColumn\n items={HOURS}\n value={singleValue.hour}\n onChange={handleHour}\n />\n <div\n className=\"flex items-center justify-center shrink-0\"\n style={{ height: ITEM_H, width: 8 }}\n >\n <span\n style={{\n fontSize: 32,\n lineHeight: 1,\n color: \"var(--foreground)\",\n }}\n >\n :\n </span>\n </div>\n <ScrollColumn\n items={MINUTES}\n value={singleValue.minute}\n onChange={handleMinute}\n />\n </div>\n </div>\n );\n}\n\n// ─── Main Component ────────────────────────────────────────────────────────────\nconst TimeInput = forwardRef<HTMLDivElement, TimeInputProps>(\n (\n {\n mode = \"single\",\n placeholder = \"Text label\",\n required = false,\n forceState,\n errorMessage = \"Error message\",\n helperText,\n value,\n onChange,\n startTime,\n endTime,\n onStartChange,\n onEndChange,\n className,\n },\n ref,\n ) => {\n const [open, setOpen] = useState(false);\n const isMobile = useIsMobile();\n\n const [internalSingle, setInternalSingle] = useState<\n TimeValue | undefined\n >(undefined);\n const [internalStart, setInternalStart] = useState<TimeValue>({\n hour: 0,\n minute: 0,\n });\n const [internalEnd, setInternalEnd] = useState<TimeValue>({\n hour: 0,\n minute: 0,\n });\n\n const [draftSingle, setDraftSingle] = useState<TimeValue>({\n hour: 0,\n minute: 0,\n });\n const [draftStart, setDraftStart] = useState<TimeValue>({\n hour: 0,\n minute: 0,\n });\n const [draftEnd, setDraftEnd] = useState<TimeValue>({\n hour: 0,\n minute: 0,\n });\n\n const isStatic = Boolean(forceState);\n const isDisabled = forceState === \"disabled\";\n\n const currentValue =\n value !== undefined ? value : internalSingle;\n const currentStart =\n startTime !== undefined ? startTime : internalStart;\n const currentEnd =\n endTime !== undefined ? endTime : internalEnd;\n\n const state: TimeInputState =\n forceState ?? (open ? \"focus\" : \"default\");\n const isError = state === \"error\";\n const isFocus = state === \"focus\";\n\n const isFilled =\n mode === \"single\" ? Boolean(currentValue) : true;\n\n // ── Colours ──────────────────────────────────────────────────────────────────\n const bgClass = isDisabled ? \"bg-disabled-bg\" : \"bg-background\";\n const labelColor = isDisabled\n ? \"var(--disabled)\"\n : \"var(--muted-foreground)\";\n const valueColor = isDisabled\n ? \"var(--disabled)\"\n : \"var(--foreground)\";\n const iconColor = isDisabled\n ? \"var(--disabled)\"\n : \"var(--muted-foreground)\";\n const minusColor = isDisabled\n ? \"var(--disabled)\"\n : \"var(--muted-foreground)\";\n const asteriskColor = isDisabled\n ? \"var(--disabled)\"\n : \"var(--error-dark)\";\n const asteriskSmall = isDisabled\n ? \"var(--disabled)\"\n : \"var(--error-dark)\";\n\n // ── Border ────────────────────────────────────────────────────────────────────\n const borderInset = isFocus || isError ? \"-1px\" : \"0px\";\n const borderRad = isFocus || isError ? \"9px\" : \"8px\";\n const borderColor = isDisabled\n ? \"var(--border-disabled)\"\n : isError\n ? \"var(--destructive)\"\n : isFocus\n ? \"var(--primary-action)\"\n : \"var(--border)\";\n\n const showBelow = isError || Boolean(helperText);\n const leftText = isError ? errorMessage : (helperText ?? \"\");\n const leftColor = isError\n ? \"var(--error-dark)\"\n : \"var(--muted-foreground)\";\n\n // ── Handlers ─────────────────────────────────────────────────────────────────\n const commitSingle = useCallback(\n (v: TimeValue) => {\n if (value === undefined) setInternalSingle(v);\n onChange?.(v);\n },\n [value, onChange],\n );\n const commitStart = useCallback(\n (v: TimeValue) => {\n if (startTime === undefined) setInternalStart(v);\n onStartChange?.(v);\n },\n [startTime, onStartChange],\n );\n const commitEnd = useCallback(\n (v: TimeValue) => {\n if (endTime === undefined) setInternalEnd(v);\n onEndChange?.(v);\n },\n [endTime, onEndChange],\n );\n\n // ── Trigger content ───────────────────────────────────────────────────────────\n const renderContent = () => {\n if (isFilled && (mode === \"range\" || currentValue)) {\n const floatLabel = required ? (\n <div className=\"flex gap-[2px] items-center shrink-0 w-full\">\n <p\n className=\"leading-[16px] not-italic shrink-0 text-[12px] whitespace-nowrap\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n <p\n className=\"leading-[1.5] not-italic shrink-0 text-[9px] w-[7px]\"\n style={{ color: asteriskSmall }}\n >\n *\n </p>\n </div>\n ) : (\n <p\n className=\"leading-[16px] not-italic shrink-0 text-[12px] w-full\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n );\n\n const valueRow =\n mode === \"single\" && currentValue ? (\n <p\n className=\"leading-[20px] not-italic shrink-0 text-[16px] w-full\"\n style={{ color: valueColor }}\n >\n {formatTime(currentValue)}\n </p>\n ) : mode === \"range\" ? (\n <div className=\"flex gap-[8px] items-center shrink-0 w-full\">\n <p\n className=\"leading-[20px] not-italic shrink-0 text-[16px] whitespace-nowrap\"\n style={{ color: valueColor }}\n >\n {formatTime(currentStart)}\n </p>\n <Minus\n size={20}\n color={minusColor}\n />\n <p\n className=\"leading-[20px] not-italic shrink-0 text-[16px] whitespace-nowrap\"\n style={{ color: valueColor }}\n >\n {formatTime(currentEnd)}\n </p>\n </div>\n ) : null;\n\n return (\n <div className=\"content-stretch flex flex-1 flex-col items-center justify-center min-h-px min-w-px relative\">\n {floatLabel}\n {valueRow}\n </div>\n );\n }\n\n if (required) {\n return (\n <div className=\"content-stretch flex flex-1 min-w-px min-h-px gap-[2px] items-center relative\">\n <p\n className=\"leading-[20px] not-italic shrink-0 text-[16px] whitespace-nowrap\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n <p\n className=\"font-normal h-full leading-[1.5] not-italic shrink-0 text-[12px] w-[7px]\"\n style={{ color: asteriskColor }}\n >\n *\n </p>\n </div>\n );\n }\n\n return (\n <p\n className=\"flex-1 min-w-0 min-h-px text-[16px] leading-[20px] not-italic overflow-hidden text-ellipsis whitespace-nowrap relative\"\n style={{ color: labelColor }}\n >\n {placeholder}\n </p>\n );\n };\n\n const isTriggerFilled =\n isFilled && (mode === \"range\" || currentValue);\n const triggerPadding = isTriggerFilled\n ? \"py-1.5\"\n : \"py-3\";\n const triggerBase = cn(\n \"relative flex gap-2 items-center rounded-lg px-3.5 w-full\",\n bgClass,\n triggerPadding,\n );\n\n const triggerInner = (\n <>\n <div\n aria-hidden=\"true\"\n className=\"absolute pointer-events-none border border-solid\"\n style={{\n inset: borderInset,\n borderRadius: borderRad,\n borderColor,\n }}\n />\n {renderContent()}\n <div\n className={cn(\n \"flex flex-row items-center shrink-0\",\n isTriggerFilled && \"self-stretch\",\n )}\n >\n <Clock\n size={isTriggerFilled ? 22 : 24}\n color={iconColor}\n weight=\"regular\"\n />\n </div>\n </>\n );\n\n const belowMsg = showBelow && (\n <div className=\"flex items-start px-1 text-xs leading-4\">\n <span\n className=\"flex-1 min-w-0\"\n style={{ color: leftColor }}\n >\n {leftText}\n </span>\n </div>\n );\n\n // ── Static (forceState) ───────────────────────────────────────────────────────\n if (isStatic) {\n return (\n <div\n ref={ref}\n className={cn(\n \"flex flex-col gap-[4px] w-full\",\n className,\n )}\n >\n <div className={triggerBase}>{triggerInner}</div>\n {belowMsg}\n </div>\n );\n }\n\n const handleOpenChange = (o: boolean) => {\n if (!isDisabled) {\n if (o) {\n setDraftSingle(\n currentValue ?? { hour: 0, minute: 0 },\n );\n setDraftStart(currentStart);\n setDraftEnd(currentEnd);\n }\n setOpen(o);\n }\n };\n\n const handleCancel = () => setOpen(false);\n\n const handleConfirm = () => {\n if (mode === \"single\") {\n commitSingle(draftSingle);\n } else {\n commitStart(draftStart);\n commitEnd(draftEnd);\n }\n setOpen(false);\n };\n\n const triggerButton = (\n <button\n type=\"button\"\n disabled={isDisabled}\n className={cn(\n triggerBase,\n \"text-left cursor-pointer disabled:cursor-default\",\n )}\n >\n {triggerInner}\n </button>\n );\n\n const pickerContent = (\n <TimePickerContent\n mode={mode}\n singleValue={draftSingle}\n onSingleChange={setDraftSingle}\n startValue={draftStart}\n endValue={draftEnd}\n onStartChange={setDraftStart}\n onEndChange={setDraftEnd}\n />\n );\n\n const actionButtons = (\n <div className=\"flex gap-[12px] items-center pt-[12px]\">\n <Button\n variant=\"outline\"\n size=\"lg\"\n className=\"flex-1\"\n onClick={handleCancel}\n >\n ยกเลิก\n </Button>\n <Button\n variant=\"primary\"\n size=\"lg\"\n className=\"flex-1\"\n onClick={handleConfirm}\n >\n ตกลง\n </Button>\n </div>\n );\n\n // ── Interactive ───────────────────────────────────────────────────────────────\n return (\n <div\n ref={ref}\n className={cn(\n \"flex flex-col gap-[4px] w-full\",\n className,\n )}\n >\n {isMobile ? (\n <Drawer open={open} onOpenChange={handleOpenChange}>\n <DrawerTrigger asChild>\n {triggerButton}\n </DrawerTrigger>\n <DrawerContent>\n <DrawerTitle className=\"sr-only\">\n เลือกเวลา\n </DrawerTitle>\n <div className=\"overflow-auto px-4 pt-2 pb-8 w-full\">\n {pickerContent}\n {actionButtons}\n </div>\n </DrawerContent>\n </Drawer>\n ) : (\n <Popover.Root\n open={open}\n onOpenChange={handleOpenChange}\n >\n <Popover.Trigger asChild>\n {triggerButton}\n </Popover.Trigger>\n\n <Popover.Portal>\n <Popover.Content\n align=\"start\"\n sideOffset={4}\n className=\"z-50 rounded-[8px] bg-popover p-3 outline-none max-w-[340px] text-popover-foreground\"\n style={{\n boxShadow: \"var(--elevation-popover)\",\n border: \"1px solid var(--border)\",\n minWidth:\n mode === \"single\" ? 327 : undefined,\n }}\n onOpenAutoFocus={(e) => e.preventDefault()}\n >\n {pickerContent}\n {actionButtons}\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n )}\n {belowMsg}\n </div>\n );\n },\n);\n\nTimeInput.displayName = \"TimeInput\";\n\nexport { TimeInput };\n"],"names":["Button","Card","Page","PageHeader","Section","Toolbar","CardGrid","Stack","sizeStyles","Chip","DrawerPrimitive","React","DateInput","_a","_b","DropdownMultiple","hasExternalLabel","Input","OptionList","SearchInput","Tab","TabGroup","Tag","TextArea"],"mappings":";;;;;;;;;;AAGO,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;ACmBA,MAAM,qBAAsD;AAAA,EAC1D,IAAI;AAAA;AAAA,EACJ,IAAI;AAAA;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,WAA4C;AAAA,EAChD,IAAI;AAAA;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,gBAAiD;AAAA,EACrD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,oBAAqD;AAAA,EACzD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,SAAS,kBACP,MACA,SACA,UACmC;AACnC,QAAM,QAAyC;AAAA,IAC7C,IAAI;AAAA;AAAA,IACJ,IAAI;AAAA;AAAA,IACJ,IAAI;AAAA;AAAA,IACJ,IAAI;AAAA;AAAA,IACJ,IAAI;AAAA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