{
  "$schema": "../manifest.schema.json",
  "schemaVersion": "1.2.0",
  "name": "ds-card",
  "description": "Card container for content",
  "docUrl": "https://design.soracom.io/design-system/elements/card/",
  "category": "elements",
  "htmlElements": [
    "div",
    "a"
  ],
  "isWebComponent": false,
  "modifiers": {
    "color": {
      "support": "all"
    },
    "gradient": {
      "support": "all"
    },
    "visual-state": {
      "support": "all"
    },
    "variant": {
      "support": "custom",
      "values": [
        "--panel",
        "--details",
        "--tiled",
        "--flat",
        "--bordered",
        "--outline",
        "--diagram",
        "--clickable"
      ],
      "aliases": {
        "--plain": "--flat",
        "--simple": "--bordered"
      }
    },
    "size": {
      "support": "subset",
      "values": [
        "--small",
        "--large"
      ]
    },
    "layout": {
      "support": "custom",
      "values": [
        "--center",
        "--middle",
        "--centered",
        "--horizontal"
      ]
    },
    "state": {
      "support": "subset",
      "values": [
        "--loading",
        "--loading-refresh"
      ]
    },
    "icon": {
      "support": "all"
    },
    "indent": {
      "support": "all"
    },
    "gap": {
      "support": "all"
    }
  },
  "cssCustomProperties": [
    {
      "name": "--ds-card-width",
      "default": "auto",
      "description": "Card width"
    },
    {
      "name": "--ds-card-height",
      "default": "auto",
      "description": "Card height"
    },
    {
      "name": "--ds-card-rows",
      "default": "initial",
      "description": "Row sizing override, such as auto 1fr or auto 1fr auto. Defaults to the automatic card layout. Vertical cards in uniform columns use the parent subgrid rows."
    },
    {
      "name": "--ds-card-text-color",
      "default": "var(--color-default)",
      "description": "Default card foreground, also used by bordered cards and their legacy --simple alias. Filled palette cards prefer --color-contrast; outline and details variants set their own foregrounds, and gradients prefer their gradient foreground. Child text inherits the resolved CSS color."
    },
    {
      "name": "--ds-card-background-color",
      "default": "var(--color-gray)",
      "description": "Default card background, used when no --color palette is supplied. Outline and hover styles adjust the painted background independently. Pair custom backgrounds with an appropriate foreground; default cards do not calculate text contrast automatically."
    },
    {
      "name": "--ds-card-border-color",
      "default": "var(--color-transparent)",
      "description": "Card border color"
    },
    {
      "name": "--ds-card-border-width",
      "default": "0px",
      "description": "Card border width"
    },
    {
      "name": "--ds-card-border-style",
      "default": "solid",
      "description": "Card border style"
    },
    {
      "name": "--ds-card-border-radius",
      "default": "12px",
      "description": "Card corner radius, shared by rows at the card edge"
    },
    {
      "name": "--ds-card-indent",
      "default": "var(--space-medium)",
      "description": "Base content inset, adjusted by --indent-* modifiers"
    },
    {
      "name": "--ds-card-v-indent",
      "default": "var(--ds-card-indent)",
      "description": "Vertical content inset, adjusted by --v-indent-* modifiers"
    },
    {
      "name": "--ds-card-h-indent",
      "default": "var(--ds-card-indent)",
      "description": "Horizontal content inset, adjusted by --h-indent-* modifiers"
    },
    {
      "name": "--ds-card-gap",
      "default": "var(--space-xsmall)",
      "description": "Content spacing, adjusted by --gap-* modifiers"
    }
  ],
  "usageNotes": [
    "Use --alert, --warning, --success, --info or --color-* for a filled palette surface with its --color-contrast foreground. --flat removes the shadow; --bordered adds a 2px palette-colored border and a light tint; --outline adds the border with a transparent background base. On hover, --flat mixes 85% of its local palette color with 15% of the black or white opposite of its contrast foreground, keeping the result opaque. Without a palette, it uses --color-celeste-lightest and the public card text default for this mix. Bordered and outline cards use the local palette color or celeste with --opacity-lightest and --opacity-bright respectively. --plain and --simple are deprecated aliases for --flat and --bordered. Background mixing and variant foregrounds are resolved internally; --ds-card-background-opacity is no longer consumed.",
    "Cards use a single content column between two grid gutter tracks sized by --ds-card-h-indent, with vertical padding sized by --ds-card-v-indent. Children keep their own padding inside this column.",
    "Set --ds-card-rows on the card to size its content rows explicitly. For example, auto 1fr keeps a heading at its natural height and gives the second row the remaining space; auto 1fr auto also allows a footer. This overrides automatic chart-row sizing and resets on nested cards. Vertical cards in ds-cols --uniform continue to share the parent subgrid rows.",
    "Images, dividers, datatables and banners span the full width and bleed to the card edge when first or last. Headers, footers, figures and icons are panels: they span the full width, keep the card indent inside their background, and share the card corners when first or last. A footer also keeps a full card indent of whitespace above its tint, except directly after media or an icon, where it sits flush. Children with --highlight or --outdent are tiles: they span the full width, extend into the adjacent row gaps, and use the row gap as their vertical inset, keeping the card indent only at the card edge. A pinned tag, close, edit or control button never counts as a row, so a trailing close button leaves the footer at the card edge, and the row after a pinned tag reaches the top edge with extra inset to clear the tag. Standard cards retain their grid row gap.",
    "Tiled cards remove the grid row gap and turn every child into a tile, except media, panels and positioned controls, so the gap modifiers size the vertical inset of each tile instead. Wrap a component that manages its own inset in a plain element to keep it.",
    "Card rows stretch to fill spare height, so a single banner or image fills a taller card. Use --center to center grid items and text horizontally and --middle to center the content vertically when the card has spare height. Use --centered for both axes, or combine --center and --middle. Child components can override the inherited text alignment. Cards with an in-flow footer stretch their rows to keep the footer at the bottom, including with --middle or --centered.",
    "Use --gap-* for both axes, --v-gap-* or --h-gap-* for individual axes, and --no-v-gap or --no-h-gap to remove an axis gap. Horizontal cards use one gap track between the icon and content; gap modifiers also apply inside the ds-rows wrapper, which keeps its own padding.",
    "For --horizontal, place one ds-icon before a ds-rows wrapper containing the card content. The icon stretches beside the content; --square gives it a tinted background and divider. Icon size modifiers control the panel width. An optional footer spans both columns. Horizontal cards in ds-cols --uniform share card heights without subgrid content-row alignment.",
    "Public --ds-card-* properties declare component defaults; private properties resolve palette colors and derived styles. Palette values and variants can override public defaults. To customize a palette-colored card, change its local --color and --color-contrast pair. Properties prefixed with --_card- are private implementation details.",
    "The --color, --color-text and --color-contrast roles do not inherit when the base, combined or standalone token stylesheet is loaded. Cards do not forward these roles to child content; ordinary CSS color inherits instead. Nested components use their own palettes and defaults, and explicit child color modifiers remain local. Outline cards use --color-default for their foreground.",
    "Footer foregrounds default to --color-default-shade. On palette-colored cards they use the card-local --color-contrast, resolved on the card and inherited through a private property. Details cards use --color-ink-bright for their footer. Gradient cards use the same resolved foreground for their body and footer, including explicit card color overrides. The footer background uses the card foreground with --opacity-bright.",
    "Apply --gradient-* to the card for named or color gradients, including direction suffixes such as -to-right. Gradient cards use the theme background beneath the gradient and --gradient-text-color for the foreground. Text inherits this color without passing a --color palette to nested components. Explicit --color-* modifiers take precedence; --gradient-text-color supplies the gradient foreground before falling back to --ds-card-text-color. Nested surfaces need their own gradient modifier, and plain icons retain their component defaults."
  ],
  "structure": {
    "parts": {
      "pinnedTag": {
        "element": "span",
        "alternativeElements": [
          "p"
        ],
        "selector": ".ds-tag.--pinned",
        "optional": true,
        "position": [
          "first"
        ]
      },
      "close": {
        "element": "button",
        "selector": ".__close",
        "optional": true,
        "position": [
          "first",
          "last"
        ]
      },
      "media": {
        "element": "i",
        "alternativeElements": [
          "img",
          "figure"
        ],
        "optional": true
      },
      "footer": {
        "element": "footer",
        "alternativeElements": [
          "div",
          "button"
        ],
        "selector": "footer, .__footer",
        "optional": true,
        "position": [
          "last"
        ]
      }
    },
    "patterns": {
      "basic": "<div class=\"ds-card\"><div class=\"ds-text --label\">{title}</div><div class=\"ds-text\">{content}</div></div>",
      "with-footer": "<div class=\"ds-card\"><div class=\"ds-text --label\">{title}</div><div class=\"ds-text\">{content}</div><footer>{footer}</footer></div>",
      "link": "<a class=\"ds-card\" href=\"{href}\"><div class=\"ds-text --label\">{title}</div><div class=\"ds-text\">{content}</div></a>",
      "horizontal": "<div class=\"ds-card --horizontal --outline\"><i class=\"ds-icon --icon-cloud --large --square\" aria-hidden=\"true\"></i><div class=\"ds-rows\"><div class=\"ds-heading --large-bold\">{title}</div><p class=\"ds-text\">{content}</p></div></div>"
    }
  },
  "attributes": {
    "href": {
      "description": "Navigation target when ds-card is applied to an anchor element.",
      "appliesTo": [
        {
          "elements": [
            "a"
          ]
        }
      ]
    }
  },
  "dataAttributes": [
    {
      "name": "data-ds-message",
      "description": "Message text that hides the card contents and renders the SDS message state.",
      "valueType": "string"
    }
  ],
  "examples": [
    {
      "name": "basic",
      "html": "<div class=\"ds-card\"><div class=\"ds-text --label\">Card Title</div><div class=\"ds-text\">Card content goes here.</div></div>"
    },
    {
      "name": "native-content",
      "html": "<div class=\"ds-card\"><h3>Card Title</h3><p>Plain HTML content uses the card indent.</p><div>A plain wrapper uses the same content column.</div></div>"
    },
    {
      "name": "divider",
      "html": "<div class=\"ds-card --indent-large\"><div>Indented content</div><hr><p>Indented content below the divider.</p></div>"
    },
    {
      "name": "horizontal",
      "html": "<div class=\"ds-card --horizontal --outline\"><i class=\"ds-icon --icon-cloud --large --square\" aria-hidden=\"true\"></i><div class=\"ds-rows\"><div class=\"ds-heading --large-bold\">Using Beam to Connect to AWS IoT Core</div><p class=\"ds-text\">Collect data from your devices on AWS IoT Core using Soracom Beam, while managing device credentials from the cloud.</p></div></div>"
    },
    {
      "name": "with-footer",
      "html": "<div class=\"ds-card\"><div class=\"ds-text --label\">Card Title</div><div class=\"ds-text\">Card content goes here.</div><div class=\"__footer\"><span>Footer</span><i class=\"ds-icon --icon-arrow-right\"></i></div></div>"
    },
    {
      "name": "with-close",
      "html": "<div class=\"ds-card\"><div class=\"ds-text --label\">Card Title</div><div class=\"ds-text\">Card content goes here.</div><button class=\"ds-button --primary --small __close\"><span>Close</span></button></div>"
    },
    {
      "name": "with-pinned-tag",
      "html": "<div class=\"ds-card\"><p class=\"ds-tag --pinned\"><span>Category</span></p><div class=\"ds-text --label\">Card Title</div><div class=\"ds-text\">Card content goes here.</div></div>"
    },
    {
      "name": "alert",
      "html": "<div class=\"ds-card --alert\"><div class=\"ds-text --label\">Alert</div><div class=\"ds-text\">Alert card content.</div></div>"
    },
    {
      "name": "info",
      "html": "<div class=\"ds-card --info\"><div class=\"ds-text --label\">Info</div><div class=\"ds-text\">Info card content.</div></div>"
    },
    {
      "name": "plain-warning",
      "html": "<div class=\"ds-card --plain --warning\"><div class=\"ds-text --label\">Usage warning</div><p class=\"ds-text\">Your device is approaching its data limit.</p></div>"
    },
    {
      "name": "outline-success",
      "html": "<div class=\"ds-card --outline --success\"><div class=\"ds-text --label\">Device connected</div><p class=\"ds-text\">Your device is ready to send data.</p></div>"
    },
    {
      "name": "color-magenta",
      "html": "<div class=\"ds-card --color-magenta\"><div class=\"ds-text --label\">Magenta</div><div class=\"ds-text\">Colored card content.</div></div>"
    },
    {
      "name": "color-magenta-lightest",
      "html": "<div class=\"ds-card --color-magenta-lightest\"><div class=\"ds-text --label\">Magenta Lightest</div><div class=\"ds-text\">Light colored card content.</div></div>"
    },
    {
      "name": "gradient-dawn",
      "html": "<div class=\"ds-card --gradient-dawn\"><div class=\"ds-heading --large\">Fleet connectivity</div><div class=\"ds-text\">Manage connectivity and data usage for your devices.</div><footer><span>24 active SIMs</span></footer></div>"
    },
    {
      "name": "color-gradient",
      "html": "<div class=\"ds-card --gradient-celeste-lightest-to-right\"><div class=\"ds-heading --large\">Account summary</div><div class=\"ds-text\">Current usage and account details.</div></div>"
    },
    {
      "name": "indent-large",
      "html": "<div class=\"ds-card --indent-large\"><div class=\"ds-text --label\">Large Indent</div><div class=\"ds-text\">Card with extra padding.</div></div>"
    },
    {
      "name": "indent-small",
      "html": "<div class=\"ds-card --indent-small\"><div class=\"ds-text --label\">Small Indent</div><div class=\"ds-text\">Card with less padding.</div></div>"
    },
    {
      "name": "loading",
      "html": "<div class=\"ds-card --loading\"><div class=\"ds-text --label\">Loading</div><div class=\"ds-text\">Content is loading.</div></div>"
    },
    {
      "name": "loading-with-message",
      "html": "<div class=\"ds-card --loading\" data-ds-message=\"Loading data...\"><div class=\"ds-text --label\">Card</div><div class=\"ds-text\">Content behind overlay.</div></div>"
    },
    {
      "name": "message",
      "html": "<div class=\"ds-card\" data-ds-message=\"No data available\"><div class=\"ds-text --label\">Empty</div><div class=\"ds-text\">Content area.</div></div>"
    },
    {
      "name": "message-with-icon",
      "html": "<div class=\"ds-card --icon-rocket\" data-ds-message=\"Launching soon\"><div class=\"ds-text --label\">Card</div><div class=\"ds-text\">Content area.</div></div>"
    },
    {
      "name": "details",
      "html": "<div class=\"ds-card --details\"><i class=\"ds-icon --massive --icon-sim\"></i><div class=\"ds-heading --large\">Title</div><div class=\"ds-text\">Details card content.</div><button class=\"__footer --label\"><span>Details</span><i class=\"ds-icon --icon-arrow-right\"></i></button></div>"
    },
    {
      "name": "panel",
      "html": "<div class=\"ds-card --panel\"></div>"
    },
    {
      "name": "panel-with-content",
      "html": "<div class=\"ds-card --panel --indent-small\"><p class=\"ds-tag --pinned\"><span>Category</span></p><div class=\"ds-text --label\">Title</div><div class=\"ds-text\">Panel card content.</div></div>"
    },
    {
      "name": "link-card",
      "html": "<a class=\"ds-card --indent-small\" href=\"#\"><div class=\"ds-text --label --xlarge\">Clickable Card</div><hr /><div class=\"ds-text --small\">Card content with link behavior.</div><footer><div><span class=\"ds-tag --small\"><span>Tag</span></span></div></footer></a>"
    }
  ]
}
