{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "date-picker",
  "title": "Date picker",
  "description": "A date field with a calendar that opens beside it.",
  "dependencies": [
    "@ui-sdk/react@0.1.0-beta.5",
    "lucide-react@1.73.0"
  ],
  "registryDependencies": [
    "https://www.cyberspec.dev/r/cyber.json",
    "https://www.cyberspec.dev/r/calendar.json"
  ],
  "files": [
    {
      "path": "registry/cyber/ui/date-picker.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport {\n  DatePicker as SdkDatePicker,\n  DatePickerContent,\n  DatePickerHint,\n  DatePickerInput,\n  DatePickerTrigger,\n} from \"@ui-sdk/react/date-picker\"\nimport { Field, FieldDescription, FieldError, FieldLabel } from \"@ui-sdk/react/field\"\nimport { CalendarDays } from \"lucide-react\"\nimport { CalendarView } from \"@/registry/cyber/ui/calendar\"\nimport \"@/registry/cyber/ui/cyber/calendar.css\"\nimport \"@/registry/cyber/ui/cyber/date-picker.css\"\n\n// Tells the field, which sits outside the picker, whether the text in the\n// picker is a date. Renders nothing.\nfunction Report({ invalid, onChange }: { invalid: boolean; onChange: (invalid: boolean) => void }) {\n  React.useEffect(() => onChange(invalid), [invalid, onChange])\n  return null\n}\n\n// A date you can type or pick: the text sits in the shared control frame\n// with a calendar key at its end, and the key opens the kit's calendar in a\n// popup. The format the field reads is printed beside the label, in the\n// page's language, and describes the input to a screen reader.\n//\n// - `hint` sits under the control. `error` is the message shown, in yellow,\n//   while the field is invalid; pass `invalid` to show it from your own\n//   code. Text that isn't a date flags the field by itself, as soon as it's\n//   entered, with the SDK's own message.\n// - Everything else goes to the SDK's DatePicker: `value`, `defaultValue`\n//   and `onValueChange` (ISO dates, like \"2026-11-21\"), `min`, `max`,\n//   `unavailable`, `name`, `required`, `disabled`, `controller`.\nfunction DatePicker({\n  label,\n  hint,\n  error,\n  invalid,\n  disabled,\n  ...props\n}: Omit<React.ComponentProps<typeof SdkDatePicker>, \"children\" | \"mode\"> & {\n  label: string\n  hint?: string\n  error?: string\n  invalid?: boolean\n}) {\n  // The popup hangs from the whole framed control, not the bare input in it.\n  const [control, setControl] = React.useState<HTMLDivElement | null>(null)\n  // Left alone, a field only reports what the browser finds wrong once its\n  // form is submitted. Text that isn't a date turns the frame yellow at\n  // once, so the words have to arrive with it.\n  const [unread, setUnread] = React.useState(false)\n\n  return (\n    <Field data-kit=\"field\" disabled={disabled} invalid={invalid ?? (unread ? true : undefined)}>\n      <SdkDatePicker data-kit=\"date-picker\" disabled={disabled} {...props}>\n        {(state) => (\n          <>\n            <Report invalid={state.invalid} onChange={setUnread} />\n            <div data-kit=\"date-picker-head\">\n              <FieldLabel data-kit=\"label\">{label}</FieldLabel>\n              <DatePickerHint data-kit=\"date-picker-format\" />\n            </div>\n            <div ref={setControl} data-kit=\"control\" data-frame=\"br\" data-frame-focus=\"within\">\n              {/* The frame lights for whichever of these has focus, so\n                  neither draws a ring of its own. */}\n              <DatePickerInput data-focus-quiet=\"\" />\n              <DatePickerTrigger data-kit=\"date-picker-trigger\" data-focus-quiet=\"\">\n                <CalendarDays aria-hidden />\n              </DatePickerTrigger>\n            </div>\n            <DatePickerContent data-kit=\"date-picker-popup\" data-frame=\"tr bl\" anchor={control} align=\"start\" sideOffset={4}>\n              <CalendarView />\n            </DatePickerContent>\n          </>\n        )}\n      </SdkDatePicker>\n      {hint && <FieldDescription data-kit=\"hint\">{hint}</FieldDescription>}\n      {invalid && error ? (\n        <FieldError data-kit=\"field-error\" match>\n          {error}\n        </FieldError>\n      ) : (\n        <FieldError data-kit=\"field-error\">{unread ? undefined : error}</FieldError>\n      )}\n    </Field>\n  )\n}\n\nexport { DatePicker }\n",
      "type": "registry:ui",
      "target": "@ui/date-picker.tsx"
    },
    {
      "path": "registry/cyber/ui/cyber/date-picker.css",
      "content": "@layer ui-sdk, cyber.tokens, cyber.base, cyber.ui, cyber.blocks, cyber.fx, cyber.a11y;\n\n/* The input sits in the shared control frame (field.css) and the popup\n   holds the calendar's own parts (calendar.css); this is the row over the\n   control, the key at its end, and the popup's frame. */\n@layer cyber.ui {\n  [data-skin=\"cyber\"] [data-kit=\"date-picker\"] {\n    display: grid;\n    gap: 6px;\n    min-width: 0;\n  }\n\n  /* The label, and the format the field reads, as a tag at the other end. */\n  [data-skin=\"cyber\"] [data-kit=\"date-picker-head\"] {\n    display: flex;\n    align-items: baseline;\n    justify-content: space-between;\n    gap: 12px;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"date-picker-format\"] {\n    font-family: var(--cy-mono);\n    font-size: 10px;\n    letter-spacing: 0.06em;\n    text-transform: uppercase;\n    white-space: nowrap;\n    color: var(--cy-ink-mute);\n  }\n\n  /* The calendar key. It's inside the frame, which lights for whichever of\n     its children has focus, so the key also marks itself when it's the one. */\n  [data-skin=\"cyber\"] [data-kit=\"date-picker-trigger\"] {\n    flex: none;\n    display: grid;\n    place-items: center;\n    width: 24px;\n    height: 24px;\n    margin-inline-end: -4px;\n    padding: 0;\n    border: 0;\n    background: none;\n    color: var(--cy-ink);\n    cursor: pointer;\n    transition:\n      color var(--cy-t-fast) linear,\n      background-color var(--cy-t-fast) linear;\n\n    @media (pointer: coarse) {\n      width: 36px;\n      height: 36px;\n    }\n\n    & svg {\n      width: 16px;\n      height: 16px;\n    }\n\n    @media (hover: hover) {\n      &:hover:not([data-disabled]) {\n        color: var(--cy-ink-hi);\n        background: var(--cy-fill-hover);\n      }\n    }\n\n    &[data-open] {\n      color: var(--cy-ink-hi);\n      background: var(--cy-fill-active);\n    }\n\n    &:focus-visible {\n      color: var(--cy-on-solid);\n      background: var(--cy-signal);\n    }\n\n    &[data-disabled] {\n      color: var(--cy-ink-mute);\n      cursor: not-allowed;\n    }\n  }\n\n  /* The popup: the same hot frame as the kit's floating lists, sized to the\n     calendar it holds. */\n  [data-skin=\"cyber\"] [data-kit=\"date-picker-popup\"] {\n    --frame-cut: var(--cy-cut);\n    --frame-line: var(--cy-line-hot);\n    --frame-fill: var(--cy-panel);\n\n    display: grid;\n    gap: 8px;\n    width: min(264px, calc(100vw - 16px));\n    margin: 0;\n    padding: 10px;\n    outline: none;\n\n    @media (pointer: coarse) {\n      width: min(344px, calc(100vw - 16px));\n    }\n\n    &[data-open] {\n      animation: var(--cy-fx-in) 200ms var(--cy-ease-snap) backwards;\n    }\n    &[data-ending-style] {\n      animation: var(--cy-fx-out) 120ms var(--cy-ease-snap) both;\n    }\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/cyber/date-picker.css"
    }
  ],
  "type": "registry:ui"
}
