{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "core-status-indicator",
  "type": "registry:lib",
  "title": "core/status-indicator",
  "description": "Framework-free behaviour shared by the ui-* components (status-indicator); no DOM, no lit. Copied from @purpurabog/ui 2.3.0; the package is the maintained source, this copy is yours to change. Icons from the Carbon Design System (Apache-2.0, © IBM Corp.; see THIRD-PARTY-NOTICES.md in the package).",
  "dependencies": [],
  "registryDependencies": [],
  "files": [
    {
      "path": "src/core/status-indicator.ts",
      "type": "registry:lib",
      "target": "components/ui/core/status-indicator.ts",
      "content": "/**\n * Carbon's status indicators (preview IconIndicator / ShapeIndicator): which Carbon icon each kind\n * shows and in which status colour. Only the painted paths are kept (the icons' transparent\n * \"inner-path\" layers are left out, except where Carbon fills them: the black \"!\" of the cautions).\n */\n\n/** How a path is painted: the kind's status colour, its darker outline, or black (Carbon `$black`). */\nexport type StatusTone = 'status' | 'outline' | 'black';\n\nexport interface StatusPath {\n    d: string;\n    tone?: StatusTone;\n}\n\nexport interface StatusIcon {\n    viewBox: string;\n    paths: readonly StatusPath[];\n}\n\n/** A kind's look: the icon, its `--ui-status-*` colour and, for two-tone shapes, the outline colour. */\nexport interface StatusLook {\n    icon: StatusIcon;\n    color: string;\n    outline?: string;\n}\n\nexport const ICON_INDICATOR_KINDS = ['failed', 'caution-major', 'caution-minor', 'undefined', 'succeeded', 'normal', 'in-progress', 'incomplete', 'not-started', 'pending', 'unknown', 'informative'] as const;\nexport type IconIndicatorKind = (typeof ICON_INDICATOR_KINDS)[number];\n\nexport const SHAPE_INDICATOR_KINDS = ['failed', 'critical', 'high', 'medium', 'low', 'cautious', 'undefined', 'stable', 'informative', 'incomplete', 'draft'] as const;\nexport type ShapeIndicatorKind = (typeof SHAPE_INDICATOR_KINDS)[number];\n\nconst grid32 = (...paths: (string | StatusPath)[]): StatusIcon => ({ viewBox: '0 0 32 32', paths: paths.map((p) => (typeof p === 'string' ? { d: p } : p)) });\nconst grid16 = (...paths: (string | StatusPath)[]): StatusIcon => ({ viewBox: '0 0 16 16', paths: paths.map((p) => (typeof p === 'string' ? { d: p } : p)) });\n\n// @carbon/icons: ErrorFilled and CheckmarkFilled have their own 16 and 20 drawings, the rest scale the 32 grid\nexport const ERROR_FILLED = {\n    16: grid16('M8,1C4.1,1,1,4.1,1,8s3.1,7,7,7s7-3.1,7-7S11.9,1,8,1z M10.7,11.5L4.5,5.3l0.8-0.8l6.2,6.2L10.7,11.5z'),\n    20: { viewBox: '0 0 20 20', paths: [{ d: 'M10,1c-5,0-9,4-9,9s4,9,9,9s9-4,9-9S15,1,10,1z M13.5,14.5l-8-8l1-1l8,8L13.5,14.5z' }] },\n};\nexport const CHECKMARK_FILLED = {\n    16: grid16('M8,1C4.1,1,1,4.1,1,8c0,3.9,3.1,7,7,7s7-3.1,7-7C15,4.1,11.9,1,8,1z M7,11L4.3,8.3l0.9-0.8L7,9.3l4-3.9l0.9,0.8L7,11z'),\n    20: { viewBox: '0 0 20 20', paths: [{ d: 'M10,1c-4.9,0-9,4.1-9,9s4.1,9,9,9s9-4,9-9S15,1,10,1z M8.7,13.5l-3.2-3.2l1-1l2.2,2.2l4.8-4.8l1,1L8.7,13.5z' }] },\n};\nconst WARNING_ALT_INVERTED_FILLED = grid32(\n    { d: 'M16,20a1.5,1.5,0,1,1,1.5-1.5A1.5,1.5,0,0,1,16,20Zm-1.125-5h2.25V6h-2.25Z', tone: 'black' },\n    'M27.3494,4H4.6506l-.0019.0034L15.998,25.8286h.004L27.3513,4.0034ZM14.875,6h2.25v9h-2.25ZM16,20a1.5,1.5,0,1,1,1.5-1.5A1.5,1.5,0,0,1,16,20Z',\n    'M29.855,2.481a1.001,1.001,0,0,1,.0322.98l-13,25a1,1,0,0,1-1.7744,0l-13-25A1,1,0,0,1,3,2H29A1.0007,1.0007,0,0,1,29.855,2.481ZM4.6487,4.0033,15.998,25.8286h.004L27.3513,4.0033,27.3493,4H4.6507Z',\n);\nconst WARNING_ALT_FILLED = grid32(\n    { d: 'M16,26a1.5,1.5,0,1,1,1.5-1.5A1.5,1.5,0,0,1,16,26Zm-1.125-5h2.25V12h-2.25Z', tone: 'black' },\n    'M16.002,6.1714h-.004L4.6487,27.9966,4.6506,28H27.3494l.0019-.0034ZM14.875,12h2.25v9h-2.25ZM16,26a1.5,1.5,0,1,1,1.5-1.5A1.5,1.5,0,0,1,16,26Z',\n    'M29,30H3a1,1,0,0,1-.8872-1.4614l13-25a1,1,0,0,1,1.7744,0l13,25A1,1,0,0,1,29,30ZM4.6507,28H27.3493l.002-.0033L16.002,6.1714h-.004L4.6487,27.9967Z',\n);\nconst UNDEFINED_FILLED = grid32(\n    'M29.391,14.527L17.473,2.609C17.067,2.203,16.533,2,16,2s-1.067,0.203-1.473,0.609L2.609,14.527C2.203,14.933,2,15.466,2,16s0.203,1.067,0.609,1.473l11.917,11.917C14.933,29.797,15.467,30,16,30s1.067-0.203,1.473-0.609l11.917-11.917C29.797,17.067,30,16.534,30,16S29.797,14.933,29.391,14.527z M21,18H11v-4h10V18z',\n);\nconst CHECKMARK_OUTLINE = grid32('M14 21.414 9 16.413 10.413 15 14 18.586 21.585 11 23 12.415 14 21.414z', 'M16,2A14,14,0,1,0,30,16,14,14,0,0,0,16,2Zm0,26A12,12,0,1,1,28,16,12,12,0,0,1,16,28Z');\nconst IN_PROGRESS = grid32('M16,2A14,14,0,1,0,30,16,14.0158,14.0158,0,0,0,16,2Zm0,26A12,12,0,0,1,16,4V16l8.4812,8.4814A11.9625,11.9625,0,0,1,16,28Z');\nconst INCOMPLETE = grid32(\n    'M23.7642,6.8593l1.2851-1.5315A13.976,13.976,0,0,0,20.8672,2.887l-.6836,1.8776A11.9729,11.9729,0,0,1,23.7642,6.8593Z',\n    'M27.81,14l1.9677-.4128A13.8888,13.8888,0,0,0,28.14,9.0457L26.4087,10A12.52,12.52,0,0,1,27.81,14Z',\n    'M20.1836,27.2354l.6836,1.8776a13.976,13.976,0,0,0,4.1821-2.4408l-1.2851-1.5315A11.9729,11.9729,0,0,1,20.1836,27.2354Z',\n    'M26.4087,22,28.14,23a14.14,14.14,0,0,0,1.6382-4.5872L27.81,18.0659A12.1519,12.1519,0,0,1,26.4087,22Z',\n    'M16,30V2a14,14,0,0,0,0,28Z',\n);\nconst CIRCLE_DASH = grid32(\n    'M7.7,4.7a14.7,14.7,0,0,0-3,3.1L6.3,9A13.26,13.26,0,0,1,8.9,6.3Z',\n    'M4.6,12.3l-1.9-.6A12.51,12.51,0,0,0,2,16H4A11.48,11.48,0,0,1,4.6,12.3Z',\n    'M2.7,20.4a14.4,14.4,0,0,0,2,3.9l1.6-1.2a12.89,12.89,0,0,1-1.7-3.3Z',\n    'M7.8,27.3a14.4,14.4,0,0,0,3.9,2l.6-1.9A12.89,12.89,0,0,1,9,25.7Z',\n    'M11.7,2.7l.6,1.9A11.48,11.48,0,0,1,16,4V2A12.51,12.51,0,0,0,11.7,2.7Z',\n    'M24.2,27.3a15.18,15.18,0,0,0,3.1-3.1L25.7,23A11.53,11.53,0,0,1,23,25.7Z',\n    'M27.4,19.7l1.9.6A15.47,15.47,0,0,0,30,16H28A11.48,11.48,0,0,1,27.4,19.7Z',\n    'M29.2,11.6a14.4,14.4,0,0,0-2-3.9L25.6,8.9a12.89,12.89,0,0,1,1.7,3.3Z',\n    'M24.1,4.6a14.4,14.4,0,0,0-3.9-2l-.6,1.9a12.89,12.89,0,0,1,3.3,1.7Z',\n    'M20.3,29.3l-.6-1.9A11.48,11.48,0,0,1,16,28v2A21.42,21.42,0,0,0,20.3,29.3Z',\n);\nconst PENDING_FILLED = grid32('M16,2A14,14,0,1,0,30,16,14,14,0,0,0,16,2ZM8,18a2,2,0,1,1,2-2A2,2,0,0,1,8,18Zm8,0a2,2,0,1,1,2-2A2,2,0,0,1,16,18Zm8,0a2,2,0,1,1,2-2A2,2,0,0,1,24,18Z');\nconst UNKNOWN_FILLED = grid32(\n    'M29.391,14.527L17.473,2.609C17.067,2.203,16.533,2,16,2s-1.067,0.203-1.473,0.609L2.609,14.527C2.203,14.933,2,15.466,2,16s0.203,1.067,0.609,1.473l11.917,11.917C14.933,29.797,15.467,30,16,30s1.067-0.203,1.473-0.609l11.917-11.917C29.797,17.067,30,16.534,30,16S29.797,14.933,29.391,14.527z M16,24c-0.828,0-1.5-0.671-1.5-1.5S15.172,21,16,21s1.5,0.671,1.5,1.5S16.828,24,16,24z M17.125,17.248v1.877h-2.25V15H17c1.034,0,1.875-0.841,1.875-1.875S18.034,11.25,17,11.25h-2c-1.034,0-1.875,0.841-1.875,1.875v0.5h-2.25v-0.5C10.875,10.851,12.726,9,15,9h2c2.274,0,4.125,1.851,4.125,4.125C21.125,15.358,19.342,17.182,17.125,17.248z',\n);\nconst WARNING_SQUARE_FILLED = grid32('M26.0022,4H5.998A1.998,1.998,0,0,0,4,5.998V26.002A1.998,1.998,0,0,0,5.998,28H26.0022A1.9979,1.9979,0,0,0,28,26.002V5.998A1.9979,1.9979,0,0,0,26.0022,4ZM14.8752,8h2.25V18h-2.25ZM16,24a1.5,1.5,0,1,1,1.5-1.5A1.5,1.5,0,0,1,16,24Z');\n\n// the shapes (16 grid only)\nconst CRITICAL = grid16('M12.887,11.4727a5.9936,5.9936,0,0,0-8.36-8.3594Z', 'M3.113,4.5273a5.9936,5.9936,0,0,0,8.36,8.3594Z');\nconst CRITICAL_SEVERITY = grid16('M13 13 3 13 3 3 13 13z');\nconst CAUTION_OUTLINE = 'M12.3154,12H3.6846L8,4.0884,12.3154,12M14,13,8,2,2,13Z';\nconst CAUTION_FILL = 'M12.315 12 3.685 12 8 4.088 12.315 12z';\nconst DIAMOND_OUTLINE = 'M8,2.4142,13.5858,8,8,13.5858,2.4142,8,8,2.4142M8,1,1,8l7,7,7-7L8,1Z';\nconst DIAMOND_FILL = 'M8,2.4142,13.5858,8,8,13.5858,2.4142,8,8,2.4142';\nconst LOW_FILL = 'M4 4H12V12H4z';\nconst LOW_OUTLINE = 'M12,4v8H4V4h8m1-1H3V13H13V3Z';\nconst CIRCLE_FILL = grid16('M8,2a6,6,0,1,0,6,6A6,6,0,0,0,8,2Z');\nconst CIRCLE_STROKE = grid16('M8,4A4,4,0,1,1,4,8,4.0045,4.0045,0,0,1,8,4M8,2a6,6,0,1,0,6,6A6,6,0,0,0,8,2Z');\n// Carbon draws this one in the component (a half-filled circle)\nconst HALF_CIRCLE = grid16('M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2Zm0 2a4.004 4.004 0 0 1 4 4H4a4.004 4.004 0 0 1 4-4Z');\n\nconst status = (name: string) => `var(--ui-status-${name})`;\n\n/** Carbon IconIndicator: the icon of a kind at 16 or 20px, and its colour. */\nexport function iconIndicatorLook(kind: IconIndicatorKind, size: 16 | 20 = 16): StatusLook {\n    switch (kind) {\n        case 'failed':\n            return { icon: ERROR_FILLED[size], color: status('red') };\n        case 'caution-major':\n            return { icon: WARNING_ALT_INVERTED_FILLED, color: status('orange') };\n        case 'caution-minor':\n            return { icon: WARNING_ALT_FILLED, color: status('yellow') };\n        case 'undefined':\n            return { icon: UNDEFINED_FILLED, color: status('purple') };\n        case 'succeeded':\n            return { icon: CHECKMARK_FILLED[size], color: status('green') };\n        case 'normal':\n            return { icon: CHECKMARK_OUTLINE, color: status('blue') };\n        case 'in-progress':\n            return { icon: IN_PROGRESS, color: status('blue') };\n        case 'incomplete':\n            return { icon: INCOMPLETE, color: status('blue') };\n        case 'not-started':\n            return { icon: CIRCLE_DASH, color: status('gray') };\n        case 'pending':\n            return { icon: PENDING_FILLED, color: status('gray') };\n        case 'unknown':\n            return { icon: UNKNOWN_FILLED, color: status('gray') };\n        default:\n            return { icon: WARNING_SQUARE_FILLED, color: status('blue') };\n    }\n}\n\n/** Carbon ShapeIndicator: the 16px shape of a kind, its colour and (medium, low, cautious) its outline colour. */\nexport function shapeIndicatorLook(kind: ShapeIndicatorKind): StatusLook {\n    switch (kind) {\n        case 'failed':\n            return { icon: CRITICAL, color: status('red') };\n        case 'critical':\n            return { icon: CRITICAL_SEVERITY, color: status('red') };\n        case 'high':\n            return { icon: grid16(CAUTION_OUTLINE, CAUTION_FILL), color: status('red') };\n        case 'medium':\n            return { icon: grid16({ d: DIAMOND_OUTLINE, tone: 'outline' }, DIAMOND_FILL), color: status('orange'), outline: status('orange-outline') };\n        case 'low':\n            return { icon: grid16(LOW_FILL, { d: LOW_OUTLINE, tone: 'outline' }), color: status('yellow'), outline: status('yellow-outline') };\n        case 'cautious':\n            return { icon: grid16({ d: CAUTION_OUTLINE, tone: 'outline' }, CAUTION_FILL), color: status('yellow'), outline: status('yellow-outline') };\n        case 'undefined':\n            return { icon: grid16(DIAMOND_OUTLINE, DIAMOND_FILL), color: status('purple') };\n        case 'stable':\n            return { icon: CIRCLE_FILL, color: status('green') };\n        case 'informative':\n            return { icon: grid16(LOW_FILL, LOW_OUTLINE), color: status('blue') };\n        case 'incomplete':\n            return { icon: HALF_CIRCLE, color: status('blue') };\n        default:\n            return { icon: CIRCLE_STROKE, color: status('gray') };\n    }\n}\n\n/** The fill of one path of a look. */\nexport function toneFill(look: StatusLook, tone: StatusTone = 'status'): string {\n    if (tone === 'black') return '#000000';\n    return tone === 'outline' ? (look.outline ?? look.color) : look.color;\n}\n"
    }
  ]
}
