{"version":3,"sources":["../src/index.ts","../src/utils/cn.ts","../src/components/view-toggle/ViewToggle.tsx","../src/locale/LocaleProvider.tsx","../src/locale/en.ts","../src/locale/zh-tw.ts","../src/components/segmented-control/SegmentedControl.tsx","../src/components/button/Button.tsx","../src/components/spinner/Spinner.tsx","../src/components/copy-button/CopyButton.tsx","../src/components/input/Input.tsx","../src/components/input/PasswordInput.tsx","../src/components/badge/Badge.tsx","../src/components/inline-code/InlineCode.tsx","../src/components/select/Select.tsx","../src/components/checkbox/Checkbox.tsx","../src/components/checkbox/CheckboxCard.tsx","../src/components/radio/Radio.tsx","../src/components/toggle/Toggle.tsx","../src/components/kbd/Kbd.tsx","../src/components/status-dot/StatusDot.tsx","../src/components/avatar/Avatar.tsx","../src/components/label/Label.tsx","../src/components/popover/Popover.tsx","../src/components/tooltip/Tooltip.tsx","../src/components/dropdown-menu/DropdownMenu.tsx","../src/components/combobox/Combobox.tsx","../src/components/command-palette/CommandPalette.tsx","../src/utils/deprecate.ts","../src/components/sidebar/Sidebar.tsx","../src/components/tenant-switcher/TenantSwitcher.tsx","../src/components/navbar/Navbar.tsx","../src/components/breadcrumb/Breadcrumb.tsx","../src/components/tabs/Tabs.tsx","../src/components/tree/Tree.tsx","../src/components/filter-bar/FilterBar.tsx","../src/components/filter-bar/FilterSelect.tsx","../src/components/data-table/DataTable.tsx","../src/components/table/Table.tsx","../src/components/scroll-fade/ScrollFade.tsx","../src/components/card/Card.tsx","../src/components/data-table/useServerTable.ts","../src/components/virtual-list/VirtualList.tsx","../src/components/stat/Stat.tsx","../src/components/sparkline/Sparkline.tsx","../src/components/empty-state/EmptyState.tsx","../src/components/form/Form.tsx","../src/components/number-input/NumberInput.tsx","../src/components/pin-input/PinInput.tsx","../src/components/textarea/Textarea.tsx","../src/components/search-input/SearchInput.tsx","../src/components/tag-input/TagInput.tsx","../src/components/file-upload/FileTrigger.tsx","../src/components/file-upload/FileUpload.tsx","../src/components/file-upload/ImageUpload.tsx","../src/components/date-picker/DatePicker.tsx","../src/components/calendar/use-grid-keyboard.ts","../src/components/date-picker/DateRangePicker.tsx","../src/components/color-picker/ColorPicker.tsx","../src/components/sheet-select/SheetSelect.tsx","../src/components/drawer/Drawer.tsx","../src/components/drawer/position-styles.ts","../src/components/toast/Toast.tsx","../src/components/toast/toast-store.ts","../src/components/toast/toast-api.ts","../src/components/toast/ToastContainer.tsx","../src/components/modal/Modal.tsx","../src/components/alert/Alert.tsx","../src/components/progress/Progress.tsx","../src/components/skeleton/Skeleton.tsx","../src/components/loading-overlay/LoadingOverlay.tsx","../src/components/steps/Steps.tsx","../src/components/timeline/Timeline.tsx","../src/components/calendar/Calendar.tsx","../src/components/action-buttons/ActionButtons.tsx","../src/components/confirm-dialog/ConfirmDialog.tsx","../src/components/pagination/Pagination.tsx","../src/components/page-header/PageHeader.tsx","../src/components/error-boundary/ErrorBoundary.tsx","../src/components/bulk-action-bar/BulkActionBar.tsx","../src/components/card-field/CardField.tsx","../src/components/description-list/DescriptionList.tsx","../src/components/container/Container.tsx","../src/components/stack/Stack.tsx","../src/components/divider/Divider.tsx","../src/components/admin-layout/AdminLayout.tsx","../src/components/collapsible-section/CollapsibleSection.tsx","../src/theme/presets.ts","../src/theme/contrast.ts","../src/theme/create-theme.ts","../src/theme/apply-theme.ts","../src/theme/theme-file.ts","../src/theme/chart-colors.ts"],"sourcesContent":["// Utils\nexport { cn } from './utils/cn'\n\n// UI Primitives\nexport * from './components/view-toggle'\nexport * from './components/segmented-control'\nexport * from './components/button'\nexport * from './components/copy-button'\nexport * from './components/input'\nexport * from './components/badge'\nexport * from './components/inline-code'\nexport * from './components/select'\nexport * from './components/checkbox'\nexport * from './components/radio'\nexport * from './components/toggle'\nexport * from './components/switch'\nexport * from './components/spinner'\nexport * from './components/kbd'\nexport * from './components/status-dot'\nexport * from './components/avatar'\nexport * from './components/label'\n\n// Overlay Primitives (Radix-based)\nexport * from './components/popover'\nexport * from './components/tooltip'\nexport * from './components/dropdown-menu'\n\n// Composite Components (Radix + cmdk)\nexport * from './components/combobox'\nexport * from './components/command-palette'\n\n// Navigation\nexport * from './components/sidebar'\nexport * from './components/tenant-switcher'\nexport * from './components/navbar'\nexport * from './components/breadcrumb'\nexport * from './components/tabs'\n\n// Data\nexport * from './components/tree'\nexport * from './components/filter-bar'\nexport * from './components/data-table'\nexport * from './components/virtual-list'\nexport * from './components/stat'\nexport * from './components/sparkline'\nexport * from './components/empty-state'\nexport * from './components/table'\nexport * from './components/scroll-fade'\n\n// Form\nexport * from './components/form'\nexport * from './components/number-input'\nexport * from './components/pin-input'\nexport * from './components/textarea'\nexport * from './components/search-input'\nexport * from './components/tag-input'\nexport * from './components/file-upload'\nexport * from './components/date-picker'\nexport * from './components/color-picker'\nexport * from './components/sheet-select'\n\n// Feedback\nexport * from './components/toast'\nexport * from './components/modal'\nexport * from './components/drawer'\nexport * from './components/alert'\nexport * from './components/progress'\nexport * from './components/skeleton'\nexport * from './components/loading-overlay'\n\n// Process\nexport * from './components/steps'\nexport * from './components/timeline'\nexport * from './components/calendar'\n\n// Actions\nexport * from './components/action-buttons'\nexport * from './components/confirm-dialog'\nexport * from './components/pagination'\nexport * from './components/page-header'\nexport * from './components/error-boundary'\nexport * from './components/bulk-action-bar'\n\n// Layout\nexport * from './components/card'\nexport * from './components/card-field'\nexport * from './components/description-list'\nexport * from './components/container'\nexport * from './components/stack'\nexport * from './components/divider'\nexport * from './components/admin-layout'\nexport * from './components/collapsible-section'\n\n// Motion — use '@arkite-ui/core/motion' entry point (requires framer-motion)\n\n// Theme\nexport * from './theme'\n\n// Locale\nexport * from './locale'\n","import { type ClassValue, clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs))\n}\n","import { forwardRef, useState, type HTMLAttributes, type ReactNode } from 'react'\nimport { LayoutGrid, LayoutList } from 'lucide-react'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\n\nexport type ViewMode = 'table' | 'card'\n\nexport interface ViewToggleProps extends Omit<\n  HTMLAttributes<HTMLDivElement>,\n  'onChange' | 'defaultValue'\n> {\n  /** Current view mode (controlled) */\n  value?: ViewMode\n  /** Initial view mode for uncontrolled usage */\n  defaultValue?: ViewMode\n  /** View change callback */\n  onChange?: (mode: ViewMode) => void\n  /** Size variant */\n  size?: 'sm' | 'md'\n  /** Additional class name */\n  className?: string\n}\n\ninterface ViewOption {\n  mode: ViewMode\n  icon: ReactNode\n  label: string\n}\n\nconst sizeStyles = {\n  sm: { wrapper: 'h-8', button: 'h-6 w-6', icon: 'h-3.5 w-3.5' },\n  md: { wrapper: 'h-9', button: 'h-7 w-7', icon: 'h-4 w-4' },\n}\n\n/** Toggle between table and card view layouts. */\nexport const ViewToggle = forwardRef<HTMLDivElement, ViewToggleProps>(\n  ({ value, defaultValue, onChange, size = 'md', className, ...rest }, ref) => {\n    const locale = useLocale()\n    const styles = sizeStyles[size]\n    const isControlled = value !== undefined\n    const [internalValue, setInternalValue] = useState(defaultValue)\n    const currentValue = isControlled ? value : internalValue\n\n    const options: ViewOption[] = [\n      {\n        mode: 'table',\n        icon: <LayoutList className={styles.icon} />,\n        label: locale.viewToggle.tableView,\n      },\n      {\n        mode: 'card',\n        icon: <LayoutGrid className={styles.icon} />,\n        label: locale.viewToggle.cardView,\n      },\n    ]\n\n    return (\n      <div\n        ref={ref}\n        role=\"radiogroup\"\n        aria-label={locale.viewToggle.label}\n        className={cn(\n          'border-input bg-background inline-flex items-center gap-1 rounded-md border p-1',\n          styles.wrapper,\n          className\n        )}\n        {...rest}\n      >\n        {options.map(({ mode, icon, label }) => (\n          <button\n            key={mode}\n            type=\"button\"\n            role=\"radio\"\n            aria-checked={currentValue === mode}\n            aria-label={label}\n            onClick={() => {\n              if (!isControlled) setInternalValue(mode)\n              onChange?.(mode)\n            }}\n            className={cn(\n              'inline-flex items-center justify-center rounded-sm transition-colors',\n              styles.button,\n              currentValue === mode\n                ? 'bg-secondary text-foreground shadow-sm'\n                : 'text-muted-foreground hover:text-foreground'\n            )}\n          >\n            {icon}\n          </button>\n        ))}\n      </div>\n    )\n  }\n)\n\nViewToggle.displayName = 'ViewToggle'\n","import { createContext, useContext, useMemo, type ReactNode } from 'react'\nimport type { ArkiteLocale, PartialArkiteLocale } from './types'\nimport { enUS } from './en'\n\nconst LocaleContext = createContext<ArkiteLocale>(enUS)\n\n/**\n * Merge a (possibly partial) locale over the English defaults, one\n * section deep — matching PartialArkiteLocale's shape.\n */\nfunction mergeLocale(override?: PartialArkiteLocale): ArkiteLocale {\n  if (!override) return enUS\n  const merged = { ...enUS } as Record<string, unknown>\n  for (const [key, value] of Object.entries(override)) {\n    if (value === undefined) continue\n    const base = (enUS as unknown as Record<string, unknown>)[key]\n    merged[key] =\n      typeof value === 'object' && !Array.isArray(value) ? { ...(base as object), ...value } : value\n  }\n  return merged as unknown as ArkiteLocale\n}\n\nexport interface LocaleProviderProps {\n  /** Full or partial locale — missing keys fall back to English. */\n  locale?: PartialArkiteLocale\n  children: ReactNode\n}\n\n/**\n * Provides component strings (placeholders, empty states, aria-labels)\n * for the whole subtree. Without a provider everything renders in\n * English; explicit component props always win over locale values.\n *\n * @example\n * ```tsx\n * import { LocaleProvider, zhTW } from '@arkite-ui/core'\n *\n * <LocaleProvider locale={zhTW}>\n *   <App />\n * </LocaleProvider>\n * ```\n */\nexport function LocaleProvider({ locale, children }: LocaleProviderProps) {\n  const value = useMemo(() => mergeLocale(locale), [locale])\n  return <LocaleContext.Provider value={value}>{children}</LocaleContext.Provider>\n}\n\n/** Read the active locale (English defaults when no provider is mounted). */\nexport function useLocale(): ArkiteLocale {\n  return useContext(LocaleContext)\n}\n","import type { ArkiteLocale } from './types'\n\n/**\n * English (US) — the built-in default. Values must stay identical to the\n * strings components shipped before the locale system existed, so\n * unwrapped apps render exactly as before.\n */\nexport const enUS: ArkiteLocale = {\n  dateLocale: 'en-US',\n\n  calendar: {\n    previousMonth: 'Previous month',\n    nextMonth: 'Next month',\n    weekdays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],\n    weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n  },\n  datePicker: {\n    placeholder: 'Select date',\n    openCalendar: 'Open calendar',\n    today: 'Today',\n    clearDate: 'Clear date',\n  },\n  dateRangePicker: {\n    startLabel: 'Start',\n    endLabel: 'End',\n    clearDates: 'Clear dates',\n    clear: 'Clear',\n    selectRange: 'Select date range',\n    selectStart: 'Select start date',\n    selectEnd: 'Select end date',\n  },\n  searchInput: {\n    clear: 'Clear search',\n  },\n  filterBar: {\n    searchPlaceholder: 'Search...',\n  },\n  combobox: {\n    placeholder: 'Select...',\n    searchPlaceholder: 'Search...',\n    emptyMessage: 'No results found.',\n    loading: 'Loading...',\n  },\n  sheetSelect: {\n    placeholder: 'Select…',\n  },\n  pagination: {\n    label: 'Pagination',\n    rowsPerPage: 'Rows per page:',\n    firstPage: 'First page',\n    previousPage: 'Previous page',\n    nextPage: 'Next page',\n    lastPage: 'Last page',\n    pageLabel: (page) => `Page ${page}`,\n    rangeInfo: (start, end, total) => `${start}-${end} of ${total}`,\n  },\n  dataTable: {\n    emptyMessage: 'No results found.',\n    toggleColumns: 'Toggle columns',\n    selectAllRows: 'Select all rows',\n    selectRow: (rowKey) => `Select row ${rowKey}`,\n    columns: 'Columns',\n    expand: 'Expand',\n    expandRow: 'Expand row',\n    collapseRow: 'Collapse row',\n    sortBy: (header) => `Sort by ${header}`,\n    sortColumn: 'Sort column',\n    filterBy: (header) => `Filter ${header}`,\n    clearFilter: 'Clear',\n    loading: 'Loading...',\n    showing: (count, total) => `Showing ${count} of ${total}`,\n  },\n  emptyState: {\n    noResultsTitle: 'No results found',\n    noResultsDescription: 'Try adjusting your search or filters.',\n    noDataTitle: 'No data yet',\n    noDataDescription: 'Get started by creating your first item.',\n    errorTitle: 'Something went wrong',\n    errorDescription: 'An error occurred while loading the data.',\n    retryLabel: 'Try again',\n  },\n  confirmDialog: {\n    cancelLabel: 'Cancel',\n    confirmLabel: 'Confirm',\n    confirmTitle: 'Are you sure?',\n    confirmDescription: 'This action cannot be undone.',\n    deleteTitle: (itemName) => `Delete ${itemName}?`,\n    deleteFallbackItem: 'this item',\n    deleteDescription:\n      'This action cannot be undone. All associated data will be permanently removed.',\n    deleteLabel: 'Delete',\n  },\n  tenantSwitcher: {\n    allLabel: 'All Tenants',\n    allDescription: 'Platform-wide view',\n    emptyMessage: 'No tenants found',\n    searchPlaceholder: 'Search tenants...',\n  },\n  bulkActionBar: {\n    selected: (count) => `${count} item${count === 1 ? '' : 's'} selected`,\n    deselectAll: 'Deselect all',\n  },\n  numberInput: {\n    increment: 'Increment',\n    decrement: 'Decrement',\n  },\n  copyButton: {\n    copy: 'Copy',\n    copied: 'Copied!',\n    copyAria: 'Copy to clipboard',\n    copiedAria: 'Copied',\n    copyValue: 'Copy value',\n  },\n  modal: {\n    close: 'Close',\n  },\n  drawer: {\n    close: 'Close',\n  },\n  toast: {\n    close: 'Close',\n  },\n  spinner: {\n    loading: 'Loading',\n    loadingText: 'Loading...',\n  },\n  adminLayout: {\n    primaryNavigation: 'Primary',\n    logout: 'Logout',\n    expandMenu: 'Expand menu',\n    bottomNavigation: 'Bottom navigation',\n  },\n  pinInput: {\n    charLabel: (index, length) => `Character ${index} of ${length}`,\n  },\n  viewToggle: {\n    label: 'View mode',\n    tableView: 'Table view',\n    cardView: 'Card view',\n  },\n  commandPalette: {\n    label: 'Command palette',\n  },\n  fileUpload: {\n    uploadFile: 'Upload file',\n    uploadFiles: 'Upload files',\n    uploadImage: 'Upload image',\n    addImage: 'Add image',\n    upload: 'Upload',\n    remove: 'Remove',\n    replace: 'Replace',\n    removeImage: 'Remove image',\n    preview: 'Preview',\n    dropzone: 'Drop files here or click to upload',\n    anyFileType: 'Any file type accepted',\n    acceptedTypes: (accept) => `Accepted: ${accept}`,\n    maxSizeNote: (size) => `Max size: ${size}`,\n    maxSizeHint: (size) => `Max ${size}`,\n    fileTooLarge: (name, size) => `File \"${name}\" exceeds maximum size of ${size}`,\n    fileNotAccepted: (name) => `File \"${name}\" is not an accepted file type`,\n    tooManyFiles: (max) => `Maximum ${max} files allowed`,\n  },\n  virtualList: {\n    label: 'Scrollable list',\n    empty: 'No items',\n    loadingMore: 'Loading more...',\n  },\n  colorPicker: {\n    pickColor: 'Pick a color',\n    hexValue: 'Hex color value',\n    presetColors: 'Preset colors',\n    selectColor: (color) => `Select color ${color}`,\n  },\n  progress: {\n    label: 'Progress',\n  },\n  breadcrumb: {\n    label: 'Breadcrumb',\n  },\n  label: {\n    optional: '(optional)',\n  },\n  passwordInput: {\n    hide: 'Hide password',\n    show: 'Show password',\n  },\n  tagInput: {\n    remove: (tag) => `Remove ${tag}`,\n  },\n  tree: {\n    collapse: 'Collapse',\n    expand: 'Expand',\n    toggle: 'Toggle',\n  },\n  filterSelect: {\n    all: 'All',\n  },\n  pageHeader: {\n    back: 'Go back',\n  },\n  sidebar: {\n    toggle: 'Toggle sidebar',\n  },\n  actionButtons: {\n    label: 'Actions',\n  },\n}\n","import type { ArkiteLocale } from './types'\n\n/** 繁體中文（台灣） */\nexport const zhTW: ArkiteLocale = {\n  dateLocale: 'zh-TW',\n\n  calendar: {\n    previousMonth: '上個月',\n    nextMonth: '下個月',\n    weekdays: ['日', '一', '二', '三', '四', '五', '六'],\n    weekdaysShort: ['週日', '週一', '週二', '週三', '週四', '週五', '週六'],\n  },\n  datePicker: {\n    placeholder: '選擇日期',\n    openCalendar: '開啟日曆',\n    today: '今天',\n    clearDate: '清除日期',\n  },\n  dateRangePicker: {\n    startLabel: '開始',\n    endLabel: '結束',\n    clearDates: '清除日期',\n    clear: '清除',\n    selectRange: '選擇日期範圍',\n    selectStart: '選擇開始日期',\n    selectEnd: '選擇結束日期',\n  },\n  searchInput: {\n    clear: '清除搜尋',\n  },\n  filterBar: {\n    searchPlaceholder: '搜尋…',\n  },\n  combobox: {\n    placeholder: '請選擇…',\n    searchPlaceholder: '搜尋…',\n    emptyMessage: '查無結果',\n    loading: '載入中…',\n  },\n  sheetSelect: {\n    placeholder: '請選擇…',\n  },\n  pagination: {\n    label: '分頁',\n    rowsPerPage: '每頁筆數：',\n    firstPage: '第一頁',\n    previousPage: '上一頁',\n    nextPage: '下一頁',\n    lastPage: '最後一頁',\n    pageLabel: (page) => `第 ${page} 頁`,\n    rangeInfo: (start, end, total) => `第 ${start}-${end} 筆，共 ${total} 筆`,\n  },\n  dataTable: {\n    emptyMessage: '查無結果',\n    toggleColumns: '切換欄位',\n    selectAllRows: '全選',\n    selectRow: (rowKey) => `選取第 ${rowKey} 列`,\n    columns: '欄位',\n    expand: '展開',\n    expandRow: '展開列',\n    collapseRow: '收合列',\n    sortBy: (header) => `依 ${header} 排序`,\n    sortColumn: '排序欄位',\n    filterBy: (header) => `篩選 ${header}`,\n    clearFilter: '清除',\n    loading: '載入中…',\n    showing: (count, total) => `顯示 ${count} 筆，共 ${total} 筆`,\n  },\n  emptyState: {\n    noResultsTitle: '查無結果',\n    noResultsDescription: '請調整搜尋或篩選條件。',\n    noDataTitle: '尚無資料',\n    noDataDescription: '建立第一筆資料開始使用。',\n    errorTitle: '發生錯誤',\n    errorDescription: '載入資料時發生錯誤。',\n    retryLabel: '重試',\n  },\n  confirmDialog: {\n    cancelLabel: '取消',\n    confirmLabel: '確認',\n    confirmTitle: '確定要執行嗎？',\n    confirmDescription: '此操作無法復原。',\n    deleteTitle: (itemName) => `刪除${itemName}？`,\n    deleteFallbackItem: '此項目',\n    deleteDescription: '此操作無法復原，所有相關資料將被永久移除。',\n    deleteLabel: '刪除',\n  },\n  tenantSwitcher: {\n    allLabel: '全部租戶',\n    allDescription: '平台總覽',\n    emptyMessage: '查無租戶',\n    searchPlaceholder: '搜尋租戶…',\n  },\n  bulkActionBar: {\n    selected: (count) => `已選取 ${count} 筆`,\n    deselectAll: '取消全選',\n  },\n  numberInput: {\n    increment: '增加',\n    decrement: '減少',\n  },\n  copyButton: {\n    copy: '複製',\n    copied: '已複製！',\n    copyAria: '複製到剪貼簿',\n    copiedAria: '已複製',\n    copyValue: '複製內容',\n  },\n  modal: {\n    close: '關閉',\n  },\n  drawer: {\n    close: '關閉',\n  },\n  toast: {\n    close: '關閉',\n  },\n  spinner: {\n    loading: '載入中',\n    loadingText: '載入中…',\n  },\n  adminLayout: {\n    primaryNavigation: '主導覽',\n    logout: '登出',\n    expandMenu: '展開選單',\n    bottomNavigation: '底部導覽',\n  },\n  pinInput: {\n    charLabel: (index, length) => `第 ${index} 碼,共 ${length} 碼`,\n  },\n  viewToggle: {\n    label: '檢視模式',\n    tableView: '表格檢視',\n    cardView: '卡片檢視',\n  },\n  commandPalette: {\n    label: '命令面板',\n  },\n  fileUpload: {\n    uploadFile: '上傳檔案',\n    uploadFiles: '上傳檔案',\n    uploadImage: '上傳圖片',\n    addImage: '新增圖片',\n    upload: '上傳',\n    remove: '移除',\n    replace: '更換',\n    removeImage: '移除圖片',\n    preview: '預覽',\n    dropzone: '拖放檔案至此，或點擊上傳',\n    anyFileType: '不限檔案格式',\n    acceptedTypes: (accept) => `可接受格式：${accept}`,\n    maxSizeNote: (size) => `大小上限：${size}`,\n    maxSizeHint: (size) => `上限 ${size}`,\n    fileTooLarge: (name, size) => `檔案「${name}」超過大小上限 ${size}`,\n    fileNotAccepted: (name) => `檔案「${name}」格式不符`,\n    tooManyFiles: (max) => `最多只能上傳 ${max} 個檔案`,\n  },\n  virtualList: {\n    label: '可捲動清單',\n    empty: '沒有項目',\n    loadingMore: '載入更多…',\n  },\n  colorPicker: {\n    pickColor: '選擇顏色',\n    hexValue: '十六進位色碼',\n    presetColors: '預設色票',\n    selectColor: (color) => `選擇顏色 ${color}`,\n  },\n  progress: {\n    label: '進度',\n  },\n  breadcrumb: {\n    label: '導覽路徑',\n  },\n  label: {\n    optional: '(選填)',\n  },\n  passwordInput: {\n    hide: '隱藏密碼',\n    show: '顯示密碼',\n  },\n  tagInput: {\n    remove: (tag) => `移除 ${tag}`,\n  },\n  tree: {\n    collapse: '收合',\n    expand: '展開',\n    toggle: '切換',\n  },\n  filterSelect: {\n    all: '全部',\n  },\n  pageHeader: {\n    back: '返回',\n  },\n  sidebar: {\n    toggle: '切換側欄',\n  },\n  actionButtons: {\n    label: '操作',\n  },\n}\n","import { forwardRef, useState, type HTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport type SegmentedControlSize = 'sm' | 'md' | 'lg'\n\nexport interface SegmentedControlOption<T extends string = string> {\n  value: T\n  label: string\n  disabled?: boolean\n}\n\nexport interface SegmentedControlProps<T extends string = string> extends Omit<\n  HTMLAttributes<HTMLDivElement>,\n  'onChange' | 'defaultValue'\n> {\n  /** Options to display */\n  options: SegmentedControlOption<T>[]\n  /** Currently selected value (controlled) */\n  value?: T\n  /** Initial value for uncontrolled usage */\n  defaultValue?: T\n  /** Change handler */\n  onChange?: (value: T) => void\n  /** Size variant @default \"md\" */\n  size?: SegmentedControlSize\n  /** Full width — segments share space equally */\n  fullWidth?: boolean\n  /** Disable all segments */\n  disabled?: boolean\n}\n\nconst sizeStyles: Record<SegmentedControlSize, { wrapper: string; button: string }> = {\n  sm: { wrapper: 'h-8 p-0.5 text-xs', button: 'px-2.5 h-[calc(100%-4px)]' },\n  md: { wrapper: 'h-9 p-1 text-sm', button: 'px-3 h-[calc(100%-8px)]' },\n  lg: { wrapper: 'h-10 p-1 text-sm', button: 'px-4 h-[calc(100%-8px)]' },\n}\n\n/**\n * Mutually exclusive option selector displayed as a horizontal pill bar.\n *\n * Use for 2–5 options where all choices should be visible at once.\n */\nexport const SegmentedControl = forwardRef<HTMLDivElement, SegmentedControlProps>(\n  (\n    {\n      options,\n      value,\n      defaultValue,\n      onChange,\n      size = 'md',\n      fullWidth = false,\n      disabled = false,\n      className,\n      ...props\n    },\n    ref\n  ) => {\n    const styles = sizeStyles[size]\n    const isControlled = value !== undefined\n    const [internalValue, setInternalValue] = useState(defaultValue)\n    const currentValue = isControlled ? value : internalValue\n\n    return (\n      <div\n        ref={ref}\n        role=\"radiogroup\"\n        className={cn(\n          'border-input bg-muted inline-flex items-center gap-0.5 rounded-md border',\n          styles.wrapper,\n          fullWidth && 'w-full',\n          disabled && 'pointer-events-none opacity-50',\n          className\n        )}\n        {...props}\n      >\n        {options.map((option) => {\n          const isActive = currentValue === option.value\n          return (\n            <button\n              key={option.value}\n              type=\"button\"\n              role=\"radio\"\n              aria-checked={isActive}\n              disabled={disabled || option.disabled}\n              onClick={() => {\n                if (!isControlled) setInternalValue(option.value)\n                onChange?.(option.value)\n              }}\n              className={cn(\n                'inline-flex items-center justify-center rounded-sm font-medium transition-colors',\n                'focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:outline-none',\n                'disabled:pointer-events-none disabled:opacity-50',\n                styles.button,\n                fullWidth && 'flex-1',\n                isActive\n                  ? 'bg-background text-foreground shadow-sm'\n                  : 'text-muted-foreground hover:text-foreground'\n              )}\n            >\n              {option.label}\n            </button>\n          )\n        })}\n      </div>\n    )\n  }\n) as <T extends string = string>(\n  props: SegmentedControlProps<T> & { ref?: React.Ref<HTMLDivElement> }\n) => React.ReactElement\n;(SegmentedControl as { displayName?: string }).displayName = 'SegmentedControl'\n","import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from 'react'\nimport { cn } from '../../utils/cn'\nimport { Spinner } from '../spinner/Spinner'\n\nexport type ButtonVariant =\n  | 'primary'\n  | 'secondary'\n  | 'outline'\n  | 'ghost'\n  | 'destructive'\n  | 'gradient'\n  | 'link'\n\nexport type ButtonSize = 'sm' | 'md' | 'lg' | 'icon'\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n  /** Button style variant */\n  variant?: ButtonVariant\n  /** Button size */\n  size?: ButtonSize\n  /** Show loading spinner */\n  loading?: boolean\n  /** Icon to show before text */\n  leftIcon?: ReactNode\n  /** Icon to show after text */\n  rightIcon?: ReactNode\n  /** Full width button */\n  fullWidth?: boolean\n}\n\nconst variantStyles: Record<ButtonVariant, string> = {\n  primary: 'bg-primary text-primary-foreground hover:bg-primary-hover shadow-sm',\n  secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',\n  outline: 'border border-input bg-background hover:bg-secondary hover:text-secondary-foreground',\n  ghost: 'hover:bg-secondary hover:text-secondary-foreground',\n  destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive-hover shadow-sm',\n  gradient: 'gradient-primary text-white hover:opacity-90 shadow-sm',\n  // Inline text link *appearance* with button semantics — for actions styled\n  // as links (e.g. inside table cells). For real navigation use an <a>.\n  link: 'text-primary underline-offset-4 hover:underline',\n}\n\nconst sizeStyles: Record<ButtonSize, string> = {\n  sm: 'h-8 px-3 text-xs rounded-md',\n  md: 'h-10 px-4 text-sm rounded-md',\n  lg: 'h-12 px-6 text-base rounded-lg',\n  icon: 'h-10 w-10 rounded-md',\n}\n\n/** General-purpose button with multiple style variants, sizes, loading state, and icon slots. */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n  (\n    {\n      className,\n      variant = 'primary',\n      size = 'md',\n      loading = false,\n      disabled,\n      leftIcon,\n      rightIcon,\n      fullWidth = false,\n      children,\n      ...props\n    },\n    ref\n  ) => {\n    const isDisabled = disabled || loading\n\n    return (\n      <button\n        ref={ref}\n        disabled={isDisabled}\n        className={cn(\n          // Base styles\n          'inline-flex items-center justify-center gap-2',\n          'font-medium transition-all duration-200',\n          'focus-visible:ring-ring/40 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n          'disabled:pointer-events-none disabled:opacity-50',\n          // Variant styles\n          variantStyles[variant],\n          // Size styles\n          sizeStyles[size],\n          // Link variant keeps the size's text scale but no box dimensions\n          variant === 'link' && 'h-auto rounded-none p-0',\n          // Full width\n          fullWidth && 'w-full',\n          className\n        )}\n        {...props}\n      >\n        {loading ? (\n          <>\n            <Spinner size=\"sm\" className=\"shrink-0\" />\n            <span>{children}</span>\n          </>\n        ) : (\n          <>\n            {leftIcon && <span className=\"shrink-0\">{leftIcon}</span>}\n            {children}\n            {rightIcon && <span className=\"shrink-0\">{rightIcon}</span>}\n          </>\n        )}\n      </button>\n    )\n  }\n)\n\nButton.displayName = 'Button'\n","import { forwardRef, type HTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\n\nexport type SpinnerSize = 'sm' | 'md' | 'lg'\n\nexport interface SpinnerProps extends HTMLAttributes<HTMLDivElement> {\n  /** Spinner size */\n  size?: SpinnerSize\n}\n\nconst sizeStyles: Record<SpinnerSize, string> = {\n  sm: 'h-4 w-4 border-2',\n  md: 'h-6 w-6 border-2',\n  lg: 'h-8 w-8 border-[3px]',\n}\n\n/** Circular spinning indicator for loading states. */\nexport const Spinner = forwardRef<HTMLDivElement, SpinnerProps>(\n  ({ className, size = 'md', ...props }, ref) => {\n    const locale = useLocale()\n    return (\n      <div\n        ref={ref}\n        role=\"status\"\n        aria-label={locale.spinner.loading}\n        className={cn(\n          'animate-spin rounded-full',\n          'border-current border-t-transparent',\n          sizeStyles[size],\n          className\n        )}\n        {...props}\n      >\n        <span className=\"sr-only\">{locale.spinner.loadingText}</span>\n      </div>\n    )\n  }\n)\n\nSpinner.displayName = 'Spinner'\n","import {\n  forwardRef,\n  useCallback,\n  useRef,\n  useState,\n  type ButtonHTMLAttributes,\n  type InputHTMLAttributes,\n  type ReactNode,\n} from 'react'\nimport { Check, Copy } from 'lucide-react'\nimport { cn } from '../../utils/cn'\nimport type { ButtonVariant, ButtonSize } from '../button/Button'\nimport { useLocale } from '../../locale'\n\n/* -------------------------------------------------------------------------- */\n/*  Style Records (reused from Button / Input)                                */\n/* -------------------------------------------------------------------------- */\n\nconst buttonVariantStyles: Record<ButtonVariant, string> = {\n  primary: 'bg-primary text-primary-foreground hover:bg-primary-hover shadow-sm',\n  secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',\n  outline: 'border border-input bg-background hover:bg-secondary hover:text-secondary-foreground',\n  ghost: 'hover:bg-secondary hover:text-secondary-foreground',\n  destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive-hover shadow-sm',\n  gradient: 'gradient-primary text-white hover:opacity-90 shadow-sm',\n  link: 'text-primary underline-offset-4 hover:underline h-auto p-0 rounded-none',\n}\n\nconst buttonSizeStyles: Record<ButtonSize, string> = {\n  sm: 'h-8 px-3 text-xs rounded-md',\n  md: 'h-10 px-4 text-sm rounded-md',\n  lg: 'h-12 px-6 text-base rounded-lg',\n  icon: 'h-10 w-10 rounded-md',\n}\n\ntype InputSize = 'sm' | 'md' | 'lg'\n\nconst inputSizeStyles: Record<InputSize, string> = {\n  sm: 'h-8 px-3 text-xs',\n  md: 'h-10 px-3 text-sm',\n  lg: 'h-12 px-4 text-base',\n}\n\nconst iconSizeMap: Record<ButtonSize, number> = {\n  sm: 14,\n  md: 16,\n  lg: 18,\n  icon: 16,\n}\n\n/* -------------------------------------------------------------------------- */\n/*  useCopyToClipboard                                                        */\n/* -------------------------------------------------------------------------- */\n\nfunction useCopyToClipboard(value: string, feedbackDuration: number, onCopy?: () => void) {\n  const [copied, setCopied] = useState(false)\n  const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n  const copy = useCallback(async () => {\n    try {\n      await navigator.clipboard.writeText(value)\n      setCopied(true)\n      onCopy?.()\n\n      if (timeoutRef.current) clearTimeout(timeoutRef.current)\n      timeoutRef.current = setTimeout(() => setCopied(false), feedbackDuration)\n    } catch {\n      // Silently fail – environments without clipboard API (e.g. insecure\n      // contexts) will simply not copy.\n    }\n  }, [value, feedbackDuration, onCopy])\n\n  return { copied, copy }\n}\n\n/* -------------------------------------------------------------------------- */\n/*  CopyButton                                                                */\n/* -------------------------------------------------------------------------- */\n\nexport interface CopyButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {\n  /** The text value to copy to the clipboard. */\n  value: string\n  /** Callback fired after a successful copy. */\n  onCopy?: () => void\n  /** Button size. */\n  size?: ButtonSize\n  /** Button style variant. */\n  variant?: ButtonVariant\n  /** Duration (ms) the \"Copied!\" feedback is shown. @default 2000 */\n  feedbackDuration?: number\n  /** Custom button content. Defaults to \"Copy\" / \"Copied!\" text. */\n  children?: ReactNode\n}\n\n/**\n * A button that copies a given value to the clipboard and shows brief\n * visual feedback (check icon + \"Copied!\" label).\n *\n * Reuses the same variant / size tokens as the base `Button` component.\n */\nexport const CopyButton = forwardRef<HTMLButtonElement, CopyButtonProps>(\n  (\n    {\n      value,\n      onCopy: onCopyProp,\n      size = 'md',\n      variant = 'outline',\n      feedbackDuration = 2000,\n      children,\n      className,\n      disabled,\n      ...props\n    },\n    ref\n  ) => {\n    const locale = useLocale()\n    const { copied, copy } = useCopyToClipboard(value, feedbackDuration, onCopyProp)\n\n    const iconSize = iconSizeMap[size]\n\n    return (\n      <button\n        ref={ref}\n        type=\"button\"\n        disabled={disabled}\n        aria-label={copied ? locale.copyButton.copiedAria : locale.copyButton.copyAria}\n        className={cn(\n          'inline-flex items-center justify-center gap-2',\n          'font-medium transition-all duration-200',\n          'focus-visible:ring-ring/40 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n          'disabled:pointer-events-none disabled:opacity-50',\n          buttonVariantStyles[variant],\n          buttonSizeStyles[size],\n          className\n        )}\n        onClick={copy}\n        {...props}\n      >\n        {copied ? (\n          <>\n            <Check size={iconSize} className=\"shrink-0\" />\n            {size !== 'icon' && <span>{children ?? locale.copyButton.copied}</span>}\n          </>\n        ) : (\n          <>\n            <Copy size={iconSize} className=\"shrink-0\" />\n            {size !== 'icon' && <span>{children ?? locale.copyButton.copy}</span>}\n          </>\n        )}\n      </button>\n    )\n  }\n)\n\nCopyButton.displayName = 'CopyButton'\n\n/* -------------------------------------------------------------------------- */\n/*  CopyInput                                                                 */\n/* -------------------------------------------------------------------------- */\n\nexport interface CopyInputProps extends Omit<\n  InputHTMLAttributes<HTMLInputElement>,\n  'size' | 'value'\n> {\n  /** The text value displayed in the input and copied to the clipboard. */\n  value: string\n  /** Callback fired after a successful copy. */\n  onCopy?: () => void\n  /** Input / button size. */\n  size?: InputSize\n  /** Duration (ms) the \"Copied!\" feedback is shown. @default 2000 */\n  feedbackDuration?: number\n  /** Additional class names applied to the wrapper. */\n  className?: string\n}\n\n/**\n * A read-only input field with an integrated copy button on the right side.\n *\n * Clicking the copy icon copies the displayed value to the clipboard and\n * briefly swaps the icon to a checkmark.\n */\nexport const CopyInput = forwardRef<HTMLInputElement, CopyInputProps>(\n  (\n    { value, onCopy: onCopyProp, size = 'md', feedbackDuration = 2000, className, ...props },\n    ref\n  ) => {\n    const locale = useLocale()\n    const { copied, copy } = useCopyToClipboard(value, feedbackDuration, onCopyProp)\n\n    const iconSize = size === 'lg' ? 18 : size === 'sm' ? 14 : 16\n\n    return (\n      <div className={cn('relative', className)}>\n        <input\n          ref={ref}\n          type=\"text\"\n          value={value}\n          readOnly\n          aria-label={locale.copyButton.copyValue}\n          className={cn(\n            'border-input bg-muted flex w-full rounded-md border',\n            'text-muted-foreground',\n            'focus-visible:ring-ring/40 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n            'cursor-default select-all',\n            'transition-colors duration-200',\n            inputSizeStyles[size],\n            'pr-10'\n          )}\n          {...props}\n        />\n        <button\n          type=\"button\"\n          aria-label={copied ? locale.copyButton.copiedAria : locale.copyButton.copyAria}\n          className={cn(\n            'absolute inset-y-0 right-0 flex items-center px-3',\n            'text-muted-foreground hover:text-foreground',\n            'transition-colors duration-200',\n            'focus-visible:ring-ring/40 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n            'rounded-r-md'\n          )}\n          onClick={copy}\n        >\n          {copied ? (\n            <Check size={iconSize} className=\"text-success shrink-0\" />\n          ) : (\n            <Copy size={iconSize} className=\"shrink-0\" />\n          )}\n        </button>\n      </div>\n    )\n  }\n)\n\nCopyInput.displayName = 'CopyInput'\n","import { forwardRef, type InputHTMLAttributes, type ReactNode } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport type InputSize = 'sm' | 'md' | 'lg'\n\nexport interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {\n  /** Input size */\n  size?: InputSize\n  /** Error state */\n  error?: boolean\n  /** Error message */\n  errorMessage?: string\n  /** Left addon (icon or text) */\n  leftAddon?: ReactNode\n  /** Right addon (icon or text) */\n  rightAddon?: ReactNode\n  /** Full width */\n  fullWidth?: boolean\n}\n\nconst sizeStyles: Record<InputSize, string> = {\n  sm: 'h-8 px-3 text-xs',\n  md: 'h-10 px-3 text-sm',\n  lg: 'h-12 px-4 text-base',\n}\n\n/** Text input field with optional left/right addons and error display. */\nexport const Input = forwardRef<HTMLInputElement, InputProps>(\n  (\n    {\n      className,\n      type = 'text',\n      size = 'md',\n      error = false,\n      errorMessage,\n      leftAddon,\n      rightAddon,\n      fullWidth = false,\n      disabled,\n      ...props\n    },\n    ref\n  ) => {\n    const inputElement = (\n      <input\n        type={type}\n        ref={ref}\n        disabled={disabled}\n        className={cn(\n          'bg-background flex w-full rounded-md border',\n          'placeholder:text-muted-foreground',\n          'focus-visible:border-primary focus-visible:ring-ring/30 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n          'disabled:cursor-not-allowed disabled:opacity-50',\n          'transition-colors duration-200',\n          // Size\n          sizeStyles[size],\n          // Error state\n          error ? 'border-destructive focus-visible:ring-destructive' : 'border-input',\n          // Addon padding\n          leftAddon && 'pl-10',\n          rightAddon && 'pr-10',\n          className\n        )}\n        {...props}\n      />\n    )\n\n    if (!leftAddon && !rightAddon && !errorMessage) {\n      return inputElement\n    }\n\n    return (\n      <div className={cn('relative', fullWidth && 'w-full')}>\n        <div className=\"relative\">\n          {leftAddon && (\n            <div className=\"text-muted-foreground pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3\">\n              {leftAddon}\n            </div>\n          )}\n          {inputElement}\n          {rightAddon && (\n            <div className=\"text-muted-foreground absolute inset-y-0 right-0 flex items-center pr-3\">\n              {rightAddon}\n            </div>\n          )}\n        </div>\n        {errorMessage && <p className=\"text-destructive mt-1.5 text-xs\">{errorMessage}</p>}\n      </div>\n    )\n  }\n)\n\nInput.displayName = 'Input'\n","import { forwardRef, useState, useCallback } from 'react'\nimport { Eye, EyeOff } from 'lucide-react'\nimport { cn } from '../../utils/cn'\nimport { Input, type InputProps } from './Input'\nimport { useLocale } from '../../locale'\n\nexport interface PasswordInputProps extends Omit<InputProps, 'type' | 'rightAddon'> {\n  /** Control visibility externally (uncontrolled by default) */\n  visible?: boolean\n  /** Visibility change callback */\n  onVisibleChange?: (visible: boolean) => void\n}\n\n/**\n * Password input with a toggle button to show/hide the value.\n *\n * Wraps `<Input>` — all Input props (size, error, leftAddon, etc.) are supported.\n */\nexport const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(\n  ({ visible: controlledVisible, onVisibleChange, disabled, ...props }, ref) => {\n    const locale = useLocale()\n    const [internalVisible, setInternalVisible] = useState(false)\n    const isControlled = controlledVisible !== undefined\n    const visible = isControlled ? controlledVisible : internalVisible\n\n    const toggle = useCallback(() => {\n      const next = !visible\n      if (!isControlled) setInternalVisible(next)\n      onVisibleChange?.(next)\n    }, [visible, isControlled, onVisibleChange])\n\n    return (\n      <Input\n        ref={ref}\n        type={visible ? 'text' : 'password'}\n        disabled={disabled}\n        rightAddon={\n          <button\n            type=\"button\"\n            tabIndex={-1}\n            disabled={disabled}\n            onClick={toggle}\n            aria-label={visible ? locale.passwordInput.hide : locale.passwordInput.show}\n            className={cn(\n              'text-muted-foreground hover:text-foreground pointer-events-auto transition-colors',\n              'disabled:pointer-events-none disabled:opacity-50'\n            )}\n          >\n            {visible ? <EyeOff className=\"h-4 w-4\" /> : <Eye className=\"h-4 w-4\" />}\n          </button>\n        }\n        {...props}\n      />\n    )\n  }\n)\n\nPasswordInput.displayName = 'PasswordInput'\n","import { forwardRef, type HTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport type BadgeVariant =\n  | 'default'\n  | 'secondary'\n  | 'success'\n  | 'warning'\n  | 'destructive'\n  | 'outline'\n  | 'info'\n  | 'count'\n\nexport type BadgeSize = 'sm' | 'md'\n\nexport interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n  /** Badge style variant */\n  variant?: BadgeVariant\n  /** Badge size */\n  size?: BadgeSize\n  /** When `children` is a number (or numeric string) greater than `max`, render as `{max}+` (e.g., 150 with max=99 → \"99+\"). Non-numeric children pass through unchanged. */\n  max?: number\n}\n\nconst variantStyles: Record<BadgeVariant, string> = {\n  default: 'bg-primary text-primary-foreground',\n  secondary: 'bg-secondary text-secondary-foreground',\n  success: 'bg-success text-success-foreground',\n  warning: 'bg-warning text-warning-foreground',\n  destructive: 'bg-destructive text-destructive-foreground',\n  outline: 'border border-border text-foreground bg-transparent',\n  info: 'bg-info-soft text-info-soft-foreground',\n  count: 'bg-muted text-muted-foreground tabular-nums',\n}\n\nconst sizeStyles: Record<BadgeSize, string> = {\n  sm: 'px-2.5 py-0.5 text-xs leading-tight',\n  md: 'px-3 py-1 text-sm leading-snug',\n}\n\n/** Small inline label for status, categories, or counts with multiple color variants. */\nexport const Badge = forwardRef<HTMLSpanElement, BadgeProps>(\n  ({ className, variant = 'default', size = 'md', max, children, ...props }, ref) => {\n    const displayed = clampNumericChildren(children, max)\n    return (\n      <span\n        ref={ref}\n        className={cn(\n          'inline-flex items-center rounded-full font-medium transition-colors',\n          sizeStyles[size],\n          variantStyles[variant],\n          className\n        )}\n        {...props}\n      >\n        {displayed}\n      </span>\n    )\n  }\n)\n\nfunction clampNumericChildren(children: BadgeProps['children'], max: number | undefined) {\n  if (typeof max !== 'number') return children\n  const num =\n    typeof children === 'number'\n      ? children\n      : typeof children === 'string' && /^-?\\d+$/.test(children)\n        ? Number(children)\n        : null\n  if (num === null || num <= max) return children\n  return `${max}+`\n}\n\nBadge.displayName = 'Badge'\n","import { forwardRef, type HTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport interface InlineCodeProps extends HTMLAttributes<HTMLElement> {\n  /** Render as a different element (e.g. \"span\"). @default \"code\" */\n  as?: 'code' | 'span'\n}\n\n/**\n * Styled inline code snippet for displaying IDs, keys, short values, etc.\n */\nexport const InlineCode = forwardRef<HTMLElement, InlineCodeProps>(\n  ({ className, as: Tag = 'code', ...props }, ref) => (\n    <Tag\n      ref={ref as React.Ref<HTMLElement>}\n      className={cn('bg-muted text-foreground rounded px-1.5 py-0.5 font-mono text-xs', className)}\n      {...props}\n    />\n  )\n)\n\nInlineCode.displayName = 'InlineCode'\n","import { forwardRef, type SelectHTMLAttributes, type ReactNode } from 'react'\nimport { cn } from '../../utils/cn'\nimport { ChevronDown } from 'lucide-react'\n\nexport type SelectSize = 'sm' | 'md' | 'lg'\n\nexport interface SelectOption {\n  value: string\n  label: string\n  disabled?: boolean\n}\n\nexport interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size'> {\n  /** Select size */\n  size?: SelectSize\n  /** Placeholder text */\n  placeholder?: string\n  /** Options list */\n  options?: readonly SelectOption[]\n  /** Error state */\n  error?: boolean\n  /** Error message */\n  errorMessage?: string\n  /** Left icon */\n  leftIcon?: ReactNode\n  /** Full width */\n  fullWidth?: boolean\n}\n\nconst sizeStyles: Record<SelectSize, string> = {\n  sm: 'h-8 px-3 pr-8 text-xs',\n  md: 'h-10 px-3 pr-10 text-sm',\n  lg: 'h-12 px-4 pr-12 text-base',\n}\n\nconst iconSizeStyles: Record<SelectSize, string> = {\n  sm: 'right-2 h-3 w-3',\n  md: 'right-3 h-4 w-4',\n  lg: 'right-4 h-5 w-5',\n}\n\n/** Native select dropdown with icon, error state, and placeholder support. */\nexport const Select = forwardRef<HTMLSelectElement, SelectProps>(\n  (\n    {\n      className,\n      size = 'md',\n      placeholder,\n      options = [],\n      error = false,\n      errorMessage,\n      leftIcon,\n      fullWidth = false,\n      disabled,\n      children,\n      ...props\n    },\n    ref\n  ) => {\n    return (\n      <div className={cn('relative', fullWidth ? 'w-full' : 'w-fit')}>\n        <div className=\"relative\">\n          {leftIcon && (\n            <div className=\"text-muted-foreground pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3\">\n              {leftIcon}\n            </div>\n          )}\n          <select\n            ref={ref}\n            disabled={disabled}\n            className={cn(\n              'bg-background flex w-full appearance-none rounded-md border',\n              'focus-visible:border-primary focus-visible:ring-ring/30 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n              'disabled:cursor-not-allowed disabled:opacity-50',\n              'transition-colors duration-200',\n              sizeStyles[size],\n              error ? 'border-destructive focus-visible:ring-destructive' : 'border-input',\n              leftIcon && 'pl-10',\n              className\n            )}\n            {...props}\n          >\n            {placeholder && (\n              <option value=\"\" disabled>\n                {placeholder}\n              </option>\n            )}\n            {options.map((option) => (\n              <option key={option.value} value={option.value} disabled={option.disabled}>\n                {option.label}\n              </option>\n            ))}\n            {children}\n          </select>\n          <ChevronDown\n            className={cn(\n              'text-muted-foreground pointer-events-none absolute top-1/2 -translate-y-1/2',\n              iconSizeStyles[size]\n            )}\n          />\n        </div>\n        {errorMessage && <p className=\"text-destructive mt-1.5 text-xs\">{errorMessage}</p>}\n      </div>\n    )\n  }\n)\n\nSelect.displayName = 'Select'\n","import { forwardRef, useId, type InputHTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\nimport { Check } from 'lucide-react'\n\nexport type CheckboxSize = 'sm' | 'md' | 'lg'\n\nexport interface CheckboxProps extends Omit<\n  InputHTMLAttributes<HTMLInputElement>,\n  'size' | 'type'\n> {\n  /** Checkbox size */\n  size?: CheckboxSize\n  /** Label text */\n  label?: string\n  /** Description text */\n  description?: string\n  /** Error state */\n  error?: boolean\n  /** Error message */\n  errorMessage?: string\n}\n\nconst sizeStyles: Record<CheckboxSize, { box: string; icon: string; text: string }> = {\n  sm: {\n    box: 'h-4 w-4',\n    icon: 'h-3 w-3',\n    text: 'text-sm',\n  },\n  md: {\n    box: 'h-5 w-5',\n    icon: 'h-3.5 w-3.5',\n    text: 'text-sm',\n  },\n  lg: {\n    box: 'h-6 w-6',\n    icon: 'h-4 w-4',\n    text: 'text-base',\n  },\n}\n\n/** Styled checkbox input with optional label, description, and error state. */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n  (\n    {\n      className,\n      size = 'md',\n      label,\n      description,\n      error = false,\n      errorMessage,\n      disabled,\n      id,\n      ...props\n    },\n    ref\n  ) => {\n    const styles = sizeStyles[size]\n    const stableId = useId()\n    const checkboxId = id || stableId\n\n    return (\n      <div className={cn('flex items-start gap-3', className)}>\n        <div className=\"relative flex items-center\">\n          <input\n            type=\"checkbox\"\n            ref={ref}\n            id={checkboxId}\n            disabled={disabled}\n            className=\"peer sr-only\"\n            {...props}\n          />\n          <label\n            htmlFor={checkboxId}\n            className={cn(\n              'flex shrink-0 cursor-pointer items-center justify-center rounded border',\n              'peer-focus-visible:ring-ring/40 peer-focus-visible:ring-1 peer-focus-visible:ring-offset-0',\n              'peer-disabled:cursor-not-allowed peer-disabled:opacity-50',\n              'peer-checked:[&>svg]:opacity-100',\n              'transition-colors duration-200',\n              styles.box,\n              error\n                ? 'border-destructive'\n                : 'border-input peer-checked:border-primary peer-checked:bg-primary'\n            )}\n          >\n            <Check\n              aria-hidden=\"true\"\n              className={cn('text-primary-foreground opacity-0 transition-opacity', styles.icon)}\n            />\n          </label>\n        </div>\n        {(label || description || errorMessage) && (\n          <div className=\"space-y-1\">\n            {label && (\n              <label\n                htmlFor={checkboxId}\n                className={cn(\n                  'cursor-pointer leading-none font-medium',\n                  styles.text,\n                  disabled && 'cursor-not-allowed opacity-50'\n                )}\n              >\n                {label}\n              </label>\n            )}\n            {description && <p className=\"text-muted-foreground text-xs\">{description}</p>}\n            {errorMessage && <p className=\"text-destructive text-xs\">{errorMessage}</p>}\n          </div>\n        )}\n      </div>\n    )\n  }\n)\n\nCheckbox.displayName = 'Checkbox'\n","import { forwardRef, useId, type InputHTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\nimport { Check } from 'lucide-react'\n\nexport interface CheckboxCardProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {\n  /** Card title / label */\n  label: string\n  /** Optional description below the label */\n  description?: string\n  /** Error state */\n  error?: boolean\n  /** Error message */\n  errorMessage?: string\n}\n\n/**\n * Checkbox presented as a selectable card with label and description.\n *\n * Useful for feature toggles, permission lists, onboarding options, etc.\n */\nexport const CheckboxCard = forwardRef<HTMLInputElement, CheckboxCardProps>(\n  ({ className, label, description, error = false, errorMessage, disabled, id, ...props }, ref) => {\n    const stableId = useId()\n    const inputId = id || stableId\n\n    return (\n      <label\n        htmlFor={inputId}\n        className={cn(\n          'bg-background relative flex items-start gap-3 rounded-lg border p-4',\n          'transition-colors duration-200',\n          'has-[:checked]:bg-primary/5',\n          'has-[:focus-visible]:ring-ring/40 has-[:focus-visible]:ring-1 has-[:focus-visible]:ring-offset-0',\n          error ? 'border-destructive' : 'border-input has-[:checked]:border-primary',\n          disabled\n            ? 'cursor-not-allowed opacity-50'\n            : 'hover:border-muted-foreground/50 cursor-pointer',\n          className\n        )}\n      >\n        <input\n          ref={ref}\n          type=\"checkbox\"\n          id={inputId}\n          disabled={disabled}\n          className=\"peer sr-only\"\n          {...props}\n        />\n        <div\n          className={cn(\n            'mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded border',\n            'transition-colors duration-200',\n            'peer-checked:[&>svg]:opacity-100',\n            error\n              ? 'border-destructive'\n              : 'border-input peer-checked:border-primary peer-checked:bg-primary'\n          )}\n        >\n          <Check className=\"text-primary-foreground h-3.5 w-3.5 opacity-0 transition-opacity\" />\n        </div>\n        <div className=\"space-y-1\">\n          <div className=\"text-sm leading-none font-medium\">{label}</div>\n          {description && (\n            <p className=\"text-muted-foreground text-xs leading-relaxed\">{description}</p>\n          )}\n          {errorMessage && <p className=\"text-destructive text-xs\">{errorMessage}</p>}\n        </div>\n      </label>\n    )\n  }\n)\n\nCheckboxCard.displayName = 'CheckboxCard'\n","import { forwardRef, useId, type InputHTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport type RadioSize = 'sm' | 'md' | 'lg'\n\nexport interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {\n  /** Radio size */\n  size?: RadioSize\n  /** Label text */\n  label?: string\n  /** Description text */\n  description?: string\n  /** Error state */\n  error?: boolean\n  /** Error message */\n  errorMessage?: string\n}\n\nconst sizeStyles: Record<RadioSize, { outer: string; inner: string; text: string }> = {\n  sm: {\n    outer: 'h-4 w-4',\n    inner: 'h-2 w-2',\n    text: 'text-sm',\n  },\n  md: {\n    outer: 'h-5 w-5',\n    inner: 'h-2.5 w-2.5',\n    text: 'text-sm',\n  },\n  lg: {\n    outer: 'h-6 w-6',\n    inner: 'h-3 w-3',\n    text: 'text-base',\n  },\n}\n\n/** Single radio button input with optional label and description. */\nexport const Radio = forwardRef<HTMLInputElement, RadioProps>(\n  (\n    {\n      className,\n      size = 'md',\n      label,\n      description,\n      error = false,\n      errorMessage,\n      disabled,\n      id,\n      ...props\n    },\n    ref\n  ) => {\n    const styles = sizeStyles[size]\n    const stableId = useId()\n    const radioId = id || stableId\n\n    return (\n      <div className={cn('flex items-start gap-3', className)}>\n        <div className=\"relative flex items-center\">\n          <input\n            type=\"radio\"\n            ref={ref}\n            id={radioId}\n            disabled={disabled}\n            className=\"peer sr-only\"\n            {...props}\n          />\n          {/* 這個 label 是**視覺上的那顆圓**，本身刻意不含文字：它的存在是為了\n              讓點圓圈也能選取（htmlFor 指向 sr-only 的 input），而 input 的\n              accessible name 由下面帶 {label} 的第二個 label 提供。\n              硬塞文字進來只會讓 accessible name 被串接兩次。 */}\n          {/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}\n          <label\n            htmlFor={radioId}\n            className={cn(\n              'flex shrink-0 cursor-pointer items-center justify-center rounded-full border',\n              'peer-focus-visible:ring-ring/40 peer-focus-visible:ring-1 peer-focus-visible:ring-offset-0',\n              'peer-disabled:cursor-not-allowed peer-disabled:opacity-50',\n              'transition-colors duration-200',\n              'peer-checked:[&>div]:scale-100',\n              styles.outer,\n              error ? 'border-destructive' : 'border-input peer-checked:border-primary'\n            )}\n          >\n            <div\n              className={cn('bg-primary scale-0 rounded-full transition-transform', styles.inner)}\n            />\n          </label>\n        </div>\n        {(label || description || errorMessage) && (\n          <div className=\"space-y-1\">\n            {label && (\n              <label\n                htmlFor={radioId}\n                className={cn(\n                  'cursor-pointer leading-none font-medium',\n                  styles.text,\n                  disabled && 'cursor-not-allowed opacity-50'\n                )}\n              >\n                {label}\n              </label>\n            )}\n            {description && <p className=\"text-muted-foreground text-xs\">{description}</p>}\n            {errorMessage && <p className=\"text-destructive text-xs\">{errorMessage}</p>}\n          </div>\n        )}\n      </div>\n    )\n  }\n)\n\nRadio.displayName = 'Radio'\n\n// Radio Group component\nexport interface RadioGroupProps {\n  /** Group name */\n  name: string\n  /** Options */\n  options: Array<{\n    value: string\n    label: string\n    description?: string\n    disabled?: boolean\n  }>\n  /** Current value */\n  value?: string\n  /** Default value */\n  defaultValue?: string\n  /** On change handler */\n  onChange?: (value: string) => void\n  /** Radio size */\n  size?: RadioSize\n  /** Orientation */\n  orientation?: 'vertical' | 'horizontal'\n  /** Error state */\n  error?: boolean\n  /** Error message */\n  errorMessage?: string\n  /** Disabled state */\n  disabled?: boolean\n  /** Class name */\n  className?: string\n}\n\n/** Group of radio buttons rendered from an options array. */\nexport const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(\n  (\n    {\n      name,\n      options,\n      value,\n      defaultValue,\n      onChange,\n      size = 'md',\n      orientation = 'vertical',\n      error = false,\n      errorMessage,\n      disabled = false,\n      className,\n    },\n    ref\n  ) => {\n    const group = (\n      <div\n        ref={ref}\n        role=\"radiogroup\"\n        className={cn(\n          'flex',\n          orientation === 'vertical' ? 'flex-col gap-3' : 'flex-row gap-6',\n          className\n        )}\n      >\n        {options.map((option) => (\n          <Radio\n            key={option.value}\n            name={name}\n            value={option.value}\n            label={option.label}\n            description={option.description}\n            size={size}\n            error={error}\n            disabled={disabled || option.disabled}\n            checked={value !== undefined ? value === option.value : undefined}\n            defaultChecked={defaultValue === option.value}\n            onChange={(e) => onChange?.(e.target.value)}\n          />\n        ))}\n      </div>\n    )\n\n    if (!errorMessage) {\n      return group\n    }\n\n    return (\n      <div>\n        {group}\n        <p className=\"text-destructive mt-1.5 text-xs\">{errorMessage}</p>\n      </div>\n    )\n  }\n)\n\nRadioGroup.displayName = 'RadioGroup'\n","import { forwardRef, useId, type InputHTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport type ToggleSize = 'sm' | 'md' | 'lg'\n\nexport interface ToggleProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {\n  /** Toggle size */\n  size?: ToggleSize\n  /** Label text */\n  label?: string\n  /** Description text */\n  description?: string\n  /** Error state */\n  error?: boolean\n  /** Error message */\n  errorMessage?: string\n}\n\nconst sizeStyles: Record<ToggleSize, { track: string; thumb: string; checkedTranslate: string }> = {\n  sm: {\n    track: 'h-5 w-9',\n    thumb: 'h-4 w-4',\n    checkedTranslate: 'group-has-[:checked]:translate-x-4',\n  },\n  md: {\n    track: 'h-6 w-11',\n    thumb: 'h-5 w-5',\n    checkedTranslate: 'group-has-[:checked]:translate-x-5',\n  },\n  lg: {\n    track: 'h-7 w-14',\n    thumb: 'h-6 w-6',\n    checkedTranslate: 'group-has-[:checked]:translate-x-7',\n  },\n}\n\n/** On/off switch input with optional label and description. */\nexport const Toggle = forwardRef<HTMLInputElement, ToggleProps>(\n  (\n    {\n      className,\n      size = 'md',\n      label,\n      description,\n      error = false,\n      errorMessage,\n      disabled,\n      id,\n      ...props\n    },\n    ref\n  ) => {\n    const styles = sizeStyles[size]\n    const stableId = useId()\n    const toggleId = id || stableId\n\n    const toggle = (\n      <div className=\"group relative flex items-center\">\n        <label\n          htmlFor={toggleId}\n          className={cn(\n            'bg-input cursor-pointer rounded-full transition-colors duration-200',\n            'has-[:checked]:bg-primary',\n            'has-[:focus-visible]:ring-ring/40 has-[:focus-visible]:ring-1 has-[:focus-visible]:ring-offset-0',\n            'has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50',\n            error && 'ring-destructive ring-1',\n            styles.track\n          )}\n        >\n          <input\n            type=\"checkbox\"\n            role=\"switch\"\n            ref={ref}\n            id={toggleId}\n            disabled={disabled}\n            className=\"sr-only\"\n            {...props}\n          />\n          <div\n            className={cn(\n              'bg-background pointer-events-none rounded-full shadow-sm transition-transform duration-200',\n              'translate-x-0.5',\n              styles.checkedTranslate,\n              styles.thumb,\n              'mt-0.5'\n            )}\n          />\n        </label>\n      </div>\n    )\n\n    if (!label && !description && !errorMessage) {\n      return <div className={className}>{toggle}</div>\n    }\n\n    return (\n      <div className={cn('flex items-start gap-3', className)}>\n        {toggle}\n        <div className=\"space-y-1\">\n          {label && (\n            <label\n              htmlFor={toggleId}\n              className={cn(\n                'cursor-pointer text-sm leading-none font-medium',\n                disabled && 'cursor-not-allowed opacity-50'\n              )}\n            >\n              {label}\n            </label>\n          )}\n          {description && <p className=\"text-muted-foreground text-xs\">{description}</p>}\n          {errorMessage && <p className=\"text-destructive text-xs\">{errorMessage}</p>}\n        </div>\n      </div>\n    )\n  }\n)\n\nToggle.displayName = 'Toggle'\n","import { forwardRef, type HTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport interface KbdProps extends HTMLAttributes<HTMLElement> {\n  /** Visual size */\n  size?: 'sm' | 'md'\n}\n\n/** Inline keyboard shortcut badge rendered as a styled kbd element. */\nexport const Kbd = forwardRef<HTMLElement, KbdProps>(\n  ({ className, size = 'sm', children, ...props }, ref) => {\n    return (\n      <kbd\n        ref={ref}\n        className={cn(\n          'border-border bg-muted text-muted-foreground inline-flex items-center justify-center rounded border font-sans font-medium shadow-xs',\n          'select-none',\n          size === 'sm' && 'text-2xs min-w-5 px-1 py-0.5 leading-none',\n          size === 'md' && 'min-w-6 px-1.5 py-0.5 text-xs leading-none',\n          className\n        )}\n        {...props}\n      >\n        {children}\n      </kbd>\n    )\n  }\n)\n\nKbd.displayName = 'Kbd'\n","import { forwardRef, type HTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport type StatusType = 'online' | 'offline' | 'busy' | 'away'\nexport type StatusDotSize = 'xs' | 'sm' | 'md' | 'lg'\n\nexport interface StatusDotProps extends HTMLAttributes<HTMLSpanElement> {\n  /** Status type */\n  status: StatusType\n  /** Dot size */\n  size?: StatusDotSize\n  /** Show a pulse animation for online status */\n  pulse?: boolean\n}\n\nconst sizeStyles: Record<StatusDotSize, string> = {\n  xs: 'h-1.5 w-1.5',\n  sm: 'h-2 w-2',\n  md: 'h-2.5 w-2.5',\n  lg: 'h-3 w-3',\n}\n\nconst statusStyles: Record<StatusType, string> = {\n  online: 'bg-status-online',\n  offline: 'bg-status-offline',\n  busy: 'bg-status-busy',\n  away: 'bg-status-away',\n}\n\n/**\n * Tiny colored dot indicating presence or entity status.\n *\n * Uses semantic CSS variables (`--status-online`, etc.) so the palette\n * stays consistent across Avatar, Badge, and Table status columns.\n *\n * @example\n * ```tsx\n * <StatusDot status=\"online\" />\n * <StatusDot status=\"busy\" size=\"lg\" />\n * <span className=\"flex items-center gap-2\">\n *   <StatusDot status=\"online\" /> Active\n * </span>\n * ```\n */\nexport const StatusDot = forwardRef<HTMLSpanElement, StatusDotProps>(\n  ({ className, status, size = 'sm', pulse = false, ...props }, ref) => (\n    <span\n      ref={ref}\n      role=\"status\"\n      aria-label={status}\n      className={cn(\n        'inline-block shrink-0 rounded-full',\n        sizeStyles[size],\n        statusStyles[status],\n        pulse && status === 'online' && 'animate-pulse',\n        className\n      )}\n      {...props}\n    />\n  )\n)\n\nStatusDot.displayName = 'StatusDot'\n","import { forwardRef, useState, type HTMLAttributes, type ImgHTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\nimport { StatusDot, type StatusType, type StatusDotSize } from '../status-dot/StatusDot'\n\nexport type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\nexport type AvatarVariant = 'circle' | 'rounded' | 'square'\n\nexport interface AvatarProps extends ImgHTMLAttributes<HTMLImageElement> {\n  /** Avatar size */\n  size?: AvatarSize\n  /** Avatar shape variant */\n  variant?: AvatarVariant\n  /** Fallback initials when image fails to load */\n  fallback?: string\n  /** Alt text for the image */\n  alt?: string\n  /** Status indicator */\n  status?: StatusType\n}\n\nconst sizeStyles: Record<\n  AvatarSize,\n  { container: string; text: string; statusDot: StatusDotSize }\n> = {\n  xs: { container: 'h-6 w-6', text: 'text-xs', statusDot: 'xs' },\n  sm: { container: 'h-8 w-8', text: 'text-xs', statusDot: 'sm' },\n  md: { container: 'h-10 w-10', text: 'text-sm', statusDot: 'md' },\n  lg: { container: 'h-12 w-12', text: 'text-base', statusDot: 'md' },\n  xl: { container: 'h-16 w-16', text: 'text-lg', statusDot: 'lg' },\n  '2xl': { container: 'h-20 w-20', text: 'text-xl', statusDot: 'lg' },\n}\n\nconst variantStyles: Record<AvatarVariant, string> = {\n  circle: 'rounded-full',\n  rounded: 'rounded-lg',\n  square: 'rounded-none',\n}\n\nfunction getInitials(name: string): string {\n  const parts = name.trim().split(/\\s+/)\n  if (parts.length === 1) {\n    return parts[0].slice(0, 2).toUpperCase()\n  }\n  return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase()\n}\n\n/** Displays a user avatar image with fallback initials and an optional status indicator. */\nexport const Avatar = forwardRef<HTMLImageElement, AvatarProps>(\n  ({ className, size = 'md', variant = 'circle', fallback, alt, src, status, ...props }, ref) => {\n    const [imageError, setImageError] = useState(false)\n    const styles = sizeStyles[size]\n    const showFallback = !src || imageError\n\n    const containerClasses = cn(\n      'relative inline-flex items-center justify-center overflow-hidden bg-muted',\n      styles.container,\n      variantStyles[variant],\n      className\n    )\n\n    return (\n      <div className={containerClasses}>\n        {showFallback ? (\n          <span className={cn('text-muted-foreground font-medium select-none', styles.text)}>\n            {fallback ? getInitials(fallback) : alt ? getInitials(alt) : '?'}\n          </span>\n        ) : (\n          <img\n            ref={ref}\n            src={src}\n            alt={alt}\n            onError={() => setImageError(true)}\n            className=\"h-full w-full object-cover\"\n            {...props}\n          />\n        )}\n        {status && (\n          <StatusDot\n            status={status}\n            size={styles.statusDot}\n            className=\"ring-background absolute right-0 bottom-0 ring-2\"\n          />\n        )}\n      </div>\n    )\n  }\n)\n\nAvatar.displayName = 'Avatar'\n\nexport interface AvatarGroupProps extends HTMLAttributes<HTMLDivElement> {\n  /** Maximum number of avatars to show */\n  max?: number\n  /** Children avatars */\n  children: React.ReactNode\n  /** Size for all avatars */\n  size?: AvatarSize\n  /** Spacing between avatars (negative for overlap) */\n  spacing?: 'tight' | 'normal' | 'loose'\n  /** Additional class name */\n  className?: string\n}\n\nconst spacingStyles: Record<NonNullable<AvatarGroupProps['spacing']>, string> = {\n  tight: '-space-x-3',\n  normal: '-space-x-2',\n  loose: '-space-x-1',\n}\n\n/** Renders a stack of overlapping avatars with a \"+N\" overflow indicator. */\nexport const AvatarGroup = forwardRef<HTMLDivElement, AvatarGroupProps>(\n  ({ max = 5, children, size = 'md', spacing = 'normal', className, ...rest }, ref) => {\n    const childrenArray = Array.isArray(children) ? children : [children]\n    const visibleChildren = childrenArray.slice(0, max)\n    const remainingCount = childrenArray.length - max\n\n    return (\n      <div\n        ref={ref}\n        className={cn('flex items-center', spacingStyles[spacing], className)}\n        {...rest}\n      >\n        {visibleChildren}\n        {remainingCount > 0 && (\n          <div\n            className={cn(\n              'bg-muted ring-background inline-flex items-center justify-center ring-2',\n              sizeStyles[size].container,\n              sizeStyles[size].text,\n              'text-muted-foreground rounded-full font-medium'\n            )}\n          >\n            +{remainingCount}\n          </div>\n        )}\n      </div>\n    )\n  }\n)\n\nAvatarGroup.displayName = 'AvatarGroup'\n","import { forwardRef, type LabelHTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\n\nexport interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {\n  /** Required indicator */\n  required?: boolean\n  /** Optional text to show */\n  optional?: boolean\n  /** Description text */\n  description?: string\n}\n\n/** Form label with optional required/optional indicators and description text. */\nexport const Label = forwardRef<HTMLLabelElement, LabelProps>(\n  ({ className, children, required, optional, description, ...props }, ref) => {\n    const locale = useLocale()\n    return (\n      <div className=\"space-y-1\">\n        <label\n          ref={ref}\n          className={cn(\n            'text-sm leading-none font-medium',\n            'peer-disabled:cursor-not-allowed peer-disabled:opacity-70',\n            className\n          )}\n          {...props}\n        >\n          {children}\n          {required && (\n            <span className=\"text-destructive ml-1\" aria-hidden=\"true\">\n              *\n            </span>\n          )}\n          {optional && (\n            <span className=\"text-muted-foreground ml-1 font-normal\">{locale.label.optional}</span>\n          )}\n        </label>\n        {description && <p className=\"text-muted-foreground text-xs\">{description}</p>}\n      </div>\n    )\n  }\n)\n\nLabel.displayName = 'Label'\n","import { forwardRef, type ComponentPropsWithoutRef, type ReactNode } from 'react'\nimport * as PopoverPrimitive from '@radix-ui/react-popover'\nimport { cn } from '../../utils/cn'\n\nexport interface PopoverProps extends ComponentPropsWithoutRef<typeof PopoverPrimitive.Root> {\n  children: ReactNode\n}\n\nexport const Popover = PopoverPrimitive.Root\n\nexport const PopoverTrigger = PopoverPrimitive.Trigger\n\nexport const PopoverAnchor = PopoverPrimitive.Anchor\n\nexport const PopoverClose = PopoverPrimitive.Close\n\nexport interface PopoverContentProps extends ComponentPropsWithoutRef<\n  typeof PopoverPrimitive.Content\n> {\n  /** Show arrow pointing to trigger */\n  showArrow?: boolean\n}\n\n/** Positioned popover content panel with optional arrow indicator. */\nexport const PopoverContent = forwardRef<HTMLDivElement, PopoverContentProps>(\n  ({ className, align = 'center', sideOffset = 4, showArrow = false, children, ...props }, ref) => (\n    <PopoverPrimitive.Portal>\n      <PopoverPrimitive.Content\n        ref={ref}\n        align={align}\n        sideOffset={sideOffset}\n        className={cn(\n          'bg-card text-card-foreground z-50 w-72 rounded-lg border p-4 shadow-lg outline-none',\n          // Animation\n          'data-[state=open]:animate-in data-[state=closed]:animate-out',\n          'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n          'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\n          'data-[side=bottom]:slide-in-from-top-2',\n          'data-[side=left]:slide-in-from-right-2',\n          'data-[side=right]:slide-in-from-left-2',\n          'data-[side=top]:slide-in-from-bottom-2',\n          className\n        )}\n        {...props}\n      >\n        {children}\n        {showArrow && <PopoverPrimitive.Arrow className=\"fill-card stroke-border stroke-[1.5px]\" />}\n      </PopoverPrimitive.Content>\n    </PopoverPrimitive.Portal>\n  )\n)\n\nPopoverContent.displayName = 'PopoverContent'\n","import { forwardRef, type ComponentPropsWithoutRef, type ReactNode } from 'react'\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip'\nimport { cn } from '../../utils/cn'\n\nexport const TooltipProvider = TooltipPrimitive.Provider\n\nexport interface TooltipProps extends ComponentPropsWithoutRef<typeof TooltipPrimitive.Root> {\n  children: ReactNode\n}\n\nexport const Tooltip = TooltipPrimitive.Root\n\nexport const TooltipTrigger = TooltipPrimitive.Trigger\n\nexport type TooltipContentProps = ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n\n/** Styled tooltip content panel with enter/exit animations. */\nexport const TooltipContent = forwardRef<HTMLDivElement, TooltipContentProps>(\n  ({ className, sideOffset = 4, children, ...props }, ref) => (\n    <TooltipPrimitive.Portal>\n      <TooltipPrimitive.Content\n        ref={ref}\n        sideOffset={sideOffset}\n        className={cn(\n          'bg-foreground z-50 overflow-hidden rounded-md px-3 py-1.5',\n          'text-background text-xs shadow-md',\n          // Animation\n          'animate-in fade-in-0 zoom-in-95',\n          'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95',\n          'data-[side=bottom]:slide-in-from-top-2',\n          'data-[side=left]:slide-in-from-right-2',\n          'data-[side=right]:slide-in-from-left-2',\n          'data-[side=top]:slide-in-from-bottom-2',\n          className\n        )}\n        {...props}\n      >\n        {children}\n      </TooltipPrimitive.Content>\n    </TooltipPrimitive.Portal>\n  )\n)\n\nTooltipContent.displayName = 'TooltipContent'\n\n/** Convenient wrapper: wraps children with tooltip on hover */\nexport interface SimpleTooltipProps {\n  /** Tooltip text */\n  content: ReactNode\n  /** Side to show tooltip */\n  side?: 'top' | 'right' | 'bottom' | 'left'\n  /** Delay before showing (ms) */\n  delayDuration?: number\n  /** Additional class name applied to the tooltip content */\n  className?: string\n  children: ReactNode\n}\n\n/** Convenient wrapper that adds a tooltip to any child element on hover. */\nexport function SimpleTooltip({\n  content,\n  side = 'top',\n  delayDuration = 200,\n  className,\n  children,\n}: SimpleTooltipProps) {\n  return (\n    <Tooltip delayDuration={delayDuration}>\n      <TooltipTrigger asChild>{children}</TooltipTrigger>\n      <TooltipContent side={side} className={className}>\n        {content}\n      </TooltipContent>\n    </Tooltip>\n  )\n}\n","import { forwardRef, type ComponentPropsWithoutRef } from 'react'\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'\nimport { cn } from '../../utils/cn'\n\n/** Root component for a dropdown menu powered by Radix UI. */\nexport const DropdownMenu = DropdownMenuPrimitive.Root\n\nexport const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger\n\nexport const DropdownMenuGroup = DropdownMenuPrimitive.Group\n\nexport const DropdownMenuPortal = DropdownMenuPrimitive.Portal\n\nexport const DropdownMenuSub = DropdownMenuPrimitive.Sub\n\nexport const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup\n\n// --- Content ---\n\n/** Animated popover container that holds dropdown menu items. */\nexport const DropdownMenuContent = forwardRef<\n  HTMLDivElement,\n  ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n  <DropdownMenuPrimitive.Portal>\n    <DropdownMenuPrimitive.Content\n      ref={ref}\n      sideOffset={sideOffset}\n      className={cn(\n        'bg-card text-card-foreground z-50 min-w-[8rem] overflow-hidden rounded-lg border p-1 shadow-lg',\n        // Animation\n        'data-[state=open]:animate-in data-[state=closed]:animate-out',\n        'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n        'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\n        'data-[side=bottom]:slide-in-from-top-2',\n        'data-[side=left]:slide-in-from-right-2',\n        'data-[side=right]:slide-in-from-left-2',\n        'data-[side=top]:slide-in-from-bottom-2',\n        className\n      )}\n      {...props}\n    />\n  </DropdownMenuPrimitive.Portal>\n))\nDropdownMenuContent.displayName = 'DropdownMenuContent'\n\n// --- Item ---\n\n/** Interactive menu item within a dropdown menu. */\nexport const DropdownMenuItem = forwardRef<\n  HTMLDivElement,\n  ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n    /** Destructive action styling */\n    destructive?: boolean\n  }\n>(({ className, destructive = false, ...props }, ref) => (\n  <DropdownMenuPrimitive.Item\n    ref={ref}\n    className={cn(\n      'relative flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none select-none',\n      'focus:bg-secondary focus:text-secondary-foreground transition-colors',\n      'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n      destructive && 'text-destructive focus:bg-destructive/10 focus:text-destructive',\n      className\n    )}\n    {...props}\n  />\n))\nDropdownMenuItem.displayName = 'DropdownMenuItem'\n\n// --- Checkbox Item ---\n\n/** Menu item with a checkbox indicator for toggling options. */\nexport const DropdownMenuCheckboxItem = forwardRef<\n  HTMLDivElement,\n  ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n  <DropdownMenuPrimitive.CheckboxItem\n    ref={ref}\n    className={cn(\n      'relative flex cursor-pointer items-center rounded-md py-1.5 pr-2 pl-8 text-sm outline-none select-none',\n      'focus:bg-secondary focus:text-secondary-foreground transition-colors',\n      'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n      className\n    )}\n    checked={checked}\n    {...props}\n  >\n    <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n      <DropdownMenuPrimitive.ItemIndicator>\n        <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\" className=\"h-4 w-4\">\n          <path\n            d=\"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3354 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.5553 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z\"\n            fill=\"currentColor\"\n            fillRule=\"evenodd\"\n            clipRule=\"evenodd\"\n          />\n        </svg>\n      </DropdownMenuPrimitive.ItemIndicator>\n    </span>\n    {children}\n  </DropdownMenuPrimitive.CheckboxItem>\n))\nDropdownMenuCheckboxItem.displayName = 'DropdownMenuCheckboxItem'\n\n// --- Radio Item ---\n\n/** Menu item with a radio indicator for single-selection groups. */\nexport const DropdownMenuRadioItem = forwardRef<\n  HTMLDivElement,\n  ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n  <DropdownMenuPrimitive.RadioItem\n    ref={ref}\n    className={cn(\n      'relative flex cursor-pointer items-center rounded-md py-1.5 pr-2 pl-8 text-sm outline-none select-none',\n      'focus:bg-secondary focus:text-secondary-foreground transition-colors',\n      'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n      className\n    )}\n    {...props}\n  >\n    <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n      <DropdownMenuPrimitive.ItemIndicator>\n        <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\" className=\"h-2 w-2\">\n          <circle cx=\"7.5\" cy=\"7.5\" r=\"4.5\" fill=\"currentColor\" />\n        </svg>\n      </DropdownMenuPrimitive.ItemIndicator>\n    </span>\n    {children}\n  </DropdownMenuPrimitive.RadioItem>\n))\nDropdownMenuRadioItem.displayName = 'DropdownMenuRadioItem'\n\n// --- Label ---\n\n/** Non-interactive label used to title a group of menu items. */\nexport const DropdownMenuLabel = forwardRef<\n  HTMLDivElement,\n  ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n    inset?: boolean\n  }\n>(({ className, inset, ...props }, ref) => (\n  <DropdownMenuPrimitive.Label\n    ref={ref}\n    className={cn(\n      'text-muted-foreground px-2 py-1.5 text-xs font-semibold',\n      inset && 'pl-8',\n      className\n    )}\n    {...props}\n  />\n))\nDropdownMenuLabel.displayName = 'DropdownMenuLabel'\n\n// --- Separator ---\n\n/** Horizontal rule separating groups of menu items. */\nexport const DropdownMenuSeparator = forwardRef<\n  HTMLDivElement,\n  ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n  <DropdownMenuPrimitive.Separator\n    ref={ref}\n    className={cn('bg-border -mx-1 my-1 h-px', className)}\n    {...props}\n  />\n))\nDropdownMenuSeparator.displayName = 'DropdownMenuSeparator'\n\n// --- Shortcut (helper) ---\n\nexport function DropdownMenuShortcut({\n  className,\n  ...props\n}: React.HTMLAttributes<HTMLSpanElement>) {\n  return (\n    <span\n      className={cn('text-muted-foreground ml-auto text-xs tracking-widest', className)}\n      {...props}\n    />\n  )\n}\n\n// --- Sub Content ---\n\n/** Trigger that opens a nested submenu within a dropdown menu. */\nexport const DropdownMenuSubTrigger = forwardRef<\n  HTMLDivElement,\n  ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n    inset?: boolean\n  }\n>(({ className, inset, children, ...props }, ref) => (\n  <DropdownMenuPrimitive.SubTrigger\n    ref={ref}\n    className={cn(\n      'flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none select-none',\n      'focus:bg-secondary data-[state=open]:bg-secondary',\n      inset && 'pl-8',\n      className\n    )}\n    {...props}\n  >\n    {children}\n    <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\" className=\"ml-auto h-4 w-4\">\n      <path\n        d=\"M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n    </svg>\n  </DropdownMenuPrimitive.SubTrigger>\n))\nDropdownMenuSubTrigger.displayName = 'DropdownMenuSubTrigger'\n\n/** Animated content container for a dropdown submenu. */\nexport const DropdownMenuSubContent = forwardRef<\n  HTMLDivElement,\n  ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n  <DropdownMenuPrimitive.SubContent\n    ref={ref}\n    className={cn(\n      'bg-card text-card-foreground z-50 min-w-[8rem] overflow-hidden rounded-lg border p-1 shadow-lg',\n      'data-[state=open]:animate-in data-[state=closed]:animate-out',\n      'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n      'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\n      'data-[side=bottom]:slide-in-from-top-2',\n      'data-[side=left]:slide-in-from-right-2',\n      'data-[side=right]:slide-in-from-left-2',\n      'data-[side=top]:slide-in-from-bottom-2',\n      className\n    )}\n    {...props}\n  />\n))\nDropdownMenuSubContent.displayName = 'DropdownMenuSubContent'\n","import {\n  useState,\n  useRef,\n  useMemo,\n  useEffect,\n  useId,\n  forwardRef,\n  type KeyboardEvent,\n  type ReactNode,\n} from 'react'\nimport * as PopoverPrimitive from '@radix-ui/react-popover'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\n\nexport interface ComboboxOption {\n  value: string\n  label: string\n  description?: string\n  disabled?: boolean\n  icon?: ReactNode\n}\n\nexport type ComboboxSize = 'sm' | 'md' | 'lg'\n\nexport interface ComboboxProps {\n  /** Available options */\n  options: ComboboxOption[]\n  /** Current value (controlled) */\n  value?: string | string[]\n  /** Initial value for uncontrolled usage */\n  defaultValue?: string | string[]\n  /** Callback when value changes */\n  onChange?: (value: string | string[]) => void\n  /** Controlled open state of the dropdown */\n  open?: boolean\n  /** Initial open state of the dropdown for uncontrolled usage */\n  defaultOpen?: boolean\n  /** Called when the dropdown opens or closes */\n  onOpenChange?: (open: boolean) => void\n  /** Placeholder text */\n  placeholder?: string\n  /** Search placeholder */\n  searchPlaceholder?: string\n  /** Allow multiple selection */\n  multiple?: boolean\n  /** Disabled state */\n  disabled?: boolean\n  /** Error state */\n  error?: boolean\n  /** Error message */\n  errorMessage?: string\n  /** Empty state message */\n  emptyMessage?: string\n  /** Async search callback */\n  onSearch?: (query: string) => void\n  /** Loading state (for async search) */\n  loading?: boolean\n  /** Custom option renderer */\n  renderOption?: (option: ComboboxOption, selected: boolean) => ReactNode\n  /** Size variant */\n  size?: ComboboxSize\n  /** Full width */\n  fullWidth?: boolean\n  className?: string\n}\n\nconst triggerSizeStyles: Record<ComboboxSize, string> = {\n  sm: 'h-8 px-3 text-xs',\n  md: 'h-10 px-3 text-sm',\n  lg: 'h-12 px-4 text-base',\n}\n\nconst searchSizeStyles: Record<ComboboxSize, string> = {\n  sm: 'h-8 text-xs',\n  md: 'h-10 text-sm',\n  lg: 'h-12 text-base',\n}\n\nconst filterOptions = (options: ComboboxOption[], query: string) => {\n  if (!query) return options\n  const q = query.toLowerCase()\n  return options.filter(\n    (o) => o.label.toLowerCase().includes(q) || o.description?.toLowerCase().includes(q)\n  )\n}\n\n/** Searchable select dropdown with single or multi-select, async search, and custom option rendering. */\nexport const Combobox = forwardRef<HTMLButtonElement, ComboboxProps>(\n  (\n    {\n      options,\n      value,\n      defaultValue,\n      onChange,\n      open: openProp,\n      defaultOpen,\n      onOpenChange,\n      placeholder,\n      searchPlaceholder,\n      multiple = false,\n      disabled = false,\n      error = false,\n      errorMessage,\n      emptyMessage,\n      onSearch,\n      loading = false,\n      renderOption,\n      size = 'md',\n      fullWidth = false,\n      className,\n    },\n    ref\n  ) => {\n    const locale = useLocale()\n    const baseId = useId()\n    const listboxId = `${baseId}-listbox`\n    const valueId = `${baseId}-value`\n    const isValueControlled = value !== undefined\n    const [internalValue, setInternalValue] = useState<string | string[] | undefined>(defaultValue)\n    const currentValue = isValueControlled ? value : internalValue\n    const [internalOpen, setInternalOpen] = useState(defaultOpen ?? false)\n    const open = openProp ?? internalOpen\n    const [search, setSearch] = useState('')\n    const [highlightedIndex, setHighlightedIndex] = useState(-1)\n    const inputRef = useRef<HTMLInputElement>(null)\n\n    const setOpen = (nextOpen: boolean) => {\n      setInternalOpen(nextOpen)\n      if (nextOpen !== open) onOpenChange?.(nextOpen)\n    }\n\n    const selectedValues = useMemo(() => {\n      if (!currentValue) return new Set<string>()\n      return new Set(Array.isArray(currentValue) ? currentValue : [currentValue])\n    }, [currentValue])\n\n    const filtered = useMemo(() => {\n      if (onSearch) return options // async search handles filtering\n      return filterOptions(options, search)\n    }, [options, search, onSearch])\n\n    const showOptions = !loading && filtered.length > 0\n    const highlightedOption: ComboboxOption | undefined = filtered[highlightedIndex]\n\n    useEffect(() => {\n      if (highlightedIndex < 0) return\n      document\n        .getElementById(`${baseId}-option-${highlightedIndex}`)\n        ?.scrollIntoView?.({ block: 'nearest' })\n    }, [highlightedIndex, baseId])\n\n    const handleOpenChange = (nextOpen: boolean) => {\n      setOpen(nextOpen)\n      if (nextOpen) {\n        setHighlightedIndex(filtered.findIndex((o) => !o.disabled && selectedValues.has(o.value)))\n      }\n    }\n\n    const moveHighlight = (direction: 1 | -1) => {\n      if (filtered.length === 0) return\n      setHighlightedIndex((current) => {\n        let next = current === -1 && direction === -1 ? filtered.length - 1 : current + direction\n        while (next >= 0 && next < filtered.length && filtered[next].disabled) {\n          next += direction\n        }\n        if (next < 0 || next >= filtered.length) return current\n        return next\n      })\n    }\n\n    const handleSelect = (optionValue: string) => {\n      if (multiple) {\n        const next = new Set(selectedValues)\n        if (next.has(optionValue)) {\n          next.delete(optionValue)\n        } else {\n          next.add(optionValue)\n        }\n        const nextValues = Array.from(next)\n        if (!isValueControlled) setInternalValue(nextValues)\n        onChange?.(nextValues)\n      } else {\n        if (!isValueControlled) setInternalValue(optionValue)\n        onChange?.(optionValue)\n        setOpen(false)\n        setSearch('')\n      }\n    }\n\n    const handleSearchChange = (q: string) => {\n      setSearch(q)\n      onSearch?.(q)\n      const next = onSearch ? options : filterOptions(options, q)\n      setHighlightedIndex(next.findIndex((o) => !o.disabled))\n    }\n\n    const handleInputKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n      if (event.key === 'ArrowDown') {\n        event.preventDefault()\n        moveHighlight(1)\n      } else if (event.key === 'ArrowUp') {\n        event.preventDefault()\n        moveHighlight(-1)\n      } else if (event.key === 'Enter') {\n        if (highlightedOption && !highlightedOption.disabled) {\n          event.preventDefault()\n          handleSelect(highlightedOption.value)\n        }\n      }\n    }\n\n    const displayLabel = useMemo(() => {\n      if (selectedValues.size === 0) return null\n      if (multiple) {\n        const labels = options.filter((o) => selectedValues.has(o.value)).map((o) => o.label)\n        return labels.length > 0 ? labels : null\n      }\n      const selected = options.find((o) => selectedValues.has(o.value))\n      return selected ? [selected.label] : null\n    }, [selectedValues, options, multiple])\n\n    const combobox = (\n      <PopoverPrimitive.Root open={open} onOpenChange={handleOpenChange}>\n        <PopoverPrimitive.Trigger asChild>\n          <button\n            ref={ref}\n            disabled={disabled}\n            role=\"combobox\"\n            aria-haspopup=\"listbox\"\n            aria-expanded={open}\n            aria-controls={open && showOptions ? listboxId : undefined}\n            aria-labelledby={valueId}\n            onKeyDown={(event) => {\n              if (event.key === 'ArrowDown' && !open) {\n                event.preventDefault()\n                handleOpenChange(true)\n              }\n            }}\n            className={cn(\n              'bg-background flex items-center justify-between rounded-md border py-2',\n              fullWidth ? 'w-full' : 'w-fit',\n              triggerSizeStyles[size],\n              'ring-offset-background focus:ring-ring/40 focus:ring-1 focus:ring-offset-0 focus:outline-none',\n              'disabled:cursor-not-allowed disabled:opacity-50',\n              error && 'border-destructive focus:ring-destructive',\n              !error && 'border-input',\n              className\n            )}\n          >\n            <span id={valueId} className=\"flex flex-1 flex-wrap gap-1 truncate\">\n              {displayLabel ? (\n                multiple ? (\n                  displayLabel.map((label) => (\n                    <span\n                      key={label}\n                      className=\"bg-secondary inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium\"\n                    >\n                      {label}\n                    </span>\n                  ))\n                ) : (\n                  <span>{displayLabel[0]}</span>\n                )\n              ) : (\n                <span className=\"text-muted-foreground\">\n                  {placeholder ?? locale.combobox.placeholder}\n                </span>\n              )}\n            </span>\n            <svg\n              width=\"15\"\n              height=\"15\"\n              viewBox=\"0 0 15 15\"\n              fill=\"none\"\n              className=\"ml-2 h-4 w-4 shrink-0 opacity-50\"\n            >\n              <path\n                d=\"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.64245 3.00605 7.35753 3.00605 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z\"\n                fill=\"currentColor\"\n                fillRule=\"evenodd\"\n                clipRule=\"evenodd\"\n              />\n            </svg>\n          </button>\n        </PopoverPrimitive.Trigger>\n\n        <PopoverPrimitive.Portal>\n          <PopoverPrimitive.Content\n            className={cn(\n              'bg-card z-50 w-[var(--radix-popover-trigger-width)] rounded-lg border p-0 shadow-lg',\n              'data-[state=open]:animate-in data-[state=closed]:animate-out',\n              'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n              'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95'\n            )}\n            sideOffset={4}\n            onOpenAutoFocus={(e) => {\n              e.preventDefault()\n              inputRef.current?.focus()\n            }}\n            onKeyDown={(event) => {\n              if (event.key === 'Tab') {\n                handleOpenChange(false)\n              }\n            }}\n          >\n            {/* Search input */}\n            <div className=\"flex items-center border-b px-3\">\n              <svg\n                width=\"15\"\n                height=\"15\"\n                viewBox=\"0 0 15 15\"\n                fill=\"none\"\n                className=\"mr-2 h-4 w-4 shrink-0 opacity-50\"\n              >\n                <path\n                  d=\"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z\"\n                  fill=\"currentColor\"\n                  fillRule=\"evenodd\"\n                  clipRule=\"evenodd\"\n                />\n              </svg>\n              <input\n                ref={inputRef}\n                value={search}\n                onChange={(e) => handleSearchChange(e.target.value)}\n                onKeyDown={handleInputKeyDown}\n                aria-controls={showOptions ? listboxId : undefined}\n                aria-activedescendant={\n                  highlightedOption ? `${baseId}-option-${highlightedIndex}` : undefined\n                }\n                aria-autocomplete=\"list\"\n                placeholder={searchPlaceholder ?? locale.combobox.searchPlaceholder}\n                className={cn(\n                  'placeholder:text-muted-foreground flex w-full bg-transparent py-3 outline-none',\n                  searchSizeStyles[size]\n                )}\n              />\n            </div>\n\n            {/* Options list */}\n            <div\n              id={showOptions ? listboxId : undefined}\n              role={showOptions ? 'listbox' : undefined}\n              aria-multiselectable={showOptions && multiple ? true : undefined}\n              className=\"max-h-60 overflow-y-auto p-1\"\n            >\n              {loading ? (\n                <div className=\"text-muted-foreground py-6 text-center text-sm\">\n                  {locale.combobox.loading}\n                </div>\n              ) : filtered.length === 0 ? (\n                <div className=\"text-muted-foreground py-6 text-center text-sm\">\n                  {emptyMessage ?? locale.combobox.emptyMessage}\n                </div>\n              ) : (\n                filtered.map((option, index) => {\n                  const isSelected = selectedValues.has(option.value)\n                  const isHighlighted = index === highlightedIndex\n                  return (\n                    <button\n                      key={option.value}\n                      id={`${baseId}-option-${index}`}\n                      role=\"option\"\n                      aria-selected={isHighlighted}\n                      tabIndex={-1}\n                      disabled={option.disabled}\n                      onClick={() => handleSelect(option.value)}\n                      onMouseEnter={() => {\n                        if (!option.disabled) setHighlightedIndex(index)\n                      }}\n                      className={cn(\n                        'relative flex w-full cursor-pointer items-center rounded-md px-2 py-1.5 text-sm outline-none select-none',\n                        'hover:bg-secondary hover:text-secondary-foreground',\n                        'disabled:pointer-events-none disabled:opacity-50',\n                        isSelected && 'bg-primary/5',\n                        isHighlighted && 'bg-secondary text-secondary-foreground'\n                      )}\n                    >\n                      {renderOption ? (\n                        renderOption(option, isSelected)\n                      ) : (\n                        <>\n                          <span className=\"mr-2 flex h-4 w-4 items-center justify-center\">\n                            {isSelected && (\n                              <svg\n                                width=\"15\"\n                                height=\"15\"\n                                viewBox=\"0 0 15 15\"\n                                fill=\"none\"\n                                className=\"h-4 w-4\"\n                              >\n                                <path\n                                  d=\"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3354 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.5553 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z\"\n                                  fill=\"currentColor\"\n                                  fillRule=\"evenodd\"\n                                  clipRule=\"evenodd\"\n                                />\n                              </svg>\n                            )}\n                          </span>\n                          <div className=\"flex flex-col\">\n                            <span className=\"flex items-center gap-2\">\n                              {option.icon}\n                              {option.label}\n                            </span>\n                            {option.description && (\n                              <span className=\"text-muted-foreground text-xs\">\n                                {option.description}\n                              </span>\n                            )}\n                          </div>\n                        </>\n                      )}\n                    </button>\n                  )\n                })\n              )}\n            </div>\n          </PopoverPrimitive.Content>\n        </PopoverPrimitive.Portal>\n      </PopoverPrimitive.Root>\n    )\n\n    if (!errorMessage) {\n      return combobox\n    }\n\n    return (\n      <div className={fullWidth ? 'w-full' : 'w-fit'}>\n        {combobox}\n        <p className=\"text-destructive mt-1.5 text-xs\">{errorMessage}</p>\n      </div>\n    )\n  }\n)\n\nCombobox.displayName = 'Combobox'\n","import {\n  forwardRef,\n  useCallback,\n  useEffect,\n  useRef,\n  useState,\n  type ComponentPropsWithoutRef,\n  type ReactNode,\n} from 'react'\nimport { Command as CommandPrimitive } from 'cmdk'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\nimport { warnDeprecated } from '../../utils/deprecate'\n\n// --- Command (root) ---\n\n/** Root container for a cmdk-powered command menu. */\nexport const Command = forwardRef<\n  HTMLDivElement,\n  ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n  <CommandPrimitive\n    ref={ref}\n    className={cn(\n      'bg-card text-card-foreground flex h-full w-full flex-col overflow-hidden rounded-lg',\n      className\n    )}\n    {...props}\n  />\n))\nCommand.displayName = 'Command'\n\n// --- Input ---\n\n/** Search input field for filtering command palette items. */\nexport const CommandInput = forwardRef<\n  HTMLInputElement,\n  ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(({ className, ...props }, ref) => (\n  <div className=\"flex items-center border-b px-3\">\n    <svg\n      width=\"15\"\n      height=\"15\"\n      viewBox=\"0 0 15 15\"\n      fill=\"none\"\n      className=\"mr-2 h-4 w-4 shrink-0 opacity-50\"\n    >\n      <path\n        d=\"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n    </svg>\n    <CommandPrimitive.Input\n      ref={ref}\n      className={cn(\n        'flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none',\n        'placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',\n        className\n      )}\n      {...props}\n    />\n  </div>\n))\nCommandInput.displayName = 'CommandInput'\n\n// --- List ---\n\n/** Scrollable list container for command palette items. */\nexport const CommandList = forwardRef<\n  HTMLDivElement,\n  ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n  <CommandPrimitive.List\n    ref={ref}\n    className={cn('max-h-[300px] overflow-x-hidden overflow-y-auto', className)}\n    {...props}\n  />\n))\nCommandList.displayName = 'CommandList'\n\n// --- Empty ---\n\n/** Empty state placeholder shown when no command palette results match. */\nexport const CommandEmpty = forwardRef<\n  HTMLDivElement,\n  ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>(({ className, ...props }, ref) => (\n  <CommandPrimitive.Empty\n    ref={ref}\n    className={cn('text-muted-foreground py-6 text-center text-sm', className)}\n    {...props}\n  />\n))\nCommandEmpty.displayName = 'CommandEmpty'\n\n// --- Group ---\n\n/** Labeled group of related items within the command palette. */\nexport const CommandGroup = forwardRef<\n  HTMLDivElement,\n  ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n  <CommandPrimitive.Group\n    ref={ref}\n    className={cn(\n      'text-foreground overflow-hidden p-1',\n      '[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5',\n      '[&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-semibold',\n      '[&_[cmdk-group-heading]]:text-muted-foreground',\n      className\n    )}\n    {...props}\n  />\n))\nCommandGroup.displayName = 'CommandGroup'\n\n// --- Separator ---\n\n/** Horizontal divider line between command palette groups. */\nexport const CommandSeparator = forwardRef<\n  HTMLDivElement,\n  ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n  <CommandPrimitive.Separator\n    ref={ref}\n    role=\"none\"\n    className={cn('bg-border -mx-1 h-px', className)}\n    {...props}\n  />\n))\nCommandSeparator.displayName = 'CommandSeparator'\n\n// --- Item ---\n\n/** Selectable action item within the command palette. */\nexport const CommandItem = forwardRef<\n  HTMLDivElement,\n  ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(({ className, ...props }, ref) => (\n  <CommandPrimitive.Item\n    ref={ref}\n    className={cn(\n      'relative flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none select-none',\n      'data-[selected=true]:bg-secondary data-[selected=true]:text-secondary-foreground',\n      'data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50',\n      className\n    )}\n    {...props}\n  />\n))\nCommandItem.displayName = 'CommandItem'\n\n// --- Shortcut ---\n\n/** Displays keyboard shortcut hints alongside a command item. */\nexport function CommandShortcut({\n  className,\n  children,\n  ...props\n}: React.HTMLAttributes<HTMLSpanElement>) {\n  return (\n    <span className={cn('ml-auto flex items-center gap-1', className)} {...props}>\n      {typeof children === 'string'\n        ? children.split('+').map((key, i) => (\n            <kbd\n              key={i}\n              className=\"border-border bg-muted text-2xs text-muted-foreground inline-flex min-w-5 items-center justify-center rounded border px-1 py-0.5 font-sans leading-none font-medium shadow-xs select-none\"\n            >\n              {key.trim()}\n            </kbd>\n          ))\n        : children}\n    </span>\n  )\n}\n\n// --- Dialog (Cmd+K modal) ---\n\nexport interface CommandDialogProps {\n  /** Controlled open state */\n  open: boolean\n  /** Called when the dialog requests to close (Escape, backdrop click) */\n  onClose?: () => void\n  /** @deprecated use `onClose` instead — removed in v1.0 */\n  onOpenChange?: (open: boolean) => void\n  /** Close on escape key */\n  closeOnEscape?: boolean\n  /** Close on backdrop click */\n  closeOnBackdropClick?: boolean\n  /** Additional class name applied to the dialog content element */\n  className?: string\n  children: ReactNode\n}\n\n/** Modal overlay that wraps a Command component for use as a Cmd+K palette. */\nexport const CommandDialog = forwardRef<HTMLDivElement, CommandDialogProps>(\n  (\n    {\n      open,\n      onClose,\n      onOpenChange,\n      closeOnEscape = true,\n      closeOnBackdropClick = true,\n      className,\n      children,\n    },\n    ref\n  ) => {\n    const locale = useLocale()\n    const dialogRef = useRef<HTMLDivElement>(null)\n    const requestClose = useCallback(() => {\n      if (onClose) {\n        onClose()\n      } else if (onOpenChange) {\n        warnDeprecated('CommandDialog', 'onOpenChange', 'onClose')\n        onOpenChange(false)\n      }\n    }, [onClose, onOpenChange])\n\n    // Close on escape\n    useEffect(() => {\n      if (!open || !closeOnEscape) return\n      const handler = (e: KeyboardEvent) => {\n        if (e.key === 'Escape') {\n          requestClose()\n        }\n      }\n      document.addEventListener('keydown', handler)\n      return () => document.removeEventListener('keydown', handler)\n    }, [open, closeOnEscape, requestClose])\n\n    // Focus the search input on open — cmdk's Input doesn't autofocus\n    useEffect(() => {\n      if (!open) return\n      dialogRef.current?.querySelector<HTMLInputElement>('[cmdk-input]')?.focus()\n    }, [open])\n\n    if (!open) return null\n\n    return (\n      <div className=\"fixed inset-0 z-50\">\n        {/* Backdrop */}\n        {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events -- backdrop dismiss handled by Escape key listener */}\n        <div\n          className=\"animate-in fade-in-0 fixed inset-0 bg-black/50\"\n          onClick={closeOnBackdropClick ? requestClose : undefined}\n        />\n        {/* Dialog */}\n        <div\n          ref={(node) => {\n            ;(dialogRef as React.MutableRefObject<HTMLDivElement | null>).current = node\n            if (typeof ref === 'function') ref(node)\n            else if (ref) ref.current = node\n          }}\n          role=\"dialog\"\n          aria-label={locale.commandPalette.label}\n          className={cn(\n            'animate-in fade-in-0 zoom-in-95 fixed top-1/2 left-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2',\n            className\n          )}\n        >\n          <Command className=\"rounded-lg border shadow-2xl\">{children}</Command>\n        </div>\n      </div>\n    )\n  }\n)\nCommandDialog.displayName = 'CommandDialog'\n\n// --- useCommandPalette hook ---\n\nexport function useCommandPalette() {\n  const [open, setOpen] = useState(false)\n\n  useEffect(() => {\n    const handler = (e: KeyboardEvent) => {\n      if ((e.metaKey || e.ctrlKey) && e.key === 'k') {\n        e.preventDefault()\n        setOpen((prev) => !prev)\n      }\n    }\n    document.addEventListener('keydown', handler)\n    return () => document.removeEventListener('keydown', handler)\n  }, [])\n\n  return { open, setOpen }\n}\n","// Replaced statically by bundlers; declared here since the lib tsconfig has no node types.\ndeclare const process: { env: { NODE_ENV?: string } }\n\nconst warned = new Set<string>()\n\n/**\n * Dev-only, once-per-key deprecation warning for renamed props.\n * Aliases warned here are removed in v1.0.\n */\nexport function warnDeprecated(component: string, oldName: string, newName: string) {\n  if (process.env.NODE_ENV === 'production') return\n  const key = `${component}.${oldName}`\n  if (warned.has(key)) return\n  warned.add(key)\n  console.warn(\n    `[arkite-ui] ${component}: \\`${oldName}\\` is deprecated and will be removed in v1.0 — use \\`${newName}\\` instead.`\n  )\n}\n\n/**\n * Clears the once-per-key ledger. Test-only — the dedupe is what keeps a\n * warning from repeating on every render, so each test that asserts on a\n * warning needs a clean slate. Not exported from the package entrypoint.\n */\nexport function __resetWarnings() {\n  warned.clear()\n}\n\n/** Dev-only, once-per-key warning for incorrect prop combinations. */\nexport function warnUsage(component: string, key: string, message: string) {\n  if (process.env.NODE_ENV === 'production') return\n  const fullKey = `${component}.${key}`\n  if (warned.has(fullKey)) return\n  warned.add(fullKey)\n  console.warn(`[arkite-ui] ${component}: ${message}`)\n}\n","import {\n  createContext,\n  forwardRef,\n  useContext,\n  useState,\n  type HTMLAttributes,\n  type MouseEventHandler,\n  type ReactNode,\n  type Ref,\n} from 'react'\nimport { cn } from '../../utils/cn'\nimport { ChevronLeft, ChevronRight } from 'lucide-react'\nimport { useLocale } from '../../locale'\n\n// Sidebar Context\ninterface SidebarContextValue {\n  collapsed: boolean\n  setCollapsed: (collapsed: boolean) => void\n  collapsible: boolean\n}\n\nconst SidebarContext = createContext<SidebarContextValue | null>(null)\n\nexport function useSidebar() {\n  const context = useContext(SidebarContext)\n  if (!context) {\n    throw new Error('useSidebar must be used within a Sidebar')\n  }\n  return context\n}\n\n// Sidebar Root\nexport interface SidebarProps extends HTMLAttributes<HTMLElement> {\n  /** Collapsible sidebar */\n  collapsible?: boolean\n  /** Default collapsed state */\n  defaultCollapsed?: boolean\n  /** Controlled collapsed state */\n  collapsed?: boolean\n  /** On collapsed change */\n  onCollapsedChange?: (collapsed: boolean) => void\n  /** Sidebar width */\n  width?: string\n  /** Collapsed width */\n  collapsedWidth?: string\n}\n\n/** Collapsible sidebar navigation panel with controlled or uncontrolled state. */\nexport const Sidebar = forwardRef<HTMLElement, SidebarProps>(\n  (\n    {\n      className,\n      collapsible = true,\n      defaultCollapsed = false,\n      collapsed: controlledCollapsed,\n      onCollapsedChange,\n      width = '240px',\n      collapsedWidth = '64px',\n      children,\n      style,\n      ...props\n    },\n    ref\n  ) => {\n    const [uncontrolledCollapsed, setUncontrolledCollapsed] = useState(defaultCollapsed)\n\n    const collapsed = controlledCollapsed ?? uncontrolledCollapsed\n    const setCollapsed = (value: boolean) => {\n      setUncontrolledCollapsed(value)\n      onCollapsedChange?.(value)\n    }\n\n    return (\n      <SidebarContext.Provider value={{ collapsed, setCollapsed, collapsible }}>\n        <aside\n          ref={ref}\n          className={cn('bg-card flex flex-col border-r transition-all duration-300', className)}\n          style={{\n            width: collapsed ? collapsedWidth : width,\n            minWidth: collapsed ? collapsedWidth : width,\n            ...style,\n          }}\n          {...props}\n        >\n          {children}\n        </aside>\n      </SidebarContext.Provider>\n    )\n  }\n)\n\nSidebar.displayName = 'Sidebar'\n\n// Sidebar Header\nexport type SidebarHeaderProps = HTMLAttributes<HTMLDivElement>\n\n/** Header area at the top of the sidebar. */\nexport const SidebarHeader = forwardRef<HTMLDivElement, SidebarHeaderProps>(\n  ({ className, ...props }, ref) => {\n    const { collapsed } = useSidebar()\n\n    return (\n      <div\n        ref={ref}\n        className={cn(\n          'flex h-14 items-center border-b px-4',\n          collapsed && 'justify-center px-2',\n          className\n        )}\n        {...props}\n      />\n    )\n  }\n)\n\nSidebarHeader.displayName = 'SidebarHeader'\n\n// Sidebar Content\nexport type SidebarContentProps = HTMLAttributes<HTMLDivElement>\n\n/** Scrollable main content area of the sidebar. */\nexport const SidebarContent = forwardRef<HTMLDivElement, SidebarContentProps>(\n  ({ className, ...props }, ref) => (\n    <div ref={ref} className={cn('flex-1 overflow-auto py-2', className)} {...props} />\n  )\n)\n\nSidebarContent.displayName = 'SidebarContent'\n\n// Sidebar Footer\nexport type SidebarFooterProps = HTMLAttributes<HTMLDivElement>\n\n/** Footer area at the bottom of the sidebar. */\nexport const SidebarFooter = forwardRef<HTMLDivElement, SidebarFooterProps>(\n  ({ className, ...props }, ref) => {\n    const { collapsed } = useSidebar()\n\n    return (\n      <div ref={ref} className={cn('border-t p-4', collapsed && 'px-2', className)} {...props} />\n    )\n  }\n)\n\nSidebarFooter.displayName = 'SidebarFooter'\n\n// Sidebar Group\nexport interface SidebarGroupProps extends HTMLAttributes<HTMLDivElement> {\n  /** Group label */\n  label?: ReactNode\n}\n\n/** Labeled group of sidebar items. */\nexport const SidebarGroup = forwardRef<HTMLDivElement, SidebarGroupProps>(\n  ({ className, label, children, ...props }, ref) => {\n    const { collapsed } = useSidebar()\n\n    return (\n      <div ref={ref} className={cn('px-2 py-2', className)} {...props}>\n        {label && !collapsed && (\n          <div className=\"text-muted-foreground mb-2 px-2 text-xs font-medium tracking-wider uppercase\">\n            {label}\n          </div>\n        )}\n        <div className=\"space-y-1\">{children}</div>\n      </div>\n    )\n  }\n)\n\nSidebarGroup.displayName = 'SidebarGroup'\n\n// Sidebar Item\nexport interface SidebarItemProps extends HTMLAttributes<HTMLButtonElement> {\n  /** Item icon */\n  icon?: ReactNode\n  /** Active state */\n  active?: boolean\n  /** Disabled state */\n  disabled?: boolean\n  /** As link */\n  href?: string\n}\n\n/** Clickable navigation item within the sidebar, rendered as a button or link. */\nexport const SidebarItem = forwardRef<HTMLButtonElement | HTMLAnchorElement, SidebarItemProps>(\n  ({ className, icon, active, disabled, href, children, onClick, ...props }, ref) => {\n    const { collapsed } = useSidebar()\n\n    const content = (\n      <>\n        {icon && <span className={cn('shrink-0', collapsed ? '' : 'mr-3')}>{icon}</span>}\n        {!collapsed && <span className=\"truncate\">{children}</span>}\n      </>\n    )\n\n    const itemClassName = cn(\n      'flex w-full items-center rounded-md px-3 py-2 text-sm font-medium transition-colors',\n      'hover:bg-muted hover:text-foreground',\n      'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n      active && 'bg-primary/5 text-primary',\n      disabled && 'pointer-events-none opacity-50',\n      collapsed && 'justify-center px-2',\n      className\n    )\n\n    if (href) {\n      return (\n        <a\n          ref={ref as Ref<HTMLAnchorElement>}\n          href={href}\n          className={itemClassName}\n          onClick={onClick as MouseEventHandler<HTMLAnchorElement> | undefined}\n          {...(props as HTMLAttributes<HTMLAnchorElement>)}\n        >\n          {content}\n        </a>\n      )\n    }\n\n    return (\n      <button\n        ref={ref as Ref<HTMLButtonElement>}\n        type=\"button\"\n        disabled={disabled}\n        onClick={onClick}\n        className={itemClassName}\n        {...props}\n      >\n        {content}\n      </button>\n    )\n  }\n)\n\nSidebarItem.displayName = 'SidebarItem'\n\n// Sidebar Toggle\nexport type SidebarToggleProps = HTMLAttributes<HTMLButtonElement>\n\n/** Button that toggles the sidebar between collapsed and expanded states. */\nexport const SidebarToggle = forwardRef<HTMLButtonElement, SidebarToggleProps>(\n  ({ className, ...props }, ref) => {\n    const locale = useLocale()\n    const { collapsed, setCollapsed, collapsible } = useSidebar()\n\n    if (!collapsible) return null\n\n    return (\n      <button\n        ref={ref}\n        type=\"button\"\n        onClick={() => setCollapsed(!collapsed)}\n        className={cn(\n          'bg-background text-muted-foreground flex h-8 w-8 items-center justify-center rounded-md border',\n          'hover:text-foreground hover:bg-muted',\n          'focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none',\n          className\n        )}\n        {...props}\n      >\n        {collapsed ? <ChevronRight className=\"h-4 w-4\" /> : <ChevronLeft className=\"h-4 w-4\" />}\n        <span className=\"sr-only\">{locale.sidebar.toggle}</span>\n      </button>\n    )\n  }\n)\n\nSidebarToggle.displayName = 'SidebarToggle'\n","/**\n * TenantSwitcher - Tenant switching dropdown\n *\n * Props-driven: works with any state management solution.\n */\n\nimport {\n  forwardRef,\n  useCallback,\n  useState,\n  useRef,\n  useEffect,\n  type HTMLAttributes,\n  type ReactNode,\n} from 'react'\nimport { cn } from '../../utils/cn'\nimport { Badge, type BadgeVariant } from '../badge/Badge'\nimport { Spinner } from '../spinner/Spinner'\nimport { useLocale } from '../../locale'\nimport { warnDeprecated } from '../../utils/deprecate'\n\n// --- Types ---\n\nexport interface TenantItem {\n  /** Unique identifier */\n  id: string\n  /** Display name */\n  name: string\n  /** URL slug (used for search) */\n  slug?: string\n  /** Logo image URL */\n  logoUrl?: string\n  /** Status label */\n  status?: string\n  /** Status badge variant */\n  statusVariant?: BadgeVariant\n  /** Plan or secondary label */\n  planLabel?: string\n}\n\nexport interface TenantSwitcherProps extends Omit<\n  HTMLAttributes<HTMLDivElement>,\n  'onSelect' | 'onChange'\n> {\n  /** List of available tenants */\n  tenants: TenantItem[]\n  /** Currently selected tenant (null = all tenants / platform view) */\n  value?: TenantItem | null\n  /** Selection callback (null = all tenants / platform view) */\n  onChange?: (tenant: TenantItem | null) => void\n  /** @deprecated Use `value` instead — will be removed in v1.0. Ignored when `value` is provided. */\n  currentTenant?: TenantItem | null\n  /** @deprecated Use `onChange` instead — will be removed in v1.0. Ignored when `onChange` is provided. */\n  onSelect?: (tenant: TenantItem | null) => void\n  /** Async search callback (overrides local filtering) */\n  onSearch?: (query: string) => void\n  /** Loading state */\n  loading?: boolean\n  /** Show \"All Tenants\" option */\n  showAllOption?: boolean\n  /** \"All Tenants\" label */\n  allLabel?: string\n  /** \"All Tenants\" description */\n  allDescription?: string\n  /** Empty search message */\n  emptyMessage?: string\n  /** Search placeholder */\n  searchPlaceholder?: string\n  /** Custom tenant renderer */\n  renderTenant?: (tenant: TenantItem, selected: boolean) => ReactNode\n  className?: string\n}\n\n// --- Inline icons ---\n\nfunction ChevronDownIcon({ className }: { className?: string }) {\n  return (\n    <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\" className={className}>\n      <path\n        d=\"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n    </svg>\n  )\n}\n\nfunction SearchIcon({ className }: { className?: string }) {\n  return (\n    <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\" className={className}>\n      <path\n        d=\"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n    </svg>\n  )\n}\n\nfunction CheckIcon({ className }: { className?: string }) {\n  return (\n    <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\" className={className}>\n      <path\n        d=\"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3354 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.5553 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n    </svg>\n  )\n}\n\nfunction BuildingIcon({ className }: { className?: string }) {\n  return (\n    <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\" className={className}>\n      <path\n        d=\"M7.5 0.5C7.77614 0.5 8 0.723858 8 1V2H12.5C12.7761 2 13 2.22386 13 2.5V14.5C13 14.7761 12.7761 15 12.5 15H2.5C2.22386 15 2 14.7761 2 14.5V2.5C2 2.22386 2.22386 2 2.5 2H7V1C7 0.723858 7.22386 0.5 7.5 0.5ZM3 3V14H7V11.5C7 11.2239 7.22386 11 7.5 11C7.77614 11 8 11.2239 8 11.5V14H12V3H3ZM5 5H4V6H5V5ZM4 7H5V8H4V7ZM5 9H4V10H5V9ZM10 5H11V6H10V5ZM11 7H10V8H11V7ZM10 9H11V10H10V9ZM8 5H7V6H8V5ZM7 7H8V8H7V7Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n    </svg>\n  )\n}\n\nfunction GlobeIcon({ className }: { className?: string }) {\n  return (\n    <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\" className={className}>\n      <path\n        d=\"M7.49996 1.80002C4.35194 1.80002 1.79996 4.352 1.79996 7.50002C1.79996 10.648 4.35194 13.2 7.49996 13.2C10.648 13.2 13.2 10.648 13.2 7.50002C13.2 4.352 10.648 1.80002 7.49996 1.80002ZM0.899963 7.50002C0.899963 3.85494 3.85488 0.900024 7.49996 0.900024C11.145 0.900024 14.1 3.85494 14.1 7.50002C14.1 11.1451 11.145 14.1 7.49996 14.1C3.85488 14.1 0.899963 11.1451 0.899963 7.50002Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n      <path\n        d=\"M13.4999 7.89998H1.49994V7.09998H13.4999V7.89998Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n      <path\n        d=\"M7.09991 13.5V1.5H7.89991V13.5H7.09991Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n      <path\n        d=\"M10.375 7.49998C10.375 5.32724 9.59364 3.17778 8.06183 1.75656L8.53793 1.24341C10.2396 2.82218 11.075 5.17273 11.075 7.49998C11.075 9.82724 10.2396 12.1778 8.53793 13.7566L8.06183 13.2434C9.59364 11.8222 10.375 9.67273 10.375 7.49998Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n      <path\n        d=\"M4.62503 7.49998C4.62503 5.32724 5.40642 3.17778 6.93823 1.75656L6.46213 1.24341C4.7605 2.82218 3.92503 5.17273 3.92503 7.49998C3.92503 9.82724 4.7605 12.1778 6.46213 13.7566L6.93823 13.2434C5.40642 11.8222 4.62503 9.67273 4.62503 7.49998Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n    </svg>\n  )\n}\n\n// --- Component ---\n\n/** Dropdown for switching between tenants with search and optional \"All Tenants\" view. */\nexport const TenantSwitcher = forwardRef<HTMLDivElement, TenantSwitcherProps>(\n  (\n    {\n      tenants = [],\n      value,\n      onChange,\n      currentTenant,\n      onSelect,\n      onSearch,\n      loading = false,\n      showAllOption = true,\n      allLabel,\n      allDescription,\n      emptyMessage,\n      searchPlaceholder,\n      renderTenant,\n      className,\n      ...rest\n    },\n    ref\n  ) => {\n    if (currentTenant !== undefined) {\n      warnDeprecated('TenantSwitcher', 'currentTenant', 'value')\n    }\n    if (onSelect) {\n      warnDeprecated('TenantSwitcher', 'onSelect', 'onChange')\n    }\n    const selectedTenant = (value !== undefined ? value : currentTenant) ?? null\n    const handleChange = onChange ?? onSelect\n\n    const locale = useLocale()\n    const resolvedAllLabel = allLabel ?? locale.tenantSwitcher.allLabel\n    const [isOpen, setIsOpen] = useState(false)\n    const [search, setSearch] = useState('')\n    const dropdownRef = useRef<HTMLDivElement | null>(null)\n    const searchInputRef = useRef<HTMLInputElement>(null)\n\n    const setRootRef = useCallback(\n      (node: HTMLDivElement | null) => {\n        dropdownRef.current = node\n        if (typeof ref === 'function') {\n          ref(node)\n        } else if (ref) {\n          ref.current = node\n        }\n      },\n      [ref]\n    )\n\n    // Close on click outside\n    useEffect(() => {\n      const handleClickOutside = (event: MouseEvent) => {\n        if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {\n          setIsOpen(false)\n          setSearch('')\n        }\n      }\n      document.addEventListener('mousedown', handleClickOutside)\n      return () => document.removeEventListener('mousedown', handleClickOutside)\n    }, [])\n\n    // Focus search on open\n    useEffect(() => {\n      if (isOpen && searchInputRef.current) {\n        searchInputRef.current.focus()\n      }\n    }, [isOpen])\n\n    // Filter tenants (local filtering unless onSearch is provided)\n    const filteredTenants = onSearch\n      ? tenants\n      : tenants.filter((t) => {\n          const q = search.toLowerCase()\n          return t.name.toLowerCase().includes(q) || (t.slug?.toLowerCase().includes(q) ?? false)\n        })\n\n    const handleSearchChange = (q: string) => {\n      setSearch(q)\n      onSearch?.(q)\n    }\n\n    const handleSelect = (tenant: TenantItem | null) => {\n      handleChange?.(tenant)\n      setIsOpen(false)\n      setSearch('')\n    }\n\n    return (\n      <div ref={setRootRef} className={cn('relative', className)} {...rest}>\n        {/* Trigger */}\n        <button\n          type=\"button\"\n          aria-expanded={isOpen}\n          aria-haspopup=\"listbox\"\n          onClick={() => setIsOpen(!isOpen)}\n          className={cn(\n            'flex items-center gap-2 rounded-md px-3 py-2',\n            'bg-card hover:bg-secondary',\n            'border-border border shadow-sm',\n            'text-sm font-medium',\n            'transition-colors duration-200',\n            'max-w-[240px] min-w-[180px]'\n          )}\n        >\n          <div className=\"flex min-w-0 flex-1 items-center gap-2\">\n            {selectedTenant ? (\n              <>\n                <BuildingIcon className=\"text-muted-foreground h-4 w-4 shrink-0\" />\n                <span className=\"truncate\">{selectedTenant.name}</span>\n              </>\n            ) : (\n              <>\n                <GlobeIcon className=\"text-primary h-4 w-4 shrink-0\" />\n                <span className=\"text-primary\">{resolvedAllLabel}</span>\n              </>\n            )}\n          </div>\n          <ChevronDownIcon\n            className={cn(\n              'text-muted-foreground h-4 w-4 shrink-0 transition-transform duration-200',\n              isOpen && 'rotate-180'\n            )}\n          />\n        </button>\n\n        {/* Dropdown */}\n        {isOpen && (\n          <div\n            className={cn(\n              'absolute top-full left-0 z-50 mt-1',\n              'max-h-[400px] w-[280px]',\n              'bg-card border-border rounded-lg border shadow-lg',\n              'overflow-hidden'\n            )}\n          >\n            {/* Search */}\n            <div className=\"border-border border-b p-2\">\n              <div className=\"relative\">\n                <SearchIcon className=\"text-muted-foreground absolute top-1/2 left-2.5 h-4 w-4 -translate-y-1/2\" />\n                <input\n                  ref={searchInputRef}\n                  type=\"text\"\n                  placeholder={searchPlaceholder ?? locale.tenantSwitcher.searchPlaceholder}\n                  value={search}\n                  onChange={(e) => handleSearchChange(e.target.value)}\n                  className={cn(\n                    'h-9 w-full pr-3 pl-8 text-sm',\n                    'bg-background border-input rounded-md border',\n                    'focus:ring-ring focus:ring-2 focus:outline-none'\n                  )}\n                />\n              </div>\n            </div>\n\n            {/* Options */}\n            <div className=\"max-h-[320px] overflow-y-auto\">\n              {loading ? (\n                <div className=\"flex items-center justify-center py-8\">\n                  <Spinner size=\"md\" />\n                </div>\n              ) : (\n                <>\n                  {/* All Tenants option */}\n                  {showAllOption && (\n                    <>\n                      <button\n                        type=\"button\"\n                        onClick={() => handleSelect(null)}\n                        className={cn(\n                          'flex w-full items-center gap-3 px-3 py-2.5',\n                          'hover:bg-muted transition-colors',\n                          'text-left',\n                          !selectedTenant && 'bg-secondary'\n                        )}\n                      >\n                        <div className=\"bg-primary/10 flex h-8 w-8 items-center justify-center rounded-md\">\n                          <GlobeIcon className=\"text-primary h-4 w-4\" />\n                        </div>\n                        <div className=\"min-w-0 flex-1\">\n                          <p className=\"text-primary text-sm font-medium\">{resolvedAllLabel}</p>\n                          <p className=\"text-muted-foreground text-xs\">\n                            {allDescription ?? locale.tenantSwitcher.allDescription}\n                          </p>\n                        </div>\n                        {!selectedTenant && <CheckIcon className=\"text-primary h-4 w-4 shrink-0\" />}\n                      </button>\n                      <div className=\"bg-border mx-2 my-1 h-px\" />\n                    </>\n                  )}\n\n                  {/* Tenant list */}\n                  {filteredTenants.length === 0 ? (\n                    <div className=\"text-muted-foreground px-3 py-6 text-center text-sm\">\n                      {emptyMessage ?? locale.tenantSwitcher.emptyMessage}\n                    </div>\n                  ) : (\n                    filteredTenants.map((tenant) => {\n                      const selected = selectedTenant?.id === tenant.id\n                      if (renderTenant) {\n                        return (\n                          <button\n                            key={tenant.id}\n                            type=\"button\"\n                            onClick={() => handleSelect(tenant)}\n                            className=\"hover:bg-muted w-full text-left transition-colors\"\n                          >\n                            {renderTenant(tenant, selected)}\n                          </button>\n                        )\n                      }\n                      return (\n                        <button\n                          key={tenant.id}\n                          type=\"button\"\n                          onClick={() => handleSelect(tenant)}\n                          className={cn(\n                            'flex w-full items-center gap-3 px-3 py-2.5',\n                            'hover:bg-muted transition-colors',\n                            'text-left',\n                            selected && 'bg-secondary'\n                          )}\n                        >\n                          <div className=\"bg-secondary text-secondary-foreground flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium\">\n                            {tenant.logoUrl ? (\n                              <img\n                                src={tenant.logoUrl}\n                                alt={tenant.name}\n                                className=\"h-8 w-8 rounded-md object-cover\"\n                              />\n                            ) : (\n                              tenant.name.charAt(0).toUpperCase()\n                            )}\n                          </div>\n                          <div className=\"min-w-0 flex-1\">\n                            <p className=\"truncate text-sm font-medium\">{tenant.name}</p>\n                            <div className=\"flex items-center gap-2\">\n                              {tenant.planLabel && (\n                                <span className=\"text-muted-foreground text-xs\">\n                                  {tenant.planLabel}\n                                </span>\n                              )}\n                              {tenant.status && (\n                                <Badge\n                                  variant={tenant.statusVariant || 'secondary'}\n                                  className=\"text-2xs px-1.5 py-0\"\n                                >\n                                  {tenant.status}\n                                </Badge>\n                              )}\n                            </div>\n                          </div>\n                          {selected && <CheckIcon className=\"text-primary h-4 w-4 shrink-0\" />}\n                        </button>\n                      )\n                    })\n                  )}\n                </>\n              )}\n            </div>\n          </div>\n        )}\n      </div>\n    )\n  }\n)\n\nTenantSwitcher.displayName = 'TenantSwitcher'\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport interface NavbarProps extends HTMLAttributes<HTMLElement> {\n  /** Sticky navbar */\n  sticky?: boolean\n  /** Bordered navbar */\n  bordered?: boolean\n  /** Navbar height */\n  height?: string\n}\n\n/** Top navigation bar with optional sticky positioning and bottom border. */\nexport const Navbar = forwardRef<HTMLElement, NavbarProps>(\n  (\n    { className, sticky = false, bordered = true, height = '64px', style, children, ...props },\n    ref\n  ) => (\n    <header\n      ref={ref}\n      className={cn(\n        'bg-background flex items-center px-4',\n        sticky && 'sticky top-0 z-40',\n        bordered && 'border-b',\n        className\n      )}\n      style={{ height, ...style }}\n      {...props}\n    >\n      {children}\n    </header>\n  )\n)\n\nNavbar.displayName = 'Navbar'\n\n// Navbar Brand\nexport interface NavbarBrandProps extends HTMLAttributes<HTMLDivElement> {\n  /** Logo element */\n  logo?: ReactNode\n  /** Brand name */\n  name?: ReactNode\n  /** Link href */\n  href?: string\n  /** Custom link renderer for framework integration (React Router, Next.js). Only used when `href` is set; defaults to a native `<a>`. */\n  renderLink?: (props: {\n    href: string\n    children: ReactNode\n    className?: string\n    active?: boolean\n  }) => ReactNode\n}\n\n/** Brand section of the navbar displaying a logo and/or name. */\nexport const NavbarBrand = forwardRef<HTMLDivElement, NavbarBrandProps>(\n  ({ className, logo, name, href, renderLink, children, ...props }, ref) => {\n    const content = (\n      <>\n        {logo && <span className=\"shrink-0\">{logo}</span>}\n        {name && <span className=\"font-bold\">{name}</span>}\n        {children}\n      </>\n    )\n\n    if (href) {\n      return (\n        <div ref={ref} className={cn('flex items-center gap-2', className)} {...props}>\n          {renderLink ? (\n            renderLink({\n              href,\n              children: content,\n              className: 'flex items-center gap-2 hover:opacity-80',\n            })\n          ) : (\n            <a href={href} className=\"flex items-center gap-2 hover:opacity-80\">\n              {content}\n            </a>\n          )}\n        </div>\n      )\n    }\n\n    return (\n      <div ref={ref} className={cn('flex items-center gap-2', className)} {...props}>\n        {content}\n      </div>\n    )\n  }\n)\n\nNavbarBrand.displayName = 'NavbarBrand'\n\n// Navbar Content\nexport interface NavbarContentProps extends HTMLAttributes<HTMLDivElement> {\n  /** Content alignment */\n  align?: 'left' | 'center' | 'right'\n}\n\n/** Flexible content area within the navbar with configurable alignment. */\nexport const NavbarContent = forwardRef<HTMLDivElement, NavbarContentProps>(\n  ({ className, align = 'left', ...props }, ref) => {\n    const alignStyles = {\n      left: 'justify-start',\n      center: 'justify-center',\n      right: 'justify-end ml-auto',\n    }\n\n    return (\n      <div\n        ref={ref}\n        className={cn('flex items-center gap-4', alignStyles[align], className)}\n        {...props}\n      />\n    )\n  }\n)\n\nNavbarContent.displayName = 'NavbarContent'\n\n// Navbar Item\nexport interface NavbarItemProps extends HTMLAttributes<HTMLDivElement> {\n  /** Active state */\n  active?: boolean\n}\n\n/** Individual item wrapper within the navbar. */\nexport const NavbarItem = forwardRef<HTMLDivElement, NavbarItemProps>(\n  ({ className, active, children, ...props }, ref) => (\n    <div\n      ref={ref}\n      className={cn('flex items-center', active && 'text-primary', className)}\n      {...props}\n    >\n      {children}\n    </div>\n  )\n)\n\nNavbarItem.displayName = 'NavbarItem'\n\n// Navbar Link\nexport interface NavbarLinkProps extends HTMLAttributes<HTMLAnchorElement> {\n  /** Link href */\n  href?: string\n  /** Active state */\n  active?: boolean\n  /** Custom link renderer for framework integration (React Router, Next.js). Only used when `href` is set; defaults to a native `<a>` (ref and extra DOM props are not forwarded to a custom link). */\n  renderLink?: (props: {\n    href: string\n    children: ReactNode\n    className?: string\n    active?: boolean\n  }) => ReactNode\n}\n\n/** Styled anchor link for use within the navbar. */\nexport const NavbarLink = forwardRef<HTMLAnchorElement, NavbarLinkProps>(\n  ({ className, href, active, renderLink, children, ...props }, ref) => {\n    const linkClassName = cn(\n      'text-sm font-medium transition-colors hover:text-foreground',\n      active ? 'text-foreground' : 'text-muted-foreground',\n      className\n    )\n\n    if (renderLink && href != null) {\n      return <>{renderLink({ href, children, className: linkClassName, active })}</>\n    }\n\n    return (\n      <a ref={ref} href={href} className={linkClassName} {...props}>\n        {children}\n      </a>\n    )\n  }\n)\n\nNavbarLink.displayName = 'NavbarLink'\n\n// Navbar Divider\nexport type NavbarDividerProps = HTMLAttributes<HTMLDivElement>\n\n/** Vertical divider line between navbar items. */\nexport const NavbarDivider = forwardRef<HTMLDivElement, NavbarDividerProps>(\n  ({ className, ...props }, ref) => (\n    <div ref={ref} className={cn('bg-border h-6 w-px', className)} {...props} />\n  )\n)\n\nNavbarDivider.displayName = 'NavbarDivider'\n\n// Navbar Spacer\nexport type NavbarSpacerProps = HTMLAttributes<HTMLDivElement>\n\n/** Flexible spacer that pushes adjacent navbar items apart. */\nexport const NavbarSpacer = forwardRef<HTMLDivElement, NavbarSpacerProps>(\n  ({ className, ...props }, ref) => <div ref={ref} className={cn('flex-1', className)} {...props} />\n)\n\nNavbarSpacer.displayName = 'NavbarSpacer'\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\nimport { warnDeprecated } from '../../utils/deprecate'\nimport { ChevronRight, Home } from 'lucide-react'\n\n/**\n * Data shape for one breadcrumb trail entry.\n *\n * Renamed from `BreadcrumbItem` in v1.0 — `BreadcrumbItem` is now the\n * compound `<li>` component (formerly `BreadcrumbItemComponent`).\n */\nexport interface BreadcrumbItemData {\n  /** Item label */\n  label: ReactNode\n  /** Item href */\n  href?: string\n  /** Item icon */\n  icon?: ReactNode\n}\n\nexport interface BreadcrumbProps extends HTMLAttributes<HTMLElement> {\n  /** Breadcrumb items */\n  items: BreadcrumbItemData[]\n  /** Custom separator */\n  separator?: ReactNode\n  /** Show home icon */\n  showHomeIcon?: boolean\n  /** Max items to show (others collapsed) */\n  maxItems?: number\n  /**\n   * Custom link renderer for framework integration (React Router, Next.js).\n   *\n   * Called for every item that has an `href` with `{ href, children, className, active }`\n   * (`active` is true for the last item); items without an `href` keep the default\n   * non-interactive rendering. Breaking change in v1.0: the old\n   * `(item, isLast) => ReactNode` signature is no longer supported.\n   */\n  renderLink?: (props: {\n    href: string\n    children: ReactNode\n    className?: string\n    active?: boolean\n  }) => ReactNode\n}\n\n/** Navigation breadcrumb trail with collapsible items, custom separators, and link rendering. */\nexport const Breadcrumb = forwardRef<HTMLElement, BreadcrumbProps>(\n  ({ className, items, separator, showHomeIcon = false, maxItems, renderLink, ...props }, ref) => {\n    const locale = useLocale()\n    const separatorElement = separator || <ChevronRight className=\"text-muted-foreground h-4 w-4\" />\n\n    // Handle collapsed items\n    let displayItems = items\n    let hasEllipsis = false\n\n    if (maxItems && items.length > maxItems) {\n      const firstItem = items[0]\n      const lastItems = items.slice(-(maxItems - 1))\n      displayItems = [firstItem, ...lastItems]\n      hasEllipsis = true\n    }\n\n    const renderItem = (item: BreadcrumbItemData, index: number, isLast: boolean) => {\n      const content = (\n        <>\n          {index === 0 && showHomeIcon && !item.icon && <Home className=\"h-4 w-4\" />}\n          {item.icon}\n          <span>{item.label}</span>\n        </>\n      )\n\n      if (renderLink && item.href) {\n        return renderLink({\n          href: item.href,\n          children: content,\n          className: cn(\n            'inline-flex items-center gap-1.5',\n            isLast\n              ? 'font-medium text-foreground'\n              : 'text-muted-foreground hover:text-foreground transition-colors'\n          ),\n          active: isLast,\n        })\n      }\n\n      if (isLast || !item.href) {\n        return (\n          <span\n            className={cn(\n              'inline-flex items-center gap-1.5',\n              isLast ? 'text-foreground font-medium' : 'text-muted-foreground'\n            )}\n            aria-current={isLast ? 'page' : undefined}\n          >\n            {content}\n          </span>\n        )\n      }\n\n      return (\n        <a\n          href={item.href}\n          className=\"text-muted-foreground hover:text-foreground inline-flex items-center gap-1.5 transition-colors\"\n        >\n          {content}\n        </a>\n      )\n    }\n\n    return (\n      <nav ref={ref} aria-label={locale.breadcrumb.label} className={className} {...props}>\n        <ol className=\"flex items-center gap-2 text-sm\">\n          {displayItems.map((item, index) => {\n            const isLast = index === displayItems.length - 1\n            const showEllipsis = hasEllipsis && index === 0\n\n            return (\n              <li key={index} className=\"flex items-center gap-2\">\n                {renderItem(item, index, isLast)}\n                {showEllipsis && (\n                  <>\n                    <span className=\"text-muted-foreground\">{separatorElement}</span>\n                    <span className=\"text-muted-foreground\">...</span>\n                  </>\n                )}\n                {!isLast && !showEllipsis && (\n                  <span className=\"text-muted-foreground\">{separatorElement}</span>\n                )}\n              </li>\n            )\n          })}\n        </ol>\n      </nav>\n    )\n  }\n)\n\nBreadcrumb.displayName = 'Breadcrumb'\n\n// Compound component approach\nexport type BreadcrumbRootProps = HTMLAttributes<HTMLElement>\n\n/** Root nav wrapper for composing breadcrumb parts individually. */\nexport const BreadcrumbRoot = forwardRef<HTMLElement, BreadcrumbRootProps>(\n  ({ className, ...props }, ref) => {\n    const locale = useLocale()\n    return <nav ref={ref} aria-label={locale.breadcrumb.label} className={className} {...props} />\n  }\n)\n\nBreadcrumbRoot.displayName = 'BreadcrumbRoot'\n\nexport type BreadcrumbListProps = HTMLAttributes<HTMLOListElement>\n\n/** Ordered list container for breadcrumb items. */\nexport const BreadcrumbList = forwardRef<HTMLOListElement, BreadcrumbListProps>(\n  ({ className, ...props }, ref) => (\n    <ol ref={ref} className={cn('flex items-center gap-2 text-sm', className)} {...props} />\n  )\n)\n\nBreadcrumbList.displayName = 'BreadcrumbList'\n\nexport type BreadcrumbItemProps = HTMLAttributes<HTMLLIElement>\n\n/**\n * Individual list item within a breadcrumb list.\n *\n * Renamed from `BreadcrumbItemComponent` in v1.0 — the `BreadcrumbItem` name\n * previously referred to the item data shape, now `BreadcrumbItemData`.\n */\nexport const BreadcrumbItem = forwardRef<HTMLLIElement, BreadcrumbItemProps>(\n  ({ className, ...props }, ref) => (\n    <li ref={ref} className={cn('flex items-center gap-2', className)} {...props} />\n  )\n)\n\nBreadcrumbItem.displayName = 'BreadcrumbItem'\n\n/** @deprecated Renamed to `BreadcrumbItem` — will be removed in v1.0. */\nexport const BreadcrumbItemComponent = forwardRef<HTMLLIElement, BreadcrumbItemProps>(\n  (props, ref) => {\n    warnDeprecated('Breadcrumb', 'BreadcrumbItemComponent', 'BreadcrumbItem')\n    return <BreadcrumbItem ref={ref} {...props} />\n  }\n)\n\nBreadcrumbItemComponent.displayName = 'BreadcrumbItemComponent'\n\nexport interface BreadcrumbLinkProps extends HTMLAttributes<HTMLAnchorElement> {\n  href?: string\n  asChild?: boolean\n}\n\n/** Clickable anchor link within a breadcrumb item. */\nexport const BreadcrumbLink = forwardRef<HTMLAnchorElement, BreadcrumbLinkProps>(\n  ({ className, href, children, ...props }, ref) => (\n    <a\n      ref={ref}\n      href={href}\n      className={cn('text-muted-foreground hover:text-foreground transition-colors', className)}\n      {...props}\n    >\n      {children}\n    </a>\n  )\n)\n\nBreadcrumbLink.displayName = 'BreadcrumbLink'\n\nexport type BreadcrumbPageProps = HTMLAttributes<HTMLSpanElement>\n\n/** Non-interactive span representing the current page in a breadcrumb trail. */\nexport const BreadcrumbPage = forwardRef<HTMLSpanElement, BreadcrumbPageProps>(\n  ({ className, ...props }, ref) => (\n    <span\n      ref={ref}\n      role=\"link\"\n      aria-current=\"page\"\n      aria-disabled=\"true\"\n      className={cn('text-foreground font-medium', className)}\n      {...props}\n    />\n  )\n)\n\nBreadcrumbPage.displayName = 'BreadcrumbPage'\n\nexport type BreadcrumbSeparatorProps = HTMLAttributes<HTMLSpanElement>\n\n/** Visual separator between breadcrumb items, defaults to a chevron icon. */\nexport const BreadcrumbSeparator = forwardRef<HTMLSpanElement, BreadcrumbSeparatorProps>(\n  ({ className, children, ...props }, ref) => (\n    <span\n      ref={ref}\n      role=\"presentation\"\n      aria-hidden=\"true\"\n      className={cn('text-muted-foreground', className)}\n      {...props}\n    >\n      {children || <ChevronRight className=\"h-4 w-4\" />}\n    </span>\n  )\n)\n\nBreadcrumbSeparator.displayName = 'BreadcrumbSeparator'\n\nexport type BreadcrumbEllipsisProps = HTMLAttributes<HTMLSpanElement>\n\n/** Ellipsis indicator for collapsed breadcrumb items. */\nexport const BreadcrumbEllipsis = forwardRef<HTMLSpanElement, BreadcrumbEllipsisProps>(\n  ({ className, ...props }, ref) => (\n    <span\n      ref={ref}\n      role=\"presentation\"\n      aria-hidden=\"true\"\n      className={cn('text-muted-foreground', className)}\n      {...props}\n    >\n      ...\n    </span>\n  )\n)\n\nBreadcrumbEllipsis.displayName = 'BreadcrumbEllipsis'\n","import {\n  createContext,\n  forwardRef,\n  useContext,\n  useId,\n  useState,\n  type HTMLAttributes,\n  type KeyboardEvent as ReactKeyboardEvent,\n  type ReactNode,\n} from 'react'\nimport { cn } from '../../utils/cn'\nimport { warnDeprecated } from '../../utils/deprecate'\n\nexport type TabsVariant = 'default' | 'pills' | 'underline'\nexport type TabsSize = 'sm' | 'md' | 'lg'\nexport type TabsOrientation = 'horizontal' | 'vertical'\n\ninterface TabsContextValue {\n  value: string\n  onChange: (value: string) => void\n  variant: TabsVariant\n  size: TabsSize\n  orientation: TabsOrientation\n  /** Unique prefix so tab/panel ids stay unique across multiple Tabs instances */\n  idPrefix: string\n}\n\nconst TabsContext = createContext<TabsContextValue | null>(null)\n\nfunction useTabsContext() {\n  const context = useContext(TabsContext)\n  if (!context) {\n    throw new Error('Tabs components must be used within a Tabs provider')\n  }\n  return context\n}\n\nexport interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {\n  /** Currently active tab value */\n  value?: string\n  /** Default active tab (uncontrolled) */\n  defaultValue?: string\n  /** Callback when tab changes */\n  onChange?: (value: string) => void\n  /** @deprecated use `onChange` instead — removed in v1.0 */\n  onValueChange?: (value: string) => void\n  /** Tab style variant */\n  variant?: TabsVariant\n  /** Tab size */\n  size?: TabsSize\n  /**\n   * Layout axis of the tab strip. `'vertical'` stacks the triggers down the\n   * side — the standard shape when vertical space is scarce (landscape phones)\n   * and the content panel should scroll on its own.\n   *\n   * This is not just layout: it moves the `underline` variant's active rule to\n   * the inline edge, sets `aria-orientation` on the tablist, and switches\n   * keyboard navigation to the up/down axis. A `className`-only vertical strip\n   * gets none of those.\n   *\n   * @default 'horizontal'\n   */\n  orientation?: TabsOrientation\n}\n\n/** Tabbed navigation container supporting default, pill, and underline variants. */\nexport const Tabs = forwardRef<HTMLDivElement, TabsProps>(\n  (\n    {\n      className,\n      value: controlledValue,\n      defaultValue,\n      onChange,\n      onValueChange,\n      variant = 'default',\n      size = 'md',\n      orientation = 'horizontal',\n      children,\n      ...props\n    },\n    ref\n  ) => {\n    const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue || '')\n    const idPrefix = useId()\n\n    const value = controlledValue ?? uncontrolledValue\n    const handleChange = (newValue: string) => {\n      setUncontrolledValue(newValue)\n      if (onChange) {\n        onChange(newValue)\n      } else if (onValueChange) {\n        warnDeprecated('Tabs', 'onValueChange', 'onChange')\n        onValueChange(newValue)\n      }\n    }\n\n    return (\n      <TabsContext.Provider\n        value={{ value, onChange: handleChange, variant, size, orientation, idPrefix }}\n      >\n        <div\n          ref={ref}\n          className={cn('w-full', orientation === 'vertical' && 'flex gap-4', className)}\n          data-orientation={orientation}\n          {...props}\n        >\n          {children}\n        </div>\n      </TabsContext.Provider>\n    )\n  }\n)\n\nTabs.displayName = 'Tabs'\n\nexport type TabsListProps = HTMLAttributes<HTMLDivElement>\n\nconst listVariantStyles: Record<TabsVariant, Record<TabsOrientation, string>> = {\n  default: {\n    horizontal: 'bg-muted rounded-lg p-1',\n    vertical: 'bg-muted rounded-lg p-1',\n  },\n  pills: {\n    horizontal: 'gap-1',\n    vertical: 'gap-1',\n  },\n  underline: {\n    // The rule the active trigger sits on moves to the inline edge when the\n    // strip runs vertically — a bottom border would leave the indicator\n    // pointing across the reading direction instead of at the panel.\n    horizontal: 'border-b gap-4',\n    vertical: 'border-e gap-1',\n  },\n}\n\n/** Container for tab trigger buttons. */\nexport const TabsList = forwardRef<HTMLDivElement, TabsListProps>(\n  ({ className, ...props }, ref) => {\n    const { variant, orientation } = useTabsContext()\n    const isVertical = orientation === 'vertical'\n\n    return (\n      <div\n        ref={ref}\n        role=\"tablist\"\n        aria-orientation={orientation}\n        data-orientation={orientation}\n        className={cn(\n          'inline-flex',\n          isVertical ? 'flex-col items-stretch self-start' : 'items-center',\n          listVariantStyles[variant][orientation],\n          className\n        )}\n        {...props}\n      />\n    )\n  }\n)\n\nTabsList.displayName = 'TabsList'\n\nexport interface TabsTriggerProps extends HTMLAttributes<HTMLButtonElement> {\n  /** Tab value */\n  value: string\n  /** Disabled state */\n  disabled?: boolean\n  /** Icon to show before label */\n  icon?: ReactNode\n}\n\nconst triggerSizeStyles: Record<TabsSize, string> = {\n  sm: 'px-2.5 py-1 text-xs',\n  md: 'px-3 py-1.5 text-sm',\n  lg: 'px-4 py-2 text-base',\n}\n\nconst triggerVariantStyles: Record<\n  TabsVariant,\n  Record<TabsOrientation, { base: string; active: string }>\n> = {\n  default: {\n    horizontal: {\n      base: 'rounded-md text-muted-foreground hover:text-foreground',\n      active: 'bg-background text-foreground shadow-sm',\n    },\n    vertical: {\n      base: 'rounded-md text-muted-foreground hover:text-foreground',\n      active: 'bg-background text-foreground shadow-sm',\n    },\n  },\n  pills: {\n    horizontal: {\n      base: 'rounded-full text-muted-foreground hover:text-foreground hover:bg-muted',\n      active: 'bg-primary text-primary-foreground',\n    },\n    vertical: {\n      base: 'rounded-full text-muted-foreground hover:text-foreground hover:bg-muted',\n      active: 'bg-primary text-primary-foreground',\n    },\n  },\n  underline: {\n    horizontal: {\n      base: 'text-muted-foreground hover:text-foreground border-b-2 border-transparent -mb-px',\n      active: 'text-foreground border-primary',\n    },\n    vertical: {\n      base: 'text-muted-foreground hover:text-foreground border-e-2 border-transparent -me-px',\n      active: 'text-foreground border-primary',\n    },\n  },\n}\n\n/** Arrow keys move along the strip's own axis; Home/End jump to the ends. */\nfunction moveFocus(event: ReactKeyboardEvent<HTMLButtonElement>, orientation: TabsOrientation) {\n  const nextKey = orientation === 'vertical' ? 'ArrowDown' : 'ArrowRight'\n  const prevKey = orientation === 'vertical' ? 'ArrowUp' : 'ArrowLeft'\n  if (\n    event.key !== nextKey &&\n    event.key !== prevKey &&\n    event.key !== 'Home' &&\n    event.key !== 'End'\n  ) {\n    return\n  }\n\n  const list = event.currentTarget.closest('[role=\"tablist\"]')\n  if (!list) return\n  const tabs = Array.from(list.querySelectorAll<HTMLButtonElement>('[role=\"tab\"]:not([disabled])'))\n  if (tabs.length === 0) return\n\n  const current = tabs.indexOf(event.currentTarget)\n  const last = tabs.length - 1\n  let next: number\n  if (event.key === 'Home') next = 0\n  else if (event.key === 'End') next = last\n  else if (event.key === nextKey) next = current === last ? 0 : current + 1\n  else next = current === 0 ? last : current - 1\n\n  event.preventDefault()\n  // Activation follows focus (the ARIA tabs pattern's automatic mode): the\n  // click handler is what commits the value, so reuse it rather than\n  // duplicating the state update here.\n  tabs[next].focus()\n  tabs[next].click()\n}\n\n/** Clickable tab button that activates its associated content panel. */\nexport const TabsTrigger = forwardRef<HTMLButtonElement, TabsTriggerProps>(\n  ({ className, value, disabled, icon, children, onKeyDown, ...props }, ref) => {\n    const {\n      value: selectedValue,\n      onChange,\n      variant,\n      size,\n      orientation,\n      idPrefix,\n    } = useTabsContext()\n    const isActive = selectedValue === value\n    const styles = triggerVariantStyles[variant][orientation]\n\n    return (\n      <button\n        ref={ref}\n        type=\"button\"\n        role=\"tab\"\n        id={`${idPrefix}tab-${value}`}\n        aria-selected={isActive}\n        aria-controls={`${idPrefix}tabpanel-${value}`}\n        // Roving tabindex: Tab enters the strip at the active tab, then the\n        // arrow keys move within it — one stop for the whole tablist.\n        tabIndex={isActive ? 0 : -1}\n        disabled={disabled}\n        onClick={() => onChange(value)}\n        className={cn(\n          'inline-flex items-center gap-2 font-medium transition-all',\n          orientation === 'vertical' ? 'justify-start text-start' : 'justify-center',\n          'focus-visible:ring-ring/40 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n          'disabled:pointer-events-none disabled:opacity-50',\n          triggerSizeStyles[size],\n          styles.base,\n          isActive && styles.active,\n          className\n        )}\n        {...props}\n        onKeyDown={(e) => {\n          moveFocus(e, orientation)\n          onKeyDown?.(e)\n        }}\n      >\n        {icon}\n        {children}\n      </button>\n    )\n  }\n)\n\nTabsTrigger.displayName = 'TabsTrigger'\n\nexport interface TabsContentProps extends HTMLAttributes<HTMLDivElement> {\n  /** Tab value */\n  value: string\n  /** Force render even when not active */\n  forceMount?: boolean\n}\n\n/** Panel that displays content for the currently active tab. */\nexport const TabsContent = forwardRef<HTMLDivElement, TabsContentProps>(\n  ({ className, value, forceMount, children, ...props }, ref) => {\n    const { value: selectedValue, orientation, idPrefix } = useTabsContext()\n    const isActive = selectedValue === value\n\n    if (!forceMount && !isActive) return null\n\n    return (\n      <div\n        ref={ref}\n        id={`${idPrefix}tabpanel-${value}`}\n        role=\"tabpanel\"\n        aria-labelledby={`${idPrefix}tab-${value}`}\n        tabIndex={0}\n        hidden={!isActive}\n        className={cn(\n          // Horizontal: the panel sits under the strip. Vertical: it sits\n          // beside it and the Tabs root's flex gap already separates them, so\n          // a top margin would only knock it out of line with the first tab.\n          orientation === 'vertical' ? 'min-w-0 flex-1' : 'mt-2',\n          'focus-visible:ring-ring/40 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n          className\n        )}\n        {...props}\n      >\n        {children}\n      </div>\n    )\n  }\n)\n\nTabsContent.displayName = 'TabsContent'\n","import {\n  forwardRef,\n  useCallback,\n  useMemo,\n  useState,\n  type HTMLAttributes,\n  type ReactNode,\n} from 'react'\nimport { Check, ChevronRight, Minus } from 'lucide-react'\nimport { cn } from '../../utils/cn'\nimport { warnDeprecated } from '../../utils/deprecate'\nimport { useLocale } from '../../locale'\n\n/* ─── Types ─── */\n\nexport interface TreeNode {\n  /** Unique key */\n  key: string\n  /** Display label */\n  label: ReactNode\n  /** Child nodes */\n  children?: TreeNode[]\n  /** Disable this node */\n  disabled?: boolean\n  /** Custom icon */\n  icon?: ReactNode\n}\n\nexport interface TreeProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect'> {\n  /** Tree data */\n  data: TreeNode[]\n  /** Default expanded keys (uncontrolled) */\n  defaultExpandedKeys?: string[]\n  /** Expanded keys (controlled) */\n  expandedKeys?: string[]\n  /** On expand change */\n  onExpandChange?: (keys: string[]) => void\n  /** Enable checkboxes */\n  checkable?: boolean\n  /** Default checked keys (uncontrolled) */\n  defaultCheckedKeys?: string[]\n  /** Checked keys (controlled) */\n  checkedKeys?: string[]\n  /** On checked keys change */\n  onSelectionChange?: (keys: string[]) => void\n  /** @deprecated use `onSelectionChange` instead — removed in v1.0 */\n  onCheckChange?: (keys: string[]) => void\n  /** On node click */\n  onSelect?: (key: string, node: TreeNode) => void\n  /** Selected key (controlled) */\n  selectedKey?: string\n  /** Default selected key (uncontrolled) */\n  defaultSelectedKey?: string\n  /** Show connecting lines */\n  showLines?: boolean\n  /** Additional class name */\n  className?: string\n}\n\n/* ─── Helpers ─── */\n\n/** Collect all descendant keys of a node */\nfunction getDescendantKeys(node: TreeNode): string[] {\n  const keys: string[] = []\n  const stack = [...(node.children ?? [])]\n  while (stack.length) {\n    const n = stack.pop()!\n    keys.push(n.key)\n    if (n.children) stack.push(...n.children)\n  }\n  return keys\n}\n\n/** Build a map from child key → parent key */\nfunction buildParentMap(nodes: TreeNode[]): Map<string, string> {\n  const map = new Map<string, string>()\n  const stack: Array<{ node: TreeNode; parentKey: string | null }> = nodes.map((n) => ({\n    node: n,\n    parentKey: null,\n  }))\n  while (stack.length) {\n    const { node, parentKey } = stack.pop()!\n    if (parentKey !== null) map.set(node.key, parentKey)\n    if (node.children) {\n      for (const child of node.children) {\n        stack.push({ node: child, parentKey: node.key })\n      }\n    }\n  }\n  return map\n}\n\n/** Build a lookup map for key → TreeNode */\nfunction buildNodeMap(nodes: TreeNode[]): Map<string, TreeNode> {\n  const map = new Map<string, TreeNode>()\n  const stack = [...nodes]\n  while (stack.length) {\n    const n = stack.pop()!\n    map.set(n.key, n)\n    if (n.children) stack.push(...n.children)\n  }\n  return map\n}\n\n/* ─── Checkbox ─── */\n\ntype CheckState = 'checked' | 'indeterminate' | 'unchecked'\n\nfunction TreeCheckbox({\n  state,\n  onChange,\n  disabled,\n  'aria-label': ariaLabel,\n}: {\n  state: CheckState\n  onChange: () => void\n  disabled?: boolean\n  'aria-label'?: string\n}) {\n  return (\n    <button\n      type=\"button\"\n      role=\"checkbox\"\n      aria-checked={state === 'indeterminate' ? 'mixed' : state === 'checked'}\n      aria-label={ariaLabel}\n      disabled={disabled}\n      onClick={(e) => {\n        e.stopPropagation()\n        onChange()\n      }}\n      className={cn(\n        'inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border transition-colors',\n        'focus-visible:ring-ring/40 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n        'disabled:cursor-not-allowed disabled:opacity-50',\n        state !== 'unchecked'\n          ? 'border-primary bg-primary text-primary-foreground'\n          : 'border-input bg-background'\n      )}\n    >\n      {state === 'checked' && <Check className=\"h-3 w-3\" />}\n      {state === 'indeterminate' && <Minus className=\"h-3 w-3\" />}\n    </button>\n  )\n}\n\n/* ─── Tree Node Renderer ─── */\n\ninterface TreeNodeRowProps {\n  node: TreeNode\n  level: number\n  expanded: boolean\n  onToggleExpand: (key: string) => void\n  checkable: boolean\n  checkState: CheckState\n  onCheck: (key: string) => void\n  selectedKey?: string\n  onSelect?: (key: string, node: TreeNode) => void\n  showLines: boolean\n}\n\nfunction TreeNodeRow({\n  node,\n  level,\n  expanded,\n  onToggleExpand,\n  checkable,\n  checkState,\n  onCheck,\n  selectedKey,\n  onSelect,\n  showLines,\n}: TreeNodeRowProps) {\n  const locale = useLocale()\n  const hasChildren = (node.children?.length ?? 0) > 0\n  const isSelected = selectedKey === node.key\n\n  return (\n    <div\n      role=\"treeitem\"\n      aria-expanded={hasChildren ? expanded : undefined}\n      aria-selected={isSelected}\n      aria-disabled={node.disabled}\n      tabIndex={0}\n      className={cn(\n        'flex h-8 items-center gap-1 px-2 text-sm select-none',\n        !node.disabled && 'hover:bg-accent/50 cursor-pointer',\n        isSelected && 'bg-accent text-accent-foreground',\n        node.disabled && 'cursor-not-allowed opacity-50',\n        showLines && 'border-border border-l'\n      )}\n      style={{ paddingLeft: level * 24 + 8 }}\n      onClick={() => {\n        if (node.disabled) return\n        onSelect?.(node.key, node)\n      }}\n      onKeyDown={(e) => {\n        if (e.key === 'Enter' || e.key === ' ') {\n          e.preventDefault()\n          if (node.disabled) return\n          onSelect?.(node.key, node)\n        }\n      }}\n    >\n      {/* Expand toggle */}\n      {hasChildren ? (\n        <button\n          type=\"button\"\n          aria-label={`${expanded ? locale.tree.collapse : locale.tree.expand} ${typeof node.label === 'string' ? node.label : node.key}`}\n          className=\"hover:bg-accent inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-sm\"\n          onClick={(e) => {\n            e.stopPropagation()\n            onToggleExpand(node.key)\n          }}\n          tabIndex={-1}\n        >\n          <ChevronRight\n            className={cn(\n              'text-muted-foreground h-4 w-4 transition-transform duration-150',\n              expanded && 'rotate-90'\n            )}\n          />\n        </button>\n      ) : (\n        <span className=\"inline-flex h-5 w-5 shrink-0\" />\n      )}\n\n      {/* Checkbox */}\n      {checkable && (\n        <TreeCheckbox\n          state={checkState}\n          onChange={() => onCheck(node.key)}\n          disabled={node.disabled}\n          aria-label={typeof node.label === 'string' ? node.label : locale.tree.toggle}\n        />\n      )}\n\n      {/* Icon */}\n      {node.icon && (\n        <span className=\"text-muted-foreground inline-flex h-4 w-4 shrink-0 items-center justify-center\">\n          {node.icon}\n        </span>\n      )}\n\n      {/* Label */}\n      <span className=\"truncate\">{node.label}</span>\n    </div>\n  )\n}\n\n/* ─── Tree Component ─── */\n\n/**\n * Hierarchical tree view with expand/collapse, selection, and optional checkboxes.\n *\n * Supports both controlled and uncontrolled expand state, and parent-child\n * cascading check behavior when `checkable` is enabled.\n */\nexport const Tree = forwardRef<HTMLDivElement, TreeProps>(function Tree(\n  {\n    data,\n    defaultExpandedKeys = [],\n    expandedKeys: controlledExpandedKeys,\n    onExpandChange,\n    checkable = false,\n    defaultCheckedKeys = [],\n    checkedKeys: controlledCheckedKeys,\n    onSelectionChange,\n    onCheckChange,\n    onSelect,\n    selectedKey: controlledSelectedKey,\n    defaultSelectedKey,\n    showLines = false,\n    className,\n    ...rest\n  },\n  ref\n) {\n  /* ── Expand state ── */\n  const isExpandControlled = controlledExpandedKeys !== undefined\n  const [uncontrolledExpanded, setUncontrolledExpanded] = useState<Set<string>>(\n    () => new Set(defaultExpandedKeys)\n  )\n  const expandedSet = useMemo(\n    () => (isExpandControlled ? new Set(controlledExpandedKeys) : uncontrolledExpanded),\n    [isExpandControlled, controlledExpandedKeys, uncontrolledExpanded]\n  )\n\n  const toggleExpand = useCallback(\n    (key: string) => {\n      const next = new Set(expandedSet)\n      if (next.has(key)) next.delete(key)\n      else next.add(key)\n      const arr = Array.from(next)\n      if (!isExpandControlled) setUncontrolledExpanded(next)\n      onExpandChange?.(arr)\n    },\n    [expandedSet, isExpandControlled, onExpandChange]\n  )\n\n  /* ── Check state ── */\n  const isCheckControlled = controlledCheckedKeys !== undefined\n  const [uncontrolledChecked, setUncontrolledChecked] = useState<Set<string>>(\n    () => new Set(defaultCheckedKeys)\n  )\n  const checkedSet = useMemo(\n    () => (isCheckControlled ? new Set(controlledCheckedKeys) : uncontrolledChecked),\n    [isCheckControlled, controlledCheckedKeys, uncontrolledChecked]\n  )\n\n  const parentMap = useMemo(() => buildParentMap(data), [data])\n  const nodeMap = useMemo(() => buildNodeMap(data), [data])\n\n  const getCheckState = useCallback(\n    (node: TreeNode): CheckState => {\n      if (!node.children?.length) {\n        return checkedSet.has(node.key) ? 'checked' : 'unchecked'\n      }\n      const descendantKeys = getDescendantKeys(node)\n      const checkedCount = descendantKeys.filter((k) => checkedSet.has(k)).length\n      if (checkedCount === 0)\n        return checkedSet.has(node.key) && descendantKeys.length === 0 ? 'checked' : 'unchecked'\n      if (checkedCount === descendantKeys.length) return 'checked'\n      return 'indeterminate'\n    },\n    [checkedSet]\n  )\n\n  const handleCheck = useCallback(\n    (key: string) => {\n      const node = nodeMap.get(key)\n      if (!node || node.disabled) return\n\n      const next = new Set(checkedSet)\n      const currentState = getCheckState(node)\n      const shouldCheck = currentState !== 'checked'\n\n      // Toggle self\n      if (shouldCheck) next.add(key)\n      else next.delete(key)\n\n      // Cascade to descendants\n      const descendantKeys = getDescendantKeys(node)\n      for (const dk of descendantKeys) {\n        if (shouldCheck) next.add(dk)\n        else next.delete(dk)\n      }\n\n      // Cascade to ancestors\n      let parentKey = parentMap.get(key)\n      while (parentKey) {\n        const parentNode = nodeMap.get(parentKey)\n        if (parentNode) {\n          const allDescendants = getDescendantKeys(parentNode)\n          const allChecked = allDescendants.every((k) => next.has(k))\n          if (allChecked) next.add(parentKey)\n          else next.delete(parentKey)\n        }\n        parentKey = parentMap.get(parentKey)\n      }\n\n      if (!isCheckControlled) setUncontrolledChecked(next)\n      const nextKeys = Array.from(next)\n      if (onSelectionChange) {\n        onSelectionChange(nextKeys)\n      } else if (onCheckChange) {\n        warnDeprecated('Tree', 'onCheckChange', 'onSelectionChange')\n        onCheckChange(nextKeys)\n      }\n    },\n    [\n      checkedSet,\n      getCheckState,\n      isCheckControlled,\n      nodeMap,\n      parentMap,\n      onSelectionChange,\n      onCheckChange,\n    ]\n  )\n\n  /* ── Selected state ── */\n  const isSelectControlled = controlledSelectedKey !== undefined\n  const [uncontrolledSelectedKey, setUncontrolledSelectedKey] = useState<string | undefined>(\n    defaultSelectedKey\n  )\n  const selectedKey = isSelectControlled ? controlledSelectedKey : uncontrolledSelectedKey\n\n  const handleSelect = useCallback(\n    (key: string, node: TreeNode) => {\n      if (!isSelectControlled) setUncontrolledSelectedKey(key)\n      onSelect?.(key, node)\n    },\n    [isSelectControlled, onSelect]\n  )\n\n  /* ── Render ── */\n  const renderNodes = (nodes: TreeNode[], level: number): ReactNode[] =>\n    nodes.flatMap((node) => {\n      const isExpanded = expandedSet.has(node.key)\n      const elements: ReactNode[] = [\n        <TreeNodeRow\n          key={node.key}\n          node={node}\n          level={level}\n          expanded={isExpanded}\n          onToggleExpand={toggleExpand}\n          checkable={checkable}\n          checkState={checkable ? getCheckState(node) : 'unchecked'}\n          onCheck={handleCheck}\n          selectedKey={selectedKey}\n          onSelect={handleSelect}\n          showLines={showLines}\n        />,\n      ]\n      if (isExpanded && node.children?.length) {\n        elements.push(...renderNodes(node.children, level + 1))\n      }\n      return elements\n    })\n\n  return (\n    <div ref={ref} role=\"tree\" className={cn('text-foreground', className)} {...rest}>\n      {renderNodes(data, 0)}\n    </div>\n  )\n})\n\nTree.displayName = 'Tree'\n","import { createContext, forwardRef, type HTMLAttributes, type ReactNode } from 'react'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\n\n/**\n * Marks the single-line toolbar row. Controls that can render taller than one\n * line (a stacked field label) read this to warn that they will break the\n * row's alignment — context rather than DOM inspection, so it survives\n * wrappers and portals.\n */\nexport const FilterToolbarContext = createContext(false)\n\n/* ─── FilterBar (root) ─── */\n\nexport interface FilterBarProps extends HTMLAttributes<HTMLDivElement> {\n  children: ReactNode\n}\n\n/**\n * Responsive layout shell for data page toolbars.\n *\n * Provides a consistent Search | Filters | Actions pattern\n * that stacks on mobile and flows horizontally on desktop.\n *\n * **In context:** [CRUD List Page](https://ui.foson.co/storybook/?path=/docs/recipes-crud-list-page--docs)\n *\n * @example\n * ```tsx\n * <FilterBar>\n *   <FilterBarSearch placeholder=\"Search orders...\" value={q} onChange={setQ} />\n *   <FilterBarFilters>\n *     <Select ... />\n *     <DatePicker ... />\n *   </FilterBarFilters>\n *   <FilterBarActions>\n *     <Button>Export</Button>\n *   </FilterBarActions>\n * </FilterBar>\n * ```\n */\nexport const FilterBar = forwardRef<HTMLDivElement, FilterBarProps>(\n  ({ className, children, ...props }, ref) => (\n    <div\n      ref={ref}\n      className={cn(\n        'flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between',\n        className\n      )}\n      {...props}\n    >\n      {children}\n    </div>\n  )\n)\n\nFilterBar.displayName = 'FilterBar'\n\n/* ─── FilterBarSearch ─── */\n\nexport interface FilterBarSearchProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {\n  /** Search placeholder */\n  placeholder?: string\n  /** Current search value */\n  value?: string\n  /** Search change handler */\n  onChange?: (value: string) => void\n}\n\n/**\n * Left slot — search input with magnifying glass icon.\n */\nexport const FilterBarSearch = forwardRef<HTMLDivElement, FilterBarSearchProps>(\n  ({ className, placeholder, value, onChange, ...props }, ref) => {\n    const locale = useLocale()\n    const resolvedPlaceholder = placeholder ?? locale.filterBar.searchPlaceholder\n    return (\n      <div ref={ref} className={cn('relative w-full sm:max-w-xs', className)} {...props}>\n        <svg\n          width=\"15\"\n          height=\"15\"\n          viewBox=\"0 0 15 15\"\n          fill=\"none\"\n          className=\"text-muted-foreground absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2\"\n        >\n          <path\n            d=\"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z\"\n            fill=\"currentColor\"\n            fillRule=\"evenodd\"\n            clipRule=\"evenodd\"\n          />\n        </svg>\n        <input\n          type=\"search\"\n          name=\"search\"\n          autoComplete=\"off\"\n          placeholder={resolvedPlaceholder}\n          value={value}\n          onChange={(e) => onChange?.(e.target.value)}\n          aria-label={resolvedPlaceholder}\n          className={cn(\n            'border-input bg-background flex h-9 w-full rounded-md border pr-3 pl-9 text-sm',\n            'placeholder:text-muted-foreground',\n            'focus-visible:border-primary focus-visible:ring-ring/30 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n            '[&::-webkit-search-cancel-button]:hidden'\n          )}\n        />\n      </div>\n    )\n  }\n)\n\nFilterBarSearch.displayName = 'FilterBarSearch'\n\n/* ─── FilterBarFilters ─── */\n\nexport interface FilterBarFiltersProps extends HTMLAttributes<HTMLDivElement> {\n  children: ReactNode\n}\n\n/**\n * Center slot — wraps filter controls (Select, DatePicker, Combobox, etc.)\n */\nexport const FilterBarFilters = forwardRef<HTMLDivElement, FilterBarFiltersProps>(\n  ({ className, children, ...props }, ref) => (\n    <FilterToolbarContext.Provider value={true}>\n      <div\n        ref={ref}\n        className={cn(\n          // min-w-0 so labelled groups can shrink and wrap rather than pushing\n          // the bar wider than its container.\n          'flex min-w-0 flex-wrap items-center gap-2',\n          className\n        )}\n        {...props}\n      >\n        {children}\n      </div>\n    </FilterToolbarContext.Provider>\n  )\n)\n\nFilterBarFilters.displayName = 'FilterBarFilters'\n\n/* ─── FilterBarGroup ─── */\n\nexport interface FilterBarGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n  /**\n   * Visible label for the group (e.g. \"Period\", \"時間範圍\"). When it is a\n   * plain string it also becomes the group's accessible name.\n   */\n  label: ReactNode\n  children: ReactNode\n}\n\n/**\n * A labelled cluster of filter controls — the \"Period: [1d][7d][30d]\" shape\n * that preset toggles need and a `Select` does not.\n *\n * `FilterSelect`'s `label` only prefixes its \"all\" option (\"Status: All\"),\n * which works for dropdowns but leaves preset groups with nowhere to put a\n * visible label. Without this, callers hand-roll a label span plus a flex row\n * — and the hand-rolled version reliably ships without `flex-wrap`, so the\n * group refuses to shrink and pushes the page sideways on narrow viewports.\n *\n * Wraps at both levels and carries `min-w-0`, so a long group folds onto the\n * next line instead of forcing a horizontal scrollbar.\n *\n * @example\n * ```tsx\n * <FilterBarFilters>\n *   <FilterBarGroup label=\"Period\">\n *     <SegmentedControl size=\"sm\" options={PERIODS} value={period} onChange={setPeriod} />\n *   </FilterBarGroup>\n * </FilterBarFilters>\n * ```\n */\nexport const FilterBarGroup = forwardRef<HTMLDivElement, FilterBarGroupProps>(\n  ({ className, label, children, ...props }, ref) => (\n    <div\n      ref={ref}\n      role=\"group\"\n      aria-label={typeof label === 'string' ? label : undefined}\n      className={cn(\n        'flex min-w-0 flex-wrap items-center gap-2',\n        // Trailing inset so adjacent groups read as separate clusters: the\n        // parent's 8px gap plus this 8px doubles the space *between* groups\n        // while the label↔control gap inside one stays 8px. Kept here rather\n        // than as a wider gap on FilterBarFilters so bars of plain selects\n        // keep their existing rhythm.\n        'pe-2 last:pe-0',\n        className\n      )}\n      {...props}\n    >\n      <span className=\"text-2xs text-muted-foreground font-medium tracking-wider uppercase\">\n        {label}\n      </span>\n      <div className=\"flex min-w-0 flex-wrap items-center gap-1\">{children}</div>\n    </div>\n  )\n)\n\nFilterBarGroup.displayName = 'FilterBarGroup'\n\n/* ─── FilterBarActions ─── */\n\nexport interface FilterBarActionsProps extends HTMLAttributes<HTMLDivElement> {\n  children: ReactNode\n}\n\n/**\n * Right slot — action buttons (Export, Add, etc.)\n */\nexport const FilterBarActions = forwardRef<HTMLDivElement, FilterBarActionsProps>(\n  ({ className, children, ...props }, ref) => (\n    <div ref={ref} className={cn('flex items-center gap-2 sm:ml-auto', className)} {...props}>\n      {children}\n    </div>\n  )\n)\n\nFilterBarActions.displayName = 'FilterBarActions'\n","import { forwardRef, useMemo, type SelectHTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\nimport { Select, type SelectOption, type SelectSize } from '../select'\nimport { useLocale } from '../../locale'\n\nexport interface FilterSelectProps extends Omit<\n  SelectHTMLAttributes<HTMLSelectElement>,\n  'size' | 'onChange'\n> {\n  /** Filter label — shown as prefix in the \"all\" option (e.g. \"狀態: 全部\") */\n  label?: string\n  /** Options list */\n  options?: readonly SelectOption[]\n  /** Text for the \"all\" option — pass `false` to hide it. Defaults to the locale's \"All\" label. */\n  allLabel?: string | false\n  /** Select size @default \"sm\" */\n  size?: SelectSize\n  /** Fires with the selected value (empty string for \"all\") */\n  onChange?: (value: string) => void\n}\n\n/**\n * Thin wrapper around `<Select>` tailored for filter toolbars.\n *\n * Adds a built-in \"all\" option and simplifies `onChange` to return\n * the value string directly instead of a change event.\n */\nexport const FilterSelect = forwardRef<HTMLSelectElement, FilterSelectProps>(\n  ({ className, label, options = [], allLabel, size = 'sm', onChange, ...props }, ref) => {\n    const locale = useLocale()\n    const mergedOptions = useMemo(() => {\n      if (allLabel === false) return options\n\n      const resolvedAllLabel = allLabel ?? locale.filterSelect.all\n      const allText = label ? `${label}: ${resolvedAllLabel}` : resolvedAllLabel\n      const allOption: SelectOption = { value: '', label: allText }\n      return [allOption, ...options]\n    }, [options, allLabel, label, locale])\n\n    // The label prop doubles as the accessible name — filter selects usually\n    // render without a visible <label>, which axe rightly flags. But when the\n    // consumer wires up their own name (a native <label htmlFor> via `id`, or\n    // `aria-labelledby`), an aria-label would silently override it in the\n    // accessible-name computation, so back off.\n    const hasOwnName = props.id != null || props['aria-labelledby'] != null\n    return (\n      <Select\n        ref={ref}\n        size={size}\n        options={mergedOptions}\n        aria-label={hasOwnName ? undefined : label}\n        className={cn('w-auto', className)}\n        onChange={(e) => onChange?.(e.target.value)}\n        {...props}\n      />\n    )\n  }\n)\n\nFilterSelect.displayName = 'FilterSelect'\n","import {\n  Fragment,\n  useState,\n  useMemo,\n  useCallback,\n  useContext,\n  useRef,\n  useEffect,\n  type CSSProperties,\n  type ReactNode,\n} from 'react'\nimport { cn } from '../../utils/cn'\nimport { warnDeprecated, warnUsage } from '../../utils/deprecate'\nimport { useLocale } from '../../locale'\nimport { Table, TableHeader, TableBody, TableRow, TableHead, TableCell } from '../table/Table'\nimport { Button } from '../button/Button'\nimport { CardSurfaceContext } from '../card/Card'\nimport {\n  ChevronLeft,\n  ChevronRight,\n  ChevronsLeft,\n  ChevronsRight,\n  ChevronDown,\n  ArrowUpDown,\n  ArrowUp,\n  ArrowDown,\n  Check,\n  Minus,\n  Columns3,\n  ListFilter,\n} from 'lucide-react'\n\nexport interface Column<T> {\n  /** Column key (should match data property) */\n  key: string\n  /** Column header */\n  header: ReactNode\n  /** Custom cell renderer */\n  cell?: (row: T, index: number) => ReactNode\n  /** Enable sorting for this column */\n  sortable?: boolean\n  /** Column width */\n  width?: string | number\n  /** Text alignment */\n  align?: 'left' | 'center' | 'right'\n  /**\n   * Hide column: `true` removes it entirely; `'mobile'` hides it below the\n   * `md` breakpoint, `'desktop'` at `md` and up — both via pure CSS\n   * (SSR-safe, no JS breakpoint math), aligned with AdminLayout's\n   * `hideSidebar=\"mobile\"` convention.\n   */\n  hidden?: boolean | 'mobile' | 'desktop'\n  /** Class for this column's header cell */\n  headerClassName?: string\n  /** Inline style for this column's header cell (e.g. vertical writing-mode) */\n  headerStyle?: CSSProperties\n  /** Class for this column's body cells — string, or a function of the row */\n  cellClassName?: string | ((row: T, index: number) => string)\n  /**\n   * Inline style for this column's body cells — for CONTINUOUS values class\n   * strings can't express (e.g. heatmap alpha computed from the row:\n   * `(row) => ({ background: \\`rgb(106 77 255 / ${row.t})\\` })`).\n   * Discrete/binary styling should prefer `cellClassName`.\n   */\n  cellStyle?: CSSProperties | ((row: T, index: number) => CSSProperties)\n  /** Enable filtering for this column */\n  filterable?: boolean\n  /** Custom filter options. If not provided, auto-detect unique values from data. */\n  filterOptions?: string[]\n  /** Custom filter function */\n  filterFn?: (row: T, filterValue: string) => boolean\n  /**\n   * Pin this column during horizontal scroll: `'left'` freezes it at the left\n   * edge (e.g. a ticker/name column in a wide table), `'right'` at the right\n   * edge (action columns). Note: `'left'` pins at the table's left edge — with\n   * `selectable`/expandable enabled, the leading utility columns scroll under\n   * the pinned column, so pin the first data column only in plain tables.\n   */\n  pinned?: 'left' | 'right'\n}\n\nexport type SortDirection = 'asc' | 'desc' | null\n\nexport interface SortState {\n  key: string\n  direction: SortDirection\n}\n\nexport interface PaginationState {\n  pageIndex: number\n  pageSize: number\n}\n\nexport interface DataTableProps<T> {\n  /** Table data */\n  data: T[]\n  /**\n   * Column definitions. `NoInfer` makes TypeScript infer `T` from `data`\n   * alone, so inline `columns` literals get fully typed `cell`/`cellClassName`\n   * callbacks without annotating `<DataTable<Row> …>`.\n   */\n  columns: Column<NoInfer<T>>[]\n  /** Show the pagination footer (rows-per-page + range + pager) @default true */\n  pagination?: boolean\n  /** Compact density — tighter cell padding for data-dense admin tables @default false */\n  compact?: boolean\n  /** Page size options */\n  pageSizeOptions?: number[]\n  /** Default page size */\n  defaultPageSize?: number\n  /** Row key extractor */\n  getRowKey?: (row: T, index: number) => string | number\n  /** Loading state */\n  loading?: boolean\n  /** Empty state content */\n  emptyContent?: ReactNode\n  /** On row click */\n  onRowClick?: (row: T, index: number) => void\n  /**\n   * Class for body rows — string, or a function of the row for conditional\n   * styling (e.g. dim disabled rows: `(r) => r.active ? '' : 'opacity-60'`)\n   */\n  rowClassName?: string | ((row: T, index: number) => string)\n  /** Selected rows (controlled) */\n  selectedRows?: Set<string | number>\n  /** Default selected rows (uncontrolled) */\n  defaultSelectedRows?: Set<string | number>\n  /** On selection change — receives the complete next selection */\n  onSelectionChange?: (selected: Set<string | number>) => void\n  /**\n   * Incremental companion to `onSelectionChange`: fires once per row whose\n   * selection actually changed. Handy when existing code speaks\n   * `toggle(id)`-style events instead of whole-set state.\n   */\n  onRowSelect?: (row: T, selected: boolean) => void\n  /** Per-row selectability — unselectable rows render a disabled checkbox and are skipped by select-all */\n  isRowSelectable?: (row: T, index: number) => boolean\n  /** Enable row selection */\n  selectable?: boolean\n  /** Row hover feedback (passed to the underlying Table) @default true */\n  hoverable?: boolean\n  /**\n   * Enable expandable rows; provide the row content via `renderExpandedRow`.\n   *\n   * Passing a function `(row, index) => ReactNode` here is deprecated and will\n   * be removed in v1.0 — move the renderer to `renderExpandedRow` instead.\n   */\n  expandable?: boolean | ((row: T, index: number) => ReactNode)\n  /** Expanded row content renderer (enables expandable rows unless `expandable` is `false`) */\n  renderExpandedRow?: (row: T, index: number) => ReactNode\n  /** Show column visibility toggle */\n  columnToggle?: boolean\n  /** Stick table header to top when scrolling. Requires `maxHeight` (or `fillHeight`) to have any effect. */\n  stickyHeader?: boolean\n  /** Max height for the scrollable table area (e.g. '400px', '60vh'). Required for stickyHeader to work. */\n  maxHeight?: string | number\n  /**\n   * Minimum table width (e.g. `960`, `'60rem'`) — below it the table scrolls\n   * horizontally instead of squashing columns to min-content.\n   *\n   * **Wide tables need this, and `Column.pinned` is inert without it.** With\n   * `width: 100%` + auto layout the browser shrinks columns to min-content\n   * before it overflows, so a many-column (or CJK-header) table collapses to\n   * ~30px columns and multi-line headers while never handing you a usable\n   * scroll. `Column.width` is only a hint to the layout algorithm, not a\n   * guarantee — `minWidth` is the floor that makes it stick.\n   */\n  minWidth?: string | number\n  /**\n   * Show fades at the horizontal edges while columns are hidden there.\n   * @default true when `minWidth` is set\n   */\n  scrollFade?: boolean\n  /**\n   * Draw the table's own bordered, rounded surface. Pass `false` when the\n   * table sits inside a surface that already has a frame (a `Card` carrying a\n   * `CardHeader`), so the two borders don't stack into a double frame.\n   * @default true\n   */\n  bordered?: boolean\n  /**\n   * Make the table scroll wrapper fill its parent's height (`h-full`).\n   * Use when the DataTable is inside a fixed-height flex container so the\n   * horizontal scrollbar pins to the bottom of the viewport even when there\n   * are few rows. The parent must provide a determinate height.\n   */\n  fillHeight?: boolean\n  /** Sort state (controlled). Pass `null` for \"no sort\". */\n  sortState?: SortState | null\n  /** Callback when sort changes (for controlled usage) */\n  onSortChange?: (sort: SortState | null) => void\n  /** Column filters (controlled) */\n  filters?: Record<string, string[]>\n  /** Callback when filters change (for controlled usage) */\n  onFilterChange?: (filters: Record<string, string[]>) => void\n  /** Current page, 1-based (controlled) */\n  page?: number\n  /** Callback when page changes (1-based) */\n  onPageChange?: (page: number) => void\n  /**\n   * Callback when the rows-per-page selector changes. In server-side mode\n   * (`totalRows`) the selector only renders when this is provided, so the\n   * consumer can refetch with the new page size.\n   */\n  onPageSizeChange?: (pageSize: number) => void\n  /**\n   * Total row count across all pages (server-side mode). When set, `data` is\n   * treated as the already-fetched current page: the table skips client-side\n   * filtering, sorting, and slicing, and the pagination footer derives page\n   * count and range info from this total instead of `data.length`.\n   *\n   * Server-side mode expects the controlled `page` prop (the table cannot\n   * slice `data`, so an internal page would drift from what is shown), and\n   * `onPageSizeChange` if you keep the rows-per-page selector. Column filters\n   * only render when `filters`/`onFilterChange` are controlled AND the column\n   * provides `filterOptions` (options derived from the current page would be\n   * incomplete). Do the actual filtering/sorting/slicing on the server.\n   */\n  totalRows?: number\n  /** Additional class name */\n  className?: string\n}\n\n/* ─── Selection Checkbox ─── */\n\ntype CheckState = 'checked' | 'indeterminate' | 'unchecked'\n\nfunction SelectionCheckbox({\n  state,\n  onChange,\n  disabled,\n  'aria-label': ariaLabel,\n}: {\n  state: CheckState\n  onChange: () => void\n  disabled?: boolean\n  'aria-label'?: string\n}) {\n  return (\n    <button\n      type=\"button\"\n      role=\"checkbox\"\n      aria-checked={state === 'indeterminate' ? 'mixed' : state === 'checked'}\n      aria-label={ariaLabel}\n      disabled={disabled}\n      onClick={(e) => {\n        e.stopPropagation()\n        onChange()\n      }}\n      className={cn(\n        'inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border transition-colors',\n        'focus-visible:ring-ring/40 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n        'disabled:cursor-not-allowed disabled:opacity-50',\n        state !== 'unchecked'\n          ? 'border-primary bg-primary text-primary-foreground'\n          : 'border-input bg-background'\n      )}\n    >\n      {state === 'checked' && <Check className=\"h-3 w-3\" />}\n      {state === 'indeterminate' && <Minus className=\"h-3 w-3\" />}\n    </button>\n  )\n}\n\nconst responsiveHiddenClass = (hidden?: boolean | 'mobile' | 'desktop') =>\n  hidden === 'mobile' ? 'max-md:hidden' : hidden === 'desktop' ? 'md:hidden' : undefined\n\n/**\n * Feature-rich data table with sorting, pagination, and custom cell rendering.\n *\n * **In context:** [CRUD List Page](https://ui.foson.co/storybook/?path=/docs/recipes-crud-list-page--docs)\n * · [Server-Side Table](https://ui.foson.co/storybook/?path=/docs/recipes-server-side-table--docs)\n * · [Dashboard](https://ui.foson.co/storybook/?path=/docs/recipes-dashboard--docs)\n */\nexport function DataTable<T>({\n  data,\n  columns,\n  pagination = true,\n  compact = false,\n  pageSizeOptions = [10, 20, 50, 100],\n  defaultPageSize = 10,\n  getRowKey = (_row, index) => index,\n  loading = false,\n  emptyContent,\n  onRowClick,\n  rowClassName,\n  selectable = false,\n  hoverable = true,\n  onRowSelect,\n  isRowSelectable,\n  selectedRows,\n  defaultSelectedRows,\n  onSelectionChange,\n  expandable,\n  renderExpandedRow,\n  columnToggle = false,\n  stickyHeader = false,\n  maxHeight,\n  minWidth,\n  scrollFade,\n  bordered = true,\n  fillHeight = false,\n  sortState: controlledSortState,\n  onSortChange,\n  filters: controlledFilters,\n  onFilterChange,\n  page: controlledPage,\n  onPageChange,\n  onPageSizeChange,\n  totalRows,\n  className,\n}: DataTableProps<T>) {\n  const locale = useLocale()\n\n  // Composition guard: DataTable already draws a bordered, rounded surface, so\n  // nesting it in a Card stacks two frames. Detected via context rather than\n  // DOM inspection — see CardSurfaceContext.\n  const insideCard = useContext(CardSurfaceContext)\n  // `border-0` in className neutralises the frame just as well as the prop —\n  // the guard's condition is \"two frames will stack\", and they won't. Checking\n  // the class string is imprecise, but the alternative is warning at call sites\n  // that are already visually correct (5 of them in one consumer audit), and a\n  // guard that cries wolf gets ignored.\n  const frameDisabledByClass = typeof className === 'string' && /\\bborder-0\\b/.test(className)\n  if (insideCard && bordered && !frameDisabledByClass) {\n    warnUsage(\n      'DataTable',\n      'nested-in-card',\n      'rendered inside a Card while drawing its own border — the two frames stack. Pass `bordered={false}` (and give the Card `padding=\"none\"` with `CardContent className=\"p-0\"`), or drop the Card: DataTable is already a complete surface.'\n    )\n  }\n\n  // Composition guard: frozen columns only engage once the table is wider than\n  // its container, and without `minWidth` it never is — auto layout squeezes\n  // the columns to min-content instead. `pinned` then silently does nothing.\n  if (minWidth == null && columns.some((column) => column.pinned)) {\n    warnUsage(\n      'DataTable',\n      'pinned-without-min-width',\n      'has `pinned` columns but no `minWidth` — the table shrinks its columns to fit instead of overflowing, so it never scrolls horizontally and the frozen columns never engage. Set `minWidth` to the width the table needs to stay readable.'\n    )\n  }\n\n  // Deprecated `expandable={(row, index) => ...}` — treated as `renderExpandedRow`\n  if (typeof expandable === 'function' && renderExpandedRow == null) {\n    warnDeprecated('DataTable', 'expandable(fn)', 'renderExpandedRow')\n  }\n  const expandedRowRenderer =\n    renderExpandedRow ?? (typeof expandable === 'function' ? expandable : undefined)\n  const isExpandable = expandable !== false && expandedRowRenderer != null\n\n  const isSortControlled = controlledSortState !== undefined\n  const [uncontrolledSortState, setUncontrolledSortState] = useState<SortState | null>(null)\n  const sortState = isSortControlled ? controlledSortState : uncontrolledSortState\n  const [expandedRows, setExpandedRows] = useState<Set<string | number>>(new Set())\n  const [hiddenColumnKeys, setHiddenColumnKeys] = useState<Set<string>>(new Set())\n  const [columnToggleOpen, setColumnToggleOpen] = useState(false)\n  const columnToggleRef = useRef<HTMLDivElement>(null)\n  const isFiltersControlled = controlledFilters !== undefined\n  const [uncontrolledFilters, setUncontrolledFilters] = useState<Record<string, string[]>>({})\n  const filters = isFiltersControlled ? controlledFilters : uncontrolledFilters\n  const [openFilterKey, setOpenFilterKey] = useState<string | null>(null)\n  const filterDropdownRefs = useRef<Record<string, HTMLDivElement | null>>({})\n  const isPageControlled = controlledPage !== undefined\n  // Server-side mode: `data` is the already-processed current page\n  const isServerMode = totalRows !== undefined\n  if (isServerMode && pagination && !isPageControlled) {\n    warnUsage(\n      'DataTable',\n      'server-uncontrolled-page',\n      'server-side mode (`totalRows`) without a controlled `page` prop — the table cannot slice `data`, so the pager and range info will not match the rendered rows unless you refetch in `onPageChange` and pass `page` back.'\n    )\n  }\n  const [paginationState, setPaginationState] = useState<PaginationState>({\n    pageIndex: 0,\n    pageSize: defaultPageSize,\n  })\n  const pageIndex = isPageControlled ? Math.max(0, controlledPage - 1) : paginationState.pageIndex\n  const pageSize = paginationState.pageSize\n\n  // Close column toggle dropdown on outside click\n  useEffect(() => {\n    if (!columnToggleOpen) return\n    const handleClick = (e: MouseEvent) => {\n      if (columnToggleRef.current && !columnToggleRef.current.contains(e.target as Node)) {\n        setColumnToggleOpen(false)\n      }\n    }\n    document.addEventListener('mousedown', handleClick)\n    return () => document.removeEventListener('mousedown', handleClick)\n  }, [columnToggleOpen])\n\n  // Close filter dropdown on outside click\n  useEffect(() => {\n    if (!openFilterKey) return\n    const handleClick = (e: MouseEvent) => {\n      const ref = filterDropdownRefs.current[openFilterKey]\n      if (ref && !ref.contains(e.target as Node)) {\n        setOpenFilterKey(null)\n      }\n    }\n    document.addEventListener('mousedown', handleClick)\n    return () => document.removeEventListener('mousedown', handleClick)\n  }, [openFilterKey])\n\n  // Filter visible columns\n  const visibleColumns = useMemo(\n    // `'mobile'`/`'desktop'` stay in the render and hide via CSS classes\n    () => columns.filter((col) => col.hidden !== true && !hiddenColumnKeys.has(col.key)),\n    [columns, hiddenColumnKeys]\n  )\n\n  // Toggleable columns (non-hidden by definition)\n  const toggleableColumns = useMemo(() => columns.filter((col) => col.hidden !== true), [columns])\n\n  // ─── Filter helpers ───\n  const getFilterOptions = useCallback(\n    (column: Column<T>): string[] => {\n      if (column.filterOptions) return column.filterOptions\n      const unique = new Set<string>()\n      data.forEach((row) => {\n        const value = (row as Record<string, unknown>)[column.key]\n        if (value !== null && value !== undefined) {\n          unique.add(String(value))\n        }\n      })\n      return Array.from(unique).sort()\n    },\n    [data]\n  )\n\n  // In server mode filtering happens on the server: only render the filter UI\n  // when the consumer controls filters (and can react to changes) AND provides\n  // the full option list — options derived from the current page are incomplete,\n  // and an uncontrolled filter would do nothing but reset the page.\n  const canRenderFilter = useCallback(\n    (column: Column<T>): boolean =>\n      Boolean(column.filterable) &&\n      (!isServerMode ||\n        (isFiltersControlled && onFilterChange != null && column.filterOptions != null)),\n    [isServerMode, isFiltersControlled, onFilterChange]\n  )\n\n  const resetToFirstPage = useCallback(() => {\n    if (!isPageControlled) {\n      setPaginationState((prev) => ({ ...prev, pageIndex: 0 }))\n    } else if (pageIndex !== 0) {\n      onPageChange?.(1)\n    }\n  }, [isPageControlled, pageIndex, onPageChange])\n\n  const applyFilters = useCallback(\n    (updated: Record<string, string[]>) => {\n      if (!isFiltersControlled) setUncontrolledFilters(updated)\n      onFilterChange?.(updated)\n      resetToFirstPage()\n    },\n    [isFiltersControlled, onFilterChange, resetToFirstPage]\n  )\n\n  const toggleFilterValue = useCallback(\n    (columnKey: string, value: string) => {\n      const current = filters[columnKey] ?? []\n      const next = current.includes(value)\n        ? current.filter((v) => v !== value)\n        : [...current, value]\n      const updated = { ...filters }\n      if (next.length === 0) {\n        delete updated[columnKey]\n      } else {\n        updated[columnKey] = next\n      }\n      applyFilters(updated)\n    },\n    [filters, applyFilters]\n  )\n\n  const clearColumnFilter = useCallback(\n    (columnKey: string) => {\n      const updated = { ...filters }\n      delete updated[columnKey]\n      applyFilters(updated)\n    },\n    [filters, applyFilters]\n  )\n\n  // Filter data\n  const filteredData = useMemo(() => {\n    if (isServerMode) return data\n    const activeFilters = Object.entries(filters).filter(([, values]) => values.length > 0)\n    if (activeFilters.length === 0) return data\n\n    return data.filter((row) =>\n      activeFilters.every(([columnKey, filterValues]) => {\n        const column = columns.find((c) => c.key === columnKey)\n        if (column?.filterFn) {\n          return filterValues.some((fv) => column.filterFn!(row, fv))\n        }\n        const cellValue = String((row as Record<string, unknown>)[columnKey] ?? '')\n        return filterValues.includes(cellValue)\n      })\n    )\n  }, [data, filters, columns, isServerMode])\n\n  const hasActiveFilters = Object.keys(filters).length > 0\n\n  // Sort data\n  const sortedData = useMemo(() => {\n    if (isServerMode || !sortState || !sortState.direction) return filteredData\n\n    const sorted = [...filteredData].sort((a, b) => {\n      const aValue = (a as Record<string, unknown>)[sortState.key]\n      const bValue = (b as Record<string, unknown>)[sortState.key]\n\n      if (aValue === bValue) return 0\n      if (aValue === null || aValue === undefined) return 1\n      if (bValue === null || bValue === undefined) return -1\n\n      const comparison = aValue < bValue ? -1 : 1\n      return sortState.direction === 'asc' ? comparison : -comparison\n    })\n\n    return sorted\n  }, [filteredData, sortState, isServerMode])\n\n  // Paginate data\n  const paginatedData = useMemo(() => {\n    if (!pagination || isServerMode) return sortedData\n\n    const start = pageIndex * pageSize\n    const end = start + pageSize\n    return sortedData.slice(start, end)\n  }, [sortedData, pagination, isServerMode, pageIndex, pageSize])\n\n  // Pagination info\n  const totalRowCount = totalRows ?? sortedData.length\n  const totalPages = Math.ceil(totalRowCount / pageSize)\n  const canPreviousPage = pageIndex > 0\n  const canNextPage = pageIndex < totalPages - 1\n\n  const handleSort = (key: string) => {\n    let next: SortState | null\n    if (sortState?.key !== key) {\n      next = { key, direction: 'asc' }\n    } else if (sortState.direction === 'asc') {\n      next = { key, direction: 'desc' }\n    } else {\n      next = null\n    }\n    if (!isSortControlled) setUncontrolledSortState(next)\n    onSortChange?.(next)\n  }\n\n  const goToPage = (nextPageIndex: number) => {\n    const clamped = Math.max(0, Math.min(nextPageIndex, totalPages - 1))\n    if (!isPageControlled) {\n      setPaginationState((prev) => ({ ...prev, pageIndex: clamped }))\n    }\n    onPageChange?.(clamped + 1)\n  }\n\n  const setPageSize = (nextPageSize: number) => {\n    setPaginationState({ pageIndex: 0, pageSize: nextPageSize })\n    resetToFirstPage()\n    onPageSizeChange?.(nextPageSize)\n  }\n\n  // ─── Selection helpers ───\n  const isSelectionControlled = selectedRows !== undefined\n  const [uncontrolledSelectedRows, setUncontrolledSelectedRows] = useState<Set<string | number>>(\n    () => new Set(defaultSelectedRows)\n  )\n  const selection = isSelectionControlled ? selectedRows : uncontrolledSelectedRows\n\n  const updateSelection = useCallback(\n    (next: Set<string | number>) => {\n      if (!isSelectionControlled) setUncontrolledSelectedRows(next)\n      onSelectionChange?.(next)\n    },\n    [isSelectionControlled, onSelectionChange]\n  )\n\n  const pageRows = useMemo(\n    () =>\n      paginatedData.map((row, i) => {\n        const index = pageIndex * pageSize + i\n        return {\n          row,\n          key: getRowKey(row, index),\n          selectableRow: isRowSelectable ? isRowSelectable(row, index) : true,\n        }\n      }),\n    [paginatedData, getRowKey, pageIndex, pageSize, isRowSelectable]\n  )\n  const allPageKeys = useMemo(\n    () => pageRows.filter((r) => r.selectableRow).map((r) => r.key),\n    [pageRows]\n  )\n\n  const headerCheckState: CheckState = useMemo(() => {\n    if (!selectable || allPageKeys.length === 0) return 'unchecked'\n    const selectedOnPage = allPageKeys.filter((k) => selection.has(k)).length\n    if (selectedOnPage === 0) return 'unchecked'\n    if (selectedOnPage === allPageKeys.length) return 'checked'\n    return 'indeterminate'\n  }, [selectable, allPageKeys, selection])\n\n  const toggleAll = useCallback(() => {\n    const next = new Set(selection)\n    const adding = headerCheckState !== 'checked'\n    for (const { row, key, selectableRow } of pageRows) {\n      if (!selectableRow) continue\n      const had = next.has(key)\n      if (adding && !had) {\n        next.add(key)\n        onRowSelect?.(row, true)\n      } else if (!adding && had) {\n        next.delete(key)\n        onRowSelect?.(row, false)\n      }\n    }\n    updateSelection(next)\n  }, [updateSelection, selection, headerCheckState, pageRows, onRowSelect])\n\n  const toggleRow = useCallback(\n    (key: string | number, row: T) => {\n      const next = new Set(selection)\n      const selectedNow = !next.has(key)\n      if (selectedNow) {\n        next.add(key)\n      } else {\n        next.delete(key)\n      }\n      onRowSelect?.(row, selectedNow)\n      updateSelection(next)\n    },\n    [updateSelection, selection, onRowSelect]\n  )\n\n  // ─── Expand helpers ───\n  const toggleExpand = useCallback((key: string | number) => {\n    setExpandedRows((prev) => {\n      const next = new Set(prev)\n      if (next.has(key)) {\n        next.delete(key)\n      } else {\n        next.add(key)\n      }\n      return next\n    })\n  }, [])\n\n  // ─── Column toggle helpers ───\n  const toggleColumnVisibility = useCallback((key: string) => {\n    setHiddenColumnKeys((prev) => {\n      const next = new Set(prev)\n      if (next.has(key)) {\n        next.delete(key)\n      } else {\n        next.add(key)\n      }\n      return next\n    })\n  }, [])\n\n  // Total colSpan for full-width rows\n  const totalColSpan = visibleColumns.length + (selectable ? 1 : 0) + (isExpandable ? 1 : 0)\n\n  const getSortIcon = (key: string) => {\n    if (sortState?.key !== key) {\n      return <ArrowUpDown className=\"h-4 w-4 opacity-50\" />\n    }\n    if (sortState.direction === 'asc') {\n      return <ArrowUp className=\"h-4 w-4\" />\n    }\n    return <ArrowDown className=\"h-4 w-4\" />\n  }\n\n  const getCellValue = (row: T, column: Column<T>, index: number): ReactNode => {\n    if (column.cell) {\n      return column.cell(row, index)\n    }\n    const value = (row as Record<string, unknown>)[column.key]\n    if (value === null || value === undefined) return '-'\n    return String(value)\n  }\n\n  return (\n    <div\n      className={cn(\n        bordered && 'rounded-md border',\n        fillHeight && 'flex h-full flex-col',\n        className\n      )}\n    >\n      {columnToggle && (\n        <div className=\"flex items-center justify-end border-b px-4 py-2\">\n          {/* 這個 div 不是互動元素，是 Escape 的捕捉容器：真正可聚焦的控制項在\n              它裡面（下方的 toggle button），關閉行為靠事件冒泡收。照規則加\n              role/tabIndex 會多出一個沒有語意的 tab stop，對鍵盤使用者是退步。 */}\n          {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n          <div\n            ref={columnToggleRef}\n            className=\"relative\"\n            onKeyDown={(e) => {\n              if (e.key === 'Escape') setColumnToggleOpen(false)\n            }}\n          >\n            <Button\n              variant=\"outline\"\n              size=\"sm\"\n              onClick={() => setColumnToggleOpen((o) => !o)}\n              className=\"h-8 gap-1.5\"\n              aria-label={locale.dataTable.toggleColumns}\n            >\n              <Columns3 className=\"h-4 w-4\" />\n              {locale.dataTable.columns}\n            </Button>\n            {columnToggleOpen && (\n              <div className=\"bg-popover absolute top-full right-0 z-20 mt-1 min-w-[10rem] rounded-md border p-1 shadow-md\">\n                {toggleableColumns.map((col) => {\n                  const isVisible = !hiddenColumnKeys.has(col.key)\n                  return (\n                    <button\n                      key={col.key}\n                      type=\"button\"\n                      onClick={() => toggleColumnVisibility(col.key)}\n                      className=\"hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm\"\n                    >\n                      <span\n                        className={cn(\n                          'inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border',\n                          isVisible\n                            ? 'border-primary bg-primary text-primary-foreground'\n                            : 'border-input'\n                        )}\n                      >\n                        {isVisible && <Check className=\"h-3 w-3\" />}\n                      </span>\n                      {typeof col.header === 'string' ? col.header : col.key}\n                    </button>\n                  )\n                })}\n              </div>\n            )}\n          </div>\n        </div>\n      )}\n\n      {/* fillHeight 模式：middle 只當 flex 容器，scroll 交給 Table 的 wrapper。\n          其他模式不需要中間層——maxHeight 直接給 Table 的 wrapper，讓「有\n          overflow 的元素」和「有高度上限的元素」是同一個，sticky thead 才\n          咬得住（兩層 overflow 嵌套會讓 sticky 完全失效）。 */}\n      <div className={cn(fillHeight && 'min-h-0 flex-1')}>\n        <Table\n          stickyHeader={stickyHeader}\n          fillHeight={fillHeight}\n          hoverable={hoverable}\n          compact={compact}\n          minWidth={minWidth}\n          maxHeight={fillHeight ? undefined : maxHeight}\n          scrollFade={scrollFade}\n          wrapperProps={stickyHeader ? { 'data-testid': 'sticky-scroll-container' } : undefined}\n        >\n          <TableHeader>\n            <TableRow>\n              {isExpandable && (\n                <TableHead style={{ width: 40 }} className=\"px-2\">\n                  <span className=\"sr-only\">{locale.dataTable.expand}</span>\n                </TableHead>\n              )}\n              {selectable && (\n                <TableHead style={{ width: 40 }} className=\"px-3\">\n                  <SelectionCheckbox\n                    state={headerCheckState}\n                    onChange={toggleAll}\n                    aria-label={locale.dataTable.selectAllRows}\n                  />\n                </TableHead>\n              )}\n              {visibleColumns.map((column) => {\n                const isFilterActive = (filters[column.key]?.length ?? 0) > 0\n                const isFilterOpen = openFilterKey === column.key\n                return (\n                  <TableHead\n                    key={column.key}\n                    stickyLead={column.pinned === 'left'}\n                    stickyAction={column.pinned === 'right'}\n                    aria-sort={\n                      column.sortable && sortState?.key === column.key && sortState.direction\n                        ? sortState.direction === 'asc'\n                          ? 'ascending'\n                          : 'descending'\n                        : undefined\n                    }\n                    style={{ width: column.width, ...column.headerStyle }}\n                    className={cn(\n                      // Pinned headers are position:sticky — `relative` would\n                      // override it (the filter dropdown anchors fine either way)\n                      !column.pinned && 'relative',\n                      responsiveHiddenClass(column.hidden),\n                      column.align === 'center' && 'text-center',\n                      column.align === 'right' && 'text-right',\n                      column.headerClassName\n                    )}\n                  >\n                    <div className=\"inline-flex items-center gap-1\">\n                      {column.sortable ? (\n                        <button\n                          onClick={() => handleSort(column.key)}\n                          className=\"hover:text-foreground inline-flex items-center gap-1\"\n                          aria-label={\n                            typeof column.header === 'string'\n                              ? locale.dataTable.sortBy(column.header)\n                              : locale.dataTable.sortColumn\n                          }\n                        >\n                          {column.header}\n                          {getSortIcon(column.key)}\n                        </button>\n                      ) : (\n                        column.header\n                      )}\n                      {/* 同上：Escape 捕捉容器，非互動元素。\n                          這裡用 disable/enable 包住，而不是 disable-next-line：後者得寫在\n                          `&& (` 之後的表達式位置，那是**裸的 JS 註解**，esbuild 會把它原樣\n                          打進 dist（實測 index.js 裡真的出現了那行中文）。JSX 註解則在編譯\n                          階段就消掉。 */}\n                      {/* eslint-disable jsx-a11y/no-static-element-interactions */}\n                      {canRenderFilter(column) && (\n                        <div\n                          ref={(el) => {\n                            filterDropdownRefs.current[column.key] = el\n                          }}\n                          className=\"relative inline-block\"\n                          onKeyDown={(e) => {\n                            if (e.key === 'Escape') setOpenFilterKey(null)\n                          }}\n                        >\n                          <button\n                            type=\"button\"\n                            onClick={(e) => {\n                              e.stopPropagation()\n                              setOpenFilterKey(isFilterOpen ? null : column.key)\n                            }}\n                            aria-label={locale.dataTable.filterBy(\n                              typeof column.header === 'string' ? column.header : column.key\n                            )}\n                            className={cn(\n                              'hover:bg-accent inline-flex h-5 w-5 items-center justify-center rounded-sm',\n                              isFilterActive ? 'text-primary' : 'opacity-50'\n                            )}\n                          >\n                            <ListFilter className=\"h-3.5 w-3.5\" />\n                          </button>\n                          {isFilterOpen && (\n                            <div\n                              data-testid={`filter-dropdown-${column.key}`}\n                              className=\"bg-popover absolute top-full left-0 z-20 mt-1 min-w-[10rem] rounded-md border p-1 shadow-md\"\n                            >\n                              {getFilterOptions(column).map((option) => {\n                                const isSelected = filters[column.key]?.includes(option) ?? false\n                                return (\n                                  <button\n                                    key={option}\n                                    type=\"button\"\n                                    role=\"checkbox\"\n                                    aria-checked={filters[column.key]?.includes(option) ?? false}\n                                    aria-label={option}\n                                    onClick={() => toggleFilterValue(column.key, option)}\n                                    className=\"hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm\"\n                                  >\n                                    <span\n                                      className={cn(\n                                        'inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border',\n                                        isSelected\n                                          ? 'border-primary bg-primary text-primary-foreground'\n                                          : 'border-input'\n                                      )}\n                                    >\n                                      {isSelected && <Check className=\"h-3 w-3\" />}\n                                    </span>\n                                    {option}\n                                  </button>\n                                )\n                              })}\n                              {isFilterActive && (\n                                <button\n                                  type=\"button\"\n                                  onClick={() => clearColumnFilter(column.key)}\n                                  className=\"text-muted-foreground hover:bg-accent hover:text-accent-foreground mt-1 flex w-full items-center justify-center rounded-sm border-t px-2 py-1.5 text-sm\"\n                                >\n                                  {locale.dataTable.clearFilter}\n                                </button>\n                              )}\n                            </div>\n                          )}\n                        </div>\n                      )}\n                      {/* eslint-enable jsx-a11y/no-static-element-interactions */}\n                    </div>\n                  </TableHead>\n                )\n              })}\n            </TableRow>\n          </TableHeader>\n          <TableBody>\n            {loading ? (\n              <TableRow>\n                <TableCell colSpan={totalColSpan} className=\"h-24 text-center\">\n                  <div className=\"flex items-center justify-center gap-2\">\n                    <div className=\"border-primary h-4 w-4 animate-spin rounded-full border-2 border-t-transparent\" />\n                    <span className=\"text-muted-foreground\">{locale.dataTable.loading}</span>\n                  </div>\n                </TableCell>\n              </TableRow>\n            ) : paginatedData.length === 0 ? (\n              <TableRow>\n                <TableCell\n                  colSpan={totalColSpan}\n                  className=\"text-muted-foreground h-24 text-center\"\n                >\n                  {emptyContent || locale.dataTable.emptyMessage}\n                </TableCell>\n              </TableRow>\n            ) : (\n              paginatedData.map((row, pageLocalIndex) => {\n                const globalIndex = pagination\n                  ? pageIndex * pageSize + pageLocalIndex\n                  : pageLocalIndex\n                const rowKey = getRowKey(row, globalIndex)\n                const isSelected = selectable && selection.has(rowKey)\n                const isExpanded = isExpandable && expandedRows.has(rowKey)\n                return (\n                  <Fragment key={rowKey}>\n                    <TableRow\n                      onClick={onRowClick ? () => onRowClick(row, globalIndex) : undefined}\n                      tabIndex={onRowClick ? 0 : undefined}\n                      onKeyDown={\n                        onRowClick\n                          ? (e) => {\n                              // Only when the row itself is focused — Enter/Space on\n                              // inner buttons must not double as row activation.\n                              if (e.target !== e.currentTarget) return\n                              if (e.key === 'Enter' || e.key === ' ') {\n                                e.preventDefault()\n                                onRowClick(row, globalIndex)\n                              }\n                            }\n                          : undefined\n                      }\n                      className={cn(\n                        onRowClick && 'cursor-pointer',\n                        isSelected && 'bg-primary/5',\n                        typeof rowClassName === 'function'\n                          ? rowClassName(row, globalIndex)\n                          : rowClassName\n                      )}\n                      data-selected={isSelected || undefined}\n                    >\n                      {isExpandable && (\n                        <TableCell className=\"px-2\">\n                          <button\n                            type=\"button\"\n                            onClick={(e) => {\n                              e.stopPropagation()\n                              toggleExpand(rowKey)\n                            }}\n                            className=\"hover:bg-accent inline-flex h-6 w-6 items-center justify-center rounded-sm\"\n                            aria-label={\n                              isExpanded ? locale.dataTable.collapseRow : locale.dataTable.expandRow\n                            }\n                          >\n                            <ChevronDown\n                              className={cn(\n                                'h-4 w-4 transition-transform',\n                                isExpanded && 'rotate-180'\n                              )}\n                            />\n                          </button>\n                        </TableCell>\n                      )}\n                      {selectable && (\n                        <TableCell className=\"px-3\">\n                          <SelectionCheckbox\n                            state={isSelected ? 'checked' : 'unchecked'}\n                            onChange={() => toggleRow(rowKey, row)}\n                            disabled={isRowSelectable ? !isRowSelectable(row, globalIndex) : false}\n                            aria-label={locale.dataTable.selectRow(rowKey)}\n                          />\n                        </TableCell>\n                      )}\n                      {visibleColumns.map((column) => (\n                        <TableCell\n                          key={column.key}\n                          stickyLead={column.pinned === 'left'}\n                          stickyAction={column.pinned === 'right'}\n                          style={\n                            typeof column.cellStyle === 'function'\n                              ? column.cellStyle(row, globalIndex)\n                              : column.cellStyle\n                          }\n                          className={cn(\n                            responsiveHiddenClass(column.hidden),\n                            column.align === 'center' && 'text-center',\n                            column.align === 'right' && 'text-right',\n                            typeof column.cellClassName === 'function'\n                              ? column.cellClassName(row, globalIndex)\n                              : column.cellClassName\n                          )}\n                        >\n                          {getCellValue(row, column, globalIndex)}\n                        </TableCell>\n                      ))}\n                    </TableRow>\n                    {isExpanded && (\n                      <TableRow>\n                        <TableCell colSpan={totalColSpan} className=\"bg-muted/30 p-4\">\n                          {expandedRowRenderer?.(row, globalIndex)}\n                        </TableCell>\n                      </TableRow>\n                    )}\n                  </Fragment>\n                )\n              })\n            )}\n          </TableBody>\n        </Table>\n      </div>\n\n      {pagination && totalRowCount > 0 && (!isServerMode || data.length > 0) && (\n        <div className=\"flex items-center justify-between border-t px-6 py-4\">\n          <div className=\"text-muted-foreground flex items-center gap-2 text-sm\">\n            {hasActiveFilters && !isServerMode && (\n              <span data-testid=\"filter-count\">\n                {locale.dataTable.showing(filteredData.length, data.length)}\n              </span>\n            )}\n            {/* Server mode can't re-slice locally — without a callback the\n                selector would change the footer math but not the rows. */}\n            {(!isServerMode || onPageSizeChange != null) && (\n              <>\n                <span>{locale.pagination.rowsPerPage}</span>\n                <select\n                  value={pageSize}\n                  onChange={(e) => setPageSize(Number(e.target.value))}\n                  aria-label={locale.pagination.rowsPerPage}\n                  className=\"border-input bg-background ring-offset-background focus:ring-ring/40 h-8 w-16 cursor-pointer rounded-md border px-2 text-sm focus:ring-1 focus:ring-offset-0 focus:outline-none\"\n                >\n                  {pageSizeOptions.map((size) => (\n                    <option key={size} value={size}>\n                      {size}\n                    </option>\n                  ))}\n                </select>\n              </>\n            )}\n          </div>\n\n          <div className=\"flex items-center gap-4\">\n            <span className=\"text-muted-foreground text-sm\">\n              {locale.pagination.rangeInfo(\n                pageIndex * pageSize + 1,\n                Math.min((pageIndex + 1) * pageSize, totalRowCount),\n                totalRowCount\n              )}\n            </span>\n\n            {totalPages > 1 && (\n              <div className=\"flex items-center gap-1\">\n                <Button\n                  variant=\"outline\"\n                  size=\"icon\"\n                  onClick={() => goToPage(0)}\n                  disabled={!canPreviousPage}\n                  className=\"h-8 w-8\"\n                  aria-label={locale.pagination.firstPage}\n                >\n                  <ChevronsLeft className=\"h-4 w-4\" />\n                </Button>\n                <Button\n                  variant=\"outline\"\n                  size=\"icon\"\n                  onClick={() => goToPage(pageIndex - 1)}\n                  disabled={!canPreviousPage}\n                  className=\"h-8 w-8\"\n                  aria-label={locale.pagination.previousPage}\n                >\n                  <ChevronLeft className=\"h-4 w-4\" />\n                </Button>\n                <span className=\"flex h-8 min-w-[4rem] items-center justify-center text-sm\">\n                  {pageIndex + 1} / {totalPages}\n                </span>\n                <Button\n                  variant=\"outline\"\n                  size=\"icon\"\n                  onClick={() => goToPage(pageIndex + 1)}\n                  disabled={!canNextPage}\n                  className=\"h-8 w-8\"\n                  aria-label={locale.pagination.nextPage}\n                >\n                  <ChevronRight className=\"h-4 w-4\" />\n                </Button>\n                <Button\n                  variant=\"outline\"\n                  size=\"icon\"\n                  onClick={() => goToPage(totalPages - 1)}\n                  disabled={!canNextPage}\n                  className=\"h-8 w-8\"\n                  aria-label={locale.pagination.lastPage}\n                >\n                  <ChevronsRight className=\"h-4 w-4\" />\n                </Button>\n              </div>\n            )}\n          </div>\n        </div>\n      )}\n    </div>\n  )\n}\n","import {\n  forwardRef,\n  useLayoutEffect,\n  useRef,\n  useState,\n  type HTMLAttributes,\n  type ReactNode,\n  type TdHTMLAttributes,\n  type ThHTMLAttributes,\n} from 'react'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\nimport { warnUsage } from '../../utils/deprecate'\nimport { ScrollFade, type DataAttributes } from '../scroll-fade/ScrollFade'\n\n// Includes HTML's deprecated `align` values so third-party renderers (e.g.\n// markdown td/th mappings) type-check — justify/char simply apply nothing.\ntype TableAlign = 'left' | 'center' | 'right' | 'justify' | 'char'\n\nconst alignStyles: Record<TableAlign, string | false> = {\n  left: false,\n  center: 'text-center',\n  right: 'text-right',\n  justify: false,\n  char: false,\n}\n\nexport interface TableProps extends HTMLAttributes<HTMLTableElement> {\n  /** Table variant */\n  variant?: 'default' | 'striped'\n  /** Compact table */\n  compact?: boolean\n  /** Bordered table */\n  bordered?: boolean\n  /** Row hover feedback @default true — pass `false` for static/print-like tables */\n  hoverable?: boolean\n  /**\n   * Sticky header — stays fixed while scrolling vertically.\n   *\n   * Needs a height limit on the scroll wrapper to do anything: pass\n   * `maxHeight` (or `fillHeight` inside a determinate-height flex chain).\n   * Wrapping the table in your own `overflow-auto` box does NOT work — that\n   * makes the wrapper the nearest scrollport, and the header sticks to a box\n   * that never scrolls vertically, so it scrolls out of view.\n   */\n  stickyHeader?: boolean\n  /**\n   * Make the scroll wrapper fill its parent's height (`h-full`).\n   * Use this when the table is inside a fixed-height flex container so the\n   * horizontal scrollbar pins to the bottom of the viewport even when there\n   * are few rows. The parent must provide a determinate height (e.g.\n   * `flex-1 min-h-0` inside a `flex flex-col` chain).\n   */\n  fillHeight?: boolean\n  /**\n   * Minimum table width (e.g. `960`, `'60rem'`). Below it the wrapper scrolls\n   * horizontally instead of squashing every column to its min-content width.\n   *\n   * **Wide tables need this.** `width: 100%` + auto layout means a table with\n   * many columns — or CJK headers, which break between characters — shrinks to\n   * min-content first: columns collapse to ~30px and headers stack vertically\n   * *before* any scrollbar appears. It is also what makes `stickyLead` /\n   * `stickyAction` (and `DataTable`'s `Column.pinned`) reachable at all —\n   * frozen columns are meaningless if the table never overflows.\n   */\n  minWidth?: string | number\n  /**\n   * Max height of the scroll wrapper (e.g. `'400px'`, `'60vh'`) — the element\n   * that owns `overflow`, which is what `stickyHeader` sticks to.\n   */\n  maxHeight?: string | number\n  /**\n   * Show fades at the horizontal edges while content is hidden there, as a\n   * \"this scrolls sideways\" affordance.\n   * @default true when `minWidth` is set\n   */\n  scrollFade?: boolean\n  /** Class for the scroll wrapper (the element that owns `overflow`) */\n  wrapperClassName?: string\n  /**\n   * Props for the scroll wrapper — most usefully the a11y trio that makes a\n   * scroll region keyboard-reachable: `tabIndex={0}`, `role=\"region\"`,\n   * `aria-label`.\n   */\n  wrapperProps?: HTMLAttributes<HTMLDivElement> & DataAttributes\n}\n\n/**\n * Styled HTML table with support for striping, density, borders, and sticky\n * headers. The style props are exposed as `data-*` attributes consumed by CSS\n * on the child components — attribute PRESENCE activates the selectors, so\n * falsy values must render as `undefined` (never `\"false\"`).\n */\nexport const Table = forwardRef<HTMLTableElement, TableProps>(\n  (\n    {\n      className,\n      variant = 'default',\n      compact,\n      bordered,\n      hoverable = true,\n      stickyHeader,\n      fillHeight,\n      minWidth,\n      maxHeight,\n      scrollFade,\n      wrapperClassName,\n      wrapperProps,\n      style,\n      ...props\n    },\n    ref\n  ) => {\n    // Composition guard: sticky positioning resolves against the nearest\n    // scrollport. With no height limit the wrapper never scrolls vertically,\n    // so the header has nothing to stick to and rides away with the rows.\n    if (stickyHeader && maxHeight == null && !fillHeight) {\n      warnUsage(\n        'Table',\n        'sticky-without-height',\n        '`stickyHeader` is set but neither `maxHeight` nor `fillHeight` is — the scroll wrapper has no height limit, so nothing scrolls vertically and the header does not stick. Wrapping the table in your own `overflow-auto` box does not work either; pass `maxHeight` here instead.'\n      )\n    }\n\n    const table = (\n      <table\n        ref={ref}\n        className={cn(\n          // border-separate + border-spacing-0 是 cross-browser sticky thead 必須\n          // 預設 border-collapse:collapse 在 Chrome 會讓 sticky 失效\n          'w-full caption-bottom border-separate border-spacing-0 text-sm',\n          bordered && 'border',\n          className\n        )}\n        style={minWidth != null ? { minWidth, ...style } : style}\n        data-variant={variant}\n        data-compact={compact || undefined}\n        data-hoverable={hoverable || undefined}\n        data-sticky-header={stickyHeader || undefined}\n        {...props}\n      />\n    )\n\n    // The wrapper is the single scroll container: it owns overflow AND the\n    // height limit, so `position: sticky` inside resolves against a scrollport\n    // that actually scrolls. Nesting another overflow box around it silently\n    // kills stickyHeader.\n    const scrollClass = cn('relative w-full', fillHeight && 'h-full', wrapperClassName)\n    const { style: wrapperStyle, ...restWrapperProps } = wrapperProps ?? {}\n    // Merged rather than spread-over, so wrapperProps.style can't drop maxHeight.\n    const scrollStyle = maxHeight != null ? { maxHeight, ...wrapperStyle } : wrapperStyle\n\n    // Fades default on for wide tables (`minWidth`), which are exactly the ones\n    // whose hidden columns need advertising.\n    if (scrollFade ?? minWidth != null) {\n      return (\n        <ScrollFade\n          className={cn('w-full', fillHeight && 'h-full')}\n          scrollClassName={scrollClass}\n          style={scrollStyle}\n          data-scroll-container=\"\"\n          {...restWrapperProps}\n        >\n          {table}\n        </ScrollFade>\n      )\n    }\n\n    return (\n      <div\n        className={cn(scrollClass, 'overflow-auto')}\n        style={scrollStyle}\n        data-scroll-container=\"\"\n        {...restWrapperProps}\n      >\n        {table}\n      </div>\n    )\n  }\n)\n\nTable.displayName = 'Table'\n\nexport type TableHeaderProps = HTMLAttributes<HTMLTableSectionElement>\n\n/** Table header section with optional sticky positioning. */\nexport const TableHeader = forwardRef<HTMLTableSectionElement, TableHeaderProps>(\n  ({ className, ...props }, ref) => (\n    <thead\n      ref={ref}\n      className={cn(\n        // Separator lives on the cells: the table is border-separate (needed\n        // for cross-browser sticky headers) and row/row-group borders don't\n        // paint in that model\n        '[&_th]:border-b',\n        /* Sticky header: activated by parent table[data-sticky-header] */\n        '[table[data-sticky-header]_&]:bg-background [table[data-sticky-header]_&]:shadow-sticky-header [table[data-sticky-header]_&]:sticky [table[data-sticky-header]_&]:top-0 [table[data-sticky-header]_&]:z-10',\n        className\n      )}\n      {...props}\n    />\n  )\n)\n\nTableHeader.displayName = 'TableHeader'\n\nexport type TableBodyProps = HTMLAttributes<HTMLTableSectionElement>\n\n/** Table body section containing data rows. */\nexport const TableBody = forwardRef<HTMLTableSectionElement, TableBodyProps>(\n  ({ className, ...props }, ref) => (\n    <tbody ref={ref} className={cn('[&_tr:last-child_td]:border-b-0', className)} {...props} />\n  )\n)\n\nTableBody.displayName = 'TableBody'\n\nexport type TableFooterProps = HTMLAttributes<HTMLTableSectionElement>\n\n/** Table footer section for summary or aggregate content. */\nexport const TableFooter = forwardRef<HTMLTableSectionElement, TableFooterProps>(\n  ({ className, ...props }, ref) => (\n    <tfoot\n      ref={ref}\n      className={cn('bg-muted/50 font-medium [&_td]:border-t', className)}\n      {...props}\n    />\n  )\n)\n\nTableFooter.displayName = 'TableFooter'\n\nexport interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {\n  /** Selected state */\n  selected?: boolean\n}\n\n/** Table row with hover and selected state styling. */\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(\n  ({ className, selected, ...props }, ref) => (\n    <tr\n      ref={ref}\n      className={cn(\n        'transition-colors',\n        // Hover feedback is opt-in via table[data-hoverable] (Table `hoverable`)\n        '[table[data-hoverable]_&:hover]:bg-muted/50',\n        // Zebra striping via table[data-variant=striped], body rows only\n        '[table[data-variant=striped]_tbody_&:nth-child(even)]:bg-muted/30',\n        'data-[state=selected]:bg-muted',\n        selected && 'bg-muted',\n        className\n      )}\n      data-state={selected ? 'selected' : undefined}\n      {...props}\n    />\n  )\n)\n\nTableRow.displayName = 'TableRow'\n\nexport interface TableHeadProps extends Omit<ThHTMLAttributes<HTMLTableCellElement>, 'align'> {\n  /** Sortable column */\n  sortable?: boolean\n  /** Sort direction */\n  sortDirection?: 'asc' | 'desc' | null\n  /** Text alignment @default \"left\" */\n  align?: TableAlign\n  /** Sticky action column — pins to the right edge during horizontal scroll */\n  stickyAction?: boolean\n  /** Sticky lead column — pins to the left edge during horizontal scroll (e.g. a ticker/name column in a wide table) */\n  stickyLead?: boolean\n}\n\n/** Table header cell with optional sort indicators and sticky positioning. */\nexport const TableHead = forwardRef<HTMLTableCellElement, TableHeadProps>(\n  (\n    {\n      className,\n      sortable,\n      sortDirection,\n      align = 'left',\n      stickyAction,\n      stickyLead,\n      children,\n      ...props\n    },\n    ref\n  ) => (\n    <th\n      ref={ref}\n      className={cn(\n        'text-muted-foreground h-10 px-4 text-left align-middle font-medium',\n        '[table[data-compact]_&]:h-8 [table[data-compact]_&]:px-3',\n        '[&:has([role=checkbox])]:pr-0',\n        alignStyles[align],\n        sortable && 'hover:text-foreground cursor-pointer select-none',\n        stickyAction && 'bg-background shadow-sticky-left sticky right-0',\n        stickyLead && 'bg-background shadow-sticky-right sticky left-0',\n        className\n      )}\n      data-sticky-action={stickyAction || undefined}\n      data-sticky-lead={stickyLead || undefined}\n      {...props}\n    >\n      {sortable ? (\n        <div className=\"flex items-center gap-1\">\n          {children}\n          <span className=\"text-xs\">\n            {sortDirection === 'asc' && '\\u2191'}\n            {sortDirection === 'desc' && '\\u2193'}\n            {!sortDirection && '\\u2195'}\n          </span>\n        </div>\n      ) : (\n        children\n      )}\n    </th>\n  )\n)\n\nTableHead.displayName = 'TableHead'\n\nexport interface TableCellProps extends Omit<TdHTMLAttributes<HTMLTableCellElement>, 'align'> {\n  /** Text alignment @default \"left\" */\n  align?: TableAlign\n  /** Numeric cell — right-aligned with tabular figures so digit columns line up */\n  numeric?: boolean\n  /** Sticky action column — pins to the right edge during horizontal scroll */\n  stickyAction?: boolean\n  /** Sticky lead column — pins to the left edge during horizontal scroll (e.g. a ticker/name column in a wide table) */\n  stickyLead?: boolean\n}\n\n/** Table data cell with optional alignment, numeric formatting, and sticky columns. */\nexport const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(\n  ({ className, align = 'left', numeric, stickyAction, stickyLead, ...props }, ref) => (\n    <td\n      ref={ref}\n      className={cn(\n        // Row separator lives here — tr borders don't paint under border-separate\n        'border-b p-4 align-middle [&:has([role=checkbox])]:pr-0',\n        '[table[data-compact]_&]:px-3 [table[data-compact]_&]:py-2',\n        alignStyles[align],\n        numeric && 'text-right tabular-nums',\n        stickyAction && 'bg-background shadow-sticky-left sticky right-0',\n        stickyLead && 'bg-background shadow-sticky-right sticky left-0',\n        className\n      )}\n      data-sticky-action={stickyAction || undefined}\n      data-sticky-lead={stickyLead || undefined}\n      {...props}\n    />\n  )\n)\n\nTableCell.displayName = 'TableCell'\n\nexport type TableCaptionProps = HTMLAttributes<HTMLTableCaptionElement>\n\n/** Table caption displayed below the table. */\nexport const TableCaption = forwardRef<HTMLTableCaptionElement, TableCaptionProps>(\n  ({ className, ...props }, ref) => (\n    <caption ref={ref} className={cn('text-muted-foreground mt-4 text-sm', className)} {...props} />\n  )\n)\n\nTableCaption.displayName = 'TableCaption'\n\n/**\n * Auto colSpan: count the header cells of the enclosing table once mounted.\n * An explicit colSpan skips measuring (use it when columns change at runtime).\n */\nfunction useAutoColSpan(explicit?: number) {\n  const ref = useRef<HTMLTableCellElement>(null)\n  const [measured, setMeasured] = useState(1)\n  useLayoutEffect(() => {\n    if (explicit != null) return\n    const table = ref.current?.closest('table')\n    const headerRow = table?.querySelector('thead tr')\n    const count = headerRow?.children.length ?? 0\n    if (count > 0) setMeasured(count)\n  }, [explicit])\n  return { ref, colSpan: explicit ?? measured }\n}\n\nexport interface TableEmptyProps {\n  /** Span — measured from the header row when omitted */\n  colSpan?: number\n  /** Custom empty content — defaults to the locale's empty message */\n  children?: ReactNode\n  className?: string\n}\n\n/** Full-width empty-state row for the Table family (colSpan handled for you). */\nexport function TableEmpty({ colSpan, children, className }: TableEmptyProps) {\n  const locale = useLocale()\n  const auto = useAutoColSpan(colSpan)\n  return (\n    <TableRow>\n      <TableCell\n        ref={auto.ref}\n        colSpan={auto.colSpan}\n        className={cn('text-muted-foreground h-24 text-center', className)}\n      >\n        {children ?? locale.dataTable.emptyMessage}\n      </TableCell>\n    </TableRow>\n  )\n}\n\nexport interface TableLoadingProps {\n  /** Span — measured from the header row when omitted */\n  colSpan?: number\n  /** Custom label — defaults to the locale's loading message */\n  children?: ReactNode\n  className?: string\n}\n\n/** Full-width loading row for the Table family (colSpan handled for you). */\nexport function TableLoading({ colSpan, children, className }: TableLoadingProps) {\n  const locale = useLocale()\n  const auto = useAutoColSpan(colSpan)\n  return (\n    <TableRow>\n      <TableCell\n        ref={auto.ref}\n        colSpan={auto.colSpan}\n        className={cn('h-24 text-center', className)}\n      >\n        <div className=\"flex items-center justify-center gap-2\">\n          <div className=\"border-primary h-4 w-4 animate-spin rounded-full border-2 border-t-transparent\" />\n          <span className=\"text-muted-foreground\">{children ?? locale.dataTable.loading}</span>\n        </div>\n      </TableCell>\n    </TableRow>\n  )\n}\n","import {\n  forwardRef,\n  useCallback,\n  useEffect,\n  useImperativeHandle,\n  useRef,\n  useState,\n  type HTMLAttributes,\n  type ReactNode,\n} from 'react'\nimport { cn } from '../../utils/cn'\n\n/** `data-*` passthrough — plain typed prop objects can't carry them otherwise. */\nexport type DataAttributes = {\n  [key: `data-${string}`]: string | number | boolean | undefined\n}\n\nexport interface ScrollFadeProps extends HTMLAttributes<HTMLDivElement>, DataAttributes {\n  /** Content that may overflow horizontally */\n  children: ReactNode\n  /**\n   * Class for the **outer** box — layout and positioning (margins, height,\n   * `flex-1`…). The fade overlays are positioned against this element.\n   */\n  className?: string\n  /**\n   * Class for the **scrolling** element — padding, `max-h-*`, background.\n   * Anything that should scroll with, or clip, the content goes here.\n   */\n  scrollClassName?: string\n}\n\n/** Width of the fade, in px — matches the 12px sticky-column shadow spread. */\nconst FADE_WIDTH = 12\n\n/**\n * Horizontal scroll container with edge fades that appear only on the side\n * where content is actually hidden — the \"you can scroll this\" affordance for\n * pill rows, tab strips, toolbars, and wide tables.\n *\n * The fades are driven by real scroll state (scroll + resize observed), not a\n * static gradient, so nothing shows when the content fits. They are painted\n * with `foreground` at low alpha, which reads as a shadow in light mode and a\n * glow in dark mode — no surface color to keep in sync, so it works unchanged\n * on `background`, `card`, or `muted`.\n *\n * The forwarded ref points at the scrolling element (for `scrollTo` etc.).\n *\n * @example\n * ```tsx\n * <ScrollFade className=\"-mx-6\" scrollClassName=\"px-6\">\n *   <TabsList>…</TabsList>\n * </ScrollFade>\n * ```\n */\nexport const ScrollFade = forwardRef<HTMLDivElement, ScrollFadeProps>(\n  ({ children, className, scrollClassName, onScroll, ...props }, ref) => {\n    const scrollRef = useRef<HTMLDivElement>(null)\n    useImperativeHandle(ref, () => scrollRef.current as HTMLDivElement)\n    const [edges, setEdges] = useState({ start: false, end: false })\n\n    const measure = useCallback(() => {\n      const el = scrollRef.current\n      if (!el) return\n      const max = el.scrollWidth - el.clientWidth\n      // 1px tolerance: sub-pixel layout leaves a fractional remainder at the\n      // extremes, which would otherwise keep a fade permanently lit.\n      const start = el.scrollLeft > 1\n      const end = max > 1 && el.scrollLeft < max - 1\n      setEdges((prev) => (prev.start === start && prev.end === end ? prev : { start, end }))\n    }, [])\n\n    useEffect(() => {\n      const el = scrollRef.current\n      if (!el) return\n      measure()\n      // Content growth (async data) and container resize both change what is\n      // hidden without ever firing `scroll`. Absent in jsdom — consumers run\n      // component tests there, so this must degrade to scroll-only, not throw.\n      if (typeof ResizeObserver === 'undefined') return\n      const observer = new ResizeObserver(measure)\n      observer.observe(el)\n      const child = el.firstElementChild\n      if (child) observer.observe(child)\n      return () => observer.disconnect()\n    }, [measure])\n\n    return (\n      <div className={cn('relative', className)}>\n        <div\n          ref={scrollRef}\n          // overflow-x:auto forces the visible y-axis to compute to auto, so a\n          // `max-h-*` on this element still scrolls vertically.\n          className={cn('overflow-x-auto', scrollClassName)}\n          {...props}\n          // After the spread: a caller's own onScroll composes with the\n          // measurement instead of silently replacing it.\n          onScroll={(e) => {\n            measure()\n            onScroll?.(e)\n          }}\n        >\n          {children}\n        </div>\n        {edges.start && (\n          <span\n            aria-hidden=\"true\"\n            data-scroll-fade=\"start\"\n            className=\"from-foreground/15 pointer-events-none absolute inset-y-0 left-0 bg-gradient-to-r to-transparent\"\n            style={{ width: FADE_WIDTH }}\n          />\n        )}\n        {edges.end && (\n          <span\n            aria-hidden=\"true\"\n            data-scroll-fade=\"end\"\n            className=\"from-foreground/15 pointer-events-none absolute inset-y-0 right-0 bg-gradient-to-l to-transparent\"\n            style={{ width: FADE_WIDTH }}\n          />\n        )}\n      </div>\n    )\n  }\n)\n\nScrollFade.displayName = 'ScrollFade'\n","import {\n  createContext,\n  forwardRef,\n  useContext,\n  type HTMLAttributes,\n  type MouseEvent,\n  type ReactNode,\n} from 'react'\nimport { cn } from '../../utils/cn'\n\nexport type CardDensity = 'default' | 'compact'\n\nexport interface CardProps extends HTMLAttributes<HTMLDivElement> {\n  /** Card padding */\n  padding?: 'none' | 'sm' | 'md' | 'lg'\n  /** Card shadow */\n  shadow?: 'none' | 'sm' | 'md' | 'lg'\n  /** Hover effect */\n  hoverable?: boolean\n  /** Card border */\n  bordered?: boolean\n  /**\n   * @deprecated No longer read — `onClick` alone now grants button semantics.\n   *\n   * Until v0.23 the condition was `interactive && onClick != null`, so a card\n   * given only `onClick` fired on click yet had no `role`, no `tabIndex`, and\n   * no keyboard activation: reachable with a mouse, unreachable with a\n   * keyboard (WCAG 2.1.1). A fleet scan found 11 such sites, and the prop's\n   * own documentation described the broken combination as the supported one.\n   * Rather than keep a footgun that the docs actively recommended, the\n   * keyboard path now follows `onClick`.\n   *\n   * Passing it is harmless and changes nothing. It is kept so existing call\n   * sites keep compiling and will be removed in the next major.\n   */\n  interactive?: boolean\n  /** Content density — `compact` tightens header/content/footer padding and typography for dashboard widgets. Inherited by CardHeader/CardContent/CardFooter. */\n  density?: CardDensity\n}\n\nexport interface CardHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n  /** Header title */\n  title?: ReactNode\n  /** Header description */\n  description?: ReactNode\n  /** Header action (button, etc.) */\n  action?: ReactNode\n  /** Right-aligned row of actions (e.g. multiple icon buttons) */\n  actions?: ReactNode\n  /** Density override — defaults to the parent Card's `density` */\n  density?: CardDensity\n  /**\n   * Heading level of the `title` element (visual style is unchanged).\n   * Defaults to 3; set to match the document outline — e.g. `2` when the\n   * card sits directly under a PageHeader's `h1`.\n   */\n  headingLevel?: 2 | 3 | 4 | 5 | 6\n}\n\nexport interface CardContentProps extends HTMLAttributes<HTMLDivElement> {\n  /** Density override — defaults to the parent Card's `density` */\n  density?: CardDensity\n}\n\nexport interface CardFooterProps extends HTMLAttributes<HTMLDivElement> {\n  /** Density override — defaults to the parent Card's `density` */\n  density?: CardDensity\n}\n\nconst CardDensityContext = createContext<CardDensity>('default')\n\n/**\n * Lets descendants know they are inside a Card's surface. `DataTable` uses it\n * to warn about double-border nesting — reading React context rather than\n * inspecting parent DOM nodes, which would be slower and wrong under portals.\n */\nexport const CardSurfaceContext = createContext(false)\n\nconst paddingStyles = {\n  none: '',\n  sm: 'p-3',\n  md: 'p-4',\n  lg: 'p-6',\n}\n\nconst shadowStyles = {\n  none: '',\n  sm: 'shadow-sm',\n  md: 'shadow-md',\n  lg: 'shadow-lg',\n}\n\n/** Styled container surface with configurable padding, shadow, and hover effects. */\nexport const Card = forwardRef<HTMLDivElement, CardProps>(\n  (\n    {\n      className,\n      padding = 'none',\n      shadow = 'sm',\n      hoverable = false,\n      bordered = true,\n      // 仍要解構，否則會落進 ...props 被灑到 <div> 上（React 會對未知的\n      // interactive=\"false\" 屬性告警）。`_` 前綴標明刻意不使用。\n      interactive: _interactive,\n      density = 'default',\n      children,\n      onClick,\n      onKeyDown,\n      ...props\n    },\n    ref\n  ) => {\n    const isInteractive = onClick != null\n    return (\n      <CardDensityContext.Provider value={density}>\n        <CardSurfaceContext.Provider value={true}>\n          {/* role / tabIndex / Enter-Space 三者是跟著 isInteractive 一起上的，\n              而 isInteractive 現在就是「有沒有 onClick」。規則看不出這個連動\n              ——它只看到 onClick 掛在 div 上，看不到同一個條件也決定了 role\n              與鍵盤處理。 */}\n          {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n          <div\n            ref={ref}\n            role={isInteractive ? 'button' : undefined}\n            tabIndex={isInteractive ? 0 : undefined}\n            onClick={onClick}\n            onKeyDown={\n              isInteractive\n                ? (e) => {\n                    onKeyDown?.(e)\n                    // Only when the card itself is focused — Enter/Space on\n                    // inner interactive children must not double-activate.\n                    if (e.target !== e.currentTarget || e.defaultPrevented) return\n                    if (e.key === 'Enter' || e.key === ' ') {\n                      e.preventDefault()\n                      onClick?.(e as unknown as MouseEvent<HTMLDivElement>)\n                    }\n                  }\n                : onKeyDown\n            }\n            className={cn(\n              'bg-card text-card-foreground rounded-lg',\n              bordered && 'border',\n              paddingStyles[padding],\n              shadowStyles[shadow],\n              hoverable && 'cursor-pointer transition-shadow hover:shadow-md',\n              isInteractive &&\n                'focus-visible:ring-ring/40 cursor-pointer transition-shadow hover:shadow-md focus-visible:ring-1 focus-visible:outline-none',\n              className\n            )}\n            {...props}\n          >\n            {children}\n          </div>\n        </CardSurfaceContext.Provider>\n      </CardDensityContext.Provider>\n    )\n  }\n)\n\nCard.displayName = 'Card'\n\n/** Card header section with title, description, and optional action slots. */\nexport const CardHeader = forwardRef<HTMLDivElement, CardHeaderProps>(\n  (\n    {\n      className,\n      title,\n      description,\n      action,\n      actions,\n      density,\n      headingLevel = 3,\n      children,\n      ...props\n    },\n    ref\n  ) => {\n    const contextDensity = useContext(CardDensityContext)\n    const compact = (density ?? contextDensity) === 'compact'\n    const Heading = `h${headingLevel}` as const\n    return (\n      <div\n        ref={ref}\n        className={cn(\n          'flex items-start justify-between gap-4',\n          compact ? 'px-4 py-3' : 'p-4',\n          className\n        )}\n        {...props}\n      >\n        <div className={compact ? 'min-w-0 space-y-1' : 'space-y-1.5'}>\n          {title && (\n            <Heading\n              className={cn(\n                'leading-none font-semibold tracking-tight',\n                compact ? 'text-sm' : 'text-lg'\n              )}\n            >\n              {title}\n            </Heading>\n          )}\n          {description && (\n            <p className={cn('text-muted-foreground', compact ? 'text-xs' : 'text-sm')}>\n              {description}\n            </p>\n          )}\n          {children}\n        </div>\n        {action && <div className=\"shrink-0\">{action}</div>}\n        {actions && <div className=\"flex shrink-0 items-center gap-1\">{actions}</div>}\n      </div>\n    )\n  }\n)\n\nCardHeader.displayName = 'CardHeader'\n\n/** Main body section of a Card. */\nexport const CardContent = forwardRef<HTMLDivElement, CardContentProps>(\n  ({ className, density, ...props }, ref) => {\n    const contextDensity = useContext(CardDensityContext)\n    const compact = (density ?? contextDensity) === 'compact'\n    return (\n      <div\n        ref={ref}\n        className={cn(\n          // `pt-0` only when something sits above (CardHeader, another section):\n          // as the Card's first child it must keep its own top padding, or the\n          // content sits flush against the top border while the other three\n          // sides stay inset — asymmetric and immediately visible.\n          compact ? 'px-4 py-3' : 'p-4',\n          '[&:not(:first-child)]:pt-0',\n          className\n        )}\n        {...props}\n      />\n    )\n  }\n)\n\nCardContent.displayName = 'CardContent'\n\n/** Bottom section of a Card, typically used for actions or metadata. */\nexport const CardFooter = forwardRef<HTMLDivElement, CardFooterProps>(\n  ({ className, density, ...props }, ref) => {\n    const contextDensity = useContext(CardDensityContext)\n    const compact = (density ?? contextDensity) === 'compact'\n    return (\n      <div\n        ref={ref}\n        className={cn(\n          'flex items-center',\n          // Same first-child rule as CardContent — a footer-only Card keeps its\n          // top padding instead of collapsing onto the border.\n          compact ? 'px-4 py-3' : 'p-4',\n          '[&:not(:first-child)]:pt-0',\n          className\n        )}\n        {...props}\n      />\n    )\n  }\n)\n\nCardFooter.displayName = 'CardFooter'\n","import { useCallback, useMemo, useState } from 'react'\nimport type { SortState } from './DataTable'\n\nexport interface ServerTableQuery {\n  /** Current page, 1-based */\n  page: number\n  /** Rows per page */\n  pageSize: number\n  /** Active sort, `null` for none */\n  sort: SortState | null\n  /** Active column filters (column key → selected values) */\n  filters: Record<string, string[]>\n}\n\nexport interface UseServerTableOptions {\n  /** Initial page, 1-based @default 1 */\n  initialPage?: number\n  /** Initial rows per page @default 10 */\n  initialPageSize?: number\n  /** Initial sort @default null */\n  initialSort?: SortState | null\n  /** Initial column filters @default {} */\n  initialFilters?: Record<string, string[]>\n}\n\nexport interface UseServerTableResult {\n  /** Current query state — feed this to your fetcher */\n  query: ServerTableQuery\n  /**\n   * Stable serialization of `query` — use as the dependency of the effect\n   * (or SWR/React Query key) that fetches the page.\n   */\n  queryKey: string\n  /**\n   * Controlled-state props for `<DataTable>` server mode. Spread them and add\n   * your own `data` + `totalRows`:\n   *\n   * ```tsx\n   * <DataTable data={page.items} totalRows={page.total} {...table.props} />\n   * ```\n   */\n  props: {\n    page: number\n    onPageChange: (page: number) => void\n    onPageSizeChange: (pageSize: number) => void\n    sortState: SortState | null\n    onSortChange: (sort: SortState | null) => void\n    filters: Record<string, string[]>\n    onFilterChange: (filters: Record<string, string[]>) => void\n  }\n  setPage: (page: number) => void\n  /** Also resets to page 1 (the old page number is meaningless at a new size) */\n  setPageSize: (pageSize: number) => void\n  /** Also resets to page 1 */\n  setSort: (sort: SortState | null) => void\n  /** Also resets to page 1 */\n  setFilters: (filters: Record<string, string[]>) => void\n  /** Back to the initial query */\n  reset: () => void\n}\n\n/**\n * State helper for `<DataTable>` server-side mode (`totalRows`).\n *\n * Pure client state — no fetching. It owns the six controlled props server\n * mode needs (`page`/`onPageChange`, `onPageSizeChange`, `sortState`/\n * `onSortChange`, `filters`/`onFilterChange`) and exposes them pre-wired via\n * `props`, so the consumer only supplies `data` and `totalRows`:\n *\n * ```tsx\n * const table = useServerTable({ initialPageSize: 20 })\n * useEffect(() => {\n *   fetchUsers(table.query).then(setPage)\n * }, [table.queryKey])\n * return <DataTable columns={columns} data={page.items} totalRows={page.total} {...table.props} />\n * ```\n *\n * Sort and filter changes reset the page to 1 — page N of a differently\n * sorted or filtered result set is a different page N.\n */\nexport function useServerTable(options: UseServerTableOptions = {}): UseServerTableResult {\n  const { initialPage = 1, initialPageSize = 10, initialSort = null, initialFilters } = options\n\n  const initialQuery = useMemo<ServerTableQuery>(\n    () => ({\n      page: initialPage,\n      pageSize: initialPageSize,\n      sort: initialSort,\n      filters: initialFilters ?? {},\n    }),\n    // Initial values are read once — later option changes don't clobber live state\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    []\n  )\n  const [query, setQuery] = useState<ServerTableQuery>(initialQuery)\n\n  const setPage = useCallback((page: number) => {\n    setQuery((prev) => (prev.page === page ? prev : { ...prev, page }))\n  }, [])\n\n  const setPageSize = useCallback((pageSize: number) => {\n    setQuery((prev) => (prev.pageSize === pageSize ? prev : { ...prev, pageSize, page: 1 }))\n  }, [])\n\n  const setSort = useCallback((sort: SortState | null) => {\n    setQuery((prev) => ({ ...prev, sort, page: 1 }))\n  }, [])\n\n  const setFilters = useCallback((filters: Record<string, string[]>) => {\n    setQuery((prev) => ({ ...prev, filters, page: 1 }))\n  }, [])\n\n  const reset = useCallback(() => {\n    setQuery(initialQuery)\n  }, [initialQuery])\n\n  const queryKey = useMemo(() => {\n    const filterKeys = Object.keys(query.filters).sort()\n    return JSON.stringify({\n      page: query.page,\n      pageSize: query.pageSize,\n      sort: query.sort,\n      filters: filterKeys.map((k) => [k, query.filters[k]]),\n    })\n  }, [query])\n\n  const props = useMemo(\n    () => ({\n      page: query.page,\n      onPageChange: setPage,\n      onPageSizeChange: setPageSize,\n      sortState: query.sort,\n      onSortChange: setSort,\n      filters: query.filters,\n      onFilterChange: setFilters,\n    }),\n    [query, setPage, setPageSize, setSort, setFilters]\n  )\n\n  return { query, queryKey, props, setPage, setPageSize, setSort, setFilters, reset }\n}\n","import {\n  forwardRef,\n  useRef,\n  useCallback,\n  useEffect,\n  type ReactNode,\n  type ReactElement,\n  type CSSProperties,\n  type ForwardedRef,\n  type MutableRefObject,\n} from 'react'\nimport { useVirtualizer, type VirtualItem } from '@tanstack/react-virtual'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\nimport { Spinner } from '../spinner/Spinner'\n\n/** Merges the internal scroll-element ref with a forwarded ref. */\nfunction useMergedRef(\n  localRef: MutableRefObject<HTMLDivElement | null>,\n  forwardedRef: ForwardedRef<HTMLDivElement>\n) {\n  return useCallback(\n    (node: HTMLDivElement | null) => {\n      localRef.current = node\n      if (typeof forwardedRef === 'function') {\n        forwardedRef(node)\n      } else if (forwardedRef) {\n        forwardedRef.current = node\n      }\n    },\n    [localRef, forwardedRef]\n  )\n}\n\nexport interface VirtualListProps<T> {\n  /** Array of items to render */\n  items: T[]\n  /** Unique key extractor */\n  getItemKey?: (item: T, index: number) => string | number\n  /** Render function for each item */\n  renderItem: (item: T, index: number, virtualItem: VirtualItem) => ReactNode\n  /** Estimated item height (px) */\n  estimateSize?: number\n  /** Container height */\n  height?: number | string\n  /** Enable dynamic sizing (measure items after render) */\n  dynamicSize?: boolean\n  /** Gap between items (px) */\n  gap?: number\n  /** Overscan count (render extra items outside viewport) */\n  overscan?: number\n  /** Loading state */\n  loading?: boolean\n  /** Empty state content */\n  emptyContent?: ReactNode\n  /** Accessible label for the scrollable region */\n  'aria-label'?: string\n  /** Container className */\n  className?: string\n  /** Inner list className */\n  innerClassName?: string\n}\n\nfunction VirtualListInner<T>(\n  {\n    items,\n    getItemKey,\n    renderItem,\n    estimateSize = 48,\n    height = 400,\n    dynamicSize = false,\n    gap = 0,\n    overscan = 5,\n    loading = false,\n    emptyContent,\n    'aria-label': ariaLabel,\n    className,\n    innerClassName,\n  }: VirtualListProps<T>,\n  ref: ForwardedRef<HTMLDivElement>\n) {\n  const locale = useLocale()\n  const parentRef = useRef<HTMLDivElement>(null)\n  const setRefs = useMergedRef(parentRef, ref)\n\n  const virtualizer = useVirtualizer({\n    count: items.length,\n    getScrollElement: () => parentRef.current,\n    estimateSize: () => estimateSize,\n    overscan,\n    gap,\n    getItemKey: getItemKey ? (index) => getItemKey(items[index], index) : undefined,\n  })\n\n  const virtualItems = virtualizer.getVirtualItems()\n\n  if (loading) {\n    return (\n      <div\n        ref={ref}\n        className={cn('flex items-center justify-center', className)}\n        style={{ height }}\n      >\n        <Spinner size=\"md\" />\n      </div>\n    )\n  }\n\n  if (items.length === 0) {\n    return (\n      <div\n        ref={ref}\n        className={cn('text-muted-foreground flex items-center justify-center text-sm', className)}\n        style={{ height }}\n      >\n        {emptyContent ?? locale.virtualList.empty}\n      </div>\n    )\n  }\n\n  return (\n    <div\n      ref={setRefs}\n      className={cn('overflow-auto', className)}\n      style={{ height }}\n      // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n      tabIndex={0}\n      role=\"region\"\n      aria-label={ariaLabel || locale.virtualList.label}\n    >\n      <div\n        className={cn('relative w-full', innerClassName)}\n        style={{ height: `${virtualizer.getTotalSize()}px` }}\n      >\n        {virtualItems.map((virtualItem) => (\n          <div\n            key={virtualItem.key}\n            ref={dynamicSize ? virtualizer.measureElement : undefined}\n            data-index={virtualItem.index}\n            style={{\n              position: 'absolute',\n              top: 0,\n              left: 0,\n              width: '100%',\n              transform: `translateY(${virtualItem.start}px)`,\n            }}\n          >\n            {renderItem(items[virtualItem.index], virtualItem.index, virtualItem)}\n          </div>\n        ))}\n      </div>\n    </div>\n  )\n}\n\n/** Efficiently renders large lists by only mounting visible items. */\nexport const VirtualList = forwardRef(VirtualListInner) as <T>(\n  props: VirtualListProps<T> & { ref?: ForwardedRef<HTMLDivElement> }\n) => ReactElement\n\n// --- Infinite Scroll ---\n\nexport interface InfiniteScrollProps<T> extends Omit<VirtualListProps<T>, 'loading'> {\n  /** Whether there are more items to load */\n  hasMore: boolean\n  /** Callback to load more items */\n  onLoadMore: () => void\n  /** Whether currently loading more */\n  loadingMore?: boolean\n  /** Initial loading state */\n  loading?: boolean\n  /** Distance from bottom to trigger load (px) */\n  threshold?: number\n  /** Loading more indicator */\n  loadingMoreContent?: ReactNode\n}\n\nfunction InfiniteScrollInner<T>(\n  {\n    items,\n    hasMore,\n    onLoadMore,\n    loadingMore = false,\n    loading = false,\n    threshold = 200,\n    loadingMoreContent,\n    renderItem,\n    estimateSize = 48,\n    height = 400,\n    gap = 0,\n    overscan = 5,\n    getItemKey,\n    dynamicSize = false,\n    emptyContent,\n    'aria-label': ariaLabel,\n    className,\n    innerClassName,\n  }: InfiniteScrollProps<T>,\n  ref: ForwardedRef<HTMLDivElement>\n) {\n  const locale = useLocale()\n  const parentRef = useRef<HTMLDivElement>(null)\n  const setRefs = useMergedRef(parentRef, ref)\n\n  const virtualizer = useVirtualizer({\n    count: items.length,\n    getScrollElement: () => parentRef.current,\n    estimateSize: () => estimateSize,\n    overscan,\n    gap,\n    getItemKey: getItemKey ? (index) => getItemKey(items[index], index) : undefined,\n  })\n\n  const handleScroll = useCallback(() => {\n    const el = parentRef.current\n    if (!el || !hasMore || loadingMore) return\n\n    const distanceFromBottom = el.scrollHeight - el.scrollTop - el.clientHeight\n    if (distanceFromBottom < threshold) {\n      onLoadMore()\n    }\n  }, [hasMore, loadingMore, threshold, onLoadMore])\n\n  useEffect(() => {\n    const el = parentRef.current\n    if (!el) return\n    el.addEventListener('scroll', handleScroll, { passive: true })\n    return () => el.removeEventListener('scroll', handleScroll)\n  }, [handleScroll])\n\n  if (loading) {\n    return (\n      <div\n        ref={ref}\n        className={cn('flex items-center justify-center', className)}\n        style={{ height }}\n      >\n        <Spinner size=\"md\" />\n      </div>\n    )\n  }\n\n  if (items.length === 0) {\n    return (\n      <div\n        ref={ref}\n        className={cn('text-muted-foreground flex items-center justify-center text-sm', className)}\n        style={{ height }}\n      >\n        {emptyContent ?? locale.virtualList.empty}\n      </div>\n    )\n  }\n\n  const virtualItems = virtualizer.getVirtualItems()\n\n  const loadingIndicator = loadingMore && (\n    <div className=\"flex items-center justify-center py-4\">\n      {loadingMoreContent ?? (\n        <div className=\"text-muted-foreground flex items-center gap-2 text-sm\">\n          <Spinner size=\"sm\" />\n          <span>{locale.virtualList.loadingMore}</span>\n        </div>\n      )}\n    </div>\n  )\n\n  const containerStyle: CSSProperties = {\n    height: `${virtualizer.getTotalSize()}px`,\n  }\n\n  return (\n    <div\n      ref={setRefs}\n      className={cn('overflow-auto', className)}\n      style={{ height }}\n      // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n      tabIndex={0}\n      role=\"region\"\n      aria-label={ariaLabel || locale.virtualList.label}\n    >\n      <div className={cn('relative w-full', innerClassName)} style={containerStyle}>\n        {virtualItems.map((virtualItem) => (\n          <div\n            key={virtualItem.key}\n            ref={dynamicSize ? virtualizer.measureElement : undefined}\n            data-index={virtualItem.index}\n            style={{\n              position: 'absolute',\n              top: 0,\n              left: 0,\n              width: '100%',\n              transform: `translateY(${virtualItem.start}px)`,\n            }}\n          >\n            {renderItem(items[virtualItem.index], virtualItem.index, virtualItem)}\n          </div>\n        ))}\n      </div>\n      {loadingIndicator}\n    </div>\n  )\n}\n\n/** Virtualized list with automatic loading of additional items on scroll. */\nexport const InfiniteScroll = forwardRef(InfiniteScrollInner) as <T>(\n  props: InfiniteScrollProps<T> & { ref?: ForwardedRef<HTMLDivElement> }\n) => ReactElement\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react'\nimport { cn } from '../../utils/cn'\nimport { TrendingUp, TrendingDown, Minus } from 'lucide-react'\n\nexport type StatTrend = 'up' | 'down' | 'neutral'\n\nexport interface StatProps extends HTMLAttributes<HTMLDivElement> {\n  /** Stat label */\n  label: ReactNode\n  /** Stat value */\n  value: ReactNode\n  /** Change value (e.g., \"+12%\") */\n  change?: ReactNode\n  /** Trend direction */\n  trend?: StatTrend\n  /** Helper text */\n  helpText?: ReactNode\n  /** Icon */\n  icon?: ReactNode\n  /** Loading state */\n  loading?: boolean\n}\n\nconst trendStyles: Record<StatTrend, string> = {\n  up: 'text-success-soft-foreground dark:text-success',\n  down: 'text-destructive',\n  neutral: 'text-muted-foreground',\n}\n\nconst trendIcons: Record<StatTrend, typeof TrendingUp> = {\n  up: TrendingUp,\n  down: TrendingDown,\n  neutral: Minus,\n}\n\n/** Displays a key metric with optional trend indicator and help text. */\nexport const Stat = forwardRef<HTMLDivElement, StatProps>(\n  ({ className, label, value, change, trend, helpText, icon, loading = false, ...props }, ref) => {\n    const TrendIcon = trend ? trendIcons[trend] : null\n\n    return (\n      <div ref={ref} className={cn('space-y-2', className)} {...props}>\n        <div className=\"flex items-center justify-between\">\n          <span className=\"text-muted-foreground text-sm font-medium\">{label}</span>\n          {icon && <div className=\"text-muted-foreground\">{icon}</div>}\n        </div>\n\n        {loading ? (\n          <div className=\"space-y-2\">\n            <div className=\"bg-muted h-8 w-24 animate-pulse rounded\" />\n            <div className=\"bg-muted h-4 w-16 animate-pulse rounded\" />\n          </div>\n        ) : (\n          <>\n            <div className=\"text-2xl font-bold\">{value}</div>\n\n            {(change || helpText) && (\n              <div className=\"flex items-center gap-2 text-sm\">\n                {change && trend && TrendIcon && (\n                  <span className={cn('flex items-center gap-1', trendStyles[trend])}>\n                    <TrendIcon className=\"h-4 w-4\" />\n                    {change}\n                  </span>\n                )}\n                {change && !trend && <span className=\"text-muted-foreground\">{change}</span>}\n                {helpText && <span className=\"text-muted-foreground\">{helpText}</span>}\n              </div>\n            )}\n          </>\n        )}\n      </div>\n    )\n  }\n)\n\nStat.displayName = 'Stat'\n\n// Stat Card variant\nexport interface StatCardProps extends StatProps {\n  /** Card variant */\n  variant?: 'default' | 'bordered' | 'filled'\n}\n\n/** Stat wrapped in a styled card container. */\nexport const StatCard = forwardRef<HTMLDivElement, StatCardProps>(\n  ({ className, variant = 'default', ...props }, ref) => {\n    const variantStyles = {\n      default: 'bg-card',\n      bordered: 'bg-card border',\n      filled: 'bg-muted/50',\n    }\n\n    return (\n      <div ref={ref} className={cn('rounded-lg p-6', variantStyles[variant], className)}>\n        <Stat {...props} />\n      </div>\n    )\n  }\n)\n\nStatCard.displayName = 'StatCard'\n\n// Stat Group for multiple stats\nexport interface StatGroupProps extends HTMLAttributes<HTMLDivElement> {\n  /** Number of columns */\n  columns?: 2 | 3 | 4\n}\n\n/** Responsive grid container for laying out multiple Stat components. */\nexport const StatGroup = forwardRef<HTMLDivElement, StatGroupProps>(\n  ({ className, columns = 4, children, ...props }, ref) => {\n    const columnStyles = {\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-4',\n    }\n\n    return (\n      <div ref={ref} className={cn('grid gap-4', columnStyles[columns], className)} {...props}>\n        {children}\n      </div>\n    )\n  }\n)\n\nStatGroup.displayName = 'StatGroup'\n","import { forwardRef, type ReactNode, type SVGAttributes } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport type SparklineTrend = 'auto' | 'up' | 'down' | 'neutral'\n\nexport interface SparklineProps extends Omit<\n  SVGAttributes<SVGSVGElement>,\n  'width' | 'height' | 'color'\n> {\n  /** Data points to plot, left to right (null/undefined treated as no data) */\n  data: number[] | null | undefined\n  /** SVG width in pixels */\n  width?: number\n  /** SVG height in pixels */\n  height?: number\n  /** Line stroke width */\n  strokeWidth?: number\n  /** Explicit stroke color (any CSS color); overrides trend coloring */\n  color?: string\n  /** Trend coloring — 'auto' compares last vs first value */\n  trend?: SparklineTrend\n  /**\n   * Rendered when there are fewer than 2 data points.\n   * `true` draws a dashed neutral line; a ReactNode replaces the output entirely.\n   * Without it, empty data renders nothing and a single point renders a dot.\n   */\n  placeholder?: boolean | ReactNode\n}\n\nconst trendStyles: Record<Exclude<SparklineTrend, 'auto'>, string> = {\n  up: 'text-success',\n  down: 'text-destructive',\n  neutral: 'text-muted-foreground',\n}\n\nfunction resolveTrend(data: number[], trend: SparklineTrend): Exclude<SparklineTrend, 'auto'> {\n  if (trend !== 'auto') return trend\n  if (data.length < 2) return 'neutral'\n  const first = data[0]\n  const last = data[data.length - 1]\n  if (last > first) return 'up'\n  if (last < first) return 'down'\n  return 'neutral'\n}\n\n/** Pure SVG polyline mini trend chart, colored by trend direction. */\nexport const Sparkline = forwardRef<SVGSVGElement, SparklineProps>(\n  (\n    {\n      data,\n      width = 80,\n      height = 24,\n      strokeWidth = 1.5,\n      color,\n      trend = 'auto',\n      placeholder,\n      className,\n      'aria-label': ariaLabel,\n      ...props\n    },\n    ref\n  ) => {\n    const values = data ?? []\n\n    if (values.length < 2 && placeholder != null && placeholder !== false) {\n      if (placeholder !== true) return <>{placeholder}</>\n      const pad = strokeWidth\n      return (\n        <svg\n          ref={ref}\n          width={width}\n          height={height}\n          viewBox={`0 0 ${width} ${height}`}\n          aria-hidden\n          className={cn('text-border shrink-0', className)}\n          {...props}\n        >\n          <line\n            x1={pad}\n            y1={height / 2}\n            x2={width - pad}\n            y2={height / 2}\n            stroke=\"currentColor\"\n            strokeWidth={1}\n            strokeDasharray=\"2 2\"\n          />\n        </svg>\n      )\n    }\n\n    if (values.length === 0) return null\n\n    // Inset so the stroke never clips at the edges\n    const pad = strokeWidth\n    const innerWidth = width - pad * 2\n    const innerHeight = height - pad * 2\n\n    const min = Math.min(...values)\n    const max = Math.max(...values)\n    const span = max - min\n\n    const points = values\n      .map((value, index) => {\n        // Single point renders as a flat line; equal values center vertically\n        const x =\n          values.length === 1\n            ? pad + innerWidth / 2\n            : pad + (innerWidth * index) / (values.length - 1)\n        const y = span === 0 ? height / 2 : pad + innerHeight * (1 - (value - min) / span)\n        return `${x.toFixed(2)},${y.toFixed(2)}`\n      })\n      .join(' ')\n\n    return (\n      <svg\n        ref={ref}\n        width={width}\n        height={height}\n        viewBox={`0 0 ${width} ${height}`}\n        role=\"img\"\n        aria-label={ariaLabel}\n        aria-hidden={ariaLabel ? undefined : true}\n        className={cn('shrink-0', !color && trendStyles[resolveTrend(values, trend)], className)}\n        {...props}\n      >\n        {values.length === 1 ? (\n          <circle cx={width / 2} cy={height / 2} r={strokeWidth} fill={color ?? 'currentColor'} />\n        ) : (\n          <polyline\n            points={points}\n            fill=\"none\"\n            stroke={color ?? 'currentColor'}\n            strokeWidth={strokeWidth}\n            strokeLinejoin=\"round\"\n            strokeLinecap=\"round\"\n          />\n        )}\n      </svg>\n    )\n  }\n)\n\nSparkline.displayName = 'Sparkline'\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react'\nimport { cn } from '../../utils/cn'\nimport { Button } from '../button/Button'\nimport { Inbox, Search, FileX, AlertCircle, Plus } from 'lucide-react'\nimport { useLocale } from '../../locale'\n\nexport type EmptyStateVariant = 'default' | 'search' | 'error' | 'no-data'\n\nexport interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n  /** Variant */\n  variant?: EmptyStateVariant\n  /** Icon to display */\n  icon?: ReactNode\n  /** Title text */\n  title?: ReactNode\n  /** Description text */\n  description?: ReactNode\n  /** Action button or element */\n  action?: ReactNode\n  /** Size */\n  size?: 'sm' | 'md' | 'lg'\n}\n\nconst variantIcons: Record<EmptyStateVariant, typeof Inbox> = {\n  default: Inbox,\n  search: Search,\n  error: AlertCircle,\n  'no-data': FileX,\n}\n\nconst sizeStyles = {\n  sm: {\n    container: 'py-8',\n    icon: 'h-8 w-8',\n    title: 'text-base',\n    description: 'text-sm',\n  },\n  md: {\n    container: 'py-12',\n    icon: 'h-12 w-12',\n    title: 'text-lg',\n    description: 'text-sm',\n  },\n  lg: {\n    container: 'py-16',\n    icon: 'h-16 w-16',\n    title: 'text-xl',\n    description: 'text-base',\n  },\n}\n\n/** Placeholder display for empty views with an icon, message, and optional action. */\nexport const EmptyState = forwardRef<HTMLDivElement, EmptyStateProps>(\n  (\n    { className, variant = 'default', icon, title, description, action, size = 'md', ...props },\n    ref\n  ) => {\n    const IconComponent = variantIcons[variant]\n    const styles = sizeStyles[size]\n\n    return (\n      <div\n        ref={ref}\n        className={cn(\n          'flex flex-col items-center justify-center text-center',\n          styles.container,\n          className\n        )}\n        {...props}\n      >\n        <div className=\"text-muted-foreground mb-4\">\n          {icon || <IconComponent className={styles.icon} />}\n        </div>\n        {title && <h3 className={cn('text-foreground font-semibold', styles.title)}>{title}</h3>}\n        {description && (\n          <p className={cn('text-muted-foreground mt-1 max-w-sm', styles.description)}>\n            {description}\n          </p>\n        )}\n        {action && <div className=\"mt-4\">{action}</div>}\n      </div>\n    )\n  }\n)\n\nEmptyState.displayName = 'EmptyState'\n\n// Pre-configured empty states\nexport interface EmptyStatePresetProps extends Omit<\n  EmptyStateProps,\n  'variant' | 'title' | 'description' | 'icon'\n> {\n  /** Custom title (overrides preset) */\n  title?: ReactNode\n  /** Custom description (overrides preset) */\n  description?: ReactNode\n}\n\n/** Preset empty state for search queries that returned no results. */\nexport const NoResults = forwardRef<HTMLDivElement, EmptyStatePresetProps>(\n  ({ title, description, ...props }, ref) => {\n    const locale = useLocale()\n    return (\n      <EmptyState\n        ref={ref}\n        variant=\"search\"\n        title={title ?? locale.emptyState.noResultsTitle}\n        description={description ?? locale.emptyState.noResultsDescription}\n        {...props}\n      />\n    )\n  }\n)\n\nNoResults.displayName = 'NoResults'\n\n/** Preset empty state prompting the user to create their first item. */\nexport const NoData = forwardRef<HTMLDivElement, EmptyStatePresetProps>(\n  ({ title, description, ...props }, ref) => {\n    const locale = useLocale()\n    return (\n      <EmptyState\n        ref={ref}\n        variant=\"no-data\"\n        title={title ?? locale.emptyState.noDataTitle}\n        description={description ?? locale.emptyState.noDataDescription}\n        icon={<Plus className=\"h-12 w-12\" />}\n        {...props}\n      />\n    )\n  }\n)\n\nNoData.displayName = 'NoData'\n\nexport interface ErrorStateProps extends EmptyStatePresetProps {\n  /** Callback fired when the retry button is clicked. When provided, a retry button is rendered automatically. */\n  onRetry?: () => void\n  /** Label for the retry button */\n  retryLabel?: string\n}\n\n/** Preset empty state indicating a data loading error occurred. */\nexport const ErrorState = forwardRef<HTMLDivElement, ErrorStateProps>(\n  ({ title, description, onRetry, retryLabel, action, ...props }, ref) => {\n    const locale = useLocale()\n    return (\n      <EmptyState\n        ref={ref}\n        variant=\"error\"\n        title={title ?? locale.emptyState.errorTitle}\n        description={description ?? locale.emptyState.errorDescription}\n        action={\n          action ??\n          (onRetry ? (\n            <Button variant=\"outline\" size=\"sm\" onClick={onRetry}>\n              {retryLabel ?? locale.emptyState.retryLabel}\n            </Button>\n          ) : undefined)\n        }\n        {...props}\n      />\n    )\n  }\n)\n\nErrorState.displayName = 'ErrorState'\n","import {\n  Children,\n  cloneElement,\n  createContext,\n  forwardRef,\n  isValidElement,\n  useContext,\n  useId,\n  type FormHTMLAttributes,\n  type HTMLAttributes,\n  type LabelHTMLAttributes,\n  type ReactNode,\n} from 'react'\nimport { cn } from '../../utils/cn'\nimport { warnDeprecated } from '../../utils/deprecate'\nimport { Label } from '../label/Label'\n\n// Form Context\ninterface FormContextValue {\n  disabled?: boolean\n}\n\nconst FormContext = createContext<FormContextValue>({})\n\nexport function useFormContext() {\n  return useContext(FormContext)\n}\n\n// Form component\nexport interface FormProps extends FormHTMLAttributes<HTMLFormElement> {\n  /** Disable all form fields */\n  disabled?: boolean\n}\n\n/**\n * Form wrapper that provides shared disabled state to all child fields.\n *\n * **In context:** [Form Page](https://ui.foson.co/storybook/?path=/docs/recipes-form-page--docs)\n * · [Detail + Drawer Edit](https://ui.foson.co/storybook/?path=/docs/recipes-detail-drawer-edit--docs)\n */\nexport const Form = forwardRef<HTMLFormElement, FormProps>(\n  ({ className, disabled, children, ...props }, ref) => (\n    <FormContext.Provider value={{ disabled }}>\n      <form ref={ref} className={cn('space-y-6', className)} {...props}>\n        {children}\n      </form>\n    </FormContext.Provider>\n  )\n)\n\nForm.displayName = 'Form'\n\n// FormField Context\ninterface FormFieldContextValue {\n  id: string\n  name?: string\n  /** @deprecated use `errorMessage` instead — removed in v1.0 */\n  error?: string\n  errorMessage?: string\n  disabled?: boolean\n}\n\nconst FormFieldContext = createContext<FormFieldContextValue | null>(null)\n\nexport function useFormFieldContext() {\n  const context = useContext(FormFieldContext)\n  if (!context) {\n    throw new Error('FormField components must be used within a FormField')\n  }\n  return context\n}\n\n// FormField component\nexport interface FormFieldProps extends HTMLAttributes<HTMLDivElement> {\n  /** Field name */\n  name?: string\n  /**\n   * Field label — renders a `FormLabel` above the control. Equivalent to\n   * composing `<FormLabel>` yourself; use composition when you need the\n   * label's extra props.\n   */\n  label?: ReactNode\n  /** Required indicator on the built-in `label` */\n  required?: boolean\n  /** Error message */\n  errorMessage?: string\n  /** @deprecated use `errorMessage` instead — removed in v1.0 */\n  error?: string\n  /** Disable field */\n  disabled?: boolean\n}\n\n/** Form field container that provides id, name, and error context to its children. */\nexport const FormField = forwardRef<HTMLDivElement, FormFieldProps>(\n  (\n    { className, name, label, required, errorMessage, error, disabled, children, ...props },\n    ref\n  ) => {\n    const id = useId()\n    const formContext = useFormContext()\n    const isDisabled = disabled || formContext.disabled\n\n    if (error !== undefined && errorMessage === undefined) {\n      warnDeprecated('FormField', 'error', 'errorMessage')\n    }\n    const resolvedError = errorMessage ?? error\n\n    return (\n      <FormFieldContext.Provider\n        value={{\n          id,\n          name,\n          error: resolvedError,\n          errorMessage: resolvedError,\n          disabled: isDisabled,\n        }}\n      >\n        <div ref={ref} className={cn('space-y-2', className)} {...props}>\n          {label != null && <FormLabel required={required}>{label}</FormLabel>}\n          {children}\n        </div>\n      </FormFieldContext.Provider>\n    )\n  }\n)\n\nFormField.displayName = 'FormField'\n\n// FormLabel component\nexport interface FormLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {\n  /** Required indicator */\n  required?: boolean\n  /** Optional indicator */\n  optional?: boolean\n}\n\n/** Label that auto-links to its parent FormField input via context. */\nexport const FormLabel = forwardRef<HTMLLabelElement, FormLabelProps>(\n  ({ className, required, optional, children, ...props }, ref) => {\n    const { id, disabled } = useFormFieldContext()\n\n    return (\n      <Label\n        ref={ref}\n        htmlFor={id}\n        required={required}\n        optional={optional}\n        className={cn(disabled && 'opacity-70', className)}\n        {...props}\n      >\n        {children}\n      </Label>\n    )\n  }\n)\n\nFormLabel.displayName = 'FormLabel'\n\n// FormControl component - wrapper for form inputs\nexport type FormControlProps = HTMLAttributes<HTMLDivElement>\n\n/** Wrapper for form input elements within a FormField. Injects field id into the first child element. */\nexport const FormControl = forwardRef<HTMLDivElement, FormControlProps>(\n  ({ className, children, ...props }, ref) => {\n    const context = useContext(FormFieldContext)\n    const id = context?.id\n\n    // Inject id into the first valid element child so label htmlFor connects properly\n    const enhancedChildren = id\n      ? Children.map(children, (child, index) => {\n          if (index === 0 && isValidElement(child)) {\n            return cloneElement(child as React.ReactElement<{ id?: string }>, { id })\n          }\n          return child\n        })\n      : children\n\n    return (\n      <div ref={ref} className={className} {...props}>\n        {enhancedChildren}\n      </div>\n    )\n  }\n)\n\nFormControl.displayName = 'FormControl'\n\n// FormDescription component\nexport type FormDescriptionProps = HTMLAttributes<HTMLParagraphElement>\n\n/** Helper text displayed below a form field. */\nexport const FormDescription = forwardRef<HTMLParagraphElement, FormDescriptionProps>(\n  ({ className, ...props }, ref) => (\n    <p ref={ref} className={cn('text-muted-foreground text-sm', className)} {...props} />\n  )\n)\n\nFormDescription.displayName = 'FormDescription'\n\n// FormMessage component - for error messages\nexport interface FormMessageProps extends HTMLAttributes<HTMLParagraphElement> {\n  /** Error message (overrides context) */\n  errorMessage?: string\n  /** @deprecated use `errorMessage` instead — removed in v1.0 */\n  error?: string\n}\n\n/** Validation error message displayed below a form field. */\nexport const FormMessage = forwardRef<HTMLParagraphElement, FormMessageProps>(\n  ({ className, errorMessage, error: errorProp, children, ...props }, ref) => {\n    const context = useContext(FormFieldContext)\n\n    if (errorProp !== undefined && errorMessage === undefined) {\n      warnDeprecated('FormMessage', 'error', 'errorMessage')\n    }\n    const error = errorMessage ?? errorProp ?? context?.errorMessage\n\n    if (!error && !children) return null\n\n    return (\n      <p ref={ref} className={cn('text-destructive text-sm', className)} {...props}>\n        {error || children}\n      </p>\n    )\n  }\n)\n\nFormMessage.displayName = 'FormMessage'\n\n// FormSection component - for grouping fields\nexport interface FormSectionProps extends Omit<HTMLAttributes<HTMLFieldSetElement>, 'title'> {\n  /** Section title */\n  title?: ReactNode\n  /** Section description */\n  description?: ReactNode\n}\n\n/** Fieldset grouping related form fields under an optional title and description. */\nexport const FormSection = forwardRef<HTMLFieldSetElement, FormSectionProps>(\n  ({ className, title, description, children, ...props }, ref) => (\n    <fieldset ref={ref} className={cn('space-y-4', className)} {...props}>\n      {(title || description) && (\n        <div className=\"space-y-1\">\n          {title && <legend className=\"text-base font-medium\">{title}</legend>}\n          {description && <p className=\"text-muted-foreground text-sm\">{description}</p>}\n        </div>\n      )}\n      {children}\n    </fieldset>\n  )\n)\n\nFormSection.displayName = 'FormSection'\n\n// FormActions component - for form buttons\nexport interface FormActionsProps extends HTMLAttributes<HTMLDivElement> {\n  /** Alignment */\n  align?: 'left' | 'center' | 'right' | 'between'\n}\n\n/** Row of action buttons at the bottom of a form. */\nexport const FormActions = forwardRef<HTMLDivElement, FormActionsProps>(\n  ({ className, align = 'right', children, ...props }, ref) => {\n    const alignStyles = {\n      left: 'justify-start',\n      center: 'justify-center',\n      right: 'justify-end',\n      between: 'justify-between',\n    }\n\n    return (\n      <div\n        ref={ref}\n        className={cn('flex items-center gap-2 pt-4', alignStyles[align], className)}\n        {...props}\n      >\n        {children}\n      </div>\n    )\n  }\n)\n\nFormActions.displayName = 'FormActions'\n","import {\n  forwardRef,\n  useCallback,\n  useEffect,\n  useRef,\n  useState,\n  type InputHTMLAttributes,\n  type KeyboardEvent,\n  type MouseEvent,\n} from 'react'\nimport { ChevronDown, ChevronUp } from 'lucide-react'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\n\nexport type NumberInputSize = 'sm' | 'md' | 'lg'\n\nexport interface NumberInputProps extends Omit<\n  InputHTMLAttributes<HTMLInputElement>,\n  'size' | 'onChange' | 'value' | 'defaultValue' | 'type'\n> {\n  /** Controlled value */\n  value?: number | null\n  /** Uncontrolled default value */\n  defaultValue?: number\n  /** Fires with the numeric value, or null if empty */\n  onChange?: (value: number | null) => void\n  /** Minimum value */\n  min?: number\n  /** Maximum value */\n  max?: number\n  /** Increment/decrement step */\n  step?: number\n  /** Number of decimal places */\n  precision?: number\n  /** Text prefix (e.g. \"$\") */\n  prefix?: string\n  /** Text suffix (e.g. \"%\", \"kg\") */\n  suffix?: string\n  /** Input size */\n  size?: NumberInputSize\n  /** Error border state */\n  error?: boolean\n  /** Error message text */\n  errorMessage?: string\n  /** Show +/- stepper buttons */\n  controls?: boolean\n  /** Allow negative numbers */\n  allowNegative?: boolean\n  /** Clamp to min/max on blur */\n  clampOnBlur?: boolean\n  /** Disabled state */\n  disabled?: boolean\n  /** Placeholder text */\n  placeholder?: string\n  /** Additional class name */\n  className?: string\n}\n\nconst sizeStyles: Record<NumberInputSize, string> = {\n  sm: 'h-8 px-3 text-xs',\n  md: 'h-10 px-3 text-sm',\n  lg: 'h-12 px-4 text-base',\n}\n\nconst controlSizeStyles: Record<NumberInputSize, string> = {\n  sm: 'w-6',\n  md: 'w-7',\n  lg: 'w-8',\n}\n\nconst iconSizeStyles: Record<NumberInputSize, number> = {\n  sm: 12,\n  md: 14,\n  lg: 16,\n}\n\nfunction toFixed(value: number, precision: number): number {\n  return Number(value.toFixed(precision))\n}\n\n/** Numeric input with optional stepper buttons, min/max clamping, and precision formatting. */\nexport const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(\n  (\n    {\n      value: controlledValue,\n      defaultValue,\n      onChange,\n      min,\n      max,\n      step = 1,\n      precision,\n      prefix,\n      suffix,\n      size = 'md',\n      error = false,\n      errorMessage,\n      controls = true,\n      allowNegative = true,\n      clampOnBlur = true,\n      disabled = false,\n      placeholder,\n      className,\n      onKeyDown,\n      onBlur,\n      ...props\n    },\n    ref\n  ) => {\n    const locale = useLocale()\n    const isControlled = controlledValue !== undefined\n    const [internalValue, setInternalValue] = useState<number | null>(defaultValue ?? null)\n    const [displayValue, setDisplayValue] = useState<string>(() => {\n      const initial = isControlled ? controlledValue : (defaultValue ?? null)\n      return initial != null ? String(initial) : ''\n    })\n\n    const currentValue = isControlled ? controlledValue : internalValue\n\n    // Sync display when controlled value changes externally\n    const prevControlledRef = useRef(controlledValue)\n    useEffect(() => {\n      if (isControlled && controlledValue !== prevControlledRef.current) {\n        prevControlledRef.current = controlledValue\n        setDisplayValue(controlledValue != null ? String(controlledValue) : '')\n      }\n    }, [isControlled, controlledValue])\n\n    const updateValue = useCallback(\n      (newValue: number | null) => {\n        if (!isControlled) {\n          setInternalValue(newValue)\n        }\n        setDisplayValue(newValue != null ? String(newValue) : '')\n        onChange?.(newValue)\n      },\n      [isControlled, onChange]\n    )\n\n    const clamp = useCallback(\n      (val: number): number => {\n        let result = val\n        if (min != null && result < min) result = min\n        if (max != null && result > max) result = max\n        return result\n      },\n      [min, max]\n    )\n\n    const canIncrement = max == null || (currentValue ?? 0) < max\n    const canDecrement = min == null || (currentValue ?? 0) > min\n\n    const increment = useCallback(\n      (e?: MouseEvent) => {\n        e?.preventDefault()\n        if (disabled) return\n        const base = currentValue ?? 0\n        let next = base + step\n        if (max != null && next > max) next = max\n        if (precision != null) next = toFixed(next, precision)\n        updateValue(next)\n      },\n      [currentValue, step, max, precision, disabled, updateValue]\n    )\n\n    const decrement = useCallback(\n      (e?: MouseEvent) => {\n        e?.preventDefault()\n        if (disabled) return\n        const base = currentValue ?? 0\n        let next = base - step\n        if (min != null && next < min) next = min\n        if (!allowNegative && next < 0) next = 0\n        if (precision != null) next = toFixed(next, precision)\n        updateValue(next)\n      },\n      [currentValue, step, min, precision, allowNegative, disabled, updateValue]\n    )\n\n    const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n      const raw = e.target.value\n\n      // Allow empty\n      if (raw === '') {\n        setDisplayValue('')\n        if (!isControlled) setInternalValue(null)\n        onChange?.(null)\n        return\n      }\n\n      // Allow intermediate states: just a minus sign, or trailing decimal point\n      if (raw === '-' && allowNegative) {\n        setDisplayValue(raw)\n        return\n      }\n      if (raw.endsWith('.') && !raw.slice(0, -1).includes('.')) {\n        setDisplayValue(raw)\n        return\n      }\n\n      // Validate numeric input\n      const pattern = allowNegative ? /^-?\\d*\\.?\\d*$/ : /^\\d*\\.?\\d*$/\n      if (!pattern.test(raw)) return\n\n      const parsed = parseFloat(raw)\n      if (isNaN(parsed)) return\n\n      setDisplayValue(raw)\n      if (!isControlled) setInternalValue(parsed)\n      onChange?.(parsed)\n    }\n\n    const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n      onBlur?.(e)\n\n      if (displayValue === '' || displayValue === '-') {\n        if (displayValue === '-') {\n          setDisplayValue('')\n          if (!isControlled) setInternalValue(null)\n          onChange?.(null)\n        }\n        return\n      }\n\n      let val = parseFloat(displayValue)\n      if (isNaN(val)) return\n\n      if (clampOnBlur) {\n        val = clamp(val)\n      }\n\n      if (!allowNegative && val < 0) {\n        val = 0\n      }\n\n      if (precision != null) {\n        val = toFixed(val, precision)\n      }\n\n      setDisplayValue(String(val))\n      if (!isControlled) setInternalValue(val)\n      onChange?.(val)\n    }\n\n    const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n      onKeyDown?.(e)\n      if (e.key === 'ArrowUp') {\n        e.preventDefault()\n        increment()\n      } else if (e.key === 'ArrowDown') {\n        e.preventDefault()\n        decrement()\n      }\n    }\n\n    const iconSize = iconSizeStyles[size]\n\n    return (\n      <div className={cn('relative', 'inline-flex flex-col')}>\n        <div className=\"relative inline-flex items-center\">\n          {prefix && (\n            <span className=\"text-muted-foreground pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3 text-sm\">\n              {prefix}\n            </span>\n          )}\n          <input\n            {...props}\n            ref={ref}\n            type=\"text\"\n            inputMode=\"decimal\"\n            role=\"spinbutton\"\n            aria-valuemin={min}\n            aria-valuemax={max}\n            aria-valuenow={currentValue ?? undefined}\n            disabled={disabled}\n            placeholder={placeholder}\n            value={displayValue}\n            onChange={handleInputChange}\n            onBlur={handleBlur}\n            onKeyDown={handleKeyDown}\n            className={cn(\n              'bg-background flex w-full rounded-md border',\n              'placeholder:text-muted-foreground',\n              'focus-visible:border-primary focus-visible:ring-ring/30 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n              'disabled:cursor-not-allowed disabled:opacity-50',\n              'transition-colors duration-200',\n              '[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none',\n              sizeStyles[size],\n              error ? 'border-destructive focus-visible:ring-destructive' : 'border-input',\n              prefix && 'pl-8',\n              suffix && 'pr-8',\n              controls && !suffix && 'pr-8',\n              controls && suffix && 'pr-16',\n              className\n            )}\n          />\n          {suffix && (\n            <span\n              className={cn(\n                'text-muted-foreground pointer-events-none absolute inset-y-0 flex items-center text-sm',\n                controls ? 'right-8 pr-1' : 'right-0 pr-3'\n              )}\n            >\n              {suffix}\n            </span>\n          )}\n          {controls && (\n            <div\n              className={cn(\n                'border-input absolute inset-y-0 right-0 flex flex-col border-l',\n                controlSizeStyles[size],\n                disabled && 'opacity-50'\n              )}\n            >\n              <button\n                type=\"button\"\n                tabIndex={-1}\n                aria-label={locale.numberInput.increment}\n                disabled={disabled || !canIncrement}\n                onClick={increment}\n                className={cn(\n                  'flex flex-1 items-center justify-center rounded-tr-md',\n                  'text-muted-foreground hover:text-foreground hover:bg-muted/50',\n                  'transition-colors duration-150',\n                  'disabled:pointer-events-none disabled:opacity-50'\n                )}\n              >\n                <ChevronUp size={iconSize} />\n              </button>\n              <div className=\"border-input border-t\" />\n              <button\n                type=\"button\"\n                tabIndex={-1}\n                aria-label={locale.numberInput.decrement}\n                disabled={disabled || !canDecrement}\n                onClick={decrement}\n                className={cn(\n                  'flex flex-1 items-center justify-center rounded-br-md',\n                  'text-muted-foreground hover:text-foreground hover:bg-muted/50',\n                  'transition-colors duration-150',\n                  'disabled:pointer-events-none disabled:opacity-50'\n                )}\n              >\n                <ChevronDown size={iconSize} />\n              </button>\n            </div>\n          )}\n        </div>\n        {errorMessage && <p className=\"text-destructive mt-1.5 text-xs\">{errorMessage}</p>}\n      </div>\n    )\n  }\n)\n\nNumberInput.displayName = 'NumberInput'\n","import {\n  forwardRef,\n  useRef,\n  useState,\n  type ClipboardEvent,\n  type HTMLAttributes,\n  type KeyboardEvent,\n} from 'react'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\n\nexport type PinInputSize = 'sm' | 'md' | 'lg'\n\nexport interface PinInputProps extends Omit<\n  HTMLAttributes<HTMLDivElement>,\n  'onChange' | 'defaultValue'\n> {\n  /** Number of characters @default 6 */\n  length?: number\n  /** Value (controlled) */\n  value?: string\n  /** Initial value (uncontrolled) */\n  defaultValue?: string\n  /** Fires with the joined string on every edit */\n  onChange?: (value: string) => void\n  /** Fires once when all cells are filled */\n  onComplete?: (value: string) => void\n  /** Accepted characters @default \"numeric\" */\n  type?: 'numeric' | 'alphanumeric'\n  /** Mask the entered characters (one-time passwords usually should NOT be masked) */\n  masked?: boolean\n  /** Cell size @default \"md\" */\n  size?: PinInputSize\n  /** Disabled state */\n  disabled?: boolean\n  /** Error state styling */\n  error?: boolean\n  /** Focus the first cell on mount */\n  autoFocus?: boolean\n}\n\nconst sizeStyles: Record<PinInputSize, string> = {\n  sm: 'h-8 w-8 text-sm rounded-md',\n  md: 'h-10 w-10 text-base rounded-md',\n  lg: 'h-12 w-12 text-lg rounded-lg',\n}\n\nconst CHAR_RE = {\n  numeric: /[0-9]/,\n  alphanumeric: /[0-9a-zA-Z]/,\n}\n\n/**\n * One-time-code input (OTP / verification codes): one cell per character with\n * auto-advance, Backspace/arrow navigation, and paste distribution. Numeric\n * mode sets `inputMode=\"numeric\"` and `autocomplete=\"one-time-code\"` so mobile\n * keyboards and SMS autofill behave.\n */\nexport const PinInput = forwardRef<HTMLDivElement, PinInputProps>(\n  (\n    {\n      length = 6,\n      value: controlledValue,\n      defaultValue = '',\n      onChange,\n      onComplete,\n      type = 'numeric',\n      masked = false,\n      size = 'md',\n      disabled = false,\n      error = false,\n      autoFocus = false,\n      className,\n      ...props\n    },\n    ref\n  ) => {\n    const locale = useLocale()\n    const isControlled = controlledValue !== undefined\n    const [uncontrolled, setUncontrolled] = useState(defaultValue.slice(0, length))\n    const value = (isControlled ? controlledValue : uncontrolled).slice(0, length)\n    const cellRefs = useRef<Array<HTMLInputElement | null>>([])\n    const charRe = CHAR_RE[type]\n\n    const commit = (next: string) => {\n      if (!isControlled) setUncontrolled(next)\n      onChange?.(next)\n      if (next.length === length && value.length !== length) onComplete?.(next)\n    }\n\n    const focusCell = (index: number) => {\n      cellRefs.current[Math.max(0, Math.min(index, length - 1))]?.focus()\n    }\n\n    const setChar = (index: number, char: string) => {\n      const chars = value.split('')\n      // Cells beyond the current value stay empty — writes always append at\n      // the boundary so the value has no holes\n      const target = Math.min(index, value.length)\n      chars[target] = char\n      commit(chars.join(''))\n      focusCell(target + 1)\n    }\n\n    const handleKeyDown = (index: number, e: KeyboardEvent<HTMLInputElement>) => {\n      if (e.key === 'Backspace') {\n        e.preventDefault()\n        if (value.length === 0) return\n        const target = index < value.length ? index : value.length - 1\n        commit(value.slice(0, target) + value.slice(target + 1))\n        focusCell(target === index ? index - 1 : target)\n      } else if (e.key === 'ArrowLeft') {\n        e.preventDefault()\n        focusCell(index - 1)\n      } else if (e.key === 'ArrowRight') {\n        e.preventDefault()\n        focusCell(index + 1)\n      } else if (e.key.length === 1 && charRe.test(e.key)) {\n        e.preventDefault()\n        setChar(index, e.key)\n      } else if (e.key.length === 1 && !e.metaKey && !e.ctrlKey) {\n        e.preventDefault() // reject characters outside the allowed set\n      }\n    }\n\n    const handlePaste = (e: ClipboardEvent<HTMLInputElement>) => {\n      e.preventDefault()\n      const pasted = e.clipboardData\n        .getData('text')\n        .split('')\n        .filter((c) => charRe.test(c))\n        .slice(0, length)\n        .join('')\n      if (pasted === '') return\n      commit(pasted)\n      focusCell(pasted.length)\n    }\n\n    return (\n      <div ref={ref} className={cn('flex items-center gap-2', className)} {...props}>\n        {Array.from({ length }, (_, i) => (\n          <input\n            key={i}\n            ref={(el) => {\n              cellRefs.current[i] = el\n            }}\n            type={masked ? 'password' : 'text'}\n            inputMode={type === 'numeric' ? 'numeric' : 'text'}\n            autoComplete={i === 0 ? 'one-time-code' : 'off'}\n            maxLength={1}\n            value={value[i] ?? ''}\n            aria-label={locale.pinInput.charLabel(i + 1, length)}\n            disabled={disabled}\n            // 這是把元件對外的 `autoFocus` prop 轉給第一格，不是寫死自動聚焦。\n            // 要不要自動聚焦由呼叫端決定（OTP 欄位是這個 prop 的主要用途），\n            // 元件無權替它拿掉。\n            // eslint-disable-next-line jsx-a11y/no-autofocus\n            autoFocus={autoFocus && i === 0}\n            // Editing is fully handled in onKeyDown/onPaste; the controlled\n            // value silences the React warning\n            onChange={() => {}}\n            onKeyDown={(e) => handleKeyDown(i, e)}\n            onPaste={handlePaste}\n            onFocus={(e) => e.target.select()}\n            className={cn(\n              'border-input bg-background border text-center font-medium transition-colors',\n              'focus:ring-ring/40 focus:border-ring focus:ring-1 focus:outline-none',\n              'disabled:cursor-not-allowed disabled:opacity-50',\n              error && 'border-destructive focus:border-destructive focus:ring-destructive/40',\n              sizeStyles[size]\n            )}\n          />\n        ))}\n      </div>\n    )\n  }\n)\n\nPinInput.displayName = 'PinInput'\n","import { forwardRef, type TextareaHTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport type TextareaSize = 'sm' | 'md' | 'lg'\n\nexport interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> {\n  /** Size variant */\n  size?: TextareaSize\n  /** Error state */\n  error?: boolean\n  /** Error message */\n  errorMessage?: string\n  /** Auto-resize to fit content */\n  autoResize?: boolean\n}\n\nconst sizeStyles: Record<TextareaSize, string> = {\n  sm: 'min-h-[60px] px-3 py-1.5 text-xs',\n  md: 'min-h-[80px] px-3 py-2 text-sm',\n  lg: 'min-h-[120px] px-4 py-3 text-base',\n}\n\n/** Multi-line text input with optional auto-resize and error state. */\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n  (\n    { className, size = 'md', error = false, errorMessage, autoResize = false, disabled, ...props },\n    ref\n  ) => {\n    const handleInput = autoResize\n      ? (e: React.FormEvent<HTMLTextAreaElement>) => {\n          const target = e.currentTarget\n          target.style.height = 'auto'\n          target.style.height = `${target.scrollHeight}px`\n        }\n      : undefined\n\n    return (\n      <div className=\"w-full\">\n        <textarea\n          ref={ref}\n          disabled={disabled}\n          onInput={handleInput}\n          className={cn(\n            'bg-background flex w-full rounded-md border',\n            'placeholder:text-muted-foreground',\n            'focus-visible:border-primary focus-visible:ring-ring/30 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n            'disabled:cursor-not-allowed disabled:opacity-50',\n            'transition-colors duration-200',\n            sizeStyles[size],\n            autoResize && 'resize-none overflow-hidden',\n            error ? 'border-destructive focus-visible:ring-destructive' : 'border-input',\n            className\n          )}\n          {...props}\n        />\n        {errorMessage && <p className=\"text-destructive mt-1.5 text-xs\">{errorMessage}</p>}\n      </div>\n    )\n  }\n)\n\nTextarea.displayName = 'Textarea'\n","import { forwardRef, useState, useRef, useEffect, type InputHTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\nimport { Search, X, Loader2 } from 'lucide-react'\nimport { useLocale } from '../../locale'\n\nexport interface SearchInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {\n  /** Input size */\n  size?: 'sm' | 'md' | 'lg'\n  /** Loading state */\n  loading?: boolean\n  /** Show clear button */\n  clearable?: boolean\n  /** On clear callback */\n  onClear?: () => void\n  /** Debounce delay in ms */\n  debounce?: number\n  /** On debounced change */\n  onDebouncedChange?: (value: string) => void\n}\n\nconst sizeStyles = {\n  sm: 'h-9 text-sm pl-8 pr-8',\n  md: 'h-10 text-sm pl-10 pr-10',\n  lg: 'h-12 text-base pl-12 pr-12',\n}\n\nconst iconSizeStyles = {\n  sm: 'h-4 w-4',\n  md: 'h-4 w-4',\n  lg: 'h-5 w-5',\n}\n\nconst iconPositionStyles = {\n  sm: 'left-2.5',\n  md: 'left-3',\n  lg: 'left-3.5',\n}\n\nconst clearPositionStyles = {\n  sm: 'right-2',\n  md: 'right-2.5',\n  lg: 'right-3',\n}\n\n/** Search text input with icon, clear button, and optional debounced change. */\nexport const SearchInput = forwardRef<HTMLInputElement, SearchInputProps>(\n  (\n    {\n      className,\n      size = 'md',\n      loading = false,\n      clearable = true,\n      onClear,\n      debounce,\n      onDebouncedChange,\n      value,\n      defaultValue,\n      onChange,\n      ...props\n    },\n    ref\n  ) => {\n    const locale = useLocale()\n    const [internalValue, setInternalValue] = useState(defaultValue || '')\n    const debounceTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n    const currentValue = value !== undefined ? value : internalValue\n    const showClear = clearable && currentValue && !loading\n\n    // Handle debounced change\n    useEffect(() => {\n      if (debounce && onDebouncedChange) {\n        debounceTimerRef.current = setTimeout(() => {\n          onDebouncedChange(String(currentValue))\n        }, debounce)\n\n        return () => {\n          if (debounceTimerRef.current) {\n            clearTimeout(debounceTimerRef.current)\n          }\n        }\n      }\n    }, [currentValue, debounce, onDebouncedChange])\n\n    const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n      setInternalValue(e.target.value)\n      onChange?.(e)\n    }\n\n    const handleClear = () => {\n      setInternalValue('')\n      onClear?.()\n\n      // Create a synthetic event for controlled components\n      if (onChange) {\n        const syntheticEvent = {\n          target: { value: '' },\n          currentTarget: { value: '' },\n        } as React.ChangeEvent<HTMLInputElement>\n        onChange(syntheticEvent)\n      }\n    }\n\n    return (\n      <div className=\"relative\">\n        {/* Search icon */}\n        <div\n          className={cn(\n            'text-muted-foreground pointer-events-none absolute top-1/2 -translate-y-1/2',\n            iconPositionStyles[size]\n          )}\n        >\n          <Search className={iconSizeStyles[size]} />\n        </div>\n\n        {/* Input */}\n        <input\n          ref={ref}\n          type=\"search\"\n          name=\"search\"\n          autoComplete=\"off\"\n          value={currentValue}\n          onChange={handleChange}\n          className={cn(\n            'border-input bg-background w-full rounded-md border',\n            'ring-offset-background placeholder:text-muted-foreground',\n            'focus-visible:border-primary focus-visible:ring-ring/30 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n            'disabled:cursor-not-allowed disabled:opacity-50',\n            '[&::-webkit-search-cancel-button]:hidden',\n            sizeStyles[size],\n            className\n          )}\n          {...props}\n        />\n\n        {/* Clear button or loading spinner */}\n        <div className={cn('absolute top-1/2 -translate-y-1/2', clearPositionStyles[size])}>\n          {loading ? (\n            <Loader2 className={cn(iconSizeStyles[size], 'text-muted-foreground animate-spin')} />\n          ) : showClear ? (\n            <button\n              type=\"button\"\n              onClick={handleClear}\n              className=\"text-muted-foreground hover:text-foreground focus:outline-none\"\n            >\n              <X className={iconSizeStyles[size]} />\n              <span className=\"sr-only\">{locale.searchInput.clear}</span>\n            </button>\n          ) : null}\n        </div>\n      </div>\n    )\n  }\n)\n\nSearchInput.displayName = 'SearchInput'\n","import {\n  forwardRef,\n  useCallback,\n  useRef,\n  useState,\n  type KeyboardEvent,\n  type InputHTMLAttributes,\n} from 'react'\nimport { X } from 'lucide-react'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\n\nexport type TagInputSize = 'sm' | 'md' | 'lg'\n\nexport interface TagInputProps extends Omit<\n  InputHTMLAttributes<HTMLInputElement>,\n  'size' | 'value' | 'onChange'\n> {\n  /** Current tag values */\n  value: string[]\n  /** Called when tags change */\n  onChange: (tags: string[]) => void\n  /** Placeholder text shown when no input */\n  placeholder?: string\n  /** Maximum number of tags allowed */\n  max?: number\n  /** Maximum character length per tag */\n  maxLength?: number\n  /** Whether the input is disabled */\n  disabled?: boolean\n  /** Error state */\n  error?: boolean\n  /** Error message */\n  errorMessage?: string\n  /** Input size variant */\n  size?: TagInputSize\n  /** Additional class name for the container */\n  className?: string\n  /** Allow duplicate tag values (default false) */\n  allowDuplicates?: boolean\n}\n\nconst containerSizeStyles: Record<TagInputSize, string> = {\n  sm: 'min-h-8 px-2 py-1 text-xs gap-1',\n  md: 'min-h-10 px-3 py-1.5 text-sm gap-1.5',\n  lg: 'min-h-12 px-4 py-2 text-base gap-2',\n}\n\nconst tagSizeStyles: Record<TagInputSize, string> = {\n  sm: 'px-1.5 py-0 text-2xs leading-none',\n  md: 'px-2 py-0.5 text-xs',\n  lg: 'px-2.5 py-0.5 text-sm',\n}\n\nconst removeBtnSizeStyles: Record<TagInputSize, string> = {\n  sm: 'h-3 w-3',\n  md: 'h-3.5 w-3.5',\n  lg: 'h-4 w-4',\n}\n\n/** Text input that converts entries into removable tag chips. Press Enter or comma to add, Backspace to remove. */\nexport const TagInput = forwardRef<HTMLInputElement, TagInputProps>(\n  (\n    {\n      value,\n      onChange,\n      placeholder,\n      max,\n      maxLength,\n      disabled = false,\n      error = false,\n      errorMessage,\n      size = 'md',\n      className,\n      allowDuplicates = false,\n      ...props\n    },\n    ref\n  ) => {\n    const locale = useLocale()\n    const [inputValue, setInputValue] = useState('')\n    const internalRef = useRef<HTMLInputElement | null>(null)\n\n    const focusInput = useCallback(() => {\n      internalRef.current?.focus()\n    }, [])\n\n    const addTag = useCallback(\n      (raw: string) => {\n        const tag = raw.trim()\n        if (!tag) return\n        if (maxLength && tag.length > maxLength) return\n        if (max && value.length >= max) return\n        if (!allowDuplicates && value.includes(tag)) return\n\n        onChange([...value, tag])\n        setInputValue('')\n      },\n      [value, onChange, max, maxLength, allowDuplicates]\n    )\n\n    const removeTag = useCallback(\n      (index: number) => {\n        onChange(value.filter((_, i) => i !== index))\n        focusInput()\n      },\n      [value, onChange, focusInput]\n    )\n\n    const handleKeyDown = useCallback(\n      (e: KeyboardEvent<HTMLInputElement>) => {\n        if (e.key === 'Enter' || e.key === ',') {\n          e.preventDefault()\n          addTag(inputValue)\n        } else if (e.key === 'Backspace' && inputValue === '' && value.length > 0) {\n          removeTag(value.length - 1)\n        }\n      },\n      [inputValue, value, addTag, removeTag]\n    )\n\n    const handleChange = useCallback(\n      (e: React.ChangeEvent<HTMLInputElement>) => {\n        const val = e.target.value\n        // If the user pastes or types a comma, split and add tags\n        if (val.includes(',')) {\n          const parts = val.split(',')\n          // Add all complete segments as tags\n          for (let i = 0; i < parts.length - 1; i++) {\n            addTag(parts[i])\n          }\n          // Keep the last segment (after the last comma) as input\n          setInputValue(parts[parts.length - 1])\n        } else {\n          setInputValue(val)\n        }\n      },\n      [addTag]\n    )\n\n    const container = (\n      // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions\n      <div\n        className={cn(\n          'bg-background flex flex-wrap items-center rounded-md border',\n          'transition-colors duration-200',\n          'has-[:focus-visible]:ring-ring/40 has-[:focus-visible]:ring-1 has-[:focus-visible]:ring-offset-0 has-[:focus-visible]:outline-none',\n          error ? 'border-destructive has-[:focus-visible]:ring-destructive' : 'border-input',\n          disabled && 'cursor-not-allowed',\n          containerSizeStyles[size],\n          className\n        )}\n        onClick={focusInput}\n      >\n        {value.map((tag, index) => (\n          <span\n            key={`${tag}-${index}`}\n            className={cn(\n              'bg-secondary text-secondary-foreground inline-flex items-center gap-1 rounded-full font-medium transition-colors',\n              disabled && 'cursor-not-allowed',\n              tagSizeStyles[size]\n            )}\n          >\n            {tag}\n            {!disabled && (\n              <button\n                type=\"button\"\n                aria-label={locale.tagInput.remove(tag)}\n                className=\"hover:bg-secondary-foreground/20 focus-visible:ring-ring rounded-full outline-none focus-visible:ring-1\"\n                onClick={(e) => {\n                  e.stopPropagation()\n                  removeTag(index)\n                }}\n              >\n                <X className={removeBtnSizeStyles[size]} />\n              </button>\n            )}\n          </span>\n        ))}\n        <input\n          ref={(node) => {\n            internalRef.current = node\n            if (typeof ref === 'function') ref(node)\n            else if (ref) ref.current = node\n          }}\n          type=\"text\"\n          value={inputValue}\n          onChange={handleChange}\n          onKeyDown={handleKeyDown}\n          placeholder={value.length === 0 ? placeholder : undefined}\n          disabled={disabled}\n          className={cn(\n            'min-w-[80px] flex-1 bg-transparent outline-none',\n            'placeholder:text-muted-foreground',\n            'disabled:cursor-not-allowed disabled:opacity-60'\n          )}\n          {...props}\n        />\n      </div>\n    )\n\n    if (!errorMessage) {\n      return container\n    }\n\n    return (\n      <div>\n        {container}\n        <p className=\"text-destructive mt-1.5 text-xs\">{errorMessage}</p>\n      </div>\n    )\n  }\n)\n\nTagInput.displayName = 'TagInput'\n","import { cloneElement, isValidElement, useRef, type MouseEvent, type ReactElement } from 'react'\n\nexport interface FileTriggerProps {\n  /** Accepted file types (native `accept` attribute) */\n  accept?: string\n  /** Allow multiple files */\n  multiple?: boolean\n  /** Disabled — the trigger renders but clicking does nothing */\n  disabled?: boolean\n  /** Called with the picked files (empty selection is ignored) */\n  onChange: (files: File[]) => void\n  /** Exactly one element to use as the trigger — cloned with an `onClick` that opens the picker */\n  children: ReactElement<{ onClick?: (e: MouseEvent) => void }>\n}\n\n/**\n * Headless file-picker trigger: makes ANY element open the native file dialog,\n * without imposing dropzone or button chrome. Use it when the trigger is a\n * thumbnail, an icon, a menu item — anything `FileUpload` (dropzone) and\n * `FileUploadButton` (styled button) don't fit:\n *\n * ```tsx\n * <FileTrigger accept=\"image/*\" onChange={([file]) => setPhoto(file)}>\n *   <img src={photoUrl} alt=\"更換照片\" className=\"h-16 w-16 rounded-full\" />\n * </FileTrigger>\n * ```\n *\n * The child's own `onClick` still runs first. The child must be focusable\n * itself (button, or `tabIndex`) for keyboard access — FileTrigger adds no\n * wrapper element and no styling.\n */\nexport function FileTrigger({\n  accept,\n  multiple = false,\n  disabled = false,\n  onChange,\n  children,\n}: FileTriggerProps) {\n  const inputRef = useRef<HTMLInputElement>(null)\n  if (!isValidElement(children)) {\n    throw new Error('[arkite-ui] FileTrigger expects exactly one element child.')\n  }\n  const childOnClick = children.props.onClick\n\n  return (\n    <>\n      <input\n        ref={inputRef}\n        type=\"file\"\n        accept={accept}\n        multiple={multiple}\n        disabled={disabled}\n        tabIndex={-1}\n        aria-hidden=\"true\"\n        className=\"sr-only\"\n        onChange={(e) => {\n          const files = e.target.files\n          if (files && files.length > 0) onChange(Array.from(files))\n          // Same file picked twice must still fire — reset the native value\n          e.target.value = ''\n        }}\n      />\n      {cloneElement(children, {\n        onClick: (e: MouseEvent) => {\n          childOnClick?.(e)\n          if (disabled || e.defaultPrevented) return\n          inputRef.current?.click()\n        },\n      })}\n    </>\n  )\n}\n","import {\n  forwardRef,\n  useRef,\n  useState,\n  type DragEvent,\n  type HTMLAttributes,\n  type InputHTMLAttributes,\n} from 'react'\nimport { cn } from '../../utils/cn'\nimport { Upload, X, File, Image, FileText, FileArchive } from 'lucide-react'\nimport { useLocale } from '../../locale'\n\nexport interface FileUploadProps extends Omit<\n  InputHTMLAttributes<HTMLInputElement>,\n  'type' | 'value' | 'onChange' | 'onError'\n> {\n  /** Accepted file types */\n  accept?: string\n  /** Allow multiple files */\n  multiple?: boolean\n  /** Max file size in bytes */\n  maxSize?: number\n  /** Max number of files */\n  maxFiles?: number\n  /** Uploaded files */\n  value?: File[]\n  /** On files change */\n  onChange?: (files: File[]) => void\n  /** On error */\n  onError?: (error: string) => void\n  /** Disabled state */\n  disabled?: boolean\n  /** Show file list */\n  showFileList?: boolean\n  /** Custom dropzone content */\n  children?: React.ReactNode\n  /** Dropzone class name */\n  dropzoneClassName?: string\n}\n\nconst fileTypeIcons: Record<string, typeof File> = {\n  image: Image,\n  text: FileText,\n  application: FileArchive,\n}\n\nfunction getFileIcon(file: File) {\n  const type = file.type.split('/')[0]\n  return fileTypeIcons[type] || File\n}\n\nfunction formatFileSize(bytes: number): string {\n  if (bytes === 0) return '0 Bytes'\n  const k = 1024\n  const sizes = ['Bytes', 'KB', 'MB', 'GB']\n  const i = Math.floor(Math.log(bytes) / Math.log(k))\n  return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]\n}\n\n/** Drag-and-drop file upload zone with validation and a file list preview. */\nexport const FileUpload = forwardRef<HTMLInputElement, FileUploadProps>(\n  (\n    {\n      className,\n      accept,\n      multiple = false,\n      maxSize,\n      maxFiles,\n      value = [],\n      onChange,\n      onError,\n      disabled = false,\n      showFileList = true,\n      children,\n      dropzoneClassName,\n      ...props\n    },\n    ref\n  ) => {\n    const locale = useLocale()\n    const inputRef = useRef<HTMLInputElement>(null)\n    const [isDragging, setIsDragging] = useState(false)\n\n    const handleFiles = (fileList: FileList | null) => {\n      if (!fileList || disabled) return\n\n      const files = Array.from(fileList)\n      let validFiles: File[] = []\n      let error: string | null = null\n\n      for (const file of files) {\n        // Check file size\n        if (maxSize && file.size > maxSize) {\n          error = locale.fileUpload.fileTooLarge(file.name, formatFileSize(maxSize))\n          continue\n        }\n\n        // Check file type\n        if (accept) {\n          const acceptedTypes = accept.split(',').map((t) => t.trim())\n          const isAccepted = acceptedTypes.some((type) => {\n            if (type.startsWith('.')) {\n              return file.name.toLowerCase().endsWith(type.toLowerCase())\n            }\n            if (type.endsWith('/*')) {\n              return file.type.startsWith(type.replace('/*', '/'))\n            }\n            return file.type === type\n          })\n\n          if (!isAccepted) {\n            error = locale.fileUpload.fileNotAccepted(file.name)\n            continue\n          }\n        }\n\n        validFiles.push(file)\n      }\n\n      // Check max files\n      if (maxFiles) {\n        const totalFiles = value.length + validFiles.length\n        if (totalFiles > maxFiles) {\n          error = locale.fileUpload.tooManyFiles(maxFiles)\n          validFiles = validFiles.slice(0, maxFiles - value.length)\n        }\n      }\n\n      if (error) {\n        onError?.(error)\n      }\n\n      if (validFiles.length > 0) {\n        const newFiles = multiple ? [...value, ...validFiles] : validFiles\n        onChange?.(newFiles)\n      }\n    }\n\n    const handleDragOver = (e: DragEvent) => {\n      e.preventDefault()\n      if (!disabled) {\n        setIsDragging(true)\n      }\n    }\n\n    const handleDragLeave = (e: DragEvent) => {\n      e.preventDefault()\n      setIsDragging(false)\n    }\n\n    const handleDrop = (e: DragEvent) => {\n      e.preventDefault()\n      setIsDragging(false)\n      handleFiles(e.dataTransfer.files)\n    }\n\n    const handleClick = () => {\n      if (!disabled) {\n        inputRef.current?.click()\n      }\n    }\n\n    const handleRemove = (index: number) => {\n      const newFiles = value.filter((_, i) => i !== index)\n      onChange?.(newFiles)\n    }\n\n    return (\n      <div className={cn('space-y-4', className)}>\n        {/* Hidden input */}\n        <input\n          ref={(node) => {\n            ;(inputRef as React.MutableRefObject<HTMLInputElement | null>).current = node\n            if (typeof ref === 'function') ref(node)\n            else if (ref) ref.current = node\n          }}\n          type=\"file\"\n          accept={accept}\n          multiple={multiple}\n          disabled={disabled}\n          className=\"sr-only\"\n          aria-label={locale.fileUpload.uploadFile}\n          onChange={(e) => handleFiles(e.target.files)}\n          {...props}\n        />\n\n        {/* Dropzone */}\n        <div\n          role=\"button\"\n          aria-label={locale.fileUpload.uploadFiles}\n          tabIndex={0}\n          onClick={handleClick}\n          onKeyDown={(e) => {\n            if (e.key === 'Enter' || e.key === ' ') {\n              e.preventDefault()\n              handleClick()\n            }\n          }}\n          onDragOver={handleDragOver}\n          onDragLeave={handleDragLeave}\n          onDrop={handleDrop}\n          className={cn(\n            'relative flex cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed p-6 transition-colors',\n            isDragging\n              ? 'border-primary bg-primary/5'\n              : 'border-muted-foreground/25 hover:border-muted-foreground/50',\n            disabled && 'pointer-events-none cursor-not-allowed',\n            dropzoneClassName\n          )}\n        >\n          {children || (\n            <>\n              <Upload className=\"text-muted-foreground mb-4 h-10 w-10\" />\n              <p className=\"mb-1 text-sm font-medium\">{locale.fileUpload.dropzone}</p>\n              <p className=\"text-muted-foreground text-xs\">\n                {accept ? locale.fileUpload.acceptedTypes(accept) : locale.fileUpload.anyFileType}\n                {maxSize && ` \\u2022 ${locale.fileUpload.maxSizeNote(formatFileSize(maxSize))}`}\n              </p>\n            </>\n          )}\n        </div>\n\n        {/* File list */}\n        {showFileList && value.length > 0 && (\n          <ul className=\"space-y-2\">\n            {value.map((file, index) => {\n              const Icon = getFileIcon(file)\n              return (\n                <li\n                  key={`${file.name}-${index}`}\n                  className=\"bg-card flex items-center gap-3 rounded-lg border p-3\"\n                >\n                  <Icon className=\"text-muted-foreground h-8 w-8 shrink-0\" />\n                  <div className=\"min-w-0 flex-1\">\n                    <p className=\"truncate text-sm font-medium\">{file.name}</p>\n                    <p className=\"text-muted-foreground text-xs\">{formatFileSize(file.size)}</p>\n                  </div>\n                  <button\n                    type=\"button\"\n                    onClick={(e) => {\n                      e.stopPropagation()\n                      handleRemove(index)\n                    }}\n                    className=\"text-muted-foreground hover:text-foreground shrink-0 rounded-md p-1\"\n                  >\n                    <X className=\"h-4 w-4\" />\n                    <span className=\"sr-only\">{locale.fileUpload.remove}</span>\n                  </button>\n                </li>\n              )\n            })}\n          </ul>\n        )}\n      </div>\n    )\n  }\n)\n\nFileUpload.displayName = 'FileUpload'\n\n// Compact variant\nexport interface FileUploadButtonProps extends Omit<HTMLAttributes<HTMLButtonElement>, 'onChange'> {\n  /** Accepted file types */\n  accept?: string\n  /** Allow multiple files */\n  multiple?: boolean\n  /** On files change */\n  onChange?: (files: File[]) => void\n  /** Disabled state */\n  disabled?: boolean\n}\n\n/** Compact button variant that opens a native file picker on click. */\nexport const FileUploadButton = forwardRef<HTMLButtonElement, FileUploadButtonProps>(\n  (\n    { className, accept, multiple = false, onChange, disabled = false, children, ...props },\n    ref\n  ) => {\n    const locale = useLocale()\n    const inputRef = useRef<HTMLInputElement>(null)\n\n    const handleClick = () => {\n      inputRef.current?.click()\n    }\n\n    const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n      const files = e.target.files\n      if (files) {\n        onChange?.(Array.from(files))\n      }\n    }\n\n    return (\n      <>\n        <input\n          ref={inputRef}\n          type=\"file\"\n          accept={accept}\n          multiple={multiple}\n          disabled={disabled}\n          className=\"sr-only\"\n          aria-label={locale.fileUpload.uploadFile}\n          onChange={handleChange}\n        />\n        <button\n          ref={ref}\n          type=\"button\"\n          onClick={handleClick}\n          disabled={disabled}\n          className={cn(\n            'bg-background inline-flex items-center gap-2 rounded-md border px-4 py-2 text-sm font-medium transition-colors',\n            'hover:bg-muted focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none',\n            'disabled:pointer-events-none disabled:opacity-50',\n            className\n          )}\n          {...props}\n        >\n          <Upload className=\"h-4 w-4\" />\n          {children || locale.fileUpload.upload}\n        </button>\n      </>\n    )\n  }\n)\n\nFileUploadButton.displayName = 'FileUploadButton'\n","import { forwardRef, useRef, useState, type DragEvent } from 'react'\nimport { cn } from '../../utils/cn'\nimport { warnDeprecated } from '../../utils/deprecate'\nimport { Plus, X, ImageIcon } from 'lucide-react'\nimport { useLocale } from '../../locale'\n\nexport interface ImageUploadProps {\n  /** Already-uploaded image URLs */\n  value?: string[]\n  /** Called when user selects new files to upload */\n  onChange?: (files: File[]) => void\n  /** Called when user removes an existing image URL */\n  onRemove?: (url: string) => void\n  /** Maximum number of images (1 = single-image mode) */\n  max?: number\n  /** Accepted file types (default: \"image/*\") */\n  accept?: string\n  /** Max file size in bytes */\n  maxSize?: number\n  /** Disabled state */\n  disabled?: boolean\n  /** Show uploading overlay on specific URLs */\n  loadingUrls?: string[]\n  /**\n   * Error state. Passing a string (the message itself) is deprecated —\n   * use `errorMessage` instead; string support is removed in v1.0.\n   */\n  error?: boolean | string\n  /** Error message */\n  errorMessage?: string\n  /** Container class name */\n  className?: string\n  /** Placeholder text */\n  placeholder?: string\n}\n\nfunction formatFileSize(bytes: number): string {\n  if (bytes === 0) return '0 Bytes'\n  const k = 1024\n  const sizes = ['Bytes', 'KB', 'MB', 'GB']\n  const i = Math.floor(Math.log(bytes) / Math.log(k))\n  return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]\n}\n\n/** Image upload zone with preview grid. Manages URL display and emits File objects for new uploads. */\nexport const ImageUpload = forwardRef<HTMLInputElement, ImageUploadProps>(\n  (\n    {\n      value = [],\n      onChange,\n      onRemove,\n      max,\n      accept = 'image/*',\n      maxSize,\n      disabled = false,\n      loadingUrls = [],\n      error,\n      errorMessage,\n      className,\n      placeholder,\n    },\n    ref\n  ) => {\n    const locale = useLocale()\n    const inputRef = useRef<HTMLInputElement>(null)\n    const [isDragging, setIsDragging] = useState(false)\n\n    if (typeof error === 'string' && errorMessage === undefined) {\n      warnDeprecated('ImageUpload', 'error', 'errorMessage')\n    }\n    const resolvedErrorMessage = errorMessage ?? (typeof error === 'string' ? error : undefined)\n    const hasError = Boolean(error)\n\n    const isSingle = max === 1\n    const isFull = max != null && value.length >= max\n\n    const defaultPlaceholder = isSingle ? locale.fileUpload.uploadImage : locale.fileUpload.addImage\n\n    const handleFiles = (fileList: FileList | null) => {\n      if (!fileList || disabled) return\n\n      const files = Array.from(fileList)\n      const valid: File[] = []\n\n      for (const file of files) {\n        if (!file.type.startsWith('image/')) continue\n        if (maxSize && file.size > maxSize) continue\n        valid.push(file)\n      }\n\n      // Respect max limit\n      if (max != null) {\n        const remaining = max - value.length\n        if (remaining <= 0) return\n        onChange?.(valid.slice(0, remaining))\n      } else {\n        onChange?.(valid)\n      }\n\n      // Reset input so same file can be re-selected\n      if (inputRef.current) inputRef.current.value = ''\n    }\n\n    const handleDragOver = (e: DragEvent) => {\n      e.preventDefault()\n      if (!disabled && !isFull) setIsDragging(true)\n    }\n\n    const handleDragLeave = (e: DragEvent) => {\n      e.preventDefault()\n      setIsDragging(false)\n    }\n\n    const handleDrop = (e: DragEvent) => {\n      e.preventDefault()\n      setIsDragging(false)\n      handleFiles(e.dataTransfer.files)\n    }\n\n    const openPicker = () => {\n      if (!disabled) inputRef.current?.click()\n    }\n\n    // Hidden input\n    const hiddenInput = (\n      <input\n        ref={(node) => {\n          ;(inputRef as React.MutableRefObject<HTMLInputElement | null>).current = node\n          if (typeof ref === 'function') ref(node)\n          else if (ref) ref.current = node\n        }}\n        type=\"file\"\n        accept={accept}\n        multiple={!isSingle}\n        disabled={disabled}\n        className=\"sr-only\"\n        aria-label={locale.fileUpload.uploadImage}\n        onChange={(e) => handleFiles(e.target.files)}\n        data-testid=\"image-upload-input\"\n      />\n    )\n\n    // ── Single image mode ──\n    if (isSingle) {\n      const url = value[0]\n\n      return (\n        <div className={cn('space-y-1', className)}>\n          {hiddenInput}\n          {url ? (\n            <div className=\"group relative inline-block overflow-hidden rounded-lg border\">\n              <img src={url} alt={locale.fileUpload.preview} className=\"h-32 w-32 object-cover\" />\n              {loadingUrls.includes(url) && (\n                <div className=\"absolute inset-0 flex items-center justify-center bg-black/40\">\n                  <div className=\"h-5 w-5 animate-spin rounded-full border-2 border-white border-t-transparent\" />\n                </div>\n              )}\n              {!disabled && (\n                <div className=\"absolute inset-0 flex items-center justify-center gap-2 bg-black/50 opacity-0 transition-opacity group-hover:opacity-100\">\n                  <button\n                    type=\"button\"\n                    onClick={openPicker}\n                    className=\"rounded-md bg-white/90 px-2 py-1 text-xs font-medium text-black hover:bg-white\"\n                  >\n                    {locale.fileUpload.replace}\n                  </button>\n                  <button\n                    type=\"button\"\n                    onClick={() => onRemove?.(url)}\n                    className=\"text-destructive rounded-md bg-white/90 px-2 py-1 text-xs font-medium hover:bg-white\"\n                  >\n                    {locale.fileUpload.remove}\n                  </button>\n                </div>\n              )}\n            </div>\n          ) : (\n            <button\n              type=\"button\"\n              onClick={openPicker}\n              onDragOver={handleDragOver}\n              onDragLeave={handleDragLeave}\n              onDrop={handleDrop}\n              disabled={disabled}\n              className={cn(\n                'flex h-32 w-32 flex-col items-center justify-center gap-1 rounded-lg border-2 border-dashed transition-colors',\n                isDragging\n                  ? 'border-primary bg-primary/5'\n                  : hasError\n                    ? 'border-destructive'\n                    : 'border-muted-foreground/25 hover:border-muted-foreground/50',\n                disabled && 'pointer-events-none opacity-50'\n              )}\n            >\n              <ImageIcon className=\"text-muted-foreground h-6 w-6\" />\n              <span className=\"text-muted-foreground text-xs\">\n                {placeholder || defaultPlaceholder}\n              </span>\n              {maxSize && (\n                <span className=\"text-2xs text-muted-foreground\">\n                  {locale.fileUpload.maxSizeHint(formatFileSize(maxSize))}\n                </span>\n              )}\n            </button>\n          )}\n          {resolvedErrorMessage && (\n            <p className=\"text-destructive text-xs\">{resolvedErrorMessage}</p>\n          )}\n        </div>\n      )\n    }\n\n    // ── Multi-image grid mode ──\n    return (\n      <div className={cn('space-y-1', className)}>\n        {hiddenInput}\n        <div className=\"flex flex-wrap gap-3\">\n          {value.map((url) => (\n            <div key={url} className=\"group relative overflow-hidden rounded-lg border\">\n              <img src={url} alt={locale.fileUpload.preview} className=\"h-24 w-24 object-cover\" />\n              {loadingUrls.includes(url) && (\n                <div className=\"absolute inset-0 flex items-center justify-center bg-black/40\">\n                  <div className=\"h-5 w-5 animate-spin rounded-full border-2 border-white border-t-transparent\" />\n                </div>\n              )}\n              {!disabled && (\n                <button\n                  type=\"button\"\n                  onClick={() => onRemove?.(url)}\n                  className=\"absolute top-1 right-1 rounded-full bg-black/60 p-0.5 text-white opacity-0 transition-opacity group-hover:opacity-100 hover:bg-black/80\"\n                  aria-label={locale.fileUpload.removeImage}\n                >\n                  <X className=\"h-3.5 w-3.5\" />\n                </button>\n              )}\n            </div>\n          ))}\n\n          {!isFull && (\n            <button\n              type=\"button\"\n              onClick={openPicker}\n              onDragOver={handleDragOver}\n              onDragLeave={handleDragLeave}\n              onDrop={handleDrop}\n              disabled={disabled}\n              className={cn(\n                'flex h-24 w-24 flex-col items-center justify-center gap-1 rounded-lg border-2 border-dashed transition-colors',\n                isDragging\n                  ? 'border-primary bg-primary/5'\n                  : hasError\n                    ? 'border-destructive'\n                    : 'border-muted-foreground/25 hover:border-muted-foreground/50',\n                disabled && 'pointer-events-none opacity-50'\n              )}\n            >\n              <Plus className=\"text-muted-foreground h-5 w-5\" />\n              <span className=\"text-2xs text-muted-foreground\">\n                {placeholder || defaultPlaceholder}\n              </span>\n            </button>\n          )}\n        </div>\n        {max && (\n          <p className=\"text-muted-foreground text-xs\">\n            {value.length} / {max}\n          </p>\n        )}\n        {resolvedErrorMessage && <p className=\"text-destructive text-xs\">{resolvedErrorMessage}</p>}\n      </div>\n    )\n  }\n)\n\nImageUpload.displayName = 'ImageUpload'\n","import {\n  forwardRef,\n  useState,\n  useRef,\n  useEffect,\n  useCallback,\n  useId,\n  type InputHTMLAttributes,\n} from 'react'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\nimport { useGridKeyboard, toDayKey } from '../calendar/use-grid-keyboard'\nimport { Calendar as CalendarIcon, ChevronLeft, ChevronRight, X } from 'lucide-react'\n\nfunction getDaysInMonth(year: number, month: number): number {\n  return new Date(year, month + 1, 0).getDate()\n}\n\nfunction getFirstDayOfMonth(year: number, month: number): number {\n  return new Date(year, month, 1).getDay()\n}\n\nfunction formatDate(date: Date, format: string): string {\n  const year = date.getFullYear()\n  const month = String(date.getMonth() + 1).padStart(2, '0')\n  const day = String(date.getDate()).padStart(2, '0')\n\n  return format.replace('yyyy', String(year)).replace('MM', month).replace('dd', day)\n}\n\nfunction parseDate(dateStr: string, format: string): Date | null {\n  const yearMatch = format.indexOf('yyyy')\n  const monthMatch = format.indexOf('MM')\n  const dayMatch = format.indexOf('dd')\n\n  if (yearMatch === -1 || monthMatch === -1 || dayMatch === -1) return null\n\n  const year = parseInt(dateStr.slice(yearMatch, yearMatch + 4))\n  const month = parseInt(dateStr.slice(monthMatch, monthMatch + 2)) - 1\n  const day = parseInt(dateStr.slice(dayMatch, dayMatch + 2))\n\n  if (isNaN(year) || isNaN(month) || isNaN(day)) return null\n\n  return new Date(year, month, day)\n}\n\nexport type DatePickerSize = 'sm' | 'md' | 'lg'\n\nexport interface DatePickerProps extends Omit<\n  InputHTMLAttributes<HTMLInputElement>,\n  'value' | 'defaultValue' | 'onChange' | 'size'\n> {\n  /** Selected date */\n  value?: Date | null\n  /** Initial date for uncontrolled usage */\n  defaultValue?: Date\n  /** On date change */\n  onChange?: (date: Date | null) => void\n  /** Controlled open state of the calendar popup */\n  open?: boolean\n  /** Initial open state of the calendar popup for uncontrolled usage */\n  defaultOpen?: boolean\n  /** Called when the calendar popup opens or closes */\n  onOpenChange?: (open: boolean) => void\n  /** Date format */\n  format?: string\n  /** Minimum date */\n  minDate?: Date\n  /** Maximum date */\n  maxDate?: Date\n  /** Disabled dates */\n  disabledDates?: Date[]\n  /** Show clear button */\n  clearable?: boolean\n  /** Error state */\n  error?: boolean\n  /** Error message */\n  errorMessage?: string\n  /** Size variant */\n  size?: DatePickerSize\n}\n\nconst inputSizeStyles: Record<DatePickerSize, string> = {\n  sm: 'h-8 px-3 pr-8 text-xs',\n  md: 'h-10 px-3 pr-10 text-sm',\n  lg: 'h-12 px-4 pr-12 text-base',\n}\n\nconst iconSizeStyles: Record<DatePickerSize, string> = {\n  sm: 'h-3.5 w-3.5',\n  md: 'h-4 w-4',\n  lg: 'h-5 w-5',\n}\n\nconst clearPositionStyles: Record<DatePickerSize, string> = {\n  sm: 'right-8 top-4',\n  md: 'right-9 top-5',\n  lg: 'right-10 top-6',\n}\n\nconst clearablePaddingStyles: Record<DatePickerSize, string> = {\n  sm: 'pr-12',\n  md: 'pr-14',\n  lg: 'pr-16',\n}\n\n/** Date input with an inline calendar dropdown for selecting dates. */\nexport const DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(\n  (\n    {\n      className,\n      value,\n      defaultValue,\n      onChange,\n      open: openProp,\n      defaultOpen,\n      onOpenChange,\n      format = 'yyyy-MM-dd',\n      minDate,\n      maxDate,\n      disabledDates = [],\n      clearable = true,\n      error,\n      errorMessage,\n      disabled,\n      size = 'md',\n      placeholder,\n      ...props\n    },\n    ref\n  ) => {\n    const locale = useLocale()\n    const isValueControlled = value !== undefined\n    const [internalValue, setInternalValue] = useState<Date | null>(defaultValue ?? null)\n    const currentValue = isValueControlled ? (value ?? null) : internalValue\n    const [internalOpen, setInternalOpen] = useState(defaultOpen ?? false)\n    const isOpen = openProp ?? internalOpen\n    const [inputValue, setInputValue] = useState(\n      currentValue ? formatDate(currentValue, format) : ''\n    )\n    const [viewDate, setViewDate] = useState(currentValue || new Date())\n    const containerRef = useRef<HTMLDivElement>(null)\n    const inputRef = useRef<HTMLInputElement | null>(null)\n    // Set when we programmatically return focus to the input (Escape/select),\n    // so the focus handler does not immediately reopen the popup.\n    const skipOpenOnFocusRef = useRef(false)\n    const monthLabelId = useId()\n\n    const { focusDay, handleDayKeyDown } = useGridKeyboard({\n      containerRef,\n      currentMonth: viewDate,\n      onNavigateToMonth: setViewDate,\n    })\n\n    const setOpen = useCallback(\n      (next: boolean) => {\n        setInternalOpen(next)\n        if (next !== isOpen) onOpenChange?.(next)\n      },\n      [isOpen, onOpenChange]\n    )\n\n    const setValue = (date: Date | null) => {\n      if (!isValueControlled) setInternalValue(date)\n      onChange?.(date)\n    }\n\n    // Sync input value with the current value\n    useEffect(() => {\n      if (currentValue) {\n        setInputValue(formatDate(currentValue, format))\n        setViewDate(currentValue)\n      } else {\n        setInputValue('')\n      }\n    }, [currentValue, format])\n\n    // Close on Escape without selecting, returning focus to the input\n    useEffect(() => {\n      if (!isOpen) return\n\n      const handleEscape = (e: KeyboardEvent) => {\n        if (e.key !== 'Escape') return\n        setOpen(false)\n        if (document.activeElement !== inputRef.current) {\n          skipOpenOnFocusRef.current = true\n          inputRef.current?.focus()\n        }\n      }\n\n      document.addEventListener('keydown', handleEscape)\n      return () => document.removeEventListener('keydown', handleEscape)\n    }, [isOpen, setOpen])\n\n    // Close on click outside\n    useEffect(() => {\n      if (!isOpen) return\n\n      const handleClickOutside = (e: MouseEvent) => {\n        if (containerRef.current && !containerRef.current.contains(e.target as Node)) {\n          setOpen(false)\n        }\n      }\n\n      document.addEventListener('mousedown', handleClickOutside)\n      return () => document.removeEventListener('mousedown', handleClickOutside)\n    }, [isOpen, setOpen])\n\n    const isDateDisabled = (date: Date): boolean => {\n      if (minDate && date < minDate) return true\n      if (maxDate && date > maxDate) return true\n      return disabledDates.some((d) => d.toDateString() === date.toDateString())\n    }\n\n    const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n      const val = e.target.value\n      setInputValue(val)\n\n      const parsed = parseDate(val, format)\n      if (parsed && !isNaN(parsed.getTime()) && !isDateDisabled(parsed)) {\n        setValue(parsed)\n        setViewDate(parsed)\n      }\n    }\n\n    const closeAndFocusInput = () => {\n      setOpen(false)\n      if (document.activeElement !== inputRef.current) {\n        skipOpenOnFocusRef.current = true\n        inputRef.current?.focus()\n      }\n    }\n\n    const handleDateSelect = (day: number) => {\n      const newDate = new Date(viewDate.getFullYear(), viewDate.getMonth(), day)\n      if (!isDateDisabled(newDate)) {\n        setValue(newDate)\n        closeAndFocusInput()\n      }\n    }\n\n    const handleClear = () => {\n      setValue(null)\n    }\n\n    const handlePrevMonth = () => {\n      setViewDate(new Date(viewDate.getFullYear(), viewDate.getMonth() - 1, 1))\n    }\n\n    const handleNextMonth = () => {\n      setViewDate(new Date(viewDate.getFullYear(), viewDate.getMonth() + 1, 1))\n    }\n\n    const renderCalendar = () => {\n      const year = viewDate.getFullYear()\n      const month = viewDate.getMonth()\n      const daysInMonth = getDaysInMonth(year, month)\n      const firstDay = getFirstDayOfMonth(year, month)\n      const today = new Date()\n\n      const days: (number | null)[] = []\n\n      // Empty cells before first day\n      for (let i = 0; i < firstDay; i++) {\n        days.push(null)\n      }\n\n      // Days of month\n      for (let i = 1; i <= daysInMonth; i++) {\n        days.push(i)\n      }\n\n      return (\n        <div className=\"w-64 p-3\">\n          {/* Header */}\n          <div className=\"mb-3 flex items-center justify-between\">\n            <button\n              type=\"button\"\n              onClick={handlePrevMonth}\n              aria-label={locale.calendar.previousMonth}\n              className=\"hover:bg-muted rounded p-1\"\n            >\n              <ChevronLeft className=\"h-4 w-4\" />\n            </button>\n            <span id={monthLabelId} className=\"text-sm font-medium\">\n              {new Date(year, month).toLocaleDateString(locale.dateLocale, {\n                month: 'long',\n                year: 'numeric',\n              })}\n            </span>\n            <button\n              type=\"button\"\n              onClick={handleNextMonth}\n              aria-label={locale.calendar.nextMonth}\n              className=\"hover:bg-muted rounded p-1\"\n            >\n              <ChevronRight className=\"h-4 w-4\" />\n            </button>\n          </div>\n\n          {/* Day names */}\n          <div className=\"mb-2 grid grid-cols-7 gap-1\">\n            {locale.calendar.weekdaysShort.map((day) => (\n              <div\n                key={day}\n                className=\"text-muted-foreground flex h-8 items-center justify-center text-xs\"\n              >\n                {day}\n              </div>\n            ))}\n          </div>\n\n          {/* Days grid */}\n          <div className=\"grid grid-cols-7 gap-1\">\n            {days.map((day, index) => {\n              if (day === null) {\n                return <div key={index} className=\"h-8\" />\n              }\n\n              const date = new Date(year, month, day)\n              const isDisabled = isDateDisabled(date)\n              const isSelected = currentValue?.toDateString() === date.toDateString()\n              const isToday = today.toDateString() === date.toDateString()\n\n              return (\n                <button\n                  key={index}\n                  type=\"button\"\n                  disabled={isDisabled}\n                  data-day={toDayKey(date)}\n                  onClick={() => handleDateSelect(day)}\n                  onKeyDown={(event) => handleDayKeyDown(event, date)}\n                  className={cn(\n                    'h-8 w-8 rounded-md text-sm transition-colors',\n                    'hover:bg-muted focus:ring-ring focus:ring-2 focus:outline-none',\n                    isSelected && 'bg-primary text-primary-foreground hover:bg-primary',\n                    isToday && !isSelected && 'bg-muted',\n                    isDisabled && 'cursor-not-allowed opacity-50 hover:bg-transparent'\n                  )}\n                >\n                  {day}\n                </button>\n              )\n            })}\n          </div>\n\n          {/* Today button */}\n          <div className=\"mt-3 border-t pt-3\">\n            <button\n              type=\"button\"\n              onClick={() => {\n                const today = new Date()\n                if (!isDateDisabled(today)) {\n                  setValue(today)\n                  closeAndFocusInput()\n                }\n              }}\n              className=\"text-primary w-full text-sm hover:underline\"\n            >\n              {locale.datePicker.today}\n            </button>\n          </div>\n        </div>\n      )\n    }\n\n    return (\n      <div ref={containerRef} className={cn('relative', className)}>\n        <div className=\"relative\">\n          <input\n            ref={(node) => {\n              inputRef.current = node\n              if (typeof ref === 'function') ref(node)\n              else if (ref) ref.current = node\n            }}\n            type=\"text\"\n            value={inputValue}\n            onChange={handleInputChange}\n            onFocus={() => {\n              if (skipOpenOnFocusRef.current) {\n                skipOpenOnFocusRef.current = false\n                return\n              }\n              setOpen(true)\n            }}\n            placeholder={placeholder ?? locale.datePicker.placeholder}\n            disabled={disabled}\n            className={cn(\n              'border-input bg-background flex w-full rounded-md border',\n              inputSizeStyles[size],\n              clearable && currentValue && !disabled && clearablePaddingStyles[size],\n              'ring-offset-background placeholder:text-muted-foreground',\n              'focus-visible:border-primary focus-visible:ring-ring/30 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n              'disabled:cursor-not-allowed disabled:opacity-50',\n              error && 'border-destructive focus-visible:ring-destructive'\n            )}\n            {...props}\n          />\n          <button\n            type=\"button\"\n            aria-label={locale.datePicker.openCalendar}\n            onClick={() => {\n              if (disabled) return\n              if (isOpen) {\n                setOpen(false)\n              } else {\n                // APG: opening the dialog moves focus to the selected day\n                // (or today when nothing is selected).\n                setOpen(true)\n                focusDay(currentValue ?? new Date())\n              }\n            }}\n            className={cn(\n              'text-muted-foreground absolute top-1/2 right-3 -translate-y-1/2',\n              disabled && 'cursor-not-allowed'\n            )}\n          >\n            <CalendarIcon className={iconSizeStyles[size]} />\n          </button>\n        </div>\n\n        {/* Dropdown */}\n        {isOpen && (\n          <div\n            role=\"dialog\"\n            aria-labelledby={monthLabelId}\n            className=\"bg-card absolute z-50 mt-1 rounded-md border shadow-lg\"\n          >\n            {renderCalendar()}\n          </div>\n        )}\n\n        {/* Clear button — rendered after the dropdown so the popup keeps its\n            tab position right after the calendar trigger */}\n        {clearable && currentValue && !disabled && (\n          <button\n            type=\"button\"\n            onClick={handleClear}\n            aria-label={locale.datePicker.clearDate}\n            className={cn(\n              'text-muted-foreground hover:text-foreground absolute -translate-y-1/2 focus:outline-none',\n              clearPositionStyles[size]\n            )}\n          >\n            <X className={iconSizeStyles[size]} />\n          </button>\n        )}\n\n        {errorMessage && <p className=\"text-destructive mt-1.5 text-xs\">{errorMessage}</p>}\n      </div>\n    )\n  }\n)\n\nDatePicker.displayName = 'DatePicker'\n","import { useEffect, useState, type KeyboardEvent, type RefObject } from 'react'\n\nfunction addDays(date: Date, amount: number): Date {\n  return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount)\n}\n\nfunction addMonthsClamped(date: Date, amount: number): Date {\n  const year = date.getFullYear()\n  const month = date.getMonth() + amount\n  const lastDayOfTarget = new Date(year, month + 1, 0).getDate()\n  return new Date(year, month, Math.min(date.getDate(), lastDayOfTarget))\n}\n\nfunction isSameMonth(a: Date, b: Date): boolean {\n  return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth()\n}\n\n/** Stable per-day key used to locate a day button in the grid DOM. */\nexport function toDayKey(date: Date): string {\n  return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`\n}\n\nexport interface UseGridKeyboardOptions {\n  /** Element containing the day buttons (matched via their `data-day` attribute). */\n  containerRef: RefObject<HTMLElement | null>\n  /** Month currently rendered in the grid. */\n  currentMonth: Date\n  /** Called when focus needs to land on a day outside the rendered month. */\n  onNavigateToMonth: (month: Date) => void\n  /** First day of week (0=Sun, 1=Mon). */\n  weekStartsOn?: 0 | 1\n}\n\n/**\n * Shared APG-style keyboard navigation for month grids (Calendar and\n * DatePicker): arrows move by day/week, Home/End jump to the edges of the\n * week, PageUp/PageDown move by month (clamped to the target month's last\n * day). When the target day is outside the rendered month the hook first\n * switches the month, then an effect focuses the target button once it\n * exists in the DOM.\n */\nexport function useGridKeyboard({\n  containerRef,\n  currentMonth,\n  onNavigateToMonth,\n  weekStartsOn = 0,\n}: UseGridKeyboardOptions) {\n  const [focusTarget, setFocusTarget] = useState<Date | null>(null)\n\n  useEffect(() => {\n    if (!focusTarget) return\n    containerRef.current\n      ?.querySelector<HTMLElement>(`[data-day=\"${toDayKey(focusTarget)}\"]`)\n      ?.focus()\n  }, [focusTarget, containerRef])\n\n  const focusDay = (target: Date) => {\n    if (!isSameMonth(target, currentMonth)) {\n      onNavigateToMonth(new Date(target.getFullYear(), target.getMonth(), 1))\n    }\n    // Clone so repeated requests for the same Date instance still re-trigger\n    // the focus effect.\n    setFocusTarget(new Date(target))\n  }\n\n  const handleDayKeyDown = (event: KeyboardEvent<HTMLElement>, date: Date) => {\n    let target: Date\n    switch (event.key) {\n      case 'ArrowLeft':\n        target = addDays(date, -1)\n        break\n      case 'ArrowRight':\n        target = addDays(date, 1)\n        break\n      case 'ArrowUp':\n        target = addDays(date, -7)\n        break\n      case 'ArrowDown':\n        target = addDays(date, 7)\n        break\n      case 'Home':\n        target = addDays(date, -((date.getDay() - weekStartsOn + 7) % 7))\n        break\n      case 'End':\n        target = addDays(date, 6 - ((date.getDay() - weekStartsOn + 7) % 7))\n        break\n      case 'PageUp':\n        target = addMonthsClamped(date, -1)\n        break\n      case 'PageDown':\n        target = addMonthsClamped(date, 1)\n        break\n      default:\n        return\n    }\n    event.preventDefault()\n    focusDay(target)\n  }\n\n  return { focusDay, handleDayKeyDown }\n}\n","import {\n  forwardRef,\n  useState,\n  useRef,\n  useEffect,\n  useCallback,\n  useContext,\n  useId,\n  type HTMLAttributes,\n} from 'react'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\nimport { warnUsage } from '../../utils/deprecate'\nimport { FilterToolbarContext } from '../filter-bar/FilterBar'\nimport { Calendar as CalendarIcon, ChevronLeft, ChevronRight, X } from 'lucide-react'\n\nfunction getDaysInMonth(year: number, month: number): number {\n  return new Date(year, month + 1, 0).getDate()\n}\n\nfunction getFirstDayOfMonth(year: number, month: number): number {\n  return new Date(year, month, 1).getDay()\n}\n\nfunction formatDate(date: Date, format: string): string {\n  const year = date.getFullYear()\n  const month = String(date.getMonth() + 1).padStart(2, '0')\n  const day = String(date.getDate()).padStart(2, '0')\n\n  return format.replace('yyyy', String(year)).replace('MM', month).replace('dd', day)\n}\n\nfunction parseDate(dateStr: string, format: string): Date | null {\n  const yearMatch = format.indexOf('yyyy')\n  const monthMatch = format.indexOf('MM')\n  const dayMatch = format.indexOf('dd')\n\n  if (yearMatch === -1 || monthMatch === -1 || dayMatch === -1) return null\n\n  const year = parseInt(dateStr.slice(yearMatch, yearMatch + 4))\n  const month = parseInt(dateStr.slice(monthMatch, monthMatch + 2)) - 1\n  const day = parseInt(dateStr.slice(dayMatch, dayMatch + 2))\n\n  if (isNaN(year) || isNaN(month) || isNaN(day)) return null\n\n  return new Date(year, month, day)\n}\n\nfunction stripTime(date: Date): Date {\n  return new Date(date.getFullYear(), date.getMonth(), date.getDate())\n}\n\nexport type DateRangePickerSize = 'sm' | 'md' | 'lg'\nexport type DateRangePickerVariant = 'input' | 'calendar'\n\nexport interface DateRangeValue {\n  start: Date | null\n  end: Date | null\n}\n\nexport interface DateRangePickerProps extends Omit<\n  HTMLAttributes<HTMLDivElement>,\n  'onChange' | 'defaultValue'\n> {\n  /** Selected range (controlled). Takes precedence over `startDate`/`endDate`. */\n  value?: DateRangeValue\n  /** Initial range for uncontrolled usage */\n  defaultValue?: DateRangeValue\n  /** Called with the full range whenever either date changes */\n  onChange?: (range: DateRangeValue) => void\n  /** Selected start date */\n  startDate?: Date | null\n  /** Selected end date */\n  endDate?: Date | null\n  /** Called when the start date changes */\n  onStartChange?: (date: Date | null) => void\n  /** Called when the end date changes */\n  onEndChange?: (date: Date | null) => void\n  /** Called when the clear button is clicked, resetting both dates */\n  onClear?: () => void\n  /** Controlled open state of the calendar dropdown */\n  open?: boolean\n  /** Initial open state of the calendar dropdown for uncontrolled usage */\n  defaultOpen?: boolean\n  /** Called when the calendar dropdown opens or closes */\n  onOpenChange?: (open: boolean) => void\n  /** Label for the start date input */\n  startLabel?: string\n  /** Label for the end date input */\n  endLabel?: string\n  /**\n   * Where the field labels go.\n   *\n   * - `'top'` (default) — stacked above each input. Adds a line above the\n   *   control, so in a `FilterBar` it pushes the inputs out of alignment with\n   *   the single-line controls beside them.\n   * - `'inside'` — the label becomes the input's placeholder, keeping the whole\n   *   control on one line. The expected format moves to the input's `title`.\n   * - `'none'` — no visible label; the placeholder stays the date format.\n   *\n   * All three keep the label as the input's accessible name.\n   */\n  labelPlacement?: 'top' | 'inside' | 'none'\n  /** Date display format */\n  format?: string\n  /** Minimum selectable date */\n  minDate?: Date\n  /** Maximum selectable date */\n  maxDate?: Date\n  /** Disabled state for both inputs */\n  disabled?: boolean\n  /** Error state for both inputs */\n  error?: boolean\n  /** Error message */\n  errorMessage?: string\n  /** Size variant */\n  size?: DateRangePickerSize\n  /** Display variant. 'input' shows two text inputs (default). 'calendar' shows a single trigger button with a dual-month calendar popover. */\n  variant?: DateRangePickerVariant\n}\n\nconst inputSizeStyles: Record<DateRangePickerSize, string> = {\n  sm: 'h-8 px-3 pr-8 text-xs',\n  md: 'h-10 px-3 pr-10 text-sm',\n  lg: 'h-12 px-4 pr-12 text-base',\n}\n\nconst iconSizeStyles: Record<DateRangePickerSize, string> = {\n  sm: 'h-3.5 w-3.5',\n  md: 'h-4 w-4',\n  lg: 'h-5 w-5',\n}\n\nconst labelSizeStyles: Record<DateRangePickerSize, string> = {\n  sm: 'text-xs',\n  md: 'text-sm',\n  lg: 'text-base',\n}\n\nconst triggerSizeStyles: Record<DateRangePickerSize, string> = {\n  sm: 'h-8 px-3 text-xs',\n  md: 'h-10 px-3 text-sm',\n  lg: 'h-12 px-4 text-base',\n}\n\ntype ActiveField = 'start' | 'end' | null\n\n/**\n * A date range picker with two side-by-side date inputs (start and end),\n * shared calendar dropdowns, and a clear button to reset both values.\n *\n * When `variant=\"calendar\"`, renders a single trigger button that opens\n * a dual-month calendar popover for visual range selection.\n *\n * The start date constrains the end date — the end date cannot be set\n * earlier than the start date.\n */\nexport const DateRangePicker = forwardRef<HTMLDivElement, DateRangePickerProps>(\n  (\n    {\n      className,\n      value,\n      defaultValue,\n      onChange,\n      startDate,\n      endDate,\n      onStartChange,\n      onEndChange,\n      onClear,\n      open: openProp,\n      defaultOpen,\n      onOpenChange,\n      startLabel,\n      endLabel,\n      labelPlacement = 'top',\n      format = 'yyyy-MM-dd',\n      minDate,\n      maxDate,\n      disabled,\n      error,\n      errorMessage,\n      size = 'md',\n      variant = 'input',\n      ...props\n    },\n    ref\n  ) => {\n    const locale = useLocale()\n    const fieldId = useId()\n    // Composition guard: a stacked label makes this control two lines tall, so\n    // in a toolbar its inputs sit below the single-line controls beside them.\n    const inToolbar = useContext(FilterToolbarContext)\n    if (inToolbar && labelPlacement === 'top') {\n      warnUsage(\n        'DateRangePicker',\n        'stacked-label-in-toolbar',\n        'rendered inside a FilterBar with `labelPlacement=\"top\"` — the stacked label adds a line, leaving the inputs out of alignment with the single-line controls next to them. Use `labelPlacement=\"inside\"` (label becomes the placeholder) or `\"none\"`.'\n      )\n    }\n    const resolvedStartLabel = startLabel ?? locale.dateRangePicker.startLabel\n    const resolvedEndLabel = endLabel ?? locale.dateRangePicker.endLabel\n    const [internalRange, setInternalRange] = useState<DateRangeValue>(\n      () => defaultValue ?? { start: null, end: null }\n    )\n    // `value` (range object) wins over the legacy startDate/endDate pair,\n    // which in turn wins over the internal uncontrolled state.\n    const currentStart =\n      value !== undefined ? value.start : startDate !== undefined ? startDate : internalRange.start\n    const currentEnd =\n      value !== undefined ? value.end : endDate !== undefined ? endDate : internalRange.end\n\n    const [activeField, setActiveFieldRaw] = useState<ActiveField>(\n      defaultOpen && variant !== 'calendar' ? 'start' : null\n    )\n    const [startInputValue, setStartInputValue] = useState(\n      currentStart ? formatDate(currentStart, format) : ''\n    )\n    const [endInputValue, setEndInputValue] = useState(\n      currentEnd ? formatDate(currentEnd, format) : ''\n    )\n    const [viewDate, setViewDate] = useState(currentStart || currentEnd || new Date())\n    const containerRef = useRef<HTMLDivElement>(null)\n\n    // Which field the input-variant dropdown targets; a controlled `open`\n    // prop overrides whether the dropdown shows at all.\n    const effectiveActiveField: ActiveField =\n      openProp === undefined ? activeField : openProp ? (activeField ?? 'start') : null\n\n    const setActiveField = useCallback(\n      (field: ActiveField) => {\n        setActiveFieldRaw(field)\n        const wasOpen = effectiveActiveField !== null\n        const willOpen = field !== null\n        if (wasOpen !== willOpen) onOpenChange?.(willOpen)\n      },\n      [effectiveActiveField, onOpenChange]\n    )\n\n    // Calendar variant state\n    const [internalCalendarOpen, setInternalCalendarOpen] = useState(defaultOpen ?? false)\n    const calendarOpen = openProp ?? internalCalendarOpen\n    const setCalendarOpen = useCallback(\n      (next: boolean) => {\n        setInternalCalendarOpen(next)\n        if (next !== calendarOpen) onOpenChange?.(next)\n      },\n      [calendarOpen, onOpenChange]\n    )\n    const [calendarViewDate, setCalendarViewDate] = useState(currentStart || new Date())\n    const [calendarSelectionPhase, setCalendarSelectionPhase] = useState<'start' | 'end'>('start')\n    const [calendarPendingStart, setCalendarPendingStart] = useState<Date | null>(null)\n    const [calendarHoverDate, setCalendarHoverDate] = useState<Date | null>(null)\n\n    // Sync start input value with the current value\n    useEffect(() => {\n      if (currentStart) {\n        setStartInputValue(formatDate(currentStart, format))\n      } else {\n        setStartInputValue('')\n      }\n    }, [currentStart, format])\n\n    // Sync end input value with the current value\n    useEffect(() => {\n      if (currentEnd) {\n        setEndInputValue(formatDate(currentEnd, format))\n      } else {\n        setEndInputValue('')\n      }\n    }, [currentEnd, format])\n\n    // Update viewDate when the active field or dates change (input variant)\n    useEffect(() => {\n      if (effectiveActiveField === 'start' && currentStart) {\n        setViewDate(currentStart)\n      } else if (effectiveActiveField === 'end' && currentEnd) {\n        setViewDate(currentEnd)\n      }\n    }, [effectiveActiveField, currentStart, currentEnd])\n\n    // Close on click outside\n    useEffect(() => {\n      const handleClickOutside = (e: MouseEvent) => {\n        if (containerRef.current && !containerRef.current.contains(e.target as Node)) {\n          if (effectiveActiveField !== null) setActiveField(null)\n          if (calendarOpen) setCalendarOpen(false)\n        }\n      }\n\n      document.addEventListener('mousedown', handleClickOutside)\n      return () => document.removeEventListener('mousedown', handleClickOutside)\n    }, [effectiveActiveField, setActiveField, calendarOpen, setCalendarOpen])\n\n    /**\n     * Apply a partial range update: keeps the internal state in sync for\n     * uncontrolled usage and fires the legacy per-field callbacks alongside\n     * the range-level `onChange`.\n     */\n    const updateRange = (next: { start?: Date | null; end?: Date | null }) => {\n      const nextRange: DateRangeValue = {\n        start: next.start !== undefined ? next.start : (currentStart ?? null),\n        end: next.end !== undefined ? next.end : (currentEnd ?? null),\n      }\n      setInternalRange(nextRange)\n      if (next.start !== undefined) onStartChange?.(nextRange.start)\n      if (next.end !== undefined) onEndChange?.(nextRange.end)\n      onChange?.(nextRange)\n    }\n\n    const isDateDisabled = useCallback(\n      (date: Date, field: ActiveField): boolean => {\n        const d = stripTime(date)\n        if (minDate && d < stripTime(minDate)) return true\n        if (maxDate && d > stripTime(maxDate)) return true\n        // End date cannot be before start date\n        if (field === 'end' && currentStart && d < stripTime(currentStart)) return true\n        return false\n      },\n      [minDate, maxDate, currentStart]\n    )\n\n    // --- Input variant handlers ---\n\n    const handleStartInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n      const val = e.target.value\n      setStartInputValue(val)\n\n      const parsed = parseDate(val, format)\n      if (parsed && !isNaN(parsed.getTime()) && !isDateDisabled(parsed, 'start')) {\n        // If end date is now before start, clear it\n        const clearEnd = currentEnd && stripTime(currentEnd) < stripTime(parsed)\n        updateRange(clearEnd ? { start: parsed, end: null } : { start: parsed })\n        setViewDate(parsed)\n      }\n    }\n\n    const handleEndInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n      const val = e.target.value\n      setEndInputValue(val)\n\n      const parsed = parseDate(val, format)\n      if (parsed && !isNaN(parsed.getTime()) && !isDateDisabled(parsed, 'end')) {\n        updateRange({ end: parsed })\n        setViewDate(parsed)\n      }\n    }\n\n    const handleDateSelect = (day: number) => {\n      const newDate = new Date(viewDate.getFullYear(), viewDate.getMonth(), day)\n\n      if (effectiveActiveField === 'start') {\n        if (!isDateDisabled(newDate, 'start')) {\n          // If end date is now before the new start, clear it\n          const clearEnd = currentEnd && stripTime(currentEnd) < stripTime(newDate)\n          updateRange(clearEnd ? { start: newDate, end: null } : { start: newDate })\n          setActiveField('end')\n        }\n      } else if (effectiveActiveField === 'end') {\n        if (!isDateDisabled(newDate, 'end')) {\n          updateRange({ end: newDate })\n          setActiveField(null)\n        }\n      }\n    }\n\n    const handlePrevMonth = () => {\n      setViewDate(new Date(viewDate.getFullYear(), viewDate.getMonth() - 1, 1))\n    }\n\n    const handleNextMonth = () => {\n      setViewDate(new Date(viewDate.getFullYear(), viewDate.getMonth() + 1, 1))\n    }\n\n    const handleClear = () => {\n      updateRange({ start: null, end: null })\n      onClear?.()\n    }\n\n    const hasDates = currentStart || currentEnd\n\n    const renderCalendar = () => {\n      const year = viewDate.getFullYear()\n      const month = viewDate.getMonth()\n      const daysInMonth = getDaysInMonth(year, month)\n      const firstDay = getFirstDayOfMonth(year, month)\n      const today = new Date()\n\n      const days: (number | null)[] = []\n\n      for (let i = 0; i < firstDay; i++) {\n        days.push(null)\n      }\n\n      for (let i = 1; i <= daysInMonth; i++) {\n        days.push(i)\n      }\n\n      return (\n        <div className=\"w-64 p-3\">\n          {/* Header */}\n          <div className=\"mb-3 flex items-center justify-between\">\n            <button\n              type=\"button\"\n              onClick={handlePrevMonth}\n              aria-label={locale.calendar.previousMonth}\n              className=\"hover:bg-muted rounded p-1\"\n            >\n              <ChevronLeft className=\"h-4 w-4\" />\n            </button>\n            <span className=\"text-sm font-medium\">\n              {new Date(year, month).toLocaleDateString(locale.dateLocale, {\n                month: 'long',\n                year: 'numeric',\n              })}\n            </span>\n            <button\n              type=\"button\"\n              onClick={handleNextMonth}\n              aria-label={locale.calendar.nextMonth}\n              className=\"hover:bg-muted rounded p-1\"\n            >\n              <ChevronRight className=\"h-4 w-4\" />\n            </button>\n          </div>\n\n          {/* Day names */}\n          <div className=\"mb-2 grid grid-cols-7 gap-1\">\n            {locale.calendar.weekdaysShort.map((day) => (\n              <div\n                key={day}\n                className=\"text-muted-foreground flex h-8 items-center justify-center text-xs\"\n              >\n                {day}\n              </div>\n            ))}\n          </div>\n\n          {/* Days grid */}\n          <div className=\"grid grid-cols-7 gap-1\">\n            {days.map((day, index) => {\n              if (day === null) {\n                return <div key={index} className=\"h-8\" />\n              }\n\n              const date = new Date(year, month, day)\n              const dateStr = date.toDateString()\n              const isDisabledDay = isDateDisabled(date, effectiveActiveField)\n              const isStartSelected = currentStart?.toDateString() === dateStr\n              const isEndSelected = currentEnd?.toDateString() === dateStr\n              const isSelected = isStartSelected || isEndSelected\n              const isInRange =\n                currentStart &&\n                currentEnd &&\n                stripTime(date) > stripTime(currentStart) &&\n                stripTime(date) < stripTime(currentEnd)\n              const isToday = today.toDateString() === dateStr\n\n              return (\n                <button\n                  key={index}\n                  type=\"button\"\n                  disabled={isDisabledDay}\n                  onClick={() => handleDateSelect(day)}\n                  className={cn(\n                    'h-8 w-8 rounded-md text-sm transition-colors',\n                    'hover:bg-muted focus:ring-ring focus:ring-2 focus:outline-none',\n                    isSelected && 'bg-primary text-primary-foreground hover:bg-primary',\n                    isInRange && 'bg-primary/10',\n                    isToday && !isSelected && 'bg-muted',\n                    isDisabledDay && 'cursor-not-allowed opacity-50 hover:bg-transparent'\n                  )}\n                >\n                  {day}\n                </button>\n              )\n            })}\n          </div>\n\n          {/* Today button */}\n          <div className=\"mt-3 border-t pt-3\">\n            <button\n              type=\"button\"\n              onClick={() => {\n                const today = new Date()\n                if (!isDateDisabled(today, effectiveActiveField)) {\n                  handleDateSelect(today.getDate())\n                  setViewDate(today)\n                }\n              }}\n              className=\"text-primary w-full text-sm hover:underline\"\n            >\n              {locale.datePicker.today}\n            </button>\n          </div>\n        </div>\n      )\n    }\n\n    // --- Calendar variant handlers ---\n\n    const isCalendarDateDisabled = useCallback(\n      (date: Date): boolean => {\n        const d = stripTime(date)\n        if (minDate && d < stripTime(minDate)) return true\n        if (maxDate && d > stripTime(maxDate)) return true\n        // When selecting end date, cannot be before pending start\n        if (\n          calendarSelectionPhase === 'end' &&\n          calendarPendingStart &&\n          d < stripTime(calendarPendingStart)\n        )\n          return true\n        return false\n      },\n      [minDate, maxDate, calendarSelectionPhase, calendarPendingStart]\n    )\n\n    const handleCalendarToggle = () => {\n      if (disabled) return\n      if (!calendarOpen) {\n        // Reset selection phase when opening\n        setCalendarSelectionPhase('start')\n        setCalendarPendingStart(null)\n        setCalendarHoverDate(null)\n        setCalendarViewDate(currentStart || new Date())\n      }\n      setCalendarOpen(!calendarOpen)\n    }\n\n    const handleCalendarDateSelect = (date: Date) => {\n      if (isCalendarDateDisabled(date)) return\n\n      if (calendarSelectionPhase === 'start') {\n        setCalendarPendingStart(date)\n        // If existing end date is before new start, clear it\n        const clearEnd = currentEnd && stripTime(currentEnd) < stripTime(date)\n        updateRange(clearEnd ? { start: date, end: null } : { start: date })\n        setCalendarSelectionPhase('end')\n      } else {\n        // End date selection\n        updateRange({ end: date })\n        setCalendarPendingStart(null)\n        setCalendarHoverDate(null)\n        setCalendarSelectionPhase('start')\n        setCalendarOpen(false)\n      }\n    }\n\n    const handleCalendarPrevMonth = () => {\n      setCalendarViewDate(\n        new Date(calendarViewDate.getFullYear(), calendarViewDate.getMonth() - 1, 1)\n      )\n    }\n\n    const handleCalendarNextMonth = () => {\n      setCalendarViewDate(\n        new Date(calendarViewDate.getFullYear(), calendarViewDate.getMonth() + 1, 1)\n      )\n    }\n\n    const handleCalendarClear = () => {\n      updateRange({ start: null, end: null })\n      onClear?.()\n      setCalendarPendingStart(null)\n      setCalendarHoverDate(null)\n      setCalendarSelectionPhase('start')\n    }\n\n    const handleCalendarToday = () => {\n      const today = new Date()\n      const stripped = stripTime(today)\n      if (!isCalendarDateDisabled(stripped)) {\n        handleCalendarDateSelect(stripped)\n        setCalendarViewDate(stripped)\n      }\n    }\n\n    const renderDualMonthCalendar = () => {\n      const leftYear = calendarViewDate.getFullYear()\n      const leftMonth = calendarViewDate.getMonth()\n      const rightDate = new Date(leftYear, leftMonth + 1, 1)\n      const rightYear = rightDate.getFullYear()\n      const rightMonth = rightDate.getMonth()\n\n      const renderMonthGrid = (year: number, month: number) => {\n        const daysInMonth = getDaysInMonth(year, month)\n        const firstDay = getFirstDayOfMonth(year, month)\n        const today = new Date()\n\n        const days: (number | null)[] = []\n        for (let i = 0; i < firstDay; i++) {\n          days.push(null)\n        }\n        for (let i = 1; i <= daysInMonth; i++) {\n          days.push(i)\n        }\n\n        // Determine effective start/end for highlight\n        const effectiveStart = calendarPendingStart || currentStart\n        const effectiveEnd =\n          calendarSelectionPhase === 'end' && calendarHoverDate ? calendarHoverDate : currentEnd\n\n        return (\n          <div className=\"w-64 p-3\">\n            {/* Month title (no nav arrows, arrows are in the outer header) */}\n            <div className=\"mb-3 flex items-center justify-center\">\n              <span className=\"text-sm font-medium\">\n                {new Date(year, month).toLocaleDateString(locale.dateLocale, {\n                  month: 'long',\n                  year: 'numeric',\n                })}\n              </span>\n            </div>\n\n            {/* Day names */}\n            <div className=\"mb-2 grid grid-cols-7 gap-1\">\n              {locale.calendar.weekdaysShort.map((day) => (\n                <div\n                  key={day}\n                  className=\"text-muted-foreground flex h-8 items-center justify-center text-xs\"\n                >\n                  {day}\n                </div>\n              ))}\n            </div>\n\n            {/* Days grid */}\n            <div className=\"grid grid-cols-7 gap-1\">\n              {days.map((day, index) => {\n                if (day === null) {\n                  return <div key={index} className=\"h-8\" />\n                }\n\n                const date = new Date(year, month, day)\n                const dateStr = date.toDateString()\n                const isDisabledDay = isCalendarDateDisabled(date)\n                const isStartSelected = currentStart?.toDateString() === dateStr\n                const isEndSelected = currentEnd?.toDateString() === dateStr\n                const isPendingStart = calendarPendingStart?.toDateString() === dateStr\n                const isSelected = isStartSelected || isEndSelected || isPendingStart\n                const isToday = today.toDateString() === dateStr\n\n                // Range highlight\n                const d = stripTime(date)\n                const isInRange =\n                  effectiveStart &&\n                  effectiveEnd &&\n                  d > stripTime(effectiveStart) &&\n                  d < stripTime(effectiveEnd)\n\n                return (\n                  <button\n                    key={index}\n                    type=\"button\"\n                    disabled={isDisabledDay}\n                    onClick={() => handleCalendarDateSelect(date)}\n                    onMouseEnter={() => {\n                      if (calendarSelectionPhase === 'end') {\n                        setCalendarHoverDate(date)\n                      }\n                    }}\n                    className={cn(\n                      'h-8 w-8 rounded-md text-sm transition-colors',\n                      'hover:bg-muted focus:ring-ring focus:ring-2 focus:outline-none',\n                      isSelected && 'bg-primary text-primary-foreground hover:bg-primary',\n                      isInRange && 'bg-primary/10',\n                      isToday && !isSelected && 'bg-muted',\n                      isDisabledDay && 'cursor-not-allowed opacity-50 hover:bg-transparent'\n                    )}\n                  >\n                    {day}\n                  </button>\n                )\n              })}\n            </div>\n          </div>\n        )\n      }\n\n      return (\n        <div\n          className=\"bg-card absolute top-full left-0 z-50 mt-1 min-w-[540px] rounded-lg border shadow-lg\"\n          data-testid=\"calendar-popover\"\n        >\n          {/* Navigation header */}\n          <div className=\"flex items-center justify-between px-3 pt-3\">\n            <button\n              type=\"button\"\n              onClick={handleCalendarPrevMonth}\n              className=\"hover:bg-muted rounded p-1\"\n              aria-label={locale.calendar.previousMonth}\n            >\n              <ChevronLeft className=\"h-4 w-4\" />\n            </button>\n            <span className=\"text-muted-foreground text-sm font-medium\">\n              {calendarSelectionPhase === 'start'\n                ? locale.dateRangePicker.selectStart\n                : locale.dateRangePicker.selectEnd}\n            </span>\n            <button\n              type=\"button\"\n              onClick={handleCalendarNextMonth}\n              className=\"hover:bg-muted rounded p-1\"\n              aria-label={locale.calendar.nextMonth}\n            >\n              <ChevronRight className=\"h-4 w-4\" />\n            </button>\n          </div>\n\n          {/* Two calendars side by side */}\n          <div className=\"flex\">\n            {renderMonthGrid(leftYear, leftMonth)}\n            <div className=\"bg-border my-3 w-px\" />\n            {renderMonthGrid(rightYear, rightMonth)}\n          </div>\n\n          {/* Footer */}\n          <div className=\"mx-3 flex items-center justify-between border-t px-3 pt-1 pb-3\">\n            <button\n              type=\"button\"\n              onClick={handleCalendarToday}\n              className=\"text-primary text-sm hover:underline\"\n            >\n              {locale.datePicker.today}\n            </button>\n            <button\n              type=\"button\"\n              onClick={handleCalendarClear}\n              className=\"text-muted-foreground hover:text-foreground text-sm\"\n              aria-label={locale.dateRangePicker.clearDates}\n            >\n              {locale.dateRangePicker.clear}\n            </button>\n          </div>\n        </div>\n      )\n    }\n\n    // --- Calendar variant render ---\n\n    if (variant === 'calendar') {\n      const triggerText =\n        currentStart && currentEnd\n          ? `${formatDate(currentStart, format)} ~ ${formatDate(currentEnd, format)}`\n          : currentStart\n            ? `${formatDate(currentStart, format)} ~ ...`\n            : locale.dateRangePicker.selectRange\n\n      return (\n        <div\n          ref={(node) => {\n            ;(containerRef as React.MutableRefObject<HTMLDivElement | null>).current = node\n            if (typeof ref === 'function') {\n              ref(node)\n            } else if (ref) {\n              ;(ref as React.MutableRefObject<HTMLDivElement | null>).current = node\n            }\n          }}\n          className={cn('relative inline-block', className)}\n          {...props}\n        >\n          <button\n            type=\"button\"\n            onClick={handleCalendarToggle}\n            disabled={disabled}\n            data-testid=\"calendar-trigger\"\n            className={cn(\n              'border-input bg-background inline-flex items-center gap-2 rounded-md border',\n              triggerSizeStyles[size],\n              'ring-offset-background',\n              'focus-visible:border-primary focus-visible:ring-ring/30 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n              'disabled:cursor-not-allowed disabled:opacity-50',\n              error && 'border-destructive',\n              calendarOpen && 'ring-ring/40 ring-1 ring-offset-0',\n              !(currentStart && currentEnd) && 'text-muted-foreground'\n            )}\n          >\n            <CalendarIcon className={iconSizeStyles[size]} />\n            <span>{triggerText}</span>\n          </button>\n\n          {calendarOpen && renderDualMonthCalendar()}\n\n          {errorMessage && <p className=\"text-destructive mt-1.5 text-xs\">{errorMessage}</p>}\n        </div>\n      )\n    }\n\n    // --- Input variant render (original behavior) ---\n\n    const inputVariant = (\n      <div\n        ref={(node) => {\n          // Merge forwarded ref with internal ref\n          ;(containerRef as React.MutableRefObject<HTMLDivElement | null>).current = node\n          if (typeof ref === 'function') {\n            ref(node)\n          } else if (ref) {\n            ;(ref as React.MutableRefObject<HTMLDivElement | null>).current = node\n          }\n        }}\n        className={cn(\n          'relative inline-flex gap-2',\n          // items-end aligns the inputs when labels stack above them; without\n          // top labels every child is one row, so centre them instead.\n          labelPlacement === 'top' ? 'items-end' : 'items-center',\n          className\n        )}\n        {...props}\n      >\n        {/* Start date field */}\n        <div className=\"flex flex-col gap-1\">\n          {labelPlacement === 'top' && (\n            <label\n              htmlFor={`${fieldId}-start`}\n              className={cn('text-foreground font-medium', labelSizeStyles[size])}\n            >\n              {resolvedStartLabel}\n            </label>\n          )}\n          <div className=\"relative\">\n            <input\n              id={`${fieldId}-start`}\n              type=\"text\"\n              value={startInputValue}\n              onChange={handleStartInputChange}\n              onFocus={() => setActiveField('start')}\n              placeholder={labelPlacement === 'inside' ? resolvedStartLabel : format.toLowerCase()}\n              title={labelPlacement === 'inside' ? format.toLowerCase() : undefined}\n              // The visible label only names the input in 'top' mode; the other\n              // placements must carry the name themselves.\n              aria-label={labelPlacement === 'top' ? undefined : resolvedStartLabel}\n              disabled={disabled}\n              className={cn(\n                'border-input bg-background flex w-full rounded-md border',\n                inputSizeStyles[size],\n                'ring-offset-background placeholder:text-muted-foreground',\n                'focus-visible:border-primary focus-visible:ring-ring/30 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n                'disabled:cursor-not-allowed disabled:opacity-50',\n                error && 'border-destructive focus-visible:ring-destructive',\n                effectiveActiveField === 'start' && 'ring-ring/40 ring-1 ring-offset-0'\n              )}\n            />\n            <button\n              type=\"button\"\n              aria-label={locale.datePicker.openCalendar}\n              onClick={() =>\n                !disabled && setActiveField(effectiveActiveField === 'start' ? null : 'start')\n              }\n              className={cn(\n                'text-muted-foreground absolute top-1/2 right-3 -translate-y-1/2',\n                disabled && 'cursor-not-allowed'\n              )}\n            >\n              <CalendarIcon className={iconSizeStyles[size]} />\n            </button>\n          </div>\n        </div>\n\n        {/* Separator */}\n        <div\n          className={cn(\n            'text-muted-foreground flex shrink-0 items-center',\n            size === 'sm' && 'h-8',\n            size === 'md' && 'h-10',\n            size === 'lg' && 'h-12'\n          )}\n        >\n          <span className=\"px-1\">&mdash;</span>\n        </div>\n\n        {/* End date field */}\n        <div className=\"flex flex-col gap-1\">\n          {labelPlacement === 'top' && (\n            <label\n              htmlFor={`${fieldId}-end`}\n              className={cn('text-foreground font-medium', labelSizeStyles[size])}\n            >\n              {resolvedEndLabel}\n            </label>\n          )}\n          <div className=\"relative\">\n            <input\n              id={`${fieldId}-end`}\n              type=\"text\"\n              value={endInputValue}\n              onChange={handleEndInputChange}\n              onFocus={() => setActiveField('end')}\n              placeholder={labelPlacement === 'inside' ? resolvedEndLabel : format.toLowerCase()}\n              title={labelPlacement === 'inside' ? format.toLowerCase() : undefined}\n              aria-label={labelPlacement === 'top' ? undefined : resolvedEndLabel}\n              disabled={disabled}\n              className={cn(\n                'border-input bg-background flex w-full rounded-md border',\n                inputSizeStyles[size],\n                'ring-offset-background placeholder:text-muted-foreground',\n                'focus-visible:border-primary focus-visible:ring-ring/30 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n                'disabled:cursor-not-allowed disabled:opacity-50',\n                error && 'border-destructive focus-visible:ring-destructive',\n                effectiveActiveField === 'end' && 'ring-ring/40 ring-1 ring-offset-0'\n              )}\n            />\n            <button\n              type=\"button\"\n              aria-label={locale.datePicker.openCalendar}\n              onClick={() =>\n                !disabled && setActiveField(effectiveActiveField === 'end' ? null : 'end')\n              }\n              className={cn(\n                'text-muted-foreground absolute top-1/2 right-3 -translate-y-1/2',\n                disabled && 'cursor-not-allowed'\n              )}\n            >\n              <CalendarIcon className={iconSizeStyles[size]} />\n            </button>\n          </div>\n        </div>\n\n        {/* Clear button */}\n        {hasDates && !disabled && (\n          <button\n            type=\"button\"\n            onClick={handleClear}\n            className={cn(\n              'text-muted-foreground hover:text-foreground hover:bg-muted flex shrink-0 items-center justify-center rounded-md transition-colors',\n              size === 'sm' && 'h-8 w-8',\n              size === 'md' && 'h-10 w-10',\n              size === 'lg' && 'h-12 w-12'\n            )}\n            aria-label={locale.dateRangePicker.clearDates}\n          >\n            <X className={iconSizeStyles[size]} />\n          </button>\n        )}\n\n        {/* Calendar dropdown */}\n        {effectiveActiveField && (\n          <div className=\"bg-card absolute top-full left-0 z-50 mt-1 rounded-md border shadow-lg\">\n            {renderCalendar()}\n          </div>\n        )}\n      </div>\n    )\n\n    if (!errorMessage) {\n      return inputVariant\n    }\n\n    return (\n      <div className=\"inline-block\">\n        {inputVariant}\n        <p className=\"text-destructive mt-1.5 text-xs\">{errorMessage}</p>\n      </div>\n    )\n  }\n)\n\nDateRangePicker.displayName = 'DateRangePicker'\n","import { forwardRef, useCallback, useRef, useState, type ChangeEvent, type MouseEvent } from 'react'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\n\nexport type ColorPickerSize = 'sm' | 'md' | 'lg'\n\nexport interface ColorPickerProps {\n  /**\n   * Current hex color value (e.g. \"#ff0000\") for controlled usage.\n   * Provide either `value` (controlled) or `defaultValue` (uncontrolled);\n   * when neither is given the picker starts at `#000000`.\n   */\n  value?: string\n  /** Initial hex color value for uncontrolled usage */\n  defaultValue?: string\n  /** Callback fired when the color changes */\n  onChange?: (color: string) => void\n  /** Whether the picker is disabled */\n  disabled?: boolean\n  /** Size variant */\n  size?: ColorPickerSize\n  /** Error state */\n  error?: boolean\n  /** Error message */\n  errorMessage?: string\n  /** Additional class name for the root element */\n  className?: string\n  /** Optional preset color swatches */\n  presets?: string[]\n}\n\nconst sizeConfig: Record<\n  ColorPickerSize,\n  { swatch: string; input: string; text: string; preset: string }\n> = {\n  sm: {\n    swatch: 'h-8 w-8',\n    input: 'h-8 px-3 text-xs',\n    text: 'text-xs',\n    preset: 'h-5 w-5',\n  },\n  md: {\n    swatch: 'h-10 w-10',\n    input: 'h-10 px-3 text-sm',\n    text: 'text-sm',\n    preset: 'h-6 w-6',\n  },\n  lg: {\n    swatch: 'h-12 w-12',\n    input: 'h-12 px-4 text-base',\n    text: 'text-base',\n    preset: 'h-7 w-7',\n  },\n}\n\n/** Normalize a hex string: ensure # prefix and lowercase. */\nfunction normalizeHex(raw: string): string {\n  let hex = raw.trim().toLowerCase()\n  if (!hex.startsWith('#')) hex = `#${hex}`\n  return hex\n}\n\n/** Validate a hex color string (# + 3 or 6 hex chars). */\nfunction isValidHex(hex: string): boolean {\n  return /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(hex)\n}\n\n/** Expand shorthand hex (#abc -> #aabbcc) for the native color input. */\nfunction expandHex(hex: string): string {\n  if (/^#[0-9a-f]{3}$/i.test(hex)) {\n    const [, r, g, b] = hex\n    return `#${r}${r}${g}${g}${b}${b}`\n  }\n  return hex\n}\n\n/**\n * Color picker with a clickable swatch, native color input, hex text input,\n * and optional preset color swatches.\n */\nexport const ColorPicker = forwardRef<HTMLDivElement, ColorPickerProps>(\n  (\n    {\n      value,\n      defaultValue,\n      onChange,\n      disabled = false,\n      size = 'md',\n      error = false,\n      errorMessage,\n      className,\n      presets,\n    },\n    ref\n  ) => {\n    const locale = useLocale()\n    const nativeInputRef = useRef<HTMLInputElement>(null)\n    const cfg = sizeConfig[size]\n\n    const isControlled = value !== undefined\n    const [internalValue, setInternalValue] = useState(defaultValue ?? '#000000')\n    const currentValue = isControlled ? value : internalValue\n\n    const setValue = useCallback(\n      (color: string) => {\n        if (!isControlled) setInternalValue(color)\n        onChange?.(color)\n      },\n      [isControlled, onChange]\n    )\n\n    const openNativePicker = useCallback(\n      (e: MouseEvent) => {\n        e.preventDefault()\n        if (disabled) return\n        nativeInputRef.current?.click()\n      },\n      [disabled]\n    )\n\n    const handleNativeChange = useCallback(\n      (e: ChangeEvent<HTMLInputElement>) => {\n        setValue(e.target.value.toLowerCase())\n      },\n      [setValue]\n    )\n\n    const handleHexInput = useCallback(\n      (e: ChangeEvent<HTMLInputElement>) => {\n        const raw = e.target.value\n        const normalized = normalizeHex(raw)\n\n        // Always reflect what the user typed (normalized)\n        if (isValidHex(normalized)) {\n          setValue(normalized)\n        }\n      },\n      [setValue]\n    )\n\n    const handleHexBlur = useCallback(() => {\n      // On blur, ensure we have a valid value; if current text is invalid, reset\n      const normalized = normalizeHex(currentValue)\n      if (isValidHex(normalized) && normalized !== currentValue) {\n        setValue(normalized)\n      }\n    }, [currentValue, setValue])\n\n    const handlePresetClick = useCallback(\n      (color: string) => {\n        if (disabled) return\n        setValue(normalizeHex(color))\n      },\n      [disabled, setValue]\n    )\n\n    // Display value without # in the text input\n    const displayHex = currentValue.startsWith('#') ? currentValue.slice(1) : currentValue\n\n    return (\n      <div ref={ref} className={cn('inline-flex flex-col gap-2', className)}>\n        <div className=\"inline-flex items-center gap-2\">\n          {/* Color swatch — opens native picker on click */}\n          <button\n            type=\"button\"\n            disabled={disabled}\n            onClick={openNativePicker}\n            className={cn(\n              'shrink-0 rounded-md border transition-colors duration-200',\n              'focus-visible:ring-ring/40 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n              'disabled:cursor-not-allowed disabled:opacity-50',\n              error ? 'border-destructive' : 'border-input',\n              cfg.swatch\n            )}\n            style={{\n              backgroundColor: isValidHex(currentValue) ? expandHex(currentValue) : undefined,\n            }}\n            aria-label={locale.colorPicker.pickColor}\n          />\n\n          {/* Hidden native color input */}\n          <input\n            ref={nativeInputRef}\n            type=\"color\"\n            value={isValidHex(currentValue) ? expandHex(currentValue) : '#000000'}\n            onChange={handleNativeChange}\n            disabled={disabled}\n            className=\"sr-only\"\n            tabIndex={-1}\n            aria-hidden=\"true\"\n          />\n\n          {/* Hex text input */}\n          <div\n            className={cn(\n              'bg-background inline-flex items-center rounded-md border',\n              'transition-colors duration-200',\n              'focus-within:ring-ring/40 focus-within:ring-1 focus-within:ring-offset-0',\n              error ? 'border-destructive focus-within:ring-destructive' : 'border-input',\n              disabled && 'cursor-not-allowed opacity-50'\n            )}\n          >\n            <span className={cn('text-muted-foreground pl-3 font-mono select-none', cfg.text)}>\n              #\n            </span>\n            <input\n              type=\"text\"\n              value={displayHex}\n              onChange={handleHexInput}\n              onBlur={handleHexBlur}\n              disabled={disabled}\n              maxLength={6}\n              spellCheck={false}\n              autoComplete=\"off\"\n              className={cn(\n                'w-[6.5ch] border-0 bg-transparent font-mono uppercase',\n                'placeholder:text-muted-foreground',\n                'focus:outline-none',\n                'disabled:cursor-not-allowed',\n                cfg.input,\n                'pl-0'\n              )}\n              aria-label={locale.colorPicker.hexValue}\n            />\n          </div>\n        </div>\n\n        {/* Preset swatches */}\n        {presets && presets.length > 0 && (\n          <div\n            className=\"flex flex-wrap gap-1.5\"\n            role=\"group\"\n            aria-label={locale.colorPicker.presetColors}\n          >\n            {presets.map((color) => {\n              const normalized = normalizeHex(color)\n              const isActive =\n                normalizeHex(currentValue) === normalized ||\n                expandHex(normalizeHex(currentValue)) === expandHex(normalized)\n\n              return (\n                <button\n                  key={color}\n                  type=\"button\"\n                  disabled={disabled}\n                  onClick={() => handlePresetClick(color)}\n                  className={cn(\n                    'rounded-full border transition-all duration-150',\n                    'focus-visible:ring-ring/40 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n                    'hover:ring-ring hover:ring-2 hover:ring-offset-1',\n                    'disabled:cursor-not-allowed disabled:opacity-50',\n                    isActive ? 'ring-ring border-ring ring-2 ring-offset-1' : 'border-input',\n                    cfg.preset\n                  )}\n                  style={{\n                    backgroundColor: isValidHex(normalized) ? expandHex(normalized) : undefined,\n                  }}\n                  aria-label={locale.colorPicker.selectColor(normalized)}\n                />\n              )\n            })}\n          </div>\n        )}\n\n        {errorMessage && <p className=\"text-destructive text-xs\">{errorMessage}</p>}\n      </div>\n    )\n  }\n)\n\nColorPicker.displayName = 'ColorPicker'\n","import { forwardRef, useState, type ButtonHTMLAttributes, type ReactNode } from 'react'\nimport { cn } from '../../utils/cn'\nimport { Check, ChevronDown } from 'lucide-react'\nimport { Drawer } from '../drawer'\nimport { useLocale } from '../../locale'\n\nexport type SheetSelectSize = 'sm' | 'md' | 'lg'\n\nexport interface SheetSelectOption {\n  value: string\n  label: string\n  /** Secondary line shown under the label */\n  description?: string\n  disabled?: boolean\n}\n\nexport interface SheetSelectProps extends Omit<\n  ButtonHTMLAttributes<HTMLButtonElement>,\n  'onChange' | 'value' | 'defaultValue' | 'title'\n> {\n  /** Options list */\n  options: readonly SheetSelectOption[]\n  /** Selected value */\n  value?: string\n  /** Initial value for uncontrolled usage */\n  defaultValue?: string\n  /** Callback when an option is selected */\n  onChange?: (value: string) => void\n  /** Controlled open state of the sheet */\n  open?: boolean\n  /** Initial open state of the sheet for uncontrolled usage */\n  defaultOpen?: boolean\n  /** Called when the sheet opens or closes */\n  onOpenChange?: (open: boolean) => void\n  /** Placeholder text shown when nothing is selected */\n  placeholder?: string\n  /** Sheet header title */\n  title?: ReactNode\n  /** Disable the trigger */\n  disabled?: boolean\n  /** Error state */\n  error?: boolean\n  /** Error message */\n  errorMessage?: string\n  /** Trigger size */\n  size?: SheetSelectSize\n  /** Custom option renderer */\n  renderOption?: (option: SheetSelectOption, selected: boolean) => ReactNode\n  /**\n   * Class overrides for the parts SheetSelect renders itself. `className`\n   * stays on the trigger button; `classNames.sheet` reaches the bottom-sheet\n   * panel, which is otherwise unreachable from outside the component — use it\n   * instead of higher-specificity global CSS, which breaks silently on any\n   * markup change.\n   */\n  classNames?: {\n    trigger?: string\n    sheet?: string\n  }\n}\n\nconst sizeStyles: Record<SheetSelectSize, string> = {\n  sm: 'h-8 px-3 text-xs',\n  md: 'h-10 px-3 text-sm',\n  lg: 'h-12 px-4 text-base',\n}\n\nconst iconSizeStyles: Record<SheetSelectSize, string> = {\n  sm: 'h-3 w-3',\n  md: 'h-4 w-4',\n  lg: 'h-5 w-5',\n}\n\n/**\n * Mobile-friendly select that opens a bottom sheet with large touch targets\n * instead of a dropdown. Built on Drawer.\n */\nexport const SheetSelect = forwardRef<HTMLButtonElement, SheetSelectProps>(\n  (\n    {\n      className,\n      options,\n      value,\n      defaultValue,\n      onChange,\n      open: openProp,\n      defaultOpen,\n      onOpenChange,\n      placeholder,\n      title,\n      disabled = false,\n      error = false,\n      errorMessage,\n      size = 'md',\n      renderOption,\n      classNames,\n      ...props\n    },\n    ref\n  ) => {\n    const locale = useLocale()\n    const isValueControlled = value !== undefined\n    const [internalValue, setInternalValue] = useState<string | undefined>(defaultValue)\n    const currentValue = isValueControlled ? value : internalValue\n    const [internalOpen, setInternalOpen] = useState(defaultOpen ?? false)\n    const open = openProp ?? internalOpen\n    const selected = options.find((option) => option.value === currentValue)\n\n    const setOpenState = (next: boolean) => {\n      setInternalOpen(next)\n      if (next !== open) onOpenChange?.(next)\n    }\n\n    const handleSelect = (option: SheetSelectOption) => {\n      if (option.disabled) return\n      if (!isValueControlled) setInternalValue(option.value)\n      onChange?.(option.value)\n      setOpenState(false)\n    }\n\n    return (\n      <>\n        <button\n          ref={ref}\n          type=\"button\"\n          disabled={disabled}\n          onClick={() => setOpenState(true)}\n          aria-haspopup=\"listbox\"\n          aria-expanded={open}\n          className={cn(\n            'bg-background flex w-full items-center justify-between gap-2 rounded-md border text-left',\n            'focus-visible:border-primary focus-visible:ring-ring/30 focus-visible:ring-1 focus-visible:ring-offset-0 focus-visible:outline-none',\n            'disabled:cursor-not-allowed disabled:opacity-50',\n            'transition-colors duration-200',\n            sizeStyles[size],\n            error ? 'border-destructive focus-visible:ring-destructive' : 'border-input',\n            className,\n            classNames?.trigger\n          )}\n          {...props}\n        >\n          <span className={cn('truncate', !selected && 'text-muted-foreground')}>\n            {selected ? selected.label : (placeholder ?? locale.sheetSelect.placeholder)}\n          </span>\n          <ChevronDown className={cn('text-muted-foreground shrink-0', iconSizeStyles[size])} />\n        </button>\n        {errorMessage && <p className=\"text-destructive mt-1.5 text-xs\">{errorMessage}</p>}\n\n        <Drawer\n          open={open}\n          onClose={() => setOpenState(false)}\n          position=\"bottom\"\n          showCloseButton={false}\n          className={cn('h-auto max-h-[85dvh] rounded-t-2xl', classNames?.sheet)}\n        >\n          {/* Grab handle */}\n          <div\n            className=\"bg-muted-foreground/30 mx-auto mb-3 h-1.5 w-10 shrink-0 rounded-full\"\n            aria-hidden=\"true\"\n          />\n          {title && (\n            <div className=\"text-foreground mb-2 px-1 text-base font-semibold\">{title}</div>\n          )}\n          <div\n            role=\"listbox\"\n            aria-label={typeof title === 'string' ? title : undefined}\n            className=\"space-y-1\"\n          >\n            {options.map((option) => {\n              const isSelected = option.value === currentValue\n              return (\n                <button\n                  key={option.value}\n                  type=\"button\"\n                  role=\"option\"\n                  aria-selected={isSelected}\n                  disabled={option.disabled}\n                  onClick={() => handleSelect(option)}\n                  className={cn(\n                    'flex min-h-11 w-full items-center justify-between gap-3 rounded-md px-3 py-3 text-left text-sm',\n                    isSelected ? 'bg-muted text-foreground font-medium' : 'hover:bg-muted/50',\n                    option.disabled && 'cursor-not-allowed opacity-50 hover:bg-transparent'\n                  )}\n                >\n                  {renderOption ? (\n                    renderOption(option, isSelected)\n                  ) : (\n                    <span className=\"min-w-0\">\n                      <span className=\"block truncate\">{option.label}</span>\n                      {option.description && (\n                        <span className=\"text-muted-foreground block truncate text-xs\">\n                          {option.description}\n                        </span>\n                      )}\n                    </span>\n                  )}\n                  {isSelected && <Check className=\"text-primary h-4.5 w-4.5 shrink-0\" />}\n                </button>\n              )\n            })}\n          </div>\n        </Drawer>\n      </>\n    )\n  }\n)\n\nSheetSelect.displayName = 'SheetSelect'\n","import {\n  forwardRef,\n  useEffect,\n  useId,\n  useRef,\n  useState,\n  type HTMLAttributes,\n  type ReactNode,\n} from 'react'\nimport { createPortal } from 'react-dom'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\nimport { X } from 'lucide-react'\nimport { drawerPositionStyles } from './position-styles'\n\nexport type DrawerPosition = 'left' | 'right' | 'top' | 'bottom'\nexport type DrawerSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | 'full'\n\nexport interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n  /** Whether the drawer is open */\n  open: boolean\n  /** Callback when drawer should close */\n  onClose: () => void\n  /** Drawer position */\n  position?: DrawerPosition\n  /** Drawer size */\n  size?: DrawerSize\n  /** Drawer title */\n  title?: ReactNode\n  /** Drawer description */\n  description?: ReactNode\n  /** Show close button */\n  showCloseButton?: boolean\n  /** Close on backdrop click */\n  closeOnBackdropClick?: boolean\n  /** Close on escape key */\n  closeOnEscape?: boolean\n  /** Footer content */\n  footer?: ReactNode\n}\n\nconst sizeStyles: Record<DrawerPosition, Record<DrawerSize, string>> = {\n  left: {\n    sm: 'w-64',\n    md: 'w-80',\n    lg: 'w-96',\n    xl: 'w-[480px]',\n    '2xl': 'w-[600px]',\n    '3xl': 'w-[720px]',\n    '4xl': 'w-[900px]',\n    '5xl': 'w-[1024px]',\n    '6xl': 'w-[1200px]',\n    full: 'w-screen',\n  },\n  right: {\n    sm: 'w-64',\n    md: 'w-80',\n    lg: 'w-96',\n    xl: 'w-[480px]',\n    '2xl': 'w-[600px]',\n    '3xl': 'w-[720px]',\n    '4xl': 'w-[900px]',\n    '5xl': 'w-[1024px]',\n    '6xl': 'w-[1200px]',\n    full: 'w-screen',\n  },\n  top: {\n    sm: 'h-32',\n    md: 'h-48',\n    lg: 'h-64',\n    xl: 'h-96',\n    '2xl': 'h-[400px]',\n    '3xl': 'h-[500px]',\n    '4xl': 'h-[600px]',\n    '5xl': 'h-[700px]',\n    '6xl': 'h-[800px]',\n    full: 'h-screen',\n  },\n  bottom: {\n    sm: 'h-32',\n    md: 'h-48',\n    lg: 'h-64',\n    xl: 'h-96',\n    '2xl': 'h-[400px]',\n    '3xl': 'h-[500px]',\n    '4xl': 'h-[600px]',\n    '5xl': 'h-[700px]',\n    '6xl': 'h-[800px]',\n    full: 'h-screen',\n  },\n}\n\nconst translateStyles: Record<DrawerPosition, { open: string; closed: string }> = {\n  left: { open: 'translate-x-0', closed: '-translate-x-full' },\n  right: { open: 'translate-x-0', closed: 'translate-x-full' },\n  top: { open: 'translate-y-0', closed: '-translate-y-full' },\n  bottom: { open: 'translate-y-0', closed: 'translate-y-full' },\n}\n\n/**\n * Sliding panel overlay that opens from any edge of the viewport.\n *\n * **In context:** [Detail + Drawer Edit](https://ui.foson.co/storybook/?path=/docs/recipes-detail-drawer-edit--docs)\n */\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(\n  (\n    {\n      open,\n      onClose,\n      position = 'right',\n      size = 'md',\n      title,\n      description,\n      showCloseButton = true,\n      closeOnBackdropClick = true,\n      closeOnEscape = true,\n      footer,\n      children,\n      className,\n      ...props\n    },\n    ref\n  ) => {\n    const drawerRef = useRef<HTMLDivElement>(null)\n    const locale = useLocale()\n    const titleId = useId()\n    const descriptionId = useId()\n    const [isVisible, setIsVisible] = useState(false)\n    const [isAnimating, setIsAnimating] = useState(false)\n\n    // Handle mount/unmount with animation\n    useEffect(() => {\n      if (open) {\n        // Mount first, then animate in\n        setIsVisible(true)\n        // Use requestAnimationFrame to ensure DOM is ready before animating\n        requestAnimationFrame(() => {\n          requestAnimationFrame(() => {\n            setIsAnimating(true)\n          })\n        })\n      } else {\n        // Animate out first, then unmount\n        setIsAnimating(false)\n      }\n    }, [open])\n\n    // Handle unmount after animation completes\n    const handleTransitionEnd = () => {\n      if (!open) {\n        setIsVisible(false)\n      }\n    }\n\n    // Handle escape key\n    useEffect(() => {\n      if (!open || !closeOnEscape) return\n\n      const handleEscape = (e: KeyboardEvent) => {\n        if (e.key === 'Escape') {\n          onClose()\n        }\n      }\n\n      document.addEventListener('keydown', handleEscape)\n      return () => document.removeEventListener('keydown', handleEscape)\n    }, [open, closeOnEscape, onClose])\n\n    // Lock body scroll when drawer is open\n    useEffect(() => {\n      if (open) {\n        const originalOverflow = document.body.style.overflow\n        document.body.style.overflow = 'hidden'\n        return () => {\n          document.body.style.overflow = originalOverflow\n        }\n      }\n    }, [open])\n\n    // Focus trap\n    useEffect(() => {\n      if (!open || !isVisible) return\n\n      const drawer = drawerRef.current\n      if (!drawer) return\n\n      const previouslyFocused = document.activeElement as HTMLElement | null\n\n      const focusableElements = drawer.querySelectorAll(\n        'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n      )\n      const firstElement = focusableElements[0] as HTMLElement\n      const lastElement = focusableElements[focusableElements.length - 1] as HTMLElement\n\n      const handleTab = (e: KeyboardEvent) => {\n        if (e.key !== 'Tab') return\n\n        if (e.shiftKey) {\n          if (document.activeElement === firstElement) {\n            e.preventDefault()\n            lastElement?.focus()\n          }\n        } else {\n          if (document.activeElement === lastElement) {\n            e.preventDefault()\n            firstElement?.focus()\n          }\n        }\n      }\n\n      drawer.addEventListener('keydown', handleTab)\n      firstElement?.focus()\n\n      return () => {\n        drawer.removeEventListener('keydown', handleTab)\n        previouslyFocused?.focus?.()\n      }\n    }, [open, isVisible])\n\n    if (!isVisible) return null\n\n    const drawerContent = (\n      <div\n        className=\"fixed inset-0 z-50\"\n        role=\"dialog\"\n        aria-modal=\"true\"\n        aria-labelledby={title ? titleId : undefined}\n        aria-describedby={description ? descriptionId : undefined}\n      >\n        {/* Backdrop */}\n        <div\n          className={cn(\n            'fixed inset-0 bg-black/50 transition-opacity duration-300 ease-out',\n            isAnimating ? 'opacity-100' : 'opacity-0'\n          )}\n          onClick={closeOnBackdropClick ? onClose : undefined}\n          aria-hidden=\"true\"\n        />\n\n        {/* Drawer */}\n        <div\n          ref={(node) => {\n            ;(drawerRef as React.MutableRefObject<HTMLDivElement | null>).current = node\n            if (typeof ref === 'function') ref(node)\n            else if (ref) ref.current = node\n          }}\n          className={cn(\n            'bg-card fixed flex flex-col shadow-xl transition-transform duration-300 ease-out',\n            drawerPositionStyles[position],\n            sizeStyles[position][size],\n            isAnimating ? translateStyles[position].open : translateStyles[position].closed,\n            className\n          )}\n          onTransitionEnd={handleTransitionEnd}\n          {...props}\n        >\n          {/* Header */}\n          {(title || showCloseButton) && (\n            <div className=\"flex items-start justify-between gap-4 border-b p-4\">\n              <div className=\"space-y-1\">\n                {title && (\n                  <h2 id={titleId} className=\"text-lg leading-none font-semibold\">\n                    {title}\n                  </h2>\n                )}\n                {description && (\n                  <p id={descriptionId} className=\"text-muted-foreground text-sm\">\n                    {description}\n                  </p>\n                )}\n              </div>\n              {showCloseButton && (\n                <button\n                  onClick={onClose}\n                  className=\"text-muted-foreground hover:text-foreground focus:ring-ring shrink-0 rounded-md p-1 focus:ring-2 focus:outline-none\"\n                >\n                  <X className=\"h-5 w-5\" />\n                  <span className=\"sr-only\">{locale.drawer.close}</span>\n                </button>\n              )}\n            </div>\n          )}\n\n          {/* Body */}\n          <div className=\"flex-1 overflow-auto p-4\">{children}</div>\n\n          {/* Footer */}\n          {footer && (\n            <div className=\"flex items-center justify-end gap-2 border-t p-4\">{footer}</div>\n          )}\n        </div>\n      </div>\n    )\n\n    return createPortal(drawerContent, document.body)\n  }\n)\n\nDrawer.displayName = 'Drawer'\n\n// Convenience components for custom layouts\nexport type DrawerHeaderProps = HTMLAttributes<HTMLDivElement>\n\n/** Header section for a custom Drawer layout. */\nexport const DrawerHeader = forwardRef<HTMLDivElement, DrawerHeaderProps>(\n  ({ className, ...props }, ref) => (\n    <div ref={ref} className={cn('flex-shrink-0 border-b p-4', className)} {...props} />\n  )\n)\n\nDrawerHeader.displayName = 'DrawerHeader'\n\nexport type DrawerBodyProps = HTMLAttributes<HTMLDivElement>\n\n/** Scrollable body section for a custom Drawer layout. */\nexport const DrawerBody = forwardRef<HTMLDivElement, DrawerBodyProps>(\n  ({ className, ...props }, ref) => (\n    <div ref={ref} className={cn('flex-1 overflow-y-auto p-4', className)} {...props} />\n  )\n)\n\nDrawerBody.displayName = 'DrawerBody'\n\nexport type DrawerFooterProps = HTMLAttributes<HTMLDivElement>\n\n/** Footer section for a custom Drawer layout with right-aligned actions. */\nexport const DrawerFooter = forwardRef<HTMLDivElement, DrawerFooterProps>(\n  ({ className, ...props }, ref) => (\n    <div\n      ref={ref}\n      className={cn('flex flex-shrink-0 items-center justify-end gap-2 border-t p-4', className)}\n      {...props}\n    />\n  )\n)\n\nDrawerFooter.displayName = 'DrawerFooter'\n","import type { DrawerPosition } from './Drawer'\n\n/**\n * Edge anchoring plus the safe-area insets that edge can collide with.\n *\n * A landscape phone puts the notch on the *side*, so a bottom sheet needs\n * left/right insets just as much as a side drawer needs top/bottom ones —\n * handling only `bottom` leaves a clipped column on every rotated device.\n *\n * `env()` resolves to 0 without `viewport-fit=cover`, so this is a no-op on\n * desktop and on any app that has not opted into edge-to-edge rendering.\n * Insets are padding: the panel keeps its `sizeStyles` footprint (border-box)\n * and only its content moves inward.\n *\n * Internal — shared by Drawer and AnimatedDrawer so the two cannot drift.\n * Not re-exported from the barrel.\n */\nexport const drawerPositionStyles: Record<DrawerPosition, string> = {\n  left: 'inset-y-0 left-0 pl-[env(safe-area-inset-left)] pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]',\n  right:\n    'inset-y-0 right-0 pr-[env(safe-area-inset-right)] pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]',\n  top: 'inset-x-0 top-0 pt-[env(safe-area-inset-top)] pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)]',\n  bottom:\n    'inset-x-0 bottom-0 pb-[env(safe-area-inset-bottom)] pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)]',\n}\n","import { forwardRef, isValidElement, useEffect, useMemo, useState, type ReactNode } from 'react'\nimport { cn } from '../../utils/cn'\nimport { warnDeprecated } from '../../utils/deprecate'\nimport { X, CheckCircle2, AlertCircle, AlertTriangle, Info, Loader2 } from 'lucide-react'\nimport { useToastStore } from './toast-store'\nimport { toast as toastApi, type ToastFromErrorOptions, type ToastOptions } from './toast-api'\n\nexport type ToastVariant =\n  | 'default'\n  | 'success'\n  | 'warning'\n  | 'info'\n  | 'destructive'\n  /** @deprecated use `'destructive'` instead — removed in v1.0 */\n  | 'error'\n\ntype ResolvedToastVariant = Exclude<ToastVariant, 'error'>\nexport type ToastPosition =\n  | 'top-right'\n  | 'top-left'\n  | 'top-center'\n  | 'bottom-right'\n  | 'bottom-left'\n  | 'bottom-center'\n\nexport interface ToastData {\n  id: string\n  title?: ReactNode\n  description?: ReactNode\n  variant?: ToastVariant\n  duration?: number\n  action?: {\n    label: string\n    onClick: () => void\n  }\n  /** Show a loading spinner instead of the variant icon. */\n  isLoading?: boolean\n}\n\nexport { useToastStore }\n\nconst variantStyles: Record<ResolvedToastVariant, string> = {\n  default: 'bg-card border-border',\n  success: 'bg-success-soft border-success-border',\n  destructive: 'bg-destructive-soft border-destructive-border',\n  warning: 'bg-warning-soft border-warning-border',\n  info: 'bg-info-soft border-info-border',\n}\n\nconst variantTextStyles: Record<ResolvedToastVariant, string> = {\n  default: 'text-foreground',\n  success: 'text-success-soft-foreground',\n  destructive: 'text-destructive-soft-foreground',\n  warning: 'text-warning-soft-foreground',\n  info: 'text-info-soft-foreground',\n}\n\nconst iconMap: Record<ResolvedToastVariant, typeof Info | null> = {\n  default: null,\n  success: CheckCircle2,\n  destructive: AlertCircle,\n  warning: AlertTriangle,\n  info: Info,\n}\n\nconst positionStyles: Record<ToastPosition, string> = {\n  'top-right': 'top-4 right-4',\n  'top-left': 'top-4 left-4',\n  'top-center': 'top-4 left-1/2 -translate-x-1/2',\n  'bottom-right': 'bottom-4 right-4',\n  'bottom-left': 'bottom-4 left-4',\n  'bottom-center': 'bottom-4 left-1/2 -translate-x-1/2',\n}\n\nexport interface ToastProps extends ToastData {\n  onClose: () => void\n  className?: string\n}\n\n/** Individual toast notification with auto-dismiss and variant styling. */\nexport function Toast({\n  id: _id,\n  title,\n  description,\n  variant = 'default',\n  duration = 5000,\n  action,\n  isLoading,\n  onClose,\n  className,\n}: ToastProps) {\n  const [isExiting, setIsExiting] = useState(false)\n  if (variant === 'error') {\n    warnDeprecated('Toast', 'variant=\"error\"', 'variant=\"destructive\"')\n  }\n  const resolvedVariant: ResolvedToastVariant = variant === 'error' ? 'destructive' : variant\n  const IconComponent = isLoading ? null : iconMap[resolvedVariant]\n\n  useEffect(() => {\n    if (duration > 0) {\n      const timer = setTimeout(() => {\n        setIsExiting(true)\n        setTimeout(onClose, 200)\n      }, duration)\n      return () => clearTimeout(timer)\n    }\n  }, [duration, onClose])\n\n  const handleClose = () => {\n    setIsExiting(true)\n    setTimeout(onClose, 200)\n  }\n\n  return (\n    <div\n      role=\"alert\"\n      className={cn(\n        'pointer-events-auto flex w-full max-w-sm gap-3 rounded-lg border p-4 shadow-lg transition-all duration-200',\n        variantStyles[resolvedVariant],\n        variantTextStyles[resolvedVariant],\n        isExiting ? 'translate-x-2 opacity-0' : 'translate-x-0 opacity-100',\n        className\n      )}\n    >\n      {isLoading && (\n        <div className=\"shrink-0\">\n          <Loader2 className=\"h-5 w-5 animate-spin\" />\n        </div>\n      )}\n      {IconComponent && (\n        <div className=\"shrink-0\">\n          <IconComponent className=\"h-5 w-5\" />\n        </div>\n      )}\n      <div className=\"flex-1 space-y-1\">\n        {title && <p className=\"leading-none font-medium\">{title}</p>}\n        {description && <p className=\"text-sm opacity-90\">{description}</p>}\n        {action && (\n          <button\n            onClick={action.onClick}\n            className=\"mt-2 text-sm font-medium underline hover:no-underline\"\n          >\n            {action.label}\n          </button>\n        )}\n      </div>\n      <button\n        onClick={handleClose}\n        className=\"shrink-0 rounded-md p-1 opacity-70 hover:opacity-100\"\n      >\n        <X className=\"h-4 w-4\" />\n        <span className=\"sr-only\">Close</span>\n      </button>\n    </div>\n  )\n}\n\nexport interface ToastContainerProps {\n  position?: ToastPosition\n  className?: string\n}\n\n/** Fixed-position container that renders active toasts from the toast store. */\nexport const ToastContainer = forwardRef<HTMLDivElement, ToastContainerProps>(\n  function ToastContainer({ position = 'top-right', className }, ref) {\n    const { toasts, dismissToast } = useToastStore()\n\n    return (\n      <div\n        ref={ref}\n        className={cn(\n          'pointer-events-none fixed z-50 flex flex-col gap-2',\n          positionStyles[position],\n          className\n        )}\n      >\n        {toasts.map((toast) => (\n          <Toast key={toast.id} {...toast} onClose={() => dismissToast(toast.id)} />\n        ))}\n      </div>\n    )\n  }\n)\n\ntype ShorthandOptions = ToastOptions | ReactNode\n\n/**\n * Back-compat: `useToast().success(title, description)` (legacy) is treated as\n * `success(title, { description })` with a dev-only deprecation warning.\n */\nfunction resolveShorthandOptions(\n  method: string,\n  options?: ShorthandOptions\n): ToastOptions | undefined {\n  if (options == null) return undefined\n  if (typeof options === 'object' && !isValidElement(options) && !Array.isArray(options)) {\n    return options as ToastOptions\n  }\n  warnDeprecated('useToast', `${method}(title, description)`, `${method}(title, options)`)\n  return { description: options as ReactNode }\n}\n\n// Hook for using toasts — thin wrapper over the imperative `toast` API (same store)\nexport function useToast() {\n  const toast = useMemo(() => {\n    const t = Object.assign(\n      (options: Omit<ToastData, 'id'>) => useToastStore.getState().addToast(options),\n      {\n        show: (title: ReactNode, options?: ShorthandOptions) =>\n          toastApi.show(title, resolveShorthandOptions('show', options)),\n        success: (title: ReactNode, options?: ShorthandOptions) =>\n          toastApi.success(title, resolveShorthandOptions('success', options)),\n        error: (title: ReactNode, options?: ShorthandOptions) =>\n          toastApi.error(title, resolveShorthandOptions('error', options)),\n        warning: (title: ReactNode, options?: ShorthandOptions) =>\n          toastApi.warning(title, resolveShorthandOptions('warning', options)),\n        info: (title: ReactNode, options?: ShorthandOptions) =>\n          toastApi.info(title, resolveShorthandOptions('info', options)),\n        loading: (title: ReactNode, options?: ToastOptions) => toastApi.loading(title, options),\n        fromError: (err: unknown, options?: ToastFromErrorOptions) =>\n          toastApi.fromError(err, options),\n        dismiss: (id: string) => toastApi.dismiss(id),\n        dismissAll: () => toastApi.dismissAll(),\n        /** @deprecated Use `dismissAll()` instead — removed in v1.0. */\n        clear: () => {\n          warnDeprecated('useToast', 'clear()', 'dismissAll()')\n          toastApi.dismissAll()\n        },\n      }\n    )\n    return t\n  }, [])\n\n  return toast\n}\n","import { create } from 'zustand'\nimport type { ToastData } from './Toast'\n\n/** @deprecated Use `ToastData` instead — removed in v1.0. */\nexport type ToastItem = ToastData\n\ninterface ToastStoreState {\n  toasts: ToastData[]\n  addToast: (toast: Omit<ToastData, 'id'>) => string\n  dismissToast: (id: string) => void\n  dismissAllToasts: () => void\n  /** @deprecated Use `dismissToast` instead — removed in v1.0. */\n  removeToast: (id: string) => void\n  /** @deprecated Use `dismissAllToasts` instead — removed in v1.0. */\n  clearToasts: () => void\n}\n\nconst MAX_TOASTS = 5\n\n/** Single shared store behind both `useToast()` and the imperative `toast` API. */\nexport const useToastStore = create<ToastStoreState>((set, get) => ({\n  toasts: [],\n  addToast: (toast) => {\n    const id = crypto.randomUUID?.() ?? Math.random().toString(36).slice(2)\n    set((state) => {\n      const next = [...state.toasts, { ...toast, id }]\n      // Keep only the newest MAX_TOASTS, dismiss oldest when exceeding\n      if (next.length > MAX_TOASTS) {\n        return { toasts: next.slice(next.length - MAX_TOASTS) }\n      }\n      return { toasts: next }\n    })\n    return id\n  },\n  dismissToast: (id) =>\n    set((state) => ({\n      toasts: state.toasts.filter((t) => t.id !== id),\n    })),\n  dismissAllToasts: () => set({ toasts: [] }),\n  removeToast: (id) => get().dismissToast(id),\n  clearToasts: () => get().dismissAllToasts(),\n}))\n\n/** @deprecated Use `useToastStore` instead — removed in v1.0. */\nexport const useImperativeToastStore = useToastStore\n","import type { ReactNode } from 'react'\nimport { useToastStore } from './toast-store'\nimport type { ToastData } from './Toast'\n\nexport type ToastOptions = Partial<Omit<ToastData, 'id' | 'title' | 'variant'>>\n\nfunction show(title: ReactNode, options?: Partial<Omit<ToastData, 'id' | 'title'>>): string {\n  return useToastStore.getState().addToast({\n    variant: 'default',\n    title,\n    duration: 5000,\n    ...options,\n  })\n}\n\nfunction success(title: ReactNode, options?: ToastOptions): string {\n  return show(title, { ...options, variant: 'success' })\n}\n\nfunction error(title: ReactNode, options?: ToastOptions): string {\n  return show(title, { ...options, variant: 'destructive' })\n}\n\nfunction warning(title: ReactNode, options?: ToastOptions): string {\n  return show(title, { ...options, variant: 'warning' })\n}\n\nfunction info(title: ReactNode, options?: ToastOptions): string {\n  return show(title, { ...options, variant: 'info' })\n}\n\nfunction loading(title: ReactNode, options?: ToastOptions): string {\n  // Loading toasts show a spinner and stay until dismissed (duration can be overridden).\n  return show(title, { duration: 0, ...options, isLoading: true })\n}\n\nfunction dismiss(id: string): void {\n  useToastStore.getState().dismissToast(id)\n}\n\nfunction dismissAll(): void {\n  useToastStore.getState().dismissAllToasts()\n}\n\n// ── fromError ──────────────────────────────────────────────────────\n\nexport interface ToastConfig {\n  /**\n   * App-level error → message parser used by `toast.fromError`. This is where\n   * domain knowledge (API envelopes, axios shapes, i18n) belongs — the\n   * component library never parses domain errors itself. Must be pure: under\n   * SSR every request shares the same registration.\n   */\n  formatError?: (error: unknown) => ReactNode\n}\n\nlet toastConfig: ToastConfig = {}\n\n/**\n * One-time app-level wiring for `toast.fromError`. Call once at startup:\n *\n * ```ts\n * import { getErrorMessage } from '@arkite/utils' // or your own parser\n * toast.configure({ formatError: getErrorMessage })\n * ```\n *\n * Module-level by design: the imperative `toast` also runs outside React\n * (event handlers, stores), so configuration cannot live in a provider.\n */\nfunction configure(next: ToastConfig): void {\n  toastConfig = { ...toastConfig, ...next }\n}\n\nexport interface ToastFromErrorOptions extends ToastOptions {\n  /** Toast title (e.g. `'儲存失敗'`); the parsed error message becomes the description */\n  prefix?: ReactNode\n}\n\n/**\n * Derive a human-readable message without inventing copy: the registered\n * `formatError` first; otherwise only zero-knowledge JS-level fallbacks.\n * Returns `undefined` when nothing meaningful can be shown (e.g. a plain\n * object) — never locale strings, so this API stays out of the i18n system.\n */\nfunction deriveErrorMessage(error: unknown): ReactNode | undefined {\n  if (toastConfig.formatError) {\n    try {\n      const formatted = toastConfig.formatError(error)\n      if (formatted != null && formatted !== '') return formatted\n    } catch {\n      // A broken formatter must not turn error display into a second crash —\n      // fall through to the zero-knowledge fallbacks.\n    }\n  }\n  if (error instanceof Error && error.message !== '') return error.message\n  if (typeof error === 'string' && error !== '') return error\n  return undefined\n}\n\n/**\n * Error-to-toast shorthand for `catch` blocks:\n *\n * ```ts\n * catch (err) {\n *   toast.fromError(err, { prefix: '儲存失敗' })\n * }\n * ```\n *\n * Renders a destructive toast with `prefix` as the title and the parsed error\n * message as the description. Parsing is app-supplied via\n * `toast.configure({ formatError })`; unconfigured, only `Error#message` /\n * plain strings are used. When no message can be derived, the prefix alone is\n * shown (or `String(error)` if there is no prefix either).\n *\n * Deliberately out of scope (app-layer concerns, keep them there):\n * error reporting/logging hooks (Sentry, console) and burst dedupe.\n */\nfunction fromError(err: unknown, options?: ToastFromErrorOptions): string {\n  const { prefix, ...rest } = options ?? {}\n  const message = deriveErrorMessage(err)\n  if (prefix != null) {\n    return error(prefix, message == null ? rest : { description: message, ...rest })\n  }\n  return error(message ?? String(err), rest)\n}\n\nexport const toast = {\n  show,\n  success,\n  error,\n  warning,\n  info,\n  loading,\n  fromError,\n  configure,\n  dismiss,\n  dismissAll,\n}\n","import { forwardRef } from 'react'\nimport { warnDeprecated } from '../../utils/deprecate'\nimport { ToastContainer, type ToastContainerProps } from './Toast'\n\n/** @deprecated Use `ToastContainerProps` instead — removed in v1.0. */\nexport type ImperativeToastContainerProps = ToastContainerProps\n\n/**\n * @deprecated Use `ToastContainer` instead — removed in v1.0. Both containers\n * now render from the same store; this alias only exists for back-compat.\n */\nexport const ImperativeToastContainer = forwardRef<HTMLDivElement, ImperativeToastContainerProps>(\n  function ImperativeToastContainer(props, ref) {\n    warnDeprecated('ToastContainer', 'ImperativeToastContainer', 'ToastContainer')\n    return <ToastContainer ref={ref} {...props} />\n  }\n)\n","import {\n  forwardRef,\n  useEffect,\n  useId,\n  useRef,\n  type FormEventHandler,\n  type HTMLAttributes,\n  type ReactNode,\n} from 'react'\nimport { createPortal } from 'react-dom'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\nimport { X } from 'lucide-react'\n\nexport type ModalSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | 'full'\n\nexport interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'onSubmit'> {\n  /** Whether the modal is open */\n  open: boolean\n  /** Callback when modal should close */\n  onClose: () => void\n  /** Modal title */\n  title?: ReactNode\n  /** Modal description */\n  description?: ReactNode\n  /** Modal size */\n  size?: ModalSize\n  /** Show close button */\n  showCloseButton?: boolean\n  /** Close on backdrop click */\n  closeOnBackdropClick?: boolean\n  /** Close on escape key */\n  closeOnEscape?: boolean\n  /** Footer content */\n  footer?: ReactNode\n  /**\n   * Form dialogs: wraps header/body/footer in a `<form>` and fires on submit,\n   * so a `type=\"submit\"` button in `footer` submits the fields in `children`\n   * without `form=\"<id>\"` attribute plumbing. Call `e.preventDefault()`\n   * yourself (or use a server action) as with any React form.\n   */\n  onSubmit?: FormEventHandler<HTMLFormElement>\n}\n\nconst sizeStyles: Record<ModalSize, string> = {\n  sm: 'max-w-sm',\n  md: 'max-w-md',\n  lg: 'max-w-lg',\n  xl: 'max-w-xl',\n  '2xl': 'max-w-2xl',\n  '3xl': 'max-w-3xl',\n  '4xl': 'max-w-4xl',\n  full: 'max-w-[calc(100vw-2rem)] max-h-[calc(100vh-2rem)]',\n}\n\n/** Modal dialog overlay with title, description, and action footer. */\nexport const Modal = forwardRef<HTMLDivElement, ModalProps>(\n  (\n    {\n      open,\n      onClose,\n      title,\n      description,\n      size = 'md',\n      showCloseButton = true,\n      closeOnBackdropClick = true,\n      closeOnEscape = true,\n      footer,\n      onSubmit,\n      children,\n      className,\n      ...props\n    },\n    ref\n  ) => {\n    const modalRef = useRef<HTMLDivElement>(null)\n    const locale = useLocale()\n    const titleId = useId()\n    const descriptionId = useId()\n\n    // Handle escape key\n    useEffect(() => {\n      if (!open || !closeOnEscape) return\n\n      const handleEscape = (e: KeyboardEvent) => {\n        if (e.key === 'Escape') {\n          onClose()\n        }\n      }\n\n      document.addEventListener('keydown', handleEscape)\n      return () => document.removeEventListener('keydown', handleEscape)\n    }, [open, closeOnEscape, onClose])\n\n    // Lock body scroll when modal is open\n    useEffect(() => {\n      if (open) {\n        const originalOverflow = document.body.style.overflow\n        document.body.style.overflow = 'hidden'\n        return () => {\n          document.body.style.overflow = originalOverflow\n        }\n      }\n    }, [open])\n\n    // Focus trap\n    useEffect(() => {\n      if (!open) return\n\n      const modal = modalRef.current\n      if (!modal) return\n\n      const previouslyFocused = document.activeElement as HTMLElement | null\n\n      const focusableElements = modal.querySelectorAll(\n        'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n      )\n      const firstElement = focusableElements[0] as HTMLElement\n      const lastElement = focusableElements[focusableElements.length - 1] as HTMLElement\n\n      const handleTab = (e: KeyboardEvent) => {\n        if (e.key !== 'Tab') return\n\n        if (e.shiftKey) {\n          if (document.activeElement === firstElement) {\n            e.preventDefault()\n            lastElement?.focus()\n          }\n        } else {\n          if (document.activeElement === lastElement) {\n            e.preventDefault()\n            firstElement?.focus()\n          }\n        }\n      }\n\n      modal.addEventListener('keydown', handleTab)\n      firstElement?.focus()\n\n      return () => {\n        modal.removeEventListener('keydown', handleTab)\n        previouslyFocused?.focus?.()\n      }\n    }, [open])\n\n    if (!open) return null\n\n    const modalContent = (\n      <div\n        className=\"fixed inset-0 z-50 flex items-center justify-center p-4\"\n        role=\"dialog\"\n        aria-modal=\"true\"\n        aria-labelledby={title ? titleId : undefined}\n        aria-describedby={description ? descriptionId : undefined}\n      >\n        {/* Backdrop */}\n        <div\n          className=\"fixed inset-0 bg-black/50 backdrop-blur-sm transition-opacity\"\n          onClick={closeOnBackdropClick ? onClose : undefined}\n          aria-hidden=\"true\"\n        />\n\n        {/* Modal */}\n        <div\n          ref={(node) => {\n            ;(modalRef as React.MutableRefObject<HTMLDivElement | null>).current = node\n            if (typeof ref === 'function') ref(node)\n            else if (ref) ref.current = node\n          }}\n          className={cn(\n            'bg-card relative z-50 flex w-full flex-col rounded-lg shadow-xl',\n            // Hard height cap: without it, long content grows past the\n            // viewport while the body scroll-lock makes the page unscrollable\n            'max-h-[calc(100vh-2rem)]',\n            'animate-in fade-in-0 zoom-in-95 duration-200',\n            sizeStyles[size],\n            className\n          )}\n          {...props}\n        >\n          <PanelLayout onSubmit={onSubmit}>\n            {/* Header */}\n            {(title || showCloseButton) && (\n              <div className=\"flex shrink-0 items-start justify-between gap-4 border-b p-4\">\n                <div className=\"space-y-1\">\n                  {title && (\n                    <h2 id={titleId} className=\"text-lg leading-none font-semibold\">\n                      {title}\n                    </h2>\n                  )}\n                  {description && (\n                    <p id={descriptionId} className=\"text-muted-foreground text-sm\">\n                      {description}\n                    </p>\n                  )}\n                </div>\n                {showCloseButton && (\n                  <button\n                    onClick={onClose}\n                    className=\"text-muted-foreground hover:text-foreground focus:ring-ring shrink-0 rounded-md p-1 focus:ring-2 focus:outline-none\"\n                  >\n                    <X className=\"h-5 w-5\" />\n                    <span className=\"sr-only\">{locale.modal.close}</span>\n                  </button>\n                )}\n              </div>\n            )}\n\n            {/* Body — scrolls when the panel hits its height cap */}\n            <div className=\"min-h-0 flex-1 overflow-y-auto p-4\">{children}</div>\n\n            {/* Footer */}\n            {footer && (\n              <div className=\"flex shrink-0 items-center justify-end gap-2 border-t p-4\">\n                {footer}\n              </div>\n            )}\n          </PanelLayout>\n        </div>\n      </div>\n    )\n\n    return createPortal(modalContent, document.body)\n  }\n)\n\nModal.displayName = 'Modal'\n\n/**\n * With `onSubmit` the header/body/footer are wrapped in a real `<form>`, so a\n * `type=\"submit\"` button in `footer` submits the fields in `children` — no\n * `form=\"<id>\"` attribute plumbing needed for the most common admin dialog.\n */\nfunction PanelLayout({\n  onSubmit,\n  children,\n}: {\n  onSubmit?: FormEventHandler<HTMLFormElement>\n  children: ReactNode\n}) {\n  if (!onSubmit) return <>{children}</>\n  return (\n    <form onSubmit={onSubmit} className=\"flex min-h-0 flex-col\">\n      {children}\n    </form>\n  )\n}\n\n// Convenience components\nexport type ModalHeaderProps = HTMLAttributes<HTMLDivElement>\n\n/** Header section for a modal with border separator. */\nexport const ModalHeader = forwardRef<HTMLDivElement, ModalHeaderProps>(\n  ({ className, ...props }, ref) => (\n    <div ref={ref} className={cn('border-b p-4', className)} {...props} />\n  )\n)\n\nModalHeader.displayName = 'ModalHeader'\n\nexport type ModalBodyProps = HTMLAttributes<HTMLDivElement>\n\n/** Body content area of a modal. */\nexport const ModalBody = forwardRef<HTMLDivElement, ModalBodyProps>(\n  ({ className, ...props }, ref) => <div ref={ref} className={cn('p-4', className)} {...props} />\n)\n\nModalBody.displayName = 'ModalBody'\n\nexport type ModalFooterProps = HTMLAttributes<HTMLDivElement>\n\n/** Footer section of a modal, typically used for action buttons. */\nexport const ModalFooter = forwardRef<HTMLDivElement, ModalFooterProps>(\n  ({ className, ...props }, ref) => (\n    <div\n      ref={ref}\n      className={cn('flex items-center justify-end gap-2 border-t p-4', className)}\n      {...props}\n    />\n  )\n)\n\nModalFooter.displayName = 'ModalFooter'\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react'\nimport { cn } from '../../utils/cn'\nimport { warnDeprecated } from '../../utils/deprecate'\nimport { AlertCircle, CheckCircle2, Info, AlertTriangle, X } from 'lucide-react'\n\nexport type AlertVariant =\n  | 'info'\n  | 'success'\n  | 'warning'\n  | 'destructive'\n  /** @deprecated use `'destructive'` instead — removed in v1.0 */\n  | 'error'\n\ntype ResolvedAlertVariant = Exclude<AlertVariant, 'error'>\n\nexport interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n  /** Alert variant */\n  variant?: AlertVariant\n  /** Alert title */\n  title?: ReactNode\n  /** Show icon */\n  icon?: boolean\n  /** Custom icon */\n  customIcon?: ReactNode\n  /** Dismissible alert */\n  dismissible?: boolean\n  /** On close callback */\n  onClose?: () => void\n  /** @deprecated use `onClose` instead — removed in v1.0 */\n  onDismiss?: () => void\n}\n\nconst variantStyles: Record<ResolvedAlertVariant, string> = {\n  info: 'bg-info-soft border-info-border text-info-soft-foreground',\n  success: 'bg-success-soft border-success-border text-success-soft-foreground',\n  warning: 'bg-warning-soft border-warning-border text-warning-soft-foreground',\n  destructive: 'bg-destructive-soft border-destructive-border text-destructive-soft-foreground',\n}\n\nconst iconMap: Record<ResolvedAlertVariant, typeof Info> = {\n  info: Info,\n  success: CheckCircle2,\n  warning: AlertTriangle,\n  destructive: AlertCircle,\n}\n\n/** Contextual feedback message with variant-based styling, optional icon, and dismissible support. */\nexport const Alert = forwardRef<HTMLDivElement, AlertProps>(\n  (\n    {\n      className,\n      variant = 'info',\n      title,\n      icon = true,\n      customIcon,\n      dismissible = false,\n      onClose,\n      onDismiss,\n      children,\n      ...props\n    },\n    ref\n  ) => {\n    if (variant === 'error') {\n      warnDeprecated('Alert', 'variant=\"error\"', 'variant=\"destructive\"')\n    }\n    if (onDismiss) {\n      warnDeprecated('Alert', 'onDismiss', 'onClose')\n    }\n    const resolvedVariant: ResolvedAlertVariant = variant === 'error' ? 'destructive' : variant\n    const handleClose = onClose ?? onDismiss\n    const IconComponent = iconMap[resolvedVariant]\n\n    return (\n      <div\n        ref={ref}\n        role=\"alert\"\n        className={cn(\n          'relative flex gap-3 rounded-lg border p-4',\n          variantStyles[resolvedVariant],\n          className\n        )}\n        {...props}\n      >\n        {icon && (\n          <div className=\"shrink-0\">{customIcon || <IconComponent className=\"h-5 w-5\" />}</div>\n        )}\n        <div className=\"flex-1 space-y-1\">\n          {title && <p className=\"leading-none font-medium\">{title}</p>}\n          {children && <div className=\"text-sm opacity-90\">{children}</div>}\n        </div>\n        {dismissible && (\n          <button\n            type=\"button\"\n            onClick={handleClose}\n            className=\"shrink-0 rounded-md p-1 opacity-70 hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none\"\n          >\n            <X className=\"h-4 w-4\" />\n            <span className=\"sr-only\">Dismiss</span>\n          </button>\n        )}\n      </div>\n    )\n  }\n)\n\nAlert.displayName = 'Alert'\n","import { forwardRef, type HTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\nimport { warnDeprecated } from '../../utils/deprecate'\nimport { useLocale } from '../../locale'\n\nexport type ProgressSize = 'sm' | 'md' | 'lg'\nexport type ProgressVariant =\n  | 'default'\n  | 'success'\n  | 'warning'\n  | 'destructive'\n  /** @deprecated use `'destructive'` instead — removed in v1.0 */\n  | 'error'\n\ntype ResolvedProgressVariant = Exclude<ProgressVariant, 'error'>\n\nexport interface ProgressProps extends HTMLAttributes<HTMLDivElement> {\n  /** Progress value (0-100) */\n  value?: number\n  /** Maximum value */\n  max?: number\n  /** Progress size */\n  size?: ProgressSize\n  /** Progress variant */\n  variant?: ProgressVariant\n  /** Show percentage label */\n  showLabel?: boolean\n  /** Indeterminate progress (animated) */\n  indeterminate?: boolean\n  /** Striped style */\n  striped?: boolean\n  /** Animated stripes */\n  animated?: boolean\n  /** Accessible label for the progress bar */\n  'aria-label'?: string\n}\n\nconst sizeStyles: Record<ProgressSize, string> = {\n  sm: 'h-1',\n  md: 'h-2',\n  lg: 'h-3',\n}\n\nconst variantStyles: Record<ResolvedProgressVariant, string> = {\n  default: 'bg-primary',\n  success: 'bg-success',\n  warning: 'bg-warning',\n  destructive: 'bg-destructive',\n}\n\n/** Horizontal progress bar with determinate, indeterminate, and striped modes. */\nexport const Progress = forwardRef<HTMLDivElement, ProgressProps>(\n  (\n    {\n      className,\n      value = 0,\n      max = 100,\n      size = 'md',\n      variant = 'default',\n      showLabel = false,\n      indeterminate = false,\n      striped = false,\n      animated = false,\n      'aria-label': ariaLabel,\n      ...props\n    },\n    ref\n  ) => {\n    const locale = useLocale()\n    if (variant === 'error') {\n      warnDeprecated('Progress', 'variant=\"error\"', 'variant=\"destructive\"')\n    }\n    const resolvedVariant: ResolvedProgressVariant = variant === 'error' ? 'destructive' : variant\n    const percentage = Math.min(100, Math.max(0, (value / max) * 100))\n\n    return (\n      <div className={cn('w-full', className)}>\n        {showLabel && (\n          <div className=\"mb-1 flex justify-between text-sm\">\n            <span className=\"text-muted-foreground\">{locale.progress.label}</span>\n            <span className=\"font-medium\">{Math.round(percentage)}%</span>\n          </div>\n        )}\n        <div\n          ref={ref}\n          role=\"progressbar\"\n          aria-valuenow={indeterminate ? undefined : value}\n          aria-valuemin={0}\n          aria-valuemax={max}\n          aria-label={ariaLabel ?? locale.progress.label}\n          className={cn('bg-muted w-full overflow-hidden rounded-full', sizeStyles[size])}\n          {...props}\n        >\n          <div\n            className={cn(\n              'h-full rounded-full transition-all duration-300',\n              variantStyles[resolvedVariant],\n              indeterminate && 'animate-progress-indeterminate',\n              striped && 'bg-stripes',\n              animated && striped && 'animate-stripes'\n            )}\n            style={{\n              width: indeterminate ? '50%' : `${percentage}%`,\n            }}\n          />\n        </div>\n      </div>\n    )\n  }\n)\n\nProgress.displayName = 'Progress'\n\n// Circular Progress\nexport interface CircularProgressProps extends HTMLAttributes<HTMLDivElement> {\n  /** Progress value (0-100) */\n  value?: number\n  /** Maximum value */\n  max?: number\n  /** Diameter in pixels */\n  diameter?: number\n  /** @deprecated use `diameter` instead — removed in v1.0 */\n  size?: number\n  /** Stroke width */\n  strokeWidth?: number\n  /** Progress variant */\n  variant?: ProgressVariant\n  /** Show percentage label */\n  showLabel?: boolean\n  /** Indeterminate progress */\n  indeterminate?: boolean\n  /** Accessible label for the progress bar */\n  'aria-label'?: string\n}\n\n/** SVG-based circular progress indicator with optional percentage label. */\nexport const CircularProgress = forwardRef<HTMLDivElement, CircularProgressProps>(\n  (\n    {\n      className,\n      value = 0,\n      max = 100,\n      diameter,\n      size,\n      strokeWidth = 4,\n      variant = 'default',\n      showLabel = false,\n      indeterminate = false,\n      'aria-label': ariaLabel,\n      ...props\n    },\n    ref\n  ) => {\n    const locale = useLocale()\n    if (variant === 'error') {\n      warnDeprecated('CircularProgress', 'variant=\"error\"', 'variant=\"destructive\"')\n    }\n    if (size !== undefined) {\n      warnDeprecated('CircularProgress', 'size', 'diameter')\n    }\n    const resolvedVariant: ResolvedProgressVariant = variant === 'error' ? 'destructive' : variant\n    const resolvedDiameter = diameter ?? size ?? 48\n    const percentage = Math.min(100, Math.max(0, (value / max) * 100))\n    const radius = (resolvedDiameter - strokeWidth) / 2\n    const circumference = radius * 2 * Math.PI\n    const offset = circumference - (percentage / 100) * circumference\n\n    const strokeColor = {\n      default: 'stroke-primary',\n      success: 'stroke-success',\n      warning: 'stroke-warning',\n      destructive: 'stroke-destructive',\n    }[resolvedVariant]\n\n    return (\n      <div\n        ref={ref}\n        role=\"progressbar\"\n        aria-valuenow={indeterminate ? undefined : value}\n        aria-valuemin={0}\n        aria-valuemax={max}\n        aria-label={ariaLabel ?? locale.progress.label}\n        className={cn('relative inline-flex items-center justify-center', className)}\n        style={{ width: resolvedDiameter, height: resolvedDiameter }}\n        {...props}\n      >\n        <svg\n          className={cn('-rotate-90 transform', indeterminate && 'animate-spin')}\n          width={resolvedDiameter}\n          height={resolvedDiameter}\n        >\n          {/* Background circle */}\n          <circle\n            className=\"stroke-muted\"\n            fill=\"none\"\n            strokeWidth={strokeWidth}\n            r={radius}\n            cx={resolvedDiameter / 2}\n            cy={resolvedDiameter / 2}\n          />\n          {/* Progress circle */}\n          <circle\n            className={cn('transition-all duration-300', strokeColor)}\n            fill=\"none\"\n            strokeWidth={strokeWidth}\n            strokeLinecap=\"round\"\n            r={radius}\n            cx={resolvedDiameter / 2}\n            cy={resolvedDiameter / 2}\n            style={{\n              strokeDasharray: circumference,\n              strokeDashoffset: indeterminate ? circumference * 0.75 : offset,\n            }}\n          />\n        </svg>\n        {showLabel && !indeterminate && (\n          <span className=\"absolute text-xs font-medium\">{Math.round(percentage)}%</span>\n        )}\n      </div>\n    )\n  }\n)\n\nCircularProgress.displayName = 'CircularProgress'\n","import { forwardRef, type HTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {\n  /** Skeleton variant */\n  variant?: 'default' | 'circular' | 'rounded' | 'text'\n  /** Animation style */\n  animation?: 'pulse' | 'wave' | 'none'\n  /** Width */\n  width?: string | number\n  /** Height */\n  height?: string | number\n}\n\n/** Animated loading placeholder with pulse or wave animation. */\nexport const Skeleton = forwardRef<HTMLDivElement, SkeletonProps>(\n  (\n    { className, variant = 'default', animation = 'pulse', width, height, style, ...props },\n    ref\n  ) => {\n    const variantStyles = {\n      default: 'rounded-md',\n      circular: 'rounded-full',\n      rounded: 'rounded-lg',\n      text: 'rounded h-4',\n    }\n\n    const animationStyles = {\n      pulse: 'animate-pulse',\n      wave: 'animate-skeleton-wave',\n      none: '',\n    }\n\n    return (\n      <div\n        ref={ref}\n        className={cn('bg-muted', variantStyles[variant], animationStyles[animation], className)}\n        style={{\n          width: typeof width === 'number' ? `${width}px` : width,\n          height: typeof height === 'number' ? `${height}px` : height,\n          ...style,\n        }}\n        {...props}\n      />\n    )\n  }\n)\n\nSkeleton.displayName = 'Skeleton'\n\n// Pre-built skeleton patterns\nexport interface SkeletonTextProps extends Omit<SkeletonProps, 'variant'> {\n  /** Number of lines */\n  lines?: number\n  /** Line spacing */\n  spacing?: 'sm' | 'md' | 'lg'\n}\n\nconst spacingStyles = {\n  sm: 'space-y-1',\n  md: 'space-y-2',\n  lg: 'space-y-3',\n}\n\n/** Renders multiple skeleton lines to simulate a block of text. */\nexport const SkeletonText = forwardRef<HTMLDivElement, SkeletonTextProps>(\n  ({ lines = 3, spacing = 'md', className, ...props }, ref) => (\n    <div ref={ref} className={cn(spacingStyles[spacing], className)}>\n      {Array.from({ length: lines }).map((_, i) => (\n        <Skeleton\n          key={i}\n          variant=\"text\"\n          style={{\n            width: i === lines - 1 ? '60%' : '100%',\n          }}\n          {...props}\n        />\n      ))}\n    </div>\n  )\n)\n\nSkeletonText.displayName = 'SkeletonText'\n\nexport interface SkeletonAvatarProps extends Omit<SkeletonProps, 'variant'> {\n  /** Avatar size */\n  size?: 'sm' | 'md' | 'lg' | 'xl'\n}\n\nconst avatarSizes = {\n  sm: 'h-8 w-8',\n  md: 'h-10 w-10',\n  lg: 'h-12 w-12',\n  xl: 'h-16 w-16',\n}\n\n/** Circular skeleton placeholder for avatar loading states. */\nexport const SkeletonAvatar = forwardRef<HTMLDivElement, SkeletonAvatarProps>(\n  ({ size = 'md', className, ...props }, ref) => (\n    <Skeleton\n      ref={ref}\n      variant=\"circular\"\n      className={cn(avatarSizes[size], className)}\n      {...props}\n    />\n  )\n)\n\nSkeletonAvatar.displayName = 'SkeletonAvatar'\n\nexport interface SkeletonCardProps extends HTMLAttributes<HTMLDivElement> {\n  /** Show image placeholder */\n  showImage?: boolean\n  /** Show avatar */\n  showAvatar?: boolean\n  /** Number of text lines */\n  lines?: number\n}\n\n/** Card-shaped skeleton with optional image, avatar, and text placeholders. */\nexport const SkeletonCard = forwardRef<HTMLDivElement, SkeletonCardProps>(\n  ({ showImage = true, showAvatar = false, lines = 3, className, ...props }, ref) => (\n    <div ref={ref} className={cn('bg-card space-y-4 rounded-lg border p-4', className)} {...props}>\n      {showImage && <Skeleton className=\"h-32 w-full\" variant=\"rounded\" />}\n      {showAvatar && (\n        <div className=\"flex items-center gap-3\">\n          <SkeletonAvatar />\n          <div className=\"flex-1 space-y-2\">\n            <Skeleton className=\"h-4 w-1/2\" />\n            <Skeleton className=\"h-3 w-1/3\" />\n          </div>\n        </div>\n      )}\n      <SkeletonText lines={lines} />\n    </div>\n  )\n)\n\nSkeletonCard.displayName = 'SkeletonCard'\n\nexport interface SkeletonTableProps extends HTMLAttributes<HTMLDivElement> {\n  /** Number of rows */\n  rows?: number\n  /** Number of columns */\n  columns?: number\n  /**\n   * Per-column widths (px number or any CSS width). Match them to the real\n   * table's columns so the layout doesn't jump when content swaps in;\n   * unspecified columns stay fluid (`flex-1`).\n   */\n  columnWidths?: (string | number | undefined)[]\n}\n\n/** Table-shaped skeleton with configurable rows and columns. */\nexport const SkeletonTable = forwardRef<HTMLDivElement, SkeletonTableProps>(\n  ({ rows = 5, columns = 4, columnWidths, className, ...props }, ref) => {\n    const count = columnWidths?.length ?? columns\n    const cellProps = (i: number) =>\n      columnWidths?.[i] != null\n        ? { className: 'shrink-0', style: { width: columnWidths[i] } }\n        : { className: 'flex-1' }\n    return (\n      <div ref={ref} className={cn('space-y-3', className)} {...props}>\n        {/* Header */}\n        <div className=\"flex gap-4\">\n          {Array.from({ length: count }).map((_, i) => {\n            const p = cellProps(i)\n            return <Skeleton key={i} className={cn('h-4', p.className)} style={p.style} />\n          })}\n        </div>\n        {/* Rows */}\n        {Array.from({ length: rows }).map((_, rowIndex) => (\n          <div key={rowIndex} className=\"flex gap-4\">\n            {Array.from({ length: count }).map((_, colIndex) => {\n              const p = cellProps(colIndex)\n              return <Skeleton key={colIndex} className={cn('h-8', p.className)} style={p.style} />\n            })}\n          </div>\n        ))}\n      </div>\n    )\n  }\n)\n\nSkeletonTable.displayName = 'SkeletonTable'\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react'\nimport { cn } from '../../utils/cn'\nimport { Spinner } from '../spinner/Spinner'\nimport { warnDeprecated } from '../../utils/deprecate'\n\nexport interface LoadingOverlayProps extends HTMLAttributes<HTMLDivElement> {\n  /** Show the overlay */\n  open?: boolean\n  /** @deprecated use `open` instead — removed in v1.0 */\n  visible?: boolean\n  /** Custom spinner or content */\n  children?: ReactNode\n  /** Overlay background blur */\n  blur?: boolean\n  /** Cover the whole viewport (fixed inset-0, high z-index, backdrop blur) instead of the nearest positioned container */\n  fullscreen?: boolean\n  /** Spinner size */\n  size?: 'sm' | 'md' | 'lg'\n  /** Loading text below spinner */\n  label?: string\n}\n\n/** Semi-transparent overlay with a centered spinner. Wrap around any element to indicate loading. */\nexport const LoadingOverlay = forwardRef<HTMLDivElement, LoadingOverlayProps>(\n  (\n    {\n      className,\n      open,\n      visible,\n      blur = false,\n      fullscreen = false,\n      size = 'md',\n      label,\n      children,\n      ...props\n    },\n    ref\n  ) => {\n    if (open === undefined && visible !== undefined) {\n      warnDeprecated('LoadingOverlay', 'visible', 'open')\n    }\n    const isOpen = open ?? visible ?? true\n    if (!isOpen) return null\n\n    const content = children || (\n      <>\n        <Spinner size={size} />\n        {label && (\n          <p className={cn('text-muted-foreground text-sm', !fullscreen && 'mt-2')}>{label}</p>\n        )}\n      </>\n    )\n\n    return (\n      <div\n        ref={ref}\n        className={cn(\n          'flex flex-col items-center justify-center',\n          fullscreen ? 'fixed inset-0 z-50' : 'absolute inset-0 z-10',\n          'bg-background/60',\n          (blur || fullscreen) && 'backdrop-blur-sm',\n          className\n        )}\n        {...props}\n      >\n        {fullscreen ? (\n          <div className=\"bg-background flex flex-col items-center gap-3 rounded-lg border px-6 py-5 shadow-lg\">\n            {content}\n          </div>\n        ) : (\n          content\n        )}\n      </div>\n    )\n  }\n)\n\nLoadingOverlay.displayName = 'LoadingOverlay'\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport interface StepItem {\n  /** Step label */\n  label: string\n  /** Optional description */\n  description?: string\n  /** Optional icon */\n  icon?: ReactNode\n}\n\nexport type StepsStatus = 'complete' | 'current' | 'upcoming'\n\nexport interface StepsProps extends HTMLAttributes<HTMLDivElement> {\n  /** Step definitions */\n  steps: StepItem[]\n  /** Current step index (0-based) */\n  currentStep: number\n  /** Orientation */\n  orientation?: 'horizontal' | 'vertical'\n  /** Size */\n  size?: 'sm' | 'md'\n}\n\nfunction CheckIcon() {\n  return (\n    <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\">\n      <path\n        d=\"M11.6 3.7a.7.7 0 0 1 0 1l-5.6 5.6a.7.7 0 0 1-1 0l-2.8-2.8a.7.7 0 1 1 1-1L5.5 8.8l5.1-5.1a.7.7 0 0 1 1 0Z\"\n        fill=\"currentColor\"\n      />\n    </svg>\n  )\n}\n\n/** Multi-step progress indicator with horizontal or vertical orientation. */\nexport const Steps = forwardRef<HTMLDivElement, StepsProps>(\n  ({ steps, currentStep, orientation = 'horizontal', size = 'md', className, ...props }, ref) => {\n    const isVertical = orientation === 'vertical'\n\n    return (\n      <div\n        ref={ref}\n        className={cn('flex', isVertical ? 'flex-col gap-0' : 'items-center gap-0', className)}\n        {...props}\n      >\n        {steps.map((step, index) => {\n          const status: StepsStatus =\n            index < currentStep ? 'complete' : index === currentStep ? 'current' : 'upcoming'\n\n          const isLast = index === steps.length - 1\n          const dotSize = size === 'sm' ? 'h-7 w-7 text-xs' : 'h-9 w-9 text-sm'\n\n          return (\n            <div\n              key={index}\n              className={cn(\n                'flex',\n                isVertical ? 'flex-row gap-3' : 'flex-1 flex-col items-center gap-2'\n              )}\n            >\n              <div\n                className={cn('flex', isVertical ? 'flex-col items-center' : 'w-full items-center')}\n              >\n                {/* Dot */}\n                <div\n                  className={cn(\n                    'flex shrink-0 items-center justify-center rounded-full font-medium transition-colors',\n                    dotSize,\n                    status === 'complete' && 'bg-primary text-primary-foreground',\n                    status === 'current' && 'border-primary text-primary bg-background border-2',\n                    status === 'upcoming' &&\n                      'border-muted-foreground/30 text-muted-foreground bg-background border-2'\n                  )}\n                >\n                  {status === 'complete' ? (step.icon ?? <CheckIcon />) : (step.icon ?? index + 1)}\n                </div>\n\n                {/* Connector line */}\n                {!isLast && (\n                  <div\n                    className={cn(\n                      'transition-colors',\n                      isVertical ? 'mx-auto my-1 min-h-[24px] w-0.5 flex-1' : 'mx-2 h-0.5 flex-1',\n                      index < currentStep ? 'bg-primary' : 'bg-muted-foreground/20'\n                    )}\n                  />\n                )}\n              </div>\n\n              {/* Label */}\n              <div className={cn(isVertical ? 'pt-0.5 pb-4' : 'text-center')}>\n                <p\n                  className={cn(\n                    'text-sm leading-tight font-medium',\n                    status === 'upcoming' && 'text-muted-foreground'\n                  )}\n                >\n                  {step.label}\n                </p>\n                {step.description && (\n                  <p className=\"text-muted-foreground mt-0.5 text-xs\">{step.description}</p>\n                )}\n              </div>\n            </div>\n          )\n        })}\n      </div>\n    )\n  }\n)\n\nSteps.displayName = 'Steps'\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react'\nimport { cn } from '../../utils/cn'\nimport { warnDeprecated } from '../../utils/deprecate'\n\nexport type TimelineVariant =\n  | 'muted'\n  | 'primary'\n  | 'success'\n  | 'warning'\n  | 'destructive'\n  | 'info'\n  /** @deprecated use `'muted'` instead — removed in v1.0 */\n  | 'default'\n\nexport interface TimelineItem {\n  /** Timestamp or date label */\n  date?: string\n  /** Event title */\n  title: string\n  /** Event description */\n  description?: ReactNode\n  /** Custom icon */\n  icon?: ReactNode\n  /** Dot color variant (`'default'` is a deprecated alias for `'muted'`) */\n  variant?: TimelineVariant\n}\n\nexport interface TimelineProps extends HTMLAttributes<HTMLDivElement> {\n  /** Timeline items */\n  items: TimelineItem[]\n  /** Size */\n  size?: 'sm' | 'md'\n}\n\nconst variantStyles: Record<string, string> = {\n  muted: 'bg-muted-foreground',\n  primary: 'bg-primary',\n  success: 'bg-success',\n  warning: 'bg-warning',\n  destructive: 'bg-destructive',\n  info: 'bg-info',\n}\n\n/** Vertical timeline displaying a sequence of events with dots and connecting lines. */\nexport const Timeline = forwardRef<HTMLDivElement, TimelineProps>(\n  ({ items, size = 'md', className, ...props }, ref) => {\n    const dotSize = size === 'sm' ? 'h-2.5 w-2.5' : 'h-3 w-3'\n    const iconSize = size === 'sm' ? 'h-6 w-6' : 'h-8 w-8'\n\n    return (\n      <div ref={ref} className={cn('relative', className)} {...props}>\n        {items.map((item, index) => {\n          const isLast = index === items.length - 1\n          if (item.variant === 'default') {\n            warnDeprecated('Timeline', 'variant=\"default\"', 'variant=\"muted\"')\n          }\n          const variant = item.variant === 'default' ? 'muted' : (item.variant ?? 'muted')\n\n          return (\n            <div key={index} className=\"flex gap-4\">\n              {/* Left: dot + line */}\n              <div className=\"flex flex-col items-center\">\n                {item.icon ? (\n                  <div\n                    className={cn(\n                      'text-primary-foreground flex shrink-0 items-center justify-center rounded-full',\n                      iconSize,\n                      variantStyles[variant]\n                    )}\n                  >\n                    {item.icon}\n                  </div>\n                ) : (\n                  <div\n                    className={cn('mt-1.5 shrink-0 rounded-full', dotSize, variantStyles[variant])}\n                  />\n                )}\n                {!isLast && <div className=\"bg-border min-h-[16px] w-px flex-1\" />}\n              </div>\n\n              {/* Right: content */}\n              <div className={cn('pb-6', isLast && 'pb-0')}>\n                {item.date && <p className=\"text-muted-foreground mb-0.5 text-xs\">{item.date}</p>}\n                <p\n                  className={cn(\n                    'leading-tight font-medium',\n                    size === 'sm' ? 'text-sm' : 'text-base'\n                  )}\n                >\n                  {item.title}\n                </p>\n                {item.description && (\n                  <div className=\"text-muted-foreground mt-1 text-sm\">{item.description}</div>\n                )}\n              </div>\n            </div>\n          )\n        })}\n      </div>\n    )\n  }\n)\n\nTimeline.displayName = 'Timeline'\n","import { useState, useRef, useId, forwardRef, type HTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\nimport { useGridKeyboard, toDayKey } from './use-grid-keyboard'\n\nexport interface CalendarProps extends Omit<\n  HTMLAttributes<HTMLDivElement>,\n  'onSelect' | 'defaultValue'\n> {\n  /** Selected date */\n  value?: Date | null\n  /** Initial selected date for uncontrolled usage */\n  defaultValue?: Date\n  /** Callback when date is selected */\n  onSelect?: (date: Date) => void\n  /** Minimum selectable date */\n  minDate?: Date\n  /** Maximum selectable date */\n  maxDate?: Date\n  /** Highlighted dates (e.g. events) */\n  highlightedDates?: Date[]\n  /** Disabled dates */\n  disabledDates?: Date[]\n  /** First day of week (0=Sun, 1=Mon) */\n  weekStartsOn?: 0 | 1\n  /** Month to display (controlled) */\n  month?: Date\n  /** Initial month to display for uncontrolled usage */\n  defaultMonth?: Date\n  /** Callback when month changes */\n  onMonthChange?: (month: Date) => void\n}\n\nfunction isSameDay(a: Date, b: Date): boolean {\n  return (\n    a.getFullYear() === b.getFullYear() &&\n    a.getMonth() === b.getMonth() &&\n    a.getDate() === b.getDate()\n  )\n}\n\nfunction getDaysInMonth(year: number, month: number): number {\n  return new Date(year, month + 1, 0).getDate()\n}\n\nfunction ChevronLeftIcon() {\n  return (\n    <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\">\n      <path\n        d=\"M8.84182 3.13514C9.04327 3.32401 9.05348 3.64042 8.86462 3.84188L5.43521 7.49991L8.86462 11.1579C9.05348 11.3594 9.04327 11.6758 8.84182 11.8647C8.64036 12.0535 8.32394 12.0433 8.13508 11.8419L4.38508 7.84188C4.20477 7.64955 4.20477 7.35027 4.38508 7.15794L8.13508 3.15794C8.32394 2.95648 8.64036 2.94628 8.84182 3.13514Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n    </svg>\n  )\n}\n\nfunction ChevronRightIcon() {\n  return (\n    <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\">\n      <path\n        d=\"M6.15803 3.13514C5.95657 3.32401 5.94637 3.64042 6.13523 3.84188L9.56464 7.49991L6.13523 11.1579C5.94637 11.3594 5.95657 11.6758 6.15803 11.8647C6.35949 12.0535 6.67591 12.0433 6.86477 11.8419L10.6148 7.84188C10.7951 7.64955 10.7951 7.35027 10.6148 7.15794L6.86477 3.15794C6.67591 2.95648 6.35949 2.94628 6.15803 3.13514Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n    </svg>\n  )\n}\n\n/** Month-view date picker with selectable, highlighted, and disabled dates. */\nexport const Calendar = forwardRef<HTMLDivElement, CalendarProps>(\n  (\n    {\n      value,\n      defaultValue,\n      onSelect,\n      minDate,\n      maxDate,\n      highlightedDates = [],\n      disabledDates = [],\n      weekStartsOn = 0,\n      month: controlledMonth,\n      defaultMonth,\n      onMonthChange,\n      className,\n      ...props\n    },\n    ref\n  ) => {\n    const locale = useLocale()\n    const gridRef = useRef<HTMLDivElement>(null)\n    const monthLabelId = useId()\n    const isValueControlled = value !== undefined\n    const [internalValue, setInternalValue] = useState<Date | null>(defaultValue ?? null)\n    const currentValue = isValueControlled ? (value ?? null) : internalValue\n    const [uncontrolledMonth, setUncontrolledMonth] = useState(\n      () => defaultMonth ?? currentValue ?? new Date()\n    )\n\n    const currentMonth = controlledMonth ?? uncontrolledMonth\n    const setCurrentMonth = (date: Date) => {\n      setUncontrolledMonth(date)\n      onMonthChange?.(date)\n    }\n\n    const { handleDayKeyDown } = useGridKeyboard({\n      containerRef: gridRef,\n      currentMonth,\n      onNavigateToMonth: setCurrentMonth,\n      weekStartsOn,\n    })\n\n    const year = currentMonth.getFullYear()\n    const month = currentMonth.getMonth()\n    const today = new Date()\n\n    const weekdays =\n      weekStartsOn === 1\n        ? [...locale.calendar.weekdays.slice(1), locale.calendar.weekdays[0]]\n        : locale.calendar.weekdays\n    const daysInMonth = getDaysInMonth(year, month)\n    let firstDayOfWeek = new Date(year, month, 1).getDay()\n    if (weekStartsOn === 1) {\n      firstDayOfWeek = firstDayOfWeek === 0 ? 6 : firstDayOfWeek - 1\n    }\n\n    const days: (Date | null)[] = []\n    for (let i = 0; i < firstDayOfWeek; i++) {\n      days.push(null)\n    }\n    for (let d = 1; d <= daysInMonth; d++) {\n      days.push(new Date(year, month, d))\n    }\n    while (days.length % 7 !== 0) {\n      days.push(null)\n    }\n\n    const weeks: (Date | null)[][] = []\n    for (let i = 0; i < days.length; i += 7) {\n      weeks.push(days.slice(i, i + 7))\n    }\n\n    const isDisabled = (date: Date): boolean => {\n      if (minDate && date < minDate) return true\n      if (maxDate && date > maxDate) return true\n      return disabledDates.some((d) => isSameDay(d, date))\n    }\n\n    const isHighlighted = (date: Date): boolean => {\n      return highlightedDates.some((d) => isSameDay(d, date))\n    }\n\n    const goToPreviousMonth = () => {\n      setCurrentMonth(new Date(year, month - 1, 1))\n    }\n\n    const goToNextMonth = () => {\n      setCurrentMonth(new Date(year, month + 1, 1))\n    }\n\n    const monthLabel = currentMonth.toLocaleDateString(locale.dateLocale, {\n      month: 'long',\n      year: 'numeric',\n    })\n\n    return (\n      <div\n        ref={ref}\n        className={cn('bg-card w-[280px] rounded-lg border p-3', className)}\n        {...props}\n      >\n        {/* Header */}\n        <div className=\"mb-3 flex items-center justify-between\">\n          <button\n            type=\"button\"\n            onClick={goToPreviousMonth}\n            className=\"hover:bg-muted text-muted-foreground hover:text-foreground flex h-7 w-7 items-center justify-center rounded-md transition-colors\"\n            aria-label={locale.calendar.previousMonth}\n          >\n            <ChevronLeftIcon />\n          </button>\n          <span id={monthLabelId} className=\"text-sm font-medium\">\n            {monthLabel}\n          </span>\n          <button\n            type=\"button\"\n            onClick={goToNextMonth}\n            className=\"hover:bg-muted text-muted-foreground hover:text-foreground flex h-7 w-7 items-center justify-center rounded-md transition-colors\"\n            aria-label={locale.calendar.nextMonth}\n          >\n            <ChevronRightIcon />\n          </button>\n        </div>\n\n        {/* Weekday headers */}\n        <div className=\"mb-1 grid grid-cols-7\">\n          {weekdays.map((day) => (\n            <div key={day} className=\"text-muted-foreground py-1 text-center text-xs font-medium\">\n              {day}\n            </div>\n          ))}\n        </div>\n\n        {/* Days grid */}\n        <div ref={gridRef} role=\"grid\" aria-labelledby={monthLabelId}>\n          {weeks.map((week, weekIndex) => (\n            <div key={weekIndex} role=\"row\" className=\"grid grid-cols-7\">\n              {week.map((date, dayIndex) => {\n                if (!date) {\n                  return <div key={`empty-${dayIndex}`} role=\"gridcell\" />\n                }\n\n                const isSelected = currentValue ? isSameDay(date, currentValue) : false\n                const isToday = isSameDay(date, today)\n                const disabled = isDisabled(date)\n                const highlighted = isHighlighted(date)\n\n                return (\n                  <div\n                    key={date.toISOString()}\n                    role=\"gridcell\"\n                    aria-selected={isSelected || undefined}\n                  >\n                    <button\n                      type=\"button\"\n                      disabled={disabled}\n                      data-day={toDayKey(date)}\n                      onClick={() => {\n                        if (!isValueControlled) setInternalValue(date)\n                        onSelect?.(date)\n                      }}\n                      onKeyDown={(event) => handleDayKeyDown(event, date)}\n                      className={cn(\n                        'mx-auto flex h-8 w-8 items-center justify-center rounded-md text-sm transition-colors',\n                        'hover:bg-muted focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none',\n                        isSelected && 'bg-primary text-primary-foreground hover:bg-primary-hover',\n                        !isSelected && isToday && 'border-primary text-primary border font-medium',\n                        !isSelected && highlighted && 'bg-primary/10 text-foreground font-medium',\n                        disabled && 'pointer-events-none opacity-30'\n                      )}\n                    >\n                      {date.getDate()}\n                    </button>\n                  </div>\n                )\n              })}\n            </div>\n          ))}\n        </div>\n      </div>\n    )\n  }\n)\n\nCalendar.displayName = 'Calendar'\n","import {\n  Fragment,\n  forwardRef,\n  useState,\n  type HTMLAttributes,\n  type ReactNode,\n  type Ref,\n} from 'react'\nimport { cn } from '../../utils/cn'\nimport { Button, type ButtonVariant } from '../button/Button'\nimport {\n  DropdownMenu,\n  DropdownMenuTrigger,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuSeparator,\n} from '../dropdown-menu/DropdownMenu'\nimport { ConfirmDialog } from '../confirm-dialog/ConfirmDialog'\nimport { useLocale } from '../../locale'\n\nexport interface ActionItem {\n  /** Action key (for React key) */\n  key?: string\n  /** Display label */\n  label: string\n  /** Icon */\n  icon?: ReactNode\n  /** Button variant (inline mode) / destructive styling (dropdown mode) */\n  variant?: ButtonVariant\n  /** Show confirmation dialog before executing */\n  confirm?:\n    | boolean\n    | {\n        title?: string\n        description?: string\n        confirmLabel?: string\n      }\n  /** Click handler */\n  onClick: () => void | Promise<void>\n  /** Disabled state */\n  disabled?: boolean\n  /** Hide this action */\n  hidden?: boolean\n  /** Separator before this item (dropdown mode only) */\n  separator?: boolean\n}\n\nexport interface ActionButtonsProps extends HTMLAttributes<HTMLElement> {\n  /** Action definitions */\n  actions: ActionItem[]\n  /** Display mode */\n  mode?: 'inline' | 'dropdown'\n  /** Dropdown trigger label */\n  triggerLabel?: string\n  /** Dropdown trigger icon (overrides label) */\n  triggerIcon?: ReactNode\n  /** Button size for inline mode */\n  size?: 'sm' | 'md'\n  /** Additional class name */\n  className?: string\n}\n\nfunction MoreHorizontalIcon({ className }: { className?: string }) {\n  return (\n    <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\" className={className}>\n      <path\n        d=\"M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM13.625 7.5C13.625 8.12132 13.1213 8.625 12.5 8.625C11.8787 8.625 11.375 8.12132 11.375 7.5C11.375 6.87868 11.8787 6.375 12.5 6.375C13.1213 6.375 13.625 6.87868 13.625 7.5Z\"\n        fill=\"currentColor\"\n      />\n    </svg>\n  )\n}\n\n/** Renders a list of actions as inline buttons or a dropdown menu with optional confirmation dialogs. */\nexport const ActionButtons = forwardRef<HTMLElement, ActionButtonsProps>(function ActionButtons(\n  { actions, mode = 'dropdown', triggerLabel, triggerIcon, size = 'sm', className, ...rest },\n  ref\n) {\n  const locale = useLocale()\n  const [confirmAction, setConfirmAction] = useState<ActionItem | null>(null)\n  const [confirmLoading, setConfirmLoading] = useState(false)\n\n  const visibleActions = actions.filter((a) => !a.hidden)\n\n  const handleConfirm = async () => {\n    if (!confirmAction) return\n    setConfirmLoading(true)\n    try {\n      await confirmAction.onClick()\n    } finally {\n      setConfirmLoading(false)\n      setConfirmAction(null)\n    }\n  }\n\n  const handleAction = (action: ActionItem) => {\n    if (action.confirm) {\n      setConfirmAction(action)\n    } else {\n      action.onClick()\n    }\n  }\n\n  const confirmConfig = confirmAction?.confirm\n  const confirmTitle = typeof confirmConfig === 'object' ? confirmConfig.title : undefined\n  const confirmDescription =\n    typeof confirmConfig === 'object' ? confirmConfig.description : undefined\n  const confirmLabel = typeof confirmConfig === 'object' ? confirmConfig.confirmLabel : undefined\n  const isDestructiveAction = confirmAction?.variant === 'destructive'\n\n  const dialog = (\n    <ConfirmDialog\n      open={!!confirmAction}\n      onClose={() => setConfirmAction(null)}\n      variant={isDestructiveAction ? 'destructive' : 'default'}\n      title={confirmTitle ?? locale.confirmDialog.confirmTitle}\n      description={confirmDescription ?? locale.confirmDialog.confirmDescription}\n      confirmLabel={confirmLabel}\n      onConfirm={handleConfirm}\n      loading={confirmLoading}\n    />\n  )\n\n  if (mode === 'inline') {\n    return (\n      <>\n        <div\n          ref={ref as Ref<HTMLDivElement>}\n          className={cn('flex items-center gap-1', className)}\n          {...rest}\n        >\n          {visibleActions.map((action, index) => (\n            <Button\n              key={action.key ?? index}\n              variant={action.variant ?? 'ghost'}\n              size={size === 'sm' ? 'icon' : 'sm'}\n              onClick={() => handleAction(action)}\n              disabled={action.disabled}\n              className={size === 'sm' ? 'h-8 w-8' : undefined}\n              title={action.label}\n            >\n              {action.icon ?? action.label}\n            </Button>\n          ))}\n        </div>\n        {dialog}\n      </>\n    )\n  }\n\n  return (\n    <>\n      <DropdownMenu>\n        <DropdownMenuTrigger asChild>\n          <Button\n            ref={ref as Ref<HTMLButtonElement>}\n            variant=\"ghost\"\n            size=\"icon\"\n            className={cn('h-8 w-8', className)}\n            {...rest}\n          >\n            {triggerIcon ?? <MoreHorizontalIcon className=\"h-4 w-4\" />}\n            {triggerLabel && <span className=\"sr-only\">{triggerLabel}</span>}\n            {!triggerLabel && <span className=\"sr-only\">{locale.actionButtons.label}</span>}\n          </Button>\n        </DropdownMenuTrigger>\n        <DropdownMenuContent align=\"end\">\n          {visibleActions.map((action, index) => (\n            <Fragment key={action.key ?? index}>\n              {action.separator && index > 0 && <DropdownMenuSeparator />}\n              <DropdownMenuItem\n                onClick={() => handleAction(action)}\n                disabled={action.disabled}\n                destructive={action.variant === 'destructive'}\n              >\n                {action.icon && <span className=\"mr-2 h-4 w-4 shrink-0\">{action.icon}</span>}\n                {action.label}\n              </DropdownMenuItem>\n            </Fragment>\n          ))}\n        </DropdownMenuContent>\n      </DropdownMenu>\n      {dialog}\n    </>\n  )\n})\n","import { forwardRef, type ReactNode } from 'react'\nimport { Modal, type ModalSize } from '../modal/Modal'\nimport { Button } from '../button/Button'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\n\nexport interface ConfirmDialogProps {\n  /** Whether the dialog is open */\n  open: boolean\n  /** Callback when dialog should close */\n  onClose: () => void\n  /** Dialog variant */\n  variant?: 'default' | 'destructive' | 'warning'\n  /** Dialog title */\n  title: ReactNode\n  /** Dialog description */\n  description?: ReactNode\n  /** Confirm button label */\n  confirmLabel?: string\n  /** Cancel button label */\n  cancelLabel?: string\n  /** Confirm callback */\n  onConfirm: () => void\n  /** Loading state (disables buttons during async operation) */\n  loading?: boolean\n  /** Close on escape key (ignored while loading) */\n  closeOnEscape?: boolean\n  /** Close on backdrop click (ignored while loading) */\n  closeOnBackdropClick?: boolean\n  /** Modal size */\n  size?: ModalSize\n  /** Custom icon */\n  icon?: ReactNode\n  /** Additional class name applied to the dialog content */\n  className?: string\n}\n\nfunction WarningIcon({ className }: { className?: string }) {\n  return (\n    <svg\n      width=\"24\"\n      height=\"24\"\n      viewBox=\"0 0 24 24\"\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth=\"2\"\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n      className={className}\n    >\n      <path d=\"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z\" />\n      <line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\" />\n      <line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\" />\n    </svg>\n  )\n}\n\n/** Modal dialog prompting the user to confirm or cancel an action. */\nexport const ConfirmDialog = forwardRef<HTMLDivElement, ConfirmDialogProps>(\n  (\n    {\n      open,\n      onClose,\n      variant = 'default',\n      title,\n      description,\n      confirmLabel,\n      cancelLabel,\n      onConfirm,\n      loading = false,\n      closeOnEscape = true,\n      closeOnBackdropClick = true,\n      size = 'sm',\n      icon,\n      className,\n    },\n    ref\n  ) => {\n    const locale = useLocale()\n    const isDestructive = variant === 'destructive'\n    const isWarning = variant === 'warning'\n    const hasIcon = variant !== 'default'\n    const resolvedConfirmLabel =\n      confirmLabel ??\n      (isDestructive ? locale.confirmDialog.deleteLabel : locale.confirmDialog.confirmLabel)\n\n    return (\n      <Modal\n        ref={ref}\n        open={open}\n        onClose={onClose}\n        className={className}\n        size={size}\n        showCloseButton={false}\n        closeOnBackdropClick={closeOnBackdropClick && !loading}\n        closeOnEscape={closeOnEscape && !loading}\n      >\n        <div className=\"flex flex-col items-center gap-4 text-center sm:flex-row sm:items-start sm:text-left\">\n          {(icon || hasIcon) && (\n            <div\n              className={cn(\n                'flex h-10 w-10 shrink-0 items-center justify-center rounded-full',\n                isDestructive && 'bg-destructive/10 text-destructive',\n                isWarning && 'bg-warning/10 text-warning',\n                !isDestructive && !isWarning && 'bg-primary/10 text-primary'\n              )}\n            >\n              {icon ?? <WarningIcon className=\"h-5 w-5\" />}\n            </div>\n          )}\n          <div className=\"space-y-2\">\n            <h3 className=\"text-lg leading-none font-semibold\">{title}</h3>\n            {description && <p className=\"text-muted-foreground text-sm\">{description}</p>}\n          </div>\n        </div>\n        <div className=\"mt-6 flex justify-end gap-2\">\n          <Button variant=\"outline\" onClick={onClose} disabled={loading}>\n            {cancelLabel ?? locale.confirmDialog.cancelLabel}\n          </Button>\n          <Button\n            variant={isDestructive ? 'destructive' : 'primary'}\n            onClick={onConfirm}\n            loading={loading}\n          >\n            {resolvedConfirmLabel}\n          </Button>\n        </div>\n      </Modal>\n    )\n  }\n)\n\nConfirmDialog.displayName = 'ConfirmDialog'\n\n/* ─── Presets ─── */\n\nexport interface DeleteConfirmDialogProps extends Omit<\n  ConfirmDialogProps,\n  'variant' | 'title' | 'description' | 'confirmLabel'\n> {\n  /** Item name to display in the dialog (e.g. \"this user\") */\n  itemName?: string\n  /** Custom title (overrides preset) */\n  title?: ReactNode\n  /** Custom description (overrides preset) */\n  description?: ReactNode\n  /** Custom confirm label (overrides preset) */\n  confirmLabel?: string\n}\n\n/** Pre-configured destructive ConfirmDialog for delete operations. */\nexport const DeleteConfirmDialog = forwardRef<HTMLDivElement, DeleteConfirmDialogProps>(\n  ({ itemName, title, description, confirmLabel, ...props }, ref) => {\n    const locale = useLocale()\n    return (\n      <ConfirmDialog\n        ref={ref}\n        variant=\"destructive\"\n        title={\n          title ??\n          locale.confirmDialog.deleteTitle(itemName ?? locale.confirmDialog.deleteFallbackItem)\n        }\n        description={description ?? locale.confirmDialog.deleteDescription}\n        confirmLabel={confirmLabel ?? locale.confirmDialog.deleteLabel}\n        {...props}\n      />\n    )\n  }\n)\n\nDeleteConfirmDialog.displayName = 'DeleteConfirmDialog'\n","import { forwardRef, type HTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\nimport { warnDeprecated } from '../../utils/deprecate'\nimport { useLocale } from '../../locale'\nimport { Button } from '../button/Button'\n\nexport interface PaginationProps extends Omit<HTMLAttributes<HTMLElement>, 'onChange'> {\n  /** Current page (1-based) */\n  currentPage: number\n  /** Total number of pages */\n  totalPages: number\n  /** Page change callback */\n  onPageChange: (page: number) => void\n  /** Total items count (for info display) */\n  totalItems?: number\n  /** Items per page (for info display) */\n  pageSize?: number\n  /** Display variant */\n  variant?: 'compact' | 'full'\n  /** @deprecated use `variant` instead — removed in v1.0 */\n  mode?: 'compact' | 'full'\n  /** Show page size selector */\n  showPageSize?: boolean\n  /** Page size options */\n  pageSizeOptions?: number[]\n  /** Page size change callback */\n  onPageSizeChange?: (pageSize: number) => void\n  /** Number of page buttons to show around current page */\n  siblingCount?: number\n}\n\nfunction ChevronLeftIcon() {\n  return (\n    <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\">\n      <path\n        d=\"M8.84182 3.13514C9.04327 3.32401 9.05348 3.64042 8.86462 3.84188L5.43521 7.49991L8.86462 11.1579C9.05348 11.3594 9.04327 11.6758 8.84182 11.8647C8.64036 12.0535 8.32394 12.0433 8.13508 11.8419L4.38508 7.84188C4.20477 7.64955 4.20477 7.35027 4.38508 7.15794L8.13508 3.15794C8.32394 2.95648 8.64036 2.94628 8.84182 3.13514Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n    </svg>\n  )\n}\n\nfunction ChevronRightIcon() {\n  return (\n    <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\">\n      <path\n        d=\"M6.15803 3.13514C5.95657 3.32401 5.94637 3.64042 6.13523 3.84188L9.56464 7.49991L6.13523 11.1579C5.94637 11.3594 5.95657 11.6758 6.15803 11.8647C6.35949 12.0535 6.67591 12.0433 6.86477 11.8419L10.6148 7.84188C10.7951 7.64955 10.7951 7.35027 10.6148 7.15794L6.86477 3.15794C6.67591 2.95648 6.35949 2.94628 6.15803 3.13514Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n    </svg>\n  )\n}\n\nfunction ChevronsLeftIcon() {\n  return (\n    <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\">\n      <path\n        d=\"M6.84182 3.13514C7.04327 3.32401 7.05348 3.64042 6.86462 3.84188L3.43521 7.49991L6.86462 11.1579C7.05348 11.3594 7.04327 11.6758 6.84182 11.8647C6.64036 12.0535 6.32394 12.0433 6.13508 11.8419L2.38508 7.84188C2.20477 7.64955 2.20477 7.35027 2.38508 7.15794L6.13508 3.15794C6.32394 2.95648 6.64036 2.94628 6.84182 3.13514Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n      <path\n        d=\"M12.8418 3.13514C13.0433 3.32401 13.0535 3.64042 12.8646 3.84188L9.43521 7.49991L12.8646 11.1579C13.0535 11.3594 13.0433 11.6758 12.8418 11.8647C12.6404 12.0535 12.3239 12.0433 12.1351 11.8419L8.38508 7.84188C8.20477 7.64955 8.20477 7.35027 8.38508 7.15794L12.1351 3.15794C12.3239 2.95648 12.6404 2.94628 12.8418 3.13514Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n    </svg>\n  )\n}\n\nfunction ChevronsRightIcon() {\n  return (\n    <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\">\n      <path\n        d=\"M2.15803 3.13514C1.95657 3.32401 1.94637 3.64042 2.13523 3.84188L5.56464 7.49991L2.13523 11.1579C1.94637 11.3594 1.95657 11.6758 2.15803 11.8647C2.35949 12.0535 2.67591 12.0433 2.86477 11.8419L6.61477 7.84188C6.79508 7.64955 6.79508 7.35027 6.61477 7.15794L2.86477 3.15794C2.67591 2.95648 2.35949 2.94628 2.15803 3.13514Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n      <path\n        d=\"M8.15803 3.13514C7.95657 3.32401 7.94637 3.64042 8.13523 3.84188L11.5646 7.49991L8.13523 11.1579C7.94637 11.3594 7.95657 11.6758 8.15803 11.8647C8.35949 12.0535 8.67591 12.0433 8.86477 11.8419L12.6148 7.84188C12.7951 7.64955 12.7951 7.35027 12.6148 7.15794L8.86477 3.15794C8.67591 2.95648 8.35949 2.94628 8.15803 3.13514Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n    </svg>\n  )\n}\n\nfunction getPageRange(\n  currentPage: number,\n  totalPages: number,\n  siblingCount: number\n): (number | 'ellipsis')[] {\n  const totalButtons = siblingCount * 2 + 5 // siblings + first + last + current + 2 ellipsis\n  if (totalPages <= totalButtons) {\n    return Array.from({ length: totalPages }, (_, i) => i + 1)\n  }\n\n  const leftSibling = Math.max(currentPage - siblingCount, 2)\n  const rightSibling = Math.min(currentPage + siblingCount, totalPages - 1)\n\n  const showLeftEllipsis = leftSibling > 2\n  const showRightEllipsis = rightSibling < totalPages - 1\n\n  const pages: (number | 'ellipsis')[] = [1]\n\n  if (showLeftEllipsis) {\n    pages.push('ellipsis')\n  } else {\n    for (let i = 2; i < leftSibling; i++) pages.push(i)\n  }\n\n  for (let i = leftSibling; i <= rightSibling; i++) {\n    pages.push(i)\n  }\n\n  if (showRightEllipsis) {\n    pages.push('ellipsis')\n  } else {\n    for (let i = rightSibling + 1; i < totalPages; i++) pages.push(i)\n  }\n\n  pages.push(totalPages)\n  return pages\n}\n\n/** Page navigation control with page buttons, size selector, and item count display. */\nexport const Pagination = forwardRef<HTMLElement, PaginationProps>(\n  (\n    {\n      currentPage,\n      totalPages,\n      onPageChange,\n      totalItems,\n      pageSize,\n      variant,\n      mode,\n      showPageSize = false,\n      pageSizeOptions = [10, 20, 50, 100],\n      onPageSizeChange,\n      siblingCount = 1,\n      className,\n      ...props\n    },\n    ref\n  ) => {\n    if (mode && variant == null) {\n      warnDeprecated('Pagination', 'mode', 'variant')\n    }\n    // `variant` wins when both are provided\n    const resolvedVariant = variant ?? mode ?? 'full'\n\n    const locale = useLocale()\n    const canPrevious = currentPage > 1\n    const canNext = currentPage < totalPages\n\n    const info =\n      totalItems != null && pageSize != null\n        ? locale.pagination.rangeInfo(\n            (currentPage - 1) * pageSize + 1,\n            Math.min(currentPage * pageSize, totalItems),\n            totalItems\n          )\n        : `${currentPage} / ${totalPages}`\n\n    return (\n      <nav\n        ref={ref}\n        aria-label={locale.pagination.label}\n        className={cn('flex items-center justify-between', className)}\n        {...props}\n      >\n        {/* Left: page size + info */}\n        <div className=\"text-muted-foreground flex items-center gap-2 text-sm\">\n          {showPageSize && pageSize != null && onPageSizeChange && (\n            <>\n              <span>{locale.pagination.rowsPerPage}</span>\n              <select\n                value={pageSize}\n                onChange={(e) => onPageSizeChange(Number(e.target.value))}\n                className=\"border-input bg-background focus:ring-ring h-8 w-16 cursor-pointer rounded-md border px-2 text-sm focus:ring-2 focus:outline-none\"\n                aria-label={locale.pagination.rowsPerPage}\n              >\n                {pageSizeOptions.map((size) => (\n                  <option key={size} value={size}>\n                    {size}\n                  </option>\n                ))}\n              </select>\n            </>\n          )}\n          <span>{info}</span>\n        </div>\n\n        {/* Right: navigation */}\n        <div className=\"flex items-center gap-1\">\n          {resolvedVariant === 'full' && (\n            <Button\n              variant=\"outline\"\n              size=\"icon\"\n              className=\"h-8 w-8\"\n              onClick={() => onPageChange(1)}\n              disabled={!canPrevious}\n              aria-label={locale.pagination.firstPage}\n            >\n              <ChevronsLeftIcon />\n            </Button>\n          )}\n          <Button\n            variant=\"outline\"\n            size=\"icon\"\n            className=\"h-8 w-8\"\n            onClick={() => onPageChange(currentPage - 1)}\n            disabled={!canPrevious}\n            aria-label={locale.pagination.previousPage}\n          >\n            <ChevronLeftIcon />\n          </Button>\n\n          {resolvedVariant === 'full' && totalPages > 0 && (\n            <div className=\"flex items-center gap-1\">\n              {getPageRange(currentPage, totalPages, siblingCount).map((page, i) =>\n                page === 'ellipsis' ? (\n                  <span\n                    key={`ellipsis-${i}`}\n                    className=\"text-muted-foreground flex h-8 w-8 items-center justify-center text-sm\"\n                  >\n                    ...\n                  </span>\n                ) : (\n                  <Button\n                    key={page}\n                    variant={page === currentPage ? 'primary' : 'outline'}\n                    size=\"icon\"\n                    className=\"h-8 w-8\"\n                    onClick={() => onPageChange(page)}\n                    aria-label={locale.pagination.pageLabel(page)}\n                    aria-current={page === currentPage ? 'page' : undefined}\n                  >\n                    {page}\n                  </Button>\n                )\n              )}\n            </div>\n          )}\n\n          {resolvedVariant === 'compact' && (\n            <span className=\"flex h-8 min-w-[4rem] items-center justify-center text-sm\">\n              {currentPage} / {totalPages}\n            </span>\n          )}\n\n          <Button\n            variant=\"outline\"\n            size=\"icon\"\n            className=\"h-8 w-8\"\n            onClick={() => onPageChange(currentPage + 1)}\n            disabled={!canNext}\n            aria-label={locale.pagination.nextPage}\n          >\n            <ChevronRightIcon />\n          </Button>\n          {resolvedVariant === 'full' && (\n            <Button\n              variant=\"outline\"\n              size=\"icon\"\n              className=\"h-8 w-8\"\n              onClick={() => onPageChange(totalPages)}\n              disabled={!canNext}\n              aria-label={locale.pagination.lastPage}\n            >\n              <ChevronsRightIcon />\n            </Button>\n          )}\n        </div>\n      </nav>\n    )\n  }\n)\n\nPagination.displayName = 'Pagination'\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\n\nexport type PageHeaderSize = 'sm' | 'md' | 'lg'\n\nexport interface PageHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n  /** Page title */\n  title: ReactNode\n  /** Typography scale — `md` (default) matches the original rendering; `sm` for sub-pages, `lg` for dashboards / detail pages */\n  size?: PageHeaderSize\n  /** Optional description below the title */\n  description?: ReactNode\n  /** Actions slot (right side) */\n  actions?: ReactNode\n  /** Breadcrumb or back link slot (above title) */\n  breadcrumb?: ReactNode\n  /** Badge or status slot (next to title) */\n  badge?: ReactNode\n  /** Back button callback — renders a ← button before the title */\n  onBack?: () => void\n  /** Back button aria-label */\n  backLabel?: string\n}\n\nfunction ArrowLeftIcon() {\n  return (\n    <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\">\n      <path\n        d=\"M6.85355 3.14645C7.04882 3.34171 7.04882 3.65829 6.85355 3.85355L3.70711 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H3.70711L6.85355 11.1464C7.04882 11.3417 7.04882 11.6583 6.85355 11.8536C6.65829 12.0488 6.34171 12.0488 6.14645 11.8536L2.14645 7.85355C1.95118 7.65829 1.95118 7.34171 2.14645 7.14645L6.14645 3.14645C6.34171 2.95118 6.65829 2.95118 6.85355 3.14645Z\"\n        fill=\"currentColor\"\n        fillRule=\"evenodd\"\n        clipRule=\"evenodd\"\n      />\n    </svg>\n  )\n}\n\nconst sizeStyles: Record<PageHeaderSize, { title: string; description: string }> = {\n  sm: { title: 'text-xl', description: 'text-sm' },\n  md: { title: 'text-2xl', description: 'text-sm' },\n  lg: { title: 'text-3xl', description: 'text-base' },\n}\n\n/** Page header with title, description, breadcrumb, and action slots. */\nexport const PageHeader = forwardRef<HTMLDivElement, PageHeaderProps>(\n  (\n    {\n      title,\n      size = 'md',\n      description,\n      actions,\n      breadcrumb,\n      badge,\n      onBack,\n      backLabel,\n      className,\n      children,\n      ...props\n    },\n    ref\n  ) => {\n    const locale = useLocale()\n    return (\n      <div ref={ref} className={cn('space-y-1', className)} {...props}>\n        {breadcrumb && <div className=\"mb-2\">{breadcrumb}</div>}\n        <div className=\"flex items-start justify-between gap-4\">\n          <div className=\"space-y-1\">\n            <div className=\"flex items-center gap-3\">\n              {onBack && (\n                <button\n                  type=\"button\"\n                  onClick={onBack}\n                  className=\"text-muted-foreground hover:bg-secondary hover:text-foreground focus-visible:ring-ring inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md transition-colors focus-visible:ring-2 focus-visible:outline-none\"\n                  aria-label={backLabel ?? locale.pageHeader.back}\n                >\n                  <ArrowLeftIcon />\n                </button>\n              )}\n              <h1 className={cn(sizeStyles[size].title, 'font-bold tracking-tight')}>{title}</h1>\n              {badge}\n            </div>\n            {description && (\n              <p className={cn(sizeStyles[size].description, 'text-muted-foreground')}>\n                {description}\n              </p>\n            )}\n          </div>\n          {actions && <div className=\"flex shrink-0 items-center gap-2\">{actions}</div>}\n        </div>\n        {children}\n      </div>\n    )\n  }\n)\n\nPageHeader.displayName = 'PageHeader'\n","import { Component, type ErrorInfo, type ReactNode } from 'react'\nimport { cn } from '../../utils/cn'\nimport { Button } from '../button/Button'\nimport { useLocale } from '../../locale'\n\nexport interface ErrorBoundaryProps {\n  /** Content to render */\n  children: ReactNode\n  /** Custom fallback UI (receives error and reset function) */\n  fallback?: ReactNode | ((props: { error: Error; reset: () => void }) => ReactNode)\n  /** Error callback */\n  onError?: (error: Error, errorInfo: ErrorInfo) => void\n  /** Additional class name for default fallback */\n  className?: string\n}\n\ninterface ErrorBoundaryState {\n  error: Error | null\n}\n\n/** React error boundary that catches render errors and displays a fallback UI. */\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n  state: ErrorBoundaryState = { error: null }\n\n  static getDerivedStateFromError(error: Error): ErrorBoundaryState {\n    return { error }\n  }\n\n  componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n    this.props.onError?.(error, errorInfo)\n  }\n\n  reset = () => {\n    this.setState({ error: null })\n  }\n\n  render() {\n    const { error } = this.state\n    const { children, fallback, className } = this.props\n\n    if (!error) return children\n\n    if (typeof fallback === 'function') {\n      return fallback({ error, reset: this.reset })\n    }\n\n    if (fallback) return fallback\n\n    return <DefaultErrorFallback error={error} reset={this.reset} className={className} />\n  }\n}\n\n/** Default fallback UI — a function component so it can read the locale context. */\nfunction DefaultErrorFallback({\n  error,\n  reset,\n  className,\n}: {\n  error: Error\n  reset: () => void\n  className?: string\n}) {\n  const locale = useLocale()\n\n  return (\n    <div\n      className={cn(\n        'border-destructive/20 bg-destructive/5 flex flex-col items-center justify-center gap-4 rounded-lg border p-8 text-center',\n        className\n      )}\n      role=\"alert\"\n    >\n      <AlertTriangleIcon className=\"text-destructive h-10 w-10\" />\n      <div className=\"space-y-1\">\n        <h3 className=\"text-lg font-semibold\">{locale.emptyState.errorTitle}</h3>\n        <p className=\"text-muted-foreground max-w-md text-sm\">\n          {error.message || 'An unexpected error occurred.'}\n        </p>\n      </div>\n      <Button variant=\"outline\" onClick={reset}>\n        {locale.emptyState.retryLabel}\n      </Button>\n    </div>\n  )\n}\n\nfunction AlertTriangleIcon({ className }: { className?: string }) {\n  return (\n    <svg\n      width=\"24\"\n      height=\"24\"\n      viewBox=\"0 0 24 24\"\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth=\"2\"\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n      className={className}\n    >\n      <path d=\"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z\" />\n      <line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\" />\n      <line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\" />\n    </svg>\n  )\n}\n","import { forwardRef, type ReactNode, type HTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\n\nexport interface BulkActionBarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {\n  /** Number of selected items */\n  selectedCount: number\n  /** Left slot — typically displays selection count */\n  left?: ReactNode\n  /** Center slot — action buttons */\n  children?: ReactNode\n  /** Right slot — typically a close/deselect button */\n  right?: ReactNode\n  /** Called when close/deselect is clicked */\n  onClose?: () => void\n}\n\n/**\n * Floating overlay bar that appears at the bottom of the viewport\n * when rows are selected. Provides left / center / right slots\n * for count display, bulk actions, and close.\n *\n * Renders nothing when `selectedCount` is 0.\n *\n * **In context:** [CRUD List Page](https://ui.foson.co/storybook/?path=/docs/recipes-crud-list-page--docs)\n *\n * @example\n * ```tsx\n * <BulkActionBar\n *   selectedCount={selected.size}\n *   onClose={() => setSelected(new Set())}\n * >\n *   <Button size=\"sm\" variant=\"secondary\">Export</Button>\n *   <Button size=\"sm\" variant=\"destructive\">Delete</Button>\n * </BulkActionBar>\n * ```\n */\nexport const BulkActionBar = forwardRef<HTMLDivElement, BulkActionBarProps>(\n  ({ className, selectedCount, left, children, right, onClose, ...props }, ref) => {\n    const locale = useLocale()\n    if (selectedCount <= 0) return null\n\n    return (\n      <div\n        ref={ref}\n        role=\"toolbar\"\n        aria-label={locale.bulkActionBar.selected(selectedCount)}\n        className={cn(\n          'fixed bottom-6 left-1/2 z-50 -translate-x-1/2',\n          'bg-card flex items-center gap-4 rounded-lg border px-4 py-3 shadow-lg',\n          'animate-in fade-in slide-in-from-bottom-4 duration-200',\n          className\n        )}\n        {...props}\n      >\n        {/* Left: selection count */}\n        <div className=\"flex items-center gap-2 text-sm font-medium whitespace-nowrap\">\n          {left ?? <span>{locale.bulkActionBar.selected(selectedCount)}</span>}\n        </div>\n\n        {/* Center: action buttons */}\n        {children && <div className=\"flex items-center gap-2 border-l pl-4\">{children}</div>}\n\n        {/* Right: close / deselect */}\n        <div className=\"flex items-center border-l pl-4\">\n          {right ??\n            (onClose && (\n              <button\n                type=\"button\"\n                onClick={onClose}\n                className=\"text-muted-foreground hover:text-foreground inline-flex h-6 w-6 items-center justify-center rounded-md transition-colors\"\n                aria-label={locale.bulkActionBar.deselectAll}\n              >\n                <svg\n                  xmlns=\"http://www.w3.org/2000/svg\"\n                  width=\"16\"\n                  height=\"16\"\n                  viewBox=\"0 0 24 24\"\n                  fill=\"none\"\n                  stroke=\"currentColor\"\n                  strokeWidth=\"2\"\n                  strokeLinecap=\"round\"\n                  strokeLinejoin=\"round\"\n                >\n                  <path d=\"M18 6 6 18\" />\n                  <path d=\"m6 6 12 12\" />\n                </svg>\n              </button>\n            ))}\n        </div>\n      </div>\n    )\n  }\n)\n\nBulkActionBar.displayName = 'BulkActionBar'\n","import { forwardRef, type HTMLAttributes, type ReactNode } from 'react'\nimport { cn } from '../../utils/cn'\n\n// ---------------------------------------------------------------------------\n// CardField\n// ---------------------------------------------------------------------------\n\nexport interface CardFieldProps extends HTMLAttributes<HTMLDivElement> {\n  /** Field label displayed above the value. */\n  label: string\n  /** Field value rendered as text. Use `children` for custom rendering. */\n  value?: ReactNode\n  /** Custom content rendered instead of `value`. */\n  children?: ReactNode\n}\n\n/**\n * Label-value pair for detail pages.\n *\n * Renders a small muted label above the value. When neither `value` nor\n * `children` is provided, a dash placeholder is shown.\n */\nexport const CardField = forwardRef<HTMLDivElement, CardFieldProps>(\n  ({ className, label, value, children, ...props }, ref) => {\n    const content = children ?? value ?? '—'\n\n    return (\n      <div ref={ref} className={cn('space-y-1', className)} {...props}>\n        <p className=\"text-muted-foreground text-sm\">{label}</p>\n        <div className=\"text-foreground text-sm font-medium\">{content}</div>\n      </div>\n    )\n  }\n)\n\nCardField.displayName = 'CardField'\n\n// ---------------------------------------------------------------------------\n// CardGrid\n// ---------------------------------------------------------------------------\n\nexport interface CardGridProps extends HTMLAttributes<HTMLDivElement> {\n  /** Number of columns at `sm` breakpoint and above. Defaults to `2`. */\n  columns?: 1 | 2 | 3 | 4\n}\n\nconst columnStyles: Record<1 | 2 | 3 | 4, string> = {\n  1: 'sm:grid-cols-1',\n  2: 'sm:grid-cols-2',\n  3: 'sm:grid-cols-3',\n  4: 'sm:grid-cols-4',\n}\n\n/**\n * Responsive grid layout for `CardField` items.\n *\n * Always renders a single column on mobile and expands to the configured\n * number of columns at the `sm` breakpoint.\n */\nexport const CardGrid = forwardRef<HTMLDivElement, CardGridProps>(\n  ({ className, columns = 2, children, ...props }, ref) => {\n    return (\n      <div\n        ref={ref}\n        className={cn('grid grid-cols-1 gap-4', columnStyles[columns], className)}\n        {...props}\n      >\n        {children}\n      </div>\n    )\n  }\n)\n\nCardGrid.displayName = 'CardGrid'\n","import { createContext, forwardRef, useContext, type HTMLAttributes, type ReactNode } from 'react'\nimport { cn } from '../../utils/cn'\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst DescriptionListContext = createContext<{ divider: boolean }>({\n  divider: true,\n})\n\n// ---------------------------------------------------------------------------\n// DescriptionList\n// ---------------------------------------------------------------------------\n\nexport interface DescriptionListProps extends HTMLAttributes<HTMLDListElement> {\n  /** Show a bottom border separator between items. @default true */\n  divider?: boolean\n}\n\n/**\n * A definition list (`<dl>`) for horizontal label-value rows.\n *\n * Use `DescriptionItem` as direct children.\n * When `divider` is `true` (default), a border separates each item.\n */\nexport const DescriptionList = forwardRef<HTMLDListElement, DescriptionListProps>(\n  ({ className, divider = true, children, ...props }, ref) => {\n    return (\n      <DescriptionListContext.Provider value={{ divider }}>\n        <dl ref={ref} className={cn(className)} {...props}>\n          {children}\n        </dl>\n      </DescriptionListContext.Provider>\n    )\n  }\n)\n\nDescriptionList.displayName = 'DescriptionList'\n\n// ---------------------------------------------------------------------------\n// DescriptionItem\n// ---------------------------------------------------------------------------\n\nexport interface DescriptionItemProps extends HTMLAttributes<HTMLDivElement> {\n  /** Label displayed on the left side. */\n  label: string\n  /** Value rendered on the right side. Use `children` for custom rendering. */\n  value?: ReactNode\n  /** Custom content rendered instead of `value`. */\n  children?: ReactNode\n}\n\n/**\n * A single label-value row inside a `DescriptionList`.\n *\n * Renders a flex row with the label on the left and the value on the right.\n * When neither `value` nor `children` is provided, a dash placeholder is shown.\n */\nexport const DescriptionItem = forwardRef<HTMLDivElement, DescriptionItemProps>(\n  ({ className, label, value, children, ...props }, ref) => {\n    const { divider } = useContext(DescriptionListContext)\n    const content = children ?? value ?? '—'\n\n    return (\n      <div\n        ref={ref}\n        className={cn(\n          'flex items-baseline justify-between py-3',\n          divider && 'border-border border-b last:border-b-0',\n          className\n        )}\n        {...props}\n      >\n        <dt className=\"text-muted-foreground shrink-0 text-sm\">{label}</dt>\n        <dd className=\"text-foreground text-right text-sm font-medium\">{content}</dd>\n      </div>\n    )\n  }\n)\n\nDescriptionItem.displayName = 'DescriptionItem'\n","import { forwardRef, type HTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport type ContainerSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full'\n\nexport interface ContainerProps extends HTMLAttributes<HTMLDivElement> {\n  /** Maximum width */\n  size?: ContainerSize\n  /** Center content horizontally */\n  centered?: boolean\n  /** Add horizontal padding */\n  padded?: boolean\n}\n\nconst sizeStyles: Record<ContainerSize, string> = {\n  sm: 'max-w-screen-sm', // 640px\n  md: 'max-w-screen-md', // 768px\n  lg: 'max-w-screen-lg', // 1024px\n  xl: 'max-w-screen-xl', // 1280px\n  '2xl': 'max-w-screen-2xl', // 1536px\n  full: 'max-w-full',\n}\n\n/** Responsive container with configurable max-width and padding. */\nexport const Container = forwardRef<HTMLDivElement, ContainerProps>(\n  ({ className, size = 'xl', centered = true, padded = true, children, ...props }, ref) => {\n    return (\n      <div\n        ref={ref}\n        className={cn(\n          'w-full',\n          sizeStyles[size],\n          centered && 'mx-auto',\n          padded && 'px-4 sm:px-6 lg:px-8',\n          className\n        )}\n        {...props}\n      >\n        {children}\n      </div>\n    )\n  }\n)\n\nContainer.displayName = 'Container'\n","import { forwardRef, type HTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport type StackDirection = 'row' | 'column'\nexport type StackSpacing = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'\nexport type StackAlign = 'start' | 'center' | 'end' | 'stretch' | 'baseline'\nexport type StackJustify = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'\n\nexport interface StackProps extends HTMLAttributes<HTMLDivElement> {\n  /** Stack direction */\n  direction?: StackDirection\n  /** Gap between items */\n  spacing?: StackSpacing\n  /** Align items */\n  align?: StackAlign\n  /** Justify content */\n  justify?: StackJustify\n  /** Allow wrapping */\n  wrap?: boolean\n  /** Full width */\n  fullWidth?: boolean\n}\n\nconst spacingStyles: Record<StackSpacing, string> = {\n  none: 'gap-0',\n  xs: 'gap-1',\n  sm: 'gap-2',\n  md: 'gap-4',\n  lg: 'gap-6',\n  xl: 'gap-8',\n}\n\nconst alignStyles: Record<StackAlign, string> = {\n  start: 'items-start',\n  center: 'items-center',\n  end: 'items-end',\n  stretch: 'items-stretch',\n  baseline: 'items-baseline',\n}\n\nconst justifyStyles: Record<StackJustify, string> = {\n  start: 'justify-start',\n  center: 'justify-center',\n  end: 'justify-end',\n  between: 'justify-between',\n  around: 'justify-around',\n  evenly: 'justify-evenly',\n}\n\n/** Flexbox layout component for arranging children with consistent spacing. */\nexport const Stack = forwardRef<HTMLDivElement, StackProps>(\n  (\n    {\n      className,\n      direction = 'column',\n      spacing = 'md',\n      align = 'stretch',\n      justify = 'start',\n      wrap = false,\n      fullWidth = false,\n      children,\n      ...props\n    },\n    ref\n  ) => {\n    return (\n      <div\n        ref={ref}\n        className={cn(\n          'flex',\n          direction === 'row' ? 'flex-row' : 'flex-col',\n          spacingStyles[spacing],\n          alignStyles[align],\n          justifyStyles[justify],\n          wrap && 'flex-wrap',\n          fullWidth && 'w-full',\n          className\n        )}\n        {...props}\n      >\n        {children}\n      </div>\n    )\n  }\n)\n\nStack.displayName = 'Stack'\n\n// Convenience components\n/** Horizontal stack that arranges children in a row. */\nexport const HStack = forwardRef<HTMLDivElement, Omit<StackProps, 'direction'>>((props, ref) => (\n  <Stack ref={ref} direction=\"row\" {...props} />\n))\n\nHStack.displayName = 'HStack'\n\n/** Vertical stack that arranges children in a column. */\nexport const VStack = forwardRef<HTMLDivElement, Omit<StackProps, 'direction'>>((props, ref) => (\n  <Stack ref={ref} direction=\"column\" {...props} />\n))\n\nVStack.displayName = 'VStack'\n","import { forwardRef, type HTMLAttributes } from 'react'\nimport { cn } from '../../utils/cn'\n\nexport type DividerOrientation = 'horizontal' | 'vertical'\n\nexport interface DividerProps extends HTMLAttributes<HTMLDivElement> {\n  /** Divider orientation */\n  orientation?: DividerOrientation\n  /** Label text */\n  label?: string\n  /** Label position (only for horizontal) */\n  labelPosition?: 'left' | 'center' | 'right'\n}\n\n/** Visual separator supporting horizontal and vertical orientations with an optional label. */\nexport const Divider = forwardRef<HTMLDivElement, DividerProps>(\n  ({ className, orientation = 'horizontal', label, labelPosition = 'center', ...props }, ref) => {\n    if (orientation === 'vertical') {\n      return (\n        <div\n          ref={ref}\n          role=\"separator\"\n          aria-orientation=\"vertical\"\n          className={cn('bg-border h-full w-px', className)}\n          {...props}\n        />\n      )\n    }\n\n    if (label) {\n      return (\n        <div\n          ref={ref}\n          role=\"separator\"\n          aria-orientation=\"horizontal\"\n          className={cn(\n            'flex items-center',\n            labelPosition === 'left' && 'justify-start',\n            labelPosition === 'center' && 'justify-center',\n            labelPosition === 'right' && 'justify-end',\n            className\n          )}\n          {...props}\n        >\n          {labelPosition !== 'left' && (\n            <div className={cn('bg-border h-px flex-1', labelPosition === 'center' && 'mr-4')} />\n          )}\n          <span className=\"text-muted-foreground text-xs\">{label}</span>\n          {labelPosition !== 'right' && (\n            <div className={cn('bg-border h-px flex-1', labelPosition === 'center' && 'ml-4')} />\n          )}\n        </div>\n      )\n    }\n\n    return (\n      <div\n        ref={ref}\n        role=\"separator\"\n        aria-orientation=\"horizontal\"\n        className={cn('bg-border h-px w-full', className)}\n        {...props}\n      />\n    )\n  }\n)\n\nDivider.displayName = 'Divider'\n","import { type ReactNode } from 'react'\nimport {\n  Sidebar,\n  SidebarHeader,\n  SidebarContent,\n  SidebarFooter,\n  SidebarGroup,\n  SidebarItem,\n  SidebarToggle,\n  useSidebar,\n} from '../sidebar/Sidebar'\nimport { Navbar, NavbarContent, NavbarSpacer } from '../navbar/Navbar'\nimport { Avatar } from '../avatar/Avatar'\nimport { Badge, type BadgeVariant } from '../badge/Badge'\nimport { ToastContainer } from '../toast/Toast'\nimport { cn } from '../../utils/cn'\nimport { useLocale } from '../../locale'\n\n// --- Types ---\n\nexport interface AdminNavItem {\n  /** Route path */\n  path: string\n  /** Display label */\n  label: string\n  /** Icon element */\n  icon?: ReactNode\n  /** Badge content (e.g., notification count) */\n  badge?: ReactNode\n  /** Required permissions (any match grants access) */\n  permissions?: string[]\n  /** External link (opens new tab) */\n  external?: boolean\n  /** Disabled state */\n  disabled?: boolean\n  /** Additional path patterns that should highlight this item (supports /stores/:id/appointments style) */\n  activeMatch?: string[]\n}\n\nexport interface AdminNavGroup {\n  /** Group heading label */\n  label: string\n  /** Navigation items in this group */\n  items: AdminNavItem[]\n  /** Only visible when `visibleWhen` returns true */\n  visibleWhen?: (context: AdminLayoutContext) => boolean\n  /** Group icon (used by `sidebarVariant=\"rail\"`; ignored in classic) */\n  icon?: ReactNode\n  /** Optional group-level route (used by `sidebarVariant=\"rail\"` when the rail item is clicked; falls back to the first visible item's path) */\n  path?: string\n}\n\nexport interface AdminBrandConfig {\n  /** Brand name */\n  name: string\n  /** Short name or letter for collapsed state */\n  shortName?: string\n  /** Logo element (replaces default letter icon) */\n  logo?: ReactNode\n  /** Collapsed logo element */\n  collapsedLogo?: ReactNode\n}\n\nexport interface AdminUserConfig {\n  /** User display name */\n  name?: string\n  /** User email */\n  email?: string\n  /** Avatar fallback (initials) */\n  avatarFallback?: string\n  /** Avatar image URL */\n  avatarSrc?: string\n  /** Role display name */\n  roleLabel?: string\n  /** Role badge variant */\n  roleBadgeVariant?: BadgeVariant\n}\n\nexport interface AdminLayoutContext {\n  /** Current path */\n  currentPath: string\n  /** Check if user has any of the given permissions */\n  hasPermission?: (permissions: string[]) => boolean\n}\n\nexport interface AdminLayoutProps {\n  /** Current pathname for active state */\n  currentPath: string\n  /** Navigation groups */\n  navigation: AdminNavGroup[]\n  /** Brand configuration */\n  brand: AdminBrandConfig\n  /** User info for navbar display */\n  user?: AdminUserConfig\n  /** Base path prefix for all routes */\n  basePath?: string\n  /** Navigate callback */\n  onNavigate: (path: string) => void\n  /** Custom link renderer for framework integration (React Router, Next.js) */\n  renderLink?: (props: {\n    href: string\n    children: ReactNode\n    className?: string\n    active?: boolean\n  }) => ReactNode\n  /** Permission check function */\n  hasPermission?: (permissions: string[]) => boolean\n  /** Logout handler */\n  onLogout?: () => void\n  /** Extra content in the navbar (left side, after brand area) */\n  navbarLeft?: ReactNode\n  /** Extra content in the navbar (right side, before user info) */\n  navbarRight?: ReactNode\n  /** Sidebar footer content (replaces default logout button) */\n  sidebarFooter?: ReactNode\n  /** Sidebar visual variant: `\"classic\"` (default, 240/64px collapsible with labels) or `\"rail\"` (72px fixed icon rail where each nav group becomes one item). */\n  sidebarVariant?: 'classic' | 'rail'\n  /** Optional sub-navigation slot rendered between the navbar and main content. Intended for the rail variant's \"sub pill\" row, but works with any variant. */\n  subNav?: ReactNode\n  /** Toast position */\n  toastPosition?:\n    | 'top-right'\n    | 'top-left'\n    | 'top-center'\n    | 'bottom-right'\n    | 'bottom-left'\n    | 'bottom-center'\n  /** Hide toast container (if consumer manages their own) */\n  hideToast?: boolean\n  /**\n   * Class overrides for the internal regions — the supported way to restyle\n   * parts AdminLayout renders itself. Use this instead of global CSS that\n   * targets internal DOM (aria-labels, utility-class combos): those selectors\n   * break silently on any markup change, with no build-time signal.\n   */\n  classNames?: {\n    root?: string\n    sidebar?: string\n    navbar?: string\n    subNav?: string\n    main?: string\n    bottomNav?: string\n  }\n  /** Hide the sidebar: `true` removes it, `'mobile'` hides it below the `md` breakpoint */\n  hideSidebar?: boolean | 'mobile'\n  /** Hide the navbar: `true` removes it, `'mobile'` hides it below the `md` breakpoint */\n  hideNavbar?: boolean | 'mobile'\n  /**\n   * Mobile bottom navigation slot — rendered as a fixed bar below the `md`\n   * breakpoint with safe-area padding built in on all three exposed edges\n   * (home indicator plus the side notch in landscape); the main\n   * area gets matching bottom padding so content is never hidden behind it.\n   * Pair with `hideSidebar=\"mobile\"` for the sidebar-on-desktop /\n   * bottom-tabs-on-mobile pattern.\n   */\n  bottomNav?: ReactNode\n  /** Main content */\n  children: ReactNode\n  className?: string\n}\n\n// --- Internal components ---\n\nfunction SidebarBrand({ brand }: { brand: AdminBrandConfig }) {\n  const locale = useLocale()\n  const { collapsed, setCollapsed } = useSidebar()\n\n  if (collapsed) {\n    return (\n      <SidebarHeader className=\"flex items-center justify-center\">\n        <button\n          type=\"button\"\n          onClick={() => setCollapsed(false)}\n          className=\"bg-primary text-primary-foreground hover:bg-primary-hover flex h-8 w-8 items-center justify-center rounded-md text-sm font-bold transition-colors\"\n          title={locale.adminLayout.expandMenu}\n        >\n          {brand.collapsedLogo || brand.shortName || brand.name.charAt(0)}\n        </button>\n      </SidebarHeader>\n    )\n  }\n\n  return (\n    <SidebarHeader className=\"flex items-center justify-between\">\n      <div className=\"flex items-center gap-2 px-2\">\n        {brand.logo || (\n          <div className=\"bg-primary text-primary-foreground flex h-8 w-8 items-center justify-center rounded-md text-sm font-bold\">\n            {brand.shortName || brand.name.charAt(0)}\n          </div>\n        )}\n        <span className=\"font-semibold\">{brand.name}</span>\n      </div>\n      <SidebarToggle />\n    </SidebarHeader>\n  )\n}\n\nfunction NavItemContent({ item }: { item: AdminNavItem }) {\n  return (\n    <>\n      {item.label}\n      {item.badge && <span className=\"ml-auto\">{item.badge}</span>}\n    </>\n  )\n}\n\n// --- Main component ---\n\n/**\n * Full admin page layout with a collapsible sidebar, top navbar, and\n * permission-aware navigation.\n *\n * **In context:** [Tenant Admin Shell](https://ui.foson.co/storybook/?path=/docs/recipes-tenant-admin-shell--docs)\n */\nexport function AdminLayout({\n  currentPath,\n  navigation,\n  brand,\n  user,\n  basePath = '',\n  onNavigate,\n  renderLink,\n  hasPermission,\n  onLogout,\n  navbarLeft,\n  navbarRight,\n  sidebarFooter,\n  sidebarVariant = 'classic',\n  subNav,\n  toastPosition = 'top-right',\n  hideToast = false,\n  classNames,\n  hideSidebar = false,\n  hideNavbar = false,\n  bottomNav,\n  children,\n  className,\n}: AdminLayoutProps) {\n  const locale = useLocale()\n  const context: AdminLayoutContext = { currentPath, hasPermission }\n\n  // Filter navigation based on permissions and visibility\n  const visibleGroups = navigation\n    .filter((group) => {\n      if (group.visibleWhen && !group.visibleWhen(context)) return false\n      return true\n    })\n    .map((group) => ({\n      ...group,\n      items: group.items.filter((item) => {\n        if (item.permissions && item.permissions.length > 0 && hasPermission) {\n          return hasPermission(item.permissions)\n        }\n        return true\n      }),\n    }))\n    .filter((group) => group.items.length > 0)\n\n  const resolvePath = (path: string) => `${basePath}${path}`\n\n  const handleItemClick = (item: AdminNavItem) => {\n    if (item.external) {\n      window.open(resolvePath(item.path), '_blank', 'noopener,noreferrer')\n    } else {\n      onNavigate(resolvePath(item.path))\n    }\n  }\n\n  const isActive = (item: AdminNavItem) => {\n    // Check activeMatch first (more specific patterns take priority)\n    if (item.activeMatch) {\n      const matched = item.activeMatch.some((pattern) => {\n        const regex = new RegExp(`^${resolvePath(pattern).replace(/:[^/]+/g, '[^/]+')}(/|$)`)\n        return regex.test(currentPath)\n      })\n      if (matched) return true\n    }\n    // Check if any OTHER item's activeMatch claims this path (avoid double highlight)\n    const claimedByOther = visibleGroups.some((group) =>\n      group.items.some(\n        (other) =>\n          other.path !== item.path &&\n          other.activeMatch?.some((pattern) => {\n            const regex = new RegExp(`^${resolvePath(pattern).replace(/:[^/]+/g, '[^/]+')}(/|$)`)\n            return regex.test(currentPath)\n          })\n      )\n    )\n    if (claimedByOther) return false\n    // Default: exact match or startsWith\n    const resolved = resolvePath(item.path)\n    return currentPath === resolved || currentPath.startsWith(`${resolved}/`)\n  }\n\n  const isGroupActive = (group: AdminNavGroup) => {\n    if (group.path) {\n      const resolved = resolvePath(group.path)\n      if (currentPath === resolved || currentPath.startsWith(`${resolved}/`)) return true\n    }\n    return group.items.some((item) => isActive(item))\n  }\n\n  const handleGroupClick = (group: AdminNavGroup) => {\n    const target = group.path ?? group.items[0]?.path\n    if (!target) return\n    onNavigate(resolvePath(target))\n  }\n\n  return (\n    <div className={cn('bg-background flex h-screen', classNames?.root, className)}>\n      {/* Sidebar */}\n      {hideSidebar === true ? null : sidebarVariant === 'rail' ? (\n        <aside\n          className={cn(\n            'bg-card flex w-[72px] min-w-[72px] flex-col border-r',\n            hideSidebar === 'mobile' && 'hidden md:flex',\n            classNames?.sidebar\n          )}\n          aria-label={locale.adminLayout.primaryNavigation}\n        >\n          <div className=\"flex h-14 items-center justify-center border-b\">\n            {brand.collapsedLogo || (\n              <div className=\"bg-primary text-primary-foreground flex h-8 w-8 items-center justify-center rounded-md text-sm font-bold\">\n                {brand.shortName || brand.name.charAt(0)}\n              </div>\n            )}\n          </div>\n          <div className=\"flex-1 overflow-x-hidden overflow-y-auto py-2\">\n            <div className=\"flex flex-col items-stretch gap-1 px-2\">\n              {visibleGroups.map((group) => {\n                const active = isGroupActive(group)\n                const itemClassName = cn(\n                  'flex flex-col items-center gap-1 rounded-md px-1 py-2 text-xs font-medium leading-tight transition-colors',\n                  'hover:bg-muted hover:text-foreground',\n                  'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n                  active ? 'bg-primary/10 text-foreground' : 'text-muted-foreground'\n                )\n                const itemContent = (\n                  <>\n                    <span className=\"flex h-6 w-6 items-center justify-center\">\n                      {group.icon || (\n                        <span className=\"text-sm font-semibold\">{group.label.charAt(0)}</span>\n                      )}\n                    </span>\n                    <span className=\"w-full truncate text-center\">{group.label}</span>\n                  </>\n                )\n\n                if (renderLink && group.path) {\n                  return (\n                    <div key={group.label}>\n                      {renderLink({\n                        href: resolvePath(group.path),\n                        active,\n                        className: itemClassName,\n                        children: itemContent,\n                      })}\n                    </div>\n                  )\n                }\n\n                return (\n                  <button\n                    key={group.label}\n                    type=\"button\"\n                    onClick={() => handleGroupClick(group)}\n                    aria-label={group.label}\n                    aria-current={active ? 'page' : undefined}\n                    className={itemClassName}\n                  >\n                    {itemContent}\n                  </button>\n                )\n              })}\n            </div>\n          </div>\n          {(sidebarFooter || onLogout) && (\n            <div className=\"border-t p-2\">\n              {sidebarFooter ||\n                (onLogout && (\n                  <button\n                    type=\"button\"\n                    onClick={onLogout}\n                    aria-label={locale.adminLayout.logout}\n                    className=\"text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:ring-ring flex w-full flex-col items-center gap-1 rounded-md px-1 py-2 text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none\"\n                  >\n                    {locale.adminLayout.logout}\n                  </button>\n                ))}\n            </div>\n          )}\n        </aside>\n      ) : (\n        <Sidebar\n          collapsible\n          defaultCollapsed={false}\n          className={cn(hideSidebar === 'mobile' && 'hidden md:flex', classNames?.sidebar)}\n        >\n          <SidebarBrand brand={brand} />\n\n          <SidebarContent>\n            {visibleGroups.map((group) => (\n              <SidebarGroup key={group.label} label={group.label}>\n                {group.items.map((item) => {\n                  const active = isActive(item)\n\n                  if (renderLink && !item.external) {\n                    return (\n                      <div key={item.path}>\n                        {renderLink({\n                          href: resolvePath(item.path),\n                          active,\n                          className: 'block',\n                          children: (\n                            <SidebarItem icon={item.icon} active={active} disabled={item.disabled}>\n                              <NavItemContent item={item} />\n                            </SidebarItem>\n                          ),\n                        })}\n                      </div>\n                    )\n                  }\n\n                  return (\n                    <SidebarItem\n                      key={item.path}\n                      icon={item.icon}\n                      active={active}\n                      disabled={item.disabled}\n                      onClick={() => handleItemClick(item)}\n                    >\n                      <NavItemContent item={item} />\n                      {item.external && (\n                        <svg\n                          width=\"12\"\n                          height=\"12\"\n                          viewBox=\"0 0 15 15\"\n                          fill=\"none\"\n                          className=\"ml-1 opacity-50\"\n                        >\n                          <path\n                            d=\"M3 2C2.44772 2 2 2.44772 2 3V12C2 12.5523 2.44772 13 3 13H12C12.5523 13 13 12.5523 13 12V8.5C13 8.22386 12.7761 8 12.5 8C12.2239 8 12 8.22386 12 8.5V12H3V3H6.5C6.77614 3 7 2.77614 7 2.5C7 2.22386 6.77614 2 6.5 2H3ZM12.8536 2.14645C12.9015 2.19439 12.9377 2.24964 12.9621 2.30861C12.9861 2.36669 12.9996 2.4303 13 2.497L13 2.5V2.50049V5.5C13 5.77614 12.7761 6 12.5 6C12.2239 6 12 5.77614 12 5.5V3.70711L6.85355 8.85355C6.65829 9.04882 6.34171 9.04882 6.14645 8.85355C5.95118 8.65829 5.95118 8.34171 6.14645 8.14645L11.2929 3H9.5C9.22386 3 9 2.77614 9 2.5C9 2.22386 9.22386 2 9.5 2H12.4999H12.5C12.5678 2 12.6324 2.01349 12.6914 2.03794C12.7504 2.06234 12.8056 2.09851 12.8536 2.14645Z\"\n                            fill=\"currentColor\"\n                            fillRule=\"evenodd\"\n                            clipRule=\"evenodd\"\n                          />\n                        </svg>\n                      )}\n                    </SidebarItem>\n                  )\n                })}\n              </SidebarGroup>\n            ))}\n          </SidebarContent>\n\n          <SidebarFooter>\n            {sidebarFooter ||\n              (onLogout && (\n                <SidebarItem onClick={onLogout}>{locale.adminLayout.logout}</SidebarItem>\n              ))}\n          </SidebarFooter>\n        </Sidebar>\n      )}\n\n      {/* Main Content */}\n      <div className=\"flex flex-1 flex-col overflow-hidden\">\n        {/* Navbar */}\n        {hideNavbar !== true && (\n          <Navbar\n            sticky\n            bordered\n            className={cn(hideNavbar === 'mobile' && 'hidden md:flex', classNames?.navbar)}\n          >\n            <NavbarContent align=\"left\">{navbarLeft}</NavbarContent>\n            <NavbarSpacer />\n            <NavbarContent align=\"right\">\n              {navbarRight}\n              {user && (\n                <div className=\"flex items-center gap-3\">\n                  <Avatar\n                    fallback={user.avatarFallback || user.name?.charAt(0) || 'U'}\n                    src={user.avatarSrc}\n                    size=\"sm\"\n                  />\n                  <div className=\"hidden md:block\">\n                    <div className=\"flex items-center gap-2\">\n                      <p className=\"text-sm font-medium\">{user.name || user.email}</p>\n                      {user.roleLabel && (\n                        <Badge variant={user.roleBadgeVariant || 'secondary'} className=\"text-xs\">\n                          {user.roleLabel}\n                        </Badge>\n                      )}\n                    </div>\n                    {user.email && user.name && (\n                      <p className=\"text-muted-foreground text-xs\">{user.email}</p>\n                    )}\n                  </div>\n                </div>\n              )}\n            </NavbarContent>\n          </Navbar>\n        )}\n\n        {/* Sub-navigation slot (e.g., rail variant's sub pill row) */}\n        {subNav && (\n          <div className={cn('bg-card/50 border-b px-6 py-2', classNames?.subNav)}>{subNav}</div>\n        )}\n\n        {/* Page Content */}\n        <main\n          className={cn(\n            'flex-1 overflow-auto p-6',\n            bottomNav != null && 'max-md:pb-24',\n            classNames?.main\n          )}\n        >\n          {children}\n        </main>\n      </div>\n\n      {/* Mobile bottom navigation */}\n      {bottomNav != null && (\n        <nav\n          aria-label={locale.adminLayout.bottomNavigation}\n          className={cn(\n            'bg-card fixed inset-x-0 bottom-0 z-40 border-t md:hidden',\n            'pr-[env(safe-area-inset-right)] pb-[env(safe-area-inset-bottom)] pl-[env(safe-area-inset-left)]',\n            classNames?.bottomNav\n          )}\n        >\n          {bottomNav}\n        </nav>\n      )}\n\n      {/* Toast Container */}\n      {!hideToast && <ToastContainer position={toastPosition} />}\n    </div>\n  )\n}\n","import { forwardRef, useCallback, useState, type HTMLAttributes, type ReactNode } from 'react'\nimport { ChevronRight } from 'lucide-react'\nimport { cn } from '../../utils/cn'\n\nexport interface CollapsibleSectionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n  /** Section title displayed in the header */\n  title: ReactNode\n  /** Content to show/hide when toggling */\n  children: ReactNode\n  /** Whether the section is open by default (uncontrolled mode) */\n  defaultOpen?: boolean\n  /** Controlled open state */\n  open?: boolean\n  /** Callback when open state changes */\n  onOpenChange?: (open: boolean) => void\n  /** Subtitle text displayed below the title */\n  description?: string\n  /** Content rendered on the right side of the header (e.g. badge, counter) */\n  rightSlot?: ReactNode\n  /** Prevents toggling when true */\n  disabled?: boolean\n}\n\n/**\n * Independent collapsible block for form sections, advanced settings, etc.\n *\n * Supports both controlled (`open` / `onOpenChange`) and uncontrolled (`defaultOpen`) modes.\n * Unlike Accordion, each CollapsibleSection operates independently.\n */\nexport const CollapsibleSection = forwardRef<HTMLDivElement, CollapsibleSectionProps>(\n  (\n    {\n      title,\n      children,\n      defaultOpen = true,\n      open: controlledOpen,\n      onOpenChange,\n      description,\n      rightSlot,\n      disabled = false,\n      className,\n      ...props\n    },\n    ref\n  ) => {\n    const isControlled = controlledOpen !== undefined\n    const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen)\n    const isOpen = isControlled ? controlledOpen : uncontrolledOpen\n\n    const handleToggle = useCallback(() => {\n      if (disabled) return\n      const next = !isOpen\n      if (!isControlled) {\n        setUncontrolledOpen(next)\n      }\n      onOpenChange?.(next)\n    }, [disabled, isOpen, isControlled, onOpenChange])\n\n    return (\n      <div\n        ref={ref}\n        className={cn(\n          'bg-card text-card-foreground rounded-lg border',\n          disabled && 'opacity-50',\n          className\n        )}\n        {...props}\n      >\n        <div\n          className={cn(\n            'flex w-full items-center',\n            !disabled && 'hover:bg-muted/50',\n            isOpen && 'border-b'\n          )}\n        >\n          <button\n            type=\"button\"\n            aria-expanded={isOpen}\n            disabled={disabled}\n            onClick={handleToggle}\n            className={cn(\n              'flex min-w-0 flex-1 items-center gap-2 text-left select-none',\n              rightSlot ? 'py-4 pr-2 pl-4' : 'p-4',\n              !disabled && 'cursor-pointer'\n            )}\n          >\n            <ChevronRight\n              className={cn(\n                'text-muted-foreground h-4 w-4 shrink-0 transition-transform duration-200',\n                isOpen && 'rotate-90'\n              )}\n            />\n            <div className=\"min-w-0 flex-1\">\n              <span className=\"text-sm font-medium\">{title}</span>\n              {description && <p className=\"text-muted-foreground mt-0.5 text-xs\">{description}</p>}\n            </div>\n          </button>\n          {rightSlot && <div className=\"shrink-0 pr-4\">{rightSlot}</div>}\n        </div>\n        {isOpen && <div className=\"p-4\">{children}</div>}\n      </div>\n    )\n  }\n)\n\nCollapsibleSection.displayName = 'CollapsibleSection'\n","/**\n * Built-in theme presets for Arkite UI.\n *\n * Each preset defines CSS variable values (HSL format without the hsl() wrapper).\n * Apply by calling `applyTheme(preset)` or import the CSS directly.\n */\n\nexport interface ThemeTokens {\n  primary: string\n  'primary-foreground': string\n  secondary: string\n  'secondary-foreground': string\n  accent: string\n  'accent-foreground': string\n  success: string\n  'success-foreground': string\n  warning: string\n  'warning-foreground': string\n  destructive: string\n  'destructive-foreground': string\n  info: string\n  'info-foreground': string\n  'success-soft': string\n  'success-soft-foreground': string\n  'success-border': string\n  'warning-soft': string\n  'warning-soft-foreground': string\n  'warning-border': string\n  'destructive-soft': string\n  'destructive-soft-foreground': string\n  'destructive-border': string\n  'info-soft': string\n  'info-soft-foreground': string\n  'info-border': string\n  background: string\n  foreground: string\n  muted: string\n  'muted-foreground': string\n  card: string\n  'card-foreground': string\n  border: string\n  input: string\n  ring: string\n  radius: string\n}\n\nexport interface ThemePreset {\n  name: string\n  light: ThemeTokens\n  dark: ThemeTokens\n}\n\n// --- Default (Stripe-inspired purple) ---\nexport const defaultTheme: ThemePreset = {\n  name: 'default',\n  light: {\n    primary: '250 100% 65%',\n    'primary-foreground': '0 0% 100%',\n    secondary: '220 14% 96%',\n    'secondary-foreground': '220 9% 35%',\n    accent: '168 80% 45%',\n    'accent-foreground': '0 0% 0%',\n    success: '145 65% 42%',\n    'success-foreground': '0 0% 0%',\n    warning: '38 92% 50%',\n    'warning-foreground': '0 0% 0%',\n    destructive: '0 72% 51%',\n    'destructive-foreground': '0 0% 100%',\n    info: '217 91% 53%',\n    'info-foreground': '0 0% 100%',\n    'success-soft': '138 76% 97%',\n    'success-soft-foreground': '143 64% 24%',\n    'success-border': '141 79% 85%',\n    'warning-soft': '55 92% 95%',\n    'warning-soft-foreground': '32 81% 29%',\n    'warning-border': '53 98% 77%',\n    'destructive-soft': '0 86% 97%',\n    'destructive-soft-foreground': '0 70% 35%',\n    'destructive-border': '0 96% 89%',\n    'info-soft': '214 100% 97%',\n    'info-soft-foreground': '226 71% 40%',\n    'info-border': '213 97% 87%',\n    background: '0 0% 100%',\n    foreground: '220 15% 20%',\n    muted: '220 14% 96%',\n    'muted-foreground': '220 9% 40%',\n    card: '0 0% 100%',\n    'card-foreground': '220 15% 20%',\n    border: '220 13% 91%',\n    input: '220 13% 91%',\n    ring: '250 100% 65%',\n    radius: '0.5rem',\n  },\n  dark: {\n    primary: '250 100% 67%',\n    'primary-foreground': '0 0% 100%',\n    secondary: '220 15% 18%',\n    'secondary-foreground': '0 0% 95%',\n    accent: '168 80% 50%',\n    'accent-foreground': '0 0% 0%',\n    success: '145 65% 50%',\n    'success-foreground': '0 0% 0%',\n    warning: '38 92% 55%',\n    'warning-foreground': '0 0% 0%',\n    destructive: '0 72% 53%',\n    'destructive-foreground': '0 0% 100%',\n    info: '217 91% 60%',\n    'info-foreground': '0 0% 0%',\n    'success-soft': '145 80% 10%',\n    'success-soft-foreground': '141 79% 85%',\n    'success-border': '144 61% 20%',\n    'warning-soft': '26 83% 14%',\n    'warning-soft-foreground': '53 98% 77%',\n    'warning-border': '28 73% 26%',\n    'destructive-soft': '0 75% 15%',\n    'destructive-soft-foreground': '0 96% 89%',\n    'destructive-border': '0 63% 31%',\n    'info-soft': '226 57% 21%',\n    'info-soft-foreground': '213 97% 87%',\n    'info-border': '224 64% 33%',\n    background: '220 20% 10%',\n    foreground: '0 0% 95%',\n    muted: '220 15% 18%',\n    'muted-foreground': '220 9% 60%',\n    card: '220 18% 13%',\n    'card-foreground': '0 0% 95%',\n    border: '220 15% 22%',\n    input: '220 15% 22%',\n    ring: '250 100% 67%',\n    radius: '0.5rem',\n  },\n}\n\n// --- Neutral (Zinc/Slate monochrome) ---\nexport const neutralTheme: ThemePreset = {\n  name: 'neutral',\n  light: {\n    primary: '220 9% 20%',\n    'primary-foreground': '0 0% 100%',\n    secondary: '220 14% 96%',\n    'secondary-foreground': '220 9% 35%',\n    accent: '220 9% 48%',\n    'accent-foreground': '0 0% 0%',\n    success: '145 65% 42%',\n    'success-foreground': '0 0% 0%',\n    warning: '38 92% 50%',\n    'warning-foreground': '0 0% 0%',\n    destructive: '0 72% 51%',\n    'destructive-foreground': '0 0% 100%',\n    info: '217 91% 53%',\n    'info-foreground': '0 0% 100%',\n    'success-soft': '138 76% 97%',\n    'success-soft-foreground': '143 64% 24%',\n    'success-border': '141 79% 85%',\n    'warning-soft': '55 92% 95%',\n    'warning-soft-foreground': '32 81% 29%',\n    'warning-border': '53 98% 77%',\n    'destructive-soft': '0 86% 97%',\n    'destructive-soft-foreground': '0 70% 35%',\n    'destructive-border': '0 96% 89%',\n    'info-soft': '214 100% 97%',\n    'info-soft-foreground': '226 71% 40%',\n    'info-border': '213 97% 87%',\n    background: '0 0% 100%',\n    foreground: '220 15% 15%',\n    muted: '220 14% 96%',\n    'muted-foreground': '220 9% 40%',\n    card: '0 0% 100%',\n    'card-foreground': '220 15% 15%',\n    border: '220 13% 91%',\n    input: '220 13% 91%',\n    ring: '220 9% 20%',\n    radius: '0.375rem',\n  },\n  dark: {\n    primary: '0 0% 98%',\n    'primary-foreground': '220 15% 10%',\n    secondary: '220 15% 18%',\n    'secondary-foreground': '0 0% 95%',\n    accent: '220 9% 60%',\n    'accent-foreground': '0 0% 0%',\n    success: '145 65% 50%',\n    'success-foreground': '0 0% 0%',\n    warning: '38 92% 55%',\n    'warning-foreground': '0 0% 0%',\n    destructive: '0 72% 53%',\n    'destructive-foreground': '0 0% 100%',\n    info: '217 91% 60%',\n    'info-foreground': '0 0% 0%',\n    'success-soft': '145 80% 10%',\n    'success-soft-foreground': '141 79% 85%',\n    'success-border': '144 61% 20%',\n    'warning-soft': '26 83% 14%',\n    'warning-soft-foreground': '53 98% 77%',\n    'warning-border': '28 73% 26%',\n    'destructive-soft': '0 75% 15%',\n    'destructive-soft-foreground': '0 96% 89%',\n    'destructive-border': '0 63% 31%',\n    'info-soft': '226 57% 21%',\n    'info-soft-foreground': '213 97% 87%',\n    'info-border': '224 64% 33%',\n    background: '220 15% 8%',\n    foreground: '0 0% 95%',\n    muted: '220 15% 14%',\n    'muted-foreground': '220 9% 55%',\n    card: '220 15% 11%',\n    'card-foreground': '0 0% 95%',\n    border: '220 15% 20%',\n    input: '220 15% 20%',\n    ring: '0 0% 98%',\n    radius: '0.375rem',\n  },\n}\n\n// --- Ocean (Blue tones) ---\nexport const oceanTheme: ThemePreset = {\n  name: 'ocean',\n  light: {\n    primary: '210 100% 45%',\n    'primary-foreground': '0 0% 100%',\n    secondary: '210 20% 96%',\n    'secondary-foreground': '210 12% 35%',\n    accent: '190 90% 45%',\n    'accent-foreground': '0 0% 0%',\n    success: '145 65% 42%',\n    'success-foreground': '0 0% 0%',\n    warning: '38 92% 50%',\n    'warning-foreground': '0 0% 0%',\n    destructive: '0 72% 51%',\n    'destructive-foreground': '0 0% 100%',\n    info: '217 91% 53%',\n    'info-foreground': '0 0% 100%',\n    'success-soft': '138 76% 97%',\n    'success-soft-foreground': '143 64% 24%',\n    'success-border': '141 79% 85%',\n    'warning-soft': '55 92% 95%',\n    'warning-soft-foreground': '32 81% 29%',\n    'warning-border': '53 98% 77%',\n    'destructive-soft': '0 86% 97%',\n    'destructive-soft-foreground': '0 70% 35%',\n    'destructive-border': '0 96% 89%',\n    'info-soft': '214 100% 97%',\n    'info-soft-foreground': '226 71% 40%',\n    'info-border': '213 97% 87%',\n    background: '210 20% 99%',\n    foreground: '210 20% 15%',\n    muted: '210 20% 96%',\n    'muted-foreground': '210 12% 40%',\n    card: '0 0% 100%',\n    'card-foreground': '210 20% 15%',\n    border: '210 18% 90%',\n    input: '210 18% 90%',\n    ring: '210 100% 45%',\n    radius: '0.5rem',\n  },\n  dark: {\n    primary: '210 100% 60%',\n    'primary-foreground': '0 0% 0%',\n    secondary: '210 20% 18%',\n    'secondary-foreground': '0 0% 95%',\n    accent: '190 90% 55%',\n    'accent-foreground': '0 0% 0%',\n    success: '145 65% 50%',\n    'success-foreground': '0 0% 0%',\n    warning: '38 92% 55%',\n    'warning-foreground': '0 0% 0%',\n    destructive: '0 72% 53%',\n    'destructive-foreground': '0 0% 100%',\n    info: '217 91% 60%',\n    'info-foreground': '0 0% 0%',\n    'success-soft': '145 80% 10%',\n    'success-soft-foreground': '141 79% 85%',\n    'success-border': '144 61% 20%',\n    'warning-soft': '26 83% 14%',\n    'warning-soft-foreground': '53 98% 77%',\n    'warning-border': '28 73% 26%',\n    'destructive-soft': '0 75% 15%',\n    'destructive-soft-foreground': '0 96% 89%',\n    'destructive-border': '0 63% 31%',\n    'info-soft': '226 57% 21%',\n    'info-soft-foreground': '213 97% 87%',\n    'info-border': '224 64% 33%',\n    background: '210 25% 8%',\n    foreground: '0 0% 95%',\n    muted: '210 20% 14%',\n    'muted-foreground': '210 12% 55%',\n    card: '210 22% 11%',\n    'card-foreground': '0 0% 95%',\n    border: '210 18% 20%',\n    input: '210 18% 20%',\n    ring: '210 100% 60%',\n    radius: '0.5rem',\n  },\n}\n\n// --- Forest (Green tones) ---\nexport const forestTheme: ThemePreset = {\n  name: 'forest',\n  light: {\n    primary: '152 60% 33%',\n    'primary-foreground': '0 0% 100%',\n    secondary: '150 15% 96%',\n    'secondary-foreground': '150 12% 35%',\n    accent: '30 80% 55%',\n    'accent-foreground': '0 0% 0%',\n    success: '145 65% 42%',\n    'success-foreground': '0 0% 0%',\n    warning: '38 92% 50%',\n    'warning-foreground': '0 0% 0%',\n    destructive: '0 72% 51%',\n    'destructive-foreground': '0 0% 100%',\n    info: '217 91% 53%',\n    'info-foreground': '0 0% 100%',\n    'success-soft': '138 76% 97%',\n    'success-soft-foreground': '143 64% 24%',\n    'success-border': '141 79% 85%',\n    'warning-soft': '55 92% 95%',\n    'warning-soft-foreground': '32 81% 29%',\n    'warning-border': '53 98% 77%',\n    'destructive-soft': '0 86% 97%',\n    'destructive-soft-foreground': '0 70% 35%',\n    'destructive-border': '0 96% 89%',\n    'info-soft': '214 100% 97%',\n    'info-soft-foreground': '226 71% 40%',\n    'info-border': '213 97% 87%',\n    background: '150 10% 99%',\n    foreground: '150 15% 15%',\n    muted: '150 12% 95%',\n    'muted-foreground': '150 8% 40%',\n    card: '0 0% 100%',\n    'card-foreground': '150 15% 15%',\n    border: '150 12% 90%',\n    input: '150 12% 90%',\n    ring: '152 60% 33%',\n    radius: '0.5rem',\n  },\n  dark: {\n    primary: '152 60% 48%',\n    'primary-foreground': '0 0% 0%',\n    secondary: '150 15% 18%',\n    'secondary-foreground': '0 0% 95%',\n    accent: '30 80% 60%',\n    'accent-foreground': '0 0% 0%',\n    success: '145 65% 50%',\n    'success-foreground': '0 0% 0%',\n    warning: '38 92% 55%',\n    'warning-foreground': '0 0% 0%',\n    destructive: '0 72% 53%',\n    'destructive-foreground': '0 0% 100%',\n    info: '217 91% 60%',\n    'info-foreground': '0 0% 0%',\n    'success-soft': '145 80% 10%',\n    'success-soft-foreground': '141 79% 85%',\n    'success-border': '144 61% 20%',\n    'warning-soft': '26 83% 14%',\n    'warning-soft-foreground': '53 98% 77%',\n    'warning-border': '28 73% 26%',\n    'destructive-soft': '0 75% 15%',\n    'destructive-soft-foreground': '0 96% 89%',\n    'destructive-border': '0 63% 31%',\n    'info-soft': '226 57% 21%',\n    'info-soft-foreground': '213 97% 87%',\n    'info-border': '224 64% 33%',\n    background: '150 20% 8%',\n    foreground: '0 0% 95%',\n    muted: '150 15% 15%',\n    'muted-foreground': '150 8% 55%',\n    card: '150 18% 11%',\n    'card-foreground': '0 0% 95%',\n    border: '150 15% 20%',\n    input: '150 15% 20%',\n    ring: '152 60% 48%',\n    radius: '0.5rem',\n  },\n}\n\n/** All built-in theme presets */\nexport const themePresets = {\n  default: defaultTheme,\n  neutral: neutralTheme,\n  ocean: oceanTheme,\n  forest: forestTheme,\n} as const\n\nexport type ThemePresetName = keyof typeof themePresets\n","/**\n * WCAG 2.1 relative-luminance contrast math.\n *\n * Used by createTheme() to pick guaranteed-AA foregrounds, and by the\n * token/preset contrast regression tests. Same formula as the Storybook\n * \"Foundation / Design Tokens\" audit page.\n */\n\nfunction channelToLinear(v: number): number {\n  return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4)\n}\n\nfunction luminanceFromRgb([r, g, b]: [number, number, number]): number {\n  return 0.2126 * channelToLinear(r) + 0.7152 * channelToLinear(g) + 0.0722 * channelToLinear(b)\n}\n\n/** Luminance of a `#rrggbb` hex color. */\nexport function hexLuminance(hex: string): number {\n  const h = hex.replace('#', '')\n  return luminanceFromRgb([\n    parseInt(h.slice(0, 2), 16) / 255,\n    parseInt(h.slice(2, 4), 16) / 255,\n    parseInt(h.slice(4, 6), 16) / 255,\n  ])\n}\n\n/** sRGB (0..1) of an `\"H S% L%\"` HSL triplet. */\nfunction hslToRgb(hsl: string): [number, number, number] {\n  const [h, s, l] = hsl.split(' ').map((v, i) => parseFloat(v) / (i ? 100 : 1))\n  const c = (1 - Math.abs(2 * l - 1)) * s\n  const x = c * (1 - Math.abs(((h / 60) % 2) - 1))\n  const m = l - c / 2\n  let rgb: [number, number, number]\n  if (h < 60) rgb = [c, x, 0]\n  else if (h < 120) rgb = [x, c, 0]\n  else if (h < 180) rgb = [0, c, x]\n  else if (h < 240) rgb = [0, x, c]\n  else if (h < 300) rgb = [x, 0, c]\n  else rgb = [c, 0, x]\n  return [rgb[0] + m, rgb[1] + m, rgb[2] + m]\n}\n\n/** Luminance of an `\"H S% L%\"` HSL triplet (the theme-preset format). */\nexport function hslLuminance(hsl: string): number {\n  return luminanceFromRgb(hslToRgb(hsl))\n}\n\n/**\n * Share of the base color kept by the solid-fill hover tokens — must match\n * `--color-primary-hover` / `--color-destructive-hover` in styles/index.css:\n * `color-mix(in oklab, <color> 88%, black)`. Black is the oklab origin, so the\n * mix simply scales L, a and b by this factor.\n */\nexport const HOVER_MIX = 0.88\n\n/**\n * Luminance of the hover shade of an `\"H S% L%\"` color, computed exactly like the\n * CSS `color-mix(in oklab, color 88%, black)` (#27: hover must darken, not fade).\n */\nexport function hoverLuminance(hsl: string, keep: number = HOVER_MIX): number {\n  const lin = hslToRgb(hsl).map(channelToLinear)\n  const lms = [\n    0.4122214708 * lin[0] + 0.5363325363 * lin[1] + 0.0514459929 * lin[2],\n    0.2119034982 * lin[0] + 0.6806995451 * lin[1] + 0.1073969566 * lin[2],\n    0.0883024619 * lin[0] + 0.2817188376 * lin[1] + 0.6299787005 * lin[2],\n  ].map(Math.cbrt)\n  const L = (0.2104542553 * lms[0] + 0.793617785 * lms[1] - 0.0040720468 * lms[2]) * keep\n  const A = (1.9779984951 * lms[0] - 2.428592205 * lms[1] + 0.4505937099 * lms[2]) * keep\n  const B = (0.0259040371 * lms[0] + 0.7827717662 * lms[1] - 0.808675766 * lms[2]) * keep\n  const l = (L + 0.3963377774 * A + 0.2158037573 * B) ** 3\n  const m = (L - 0.1055613458 * A - 0.0638541728 * B) ** 3\n  const s = (L - 0.0894841775 * A - 1.291485548 * B) ** 3\n  const r = 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s\n  const g = -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s\n  const b = -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s\n  // Back in linear-light sRGB: clamp to gamut and take relative luminance directly.\n  const clamp = (v: number) => Math.min(1, Math.max(0, v))\n  return 0.2126 * clamp(r) + 0.7152 * clamp(g) + 0.0722 * clamp(b)\n}\n\n/** WCAG contrast ratio (1..21) between two luminances. */\nexport function contrastRatio(lum1: number, lum2: number): number {\n  const [lighter, darker] = lum1 > lum2 ? [lum1, lum2] : [lum2, lum1]\n  return (lighter + 0.05) / (darker + 0.05)\n}\n\n/** WCAG AA threshold for normal-size text. */\nexport const WCAG_AA = 4.5\n\n/**\n * Pick black or white foreground for an `\"H S% L%\"` background, whichever\n * contrasts more. Because contrast(white, bg) × contrast(black, bg) ≡ 21,\n * the winning side is always ≥ √21 ≈ 4.58 — WCAG AA holds for any color.\n */\nexport function pickForeground(hsl: string): string {\n  const bg = hslLuminance(hsl)\n  return contrastRatio(0, bg) >= contrastRatio(1, bg) ? '0 0% 0%' : '0 0% 100%'\n}\n","import type { ThemeTokens, ThemePreset } from './presets'\nimport { defaultTheme } from './presets'\nimport { pickForeground } from './contrast'\n\n/**\n * Parse a hex color to HSL components.\n * Returns \"H S% L%\" string for CSS variable usage.\n */\nfunction hexToHsl(hex: string): string {\n  hex = hex.replace('#', '')\n  if (hex.length === 3) {\n    hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]\n  }\n\n  const r = parseInt(hex.substring(0, 2), 16) / 255\n  const g = parseInt(hex.substring(2, 4), 16) / 255\n  const b = parseInt(hex.substring(4, 6), 16) / 255\n\n  const max = Math.max(r, g, b)\n  const min = Math.min(r, g, b)\n  const l = (max + min) / 2\n\n  if (max === min) {\n    return `0 0% ${Math.round(l * 100)}%`\n  }\n\n  const d = max - min\n  const s = l > 0.5 ? d / (2 - max - min) : d / (max + min)\n\n  let h: number\n  switch (max) {\n    case r:\n      h = ((g - b) / d + (g < b ? 6 : 0)) / 6\n      break\n    case g:\n      h = ((b - r) / d + 2) / 6\n      break\n    default:\n      h = ((r - g) / d + 4) / 6\n      break\n  }\n\n  return `${Math.round(h * 360)} ${Math.round(s * 100)}% ${Math.round(l * 100)}%`\n}\n\n/**\n * Adjust the lightness of an HSL string.\n */\nfunction adjustLightness(hsl: string, delta: number): string {\n  const parts = hsl.match(/(\\d+)\\s+(\\d+)%\\s+(\\d+)%/)\n  if (!parts) return hsl\n  const h = parseInt(parts[1])\n  const s = parseInt(parts[2])\n  const l = Math.max(0, Math.min(100, parseInt(parts[3]) + delta))\n  return `${h} ${s}% ${l}%`\n}\n\nexport interface CreateThemeOptions {\n  /** Theme name */\n  name?: string\n  /** Primary brand color (hex) */\n  primary: string\n  /** Accent color (hex). Defaults to a complementary color. */\n  accent?: string\n  /** Border radius. Defaults to \"0.5rem\". */\n  radius?: string\n}\n\n/**\n * Create a complete theme from 1-2 input colors.\n *\n * @example\n * ```ts\n * import { createTheme, applyTheme } from '@arkite-ui/core'\n *\n * const myTheme = createTheme({\n *   primary: '#FF6B00',\n *   accent: '#00B4D8',\n * })\n *\n * applyTheme(myTheme) // applies to :root\n * ```\n */\nexport function createTheme(options: CreateThemeOptions): ThemePreset {\n  const primaryHsl = hexToHsl(options.primary)\n  const accentHsl = options.accent ? hexToHsl(options.accent) : adjustLightness(primaryHsl, 10)\n  const radius = options.radius ?? '0.5rem'\n  const darkPrimaryHsl = adjustLightness(primaryHsl, 8)\n  const darkAccentHsl = adjustLightness(accentHsl, 8)\n\n  const light: ThemeTokens = {\n    ...defaultTheme.light,\n    primary: primaryHsl,\n    'primary-foreground': pickForeground(primaryHsl),\n    accent: accentHsl,\n    'accent-foreground': pickForeground(accentHsl),\n    ring: primaryHsl,\n    radius,\n  }\n\n  const dark: ThemeTokens = {\n    ...defaultTheme.dark,\n    primary: darkPrimaryHsl,\n    'primary-foreground': pickForeground(darkPrimaryHsl),\n    accent: darkAccentHsl,\n    'accent-foreground': pickForeground(darkAccentHsl),\n    ring: darkPrimaryHsl,\n    radius,\n  }\n\n  return {\n    name: options.name ?? 'custom',\n    light,\n    dark,\n  }\n}\n","import type { ThemePreset, ThemeTokens } from './presets'\n\n/**\n * Apply a theme preset's CSS variables to a DOM element.\n * Applies light tokens to the element and dark tokens to `.dark` selector.\n *\n * @param theme - Theme preset to apply\n * @param element - Target element (defaults to document.documentElement)\n */\nexport function applyTheme(theme: ThemePreset, element?: HTMLElement): void {\n  const target = element ?? document.documentElement\n  applyTokens(target, theme.light)\n}\n\n/**\n * Apply dark mode tokens to an element.\n *\n * @param theme - Theme preset to apply\n * @param element - Target element (defaults to document.documentElement)\n */\nexport function applyDarkTheme(theme: ThemePreset, element?: HTMLElement): void {\n  const target = element ?? document.documentElement\n  applyTokens(target, theme.dark)\n}\n\nfunction applyTokens(element: HTMLElement, tokens: ThemeTokens): void {\n  for (const [key, value] of Object.entries(tokens)) {\n    element.style.setProperty(`--${key}`, value)\n  }\n}\n\n/**\n * Generate a CSS string from a theme preset.\n * Useful for SSR or injecting into a <style> tag.\n *\n * @example\n * ```ts\n * const css = themeToCSS(myTheme)\n * // Returns:\n * // :root { --primary: 250 100% 65%; ... }\n * // .dark { --primary: 250 100% 70%; ... }\n * ```\n */\nexport function themeToCSS(theme: ThemePreset, selector = ':root'): string {\n  const lightVars = Object.entries(theme.light)\n    .map(([key, value]) => `  --${key}: ${value};`)\n    .join('\\n')\n\n  const darkVars = Object.entries(theme.dark)\n    .map(([key, value]) => `  --${key}: ${value};`)\n    .join('\\n')\n\n  return `${selector} {\\n${lightVars}\\n}\\n\\n.dark {\\n${darkVars}\\n}`\n}\n","import { createTheme, type CreateThemeOptions } from './create-theme'\nimport { themeToCSS } from './apply-theme'\n\n/**\n * The contents of an `arkite.theme.json` — a project's brand as a committed\n * artifact rather than CSS variables copied between repos.\n *\n * Four values are the whole source of truth; every token in the generated\n * theme is derived from them, so a rebrand is a reviewable four-line diff.\n */\nexport type ThemeFile = CreateThemeOptions\n\n/** Thrown when a theme file is malformed. The message is written for a terminal. */\nexport class ThemeFileError extends Error {\n  override name = 'ThemeFileError'\n}\n\nconst HEX = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i\nconst LENGTH = /^(?:0|\\d*\\.?\\d+(?:rem|em|px))$/\nconst KNOWN_KEYS = ['name', 'primary', 'accent', 'radius'] as const\n\nfunction fail(message: string): never {\n  throw new ThemeFileError(message)\n}\n\n/**\n * Validate parsed JSON as a theme file.\n *\n * `createTheme` itself is permissive — an unparseable hex flows through\n * `parseInt` and lands in the CSS as `NaN NaN% NaN%`, which fails at render\n * time in the consuming app rather than here. This is the gate that turns\n * that into a message at the point of authorship.\n *\n * Unknown keys are rejected rather than ignored: the file has four keys, so\n * an extra one is a typo (`primaryColor`) or a wrong mental model, and\n * silently dropping it would ship the default brand instead.\n */\nexport function parseThemeFile(input: unknown): ThemeFile {\n  if (input === null || typeof input !== 'object' || Array.isArray(input)) {\n    fail('Theme file must be a JSON object.')\n  }\n\n  const raw = input as Record<string, unknown>\n\n  const unknown = Object.keys(raw).filter((key) => !(KNOWN_KEYS as readonly string[]).includes(key))\n  if (unknown.length > 0) {\n    fail(`Unknown key(s): ${unknown.join(', ')}. Valid keys: ${KNOWN_KEYS.join(', ')}.`)\n  }\n\n  if (typeof raw.primary !== 'string') {\n    fail('\"primary\" is required and must be a hex string, e.g. \"#6a4dff\".')\n  }\n  if (!HEX.test(raw.primary)) {\n    fail(`\"primary\" must be a hex color like \"#6a4dff\" — got ${JSON.stringify(raw.primary)}.`)\n  }\n\n  if (raw.accent !== undefined) {\n    if (typeof raw.accent !== 'string' || !HEX.test(raw.accent)) {\n      fail(`\"accent\" must be a hex color like \"#00b4d8\" — got ${JSON.stringify(raw.accent)}.`)\n    }\n  }\n\n  if (raw.radius !== undefined) {\n    if (typeof raw.radius !== 'string' || !LENGTH.test(raw.radius)) {\n      fail(`\"radius\" must be a CSS length like \"0.5rem\" — got ${JSON.stringify(raw.radius)}.`)\n    }\n  }\n\n  if (raw.name !== undefined && (typeof raw.name !== 'string' || raw.name.trim() === '')) {\n    fail(`\"name\" must be a non-empty string — got ${JSON.stringify(raw.name)}.`)\n  }\n\n  const theme: ThemeFile = { primary: raw.primary }\n  if (typeof raw.name === 'string') theme.name = raw.name\n  if (typeof raw.accent === 'string') theme.accent = raw.accent\n  if (typeof raw.radius === 'string') theme.radius = raw.radius\n  return theme\n}\n\nexport interface ThemeFileToCSSOptions {\n  /** Path shown in the generated header, so the CSS points back at its source. */\n  source?: string\n  /** Selector the light tokens land on. Defaults to `:root`. */\n  selector?: string\n}\n\n/**\n * Render a theme file as CSS variables, with a header marking it generated.\n *\n * Server-safe: this module touches no DOM, so a build script or a Server\n * Component can emit theme CSS without pulling in the component library.\n */\nexport function themeFileToCSS(file: ThemeFile, options: ThemeFileToCSSOptions = {}): string {\n  const { source = 'arkite.theme.json', selector = ':root' } = options\n  const css = themeToCSS(createTheme(file), selector)\n  return `/* Generated from ${source} by \\`arkite-ui theme apply\\` — do not edit.\\n   Change the source file and re-run instead. */\\n\\n${css}\\n`\n}\n","/**\n * Chart color palette — CSS variable references for use with\n * Recharts, Nivo, Chart.js, or any charting library.\n *\n * Colors follow the theme system and adapt to light/dark mode.\n *\n * @example\n * ```tsx\n * import { chartColors } from '@arkite-ui/core'\n *\n * <BarChart data={data}>\n *   <Bar dataKey=\"revenue\" fill={chartColors[1]} />\n *   <Bar dataKey=\"cost\" fill={chartColors[2]} />\n * </BarChart>\n * ```\n */\nexport const chartColors = {\n  1: 'hsl(var(--chart-1))',\n  2: 'hsl(var(--chart-2))',\n  3: 'hsl(var(--chart-3))',\n  4: 'hsl(var(--chart-4))',\n  5: 'hsl(var(--chart-5))',\n} as const\n\n/** Array form for iterating (e.g. mapping over datasets) */\nexport const chartColorList = [\n  chartColors[1],\n  chartColors[2],\n  chartColors[3],\n  chartColors[4],\n  chartColors[5],\n] as const\n\nexport type ChartColorKey = keyof typeof chartColors\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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,cAAc;AAAA,EACzB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGO,IAAM,iBAAiB;AAAA,EAC5B,YAAY,CAAC;AAAA,EACb,YAAY,CAAC;AAAA,EACb,YAAY,CAAC;AAAA,EACb,YAAY,CAAC;AAAA,EACb,YAAY,CAAC;AACf;","names":["import_react","import_jsx_runtime","import_react","import_jsx_runtime","sizeStyles","import_react","import_react","import_jsx_runtime","sizeStyles","import_jsx_runtime","sizeStyles","loading","import_react","import_lucide_react","import_jsx_runtime","import_react","import_jsx_runtime","sizeStyles","error","import_react","import_lucide_react","import_jsx_runtime","import_react","import_jsx_runtime","variantStyles","sizeStyles","import_react","import_jsx_runtime","import_react","import_lucide_react","import_jsx_runtime","sizeStyles","error","import_react","import_lucide_react","import_jsx_runtime","sizeStyles","error","import_react","import_lucide_react","import_jsx_runtime","error","import_react","import_jsx_runtime","sizeStyles","error","import_react","import_jsx_runtime","sizeStyles","error","import_react","import_jsx_runtime","import_react","import_jsx_runtime","sizeStyles","import_react","import_jsx_runtime","sizeStyles","variantStyles","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_react","PopoverPrimitive","import_jsx_runtime","error","loading","import_react","import_jsx_runtime","CommandPrimitive","import_react","import_lucide_react","import_jsx_runtime","import_react","import_jsx_runtime","loading","import_react","import_jsx_runtime","alignStyles","import_react","import_lucide_react","import_jsx_runtime","import_react","import_jsx_runtime","triggerSizeStyles","import_react","import_lucide_react","import_jsx_runtime","Tree","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_react","import_react","import_jsx_runtime","import_jsx_runtime","import_react","import_jsx_runtime","import_lucide_react","import_jsx_runtime","loading","import_react","import_react","import_jsx_runtime","loading","import_react","import_lucide_react","import_jsx_runtime","loading","variantStyles","columnStyles","import_react","import_jsx_runtime","trendStyles","pad","import_react","import_lucide_react","import_jsx_runtime","sizeStyles","import_react","import_jsx_runtime","error","alignStyles","import_react","import_lucide_react","import_jsx_runtime","sizeStyles","iconSizeStyles","error","import_react","import_jsx_runtime","sizeStyles","error","import_react","import_jsx_runtime","sizeStyles","error","import_react","import_lucide_react","import_jsx_runtime","sizeStyles","iconSizeStyles","loading","import_react","import_lucide_react","import_jsx_runtime","error","import_react","import_jsx_runtime","import_react","import_lucide_react","import_jsx_runtime","error","import_react","import_lucide_react","import_jsx_runtime","formatFileSize","error","import_react","import_react","import_lucide_react","import_jsx_runtime","inputSizeStyles","iconSizeStyles","clearPositionStyles","error","today","CalendarIcon","import_react","import_lucide_react","import_jsx_runtime","getDaysInMonth","getFirstDayOfMonth","formatDate","parseDate","inputSizeStyles","iconSizeStyles","triggerSizeStyles","error","today","CalendarIcon","import_react","import_jsx_runtime","error","import_react","import_lucide_react","import_react","import_lucide_react","import_jsx_runtime","sizeStyles","import_jsx_runtime","sizeStyles","iconSizeStyles","error","import_react","import_lucide_react","toast","error","import_jsx_runtime","variantStyles","ToastContainer","toast","import_react","import_jsx_runtime","ImperativeToastContainer","import_react","import_react_dom","import_lucide_react","import_jsx_runtime","sizeStyles","import_react","import_lucide_react","import_jsx_runtime","variantStyles","iconMap","import_react","import_jsx_runtime","sizeStyles","variantStyles","import_react","import_jsx_runtime","variantStyles","spacingStyles","_","import_react","import_jsx_runtime","import_react","import_jsx_runtime","CheckIcon","import_react","import_jsx_runtime","variantStyles","import_react","import_jsx_runtime","getDaysInMonth","import_react","import_react","import_jsx_runtime","loading","import_jsx_runtime","ActionButtons","import_react","import_jsx_runtime","ChevronLeftIcon","ChevronRightIcon","info","import_react","import_jsx_runtime","sizeStyles","import_react","import_jsx_runtime","error","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_jsx_runtime","sizeStyles","import_react","import_jsx_runtime","spacingStyles","alignStyles","import_react","import_jsx_runtime","import_jsx_runtime","import_react","import_lucide_react","import_jsx_runtime"]}