{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "filters-01",
  "title": "Amount filter over a histogram",
  "description": "A popover that draws how the invoices spread by amount, lights the bars inside the range as the handles move, glides them to a common range and counts the matches before the list applies them.",
  "dependencies": [
    "@base-ui/react",
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/animated-size.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/chip.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/motion-number.json",
    "https://ui.ndekocode.dev/r/popover.json",
    "https://ui.ndekocode.dev/r/tabs.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/blocks/filters/filters-01/index.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion } from 'motion/react';\nimport { useState } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { FileTextIcon, XIcon } from '@/registry/ndeko/lib/icons';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Chip } from '@/registry/ndeko/ui/chip';\nimport { Tabs, TabsList, TabsTab } from '@/registry/ndeko/ui/tabs';\n\nimport { AmountFilter } from './amount-filter';\nimport {\n  INVOICES,\n  STATUS_DETAILS,\n  STATUS_FILTERS,\n  WORKSPACE,\n  type AmountRange,\n  type Invoice,\n  type StatusFilter,\n} from './data';\nimport {\n  CURRENCY_FORMAT,\n  CURRENCY_LOCALE,\n  FULL_RANGE,\n  emptyLineOf,\n  formatAmount,\n  invoiceCountLabel,\n  invoicesInRange,\n  matchesStatus,\n  totalOf,\n} from './invoice-model';\nimport { useHeightPresence } from './motion-parts';\n\nconst LIST_SURFACE =\n  'bg-card hairline-ring ring-border rounded-xl shadow-[0_1px_2px_rgb(0_0_0/0.04)] dark:bg-foreground/[0.03]';\n\nfunction isStatusFilter(value: unknown): value is StatusFilter {\n  return STATUS_FILTERS.some((filter) => filter.id === value);\n}\n\nfunction InvoiceRow({ invoice }: { invoice: Invoice }) {\n  const status = STATUS_DETAILS[invoice.status];\n\n  return (\n    <div className='flex h-14 items-center gap-3 px-4'>\n      <span className='keycap-3d text-muted-foreground hidden size-8 shrink-0 items-center justify-center rounded-lg sm:flex'>\n        <FileTextIcon />\n      </span>\n      <div className='min-w-0 flex-1'>\n        <p className='truncate text-[13px] font-medium'>{invoice.client}</p>\n        <p className='text-muted-foreground truncate text-xs tabular-nums'>\n          {invoice.number} · {invoice.issuedOn}\n        </p>\n      </div>\n      <div className='flex flex-col items-end gap-1 sm:flex-row-reverse sm:items-center sm:gap-4'>\n        <span className='text-[13px] font-medium tabular-nums sm:w-20 sm:text-right'>\n          {formatAmount(invoice.amount)}\n        </span>\n        <Chip color={status.color}>{status.label}</Chip>\n      </div>\n    </div>\n  );\n}\n\ntype NoMatchProps = {\n  status: StatusFilter;\n  range: AmountRange;\n  onReset: () => void;\n};\n\nfunction NoMatch({ status, range, onReset }: NoMatchProps) {\n  return (\n    <div className='flex flex-col items-center px-6 py-10 text-center'>\n      <span className='keycap-3d text-muted-foreground flex size-9 items-center justify-center rounded-lg'>\n        <FileTextIcon />\n      </span>\n      <p className='mt-4 text-sm font-medium'>Nothing matches these filters</p>\n      <p className='text-muted-foreground mt-1 max-w-sm text-[13px] text-balance'>\n        {emptyLineOf(status, range)}\n      </p>\n      <Button variant='outline' onClick={onReset} className='mt-4'>\n        <XIcon />\n        Reset filters\n      </Button>\n    </div>\n  );\n}\n\nexport default function Filters01() {\n  const [status, setStatus] = useState<StatusFilter>('all');\n  const [range, setRange] = useState<AmountRange>(FULL_RANGE);\n  const heightPresence = useHeightPresence();\n  const statusInvoices = INVOICES.filter((invoice) =>\n    matchesStatus(invoice, status)\n  );\n  const shown = invoicesInRange(statusInvoices, range);\n  const shownCount = shown.length;\n  const shownTotal = totalOf(shown);\n  const hasMatches = shownCount > 0;\n\n  function pickStatus(value: unknown) {\n    if (isStatusFilter(value)) {\n      setStatus(value);\n    }\n  }\n\n  function resetFilters() {\n    setStatus('all');\n    setRange(FULL_RANGE);\n  }\n\n  return (\n    <div className='bg-background text-foreground min-h-dvh w-full'>\n      <div className='mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6 md:py-10'>\n        <header className='flex flex-wrap items-end justify-between gap-x-4 gap-y-1'>\n          <div className='flex flex-col gap-0.5'>\n            <h1 className='text-lg font-semibold text-balance'>\n              {WORKSPACE.title}\n            </h1>\n            <p className='text-muted-foreground text-xs'>\n              {WORKSPACE.period} · Illustrative figures\n            </p>\n          </div>\n          <p className='text-muted-foreground text-[13px]'>\n            <MotionNumber\n              value={shownCount}\n              className='text-foreground font-medium'\n            />{' '}\n            {invoiceCountLabel(shownCount)} ·{' '}\n            <MotionNumber\n              value={shownTotal}\n              locale={CURRENCY_LOCALE}\n              format={CURRENCY_FORMAT}\n              className='text-foreground font-medium'\n            />\n          </p>\n        </header>\n        <div className='flex flex-wrap items-center gap-2'>\n          <Tabs value={status} onValueChange={pickStatus}>\n            <TabsList variant='segmented' aria-label='Status'>\n              {STATUS_FILTERS.map((filter) => (\n                <TabsTab key={filter.id} value={filter.id}>\n                  {filter.label}\n                </TabsTab>\n              ))}\n            </TabsList>\n          </Tabs>\n          <AmountFilter\n            invoices={statusInvoices}\n            value={range}\n            onValueChange={setRange}\n          />\n        </div>\n        <section aria-label='Matching invoices' className={LIST_SURFACE}>\n          <ul className='max-h-[30rem] overflow-y-auto'>\n            <AnimatePresence initial={false}>\n              {shown.map((invoice) => (\n                <motion.li\n                  key={invoice.id}\n                  {...heightPresence}\n                  className='overflow-hidden'\n                >\n                  <InvoiceRow invoice={invoice} />\n                </motion.li>\n              ))}\n            </AnimatePresence>\n          </ul>\n          <AnimatePresence initial={false}>\n            {!hasMatches && (\n              <motion.div\n                key='no-match'\n                {...heightPresence}\n                className='overflow-hidden'\n              >\n                <NoMatch status={status} range={range} onReset={resetFilters} />\n              </motion.div>\n            )}\n          </AnimatePresence>\n        </section>\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/filters-01/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/filters/filters-01/amount-filter.tsx",
      "content": "'use client';\n\nimport { Slider as SliderPrimitive } from '@base-ui/react/slider';\nimport {\n  AnimatePresence,\n  motion,\n  type Transition,\n  type Variants,\n} from 'motion/react';\nimport { useState } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { ChevronDownIcon, XIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport {\n  Popover,\n  PopoverClose,\n  PopoverContent,\n  PopoverTitle,\n  PopoverTrigger,\n} from '@/registry/ndeko/ui/popover';\n\nimport {\n  AMOUNT_BOUNDS,\n  AMOUNT_PRESETS,\n  type AmountPreset,\n  type AmountRange,\n  type Invoice,\n} from './data';\nimport {\n  CURRENCY_FORMAT,\n  CURRENCY_LOCALE,\n  FULL_RANGE,\n  formatAmount,\n  histogramOf,\n  invoiceCountLabel,\n  invoicesInRange,\n  isFullRange,\n  rangeLabelOf,\n  sameRange,\n  totalOf,\n  type HistogramBin,\n} from './invoice-model';\n\nconst THUMB_LABELS = ['Lowest amount', 'Highest amount'];\n\nconst SWAP_TRANSITION: Transition = { duration: 0.15, ease: [0.2, 0, 0, 1] };\n\nconst SWAP_VARIANTS: Variants = {\n  enter: { opacity: 0, scale: 0.6, filter: 'blur(2px)' },\n  visible: { opacity: 1, scale: 1, filter: 'blur(0px)' },\n  exit: { opacity: 0, scale: 0.6, filter: 'blur(2px)' },\n};\n\nconst FADE_VARIANTS: Variants = {\n  enter: { opacity: 0 },\n  visible: { opacity: 1 },\n  exit: { opacity: 0 },\n};\n\nconst THUMB = [\n  'group/thumb relative block size-4 shrink-0 rounded-full bg-white shadow-[0_1px_3px_rgb(0_0_0/0.18)] hairline-ring ring-foreground/15 outline-none',\n  'transition-[scale,box-shadow] duration-150 ease-(--ease-out-strong) data-dragging:scale-110',\n  'group-data-gliding/range:transition-[inset-inline-start,scale,box-shadow] group-data-gliding/range:duration-200',\n  'has-focus-visible:ring-[3px] has-focus-visible:ring-ring/30',\n].join(' ');\n\nconst INDICATOR = [\n  'bg-primary rounded-full',\n  'group-data-gliding/range:transition-[inset-inline-start,width] group-data-gliding/range:duration-200 group-data-gliding/range:ease-(--ease-out-strong)',\n].join(' ');\n\nfunction swapVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_VARIANTS;\n  }\n  return SWAP_VARIANTS;\n}\n\nfunction rangeOf(value: number | readonly number[]): AmountRange {\n  if (typeof value === 'number') {\n    return [value, AMOUNT_BOUNDS.max];\n  }\n  return [value[0], value[1]];\n}\n\nfunction barHeightOf(bin: HistogramBin) {\n  if (bin.count === 0) {\n    return '2px';\n  }\n  const percent = Math.max(bin.share * 100, 8);\n  return `${percent}%`;\n}\n\nfunction barToneOf(bin: HistogramBin) {\n  if (bin.isInRange) {\n    return 'bg-primary';\n  }\n  return 'bg-foreground/10';\n}\n\nfunction triggerLabelOf(range: AmountRange) {\n  if (isFullRange(range)) {\n    return 'Any amount';\n  }\n  return rangeLabelOf(range);\n}\n\nfunction amountAriaTextOf(_formatted: string, value: number) {\n  return formatAmount(value);\n}\n\nfunction Histogram({ bins }: { bins: HistogramBin[] }) {\n  return (\n    <div aria-hidden='true' className='flex h-16 items-end gap-0.5'>\n      {bins.map((bin) => (\n        <span\n          key={bin.id}\n          style={{ height: barHeightOf(bin) }}\n          className={cn(\n            'flex-1 rounded-[3px] transition-colors duration-150',\n            barToneOf(bin)\n          )}\n        />\n      ))}\n    </div>\n  );\n}\n\ntype RangeSliderProps = {\n  value: AmountRange;\n  isGliding: boolean;\n  onValueChange: (range: AmountRange) => void;\n  onValueCommitted: (range: AmountRange) => void;\n};\n\n/** Built from the Base UI parts so the thumbs and the fill can glide to a preset and still follow the pointer without lag. */\nfunction RangeSlider({\n  value,\n  isGliding,\n  onValueChange,\n  onValueCommitted,\n}: RangeSliderProps) {\n  const glidingAttribute = isGliding || undefined;\n  const minimumSteps = AMOUNT_BOUNDS.minGap / AMOUNT_BOUNDS.step;\n\n  function changeRange(next: number | readonly number[]) {\n    const range = rangeOf(next);\n    onValueChange(range);\n  }\n\n  function commitRange(next: number | readonly number[]) {\n    const range = rangeOf(next);\n    onValueCommitted(range);\n  }\n\n  return (\n    <SliderPrimitive.Root\n      value={[value[0], value[1]]}\n      min={AMOUNT_BOUNDS.min}\n      max={AMOUNT_BOUNDS.max}\n      step={AMOUNT_BOUNDS.step}\n      minStepsBetweenValues={minimumSteps}\n      onValueChange={changeRange}\n      onValueCommitted={commitRange}\n      data-gliding={glidingAttribute}\n      className='group/range w-full'\n    >\n      <SliderPrimitive.Control className='relative flex w-full touch-none items-center py-2 select-none'>\n        <SliderPrimitive.Track className='bg-foreground/10 relative h-1 w-full grow rounded-full'>\n          <SliderPrimitive.Indicator className={INDICATOR} />\n          {THUMB_LABELS.map((label, index) => (\n            <SliderPrimitive.Thumb\n              key={label}\n              index={index}\n              aria-label={label}\n              getAriaValueText={amountAriaTextOf}\n              className={THUMB}\n            />\n          ))}\n        </SliderPrimitive.Track>\n      </SliderPrimitive.Control>\n    </SliderPrimitive.Root>\n  );\n}\n\ntype PresetListProps = {\n  draft: AmountRange;\n  onPick: (preset: AmountPreset) => void;\n};\n\nfunction PresetList({ draft, onPick }: PresetListProps) {\n  return (\n    <div\n      role='group'\n      aria-label='Common ranges'\n      className='flex flex-wrap gap-1.5'\n    >\n      {AMOUNT_PRESETS.map((preset) => {\n        const isCurrent = sameRange(preset.range, draft);\n\n        return (\n          <Button\n            key={preset.id}\n            variant='outline'\n            size='sm'\n            aria-pressed={isCurrent}\n            onClick={() => onPick(preset)}\n            className='aria-pressed:bg-primary/10 aria-pressed:text-primary-ink aria-pressed:ring-primary/30 dark:aria-pressed:bg-primary/15'\n          >\n            {preset.label}\n          </Button>\n        );\n      })}\n    </div>\n  );\n}\n\ntype AmountPanelProps = {\n  invoices: Invoice[];\n  value: AmountRange;\n  onValueChange: (range: AmountRange) => void;\n};\n\n/** Mounted each time the popover opens, so the draft starts from the applied range. */\nfunction AmountPanel({ invoices, value, onValueChange }: AmountPanelProps) {\n  const [draft, setDraft] = useState<AmountRange>(value);\n  const [isGliding, setIsGliding] = useState(false);\n  const bins = histogramOf(invoices, draft);\n  const matches = invoicesInRange(invoices, draft);\n  const matchCount = matches.length;\n  const matchTotal = totalOf(matches);\n  const countNoun = invoiceCountLabel(matchCount);\n  const isReset = isFullRange(draft);\n\n  function followPointer(range: AmountRange) {\n    setIsGliding(false);\n    setDraft(range);\n  }\n\n  function jumpTo(range: AmountRange) {\n    setIsGliding(true);\n    setDraft(range);\n    onValueChange(range);\n  }\n\n  return (\n    <div className='flex flex-col gap-4'>\n      <div className='flex items-baseline justify-between gap-3'>\n        <PopoverTitle>Amount</PopoverTitle>\n        <span className='text-muted-foreground text-xs tabular-nums'>\n          {rangeLabelOf(draft)}\n        </span>\n      </div>\n      <div className='flex flex-col gap-1'>\n        <Histogram bins={bins} />\n        <RangeSlider\n          value={draft}\n          isGliding={isGliding}\n          onValueChange={followPointer}\n          onValueCommitted={onValueChange}\n        />\n        <div className='text-muted-foreground flex justify-between text-xs tabular-nums'>\n          <span>{formatAmount(AMOUNT_BOUNDS.min)}</span>\n          <span>{formatAmount(AMOUNT_BOUNDS.max)}</span>\n        </div>\n      </div>\n      <PresetList draft={draft} onPick={(preset) => jumpTo(preset.range)} />\n      <div className='flex items-center gap-2 pt-1'>\n        <p className='text-muted-foreground min-w-0 flex-1 truncate text-xs'>\n          <MotionNumber\n            value={matchCount}\n            className='text-foreground font-medium'\n          />{' '}\n          {countNoun} ·{' '}\n          <MotionNumber\n            value={matchTotal}\n            locale={CURRENCY_LOCALE}\n            format={CURRENCY_FORMAT}\n          />\n        </p>\n        <Button\n          variant='ghost'\n          size='sm'\n          disabled={isReset}\n          onClick={() => jumpTo(FULL_RANGE)}\n        >\n          Reset\n        </Button>\n        <PopoverClose render={<Button size='sm' />}>Done</PopoverClose>\n      </div>\n    </div>\n  );\n}\n\ntype AmountFilterProps = {\n  /** The invoices left by the other filters: the histogram draws their spread. */\n  invoices: Invoice[];\n  value: AmountRange;\n  onValueChange: (range: AmountRange) => void;\n};\n\nexport function AmountFilter({\n  invoices,\n  value,\n  onValueChange,\n}: AmountFilterProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const variants = swapVariantsOf(shouldReduceMotion);\n  const label = triggerLabelOf(value);\n  const isFiltered = !isFullRange(value);\n\n  return (\n    <div className='flex items-center gap-1'>\n      <Popover>\n        <PopoverTrigger\n          render={<Button variant='outline' className='gap-1.5 pe-2.5' />}\n        >\n          <span className='text-muted-foreground'>Amount</span>\n          <AnimatedSize as='span' axis='width' contentClassName='relative flex'>\n            <AnimatePresence mode='popLayout' initial={false}>\n              <motion.span\n                key={label}\n                variants={variants}\n                initial='enter'\n                animate='visible'\n                exit='exit'\n                transition={SWAP_TRANSITION}\n                className='tabular-nums'\n              >\n                {label}\n              </motion.span>\n            </AnimatePresence>\n          </AnimatedSize>\n          <ChevronDownIcon className='text-muted-foreground size-3.5' />\n        </PopoverTrigger>\n        <PopoverContent align='start' className='w-80'>\n          <AmountPanel\n            invoices={invoices}\n            value={value}\n            onValueChange={onValueChange}\n          />\n        </PopoverContent>\n      </Popover>\n      <AnimatePresence initial={false}>\n        {isFiltered && (\n          <motion.span\n            key='clear-amount'\n            variants={variants}\n            initial='enter'\n            animate='visible'\n            exit='exit'\n            transition={SWAP_TRANSITION}\n            className='flex'\n          >\n            <Button\n              variant='ghost'\n              size='icon-sm'\n              aria-label='Clear the amount filter'\n              onClick={() => onValueChange(FULL_RANGE)}\n              className='rounded-full'\n            >\n              <XIcon />\n            </Button>\n          </motion.span>\n        )}\n      </AnimatePresence>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/filters-01/amount-filter.tsx"
    },
    {
      "path": "registry/ndeko/blocks/filters/filters-01/invoice-model.ts",
      "content": "import {\n  AMOUNT_BOUNDS,\n  HISTOGRAM_BIN_COUNT,\n  type AmountRange,\n  type Invoice,\n  type StatusFilter,\n  WORKSPACE,\n} from './data';\n\nexport type HistogramBin = {\n  id: string;\n  count: number;\n  /** Share of the tallest bin, from 0 to 1. */\n  share: number;\n  isInRange: boolean;\n};\n\nexport const FULL_RANGE: AmountRange = [AMOUNT_BOUNDS.min, AMOUNT_BOUNDS.max];\n\nexport const CURRENCY_LOCALE = 'en-IE';\n\nexport const CURRENCY_FORMAT: Intl.NumberFormatOptions = {\n  style: 'currency',\n  currency: 'EUR',\n  maximumFractionDigits: 0,\n};\n\nconst CURRENCY = new Intl.NumberFormat(CURRENCY_LOCALE, CURRENCY_FORMAT);\n\nexport function formatAmount(amount: number) {\n  return CURRENCY.format(amount);\n}\n\nexport function isFullRange(range: AmountRange) {\n  const startsAtMinimum = range[0] === AMOUNT_BOUNDS.min;\n  const endsAtMaximum = range[1] === AMOUNT_BOUNDS.max;\n  return startsAtMinimum && endsAtMaximum;\n}\n\nexport function sameRange(first: AmountRange, second: AmountRange) {\n  const sameStart = first[0] === second[0];\n  const sameEnd = first[1] === second[1];\n  return sameStart && sameEnd;\n}\n\nexport function rangeLabelOf(range: AmountRange) {\n  if (range[1] === AMOUNT_BOUNDS.max) {\n    return `${formatAmount(range[0])} and over`;\n  }\n  if (range[0] === AMOUNT_BOUNDS.min) {\n    return `Up to ${formatAmount(range[1])}`;\n  }\n  return `${formatAmount(range[0])} – ${formatAmount(range[1])}`;\n}\n\nexport function matchesStatus(invoice: Invoice, status: StatusFilter) {\n  if (status === 'all') {\n    return true;\n  }\n  return invoice.status === status;\n}\n\nexport function isInRange(amount: number, range: AmountRange) {\n  const isAboveStart = amount >= range[0];\n  const isBelowEnd = amount <= range[1];\n  return isAboveStart && isBelowEnd;\n}\n\nexport function invoicesInRange(invoices: Invoice[], range: AmountRange) {\n  return invoices.filter((invoice) => isInRange(invoice.amount, range));\n}\n\nexport function totalOf(invoices: Invoice[]) {\n  let total = 0;\n  for (const invoice of invoices) {\n    total += invoice.amount;\n  }\n  return total;\n}\n\nexport function invoiceCountLabel(count: number) {\n  if (count === 1) {\n    return 'invoice';\n  }\n  return 'invoices';\n}\n\nfunction binIndexOf(amount: number, binWidth: number) {\n  const index = Math.floor((amount - AMOUNT_BOUNDS.min) / binWidth);\n  return Math.min(index, HISTOGRAM_BIN_COUNT - 1);\n}\n\nfunction tallestOf(counts: number[]) {\n  const tallest = Math.max(...counts);\n  return Math.max(tallest, 1);\n}\n\n/** A bin lights up when its middle sits inside the range, so a thumb dragged across a bin flips it once. */\nexport function histogramOf(invoices: Invoice[], range: AmountRange) {\n  const span = AMOUNT_BOUNDS.max - AMOUNT_BOUNDS.min;\n  const binWidth = span / HISTOGRAM_BIN_COUNT;\n  const counts: number[] = Array.from({ length: HISTOGRAM_BIN_COUNT }, () => 0);\n  for (const invoice of invoices) {\n    const index = binIndexOf(invoice.amount, binWidth);\n    counts[index] += 1;\n  }\n  const tallest = tallestOf(counts);\n  const bins: HistogramBin[] = counts.map((count, index) => {\n    const middle = AMOUNT_BOUNDS.min + binWidth * (index + 0.5);\n    return {\n      id: `bin-${index}`,\n      count,\n      share: count / tallest,\n      isInRange: isInRange(middle, range),\n    };\n  });\n  return bins;\n}\n\nfunction statusPhraseOf(status: StatusFilter) {\n  if (status === 'all') {\n    return 'No invoice';\n  }\n  return `No ${status} invoice`;\n}\n\nfunction rangePhraseOf(range: AmountRange) {\n  const start = formatAmount(range[0]);\n  const end = formatAmount(range[1]);\n  if (range[1] === AMOUNT_BOUNDS.max) {\n    return `of ${start} or more`;\n  }\n  if (range[0] === AMOUNT_BOUNDS.min) {\n    return `up to ${end}`;\n  }\n  return `between ${start} and ${end}`;\n}\n\nexport function emptyLineOf(status: StatusFilter, range: AmountRange) {\n  const subject = statusPhraseOf(status);\n  if (isFullRange(range)) {\n    return `${subject} in ${WORKSPACE.period}`;\n  }\n  const rangePhrase = rangePhraseOf(range);\n  return `${subject} ${rangePhrase}`;\n}\n",
      "type": "registry:component",
      "target": "components/blocks/filters-01/invoice-model.ts"
    },
    {
      "path": "registry/ndeko/blocks/filters/filters-01/motion-parts.tsx",
      "content": "'use client';\n\nimport { type MotionProps, type Transition } from 'motion/react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\n\nconst EASE_OUT_STRONG: [number, number, number, number] = [0.23, 1, 0.32, 1];\n\nconst ENTER: Transition = { duration: 0.2, ease: EASE_OUT_STRONG };\n\nconst EXIT: Transition = { duration: 0.14, ease: EASE_OUT_STRONG };\n\ntype PresenceProps = Pick<\n  MotionProps,\n  'initial' | 'animate' | 'exit' | 'transition'\n>;\n\nconst HEIGHT_PRESENCE: PresenceProps = {\n  initial: { height: 0, opacity: 0 },\n  animate: { height: 'auto', opacity: 1 },\n  exit: { height: 0, opacity: 0, transition: EXIT },\n  transition: ENTER,\n};\n\nexport const FADE_PRESENCE: PresenceProps = {\n  initial: { opacity: 0 },\n  animate: { opacity: 1 },\n  exit: { opacity: 0, transition: EXIT },\n  transition: ENTER,\n};\n\n/** Rows that join or leave a list open and close their own height, so what follows slides. */\nexport function useHeightPresence() {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  if (shouldReduceMotion) {\n    return FADE_PRESENCE;\n  }\n  return HEIGHT_PRESENCE;\n}\n",
      "type": "registry:component",
      "target": "components/blocks/filters-01/motion-parts.tsx"
    },
    {
      "path": "registry/ndeko/blocks/filters/filters-01/data.ts",
      "content": "export type InvoiceStatus = 'paid' | 'open' | 'overdue';\n\nexport type StatusFilter = 'all' | InvoiceStatus;\n\nexport type Invoice = {\n  id: string;\n  number: string;\n  client: string;\n  issuedOn: string;\n  amount: number;\n  status: InvoiceStatus;\n};\n\nexport type AmountRange = readonly [number, number];\n\nexport type AmountPreset = {\n  id: string;\n  label: string;\n  range: AmountRange;\n};\n\nexport const WORKSPACE = {\n  title: 'Invoices',\n  period: 'September and October',\n};\n\nexport const AMOUNT_BOUNDS = {\n  min: 0,\n  max: 6000,\n  step: 50,\n  /** The two thumbs never come closer than this, so a range always holds something. */\n  minGap: 250,\n};\n\nexport const HISTOGRAM_BIN_COUNT = 24;\n\nexport const STATUS_FILTERS: { id: StatusFilter; label: string }[] = [\n  { id: 'all', label: 'All' },\n  { id: 'paid', label: 'Paid' },\n  { id: 'open', label: 'Open' },\n  { id: 'overdue', label: 'Overdue' },\n];\n\nexport const STATUS_DETAILS: Record<\n  InvoiceStatus,\n  { label: string; color: string }\n> = {\n  paid: { label: 'Paid', color: 'var(--success)' },\n  open: { label: 'Open', color: 'var(--info)' },\n  overdue: { label: 'Overdue', color: 'var(--destructive)' },\n};\n\nexport const AMOUNT_PRESETS: AmountPreset[] = [\n  { id: 'small', label: 'Under €500', range: [0, 500] },\n  { id: 'medium', label: '€500 to €2,000', range: [500, 2000] },\n  { id: 'large', label: 'Over €2,000', range: [2000, 6000] },\n];\n\nexport const INVOICES: Invoice[] = [\n  {\n    id: 'inv-01',\n    number: 'INV-2041',\n    client: 'Fernhollow Bakery',\n    issuedOn: 'Oct 28',\n    amount: 180,\n    status: 'open',\n  },\n  {\n    id: 'inv-02',\n    number: 'INV-2040',\n    client: 'Saltmarsh Press',\n    issuedOn: 'Oct 27',\n    amount: 1240,\n    status: 'open',\n  },\n  {\n    id: 'inv-03',\n    number: 'INV-2039',\n    client: 'Okapi Freight',\n    issuedOn: 'Oct 25',\n    amount: 4860,\n    status: 'open',\n  },\n  {\n    id: 'inv-04',\n    number: 'INV-2038',\n    client: 'Quillmark Studio',\n    issuedOn: 'Oct 24',\n    amount: 320,\n    status: 'paid',\n  },\n  {\n    id: 'inv-05',\n    number: 'INV-2037',\n    client: 'Driftwood Yoga',\n    issuedOn: 'Oct 22',\n    amount: 95,\n    status: 'paid',\n  },\n  {\n    id: 'inv-06',\n    number: 'INV-2036',\n    client: 'Brightmoor Dental',\n    issuedOn: 'Oct 21',\n    amount: 760,\n    status: 'open',\n  },\n  {\n    id: 'inv-07',\n    number: 'INV-2035',\n    client: 'Tessaro Labs',\n    issuedOn: 'Oct 20',\n    amount: 2150,\n    status: 'paid',\n  },\n  {\n    id: 'inv-08',\n    number: 'INV-2034',\n    client: 'Marula Kitchens',\n    issuedOn: 'Oct 18',\n    amount: 410,\n    status: 'overdue',\n  },\n  {\n    id: 'inv-09',\n    number: 'INV-2033',\n    client: 'Cobalt Ridge Hotel',\n    issuedOn: 'Oct 17',\n    amount: 3420,\n    status: 'paid',\n  },\n  {\n    id: 'inv-10',\n    number: 'INV-2032',\n    client: 'Ironbark Builders',\n    issuedOn: 'Oct 15',\n    amount: 1680,\n    status: 'open',\n  },\n  {\n    id: 'inv-11',\n    number: 'INV-2031',\n    client: 'Petrel Analytics',\n    issuedOn: 'Oct 14',\n    amount: 260,\n    status: 'paid',\n  },\n  {\n    id: 'inv-12',\n    number: 'INV-2030',\n    client: 'Lumen Atelier',\n    issuedOn: 'Oct 12',\n    amount: 540,\n    status: 'paid',\n  },\n  {\n    id: 'inv-13',\n    number: 'INV-2029',\n    client: 'Fernhollow Bakery',\n    issuedOn: 'Oct 10',\n    amount: 145,\n    status: 'paid',\n  },\n  {\n    id: 'inv-14',\n    number: 'INV-2028',\n    client: 'Okapi Freight',\n    issuedOn: 'Oct 9',\n    amount: 5620,\n    status: 'overdue',\n  },\n  {\n    id: 'inv-15',\n    number: 'INV-2027',\n    client: 'Saltmarsh Press',\n    issuedOn: 'Oct 7',\n    amount: 880,\n    status: 'paid',\n  },\n  {\n    id: 'inv-16',\n    number: 'INV-2026',\n    client: 'Quillmark Studio',\n    issuedOn: 'Oct 6',\n    amount: 1320,\n    status: 'overdue',\n  },\n  {\n    id: 'inv-17',\n    number: 'INV-2025',\n    client: 'Driftwood Yoga',\n    issuedOn: 'Oct 3',\n    amount: 210,\n    status: 'paid',\n  },\n  {\n    id: 'inv-18',\n    number: 'INV-2024',\n    client: 'Tessaro Labs',\n    issuedOn: 'Oct 2',\n    amount: 2780,\n    status: 'open',\n  },\n  {\n    id: 'inv-19',\n    number: 'INV-2023',\n    client: 'Brightmoor Dental',\n    issuedOn: 'Sep 30',\n    amount: 690,\n    status: 'paid',\n  },\n  {\n    id: 'inv-20',\n    number: 'INV-2022',\n    client: 'Marula Kitchens',\n    issuedOn: 'Sep 28',\n    amount: 365,\n    status: 'paid',\n  },\n  {\n    id: 'inv-21',\n    number: 'INV-2021',\n    client: 'Petrel Analytics',\n    issuedOn: 'Sep 26',\n    amount: 1960,\n    status: 'paid',\n  },\n  {\n    id: 'inv-22',\n    number: 'INV-2020',\n    client: 'Cobalt Ridge Hotel',\n    issuedOn: 'Sep 24',\n    amount: 470,\n    status: 'overdue',\n  },\n  {\n    id: 'inv-23',\n    number: 'INV-2019',\n    client: 'Lumen Atelier',\n    issuedOn: 'Sep 23',\n    amount: 1150,\n    status: 'paid',\n  },\n  {\n    id: 'inv-24',\n    number: 'INV-2018',\n    client: 'Ironbark Builders',\n    issuedOn: 'Sep 21',\n    amount: 3980,\n    status: 'paid',\n  },\n  {\n    id: 'inv-25',\n    number: 'INV-2017',\n    client: 'Fernhollow Bakery',\n    issuedOn: 'Sep 19',\n    amount: 230,\n    status: 'paid',\n  },\n  {\n    id: 'inv-26',\n    number: 'INV-2016',\n    client: 'Saltmarsh Press',\n    issuedOn: 'Sep 17',\n    amount: 615,\n    status: 'paid',\n  },\n  {\n    id: 'inv-27',\n    number: 'INV-2015',\n    client: 'Driftwood Yoga',\n    issuedOn: 'Sep 15',\n    amount: 120,\n    status: 'overdue',\n  },\n  {\n    id: 'inv-28',\n    number: 'INV-2014',\n    client: 'Quillmark Studio',\n    issuedOn: 'Sep 12',\n    amount: 940,\n    status: 'paid',\n  },\n  {\n    id: 'inv-29',\n    number: 'INV-2013',\n    client: 'Tessaro Labs',\n    issuedOn: 'Sep 10',\n    amount: 1490,\n    status: 'paid',\n  },\n  {\n    id: 'inv-30',\n    number: 'INV-2012',\n    client: 'Okapi Freight',\n    issuedOn: 'Sep 8',\n    amount: 2460,\n    status: 'paid',\n  },\n  {\n    id: 'inv-31',\n    number: 'INV-2011',\n    client: 'Brightmoor Dental',\n    issuedOn: 'Sep 5',\n    amount: 335,\n    status: 'paid',\n  },\n  {\n    id: 'inv-32',\n    number: 'INV-2010',\n    client: 'Marula Kitchens',\n    issuedOn: 'Sep 3',\n    amount: 780,\n    status: 'paid',\n  },\n];\n",
      "type": "registry:component",
      "target": "components/blocks/filters-01/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "filters"
  ],
  "type": "registry:block"
}