{
  "name": "time-picker",
  "type": "ui:component",
  "title": "TimePicker",
  "description": "Accessible 12h/24h time selector with configurable minute step intervals.",
  "dependencies": [
    "@lucide/icons"
  ],
  "registryDependencies": [
    "theme",
    "icon"
  ],
  "files": [
    {
      "path": "src/ui/time-picker.tsx",
      "target": "src/ui/time-picker.tsx",
      "sha256": "a612cdecbb2526d42be4b31e16ed6a82e110f327dcd3f521714542248ea2fe58",
      "content": "import './theme.css';\nimport { Clock } from '@lucide/icons';\nimport { scope, type Ctx } from '@fierst/aster';\nimport { Icon } from './icon';\n\nconst tpScope = scope`\n  :scope { display: grid; gap: 0.375rem; font-family: var(--aster-font-sans); }\n  .tp-label { font-size: 0.84rem; font-weight: 500; color: var(--aster-on-surface); }\n  .tp-wrap {\n    display: flex;\n    align-items: center;\n    gap: 0.45rem;\n    min-height: var(--aster-control-md);\n    padding: 0 0.7rem;\n    border-radius: var(--aster-radius-control);\n    border: 1px solid var(--aster-input-border);\n    background: var(--aster-surface);\n    box-shadow: var(--aster-shadow-xs);\n    transition: border-color var(--aster-dur-fast), box-shadow var(--aster-dur-fast);\n  }\n  .tp-wrap:focus-within { border-color: var(--aster-primary); box-shadow: var(--aster-focus-ring); }\n  .tp-icon { color: var(--aster-on-surface-subtle); display: inline-flex; flex-shrink: 0; }\n  select {\n    flex: 1;\n    border: none;\n    outline: none;\n    background: transparent;\n    color: var(--aster-on-surface);\n    font: inherit;\n    font-size: 0.875rem;\n    font-family: var(--aster-font-mono);\n    cursor: pointer;\n  }\n`;\n\nfunction formatTime(totalMins: number, use24h: boolean): string {\n  const h = Math.floor(totalMins / 60);\n  const m = totalMins % 60;\n  const mm = String(m).padStart(2, '0');\n  if (use24h) return `${String(h).padStart(2, '0')}:${mm}`;\n  const period = h >= 12 ? 'PM' : 'AM';\n  const h12 = h % 12 || 12;\n  return `${h12}:${mm} ${period}`;\n}\n\nlet tpSeq = 0;\n\nexport function* TimePicker(\n  props: {\n    label?: string;\n    value?: string;\n    defaultValue?: string;\n    stepMinutes?: number;\n    use24h?: boolean;\n    disabled?: boolean;\n    onChange?: (hhmm: string) => void;\n    class?: string;\n  },\n  ctx: Ctx,\n) {\n  const uid = `aster-tp-${++tpSeq}`;\n  let internal = props.defaultValue ?? '09:00';\n\n  for (props of ctx) {\n    const step = Math.max(5, props.stepMinutes ?? 15);\n    const isControlled = props.value !== undefined;\n    const current = isControlled ? props.value! : internal;\n    const slots: { val: string; label: string }[] = [];\n    for (let mins = 0; mins < 24 * 60; mins += step) {\n      const h = String(Math.floor(mins / 60)).padStart(2, '0');\n      const m = String(mins % 60).padStart(2, '0');\n      slots.push({ val: `${h}:${m}`, label: formatTime(mins, Boolean(props.use24h)) });\n    }\n\n    yield (\n      <div class={[tpScope, props.class].filter(Boolean).join(' ')}>\n        {props.label ? (\n          <label class=\"tp-label\" for={uid}>\n            {props.label}\n          </label>\n        ) : null}\n        <div class=\"tp-wrap\">\n          <span class=\"tp-icon\" aria-hidden=\"true\">\n            <Icon icon={Clock} size={15} />\n          </span>\n          <select\n            id={uid}\n            value={current}\n            disabled={props.disabled}\n            onChange={(e: Event) => {\n              const next = (e.target as HTMLSelectElement).value;\n              if (!isControlled) internal = next;\n              props.onChange?.(next);\n            }}\n          >\n            {slots.map((s) => (\n              <option key={s.val} value={s.val} selected={s.val === current}>\n                {s.label}\n              </option>\n            ))}\n          </select>\n        </div>\n      </div>\n    );\n  }\n}\n"
    }
  ]
}
