@alfadocs/ui-kit-debug 0.94.0 → 0.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/_chunks/{apexcharts-theme-fAQXLIMW.js → apexcharts-theme-B_AxGC_h.js} +25 -20
  2. package/dist/_chunks/apexcharts-theme-B_AxGC_h.js.map +1 -0
  3. package/dist/_chunks/chart-DR68TJD5.js +705 -0
  4. package/dist/_chunks/chart-DR68TJD5.js.map +1 -0
  5. package/dist/_chunks/{date-range-picker-Cfv4Sr63.js → date-range-picker-pEG3Ln3i.js} +314 -297
  6. package/dist/_chunks/date-range-picker-pEG3Ln3i.js.map +1 -0
  7. package/dist/_chunks/{link-cell-renderer-_LDZhY4r.js → link-cell-renderer-flfZh2qY.js} +2 -2
  8. package/dist/_chunks/{link-cell-renderer-_LDZhY4r.js.map → link-cell-renderer-flfZh2qY.js.map} +1 -1
  9. package/dist/_chunks/{patient-table-CFM92QqU.js → patient-table-CvZTIM2R.js} +2 -2
  10. package/dist/_chunks/{patient-table-CFM92QqU.js.map → patient-table-CvZTIM2R.js.map} +1 -1
  11. package/dist/_chunks/{radiograph-panel.agent-DDnDGVpN.js → radiograph-panel.agent-AsXJBr1p.js} +2 -2
  12. package/dist/_chunks/{radiograph-panel.agent-DDnDGVpN.js.map → radiograph-panel.agent-AsXJBr1p.js.map} +1 -1
  13. package/dist/_chunks/{sparkline-o6JH4O66.js → sparkline-DcXqRZoq.js} +2 -2
  14. package/dist/_chunks/{sparkline-o6JH4O66.js.map → sparkline-DcXqRZoq.js.map} +1 -1
  15. package/dist/agent-catalog.json +1 -1
  16. package/dist/components/chart/chart.d.ts +12 -5
  17. package/dist/components/chart/chart.d.ts.map +1 -1
  18. package/dist/components/chart/index.js +1 -1
  19. package/dist/components/data-table/index.js +1 -1
  20. package/dist/components/date-range-picker/date-range-picker.d.ts +10 -1
  21. package/dist/components/date-range-picker/date-range-picker.d.ts.map +1 -1
  22. package/dist/components/date-range-picker/index.js +1 -1
  23. package/dist/components/patient-table/index.js +1 -1
  24. package/dist/components/radiograph-panel/index.js +1 -1
  25. package/dist/components/sparkline/index.js +1 -1
  26. package/dist/index.js +6 -6
  27. package/dist/tokens/apexcharts-theme.d.ts +19 -33
  28. package/dist/tokens/apexcharts-theme.d.ts.map +1 -1
  29. package/dist/tokens.css +1 -1
  30. package/package.json +1 -1
  31. package/dist/_chunks/apexcharts-theme-fAQXLIMW.js.map +0 -1
  32. package/dist/_chunks/chart-DqxVCm1I.js +0 -664
  33. package/dist/_chunks/chart-DqxVCm1I.js.map +0 -1
  34. package/dist/_chunks/date-range-picker-Cfv4Sr63.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"chart-DqxVCm1I.js","sources":["../../node_modules/lucide-react/dist/esm/icons/chart-area.mjs","../../node_modules/lucide-react/dist/esm/icons/chart-column.mjs","../../node_modules/lucide-react/dist/esm/icons/chart-line.mjs","../../node_modules/lucide-react/dist/esm/icons/chart-pie.mjs","../../node_modules/lucide-react/dist/esm/icons/donut.mjs","../../src/components/chart/chart.agent.ts","../../src/components/chart/chart.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M3 3v16a2 2 0 0 0 2 2h16\", key: \"c24i48\" }],\n [\n \"path\",\n {\n d: \"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z\",\n key: \"q0gr47\"\n }\n ]\n];\nconst ChartArea = createLucideIcon(\"chart-area\", __iconNode);\n\nexport { __iconNode, ChartArea as default };\n//# sourceMappingURL=chart-area.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M3 3v16a2 2 0 0 0 2 2h16\", key: \"c24i48\" }],\n [\"path\", { d: \"M18 17V9\", key: \"2bz60n\" }],\n [\"path\", { d: \"M13 17V5\", key: \"1frdt8\" }],\n [\"path\", { d: \"M8 17v-3\", key: \"17ska0\" }]\n];\nconst ChartColumn = createLucideIcon(\"chart-column\", __iconNode);\n\nexport { __iconNode, ChartColumn as default };\n//# sourceMappingURL=chart-column.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M3 3v16a2 2 0 0 0 2 2h16\", key: \"c24i48\" }],\n [\"path\", { d: \"m19 9-5 5-4-4-3 3\", key: \"2osh9i\" }]\n];\nconst ChartLine = createLucideIcon(\"chart-line\", __iconNode);\n\nexport { __iconNode, ChartLine as default };\n//# sourceMappingURL=chart-line.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z\",\n key: \"pzmjnu\"\n }\n ],\n [\"path\", { d: \"M21.21 15.89A10 10 0 1 1 8 2.83\", key: \"k2fpak\" }]\n];\nconst ChartPie = createLucideIcon(\"chart-pie\", __iconNode);\n\nexport { __iconNode, ChartPie as default };\n//# sourceMappingURL=chart-pie.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M20.5 10a2.5 2.5 0 0 1-2.4-3H18a2.95 2.95 0 0 1-2.6-4.4 10 10 0 1 0 6.3 7.1c-.3.2-.8.3-1.2.3\",\n key: \"19sr3x\"\n }\n ],\n [\"circle\", { cx: \"12\", cy: \"12\", r: \"3\", key: \"1v7zrd\" }]\n];\nconst Donut = createLucideIcon(\"donut\", __iconNode);\n\nexport { __iconNode, Donut as default };\n//# sourceMappingURL=donut.mjs.map\n","import type { AgentAdapter } from '../../agent/types';\nimport type { ChartHandle } from './chart';\n\nexport const chartAgent: AgentAdapter<ChartHandle> = {\n id: 'chart',\n // view_change backs the opt-in type switcher (`switchableTypes` prop):\n // the same chart re-presented as line / bar / area / pie / donut.\n capabilities: ['view_change'],\n state: {\n declaredType: {\n type: \"'line' | 'bar' | 'pie' | 'donut' | 'area' | 'radialBar'\",\n descriptionKey: 'ui.agent.chart.state.declaredType',\n description:\n 'The consumer-declared chart type — the shape `update_series` expects.',\n read: (handle) => handle.getTypeState().declaredType,\n },\n effectiveType: {\n type: \"'line' | 'bar' | 'pie' | 'donut' | 'area' | 'radialBar'\",\n descriptionKey: 'ui.agent.chart.state.effectiveType',\n description:\n 'The type currently rendered — differs from declaredType after a type-switcher pick.',\n read: (handle) => handle.getTypeState().effectiveType,\n },\n availableTypes: {\n type: 'ChartType[]',\n descriptionKey: 'ui.agent.chart.state.availableTypes',\n description:\n 'Types the switcher offers. Empty when the chart has no type switcher.',\n read: (handle) => handle.getTypeState().availableTypes,\n },\n },\n actions: {\n change_view: {\n // Switching the presentation is a write (it changes what the user\n // sees) but is trivially reversible by switching back.\n safety: 'write',\n argsType: 'type',\n argsSchema: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: ['line', 'bar', 'area', 'pie', 'donut'],\n description: 'The chart type to render.',\n },\n },\n required: ['type'],\n },\n returns: 'boolean (accepted)',\n returnsSchema: {\n type: 'boolean',\n description:\n 'True when the switch was applied; false when the chart has no type switcher or the type is not offered (check availableTypes first).',\n },\n idempotent: true,\n descriptionKey: 'ui.agent.chart.actions.changeView',\n description:\n 'Switch the rendered chart type via the type switcher. No-op (returns false) when the chart has no switcher or the type is not offered.',\n invoke: (handle, args: { type: string }) =>\n handle.setType(args.type as Parameters<ChartHandle['setType']>[0]),\n },\n update_series: {\n // Replacing the rendered series mutates what the chart displays — it\n // is a write, reversible by pushing the prior series back.\n safety: 'write',\n argsType: 'series',\n // `series` is `ChartSeries[]` (line/bar/area) OR `number[]`\n // (pie/donut/radialBar). Both shapes are accepted; the handle routes\n // by chart type internally.\n argsSchema: {\n type: 'object',\n properties: {\n series: {\n oneOf: [\n {\n type: 'array',\n description: 'Categorical series for line / bar / area charts.',\n items: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n data: { type: 'array', items: { type: 'number' } },\n role: {\n type: 'string',\n enum: ['primary', 'compare'],\n description:\n \"Optional. 'compare' renders this series as a secondary, colour-blind-safe overlay (e.g. the previous period) — dashed grey for line/area, hatched grey for bar. Omit for a normal primary series.\",\n },\n },\n required: ['name', 'data'],\n },\n },\n {\n type: 'array',\n description: 'Flat values for pie / donut / radialBar charts.',\n items: { type: 'number' },\n },\n ],\n },\n },\n required: ['series'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.chart.actions.updateSeries',\n description:\n 'Replace the chart series without remounting. Pass the DECLARED type’s shape (see declaredType state) — when the user has switched the view cross-shape the values are converted to the rendered shape. The write targets the live instance only: a later type switch re-reads the original props and discards it.',\n invoke: (\n handle,\n args: { series: Parameters<ChartHandle['updateSeries']>[0] },\n ) => {\n handle.updateSeries(args.series);\n },\n },\n export_png: {\n safety: 'read',\n returns: 'string (PNG data URI)',\n returnsSchema: {\n type: 'string',\n description: 'A `data:image/png;base64,…` URI of the rendered chart.',\n },\n idempotent: true,\n descriptionKey: 'ui.agent.chart.actions.exportPng',\n description:\n 'Return a PNG data URI of the chart for export or screenshotting.',\n invoke: (handle) => handle.dataURI(),\n },\n },\n domHooks: {\n root: { attr: 'data-component', value: 'chart' },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* Chart — thin, typed wrapper over ApexCharts (react-apexcharts). */\n/* */\n/* - All chrome, colours, and fonts flow from */\n/* `src/tokens/apexcharts-theme.ts` — never hex literals in user */\n/* code. A MutationObserver on `<html class>` re-reads the bridge so */\n/* theme changes repaint without remount. */\n/* - A ResizeObserver on the wrapper keeps the chart responsive */\n/* without listening on `window.resize`. */\n/* - Accessibility: the wrapper carries `role=\"img\"` + `aria-label` */\n/* (required `title` prop) + `aria-describedby` pointing at a */\n/* visually-hidden `<table>` that mirrors series × categories. */\n/* - Colour-blind users: `patterns` prop flips `fill.type` to pattern */\n/* using ApexCharts' built-in pattern presets. */\n/* - Numbers format via `Intl.NumberFormat(locale)` — no hand-rolled */\n/* `toFixed()`. */\n/* ------------------------------------------------------------------ */\n\nimport {\n forwardRef,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport ReactApexChart from 'react-apexcharts';\nimport ApexCharts from 'apexcharts';\nimport {\n ChartArea,\n ChartColumn,\n ChartLine,\n ChartPie,\n Donut,\n} from 'lucide-react';\nimport {\n getApexChartsTheme,\n type ApexChartsTheme,\n} from '../../tokens/apexcharts-theme';\nimport { usePrefersReducedMotion } from '../../hooks';\nimport { useNeutraliseHiddenFocus } from '../_shared/use-neutralize-hidden-focus';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { chartAgent } from './chart.agent';\nimport { IconButton } from '../button/icon-button';\nimport { IconButtonGroup } from '../icon-button-group';\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst chartVariants = cva('ds:relative ds:block ds:w-full', {\n variants: {\n density: {\n compact: 'ds:min-h-[var(--chart-min-height-compact)]',\n comfortable: 'ds:min-h-[var(--chart-min-height-comfortable)]',\n // Applied when an explicit `height` prop is given and no density was\n // requested: the wrapper must not exceed the caller's height (a 96px\n // KPI chart inside a card must not reserve 320px).\n none: '',\n },\n },\n defaultVariants: { density: 'comfortable' },\n});\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type ChartType = 'line' | 'bar' | 'pie' | 'donut' | 'area' | 'radialBar';\n\nexport interface ChartSeries {\n name: string;\n data: number[];\n /**\n * Marks this series as a secondary \"compare\" overlay — e.g. the previous\n * period in a current-vs-previous financial view. Rendered visually\n * subordinate and colour-blind-safe, distinguished from primary series by\n * BOTH a non-colour cue AND a muted hue (never colour alone):\n * - line / area: DASHED stroke in a resolved neutral grey (the chart echo\n * of the calendar compare band's dashed block-end rule).\n * - bar: HATCHED (slantedLines) grey fill — bars have a zero-width stroke\n * and cannot dash, so the non-colour cue lives in the fill texture.\n * Only meaningful on axis types (line / area / bar); it is structurally\n * impossible on pie / donut / radialBar (their `series` is `number[]`, which\n * cannot carry this field), so the axis-only invariant is enforced by the\n * type system with no runtime guard. On an axis→slice type switch the compare\n * series are dropped from the slice (a previous-period total is not a slice of\n * the current whole; DEV warn). Omit (or `'primary'`) to render normally — a\n * chart with NO compare series emits byte-identical ApexCharts options to\n * before this field existed.\n * @default 'primary'\n */\n role?: 'primary' | 'compare';\n}\n\n/** Bar orientation. `'horizontal'` renders a ranking sideways. Default `'vertical'`. */\nexport type ChartOrientation = 'vertical' | 'horizontal';\n\n/** Line / area stroke interpolation. Default `'smooth'`. */\nexport type ChartCurve = 'smooth' | 'straight' | 'stepline';\n\nexport interface ChartProps extends VariantProps<typeof chartVariants> {\n /** Required — drives aria-label and sr-only table caption. */\n title: string;\n /** Opaque instance id — emitted as `data-component-id` for the agent registry. */\n id?: string;\n /** Chart visual type. */\n type: ChartType;\n /**\n * For `line` / `bar` / `area`: an array of `ChartSeries`.\n * For `pie` / `donut` / `radialBar`: an array of numbers matched to `labels`.\n */\n series: ChartSeries[] | number[];\n /** Category axis labels (line / bar / area). */\n categories?: string[];\n /** Slice labels (pie / donut / radialBar). */\n labels?: string[];\n /** Height override. Defaults to 320px. */\n height?: number | string;\n /** Width override. Defaults to 100% of container. */\n width?: number | string;\n /** Opt-in pattern fills for colour-blind users. */\n patterns?: boolean;\n /**\n * Stack multiple `bar` / `area` series into a composition-over-time view.\n * Maps to ApexCharts `chart.stacked`. Only applies to the axis types\n * (`line` / `bar` / `area`); slice types (`pie` / `donut` / `radialBar`)\n * have no axis to stack against and ignore it. Default `false` — an\n * unstacked chart emits no `chart.stacked` key and renders identically to\n * before this prop existed.\n */\n stacked?: boolean;\n /**\n * Orientation for the `bar` type. `'horizontal'` renders the bars sideways\n * (ApexCharts `plotOptions.bar.horizontal`) for ranking-style charts where\n * the category is a name and the value runs across the horizontal axis.\n * Still an axis chart — pass `series` as `ChartSeries[]` with `categories`.\n * Ignored for every non-`bar` type. Default `'vertical'`.\n */\n orientation?: ChartOrientation;\n /**\n * Stroke interpolation for `line` / `area` charts (ApexCharts\n * `stroke.curve`). `'straight'` avoids the overshoot a smoothed spline\n * introduces on spiky monthly financials — where a `'smooth'` curve can dip\n * visually below zero between two positive points. Inert on `bar` (stroke\n * width is 0) and ignored on slice types. Default `'smooth'` — existing\n * charts are unaffected.\n */\n curve?: ChartCurve;\n /**\n * Override the series colour ramp. Pass **already-resolved** colour strings\n * (e.g. the live value of `var(--success)` sampled by the consumer) — these\n * are handed straight to ApexCharts, which can't read CSS custom properties.\n * When omitted, the theme bridge's `colors` ramp from `apexcharts-theme.ts`\n * is used, so existing consumers are unaffected. Typical use: a single-arc\n * `radialBar` gauge (e.g. BMI) that must change hue with the value —\n * green in the healthy band, amber/red outside it.\n */\n colors?: string[];\n /** Show the ApexCharts toolbar. Defaults to false. */\n toolbar?: boolean;\n /** Locale override — defaults to the active i18next language. */\n locale?: string;\n /**\n * radialBar only. Formats the value printed in the ring centre. Use when the\n * gauge represents a non-percentage figure: pass the arc fill (0–100) as the\n * single `series` value and return the real figure here (e.g. `(_, ) => '22.4'`).\n * Ignored for every other chart type. Defaults to ApexCharts' `${value}%`.\n */\n radialValueFormatter?: (value: number) => string;\n /**\n * Formats the numeric value of each data point wherever it is surfaced as\n * text — the tooltip, the value (y) axis on categorical charts, and the\n * screen-reader summary table. Use it to append a unit or currency symbol,\n * e.g. `(v) => new Intl.NumberFormat(locale, { style: 'currency', currency:\n * 'EUR' }).format(v)`. Defaults to `Intl.NumberFormat(locale)` (grouped\n * number, no unit). Does not apply to a `radialBar` ring centre — use\n * `radialValueFormatter` for that.\n */\n valueFormatter?: (value: number) => string;\n /**\n * Opt-in type switcher. Pass two or more of `'line' | 'bar' | 'area' |\n * 'pie' | 'donut'` to render an icon radiogroup (an `IconButtonGroup`)\n * above the plot that lets the user flip the chart between those types.\n * `type` is the initial selection and is always offered; the user's pick\n * then sticks across re-renders (remount with a new `key` to reset it).\n * When the picked type reads the other data shape, the data adapts: axis\n * series collapse to one slice per series (that series' total) for `pie` /\n * `donut`, and slice values become a single-series axis chart with\n * `labels` as the categories. `radialBar` cannot participate — such\n * entries are ignored (DEV warning) and a `radialBar` chart never shows\n * the switcher.\n */\n switchableTypes?: ChartType[];\n /** Called when the user picks a different type via the switcher. */\n onTypeChange?: (type: ChartType) => void;\n /** Extra class names on the wrapper. */\n className?: string;\n}\n\nexport interface ChartHandle {\n /** Returns a PNG data URI for the chart. */\n dataURI: () => Promise<string>;\n /**\n * Updates series without remounting. Always pass the DECLARED `type`'s\n * shape — while the user has switched the view across the axis/slice\n * boundary the values (and, for axis→slice, the slice labels) are\n * converted to the rendered shape; for slice→axis the categories stay\n * the `labels` prop, so keep the value count stable. The update writes\n * to the live ApexCharts instance only: a later type switch remounts\n * from the original props and discards it.\n */\n updateSeries: (next: ChartProps['series']) => void;\n /**\n * Switches the rendered type via the type switcher. Returns `false`\n * (no-op) when the switcher is not enabled or the type is not offered.\n */\n setType: (next: ChartType) => boolean;\n /** Declared vs rendered type plus the types the switcher offers ([] when disabled). */\n getTypeState: () => {\n declaredType: ChartType;\n effectiveType: ChartType;\n availableTypes: ChartType[];\n };\n}\n\n/* ------------------------------------------------------------------ */\n/* Constants */\n/* ------------------------------------------------------------------ */\n\nconst PATTERN_STYLES = [\n 'verticalLines',\n 'horizontalLines',\n 'slantedLines',\n 'squares',\n 'circles',\n] as const;\n\n/** Types where `categories` belong on an x-axis. */\nconst CATEGORICAL_TYPES: ReadonlyArray<ChartType> = ['line', 'bar', 'area'];\n\n/** Types where `series` is a flat `number[]` paired with `labels`. */\nconst SLICE_TYPES: ReadonlyArray<ChartType> = ['pie', 'donut', 'radialBar'];\n\n/** Types the switcher may offer. `radialBar` is excluded — its series are\n * synthetic arc percents that cannot be re-plotted on an axis or as slices. */\nconst SWITCHABLE_TYPES: ReadonlyArray<ChartType> = [\n 'line',\n 'bar',\n 'area',\n 'pie',\n 'donut',\n];\n\ntype SwitchableType = Exclude<ChartType, 'radialBar'>;\n\n/* Static key map (not template-built) so the i18n coverage tooling can see\n every key literally. */\nconst TYPE_SWITCHER_LABEL_KEYS: Record<SwitchableType, string> = {\n line: 'chart.typeSwitcher.line',\n bar: 'chart.typeSwitcher.bar',\n area: 'chart.typeSwitcher.area',\n pie: 'chart.typeSwitcher.pie',\n donut: 'chart.typeSwitcher.donut',\n};\n\nconst TYPE_SWITCHER_ICONS: Record<SwitchableType, React.ReactNode> = {\n line: <ChartLine />,\n bar: <ChartColumn />,\n area: <ChartArea />,\n pie: <ChartPie />,\n donut: <Donut />,\n};\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nfunction isSliceType(type: ChartType): boolean {\n return SLICE_TYPES.includes(type);\n}\n\nfunction isCategoricalType(type: ChartType): boolean {\n return CATEGORICAL_TYPES.includes(type);\n}\n\n/** Coerce `series` into `ChartSeries[]` for shared logic (table, aria). */\nfunction normaliseSeries(\n series: ChartSeries[] | number[],\n type: ChartType,\n): ChartSeries[] {\n if (isSliceType(type)) {\n const nums = series as number[];\n return [\n {\n name: '',\n data: nums,\n },\n ];\n }\n return series as ChartSeries[];\n}\n\n/* ------------------------------------------------------------------ */\n/* Chart component */\n/* ------------------------------------------------------------------ */\n\nexport const Chart = forwardRef<ChartHandle, ChartProps>(\n (\n {\n title,\n id,\n type,\n series,\n categories,\n labels,\n height,\n width,\n patterns = false,\n stacked = false,\n orientation = 'vertical',\n curve = 'smooth',\n colors,\n toolbar = false,\n locale: localeProp,\n radialValueFormatter,\n valueFormatter,\n switchableTypes,\n onTypeChange,\n density,\n className,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const rawId = useId();\n const chartId = useMemo(\n () => `chart-${rawId.replace(/[^a-zA-Z0-9-_]/g, '')}`,\n [rawId],\n );\n const summaryId = `${chartId}-summary`;\n\n const wrapperRef = useRef<HTMLDivElement>(null);\n const [containerWidth, setContainerWidth] = useState(0);\n\n /* ApexCharts injects focusable canvases inside the `aria-hidden` */\n /* chart wrapper. Neutralise their tabindex so axe's */\n /* `aria-hidden-focus` rule passes. Same hook used in Sparkline. */\n useNeutraliseHiddenFocus(wrapperRef);\n\n const locale = localeProp ?? i18n.language ?? 'en';\n\n /* ---- dev warning if title missing ------------------------------ */\n if (import.meta.env.DEV && !title) {\n console.warn(\n 'Chart: `title` prop is required. It drives aria-label and the screen-reader summary table.',\n );\n }\n\n /* ---- theme-reactive state -------------------------------------- */\n const [themeOptions, setThemeOptions] = useState<ApexChartsTheme>(() => {\n try {\n return getApexChartsTheme();\n } catch {\n return {};\n }\n });\n\n /* ---- MutationObserver: re-read theme on class change ------------ */\n useEffect(() => {\n if (typeof document === 'undefined') return undefined;\n let timer: ReturnType<typeof setTimeout>;\n const observer = new MutationObserver(() => {\n clearTimeout(timer);\n timer = setTimeout(() => {\n try {\n setThemeOptions(getApexChartsTheme());\n } catch {\n /* no-op in non-browser environments */\n }\n }, 50);\n });\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class'],\n });\n return () => {\n clearTimeout(timer);\n observer.disconnect();\n };\n }, []);\n\n /* ---- ResizeObserver: track container width --------------------- */\n useEffect(() => {\n const el = wrapperRef.current;\n if (!el || typeof ResizeObserver === 'undefined') return undefined;\n const ro = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) setContainerWidth(Math.floor(entry.contentRect.width));\n });\n ro.observe(el);\n return () => ro.disconnect();\n }, []);\n\n /* ---- type switcher ---------------------------------------------- */\n const switcherTypes = useMemo<SwitchableType[]>(() => {\n if (!switchableTypes || switchableTypes.length === 0) return [];\n const valid = switchableTypes.filter((entry): entry is SwitchableType =>\n SWITCHABLE_TYPES.includes(entry),\n );\n if (import.meta.env.DEV && valid.length !== switchableTypes.length) {\n console.warn(\n \"Chart: `switchableTypes` accepts 'line' | 'bar' | 'area' | 'pie' | 'donut' — other entries are ignored.\",\n );\n }\n if (!SWITCHABLE_TYPES.includes(type)) {\n if (import.meta.env.DEV && valid.length > 0) {\n console.warn(\n 'Chart: the type switcher is unavailable when `type` is \"radialBar\".',\n );\n }\n return [];\n }\n const withCurrent = valid.includes(type as SwitchableType)\n ? valid\n : [type as SwitchableType, ...valid];\n return [...new Set(withCurrent)];\n }, [switchableTypes, type]);\n const switcherEnabled = switcherTypes.length >= 2;\n\n const [pickedType, setPickedType] = useState<SwitchableType | null>(null);\n const effectiveType: ChartType =\n switcherEnabled && pickedType && switcherTypes.includes(pickedType)\n ? pickedType\n : type;\n\n /* ---- data adaptation for the switcher --------------------------- */\n /* Axis and slice types read different `series` shapes. When the user */\n /* switches across that boundary the data adapts: each axis series */\n /* becomes one slice (its total across the categories), and slice */\n /* values become one axis series with `labels` as the categories. */\n /* Same-shape switches (line/bar/area, pie/donut) pass through as-is. */\n const declaredIsSlice = isSliceType(type);\n const effectiveIsSlice = isSliceType(effectiveType);\n const { effectiveSeries, effectiveCategories, effectiveLabels } =\n useMemo(() => {\n if (declaredIsSlice === effectiveIsSlice) {\n return {\n effectiveSeries: series,\n effectiveCategories: categories,\n effectiveLabels: labels,\n };\n }\n if (!declaredIsSlice) {\n const allRows = series as ChartSeries[];\n // A previous-period total is not a slice of the current whole, so\n // compare overlays are dropped from the axis→slice collapse (their\n // grey \"prev\" slice would misread as part of the current mix). This\n // also makes compareFlags naturally [] on the slice side.\n const rows = allRows.filter((row) => row.role !== 'compare');\n if (import.meta.env.DEV && rows.length !== allRows.length) {\n console.warn(\n 'Chart: compare series are dropped on an axis→slice switch — a previous-period total is not a slice of the current whole.',\n );\n }\n const totals = rows.map((row) =>\n row.data.reduce((sum, v) => sum + v, 0),\n );\n if (import.meta.env.DEV && totals.some((v) => v < 0)) {\n console.warn(\n 'Chart: the axis→slice adaptation produced a negative series total — pie/donut cannot represent negative values. Offer only axis types in `switchableTypes` for delta-style data.',\n );\n }\n return {\n effectiveSeries: totals,\n effectiveCategories: undefined,\n effectiveLabels: rows.map((row) => row.name),\n };\n }\n const values = series as number[];\n return {\n effectiveSeries: [\n { name: t('chart.table.value'), data: values },\n ] as ChartSeries[],\n effectiveCategories: labels ?? [],\n effectiveLabels: undefined,\n };\n }, [series, categories, labels, declaredIsSlice, effectiveIsSlice, t]);\n\n /* ---- imperative handle ----------------------------------------- */\n const agentHandle = useMemo<ChartHandle>(\n () => ({\n async dataURI(): Promise<string> {\n const instance = ApexCharts.getChartByID(chartId);\n if (!instance) return '';\n const result = await instance.dataURI();\n return (result as { imgURI: string }).imgURI;\n },\n updateSeries(next) {\n const instance = ApexCharts.getChartByID(chartId);\n if (!instance) return;\n // Callers always pass the DECLARED type's shape. When the user has\n // switched the view across the axis/slice boundary, convert to what\n // the live instance actually renders (mirrors the render-time\n // adaptation) so the update never hits a mismatched instance.\n const declaredSlice = isSliceType(type);\n const renderedSlice = isSliceType(effectiveType);\n if (declaredSlice === renderedSlice) {\n if (declaredSlice) instance.updateSeries(next as number[]);\n else instance.updateSeries(next as ChartSeries[]);\n return;\n }\n if (!declaredSlice) {\n // Drop compare overlays from the collapse (mirrors the render-time\n // adaptation) so no stray \"prev\" slice appears.\n const rows = (next as ChartSeries[]).filter(\n (row) => row.role !== 'compare',\n );\n // Keep slice labels in step with the incoming series — without\n // this, a series-count or name change desyncs slices from the\n // labels captured at the last React render.\n instance.updateOptions(\n { labels: rows.map((row) => row.name) },\n false,\n true,\n );\n instance.updateSeries(\n rows.map((row) => row.data.reduce((sum, v) => sum + v, 0)),\n );\n return;\n }\n instance.updateSeries([\n { name: t('chart.table.value'), data: next as number[] },\n ]);\n },\n setType(next: ChartType): boolean {\n if (!switcherEnabled) return false;\n if (!switcherTypes.includes(next as SwitchableType)) return false;\n setPickedType(next as SwitchableType);\n return true;\n },\n getTypeState() {\n return {\n declaredType: type,\n effectiveType,\n availableTypes: switcherEnabled\n ? ([...switcherTypes] as ChartType[])\n : [],\n };\n },\n }),\n [chartId, type, effectiveType, t, switcherEnabled, switcherTypes],\n );\n useImperativeHandle(ref, () => agentHandle, [agentHandle]);\n useAgentRegistration(chartAgent, agentHandle, id);\n\n /* ---- RTL detection --------------------------------------------- */\n const isRtl =\n typeof document !== 'undefined' && document.documentElement.dir === 'rtl';\n\n /* ---- normalised series for sr-only table ----------------------- */\n const tableSeries = useMemo(\n () => normaliseSeries(effectiveSeries, effectiveType),\n [effectiveSeries, effectiveType],\n );\n\n /* ---- Intl formatter -------------------------------------------- */\n const numberFormatter = useMemo(\n () => new Intl.NumberFormat(locale),\n [locale],\n );\n\n /* ---- resolved value formatter ---------------------------------- */\n /* The consumer's `valueFormatter` (e.g. a currency formatter) wins */\n /* everywhere a data-point value is surfaced as text; otherwise we */\n /* fall back to the locale-aware grouped number. */\n const formatValue = useMemo(\n () =>\n valueFormatter ?? ((value: number) => numberFormatter.format(value)),\n [valueFormatter, numberFormatter],\n );\n\n /* ---- toolbar localisation -------------------------------------- */\n const toolbarLocale = useMemo(\n () => ({\n name: locale,\n options: {\n toolbar: {\n download: t('chart.toolbar.download'),\n selection: t('chart.toolbar.selection'),\n selectionZoom: t('chart.toolbar.selectionZoom'),\n zoomIn: t('chart.toolbar.zoomIn'),\n zoomOut: t('chart.toolbar.zoomOut'),\n pan: t('chart.toolbar.pan'),\n reset: t('chart.toolbar.reset'),\n exportToSVG: t('chart.toolbar.exportToSVG'),\n exportToPNG: t('chart.toolbar.exportToPNG'),\n exportToCSV: t('chart.toolbar.exportToCSV'),\n },\n },\n }),\n [locale, t],\n );\n\n /* ---- build ApexOptions ----------------------------------------- */\n const reducedMotion = usePrefersReducedMotion();\n\n const chartOptions: ApexCharts.ApexOptions = useMemo(() => {\n // Split the resolved compare colours off the theme object BEFORE spread:\n // `compare` must never land in the ApexCharts options (that would break\n // the byte-identical guarantee for non-compare charts). `base` is exactly\n // today's theme shape, so `...base` emits the same keys as before.\n const { compare: compareColours, ...base } = themeOptions;\n const compareMark = compareColours?.mark ?? '';\n const compareWash = compareColours?.wash ?? '';\n\n // Per-series compare flags, derived at build time from the EFFECTIVE\n // series/type so the type switcher composes: only axis types carry the\n // `role` field (slice `series` is `number[]`), so a slice view yields [].\n const compareFlags =\n isCategoricalType(effectiveType) && Array.isArray(effectiveSeries)\n ? (effectiveSeries as ChartSeries[]).map((s) => s.role === 'compare')\n : [];\n const hasCompare = compareFlags.some(Boolean);\n const barCompare = hasCompare && effectiveType === 'bar';\n\n if (\n import.meta.env.DEV &&\n hasCompare &&\n stacked &&\n isCategoricalType(effectiveType)\n ) {\n console.warn(\n 'Chart: `stacked` with a compare series — a compare overlay is normally a grouped, not stacked, series. It will be stacked with the primaries.',\n );\n }\n\n const options: ApexCharts.ApexOptions = {\n ...base,\n chart: {\n ...base.chart,\n id: chartId,\n toolbar: { show: toolbar },\n zoom: { enabled: toolbar },\n animations: {\n enabled: !reducedMotion,\n dynamicAnimation: { enabled: !reducedMotion },\n },\n locales: [toolbarLocale],\n defaultLocale: locale,\n parentHeightOffset: 0,\n // Stacking is an axis-only concept — gate on the categorical types\n // so a slice/radial chart never receives it, and omit the key\n // entirely when unstacked so the default output is byte-identical.\n ...(stacked && isCategoricalType(effectiveType)\n ? { stacked: true }\n : {}),\n },\n // Only set `labels` when the effective type actually has them (slice\n // charts). Emitting `labels: undefined` crashes ApexCharts' bar\n // renderer — `parseDataAxisCharts` reads `labels.length` and throws\n // \"Cannot read properties of undefined (reading 'length')\", which\n // aborts the render and leaves a blank chart. Absent is safe; area /\n // line tolerate the undefined but bar does not, so never pass it.\n ...(effectiveLabels ? { labels: effectiveLabels } : {}),\n legend: {\n ...base.legend,\n position: 'bottom',\n // ApexCharts legend.horizontalAlign is a physical prop mapped internally\n // to the chart's own text flow. For RTL we flip via `yaxis.opposite`\n // and ApexCharts' own `direction: 'rtl'` handling; legend stays anchored\n // to the inline-start by asking for 'left' on LTR and 'right' on RTL.\n horizontalAlign: isRtl ? 'right' : 'left',\n fontFamily: 'inherit',\n },\n tooltip: {\n ...base.tooltip,\n y: {\n formatter: (value: number) => formatValue(value),\n },\n },\n noData: {\n text: t('chart.noData'),\n },\n };\n\n // Consumer-supplied, already-resolved colour ramp wins over the theme\n // bridge's `colors`. Ignored when absent so existing charts keep the\n // tokenised ramp. ApexCharts can't read `var(--…)`, so the consumer is\n // responsible for sampling the live token value before passing it in.\n if (colors && colors.length > 0) {\n options.colors = colors;\n }\n\n // Step 1 (compare) — expand whatever ramp ApexCharts would use to one\n // entry per series and swap the compare indices for the resolved neutral\n // grey `mark`. This preserves each primary's exact colour (including\n // ApexCharts' own %-cycling for the primary indices) and greys the\n // compare stroke / fill / area source AND its legend swatch at once.\n if (hasCompare) {\n const ramp = (options.colors ?? base.colors ?? []) as string[];\n options.colors = (effectiveSeries as ChartSeries[]).map((_, i) =>\n compareFlags[i] ? compareMark : ramp[i % Math.max(ramp.length, 1)],\n );\n }\n\n if (isCategoricalType(effectiveType)) {\n // A horizontal bar makes ApexCharts swap axes: the numeric axis\n // becomes the x-axis and the categories move to the y-axis. The value\n // formatter must follow the numbers, so on a horizontal bar it lives\n // on `xaxis.labels` and the category y-axis keeps its default (string)\n // labels; every other categorical chart keeps the formatter on `yaxis`.\n const horizontalBar =\n effectiveType === 'bar' && orientation === 'horizontal';\n options.xaxis = {\n ...base.xaxis,\n categories: effectiveCategories ?? [],\n ...(horizontalBar\n ? {\n labels: {\n formatter: (value: string | number) =>\n formatValue(Number(value)),\n },\n }\n : {}),\n };\n options.yaxis = {\n ...base.yaxis,\n opposite: isRtl,\n ...(horizontalBar\n ? {}\n : { labels: { formatter: (value: number) => formatValue(value) } }),\n };\n // Step 2 (compare) — the line / area non-colour cue is a dashed stroke\n // on the compare indices (bars have a zero-width stroke and can't dash,\n // so this is skipped for bar — the cue moves to the fill in Step 3).\n // Width stays 2 for legibility; the dash + grey carry secondariness.\n options.stroke = {\n curve,\n width: effectiveType === 'bar' ? 0 : 2,\n ...(hasCompare && effectiveType !== 'bar'\n ? { dashArray: compareFlags.map((c) => (c ? 6 : 0)) }\n : {}),\n };\n options.dataLabels = { enabled: false };\n }\n\n if (effectiveType === 'radialBar' && radialValueFormatter) {\n // ApexCharts treats a radialBar series value as a 0–100 percent and\n // renders it verbatim in the ring centre. When the displayed value is\n // NOT a percentage (e.g. a BMI), the consumer scales the series to a\n // percent for the arc and supplies `radialValueFormatter` to print the\n // real value in the centre. Without this, the gauge would read \"56%\"\n // for a BMI of 22.4 — misleading. Default behaviour is untouched.\n const basePlot = (base.plotOptions ?? {}) as NonNullable<\n ApexCharts.ApexOptions['plotOptions']\n >;\n options.plotOptions = {\n ...basePlot,\n radialBar: {\n ...(basePlot.radialBar ?? {}),\n dataLabels: {\n ...(basePlot.radialBar?.dataLabels ?? {}),\n value: {\n ...(basePlot.radialBar?.dataLabels?.value ?? {}),\n formatter: (val: number) => radialValueFormatter(Number(val)),\n },\n },\n },\n };\n }\n\n // Horizontal bars for rankings. `bar` and `radialBar` are mutually\n // exclusive effective types, so this never collides with the radialBar\n // plotOptions above. Absent (vertical) = the ApexCharts default, so the\n // key is only emitted when the consumer opts in.\n if (effectiveType === 'bar' && orientation === 'horizontal') {\n const basePlot = (base.plotOptions ?? {}) as NonNullable<\n ApexCharts.ApexOptions['plotOptions']\n >;\n options.plotOptions = {\n ...basePlot,\n bar: { ...(basePlot.bar ?? {}), horizontal: true },\n };\n }\n\n // Step 3 (fill) — the compare branches sit between the global `patterns`\n // branch and the area-gradient branch. Each is gated on hasCompare /\n // barCompare, so a chart with no compare series follows today's exact\n // paths and emits byte-identical fill.\n if (patterns) {\n // Global colour-blind pattern fills. With a compare overlay, pin the\n // compare indices to a single slanted hatch so they stay tellable apart\n // (grey colour from Step 1 + fixed hatch) while the primaries keep the\n // brand-hue style ApexCharts would have cycled for that index.\n options.fill = {\n type: 'pattern',\n opacity: effectiveType === 'area' ? 0.3 : 1,\n pattern: {\n style: hasCompare\n ? compareFlags.map((c, i) =>\n c\n ? 'slantedLines'\n : PATTERN_STYLES[i % PATTERN_STYLES.length],\n )\n : [...PATTERN_STYLES],\n strokeWidth: 2,\n },\n };\n } else if (barCompare) {\n // Bars can't dash, so the non-colour cue is the fill: compare bars get\n // a hatched (slantedLines) fill over the Step-1 grey base at full\n // opacity; primaries stay solid in their brand colour. Orientation is\n // independent — ApexCharts swaps axes, not the per-series fill mapping.\n options.fill = {\n type: compareFlags.map((c) => (c ? 'pattern' : 'solid')),\n pattern: {\n style: compareFlags.map((c) =>\n c ? 'slantedLines' : 'horizontalLines',\n ),\n strokeWidth: 2,\n },\n };\n } else if (effectiveType === 'area') {\n // Area gradient. With a compare overlay, lower the compare fill opacity\n // so its grey wash sits under the dashed grey stroke without fighting\n // the primary, and tint the compare gradient with the resolved\n // `--calendar-compare-fill` wash (primaries keep the default gradient).\n options.fill = hasCompare\n ? {\n type: 'gradient',\n opacity: compareFlags.map((c) => (c ? 0.15 : 0.3)),\n gradient: {\n gradientToColors: compareFlags.map((c) =>\n c ? compareWash : undefined,\n ) as string[],\n },\n }\n : {\n type: 'gradient',\n opacity: 0.3,\n };\n }\n\n return options;\n }, [\n themeOptions,\n chartId,\n toolbar,\n reducedMotion,\n toolbarLocale,\n locale,\n effectiveLabels,\n formatValue,\n t,\n effectiveType,\n effectiveSeries,\n effectiveCategories,\n isRtl,\n patterns,\n stacked,\n orientation,\n curve,\n colors,\n radialValueFormatter,\n ]);\n\n /* ---- resolved dimensions --------------------------------------- */\n const resolvedWidth =\n width ?? (containerWidth > 0 ? containerWidth : '100%');\n const resolvedHeight = height ?? 320;\n\n /* ---- sr-only data table --------------------------------------- */\n const srTable = useMemo(() => {\n const columnLabels = isSliceType(effectiveType)\n ? (effectiveLabels ?? [])\n : (effectiveCategories ?? []);\n const rows = tableSeries;\n return (\n <table id={summaryId} className=\"ds:sr-only\">\n <caption>{title}</caption>\n <thead>\n <tr>\n <th scope=\"col\">{t('chart.table.series')}</th>\n {columnLabels.map((col, i) => (\n <th key={`${col}-${i}`} scope=\"col\">\n {col}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, rowIndex) => (\n <tr key={`${row.name}-${rowIndex}`}>\n <th scope=\"row\">{row.name || t('chart.table.value')}</th>\n {row.data.map((value, colIndex) => (\n <td key={`${rowIndex}-${colIndex}`}>\n {/* For a radialBar gauge the series is a synthetic arc\n percent — announce the consumer's display value (e.g.\n the real BMI) instead of the raw fill so AT users get\n the same figure sighted users see in the ring. */}\n {effectiveType === 'radialBar' && radialValueFormatter\n ? radialValueFormatter(value)\n : formatValue(value)}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n }, [\n effectiveType,\n tableSeries,\n effectiveLabels,\n effectiveCategories,\n summaryId,\n title,\n t,\n formatValue,\n radialValueFormatter,\n ]);\n\n /* ---- ApexCharts `series` prop shape ----------------------------- */\n const apexSeries = useMemo(() => {\n if (isSliceType(effectiveType)) {\n return effectiveSeries as number[];\n }\n return effectiveSeries as ChartSeries[];\n }, [effectiveSeries, effectiveType]);\n\n /* `key={effectiveType}` remounts ApexCharts on a switch: its in-place\n axis↔slice type transitions are unreliable (stale internal scales),\n and a clean mount is the documented-safe path. */\n const chartRegion = (\n <div\n ref={wrapperRef}\n role=\"img\"\n aria-label={title}\n aria-describedby={summaryId}\n className={chartVariants({\n // Explicit height wins over the density min-height unless the\n // caller also asked for a density explicitly.\n density: density ?? (height !== undefined ? 'none' : undefined),\n className: switcherEnabled ? undefined : className,\n })}\n {...(switcherEnabled\n ? {}\n : { 'data-component': 'chart', 'data-component-id': id })}\n >\n {srTable}\n <ReactApexChart\n key={effectiveType}\n type={effectiveType}\n series={apexSeries as ApexCharts.ApexOptions['series']}\n options={chartOptions}\n width={resolvedWidth}\n height={resolvedHeight}\n aria-hidden=\"true\"\n />\n </div>\n );\n\n if (!switcherEnabled) return chartRegion;\n\n /* The switcher cannot live inside the `role=\"img\"` region — that role\n makes the whole subtree presentational, which would strip the radios\n from the accessibility tree. It renders as a sibling above the plot,\n and the bounding `data-component` marker moves to this shared\n wrapper so the component boundary still encloses everything. */\n return (\n <div\n data-component=\"chart\"\n data-component-id={id}\n className={`ds:block ds:w-full ${className ?? ''}`.trim()}\n >\n <div className=\"ds:mb-[var(--spacing-xs)] ds:flex ds:justify-end\">\n <IconButtonGroup\n role=\"radiogroup\"\n mode=\"toggle-single\"\n size=\"sm\"\n aria-label={t('chart.typeSwitcher.label')}\n value={effectiveType}\n onValueChange={(next) => {\n // Guard: keyboard paths can re-commit the current value; the\n // contract is \"called when the user picks a DIFFERENT type\".\n if (next === effectiveType) return;\n setPickedType(next as SwitchableType);\n onTypeChange?.(next as ChartType);\n }}\n >\n {switcherTypes.map((entry) => (\n <IconButton\n key={entry}\n value={entry}\n // Explicit — the default (submit) would post a surrounding\n // consumer <form> on click/Space.\n type=\"button\"\n icon={TYPE_SWITCHER_ICONS[entry]}\n aria-label={t(TYPE_SWITCHER_LABEL_KEYS[entry])}\n />\n ))}\n </IconButtonGroup>\n </div>\n {chartRegion}\n </div>\n );\n },\n);\n\nChart.displayName = 'Chart';\n\n/* ------------------------------------------------------------------ */\n/* Re-export internal helper for downstream theming (kept narrow). */\n/* ------------------------------------------------------------------ */\n\nexport { chartVariants };\n"],"names":["__iconNode","ChartArea","createLucideIcon","ChartColumn","ChartLine","ChartPie","Donut","chartAgent","handle","args","chartVariants","cva","PATTERN_STYLES","CATEGORICAL_TYPES","SLICE_TYPES","SWITCHABLE_TYPES","TYPE_SWITCHER_LABEL_KEYS","TYPE_SWITCHER_ICONS","isSliceType","type","isCategoricalType","normaliseSeries","series","Chart","forwardRef","title","id","categories","labels","height","width","patterns","stacked","orientation","curve","colors","toolbar","localeProp","radialValueFormatter","valueFormatter","switchableTypes","onTypeChange","density","className","ref","t","i18n","useTranslation","rawId","useId","chartId","useMemo","summaryId","wrapperRef","useRef","containerWidth","setContainerWidth","useState","useNeutraliseHiddenFocus","locale","themeOptions","setThemeOptions","getApexChartsTheme","useEffect","timer","observer","el","ro","entries","entry","switcherTypes","valid","withCurrent","switcherEnabled","pickedType","setPickedType","effectiveType","declaredIsSlice","effectiveIsSlice","effectiveSeries","effectiveCategories","effectiveLabels","rows","row","sum","v","values","agentHandle","instance","ApexCharts","next","declaredSlice","renderedSlice","useImperativeHandle","useAgentRegistration","isRtl","tableSeries","numberFormatter","formatValue","value","toolbarLocale","reducedMotion","usePrefersReducedMotion","chartOptions","compareColours","base","compareMark","compareWash","compareFlags","s","hasCompare","barCompare","options","ramp","_","i","horizontalBar","c","basePlot","_a","_c","_b","val","resolvedWidth","resolvedHeight","srTable","columnLabels","jsx","jsxs","col","rowIndex","colIndex","apexSeries","chartRegion","ReactApexChart","IconButtonGroup","IconButton"],"mappings":";;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,4BAA4B,KAAK,SAAQ,CAAE;AAAA,EACzD;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMC,KAAYC,EAAiB,cAAcF,EAAU;ACnB3D;AAAA;AAAA;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EnD,UAAA;AAAA,UAAA,gBAAAoF,EAAC,OAAA,EAAI,WAAU,oDACb,UAAA,gBAAAA;AAAA,YAACQ;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,MAAK;AAAA,cACL,MAAK;AAAA,cACL,cAAY1F,EAAE,0BAA0B;AAAA,cACxC,OAAO+B;AAAA,cACP,eAAe,CAACc,MAAS;AAGvB,gBAAIA,MAASd,MACbD,GAAce,CAAsB,GACpCjD,KAAA,QAAAA,EAAeiD;AAAA,cACjB;AAAA,cAEC,UAAApB,EAAc,IAAI,CAACD,MAClB,gBAAA0D;AAAA,gBAACS;AAAA,gBAAA;AAAA,kBAEC,OAAOnE;AAAA,kBAGP,MAAK;AAAA,kBACL,MAAMpD,GAAoBoD,CAAK;AAAA,kBAC/B,cAAYxB,EAAE7B,GAAyBqD,CAAK,CAAC;AAAA,gBAAA;AAAA,gBANxCA;AAAA,cAAA,CAQR;AAAA,YAAA;AAAA,UAAA,GAEL;AAAA,UACCgE;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,IAzCwBA;AAAA,EA4C/B;AACF;AAEA9G,GAAM,cAAc;","x_google_ignoreList":[0,1,2,3,4]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-range-picker-Cfv4Sr63.js","sources":["../../node_modules/date-fns/subWeeks.js","../../node_modules/date-fns/subYears.js","../../src/components/date-range-picker/date-range-picker.agent.ts","../../src/components/date-range-picker/date-range-picker.tsx"],"sourcesContent":["import { addWeeks } from \"./addWeeks.js\";\n\n/**\n * The {@link subWeeks} function options.\n */\n\n/**\n * @name subWeeks\n * @category Week Helpers\n * @summary Subtract the specified number of weeks from the given date.\n *\n * @description\n * Subtract the specified number of weeks from the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of weeks to be subtracted.\n * @param options - An object with options\n *\n * @returns The new date with the weeks subtracted\n *\n * @example\n * // Subtract 4 weeks from 1 September 2014:\n * const result = subWeeks(new Date(2014, 8, 1), 4)\n * //=> Mon Aug 04 2014 00:00:00\n */\nexport function subWeeks(date, amount, options) {\n return addWeeks(date, -amount, options);\n}\n\n// Fallback for modularized imports:\nexport default subWeeks;\n","import { addYears } from \"./addYears.js\";\n\n/**\n * The {@link subYears} function options.\n */\n\n/**\n * @name subYears\n * @category Year Helpers\n * @summary Subtract the specified number of years from the given date.\n *\n * @description\n * Subtract the specified number of years from the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of years to be subtracted.\n * @param options - An object with options\n *\n * @returns The new date with the years subtracted\n *\n * @example\n * // Subtract 5 years from 1 September 2014:\n * const result = subYears(new Date(2014, 8, 1), 5)\n * //=> Tue Sep 01 2009 00:00:00\n */\nexport function subYears(date, amount, options) {\n return addYears(date, -amount, options);\n}\n\n// Fallback for modularized imports:\nexport default subYears;\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — DateRangePicker. */\n/* */\n/* DateRangePicker wraps react-day-picker (range mode) inside a Radix */\n/* Popover. The agent surface curates the trigger + popover into range */\n/* operations — set / clear / open / close, commit (apply / cancel), and */\n/* the Range Cockpit config (set_granularity / toggle_compare + read-only */\n/* granularity + compareRange state). */\n/* */\n/* See `src/docs/26-agent-readiness.mdx` §15. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DateRangePickerHandle } from './date-range-picker';\n\nexport const dateRangePickerAgent: AgentAdapter<DateRangePickerHandle> = {\n id: 'date-range-picker',\n capabilities: [\n 'range_pick',\n 'open',\n 'close',\n 'confirm', // apply — commit the draft range\n 'dismiss', // cancel — discard the draft\n 'set_value', // set_granularity + compare_toggle\n ],\n state: {\n range: {\n type: '{ from: iso-date | null, to: iso-date | null }',\n descriptionKey: 'ui.agent.dateRangePicker.state.range',\n description:\n 'Currently-selected ISO date range endpoints, each possibly null.',\n read: (handle) => {\n const range = handle.getRange();\n return {\n from: range.from?.toISOString() ?? null,\n to: range.to?.toISOString() ?? null,\n };\n },\n },\n isOpen: {\n type: 'boolean',\n descriptionKey: 'ui.agent.dateRangePicker.state.isOpen',\n description: 'Whether the range calendar popover is open.',\n read: (handle) => handle.isOpen(),\n },\n granularity: {\n type: \"'day' | 'week' | 'month' | 'quarter' | null\",\n descriptionKey: 'ui.agent.dateRangePicker.state.granularity',\n description:\n 'Selected time granularity (Range Cockpit), or null when the control is disabled.',\n read: (handle) => handle.getGranularity() ?? null,\n },\n compareRange: {\n type: '{ from: iso-date | null, to: iso-date | null } | null',\n descriptionKey: 'ui.agent.dateRangePicker.state.compareRange',\n description:\n 'Resolved comparison period when compare-to-previous-period is on, else null.',\n read: (handle) => {\n const compare = handle.getCompareRange();\n if (!compare) return null;\n return {\n from: compare.from?.toISOString() ?? null,\n to: compare.to?.toISOString() ?? null,\n };\n },\n },\n },\n actions: {\n set_range: {\n safety: 'write',\n argsType: '{ from: string, to: string }',\n argsSchema: {\n type: 'object',\n properties: {\n from: {\n type: 'string',\n format: 'date',\n description: 'ISO start date (inclusive).',\n },\n to: {\n type: 'string',\n format: 'date',\n description: 'ISO end date (inclusive).',\n },\n },\n required: ['from', 'to'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.dateRangePicker.actions.setRange',\n description: 'Replace the selected range with the given ISO endpoints.',\n examples: [\n {\n args: { from: '2026-06-01', to: '2026-06-30' },\n note: 'Select all of June 2026.',\n },\n ],\n invoke: (handle, args: { from: string; to: string }) => {\n handle.setRange({ from: new Date(args.from), to: new Date(args.to) });\n },\n },\n clear: {\n // Discards the selected range — loses the user's input.\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'ui.agent.dateRangePicker.actions.clear',\n description: 'Clear the selected range.',\n invoke: (handle) => {\n handle.clear();\n },\n },\n open: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.dateRangePicker.actions.open',\n description: 'Open the range calendar popover.',\n invoke: (handle) => {\n handle.open();\n },\n },\n close: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.dateRangePicker.actions.close',\n description: 'Close the range calendar popover.',\n invoke: (handle) => {\n handle.close();\n },\n },\n apply: {\n // Commits the current draft — in `commitMode=\"apply\"` this is what runs\n // the downstream query, so it is a write, not read.\n safety: 'write',\n idempotent: true,\n descriptionKey: 'ui.agent.dateRangePicker.actions.apply',\n description:\n 'Commit the current draft range (as the Apply / Done button).',\n invoke: (handle) => {\n handle.apply();\n },\n },\n cancel: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.dateRangePicker.actions.cancel',\n description: 'Discard the draft and close without committing.',\n invoke: (handle) => {\n handle.cancel();\n },\n },\n set_granularity: {\n safety: 'write',\n argsType: \"{ granularity: 'day' | 'week' | 'month' | 'quarter' }\",\n argsSchema: {\n type: 'object',\n properties: {\n granularity: {\n type: 'string',\n enum: ['day', 'week', 'month', 'quarter'],\n description: 'Time grain to query the range at.',\n },\n },\n required: ['granularity'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.dateRangePicker.actions.setGranularity',\n description: 'Set the time granularity (Range Cockpit).',\n examples: [{ args: { granularity: 'month' }, note: 'Query by month.' }],\n invoke: (\n handle,\n args: { granularity: 'day' | 'week' | 'month' | 'quarter' },\n ) => {\n handle.setGranularity(args.granularity);\n },\n },\n toggle_compare: {\n safety: 'write',\n argsType: '{ enabled: boolean }',\n argsSchema: {\n type: 'object',\n properties: {\n enabled: {\n type: 'boolean',\n description: 'Whether to compare against the previous period.',\n },\n },\n required: ['enabled'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.dateRangePicker.actions.toggleCompare',\n description: 'Turn compare-to-previous-period on or off (Range Cockpit).',\n examples: [\n { args: { enabled: true }, note: 'Enable period comparison.' },\n ],\n invoke: (handle, args: { enabled: boolean }) => {\n handle.setCompare(args.enabled);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'date-range-picker',\n description: 'Marks the DateRangePicker wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n Fragment,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type KeyboardEvent,\n} from 'react';\nimport { type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport * as Popover from '@radix-ui/react-popover';\nimport * as RadioGroup from '@radix-ui/react-radio-group';\nimport { DayPicker, type DateRange } from 'react-day-picker';\nimport {\n format as fnsFormat,\n parse as fnsParse,\n isValid,\n isAfter,\n isBefore,\n differenceInCalendarDays,\n isSameDay,\n addDays,\n subDays,\n subWeeks,\n subYears,\n startOfWeek,\n endOfWeek,\n startOfMonth,\n endOfMonth,\n} from 'date-fns';\nimport { CalendarDays, Check } from 'lucide-react';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport { useFormField } from '../form-field/form-field-context';\nimport {\n useDateFnsLocale,\n getShortDateFormat,\n buildDisabledMatcher,\n CalendarChevron,\n calendarClassNames,\n calendarCompareModifierClassNames,\n triggerVariants,\n calendarIconVariants,\n popoverContentVariants,\n presetButtonVariants,\n rangeFieldVariants,\n rangeActionVariants,\n granularityGroupVariants,\n granularityItemVariants,\n presetGroupHeadingVariants,\n} from '../_shared';\nimport { Switch } from '../switch';\nimport { useAgentRegistration } from '../../agent';\nimport { dateRangePickerAgent } from './date-range-picker.agent';\n\n/* -------------------------------------------------------------------------- */\n/* Props */\n/* -------------------------------------------------------------------------- */\n\nexport interface DateRangePreset {\n label: string;\n range: () => { from: Date; to: Date };\n /** Optional group name — presets sharing a group render under one sub-heading. */\n group?: string;\n}\n\nexport interface DateRangeValue {\n from?: Date;\n to?: Date;\n}\n\n/** Time grain the range is queried at (Range Cockpit). */\nexport type DateRangeGranularity = 'day' | 'week' | 'month' | 'quarter';\n\n/** How the comparison period is derived from the selected range. */\nexport type DateRangeCompareMode = 'previous' | 'lastYear';\n\n/** Extra data emitted alongside a committed range (Range Cockpit). */\nexport interface DateRangeApplyMeta {\n granularity?: DateRangeGranularity;\n compareRange?: DateRangeValue;\n}\n\n/** Curated imperative handle exposed via `ref` — also consumed by the agent adapter. */\nexport interface DateRangePickerHandle {\n /** Get the current selected range. */\n getRange: () => DateRangeValue;\n /** Replace the selected range. */\n setRange: (range: DateRangeValue) => void;\n /** Clear the selected range. */\n clear: () => void;\n /** Whether the popover is open. */\n isOpen: () => boolean;\n /** Open the range calendar popover. */\n open: () => void;\n /** Close the range calendar popover. */\n close: () => void;\n /** Current granularity, or undefined when the control is disabled. */\n getGranularity: () => DateRangeGranularity | undefined;\n /** Set the time granularity. */\n setGranularity: (granularity: DateRangeGranularity) => void;\n /** Current comparison period, or undefined when compare is off/incomplete. */\n getCompareRange: () => DateRangeValue | undefined;\n /** Turn compare-to-previous-period on or off. */\n setCompare: (enabled: boolean) => void;\n /** Label of the preset matching the committed range, or undefined for a custom range. */\n getActivePreset: () => string | undefined;\n /** Which endpoint the next calendar click will set, or null when the draft is complete. */\n getActiveEnd: () => 'start' | 'end' | null;\n /** Commit the current draft (as the Apply / Done button does). */\n apply: () => void;\n /** Discard the draft and close (as Cancel / Escape does). */\n cancel: () => void;\n}\n\nexport interface DateRangePickerProps extends Pick<\n VariantProps<typeof triggerVariants>,\n 'size'\n> {\n /** Current range — controlled. */\n value?: DateRangeValue;\n /** Default range — uncontrolled. */\n defaultValue?: DateRangeValue;\n /**\n * Called when the range is committed. In `commitMode=\"auto\"` (default) this\n * fires the instant the range becomes COMPLETE (both ends) — never on a\n * start-only partial. In `commitMode=\"apply\"` it fires once, on Apply.\n */\n onChange?: (range: DateRangeValue) => void;\n /**\n * Commit model.\n * - `'auto'` (default): manual selection updates a popover-local draft and\n * commits (`onChange`) the moment both ends exist; the popover stays open so\n * the user can refine, and the footer's Done button dismisses it. A preset\n * commits and closes. Right for cheap client-side filters.\n * - `'apply'`: every edit (presets, calendar, typed fields) mutates the draft\n * only; nothing commits until the Apply button. Escape / outside-click /\n * Cancel revert to the last committed value. Right for expensive queries\n * that must not fire on a half-picked range.\n */\n commitMode?: 'auto' | 'apply';\n /**\n * Called when the range is committed by a decisive action that CLOSES the\n * popover — a preset click, or the Apply button. Completing a range on the\n * calendar in `'auto'` mode fires `onChange` but keeps the popover open, so it\n * does not fire `onApply`. The optional second argument carries the Range\n * Cockpit metadata (granularity + resolved comparison range) when enabled.\n */\n onApply?: (range: DateRangeValue, meta?: DateRangeApplyMeta) => void;\n /** Called when an `'apply'`-mode edit is cancelled (Cancel / Escape / dismiss). */\n onCancel?: () => void;\n /** Show the footer Clear action. Defaults to `true`. */\n showClear?: boolean;\n /** Number of month grids to render. Defaults to `2`. */\n numberOfMonths?: number;\n /**\n * Range Cockpit — granularity. Passing `granularity` (controlled) or\n * `defaultGranularity` (uncontrolled) shows a Day / Week / Month / Quarter\n * segmented control in the header and names the queried grain.\n */\n granularity?: DateRangeGranularity;\n defaultGranularity?: DateRangeGranularity;\n onGranularityChange?: (granularity: DateRangeGranularity) => void;\n /**\n * Restrict the granularity segmented control to a subset of\n * `'day' | 'week' | 'month' | 'quarter'` — e.g. `['month', 'quarter']` for\n * data with a coarser grain. Options always render in canonical\n * Day → Quarter order regardless of the array order passed. Defaults to all\n * four (an empty array is treated as all four). Only meaningful when the\n * Cockpit granularity control is enabled (via `granularity` /\n * `defaultGranularity`) — it does not enable the control on its own. A\n * `defaultGranularity` or controlled `granularity` outside the allowed set is\n * clamped to the first allowed option.\n */\n allowedGranularities?: DateRangeGranularity[];\n /**\n * Range Cockpit — compare. When `true`, a compare-to-previous-period toggle\n * appears; enabling it overlays a neutral secondary band on the calendar and\n * (on Apply) reports the resolved comparison range via `onApply` meta and\n * `onCompareChange`.\n */\n compare?: boolean;\n /** Start with compare enabled (only meaningful when `compare` is set). */\n defaultCompare?: boolean;\n defaultCompareMode?: DateRangeCompareMode;\n onCompareChange?: (enabled: boolean, compareRange?: DateRangeValue) => void;\n /** Week start (0 = Sunday). Defaults to the locale's first day. */\n weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n /** Minimum selectable date. */\n minDate?: Date;\n /** Maximum selectable date. */\n maxDate?: Date;\n /** Custom presets. Replaces defaults unless mergePresets is true. */\n presets?: DateRangePreset[];\n /** Merge custom presets with defaults instead of replacing. */\n mergePresets?: boolean;\n /** Component size. */\n size?: 'sm' | 'md' | 'lg';\n /**\n * Trigger chrome. `'input'` (default) is the soft input look — fill + the\n * `--shadow-input` halo — that matches other form fields. `'button'` renders\n * the trigger as an outline Button (flat, `--radius-md`, no halo, `md` = 40px)\n * so the picker sits flush among Buttons in a toolbar. Use `'button'` only in\n * toolbars, not in forms: the input halo is a11y-load-bearing (it lifts the\n * field border to the WCAG 1.4.11 3:1 composite), whereas a button-chrome\n * trigger relies on its value/label like a Button does.\n */\n chrome?: 'input' | 'button';\n /** Disabled state. */\n disabled?: boolean;\n /** Placeholder text. */\n placeholder?: string;\n /** Additional class names. */\n className?: string;\n /** id override. */\n id?: string;\n}\n\nconst GRANULARITY_OPTIONS: {\n value: DateRangeGranularity;\n fallback: string;\n}[] = [\n { value: 'day', fallback: 'Day' },\n { value: 'week', fallback: 'Week' },\n { value: 'month', fallback: 'Month' },\n { value: 'quarter', fallback: 'Quarter' },\n];\n\nconst COMPARE_MODE_OPTIONS: {\n value: DateRangeCompareMode;\n fallback: string;\n}[] = [\n { value: 'previous', fallback: 'Previous period' },\n { value: 'lastYear', fallback: 'Same period last year' },\n];\n\n/* -------------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------------- */\n\nexport const DateRangePicker = forwardRef<\n DateRangePickerHandle,\n DateRangePickerProps\n>(\n (\n {\n value,\n defaultValue,\n onChange,\n commitMode = 'auto',\n onApply,\n onCancel,\n showClear = true,\n numberOfMonths = 2,\n granularity: granularityProp,\n defaultGranularity,\n onGranularityChange,\n allowedGranularities,\n compare = false,\n defaultCompare = false,\n defaultCompareMode = 'previous',\n onCompareChange,\n weekStartsOn,\n minDate,\n maxDate,\n presets: presetsProp,\n mergePresets = false,\n size = 'md',\n chrome = 'input',\n disabled,\n placeholder,\n className,\n id,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const ctx = useFormField();\n const effectiveId = id ?? ctx.id;\n const effectiveDisabled = ctx.disabled || disabled;\n const effectiveTone = ctx.invalid ? 'error' : 'default';\n\n const locale = useDateFnsLocale(i18n.language);\n const dateFormat = getShortDateFormat(i18n.language);\n const placeholderText =\n placeholder ??\n t('inputs.dateRangePicker.placeholder', 'Select date range');\n\n const [currentValueRaw, setDateRangeValue] =\n useControllableState<DateRangeValue>({\n value,\n defaultValue: defaultValue ?? {},\n onChange,\n });\n const currentValue: DateRangeValue = currentValueRaw ?? {};\n\n const [open, setOpen] = useState(false);\n // Popover-local draft — the working range while the popover is open. In\n // `auto` it commits to `currentValue` the moment it is complete; in `apply`\n // it stays local until Apply. Seeded from the committed value on open.\n const [draft, setDraft] = useState<DateRangeValue>(currentValue);\n const [month, setMonth] = useState<Date>(currentValue.from ?? new Date());\n\n // Editable endpoint field text + parse-error flags.\n const [startText, setStartText] = useState('');\n const [endText, setEndText] = useState('');\n const [startInvalid, setStartInvalid] = useState(false);\n const [endInvalid, setEndInvalid] = useState(false);\n\n // Range Cockpit state (all opt-in; the default picker never renders these).\n const granularityEnabled =\n granularityProp !== undefined || defaultGranularity !== undefined;\n // Restrict the granularity control to an allowed subset (default = all four;\n // an empty array is treated as \"all\"). Filtering GRANULARITY_OPTIONS keeps\n // the canonical Day → Quarter order no matter what order the consumer passes.\n const allowedGranularitySet =\n allowedGranularities && allowedGranularities.length > 0\n ? allowedGranularities\n : undefined;\n const visibleGranularityOptions = allowedGranularitySet\n ? GRANULARITY_OPTIONS.filter((o) =>\n allowedGranularitySet.includes(o.value),\n )\n : GRANULARITY_OPTIONS;\n const clampGranularity = (g: DateRangeGranularity): DateRangeGranularity =>\n !allowedGranularitySet || allowedGranularitySet.includes(g)\n ? g\n : (visibleGranularityOptions[0]?.value ?? g);\n const [granularity, setGranularity] =\n useControllableState<DateRangeGranularity>({\n value: granularityProp,\n defaultValue: clampGranularity(defaultGranularity ?? 'day'),\n onChange: onGranularityChange,\n });\n // The clamped granularity actually shown / reported — guards a controlled\n // `granularity` prop that sits outside the allowed set. Equal to\n // `granularity` when unrestricted, so default output is unchanged.\n const resolvedGranularity = clampGranularity(granularity ?? 'day');\n const [compareEnabled, setCompareEnabled] = useState(defaultCompare);\n const [compareMode, setCompareMode] =\n useState<DateRangeCompareMode>(defaultCompareMode);\n\n const triggerRef = useRef<HTMLButtonElement>(null);\n // Set true immediately before a commit-and-close so the close handler does\n // not also fire the `apply`-mode cancel path.\n const committingRef = useRef(false);\n\n const titleId = useId();\n const startFieldId = useId();\n const endFieldId = useId();\n const gridLabelId = useId();\n const errorId = useId();\n // The compare Switch gets its OWN id so — inside a FormField — it does not\n // inherit the field's id (which would clash with / steal the trigger label).\n const compareId = useId();\n\n const emit = useCallback(\n (range: DateRangeValue) => {\n setDateRangeValue(range);\n },\n [setDateRangeValue],\n );\n\n const disabledMatcher = buildDisabledMatcher(minDate, maxDate);\n\n // `buildDisabledMatcher` returns an rdp Matcher (for the grid), not a\n // predicate — so validate a TYPED endpoint against min/max directly.\n const isDateBlocked = (d: Date): boolean =>\n (minDate ? isBefore(d, minDate) : false) ||\n (maxDate ? isAfter(d, maxDate) : false);\n\n // Seed the draft from the committed value whenever the popover opens —\n // works for both the Radix trigger and the imperative handle / agent\n // `open()`, and resets any stale parse-error state.\n useEffect(() => {\n if (open) {\n setDraft(currentValue);\n setStartInvalid(false);\n setEndInvalid(false);\n // Clear the commit guard on EVERY open transition (trigger, imperative\n // handle, agent) so a later Escape / outside-dismiss still runs the\n // apply-mode cancel path even if the last close was a commit.\n committingRef.current = false;\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- seed only on the open transition; must not re-seed as currentValue changes mid-edit\n }, [open]);\n\n // Keep the visible field text in sync with the draft (e.g. after a calendar\n // click or a preset), unless the user is mid-typing an invalid value.\n useEffect(() => {\n if (!startInvalid) {\n setStartText(\n draft.from ? fnsFormat(draft.from, dateFormat, { locale }) : '',\n );\n }\n if (!endInvalid) {\n setEndText(draft.to ? fnsFormat(draft.to, dateFormat, { locale }) : '');\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- text follows the draft; invalid flags gate the overwrite intentionally\n }, [draft.from, draft.to, dateFormat, locale]);\n\n // Default presets\n const defaultPresets: DateRangePreset[] = [\n {\n label: t('inputs.dateRangePicker.presets.today', 'Today'),\n range: () => {\n const today = new Date();\n return { from: today, to: today };\n },\n },\n {\n label: t('inputs.dateRangePicker.presets.yesterday', 'Yesterday'),\n range: () => {\n const yesterday = subDays(new Date(), 1);\n return { from: yesterday, to: yesterday };\n },\n },\n {\n label: t('inputs.dateRangePicker.presets.last7', 'Last 7 days'),\n range: () => ({\n from: subDays(new Date(), 6),\n to: new Date(),\n }),\n },\n {\n label: t('inputs.dateRangePicker.presets.thisWeek', 'This week'),\n range: () => ({\n // `weekStartsOn` (when set) overrides the locale's first day; when\n // undefined date-fns falls back to the locale.\n from: startOfWeek(new Date(), { locale, weekStartsOn }),\n to: endOfWeek(new Date(), { locale, weekStartsOn }),\n }),\n },\n {\n label: t('inputs.dateRangePicker.presets.lastWeek', 'Last week'),\n range: () => {\n const lastWeekDay = subWeeks(new Date(), 1);\n return {\n from: startOfWeek(lastWeekDay, { locale, weekStartsOn }),\n to: endOfWeek(lastWeekDay, { locale, weekStartsOn }),\n };\n },\n },\n {\n label: t('inputs.dateRangePicker.presets.thisMonth', 'This month'),\n range: () => ({\n from: startOfMonth(new Date()),\n to: endOfMonth(new Date()),\n }),\n },\n {\n label: t('inputs.dateRangePicker.presets.last30', 'Last 30 days'),\n range: () => ({\n from: subDays(new Date(), 29),\n to: new Date(),\n }),\n },\n ];\n\n const effectivePresets = presetsProp\n ? mergePresets\n ? [...defaultPresets, ...presetsProp]\n : presetsProp\n : defaultPresets;\n\n // Preset groups (Range Cockpit grouped rail). If no preset declares a\n // `group`, this collapses to a single unnamed group == the flat list.\n const presetGroups = (() => {\n const order: string[] = [];\n const byGroup = new Map<string, DateRangePreset[]>();\n for (const preset of effectivePresets) {\n const key = preset.group ?? '';\n if (!byGroup.has(key)) {\n byGroup.set(key, []);\n order.push(key);\n }\n byGroup.get(key)!.push(preset);\n }\n return order.map((key) => ({ group: key, presets: byGroup.get(key)! }));\n })();\n const hasPresetGroups = presetGroups.some((g) => g.group !== '');\n\n // Derive the comparison period from a base range. `mode` defaults to the\n // current state, but callers that are ALSO changing the mode pass the new\n // value explicitly (React state updates are async, so the closure would\n // otherwise still see the old mode).\n const computeCompareRange = (\n base: DateRangeValue,\n mode: DateRangeCompareMode = compareMode,\n ): DateRangeValue | undefined => {\n if (!base.from || !base.to) return undefined;\n if (mode === 'lastYear') {\n // Shift back one year. (For a selected range longer than a year the\n // comparison would overlap the primary band; that is an unusual\n // period-over-period selection and is left as-is.)\n return { from: subYears(base.from, 1), to: subYears(base.to, 1) };\n }\n // 'previous': same length, immediately before the start.\n const length = differenceInCalendarDays(base.to, base.from);\n const to = subDays(base.from, 1);\n return { from: subDays(to, length), to };\n };\n\n const compareActive = compare && compareEnabled;\n const draftCompareRange = compareActive\n ? computeCompareRange(draft)\n : undefined;\n const compareModifiers:\n | Record<string, Date | { from: Date; to: Date }>\n | undefined = (() => {\n if (!draftCompareRange?.from || !draftCompareRange.to) return undefined;\n const from = draftCompareRange.from;\n const to = draftCompareRange.to;\n const mods: Record<string, Date | { from: Date; to: Date }> = {\n compareStart: from,\n compareEnd: to,\n };\n // Only add the middle band for spans of 3+ days. For a 1-2 day span the\n // start/end caps fully describe it, and an inverted middle range\n // ({from: from+1, to: to-1}) would be SWAPPED by rdp and paint cells\n // outside the comparison period (including the selected day).\n if (differenceInCalendarDays(to, from) >= 2) {\n mods.compareMiddle = { from: addDays(from, 1), to: subDays(to, 1) };\n }\n return mods;\n })();\n\n const applyMeta = (\n base: DateRangeValue,\n ): DateRangeApplyMeta | undefined => {\n const meta: DateRangeApplyMeta = {};\n if (granularityEnabled) meta.granularity = resolvedGranularity;\n if (compareActive) meta.compareRange = computeCompareRange(base);\n return meta.granularity || meta.compareRange ? meta : undefined;\n };\n\n const handleCompareModeChange = (v: string) => {\n const mode = v as DateRangeCompareMode;\n setCompareMode(mode);\n // Report the recomputed comparison range for the newly-selected mode.\n if (compareActive) {\n onCompareChange?.(true, computeCompareRange(draft, mode));\n }\n };\n\n const handleCompareToggle = (next: boolean) => {\n setCompareEnabled(next);\n onCompareChange?.(next, next ? computeCompareRange(draft) : undefined);\n };\n\n /**\n * Update the draft. In `auto` mode, commit the instant the range is\n * complete (both ends) — and NEVER on a start-only partial, which removes\n * the old half-open `{from, to:undefined}` emit.\n */\n const updateDraft = useCallback(\n (next: DateRangeValue) => {\n setDraft(next);\n if (commitMode === 'auto' && next.from && next.to) {\n emit(next);\n }\n },\n [commitMode, emit],\n );\n\n const handleRangeSelect = (range: DateRange | undefined) => {\n // Picking on the calendar clears any stale typed-field parse error.\n setStartInvalid(false);\n setEndInvalid(false);\n updateDraft({ from: range?.from, to: range?.to });\n };\n\n const handlePresetClick = (preset: DateRangePreset) => {\n const range = preset.range();\n setStartInvalid(false);\n setEndInvalid(false);\n setDraft(range);\n setMonth(range.from);\n if (commitMode === 'auto') {\n emit(range);\n onApply?.(range, applyMeta(range));\n committingRef.current = true;\n setOpen(false);\n }\n };\n\n /** Parse + apply one typed endpoint, keeping `from <= to`. */\n const commitField = (which: 'from' | 'to', text: string) => {\n const setInvalid = which === 'from' ? setStartInvalid : setEndInvalid;\n if (text.trim() === '') {\n setInvalid(false);\n updateDraft(\n which === 'from'\n ? { from: undefined, to: draft.to }\n : { from: draft.from, to: undefined },\n );\n return;\n }\n const parsed = fnsParse(text, dateFormat, new Date(), { locale });\n if (!isValid(parsed) || isDateBlocked(parsed)) {\n setInvalid(true);\n return;\n }\n setInvalid(false);\n let next: DateRangeValue;\n if (which === 'from') {\n next =\n draft.to && isAfter(parsed, draft.to)\n ? { from: parsed, to: undefined }\n : { from: parsed, to: draft.to };\n } else {\n next =\n draft.from && isAfter(draft.from, parsed)\n ? { from: parsed, to: undefined }\n : { from: draft.from, to: parsed };\n }\n setMonth(parsed);\n updateDraft(next);\n };\n\n const handleFieldKeyDown =\n (which: 'from' | 'to') => (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n commitField(which, which === 'from' ? startText : endText);\n }\n };\n\n const handleClear = () => {\n setDraft({});\n setStartInvalid(false);\n setEndInvalid(false);\n if (commitMode === 'auto') {\n emit({});\n }\n };\n\n // The draft can be applied when it is a COMPLETE range or fully EMPTY\n // (so Clear -> Apply can commit a cleared range) — but not a half-picked\n // `{ from, to:undefined }` partial.\n const draftComplete = Boolean(draft.from && draft.to);\n const draftEmpty = !draft.from && !draft.to;\n // Block the commit while a typed field is showing a parse error, so Apply\n // can't silently save the last-valid range while the user sees an error.\n const canApply =\n (draftComplete || draftEmpty) && !startInvalid && !endInvalid;\n\n const handleApply = () => {\n if (canApply) {\n emit(draft);\n onApply?.(draft, applyMeta(draft));\n }\n committingRef.current = true;\n setOpen(false);\n };\n\n const handleDone = () => {\n committingRef.current = true;\n setOpen(false);\n };\n\n // Programmatic `setOpen(false)` does NOT call Radix's `onOpenChange`, so the\n // Cancel button reverts explicitly (only Escape / outside-dismiss flows\n // through `handleOpenChange`).\n const handleCancel = () => {\n if (commitMode === 'apply') {\n onCancel?.();\n }\n setDraft(currentValue);\n setOpen(false);\n };\n\n const handleOpenChange = (next: boolean) => {\n if (next) {\n // Opening — the draft is seeded by the `open` effect below (which also\n // covers opening via the imperative handle / agent, not just Radix).\n committingRef.current = false;\n setOpen(true);\n return;\n }\n // Closing. A dismiss (Escape / outside-click) that is NOT one of our\n // commit buttons reverts the draft in `apply` mode.\n if (commitMode === 'apply' && !committingRef.current) {\n onCancel?.();\n }\n setDraft(currentValue);\n committingRef.current = false;\n setOpen(false);\n };\n\n // A preset is \"active\" when the committed range matches the range it would\n // produce (same calendar day at both ends) — so the highlighted band and\n // its shortcut visibly agree, and a custom range simply matches nothing.\n const isPresetActive = (preset: DateRangePreset): boolean => {\n if (!currentValue.from || !currentValue.to) return false;\n const range = preset.range();\n return (\n isSameDay(range.from, currentValue.from) &&\n isSameDay(range.to, currentValue.to)\n );\n };\n\n // Trigger label reflects the COMMITTED value (locale-aware short format).\n const displayText = (() => {\n if (currentValue.from && currentValue.to) {\n const fromStr = fnsFormat(currentValue.from, dateFormat, { locale });\n const toStr = fnsFormat(currentValue.to, dateFormat, { locale });\n return `${fromStr} – ${toStr}`;\n }\n if (currentValue.from) {\n return fnsFormat(currentValue.from, dateFormat, { locale });\n }\n return '';\n })();\n\n // Which endpoint the next calendar click will set — drives the field ring\n // and the guidance line.\n const activeEnd: 'start' | 'end' | null = !draft.from\n ? 'start'\n : !draft.to\n ? 'end'\n : null;\n\n // Footer live-region text: selection guidance until complete, then the full\n // localised summary (dates + day count), never a bare number.\n const summaryText = (() => {\n if (!draft.from) {\n return t('inputs.dateRangePicker.selectStart', 'Select start date');\n }\n if (!draft.to) {\n return t('inputs.dateRangePicker.selectEnd', 'Select end date');\n }\n // Compose the summary with a PLURALISED day count (via the `days_*`\n // plural keys) so the live region reads \"… · 1 day\" / \"… · 15 days\"\n // grammatically, rather than the \"{{count}} day(s)\" literal.\n const days = differenceInCalendarDays(draft.to, draft.from) + 1;\n const fromStr = fnsFormat(draft.from, dateFormat, { locale });\n const toStr = fnsFormat(draft.to, dateFormat, { locale });\n const daysLabel = t('inputs.dateRangePicker.days', { count: days });\n return `${fromStr} – ${toStr} · ${daysLabel}`;\n })();\n\n // A live pointer to the render-scoped values the imperative handle reads,\n // so the handle object stays STABLE (agent registers once) while always\n // reflecting current state.\n const liveRef = useRef({\n currentValue,\n open,\n getGranularity: (): DateRangeGranularity | undefined =>\n granularityEnabled ? resolvedGranularity : undefined,\n setGranularity: (g: DateRangeGranularity): void =>\n setGranularity(clampGranularity(g)),\n getCompareRange: (): DateRangeValue | undefined =>\n compareActive ? computeCompareRange(currentValue) : undefined,\n setCompare: (enabled: boolean): void => handleCompareToggle(enabled),\n getActivePreset: (): string | undefined =>\n effectivePresets.find(isPresetActive)?.label,\n getActiveEnd: (): 'start' | 'end' | null => activeEnd,\n apply: () => handleApply(),\n cancel: () => handleCancel(),\n });\n liveRef.current = {\n currentValue,\n open,\n getGranularity: () =>\n granularityEnabled ? resolvedGranularity : undefined,\n setGranularity: (g: DateRangeGranularity) =>\n setGranularity(clampGranularity(g)),\n getCompareRange: () =>\n compareActive ? computeCompareRange(currentValue) : undefined,\n setCompare: (enabled: boolean) => handleCompareToggle(enabled),\n getActivePreset: () => effectivePresets.find(isPresetActive)?.label,\n getActiveEnd: () => activeEnd,\n apply: () => handleApply(),\n cancel: () => handleCancel(),\n };\n\n const handle = useMemo<DateRangePickerHandle>(\n () => ({\n getRange: () => liveRef.current.currentValue,\n setRange: (range) => emit(range),\n clear: () => emit({}),\n isOpen: () => liveRef.current.open,\n open: () => setOpen(true),\n close: () => setOpen(false),\n getGranularity: () => liveRef.current.getGranularity(),\n setGranularity: (g) => liveRef.current.setGranularity(g),\n getCompareRange: () => liveRef.current.getCompareRange(),\n setCompare: (enabled) => liveRef.current.setCompare(enabled),\n getActivePreset: () => liveRef.current.getActivePreset(),\n getActiveEnd: () => liveRef.current.getActiveEnd(),\n apply: () => liveRef.current.apply(),\n cancel: () => liveRef.current.cancel(),\n }),\n [emit],\n );\n\n useImperativeHandle(ref, () => handle, [handle]);\n useAgentRegistration(dateRangePickerAgent, handle, effectiveId);\n\n const fieldState = (which: 'from' | 'to') => {\n if (which === 'from') {\n return startInvalid\n ? 'error'\n : activeEnd === 'start'\n ? 'active'\n : 'default';\n }\n return endInvalid ? 'error' : activeEnd === 'end' ? 'active' : 'default';\n };\n\n return (\n <Popover.Root open={open} onOpenChange={handleOpenChange}>\n <div\n className={className}\n data-component=\"date-range-picker\"\n data-component-id={effectiveId}\n >\n <Popover.Trigger asChild disabled={effectiveDisabled}>\n {/* eslint-disable-next-line jsx-a11y/role-supports-aria-props -- FormField propagates invalid state to its trigger; users rely on this for validation announcements */}\n <button\n ref={triggerRef}\n id={effectiveId}\n type=\"button\"\n disabled={effectiveDisabled}\n aria-describedby={ctx.describedBy || undefined}\n aria-invalid={ctx.invalid || undefined}\n // `aria-required` is not valid on `<button>` per ARIA 1.2 — the\n // FormField label's visible asterisk + `aria-describedby` link\n // communicate the required state instead.\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n className={triggerVariants({ size, tone: effectiveTone, chrome })}\n >\n <span\n className={[\n // Truncate so a long value/placeholder ellipsises instead of\n // running under the absolutely-positioned calendar icon (the\n // trigger reserves the icon's space via `pe-10`). `min-w-0`\n // lets the flex child shrink below its content width so\n // `truncate` engages.\n 'ds:min-w-0 ds:flex-1 ds:truncate ds:text-start',\n displayText\n ? 'ds:text-foreground'\n : 'ds:text-muted-foreground',\n ].join(' ')}\n >\n {displayText || placeholderText}\n </span>\n <span\n aria-hidden=\"true\"\n className={calendarIconVariants({ size })}\n >\n <CalendarDays />\n </span>\n </button>\n </Popover.Trigger>\n\n <Popover.Portal>\n <Popover.Content\n sideOffset={4}\n align=\"start\"\n role=\"dialog\"\n // Name the dialog with a direct `aria-label` rather than\n // `aria-labelledby` to the header title — the cross-reference did\n // not resolve reliably on the Radix-portaled content in a real\n // browser (axe `aria-dialog-name`), whereas a literal label is\n // read directly. The visible `<h2>` title still repeats it.\n aria-label={t(\n 'inputs.dateRangePicker.title',\n 'Select date range',\n )}\n className={popoverContentVariants()}\n >\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n {/* Header — title + editable Start / End endpoints */}\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <div className=\"ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]\">\n <h2\n id={titleId}\n className=\"type-body-sm ds:font-semibold ds:text-foreground\"\n >\n {t('inputs.dateRangePicker.title', 'Select date range')}\n </h2>\n {granularityEnabled ? (\n <RadioGroup.Root\n value={resolvedGranularity}\n onValueChange={(v) =>\n setGranularity(\n clampGranularity(v as DateRangeGranularity),\n )\n }\n aria-label={t(\n 'inputs.dateRangePicker.granularityLabel',\n 'Granularity',\n )}\n className={granularityGroupVariants()}\n >\n {visibleGranularityOptions.map((o) => (\n <RadioGroup.Item\n key={o.value}\n value={o.value}\n className={granularityItemVariants()}\n >\n {t(\n `inputs.dateRangePicker.granularity.${o.value}`,\n o.fallback,\n )}\n </RadioGroup.Item>\n ))}\n </RadioGroup.Root>\n ) : null}\n </div>\n <div className=\"ds:flex ds:items-end ds:gap-[var(--spacing-xs)]\">\n <div className=\"ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <label\n htmlFor={startFieldId}\n className=\"ds:text-[length:var(--font-size-xs)] ds:text-muted-foreground\"\n >\n {t('inputs.dateRangePicker.startLabel', 'Start date')}\n </label>\n <input\n id={startFieldId}\n type=\"text\"\n inputMode=\"numeric\"\n value={startText}\n placeholder={dateFormat.toUpperCase()}\n aria-invalid={startInvalid || undefined}\n aria-describedby={startInvalid ? errorId : undefined}\n onChange={(e: ChangeEvent<HTMLInputElement>) =>\n setStartText(e.target.value)\n }\n onBlur={(e) => commitField('from', e.target.value)}\n onKeyDown={handleFieldKeyDown('from')}\n className={rangeFieldVariants({\n state: fieldState('from'),\n })}\n />\n </div>\n <span\n aria-hidden=\"true\"\n className=\"ds:pb-[var(--spacing-xs)] ds:text-muted-foreground\"\n >\n {'–'}\n </span>\n <div className=\"ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <label\n htmlFor={endFieldId}\n className=\"ds:text-[length:var(--font-size-xs)] ds:text-muted-foreground\"\n >\n {t('inputs.dateRangePicker.endLabel', 'End date')}\n </label>\n <input\n id={endFieldId}\n type=\"text\"\n inputMode=\"numeric\"\n value={endText}\n placeholder={dateFormat.toUpperCase()}\n aria-invalid={endInvalid || undefined}\n aria-describedby={endInvalid ? errorId : undefined}\n onChange={(e: ChangeEvent<HTMLInputElement>) =>\n setEndText(e.target.value)\n }\n onBlur={(e) => commitField('to', e.target.value)}\n onKeyDown={handleFieldKeyDown('to')}\n className={rangeFieldVariants({\n state: fieldState('to'),\n })}\n />\n </div>\n </div>\n {startInvalid || endInvalid ? (\n <p\n id={errorId}\n role=\"alert\"\n className=\"ds:text-[length:var(--font-size-xs)] ds:text-destructive\"\n >\n {t(\n 'inputs.dateRangePicker.invalidDate',\n 'Enter a date as {{format}}',\n {\n format: dateFormat.toUpperCase(),\n },\n )}\n </p>\n ) : null}\n </div>\n\n {/* Body — presets + dual calendar */}\n <div className=\"ds:flex ds:gap-[var(--spacing-md)]\">\n {effectivePresets.length > 0 ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:min-w-[8rem] ds:border-e ds:border-border ds:pe-[var(--spacing-md)]\">\n {presetGroups.map((grp, gi) => {\n const headingId = `${titleId}-pg${gi}`;\n const buttons = grp.presets.map((preset) => {\n const active = isPresetActive(preset);\n return (\n <button\n key={preset.label}\n type=\"button\"\n aria-pressed={active}\n onClick={() => handlePresetClick(preset)}\n className={presetButtonVariants({ active })}\n >\n <span className=\"ds:min-w-0 ds:truncate\">\n {preset.label}\n </span>\n {active ? (\n <Check\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:shrink-0 ds:text-primary\"\n />\n ) : null}\n </button>\n );\n });\n // A named group is a labelled `role=\"group\"` so the\n // visual grouping is conveyed to assistive tech.\n if (hasPresetGroups && grp.group) {\n return (\n <div\n key={grp.group}\n role=\"group\"\n aria-labelledby={headingId}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\"\n >\n <div\n id={headingId}\n className={presetGroupHeadingVariants()}\n >\n {grp.group}\n </div>\n {buttons}\n </div>\n );\n }\n return (\n <Fragment key={grp.group || '_ungrouped'}>\n {buttons}\n </Fragment>\n );\n })}\n </div>\n ) : null}\n\n <div role=\"region\" aria-labelledby={gridLabelId}>\n <span id={gridLabelId} className=\"ds:sr-only\">\n {t('inputs.dateRangePicker.gridLabel', 'Calendar')}\n </span>\n <DayPicker\n mode=\"range\"\n selected={\n draft.from\n ? { from: draft.from, to: draft.to }\n : undefined\n }\n onSelect={handleRangeSelect}\n month={month}\n onMonthChange={setMonth}\n numberOfMonths={numberOfMonths}\n weekStartsOn={weekStartsOn}\n disabled={disabledMatcher}\n locale={locale}\n showOutsideDays\n fixedWeeks\n pagedNavigation\n classNames={calendarClassNames}\n modifiers={compareModifiers}\n modifiersClassNames={calendarCompareModifierClassNames}\n components={{ Chevron: CalendarChevron }}\n />\n </div>\n </div>\n\n {/* Compare-to-previous-period row (Range Cockpit) */}\n {compare ? (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)] ds:border-t ds:border-border ds:pt-[var(--spacing-sm)]\">\n <Switch\n id={compareId}\n label={t(\n 'inputs.dateRangePicker.compareLabel',\n 'Compare to previous period',\n )}\n size=\"sm\"\n checked={compareEnabled}\n onCheckedChange={handleCompareToggle}\n />\n {compareActive && draftCompareRange ? (\n <span className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-[length:var(--font-size-xs)] ds:text-muted-foreground\">\n <span\n aria-hidden=\"true\"\n className=\"ds:inline-block ds:size-3 ds:rounded-[calc(var(--radius-sm)-2px)] ds:bg-[var(--calendar-compare-fill)] ds:border-b-2 ds:border-dashed ds:border-b-[var(--calendar-compare-edge)]\"\n />\n {`${fnsFormat(draftCompareRange.from as Date, dateFormat, { locale })} – ${fnsFormat(draftCompareRange.to as Date, dateFormat, { locale })}`}\n </span>\n ) : null}\n {compareEnabled ? (\n <RadioGroup.Root\n value={compareMode}\n onValueChange={handleCompareModeChange}\n aria-label={t(\n 'inputs.dateRangePicker.compareModeLabel',\n 'Comparison period',\n )}\n className={`${granularityGroupVariants()} ds:ms-auto`}\n >\n {COMPARE_MODE_OPTIONS.map((o) => (\n <RadioGroup.Item\n key={o.value}\n value={o.value}\n className={granularityItemVariants()}\n >\n {t(\n `inputs.dateRangePicker.compareMode.${o.value}`,\n o.fallback,\n )}\n </RadioGroup.Item>\n ))}\n </RadioGroup.Root>\n ) : null}\n </div>\n ) : null}\n\n {/* Footer — persistent live summary + actions */}\n <div className=\"ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-md)] ds:border-t ds:border-border ds:pt-[var(--spacing-sm)]\">\n <div\n role=\"status\"\n aria-live=\"polite\"\n className=\"type-body-sm ds:min-w-0 ds:truncate ds:text-muted-foreground\"\n >\n {summaryText}\n </div>\n <div className=\"ds:flex ds:shrink-0 ds:gap-[var(--spacing-xs)]\">\n {showClear ? (\n <button\n type=\"button\"\n onClick={handleClear}\n className={rangeActionVariants({ intent: 'ghost' })}\n >\n {t('inputs.dateRangePicker.clear', 'Clear')}\n </button>\n ) : null}\n {commitMode === 'apply' ? (\n <>\n <button\n type=\"button\"\n onClick={handleCancel}\n className={rangeActionVariants({ intent: 'ghost' })}\n >\n {t('inputs.dateRangePicker.cancel', 'Cancel')}\n </button>\n <button\n type=\"button\"\n disabled={!canApply}\n onClick={handleApply}\n className={rangeActionVariants({ intent: 'primary' })}\n >\n {t('inputs.dateRangePicker.apply', 'Apply')}\n </button>\n </>\n ) : (\n <button\n type=\"button\"\n onClick={handleDone}\n className={rangeActionVariants({ intent: 'primary' })}\n >\n {t('inputs.dateRangePicker.done', 'Done')}\n </button>\n )}\n </div>\n </div>\n </div>\n </Popover.Content>\n </Popover.Portal>\n </div>\n </Popover.Root>\n );\n },\n);\n\nDateRangePicker.displayName = 'DateRangePicker';\n"],"names":["subWeeks","date","amount","options","addWeeks","subYears","addYears","dateRangePickerAgent","handle","range","_a","_b","compare","args","GRANULARITY_OPTIONS","COMPARE_MODE_OPTIONS","DateRangePicker","forwardRef","value","defaultValue","onChange","commitMode","onApply","onCancel","showClear","numberOfMonths","granularityProp","defaultGranularity","onGranularityChange","allowedGranularities","defaultCompare","defaultCompareMode","onCompareChange","weekStartsOn","minDate","maxDate","presetsProp","mergePresets","size","chrome","disabled","placeholder","className","id","ref","t","i18n","useTranslation","ctx","useFormField","effectiveId","effectiveDisabled","effectiveTone","locale","useDateFnsLocale","dateFormat","getShortDateFormat","placeholderText","currentValueRaw","setDateRangeValue","useControllableState","currentValue","open","setOpen","useState","draft","setDraft","month","setMonth","startText","setStartText","endText","setEndText","startInvalid","setStartInvalid","endInvalid","setEndInvalid","granularityEnabled","allowedGranularitySet","visibleGranularityOptions","o","clampGranularity","g","granularity","setGranularity","resolvedGranularity","compareEnabled","setCompareEnabled","compareMode","setCompareMode","triggerRef","useRef","committingRef","titleId","useId","startFieldId","endFieldId","gridLabelId","errorId","compareId","emit","useCallback","disabledMatcher","buildDisabledMatcher","isDateBlocked","d","isBefore","isAfter","useEffect","fnsFormat","defaultPresets","today","yesterday","subDays","startOfWeek","endOfWeek","lastWeekDay","startOfMonth","endOfMonth","effectivePresets","presetGroups","order","byGroup","preset","key","hasPresetGroups","computeCompareRange","base","mode","length","differenceInCalendarDays","to","compareActive","draftCompareRange","compareModifiers","from","mods","addDays","applyMeta","meta","handleCompareModeChange","v","handleCompareToggle","next","updateDraft","handleRangeSelect","handlePresetClick","commitField","which","text","setInvalid","parsed","fnsParse","isValid","handleFieldKeyDown","e","handleClear","draftComplete","draftEmpty","canApply","handleApply","handleDone","handleCancel","handleOpenChange","isPresetActive","isSameDay","displayText","fromStr","toStr","activeEnd","summaryText","days","daysLabel","liveRef","enabled","useMemo","useImperativeHandle","useAgentRegistration","fieldState","Popover","jsxs","jsx","triggerVariants","calendarIconVariants","CalendarDays","popoverContentVariants","RadioGroup","granularityGroupVariants","granularityItemVariants","rangeFieldVariants","grp","gi","headingId","buttons","active","presetButtonVariants","Check","presetGroupHeadingVariants","Fragment","DayPicker","calendarClassNames","calendarCompareModifierClassNames","CalendarChevron","Switch","rangeActionVariants"],"mappings":";;;;;;;;;;;;;;;AA4BO,SAASA,GAASC,GAAMC,GAAQC,GAAS;AAC9C,SAAOC,GAASH,GAAM,IAASE,CAAO;AACxC;ACFO,SAASE,GAASJ,GAAMC,GAAQC,GAAS;AAC9C,SAAOG,GAASL,GAAM,IAASE,CAAO;AACxC;ACfO,MAAMI,KAA4D;AAAA,EACvE,IAAI;AAAA,EACJ,cAAc;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,IACA;AAAA;AAAA,EAAA;AAAA,EAEF,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAW;;AAChB,cAAMC,IAAQD,EAAO,SAAA;AACrB,eAAO;AAAA,UACL,QAAME,IAAAD,EAAM,SAAN,gBAAAC,EAAY,kBAAiB;AAAA,UACnC,MAAIC,IAAAF,EAAM,OAAN,gBAAAE,EAAU,kBAAiB;AAAA,QAAA;AAAA,MAEnC;AAAA,IAAA;AAAA,IAEF,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACH,MAAWA,EAAO,OAAA;AAAA,IAAO;AAAA,IAElC,aAAa;AAAA,MACX,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,oBAAoB;AAAA,IAAA;AAAA,IAE/C,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAW;;AAChB,cAAMI,IAAUJ,EAAO,gBAAA;AACvB,eAAKI,IACE;AAAA,UACL,QAAM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