adaptive-card-core 0.1.0

Pure-Rust library for validating, optimizing, and transforming Microsoft Adaptive Cards v1.6
Documentation
{
  "id": "patterns/warehouse-inventory",
  "title": "Warehouse Inventory Dashboard with KPIs",
  "description": "Live timestamp header, dual KPI boxes (emphasis columns with big number + change indicator in good-style container), product list with thumbnails and forward arrows.",
  "category": "patterns",
  "tags": [
    "inventory",
    "dashboard",
    "KPI",
    "metrics",
    "warehouse",
    "products",
    "stock"
  ],
  "use_cases": [
    "Inventory dashboard",
    "Sales metrics",
    "Stock monitoring",
    "Warehouse overview"
  ],
  "host_targets": [
    "generic",
    "teams",
    "web_chat"
  ],
  "complexity": "intermediate",
  "card": {
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.2",
    "body": [
      {
        "type": "Container"
      },
      {
        "type": "TextBlock",
        "text": "${warehouse}",
        "wrap": true,
        "weight": "Bolder",
        "size": "ExtraLarge",
        "spacing": "Medium"
      },
      {
        "type": "TextBlock",
        "text": " As of ${formatDateTime(utcNow() , 'HH:mm')}  \u2022  ${location}",
        "wrap": true,
        "size": "Small",
        "isSubtle": true
      },
      {
        "type": "ColumnSet",
        "columns": [
          {
            "type": "Column",
            "width": 48,
            "items": [
              {
                "type": "TextBlock",
                "text": "Available",
                "wrap": true,
                "size": "Small",
                "weight": "Bolder",
                "isSubtle": true
              },
              {
                "type": "TextBlock",
                "text": "${formatNumber(available.amount,2)}M",
                "wrap": true,
                "size": "ExtraLarge",
                "weight": "Bolder"
              },
              {
                "type": "ColumnSet",
                "columns": [
                  {
                    "type": "Column",
                    "width": "28px",
                    "items": [
                      {
                        "type": "TextBlock",
                        "height": "stretch",
                        "horizontalAlignment": "Left",
                        "text": "\u2b06",
                        "spacing": "None"
                      }
                    ],
                    "spacing": "None"
                  },
                  {
                    "type": "Column",
                    "width": "stretch",
                    "verticalContentAlignment": "Center",
                    "items": [
                      {
                        "type": "TextBlock",
                        "text": "+${available.change}%",
                        "wrap": true
                      }
                    ],
                    "spacing": "None"
                  }
                ],
                "style": "good",
                "spacing": "Medium"
              }
            ],
            "style": "emphasis"
          },
          {
            "type": "Column",
            "width": 4
          },
          {
            "type": "Column",
            "items": [
              {
                "type": "TextBlock",
                "text": "Ready to ship",
                "wrap": true,
                "size": "Small",
                "weight": "Bolder",
                "isSubtle": true
              },
              {
                "type": "TextBlock",
                "text": "${formatNumber(ready.amount,2)}M",
                "wrap": true,
                "size": "ExtraLarge",
                "weight": "Bolder"
              },
              {
                "type": "ColumnSet",
                "style": "good",
                "columns": [
                  {
                    "type": "Column",
                    "width": "28px",
                    "items": [
                      {
                        "type": "TextBlock",
                        "text": "\u2b06",
                        "color": "Default",
                        "height": "stretch",
                        "spacing": "None"
                      }
                    ],
                    "spacing": "None"
                  },
                  {
                    "type": "Column",
                    "width": "stretch",
                    "items": [
                      {
                        "type": "TextBlock",
                        "text": "${ready.change}%",
                        "wrap": true,
                        "spacing": "None"
                      }
                    ],
                    "verticalContentAlignment": "Center",
                    "spacing": "None"
                  }
                ],
                "spacing": "Medium"
              }
            ],
            "width": 48,
            "style": "emphasis"
          }
        ],
        "spacing": "Large"
      },
      {
        "type": "TextBlock",
        "text": "Top selling items",
        "wrap": true,
        "spacing": "ExtraLarge",
        "size": "Medium",
        "weight": "Bolder"
      },
      {
        "type": "Container"
      },
      {
        "type": "ColumnSet",
        "$data": "${$root.products}",
        "columns": [
          {
            "type": "Column",
            "width": "50px",
            "items": [
              {
                "type": "Image",
                "url": "${image}",
                "width": "48px",
                "height": "48px",
                "horizontalAlignment": "Center"
              }
            ],
            "verticalContentAlignment": "Center"
          },
          {
            "type": "Column",
            "width": 75,
            "items": [
              {
                "type": "TextBlock",
                "text": "${name}",
                "wrap": true,
                "weight": "Bolder"
              },
              {
                "type": "ColumnSet",
                "columns": [
                  {
                    "type": "Column",
                    "width": 33,
                    "items": [
                      {
                        "type": "TextBlock",
                        "text": "${SKUs}",
                        "wrap": true
                      }
                    ]
                  },
                  {
                    "type": "Column",
                    "width": 33,
                    "items": [
                      {
                        "type": "TextBlock",
                        "text": "${change}",
                        "wrap": true,
                        "color": "Accent"
                      }
                    ]
                  },
                  {
                    "type": "Column",
                    "width": 33
                  }
                ],
                "spacing": "Small"
              }
            ],
            "verticalContentAlignment": "Center"
          },
          {
            "type": "Column",
            "width": 5,
            "items": [
              {
                "type": "Image",
                "url": "https://raw.githubusercontent.com/pnp/AdaptiveCards-Templates/main/samples/inventory/assets/arrowforward.png",
                "width": "20px",
                "height": "20px"
              }
            ],
            "verticalContentAlignment": "Center",
            "horizontalAlignment": "Right"
          }
        ],
        "spacing": "Medium",
        "separator": true
      }
    ],
    "speak": "${products[0].name} was the top seller this week, selling ${products[0].previous_period} more than the week before."
  },
  "notes": ""
}