{
 "id": "order-summary",
 "name": "Order summary",
 "purpose": "A checkout summary: two products with their photos and quantity steppers, a promo code with the applied code shown as a chip, the totals and a Pay button that shows the amount.",
 "use_when": [
  "at checkout, beside the payment step",
  "a one-page checkout where the buyer can still change quantities and try a code before paying"
 ],
 "avoid_when": [
  "a cart opened from the header while shopping: use cart-drawer",
  "a list of past orders or bills: use receipts-table",
  "picking a plan for a subscription: use plan-picker"
 ],
 "type": "commerce",
 "style": "quiet",
 "width": "narrow",
 "tags": {
  "audience": "work",
  "industries": [
   "retail",
   "home",
   "saas",
   "any"
  ],
  "keywords": [
   "checkout",
   "cart",
   "promo code",
   "stepper",
   "payment"
  ]
 },
 "root": ".odl-order-summary",
 "parts": [
  {
   "name": "title",
   "selector": "h3",
   "what": "the card heading",
   "slot": "text"
  },
  {
   "name": "count",
   "selector": ".odl-count",
   "what": "how many items in all",
   "slot": "text"
  },
  {
   "name": "items",
   "selector": ".odl-item",
   "what": "one product: photo, name, variant and unit price, line total and a quantity stepper",
   "slot": "list"
  },
  {
   "name": "stepper",
   "selector": ".odl-step",
   "what": "fewer and more buttons around the quantity, from 1 to 20",
   "slot": "action"
  },
  {
   "name": "code",
   "selector": ".odl-promo input",
   "what": "the promo code field",
   "slot": "input"
  },
  {
   "name": "apply",
   "selector": ".odl-apply",
   "what": "applies the code",
   "slot": "action"
  },
  {
   "name": "code_error",
   "selector": ".odl-msg",
   "what": "the message when a code is wrong",
   "slot": "text"
  },
  {
   "name": "chip",
   "selector": ".odl-chip",
   "what": "the applied code and its discount, with a remove button",
   "slot": "text"
  },
  {
   "name": "totals",
   "selector": "dl > div",
   "what": "one line of the sum: subtotal, discount, shipping, tax; the last is the total with its currency",
   "slot": "list"
  },
  {
   "name": "pay",
   "selector": ".odl-pay",
   "what": "the Pay button with the total in it",
   "slot": "action"
  },
  {
   "name": "fine",
   "selector": ".odl-fine",
   "what": "the card used and the returns note",
   "slot": "text"
  }
 ],
 "data": {
  "type": "object",
  "required": [
   "items",
   "totals",
   "currency"
  ],
  "properties": {
   "title": {
    "type": "string",
    "maxLength": 24,
    "part": "title"
   },
   "items": {
    "type": "array",
    "minItems": 1,
    "maxItems": 4,
    "part": "items",
    "items": {
     "type": "object",
     "required": [
      "name",
      "price",
      "quantity"
     ],
     "properties": {
      "name": {
       "type": "string",
       "maxLength": 32
      },
      "variant": {
       "type": "string",
       "maxLength": 20
      },
      "photo": {
       "type": "string",
       "maxLength": 300
      },
      "photo_alt": {
       "type": "string",
       "maxLength": 80
      },
      "price": {
       "type": "number",
       "minimum": 0
      },
      "quantity": {
       "type": "integer",
       "minimum": 1,
       "maximum": 20
      },
      "unit": {
       "type": "string",
       "maxLength": 12
      },
      "units": {
       "type": "string",
       "maxLength": 12
      }
     }
    }
   },
   "promo": {
    "type": "object",
    "part": "chip",
    "properties": {
     "code": {
      "type": "string",
      "maxLength": 12
     },
     "label": {
      "type": "string",
      "maxLength": 16
     },
     "rate": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
     }
    }
   },
   "totals": {
    "type": "array",
    "minItems": 2,
    "maxItems": 6,
    "part": "totals",
    "items": {
     "type": "object",
     "required": [
      "label",
      "value"
     ],
     "properties": {
      "label": {
       "type": "string",
       "maxLength": 24
      },
      "value": {
       "type": "string",
       "maxLength": 12
      }
     }
    }
   },
   "currency": {
    "type": "string",
    "maxLength": 3,
    "part": "totals"
   },
   "pay_label": {
    "type": "string",
    "maxLength": 12,
    "part": "pay"
   },
   "fine": {
    "type": "string",
    "maxLength": 90,
    "part": "fine"
   },
   "promo_code": {
    "type": "string",
    "maxLength": 80
   },
   "promo_label": {
    "type": "string",
    "maxLength": 80
   },
   "promo_rate": {
    "type": "string",
    "maxLength": 80
   }
  }
 },
 "states": {
  "shown": [
   "code applied",
   "code removed",
   "invalid code",
   "quantity at minimum",
   "hover",
   "pressed",
   "focus"
  ],
  "edge": {
   "empty": {
    "status": "handled",
    "evidence": "data-od-list",
    "how": "the Smart UI renderer puts one plain 'Nothing to show yet.' line in an empty list"
   },
   "loading": {
    "status": "handled",
    "evidence": "data-od-slot",
    "how": "the Smart UI renderer draws each marked slot as a quiet block of its size while the data arrives; the static file shows the filled part"
   },
   "error": {
    "status": "shown",
    "how": "a wrong code turns the field's border red and shows a message that is announced",
    "evidence": "input[aria-invalid=\"true\"] { border-color: var(--ds-color-border-danger); }"
   },
   "disabled": {
    "status": "shown",
    "how": "the fewer button is off at a quantity of 1 and the more button at 20",
    "evidence": ".odl-step button:disabled { color: var(--ds-color-text-disabled); cursor: not-allowed; }"
   },
   "overflow": {
    "status": "handled",
    "how": "on the smallest phones the line price moves under the product name",
    "evidence": "@container (max-width: 21rem)"
   },
   "long_text": {
    "status": "handled",
    "how": "a long product name wraps in the middle column while the photo and line price keep their width",
    "evidence": "grid-template-columns: var(--odl-thumb) minmax(0, 1fr) auto"
   },
   "missing_image": {
    "status": "handled",
    "evidence": "data-od-media",
    "how": "the Smart UI renderer swaps a photo that fails to load for a block of the same size with its alt text"
   }
  }
 },
 "tokens": [
  "--ds-border-width-default",
  "--ds-color-bg-action-primary",
  "--ds-color-bg-action-primary-hover",
  "--ds-color-bg-action-primary-pressed",
  "--ds-color-bg-field",
  "--ds-color-bg-neutral-subtle",
  "--ds-color-border-danger",
  "--ds-color-border-default",
  "--ds-color-border-focus",
  "--ds-color-border-input",
  "--ds-color-border-subtle",
  "--ds-color-icon-subtle",
  "--ds-color-surface-raised",
  "--ds-color-surface-sunken",
  "--ds-color-text-danger",
  "--ds-color-text-disabled",
  "--ds-color-text-on-action",
  "--ds-color-text-primary",
  "--ds-color-text-secondary",
  "--ds-color-text-success",
  "--ds-color-text-tertiary",
  "--ds-elevation-raised",
  "--ds-focus-ring-offset",
  "--ds-focus-ring-width",
  "--ds-font-weight-heading",
  "--ds-font-weight-label",
  "--ds-icon-stroke-md",
  "--ds-motion-duration-short",
  "--ds-motion-easing-standard",
  "--ds-radius-container",
  "--ds-radius-control",
  "--ds-radius-full",
  "--ds-radius-nested",
  "--ds-size-control-lg",
  "--ds-size-control-md",
  "--ds-size-icon-sm",
  "--ds-size-target-min",
  "--ds-space-inline-md",
  "--ds-space-inline-sm",
  "--ds-space-inline-xs",
  "--ds-space-inset-lg",
  "--ds-space-inset-md",
  "--ds-space-inset-sm",
  "--ds-space-inset-xl",
  "--ds-space-stack-lg",
  "--ds-space-stack-md",
  "--ds-space-stack-sm",
  "--ds-space-stack-xs",
  "--ds-text-body-md",
  "--ds-text-body-sm",
  "--ds-text-code-sm",
  "--ds-text-label-lg",
  "--ds-text-label-md",
  "--ds-text-numeric-md",
  "--ds-text-title-md"
 ],
 "a11y": {
  "summary": "Steppers are labelled groups of real buttons with an output that announces the new quantity; each product photo has alt text, the code field has a name, a wrong code is announced as an alert, and the chip's remove button names the code.",
  "roles": [
   "alert",
   "group",
   "list",
   "region"
  ],
  "keyboard": [
   "Tab reaches each product's fewer and more buttons, the code field, Apply, the code's remove button, then Pay",
   "Enter or Space presses the focused button; the quantity change is announced",
   "Enter in the code field applies the code",
   "Removing the code moves focus to the code field",
   "Pay is a button, but the file wires no action to it"
  ],
  "controls": {
   "button": 9,
   "input": 1,
   "link": 0,
   "select": 0,
   "textarea": 0,
   "summary": 0
  },
  "focus_visible": true,
  "reduced_motion": true,
  "min_target": true
 },
 "files": {
  "html": "components/order-summary/component.html",
  "bytes": 20815,
  "script": true
 },
 "source": null,
 "photos": 2,
 "urls": {
  "html": "https://opendesigner.dev/library/order-summary.html",
  "json": "https://opendesigner.dev/library/order-summary.json",
  "page": "https://opendesigner.dev/library/order-summary/"
 },
 "get": {
  "curl": "curl -fsSLo order-summary.html https://opendesigner.dev/library/order-summary.html",
  "opendesigner": "python3 path/to/skills/opendesigner/scripts/library.py add order-summary --from https://opendesigner.dev",
  "prompt": "Add the OpenDesigner component order-summary to this project: https://opendesigner.dev/library/order-summary.html. Keep its markup and states; map its --ds-* variables to my tokens."
 }
}
