{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "checkbox",
  "title": "Checkbox",
  "description": "A cut box that fills and marks when checked, with an indeterminate state.",
  "dependencies": [
    "@ui-sdk/react@0.1.0-beta.5"
  ],
  "registryDependencies": [
    "https://www.cyberspec.dev/r/cyber.json"
  ],
  "files": [
    {
      "path": "registry/cyber/ui/checkbox.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Checkbox as SdkCheckbox, CheckboxGroup as SdkCheckboxGroup, CheckboxIndicator } from \"@ui-sdk/react/checkbox\"\nimport \"@/registry/cyber/ui/cyber/checkbox.css\"\n\n// A cut box beside a line of text, like an objective on a job sheet. Checked,\n// it lights and a tick locks on; a partly checked set shows a bar instead.\n//\n// The row is a label, so the text toggles the box too. `hint` is a second\n// line under the text that describes the box without becoming part of its\n// name.\nfunction Checkbox({\n  label,\n  hint,\n  ...props\n}: Omit<React.ComponentProps<typeof SdkCheckbox>, \"children\"> & { label: string; hint?: string }) {\n  const hintId = React.useId()\n  return (\n    <div data-kit=\"checkbox-item\">\n      <label data-kit=\"checkbox-row\">\n        <SdkCheckbox\n          data-kit=\"checkbox\"\n          data-frame=\"br\"\n          data-press-flash=\"\"\n          data-parent={props.parent ? \"\" : undefined}\n          aria-describedby={hint ? hintId : undefined}\n          {...props}\n        >\n          <CheckboxIndicator data-kit=\"checkbox-indicator\" aria-hidden />\n        </SdkCheckbox>\n        <span data-kit=\"checkbox-label\">{label}</span>\n      </label>\n      {hint && (\n        <p data-kit=\"hint\" id={hintId}>\n          {hint}\n        </p>\n      )}\n    </div>\n  )\n}\n\n// Several boxes that make one value, under a legend. The legend counts what's\n// ticked against what's there (the stylesheet does the counting, so it's\n// right however the value changes), which a screen reader doesn't need: it\n// hears each box's state.\nfunction CheckboxGroup<T extends string = string>({\n  label,\n  hint,\n  children,\n  ...props\n}: React.ComponentProps<typeof SdkCheckboxGroup<T>> & { label: string; hint?: string }) {\n  const id = React.useId()\n  return (\n    <div data-kit=\"checkbox-set\">\n      <div data-kit=\"checkbox-legend\">\n        <span data-kit=\"label\" id={`${id}-label`}>\n          {label}\n        </span>\n      </div>\n      {hint && (\n        <p data-kit=\"hint\" id={`${id}-hint`}>\n          {hint}\n        </p>\n      )}\n      <SdkCheckboxGroup<T>\n        data-kit=\"checkbox-group\"\n        aria-labelledby={`${id}-label`}\n        aria-describedby={hint ? `${id}-hint` : undefined}\n        {...props}\n      >\n        {children}\n      </SdkCheckboxGroup>\n      <span data-kit=\"checkbox-count\" aria-hidden />\n    </div>\n  )\n}\n\nexport { Checkbox, CheckboxGroup }\n",
      "type": "registry:ui",
      "target": "@ui/checkbox.tsx"
    },
    {
      "path": "registry/cyber/ui/cyber/checkbox.css",
      "content": "@layer ui-sdk, cyber.tokens, cyber.base, cyber.ui, cyber.blocks, cyber.fx, cyber.a11y;\n\n@layer cyber.ui {\n  /* One box with its text, and the hint under the text if there is one. */\n  [data-skin=\"cyber\"] [data-kit=\"checkbox-item\"] {\n    --box: 18px;\n    --box-gap: 10px;\n\n    display: grid;\n    width: 100%;\n    min-width: 0;\n    text-align: start;\n\n    & > [data-kit=\"hint\"] {\n      /* Tucked up under the text, whatever the row's height. */\n      margin-block: calc((var(--cy-h) - 20px) / -2 + 2px) 6px;\n      padding-inline-start: calc(var(--box) + var(--box-gap));\n    }\n  }\n\n  /* The row is the target: the whole line toggles the box, and it's as tall\n     as any other control. The box sits on the first line of the text. */\n  [data-skin=\"cyber\"] [data-kit=\"checkbox-row\"] {\n    display: flex;\n    align-items: flex-start;\n    gap: var(--box-gap);\n    min-height: var(--cy-h);\n    padding-block: calc((var(--cy-h) - 20px) / 2);\n    cursor: pointer;\n\n    &:has([data-readonly]) {\n      cursor: default;\n    }\n\n    &:has([data-disabled]) {\n      cursor: not-allowed;\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"checkbox\"] {\n    --frame-cut: 5px;\n    --frame-line: var(--cy-line-ctl);\n    --frame-fill: var(--cy-panel);\n    /* A frame inherits the variables of a frame around it, so this one says\n       it has no image of its own. */\n    --frame-image: none;\n\n    flex: none;\n    display: grid;\n    place-items: center;\n    width: var(--box);\n    height: var(--box);\n    margin-block-start: 1px;\n    padding: 0;\n    cursor: inherit;\n    transition:\n      background-color var(--cy-t-fast) linear,\n      border-color var(--cy-t-fast) linear;\n\n    @media (hover: hover) {\n      [data-kit=\"checkbox-row\"]:hover > &:not([data-disabled], [data-readonly]) {\n        --frame-line: var(--cy-line-hot);\n        --frame-fill: var(--cy-fill-hover);\n      }\n    }\n\n    &:is([data-checked], [data-indeterminate]) {\n      --frame-line: var(--cy-line-hot);\n      --frame-fill: var(--cy-fill-active);\n    }\n\n    @media (hover: hover) {\n      [data-kit=\"checkbox-row\"]:hover > &:is([data-checked], [data-indeterminate]):not([data-disabled], [data-readonly]) {\n        --frame-fill: color-mix(in srgb, var(--cy-accent) 52%, var(--cy-panel));\n      }\n    }\n\n    /* Yellow, not red: red is what every box already is. */\n    &:is([aria-invalid=\"true\"], [data-invalid]) {\n      --frame-line: var(--cy-flag);\n    }\n\n    &[data-disabled] {\n      --frame-line: var(--cy-line-deco);\n      --frame-fill: var(--cy-panel);\n      --frame-image: repeating-linear-gradient(135deg, transparent 0 4px, var(--cy-line-deco) 4px 5px);\n    }\n  }\n\n  /* The mark, in the signal color like every selection mark: a tick, or a\n     bar for a partly checked set. It arrives oversized and steps down onto\n     the box, like a reticle locking. */\n  [data-skin=\"cyber\"] [data-kit=\"checkbox-indicator\"] {\n    display: block;\n    width: 10px;\n    height: 10px;\n    background: var(--cy-signal);\n    clip-path: polygon(0 52%, 15% 37%, 38% 60%, 85% 10%, 100% 25%, 38% 90%);\n    transition:\n      opacity var(--cy-t-fast) linear,\n      scale var(--cy-t) var(--cy-ease-step);\n\n    &[data-indeterminate] {\n      clip-path: inset(4px 0);\n    }\n\n    &[data-disabled] {\n      background: var(--cy-ink-mute);\n    }\n\n    &:is([data-starting-style], [data-ending-style]) {\n      opacity: 0;\n      scale: 1.9;\n    }\n  }\n\n  /* What the box is for. It's whatever was written, a word or a sentence, so\n     it isn't uppercased. The box's hidden native input sits between the two,\n     so the state is read from any earlier sibling. */\n  [data-skin=\"cyber\"] [data-kit=\"checkbox-label\"] {\n    min-width: 0;\n    font-size: var(--cy-text-md);\n    font-weight: 500;\n    line-height: 20px;\n    color: var(--cy-ink);\n    text-wrap: pretty;\n    user-select: none;\n    transition: color var(--cy-t-fast) linear;\n\n    :is([data-checked], [data-indeterminate]) ~ & {\n      color: var(--cy-ink-hi);\n    }\n\n    [data-disabled] ~ & {\n      color: var(--cy-ink-mute);\n    }\n  }\n\n  /* A set of boxes: a legend with a rule running off it and a count at the\n     end of the rule, then the boxes. */\n  [data-skin=\"cyber\"] [data-kit=\"checkbox-set\"] {\n    display: grid;\n    grid-template-columns: minmax(0, 1fr) auto;\n    column-gap: 8px;\n    width: 100%;\n    min-width: 0;\n    text-align: start;\n    counter-reset: cy-box cy-box-on;\n\n    & > :is([data-kit=\"hint\"], [data-kit=\"checkbox-group\"]) {\n      grid-column: 1 / -1;\n    }\n\n    & > [data-kit=\"hint\"] {\n      margin-block-start: 2px;\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"checkbox-legend\"] {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    min-width: 0;\n\n    &::after {\n      content: \"\";\n      flex: 1;\n      min-width: 12px;\n      height: 1px;\n      background: var(--cy-line-deco);\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"checkbox-group\"] {\n    display: grid;\n    margin-block-start: 4px;\n\n    /* Every box counts, and every ticked one counts twice; a box that checks\n       the whole set isn't one of the things being counted. */\n    & [data-kit=\"checkbox\"]:not([data-parent]) {\n      counter-increment: cy-box;\n\n      &[data-checked] {\n        counter-increment: cy-box cy-box-on;\n      }\n    }\n  }\n\n  /* The count comes after the boxes in the page, where the counters have\n     their totals, and is placed back up beside the legend. */\n  [data-skin=\"cyber\"] [data-kit=\"checkbox-count\"] {\n    grid-area: 1 / 2;\n    align-self: center;\n    font-family: var(--cy-mono);\n    font-size: var(--cy-text-xs);\n    color: var(--cy-signal);\n\n    &::before {\n      content: counter(cy-box-on, decimal-leading-zero) \"/\" counter(cy-box, decimal-leading-zero);\n    }\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/cyber/checkbox.css"
    }
  ],
  "type": "registry:ui"
}
