"use client"; import { cx } from "../../utils"; /** `dot`은 시안 carousel-dot, `number`는 carousel-number다. */ export type FoxCarouselIndicatorType = "dot" | "number"; export interface FoxCarouselIndicatorProps { type?: FoxCarouselIndicatorType; /** 1부터 센다. */ current: number; total: number; /** * 점을 눌러 옮길 수 있게 한다. 넘기지 않으면 표시만 하는 조각이라 누를 곳이 없다. * `number`형에는 누를 점이 없어 쓰이지 않는다. */ onSelect?: (page: number) => void; /** 스크린리더가 읽을 이름. */ label?: string; /** 참이면 렌더하지 않는다(DOM에 남지 않는다). */ hidden?: boolean; /** 배치 조정용. */ className?: string; } /** * @fox 캐러셀 현재 위치 표시. 흰 알약 안에 점 또는 숫자가 들어간다. * * 시안의 carousel-dot과 carousel-number를 하나로 둔다 — 껍데기(흰 알약·높이·좌우 여백· * 간격)가 같고 안에 든 것만 다르다. * * ⚠️ 스타일은 이 파일이 import하지 않는다 — 호스트 앱이 `@use "@fox/styles/components"` * (또는 개별 파티셜)로 한 번 불러와야 한다. */ export function FoxCarouselIndicator({ type = "dot", current, total, onSelect, label = "현재 위치", hidden = false, className, }: FoxCarouselIndicatorProps) { if (hidden || total < 1) { return null; } const safe = Math.min(Math.max(current, 1), total); if (type === "number") { return (
); } const dots = Array.from({ length: total }, (unused, index) => index + 1); return (