{
 "id": "date-range-picker",
 "name": "Date range picker",
 "purpose": "Pick a start and end day from two months side by side, or one quick range such as last 7 days, then apply it to a report.",
 "use_when": [
  "for filtering a report or table by dates",
  "a past period for analytics or billing, where days after today must not be picked"
 ],
 "avoid_when": [
  "picking one date or a travel date in the future: future days are disabled here; use trip-search",
  "choosing several filters at once, of which dates are only one: use filter-bar and open this from it",
  "seeing what happens on each day: use calendar-agenda"
 ],
 "type": "form",
 "style": "quiet",
 "width": "wide",
 "tags": {
  "audience": "work",
  "industries": [
   "any"
  ],
  "keywords": [
   "date range",
   "calendar",
   "presets",
   "filter",
   "report"
  ]
 },
 "root": ".odl-date-range-picker",
 "parts": [
  {
   "name": "presets",
   "selector": ".odl-presets button",
   "what": "one quick range, such as Last 7 days; the last is Custom",
   "slot": "list"
  },
  {
   "name": "start",
   "selector": ".odl-start",
   "what": "the chosen start day, or a prompt to pick one",
   "slot": "text"
  },
  {
   "name": "end",
   "selector": ".odl-end",
   "what": "the chosen end day, or a prompt to pick one",
   "slot": "text"
  },
  {
   "name": "months",
   "selector": ".odl-month",
   "what": "one month: its name, previous and next buttons, and a grid of days; two side by side when wide",
   "slot": "list"
  },
  {
   "name": "month_title",
   "selector": ".odl-mhead h3",
   "what": "the month and year",
   "slot": "text"
  },
  {
   "name": "nav",
   "selector": ".odl-nav",
   "what": "previous and next month",
   "slot": "action"
  },
  {
   "name": "days",
   "selector": ".odl-day",
   "what": "one day button: start, end, in range, today or disabled",
   "slot": "list"
  },
  {
   "name": "summary",
   "selector": ".odl-summary",
   "what": "the range length and the time zone, or what to do next",
   "slot": "rich"
  },
  {
   "name": "cancel",
   "selector": ".odl-cancel",
   "what": "puts the first range back",
   "slot": "action"
  },
  {
   "name": "apply",
   "selector": ".odl-apply",
   "what": "the main action",
   "slot": "action"
  }
 ],
 "data": {
  "type": "object",
  "required": [
   "today"
  ],
  "properties": {
   "presets": {
    "type": "array",
    "minItems": 2,
    "maxItems": 6,
    "part": "presets",
    "items": {
     "type": "object",
     "required": [
      "label",
      "id"
     ],
     "properties": {
      "label": {
       "type": "string",
       "maxLength": 16
      },
      "id": {
       "enum": [
        "today",
        "7",
        "month",
        "quarter",
        "custom"
       ]
      }
     }
    }
   },
   "start": {
    "type": "string",
    "format": "date",
    "maxLength": 10,
    "part": "start"
   },
   "end": {
    "type": "string",
    "format": "date",
    "maxLength": 10,
    "part": "end"
   },
   "today": {
    "type": "string",
    "format": "date",
    "maxLength": 10,
    "part": "days"
   },
   "timezone_note": {
    "type": "string",
    "maxLength": 36,
    "part": "summary"
   },
   "actions": {
    "type": "object",
    "properties": {
     "apply": {
      "type": "string",
      "maxLength": 12,
      "part": "apply"
     },
     "cancel": {
      "type": "string",
      "maxLength": 12,
      "part": "cancel"
     }
    }
   }
  }
 },
 "states": {
  "shown": [
   "hover",
   "focus",
   "selected start",
   "in range",
   "selected end",
   "today",
   "disabled future day",
   "picking end"
  ],
  "edge": {
   "empty": {
    "status": "handled",
    "how": "with only a start or no day picked, the open field shows 'Pick a day' in a muted colour with a focus border and the summary says what to do",
    "evidence": "output.is-empty"
   },
   "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": "not_built",
    "how": "if a range is too long for the report, put a warning line in the summary and set disabled on Apply"
   },
   "disabled": {
    "status": "shown",
    "how": "days after today and the next-month button past today are greyed out and cannot be pressed",
    "evidence": ".odl-day:disabled"
   },
   "overflow": {
    "status": "handled",
    "how": "below 600 px one month shows instead of two, and the presets move from a side column to a wrapping row, then two columns",
    "evidence": "@container (max-width: 599.98px)"
   },
   "long_text": {
    "status": "handled",
    "how": "the start and end fields cut a long date off with an ellipsis; preset labels never wrap",
    "evidence": "white-space: nowrap; overflow: hidden; text-overflow: ellipsis"
   },
   "missing_image": {
    "status": "none",
    "how": "the part has no photo"
   }
  }
 },
 "tokens": [
  "--ds-border-width-default",
  "--ds-border-width-emphasis",
  "--ds-color-bg-accent-subtle",
  "--ds-color-bg-accent-subtle-hover",
  "--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-hover",
  "--ds-color-border-accent",
  "--ds-color-border-default",
  "--ds-color-border-focus",
  "--ds-color-border-input",
  "--ds-color-border-subtle",
  "--ds-color-icon-default",
  "--ds-color-icon-subtle",
  "--ds-color-surface-overlay",
  "--ds-color-surface-raised",
  "--ds-color-surface-sunken",
  "--ds-color-text-disabled",
  "--ds-color-text-on-action",
  "--ds-color-text-primary",
  "--ds-color-text-secondary",
  "--ds-color-text-tertiary",
  "--ds-elevation-overlay",
  "--ds-elevation-raised",
  "--ds-focus-ring-offset",
  "--ds-focus-ring-width",
  "--ds-font-weight-label",
  "--ds-icon-stroke-md",
  "--ds-motion-duration-short",
  "--ds-motion-easing-standard",
  "--ds-radius-control",
  "--ds-radius-control-sm",
  "--ds-radius-overlay",
  "--ds-size-control-md",
  "--ds-size-control-sm",
  "--ds-size-icon-sm",
  "--ds-size-target-min",
  "--ds-space-2",
  "--ds-space-4",
  "--ds-space-inline-md",
  "--ds-space-inline-sm",
  "--ds-space-inset-lg",
  "--ds-space-inset-md",
  "--ds-space-inset-xl",
  "--ds-space-inset-xs",
  "--ds-space-stack-lg",
  "--ds-space-stack-md",
  "--ds-space-stack-sm",
  "--ds-space-stack-xl",
  "--ds-text-body-md",
  "--ds-text-label-lg",
  "--ds-text-label-md",
  "--ds-text-label-sm",
  "--ds-text-title-sm"
 ],
 "a11y": {
  "summary": "Every day is a button with its full date as its label and aria-pressed on the start and end; today has aria-current, future days are disabled, and the range length is announced in a polite live region.",
  "roles": [
   "contentinfo",
   "dialog",
   "group",
   "region"
  ],
  "keyboard": [
   "Tab moves through the preset buttons, previous and next month, every day that is not disabled, then Cancel and Apply",
   "Enter or Space on a day picks the start, then the end; focus stays on that day",
   "Enter or Space on a preset sets its range and shows its months",
   "The range length is read out by a polite live region after each pick"
  ],
  "controls": {
   "button": 73,
   "input": 0,
   "link": 0,
   "select": 0,
   "textarea": 0,
   "summary": 0
  },
  "focus_visible": true,
  "reduced_motion": true,
  "min_target": true
 },
 "files": {
  "html": "components/date-range-picker/component.html",
  "bytes": 34627,
  "script": true
 },
 "source": "brand/showcase/components/03-date-range-picker",
 "photos": 0,
 "urls": {
  "html": "https://opendesigner.dev/library/date-range-picker.html",
  "json": "https://opendesigner.dev/library/date-range-picker.json",
  "page": "https://opendesigner.dev/library/date-range-picker/"
 },
 "get": {
  "curl": "curl -fsSLo date-range-picker.html https://opendesigner.dev/library/date-range-picker.html",
  "opendesigner": "python3 path/to/skills/opendesigner/scripts/library.py add date-range-picker --from https://opendesigner.dev",
  "prompt": "Add the OpenDesigner component date-range-picker to this project: https://opendesigner.dev/library/date-range-picker.html. Keep its markup and states; map its --ds-* variables to my tokens."
 }
}
