{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "month-field",
  "type": "registry:ui",
  "title": "Month Field",
  "dependencies": [
    "@base-ui-next/react",
    "class-variance-authority"
  ],
  "registryDependencies": [
    "https://hamur.dev/r/react/utils.json",
    "https://hamur.dev/r/react/button.json"
  ],
  "files": [
    {
      "path": "react/month-field.tsx",
      "content": "'use client'\n\nimport type * as React from 'react' // base-ui-next/ui month-field@0.1.1\nimport { MonthField as MonthFieldPrimitive } from '@base-ui-next/react/month-field'\nimport type { VariantProps } from 'class-variance-authority'\nimport { cn } from '@/lib/utils'\nimport { buttonVariants } from '@/components/ui/button'\n\nconst monthFieldClassName =\n  'flex h-9 w-fit max-w-full min-w-0 items-center rounded-md border border-input px-2 shadow-xs transition-[color,box-shadow] outline-none data-focused:border-ring data-focused:ring-3 data-focused:ring-ring/50 data-invalid:border-destructive data-invalid:ring-3 data-invalid:ring-destructive/20 data-invalid:data-focused:border-destructive data-invalid:data-focused:ring-destructive/20 data-disabled:cursor-not-allowed data-disabled:opacity-50 dark:bg-input/30 dark:data-invalid:border-destructive/50 dark:data-invalid:ring-destructive/40 dark:data-invalid:data-focused:border-destructive/50 dark:data-invalid:data-focused:ring-destructive/40'\n\n/** The segments' row; a literal between them is a muted `span`. */\nconst monthFieldInputClassName = 'flex min-w-0 items-center'\n\n/** One editable segment is an `input` as wide as its digits; its placeholder is the dimmed text. */\nconst monthFieldSegmentClassName =\n  'h-7 w-[calc(2ch+--spacing(1))] min-w-0 rounded-sm bg-transparent px-0.5 py-0 text-center text-base tabular-nums caret-transparent outline-none selection:bg-transparent placeholder:text-muted-foreground read-only:cursor-default focus:bg-accent focus:text-accent-foreground focus:placeholder:text-accent-foreground disabled:cursor-not-allowed data-placeholder:text-muted-foreground data-invalid:text-destructive data-invalid:underline data-invalid:decoration-dashed data-invalid:underline-offset-4 data-[type=dayPeriod]:w-[calc(3ch+--spacing(1))] data-[type=literal]:w-auto data-[type=literal]:px-0 data-[type=literal]:text-muted-foreground data-[type=millisecond]:w-[calc(3ch+--spacing(1))] data-[type=year]:w-[calc(4ch+--spacing(1))] md:text-sm'\n\n/** A ghost icon button at the box's end, hidden while no segment has a value. */\nconst monthFieldClearClassName =\n  'ms-auto -me-1.5 size-6 text-muted-foreground data-empty:invisible'\n\ntype ButtonVariants = VariantProps<typeof buttonVariants>\n\n// lucide's icons, inline and hidden from assistive technology (10 · As built, BN-309).\nfunction SvgIcon({ children, ...props }: React.ComponentProps<'svg'>) {\n  return (\n    <svg\n      xmlns=\"http://www.w3.org/2000/svg\"\n      viewBox=\"0 0 24 24\"\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth=\"2\"\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n      aria-hidden=\"true\"\n      {...props}\n    >\n      {children}\n    </svg>\n  )\n}\n\n// No shadcn item: one name per Base UI part (docs/design/log/month-year-picker.md).\nfunction MonthField({ className, ...props }: MonthFieldPrimitive.Root.Props) {\n  return (\n    <MonthFieldPrimitive.Root\n      data-slot=\"month-field\"\n      className={cn(monthFieldClassName, className)}\n      {...props}\n    />\n  )\n}\n\n/** Without children it renders every segment, styled, in the locale's order. */\nfunction MonthFieldInput({ className, children, ...props }: MonthFieldPrimitive.Input.Props) {\n  return (\n    <MonthFieldPrimitive.Input\n      data-slot=\"month-field-input\"\n      className={cn(monthFieldInputClassName, className)}\n      {...props}\n    >\n      {children ??\n        (({ segments }) =>\n          segments.map((segment) => <MonthFieldSegment key={segment.index} segment={segment} />))}\n    </MonthFieldPrimitive.Input>\n  )\n}\n\nfunction MonthFieldSegment({ className, ...props }: MonthFieldPrimitive.Segment.Props) {\n  return (\n    <MonthFieldPrimitive.Segment\n      data-slot=\"month-field-segment\"\n      className={cn(monthFieldSegmentClassName, className)}\n      {...props}\n    />\n  )\n}\n\n/** A ghost icon button with lucide's X; Base UI names it \"Clear\" whatever its content. */\nfunction MonthFieldClear({\n  className,\n  children,\n  variant = 'ghost',\n  size = 'icon-xs',\n  ...props\n}: MonthFieldPrimitive.Clear.Props & ButtonVariants) {\n  return (\n    <MonthFieldPrimitive.Clear\n      data-slot=\"month-field-clear\"\n      className={cn(buttonVariants({ variant, size }), monthFieldClearClassName, className)}\n      {...props}\n    >\n      {children ?? (\n        <SvgIcon>\n          <path d=\"M18 6 6 18\" />\n          <path d=\"m6 6 12 12\" />\n        </SvgIcon>\n      )}\n    </MonthFieldPrimitive.Clear>\n  )\n}\n\nexport { MonthField, MonthFieldClear, MonthFieldInput, MonthFieldSegment }\n",
      "type": "registry:ui",
      "target": "@ui/month-field.tsx"
    }
  ],
  "meta": {
    "baseUiNext": {
      "version": "0.1.1",
      "hash": "aca04bf71c749fb1ca22edfee91385a80a009bdeec722739ba476d2902dd9e74",
      "files": {
        "@ui/month-field.tsx": "2a64516d8a27cca80b814ee1a0309f1824bd1632724fe4970430f65d590f3683"
      }
    }
  }
}
