@acronis-platform/ui-react 0.60.0 → 0.62.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.
- package/README.md +5 -5
- package/dist/components/ui/app-shell/app-shell.js.map +1 -1
- package/dist/components/ui/area-chart/area-chart.js +209 -146
- package/dist/components/ui/area-chart/area-chart.js.map +1 -1
- package/dist/components/ui/avatar/avatar.js +26 -23
- package/dist/components/ui/avatar/avatar.js.map +1 -1
- package/dist/components/ui/bar-chart/bar-chart.js +595 -180
- package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
- package/dist/components/ui/calendar-panel/calendar-panel-utils.js +63 -0
- package/dist/components/ui/calendar-panel/calendar-panel-utils.js.map +1 -0
- package/dist/components/ui/calendar-panel/calendar-panel.js +260 -0
- package/dist/components/ui/calendar-panel/calendar-panel.js.map +1 -0
- package/dist/components/ui/category-bar/category-bar.js +98 -77
- package/dist/components/ui/category-bar/category-bar.js.map +1 -1
- package/dist/components/ui/chart/chart-format.js +144 -14
- package/dist/components/ui/chart/chart-format.js.map +1 -1
- package/dist/components/ui/chart/chart.js +204 -150
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/composed-chart/composed-chart.js +422 -125
- package/dist/components/ui/composed-chart/composed-chart.js.map +1 -1
- package/dist/components/ui/confidence-cone/confidence-cone.js +308 -202
- package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -1
- package/dist/components/ui/filter-cards/filter-cards.js +25 -0
- package/dist/components/ui/filter-cards/filter-cards.js.map +1 -0
- package/dist/components/ui/funnel-chart/funnel-chart.js +245 -51
- package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -1
- package/dist/components/ui/histogram/histogram.js +85 -81
- package/dist/components/ui/histogram/histogram.js.map +1 -1
- package/dist/components/ui/line-chart/line-chart.js +227 -184
- package/dist/components/ui/line-chart/line-chart.js.map +1 -1
- package/dist/components/ui/metric/metric.js +88 -70
- package/dist/components/ui/metric/metric.js.map +1 -1
- package/dist/components/ui/pie-chart/pie-chart.js +234 -80
- package/dist/components/ui/pie-chart/pie-chart.js.map +1 -1
- package/dist/components/ui/radar-chart/radar-chart.js +210 -57
- package/dist/components/ui/radar-chart/radar-chart.js.map +1 -1
- package/dist/components/ui/radial-bar-chart/radial-bar-chart.js +358 -50
- package/dist/components/ui/radial-bar-chart/radial-bar-chart.js.map +1 -1
- package/dist/components/ui/resizable/resizable.js +23 -11
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/sankey-chart/sankey-chart.js +25 -18
- package/dist/components/ui/sankey-chart/sankey-chart.js.map +1 -1
- package/dist/components/ui/scatter-chart/scatter-chart.js +86 -78
- package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -1
- package/dist/components/ui/sidebar-secondary/sidebar-secondary.js.map +1 -1
- package/dist/components/ui/timeline/timeline.js +206 -142
- package/dist/components/ui/timeline/timeline.js.map +1 -1
- package/dist/components/ui/treemap/treemap.js +183 -59
- package/dist/components/ui/treemap/treemap.js.map +1 -1
- package/dist/index.js +446 -420
- package/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/react-day-picker@10.0.1_@types_react@19.2.15_react@19.2.6/node_modules/react-day-picker/dist/esm/useDayPicker.js +3 -3
- package/dist/react.js +446 -420
- package/dist/react.js.map +1 -1
- package/dist/src/components/ui/area-chart/area-chart.d.ts +53 -3
- package/dist/src/components/ui/area-chart/index.d.ts +1 -1
- package/dist/src/components/ui/avatar/avatar.d.ts +1 -1
- package/dist/src/components/ui/bar-chart/bar-chart.d.ts +154 -16
- package/dist/src/components/ui/bar-chart/index.d.ts +1 -1
- package/dist/src/components/ui/button/button.d.ts +1 -1
- package/dist/src/components/ui/button-menu/button-menu.d.ts +1 -1
- package/dist/src/components/ui/calendar-panel/__tests__/calendar-panel-utils.test.d.ts +1 -0
- package/dist/src/components/ui/calendar-panel/calendar-panel-utils.d.ts +55 -0
- package/dist/src/components/ui/calendar-panel/calendar-panel.d.ts +112 -0
- package/dist/src/components/ui/calendar-panel/index.d.ts +1 -0
- package/dist/src/components/ui/chart/__tests__/chart-layout.d.ts +63 -0
- package/dist/src/components/ui/chart/__tests__/chart-layout.test.d.ts +1 -0
- package/dist/src/components/ui/chart/chart-format.d.ts +415 -0
- package/dist/src/components/ui/chart/chart.d.ts +9 -3
- package/dist/src/components/ui/chart/index.d.ts +2 -2
- package/dist/src/components/ui/composed-chart/composed-chart.d.ts +156 -7
- package/dist/src/components/ui/composed-chart/index.d.ts +1 -1
- package/dist/src/components/ui/confidence-cone/confidence-cone.d.ts +138 -20
- package/dist/src/components/ui/confidence-cone/index.d.ts +1 -1
- package/dist/src/components/ui/filter-cards/filter-cards.d.ts +11 -0
- package/dist/src/components/ui/filter-cards/index.d.ts +1 -0
- package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +201 -3
- package/dist/src/components/ui/funnel-chart/index.d.ts +1 -1
- package/dist/src/components/ui/histogram/histogram.d.ts +2 -2
- package/dist/src/components/ui/line-chart/index.d.ts +1 -1
- package/dist/src/components/ui/line-chart/line-chart.d.ts +51 -3
- package/dist/src/components/ui/pie-chart/index.d.ts +1 -1
- package/dist/src/components/ui/pie-chart/pie-chart.d.ts +145 -4
- package/dist/src/components/ui/radar-chart/index.d.ts +1 -1
- package/dist/src/components/ui/radar-chart/radar-chart.d.ts +219 -6
- package/dist/src/components/ui/radial-bar-chart/index.d.ts +1 -1
- package/dist/src/components/ui/radial-bar-chart/radial-bar-chart.d.ts +215 -9
- package/dist/src/components/ui/scatter-chart/scatter-chart.d.ts +2 -2
- package/dist/src/components/ui/timeline/index.d.ts +1 -1
- package/dist/src/components/ui/timeline/timeline.d.ts +79 -20
- package/dist/src/components/ui/treemap/index.d.ts +1 -1
- package/dist/src/components/ui/treemap/treemap.d.ts +68 -8
- package/dist/src/index.d.ts +2 -1
- package/dist/ui-react.css +1 -1
- package/package.json +2 -2
- package/dist/components/ui/search-global/search-global.js +0 -60
- package/dist/components/ui/search-global/search-global.js.map +0 -1
- package/dist/src/components/ui/search-global/index.d.ts +0 -1
- package/dist/src/components/ui/search-global/search-global.d.ts +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar-chart.js","sources":["../../../../src/components/ui/bar-chart/bar-chart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n Bar,\n BarChart as RechartsBarChart,\n CartesianGrid,\n ReferenceLine,\n XAxis,\n YAxis,\n} from 'recharts';\n\nimport { cn } from '@/lib/utils';\nimport {\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartTooltip,\n ChartTooltipContent,\n resolveAxisDomain,\n type ChartConfig,\n type CartesianChartProps,\n} from '../chart';\n\n// A typed recharts composition over the shared `Chart` primitives. The two CVA\n// axes are the design's Bar-chart variant set (B2): `orientation` (which way the\n// bars grow) and `layout` (grouped side-by-side vs stacked). The classes stay\n// empty because the recharts SVG — not CSS — draws the bars: the same two props\n// drive recharts' `layout` prop, the axis roles, the `stackId`, and the corner\n// radius below. CVA is kept so the variant set is a first-class, spec-conformant\n// part of the API (matched against ui-spec's api.yaml enums) and exposed via\n// `VariantProps`; the resolved values are also mirrored onto `data-orientation`\n// / `data-layout` for styling hooks and tests.\nconst barChartVariants = cva('', {\n variants: {\n orientation: {\n vertical: '',\n horizontal: '',\n },\n layout: {\n grouped: '',\n stacked: '',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n layout: 'grouped',\n },\n});\n\nexport interface BarChartReferenceLine {\n /** Fixed position on the value axis. Takes precedence over `average`. */\n value?: number;\n /**\n * Draw the line at the mean of one series (a `dataKeys` entry) or, when\n * `true`, of every plotted series' values.\n */\n average?: boolean | string;\n /** Optional caption rendered alongside the line. */\n label?: string;\n}\n\n/**\n * Resolve a `referenceLine` config to a position on the value axis: a fixed\n * `value` wins; otherwise the mean of the requested series (a single `dataKeys`\n * entry, or all of them when `average` is `true`). Returns `undefined` when\n * there is nothing to draw (no config, or no numeric values to average).\n * Exported for unit tests; not part of the package's public API.\n */\nexport function barChartReferenceValue(\n referenceLine: BarChartReferenceLine | undefined,\n data: ReadonlyArray<Record<string, string | number>>,\n dataKeys: string[]\n): number | undefined {\n if (!referenceLine) return undefined;\n if (typeof referenceLine.value === 'number') return referenceLine.value;\n if (!referenceLine.average) return undefined;\n\n const keys =\n typeof referenceLine.average === 'string'\n ? [referenceLine.average]\n : dataKeys;\n const nums = data.flatMap((row) =>\n keys\n .map((key) => row[key])\n .filter((value): value is number => typeof value === 'number')\n );\n if (nums.length === 0) return undefined;\n return nums.reduce((sum, n) => sum + n, 0) / nums.length;\n}\n\nexport interface BarChartProps\n extends Omit<React.ComponentProps<'div'>, 'children'>,\n VariantProps<typeof barChartVariants>,\n CartesianChartProps {\n /** Row-per-category data. Each object holds the category key + one numeric field per series. */\n data: ReadonlyArray<Record<string, string | number>>;\n /**\n * Per-series map of `label` / `color` (imported from the shared `Chart`\n * primitives). Series colors are caller-supplied — reference an existing\n * semantic `--ui-*` token; there is no chart palette tier yet.\n */\n config: ChartConfig;\n /** Series to plot — one `<Bar>` per key. Each must exist in `config` and in every data row. */\n dataKeys: string[];\n /** Category axis key (the shared dimension across rows, e.g. `\"month\"`). */\n xKey: string;\n /**\n * One or more dashed reference/average lines on the value axis (Y for vertical\n * bars, X for horizontal). Each is driven by a fixed `value` or a computed\n * series `average`. Pass a single object or an array to draw several at once.\n */\n referenceLine?: BarChartReferenceLine | BarChartReferenceLine[];\n /** Unit suffix on X-axis tick values (recharts `unit`) — applies when the X axis is numeric (`orientation=\"horizontal\"`). */\n xUnit?: string;\n /** Corner radius applied to the growing end of each bar. */\n barRadius?: number;\n showLegend?: boolean;\n}\n\nconst BarChart = React.forwardRef<HTMLDivElement, BarChartProps>(\n (\n {\n className,\n config,\n data,\n dataKeys,\n xKey,\n referenceLine,\n xAxisLabel,\n yAxisLabel,\n xUnit,\n yUnit,\n orientation = 'vertical',\n layout = 'grouped',\n barRadius = 4,\n showGrid = true,\n showTooltip = true,\n showLegend = true,\n showXAxis = true,\n showYAxis = true,\n xTickFormatter,\n yTickFormatter,\n xAxisAngle,\n xAxisInterval,\n yAxisTickCount,\n yAxisDomain,\n gridDashed,\n gridHorizontal,\n gridVertical,\n tooltipContent,\n ...props\n },\n ref\n ) => {\n // Our `orientation` is bar-direction; recharts' `layout` is the opposite axis.\n const rechartsLayout = orientation === 'horizontal' ? 'vertical' : 'horizontal';\n const isStacked = layout === 'stacked';\n\n const referenceLines = referenceLine\n ? Array.isArray(referenceLine)\n ? referenceLine\n : [referenceLine]\n : [];\n\n // Axis titles: the X title sits below the ticks; the Y title is rotated in\n // the left gutter. Passed to recharts' native `label` (themed via the\n // `.recharts-label` fill selector on the container).\n const xAxisTitle = xAxisLabel\n ? { value: xAxisLabel, position: 'insideBottom' as const, offset: 0 }\n : undefined;\n const yAxisTitle = yAxisLabel\n ? {\n value: yAxisLabel,\n angle: -90,\n position: 'insideLeft' as const,\n style: { textAnchor: 'middle' as const },\n }\n : undefined;\n\n const yDomain = resolveAxisDomain(yAxisDomain);\n\n // Room for the X tick row: recharts' default 30, plus a rotated tick row\n // (+20) and/or the axis title (+18). Additive — both can be present at once,\n // which the old label-or-angle ternary under-allocated.\n const xAxisHeight =\n xAxisLabel || xAxisAngle != null\n ? 30 + (xAxisAngle != null ? 20 : 0) + (xAxisLabel ? 18 : 0)\n : undefined;\n\n // Round only the growing end: top for vertical bars, right for horizontal.\n const endRadius: [number, number, number, number] =\n orientation === 'horizontal'\n ? [0, barRadius, barRadius, 0]\n : [barRadius, barRadius, 0, 0];\n\n return (\n <div\n ref={ref}\n data-orientation={orientation}\n data-layout={layout}\n className={cn(barChartVariants({ orientation, layout }), className)}\n {...props}\n >\n <ChartContainer\n config={config}\n className=\"size-full [&_.recharts-label]:fill-foreground\"\n >\n <RechartsBarChart data={data as readonly unknown[]} layout={rechartsLayout}>\n {showGrid && (\n <CartesianGrid\n horizontal={gridHorizontal ?? orientation === 'vertical'}\n vertical={gridVertical ?? orientation === 'horizontal'}\n strokeDasharray={gridDashed ? '3 3' : undefined}\n />\n )}\n {orientation === 'horizontal' ? (\n <>\n {/* Horizontal bars put the values on X, so the value-axis\n props (tickCount/domain) belong here — recharts ignores both\n on the category axis. */}\n <XAxis\n type=\"number\"\n hide={!showXAxis}\n tickLine={false}\n axisLine={false}\n unit={xUnit}\n tickFormatter={xTickFormatter}\n angle={xAxisAngle}\n interval={xAxisInterval}\n textAnchor={\n xAxisAngle != null ? (xAxisAngle < 0 ? 'end' : 'start') : undefined\n }\n tickCount={yAxisTickCount}\n domain={yDomain}\n height={xAxisHeight}\n label={xAxisTitle}\n />\n <YAxis\n dataKey={xKey}\n type=\"category\"\n hide={!showYAxis}\n tickLine={false}\n axisLine={false}\n tickFormatter={yTickFormatter}\n width={yAxisLabel ? 96 : 80}\n label={yAxisTitle}\n />\n </>\n ) : (\n <>\n <XAxis\n dataKey={xKey}\n type=\"category\"\n hide={!showXAxis}\n tickLine={false}\n axisLine={false}\n tickFormatter={xTickFormatter}\n angle={xAxisAngle}\n interval={xAxisInterval}\n textAnchor={\n xAxisAngle != null ? (xAxisAngle < 0 ? 'end' : 'start') : undefined\n }\n height={xAxisHeight}\n label={xAxisTitle}\n />\n <YAxis\n type=\"number\"\n hide={!showYAxis}\n tickLine={false}\n axisLine={false}\n unit={yUnit}\n tickFormatter={yTickFormatter}\n tickCount={yAxisTickCount}\n domain={yDomain}\n width={yAxisLabel ? 72 : undefined}\n label={yAxisTitle}\n />\n </>\n )}\n {showTooltip && (\n <ChartTooltip content={tooltipContent ?? <ChartTooltipContent />} />\n )}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n {dataKeys.map((key, index) => {\n // In a stack only the last segment's end is rounded; grouped bars\n // each round their own end.\n const rounded = isStacked ? index === dataKeys.length - 1 : true;\n return (\n <Bar\n key={key}\n dataKey={key}\n fill={`var(--color-${key})`}\n stackId={isStacked ? 'a' : undefined}\n radius={barRadius > 0 && rounded ? endRadius : undefined}\n isAnimationActive={false}\n />\n );\n })}\n {referenceLines.map((ref, index) => {\n const value = barChartReferenceValue(ref, data, dataKeys);\n if (value === undefined) return null;\n return (\n <ReferenceLine\n key={`${ref.label ?? 'ref'}-${index}`}\n // Draw on the value axis: Y for vertical bars, X for horizontal.\n {...(orientation === 'horizontal' ? { x: value } : { y: value })}\n stroke=\"var(--ui-text-on-surface-secondary)\"\n strokeDasharray=\"4 4\"\n // extendDomain so a target beyond the data max stays visible.\n ifOverflow=\"extendDomain\"\n label={\n ref.label\n ? {\n value: ref.label,\n // Sit the caption at the top of the line: above the\n // right end of a horizontal line (vertical bars), or\n // above the top of a vertical line (horizontal bars).\n position:\n orientation === 'horizontal'\n ? 'top'\n : 'insideTopRight',\n fill: 'var(--ui-text-on-surface-secondary)',\n fontSize: 12,\n }\n : undefined\n }\n />\n );\n })}\n </RechartsBarChart>\n </ChartContainer>\n </div>\n );\n }\n);\nBarChart.displayName = 'BarChart';\n\nexport { BarChart, barChartVariants };\n"],"names":["barChartVariants","cva","barChartReferenceValue","referenceLine","data","dataKeys","keys","nums","row","key","value","sum","n","BarChart","React","className","config","xKey","xAxisLabel","yAxisLabel","xUnit","yUnit","orientation","layout","barRadius","showGrid","showTooltip","showLegend","showXAxis","showYAxis","xTickFormatter","yTickFormatter","xAxisAngle","xAxisInterval","yAxisTickCount","yAxisDomain","gridDashed","gridHorizontal","gridVertical","tooltipContent","props","ref","rechartsLayout","isStacked","referenceLines","xAxisTitle","yAxisTitle","yDomain","resolveAxisDomain","xAxisHeight","endRadius","jsx","cn","ChartContainer","jsxs","RechartsBarChart","CartesianGrid","Fragment","XAxis","YAxis","ChartTooltip","ChartTooltipContent","ChartLegend","ChartLegendContent","index","rounded","Bar","ReferenceLine"],"mappings":";;;;;;;AAkCA,MAAMA,KAAmBC,EAAI,IAAI;AAAA,EAC/B,UAAU;AAAA,IACR,aAAa;AAAA,MACX,UAAU;AAAA,MACV,YAAY;AAAA,IAAA;AAAA,IAEd,QAAQ;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,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;AACAnD,GAAS,cAAc;"}
|
|
1
|
+
{"version":3,"file":"bar-chart.js","sources":["../../../../src/components/ui/bar-chart/bar-chart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n Bar,\n BarChart as RechartsBarChart,\n Brush,\n CartesianGrid,\n Cell,\n LabelList,\n ReferenceArea,\n ReferenceLine,\n Rectangle,\n Text,\n XAxis,\n YAxis,\n} from 'recharts';\n\nimport type { BarShapeProps } from 'recharts/types/cartesian/Bar';\n\nimport { cn } from '@/lib/utils';\nimport {\n CHART_LABEL_FONT_SIZE,\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartTooltip,\n ChartTooltipContent,\n resolveAnimation,\n resolveAxisDomain,\n resolveBrushProps,\n resolveCartesianLabelPosition,\n resolveCategoryRange,\n resolveChartReferenceValue,\n resolveLabelFillClass,\n resolveReferenceLineProps,\n resolveRotatedTickAnchor,\n resolveXAxisHeight,\n resolveXAxisTitle,\n resolveYAxisTitle,\n toLabelFormatter,\n toReferenceLineList,\n type ChartConfig,\n type ChartReferenceLine,\n type ChartLegendContentProps,\n type ChartTooltipContentProps,\n type CartesianChartProps,\n type ChartAnimationProps,\n type ChartBrushProps,\n type ChartCategoryRange,\n type ChartDataLabelProps,\n type CartesianLabelPosition,\n} from '../chart';\n\n// A typed recharts composition over the shared `Chart` primitives. The two CVA\n// axes are the design's Bar-chart variant set (B2): `orientation` (which way the\n// bars grow) and `layout` (grouped side-by-side vs stacked). The classes stay\n// empty because the recharts SVG — not CSS — draws the bars: the same two props\n// drive recharts' `layout` prop, the axis roles, the `stackId`, and the corner\n// radius below. CVA is kept so the variant set is a first-class, spec-conformant\n// part of the API (matched against ui-spec's api.yaml enums) and exposed via\n// `VariantProps`; the resolved values are also mirrored onto `data-orientation`\n// / `data-layout` for styling hooks and tests.\nconst barChartVariants = cva('', {\n variants: {\n orientation: {\n vertical: '',\n horizontal: '',\n },\n layout: {\n grouped: '',\n stacked: '',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n layout: 'grouped',\n },\n});\n\n/**\n * How a bar is painted. `rounded` rounds the growing end by `barRadius`; `pill`\n * rounds every corner to a capsule; `gradient` fades the series color down the\n * bar; `pattern` fills it with diagonal hatching in the series color (a\n * colorblind-safe way to set a subset of bars apart).\n */\nexport type BarChartBarShape = 'rounded' | 'pill' | 'gradient' | 'pattern';\n\n/**\n * Style override for one series over a range of categories — e.g. \"the forecast\n * tail from September onward reads translucent and dashed\". Anything left unset\n * keeps the series' normal painting.\n */\nexport interface BarChartBarSettings extends ChartCategoryRange {\n /** Fill for the matched bars. Defaults to the series color. */\n fill?: string;\n /** Fill opacity for the matched bars. */\n opacity?: number;\n /** Outline the matched bars with a dashed stroke in the series color. */\n dashed?: boolean;\n /** Shape for the matched bars, overriding the chart's `barShape`. */\n shape?: BarChartBarShape;\n /**\n * Track behind the matched bars: `true` fills the plot height, while a data\n * field name caps it at that row's value — the headroom between a projection\n * and its upper bound. A capped track stacks on its bar, so it needs the\n * default `layout=\"grouped\"`; under `layout=\"stacked\"` it is ignored.\n */\n background?: boolean | string;\n}\n\n/** A shaded band behind a range of categories. */\nexport interface BarChartReferenceArea extends ChartCategoryRange {\n /** Caption above the band. */\n label?: string;\n /**\n * Mark the category ticks under the band — accent color, italic — so the\n * highlighted range reads on the axis too. On by default.\n */\n highlightTicks?: boolean;\n /**\n * Draw a dashed rule at the band's leading edge — the hand-off into a\n * forecast. Off by default.\n */\n divider?: boolean;\n}\n\n// Reserved field prefix for the synthetic headroom series a capped track\n// stacks onto its bar. It must never surface in the tooltip or the legend.\nconst HEADROOM_FIELD_PREFIX = '__headroom_';\n\n/**\n * Drop the synthetic headroom series from a recharts tooltip/legend payload,\n * keeping the real series (and their order). `legendType`/`tooltipType=\"none\"`\n * are set on those bars too, but recharts still lists them, so this filter is\n * what actually keeps them out — hence it's unit-tested.\n */\nexport function dropHeadroomSeries<T extends { dataKey?: unknown }>(\n payload: readonly T[] | undefined,\n dataKeys?: string[]\n): T[] | undefined {\n const real = payload?.filter(\n (item) => !String(item.dataKey).startsWith(HEADROOM_FIELD_PREFIX)\n );\n // recharts sorts the legend payload alphabetically by series name by default\n // (its `itemSorter: 'value'`), so passing `dataKeys` puts the entries back in\n // the order the caller declared them.\n return dataKeys\n ? real?.slice().sort(\n (a, b) =>\n dataKeys.indexOf(String(a.dataKey)) -\n dataKeys.indexOf(String(b.dataKey))\n )\n : real;\n}\n\n/**\n * Swap a paint-server fill back to the series color for the chrome. A\n * `gradient` / `pattern` bar fills from `url(#…)`, which paints SVG but means\n * nothing as a CSS background — the legend swatch and the tooltip dot would\n * render blank — so they fall back to the series' own `--color-<key>`.\n */\nexport function withSeriesColor<T extends { dataKey?: unknown; color?: string }>(\n payload: readonly T[] | undefined\n): T[] | undefined {\n return payload?.map((item) =>\n item.color?.startsWith('url(')\n ? { ...item, color: `var(--color-${String(item.dataKey)})` }\n : item\n );\n}\n\ntype TooltipContentType = NonNullable<\n React.ComponentProps<typeof ChartTooltip>['content']\n>;\ntype TooltipContentFn = Extract<\n TooltipContentType,\n (...args: never[]) => unknown\n>;\ntype TooltipRenderProps = Parameters<TooltipContentFn>[0];\n\ntype LegendContentType = NonNullable<\n React.ComponentProps<typeof ChartLegend>['content']\n>;\ntype LegendContentFn = Extract<LegendContentType, (...args: never[]) => unknown>;\ntype LegendRenderProps = Parameters<LegendContentFn>[0];\n\n/**\n * Tooltip content that normalizes recharts' payload before anything renders it:\n * the synthetic headroom series stripped, the rows put back in `dataKeys` order,\n * and paint-server fills swapped back to the series color. Falls through to a\n * caller-supplied `content`, preserving recharts' own mount semantics — a\n * function via `createElement` (its own component identity + hook state), an\n * element via `cloneElement`.\n *\n * This is a component rather than a per-render wrapper factory on purpose:\n * recharts renders `content` by cloning the element it is given\n * (`Tooltip.js:27-28`), so a stable module-level type here means the subtree is\n * never remounted, whatever the caller passes.\n */\nexport function NormalizedTooltipContent({\n content,\n dataKeys,\n ...props\n}: Partial<TooltipRenderProps> & {\n content?: TooltipContentType;\n dataKeys?: string[];\n}) {\n const merged = {\n ...props,\n payload: withSeriesColor(dropHeadroomSeries(props.payload, dataKeys)),\n } as TooltipRenderProps;\n\n if (!content) {\n return <ChartTooltipContent {...(merged as ChartTooltipContentProps)} />;\n }\n return typeof content === 'function'\n ? React.createElement(\n content as React.FunctionComponent<TooltipRenderProps>,\n merged\n )\n : React.cloneElement(content, merged);\n}\n\n/**\n * Legend content over the same normalization. Ordering is the reason this\n * applies unconditionally: recharts sorts legend entries alphabetically by\n * series name by default (`itemSorter: 'value'`), so without putting them back\n * in `dataKeys` order the legend would silently reorder itself depending on\n * which bar-styling props happen to be set.\n */\nexport function NormalizedLegendContent({\n dataKeys,\n ...props\n}: Partial<LegendRenderProps> & { dataKeys: string[] }) {\n return (\n <ChartLegendContent\n verticalAlign={props.verticalAlign}\n payload={\n withSeriesColor(\n dropHeadroomSeries(props.payload, dataKeys)\n ) as ChartLegendContentProps['payload']\n }\n />\n );\n}\n\n/** Paint overrides recharts spreads over a bar to mark it as the active one. */\ninterface BarPaintOverride {\n fill?: string;\n fillOpacity?: number;\n}\n\n/**\n * Draw a bar, optionally over its full-height track (recharts hands a custom\n * `<Bar shape>` the track geometry alongside the bar's). Only geometry and\n * paint props are forwarded — recharts also passes the whole data entry, and\n * spreading that onto an SVG node would leak data fields into the DOM.\n *\n * `paint` is how the active bar keeps its track: recharts swaps a custom\n * `shape` out for the `activeBar` option while a bar is hovered\n * (`Bar.js` `BarRectangleWithActiveState`), so the active option has to be a\n * shape of its own that redraws the track and applies the highlight itself.\n */\nfunction renderBarWithTrack({\n bar,\n track,\n trackFill,\n paint,\n}: {\n bar: Omit<BarShapeProps, 'background' | 'index'>;\n track?: BarShapeProps['background'];\n trackFill: string;\n paint?: BarPaintOverride;\n}) {\n return (\n <>\n {track && (\n <Rectangle\n className=\"recharts-bar-background-rectangle\"\n x={track.x ?? undefined}\n y={track.y ?? undefined}\n width={track.width ?? undefined}\n height={track.height ?? undefined}\n fill={trackFill}\n />\n )}\n <Rectangle\n x={bar.x ?? undefined}\n y={bar.y ?? undefined}\n width={bar.width ?? undefined}\n height={bar.height ?? undefined}\n radius={bar.radius}\n fill={paint?.fill ?? bar.fill}\n fillOpacity={paint?.fillOpacity ?? bar.fillOpacity}\n stroke={bar.stroke}\n strokeWidth={bar.strokeWidth}\n strokeDasharray={bar.strokeDasharray}\n />\n </>\n );\n}\n\n/**\n * Build the `<Bar shape>` that draws a range-scoped track. recharts' own\n * `background` is all-or-nothing per series, so the track is drawn per row and\n * hidden where the range doesn't apply.\n */\nexport function createTrackShape({\n inRange,\n trackFill,\n paint,\n}: {\n inRange: (row: number) => boolean;\n trackFill: string;\n paint?: BarPaintOverride;\n}) {\n return ({ background: track, index: row, ...bar }: BarShapeProps) =>\n renderBarWithTrack({\n bar,\n track: inRange(row) ? track : undefined,\n trackFill,\n paint,\n });\n}\n\n/**\n * The `shape` / `activeBar` pair one series' `<Bar>` is given.\n *\n * They resolve together because recharts swaps a custom `shape` out for the\n * `activeBar` option while a bar is hovered: a range-scoped track has to be\n * redrawn by the active option too, or the track blinks out under the cursor.\n */\nfunction resolveBarShapes({\n rangeBackground,\n inRange,\n trackFill,\n activeBarOption,\n}: {\n /**\n * recharts takes one `background` per series, so a range-scoped one is drawn\n * per row by a custom shape instead: hidden where it doesn't apply.\n */\n rangeBackground: boolean;\n inRange: (row: number) => boolean;\n trackFill: string;\n activeBarOption: BarPaintOverride | false;\n}) {\n if (!rangeBackground) {\n return { shape: undefined, activeBar: activeBarOption };\n }\n return {\n shape: createTrackShape({ inRange, trackFill }),\n activeBar: activeBarOption\n ? createTrackShape({ inRange, trackFill, paint: activeBarOption })\n : activeBarOption,\n };\n}\n\n/**\n * Draw a highlight band plus a dashed rule on its leading edge: the left edge\n * for vertical bars (the category axis runs along X), the top edge otherwise.\n *\n * The band's own paint comes from the props recharts hands the shape — a\n * `<ReferenceArea shape>` still receives the element's `fill`/`fillOpacity`\n * (`ReferenceArea.js` `renderRect`), so hardcoding them here would quietly\n * ignore whatever the caller set.\n */\nfunction renderBandWithDivider({\n band,\n vertical,\n}: {\n band: {\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n fill?: string;\n fillOpacity?: number;\n };\n vertical: boolean;\n}) {\n const { x = 0, y = 0, width = 0, height = 0, fill, fillOpacity } = band;\n return (\n <>\n <Rectangle\n className=\"recharts-reference-area-rect\"\n x={x}\n y={y}\n width={width}\n height={height}\n fill={fill}\n fillOpacity={fillOpacity}\n />\n <line\n x1={x}\n y1={y}\n x2={vertical ? x : x + width}\n y2={vertical ? y + height : y}\n stroke=\"var(--ui-border-on-surface-border)\"\n strokeDasharray=\"4 4\"\n />\n </>\n );\n}\n\n/**\n * The `<ReferenceArea shape>` for a band, or `undefined` so recharts draws its\n * own rect. A custom shape is only needed for the leading-edge rule: a\n * `ReferenceLine` would sit on the tick's centre, and only the band knows where\n * its own edge is.\n */\nfunction resolveBandShape({\n divider,\n vertical,\n}: {\n divider: boolean | undefined;\n vertical: boolean;\n}) {\n if (!divider) return undefined;\n return (band: { x?: number; y?: number; width?: number; height?: number }) =>\n renderBandWithDivider({ band, vertical });\n}\n\n/**\n * A band's caption as recharts' native `label`. `'insideTop'` is asserted\n * because, read outside the JSX attribute, it would widen to `string` and stop\n * matching recharts' `Position` union.\n */\nfunction resolveBandLabel(label: string | undefined) {\n return label\n ? {\n value: label,\n position: 'insideTop' as const,\n fill: 'var(--ui-text-on-surface-secondary)',\n fontSize: 12,\n }\n : undefined;\n}\n\n/**\n * The `<defs>` a `gradient` / `pattern` bar fills from — one paint server per\n * series, since each is painted in that series' own color. Ids are namespaced\n * by the chart instance so two charts on a page can't collide.\n *\n * Safe to render as a component: unlike `Bar`'s cells, the chart renders its\n * children straight through rather than looking them up by type.\n */\nfunction BarPaintServers({\n id,\n dataKeys,\n shapes,\n horizontal,\n}: {\n id: string;\n dataKeys: string[];\n shapes: ReadonlySet<BarChartBarShape>;\n /** Bars grow along X, so a gradient runs left-to-right instead of top-down. */\n horizontal: boolean;\n}) {\n const hasGradient = shapes.has('gradient');\n const hasPattern = shapes.has('pattern');\n if (!hasGradient && !hasPattern) return null;\n\n return (\n <defs>\n {dataKeys.map((key) => (\n <React.Fragment key={key}>\n {hasGradient && (\n <linearGradient\n id={`${id}-gradient-${key}`}\n x1=\"0\"\n y1=\"0\"\n x2={horizontal ? '1' : '0'}\n y2={horizontal ? '0' : '1'}\n >\n <stop\n offset=\"0%\"\n stopColor={`var(--color-${key})`}\n stopOpacity={1}\n />\n <stop\n offset=\"100%\"\n stopColor={`var(--color-${key})`}\n stopOpacity={0.35}\n />\n </linearGradient>\n )}\n {hasPattern && (\n <pattern\n id={`${id}-pattern-${key}`}\n patternUnits=\"userSpaceOnUse\"\n width={6}\n height={6}\n patternTransform=\"rotate(45)\"\n >\n <rect\n width={6}\n height={6}\n fill={`var(--color-${key})`}\n fillOpacity={0.25}\n />\n <line\n x1={0}\n y1={0}\n x2={0}\n y2={6}\n stroke={`var(--color-${key})`}\n strokeWidth={3}\n />\n </pattern>\n )}\n </React.Fragment>\n ))}\n </defs>\n );\n}\n\n/** Corner radius as recharts' `Rectangle` takes it: one value or a 4-tuple. */\ntype BarRadius = number | [number, number, number, number] | undefined;\n\ninterface RangeCellsOptions {\n data: ReadonlyArray<Record<string, string | number>>;\n /** `data` plus the synthetic headroom fields, if any were added. */\n chartData: ReadonlyArray<Record<string, string | number>>;\n xKey: string;\n seriesKey: string;\n settings: BarChartBarSettings;\n /** Inclusive row bounds the settings apply to. */\n range: [number, number];\n headroomKey: string | undefined;\n barShape: BarChartBarShape;\n rounded: boolean;\n fillOf: (key: string, shape: BarChartBarShape) => string;\n radiusFor: (shape: BarChartBarShape, rounded: boolean) => BarRadius;\n}\n\n/**\n * The `<Cell>` list that applies a series' `barSettings` over its range: the\n * matched rows take the override fill/opacity/dash/shape, the rest keep the\n * series' normal painting.\n *\n * A plain function returning the elements, deliberately not a component:\n * `Bar` discovers its cells with `findAllByType(props.children, Cell)`\n * (recharts `Bar.js`), which matches each direct child on its own display\n * name. Wrapping these in a component would make that lookup find nothing and\n * silently drop every per-range style — no error, just unstyled bars.\n * Returning an array keeps them direct children, since recharts' `toArray`\n * flattens arrays and unwraps fragments.\n */\nfunction rangeCells({\n data,\n chartData,\n xKey,\n seriesKey,\n settings,\n range,\n headroomKey,\n barShape,\n rounded,\n fillOf,\n radiusFor,\n}: RangeCellsOptions) {\n const { fill, opacity, dashed } = settings;\n\n return data.map((row, rowIndex) => {\n const on = rowIndex >= range[0] && rowIndex <= range[1];\n const shape = (on && settings.shape) || barShape;\n // Only a row that actually carries headroom gives up its rounded end — a\n // row in range whose upper bound is missing, or no higher than its value,\n // keeps it.\n const stacksHeadroom =\n headroomKey !== undefined &&\n Number(\n (chartData[rowIndex] as Record<string, unknown>)?.[\n `${HEADROOM_FIELD_PREFIX}${seriesKey}`\n ]\n ) > 0;\n\n return (\n <Cell\n key={`${seriesKey}-${String(row[xKey])}-${rowIndex}`}\n fill={\n on ? (fill ?? fillOf(seriesKey, shape)) : fillOf(seriesKey, barShape)\n }\n fillOpacity={on ? opacity : undefined}\n stroke={on && dashed ? `var(--color-${seriesKey})` : undefined}\n strokeWidth={on && dashed ? 1 : undefined}\n strokeDasharray={on && dashed ? '4 3' : undefined}\n // Cell types `radius` as the SVG attribute, but it feeds recharts'\n // Rectangle, which takes the 4-tuple. A bar with headroom stacked on it\n // hands the rounded end to that segment instead.\n radius={\n (stacksHeadroom ? undefined : radiusFor(shape, rounded)) as\n | number\n | undefined\n }\n />\n );\n });\n}\n\nexport interface BarChartProps\n extends Omit<React.ComponentProps<'div'>, 'children'>,\n VariantProps<typeof barChartVariants>,\n CartesianChartProps,\n ChartAnimationProps,\n ChartBrushProps,\n ChartDataLabelProps {\n /** Row-per-category data. Each object holds the category key + one numeric field per series. */\n data: ReadonlyArray<Record<string, string | number>>;\n /**\n * Per-series map of `label` / `color` (imported from the shared `Chart`\n * primitives). Series colors are caller-supplied — reference an existing\n * semantic `--ui-*` token; there is no chart palette tier yet.\n */\n config: ChartConfig;\n /** Series to plot — one `<Bar>` per key. Each must exist in `config` and in every data row. */\n dataKeys: string[];\n /** Category axis key (the shared dimension across rows, e.g. `\"month\"`). */\n xKey: string;\n /**\n * One or more dashed reference/average lines on the value axis (Y for vertical\n * bars, X for horizontal). Each is driven by a fixed `value` or a computed\n * series `average`. Pass a single object or an array to draw several at once.\n */\n referenceLine?: ChartReferenceLine | ChartReferenceLine[];\n /**\n * One or more shaded bands behind a range of categories — e.g. a forecast\n * period. Pass a single object or an array to draw several.\n */\n referenceArea?: BarChartReferenceArea | BarChartReferenceArea[];\n /**\n * Per-series style override for a range of categories, keyed by `dataKeys`\n * entry. Bars outside a series' range — and series with no entry — render\n * normally.\n */\n barSettings?: Record<string, BarChartBarSettings>;\n /** Unit suffix on X-axis tick values (recharts `unit`) — applies when the X axis is numeric (`orientation=\"horizontal\"`). */\n xUnit?: string;\n /** Corner radius applied to the growing end of each bar. */\n barRadius?: number;\n /** How every bar is painted. Per-range overrides come from `barSettings`. */\n barShape?: BarChartBarShape;\n /** Fixed bar thickness, in px. Unset, recharts sizes bars from the available width. */\n barSize?: number;\n /** Upper bound on the computed bar thickness, in px. */\n maxBarSize?: number;\n /** Gap between bars of the same category, in px or a percentage string. */\n barGap?: number | string;\n /** Gap between category groups, in px or a percentage string. */\n barCategoryGap?: number | string;\n /**\n * Minimum rendered length for a bar, in px, so a tiny value stays visible. A\n * value of exactly `0` still renders nothing — a floor on it would read as a\n * small positive.\n */\n minPointSize?: number;\n /** Draw a full-height track behind every bar. */\n showBackground?: boolean;\n /** Fill for the track background. Defaults to the secondary surface. */\n backgroundFill?: string;\n /** Highlight the hovered bar. */\n showActiveBar?: boolean;\n /** Painting of the hovered bar when `showActiveBar` is on. */\n activeBar?: {\n /** Fill for the hovered bar. Defaults to the series color. */\n fill?: string;\n /** Fill opacity for the hovered bar. */\n opacity?: number;\n };\n showLegend?: boolean;\n /**\n * Position of the value labels when `showLabels` is on. Defaults to the growing\n * end — `top` for vertical bars, `right` for horizontal.\n */\n labelPosition?: CartesianLabelPosition;\n}\n\nconst BarChart = React.forwardRef<HTMLDivElement, BarChartProps>(\n (\n {\n className,\n config,\n data,\n dataKeys,\n xKey,\n referenceLine,\n referenceArea,\n barSettings,\n xAxisLabel,\n yAxisLabel,\n xUnit,\n yUnit,\n orientation = 'vertical',\n layout = 'grouped',\n barRadius = 4,\n barShape = 'rounded',\n barSize,\n maxBarSize,\n barGap,\n barCategoryGap,\n minPointSize,\n showBackground = false,\n backgroundFill = 'var(--ui-background-surface-secondary)',\n showActiveBar = false,\n activeBar,\n showGrid = true,\n showTooltip = true,\n showLegend = true,\n showXAxis = true,\n showYAxis = true,\n xTickFormatter,\n yTickFormatter,\n xAxisAngle,\n xAxisInterval,\n yAxisTickCount,\n yAxisDomain,\n gridDashed,\n gridHorizontal,\n gridVertical,\n tooltipContent,\n animate,\n animationDuration,\n animationBegin,\n animationEasing,\n showLabels = false,\n labelPosition,\n labelFormatter,\n showBrush = false,\n brushHeight,\n brushAriaLabel,\n ...props\n },\n ref\n ) => {\n const animation = resolveAnimation({\n animate,\n animationDuration,\n animationBegin,\n animationEasing,\n });\n // Our `orientation` is bar-direction; recharts' `layout` is the opposite axis.\n const rechartsLayout = orientation === 'horizontal' ? 'vertical' : 'horizontal';\n const isStacked = layout === 'stacked';\n // Labels sit at the growing end of the bar: above vertical bars, to the\n // right of horizontal ones — or centred in the segment when stacked.\n const barLabelPosition = resolveCartesianLabelPosition({\n labelPosition,\n isStacked,\n growingEnd: orientation === 'horizontal' ? 'right' : 'top',\n });\n\n const referenceLines = toReferenceLineList(referenceLine);\n\n // Bands + the per-series overrides resolved to inclusive row indices once,\n // so the Cells below are a lookup rather than a search per bar.\n const referenceAreas = (\n referenceArea\n ? Array.isArray(referenceArea)\n ? referenceArea\n : [referenceArea]\n : []\n )\n .map((area) => ({ area, range: resolveCategoryRange(area, data, xKey) }))\n .filter(\n (entry): entry is { area: BarChartReferenceArea; range: [number, number] } =>\n entry.range !== undefined\n );\n\n const settingsByKey = new Map(\n dataKeys.flatMap((key) => {\n const settings = barSettings?.[key];\n const range = settings\n ? resolveCategoryRange(settings, data, xKey)\n : undefined;\n return settings && range ? [[key, { settings, range }] as const] : [];\n })\n );\n\n // A capped track is drawn as a synthetic remainder (upper bound minus the\n // bar's own value) stacked on the bar, so recharts scales and animates it\n // rather than us guessing the axis scale from a mid-animation geometry.\n const headroomKeys = new Map(\n isStacked\n ? []\n : Array.from(settingsByKey, ([key, entry]) =>\n typeof entry.settings.background === 'string'\n ? ([key, entry.settings.background] as const)\n : undefined\n ).filter((pair): pair is readonly [string, string] => pair !== undefined)\n );\n\n const chartData = headroomKeys.size\n ? data.map((row, rowIndex) => {\n const extra: Record<string, number> = {};\n headroomKeys.forEach((upperKey, key) => {\n const entry = settingsByKey.get(key);\n if (!entry) return;\n const [start, end] = entry.range;\n if (rowIndex < start || rowIndex > end) return;\n const value = row[key];\n const upper = row[upperKey];\n if (typeof value !== 'number' || typeof upper !== 'number') return;\n extra[`${HEADROOM_FIELD_PREFIX}${key}`] = Math.max(0, upper - value);\n });\n return { ...row, ...extra };\n })\n : data;\n\n // The ticks under a band pick up the accent styling unless the band opts\n // out. Resolved to the categories' own values rather than kept as row\n // indices, because neither index a tick carries can be trusted here: the\n // `index` prop is a position in the list recharts actually renders, which\n // a numeric `interval` (and the default `preserveEnd`, dropping labels that\n // don't fit) has already filtered, and `payload.index` is relative to the\n // slice a `showBrush` selection leaves. The value survives both.\n const highlightedValues = new Set(\n referenceAreas\n .filter(({ area }) => area.highlightTicks !== false)\n .flatMap(({ range }) =>\n data.slice(range[0], range[1] + 1).map((row) => row[xKey])\n )\n );\n\n // recharts places the tick and hands the element its final geometry; we\n // reuse its own <Text> so angle/anchor behavior is unchanged and only add\n // the accent styling for the highlighted range. The formatter still takes\n // the rendered position, since that is what recharts passes its own\n // `tickFormatter`.\n const categoryTick = highlightedValues.size\n ? ({\n payload,\n index,\n ...tickProps\n }: {\n payload: { value: string | number };\n index: number;\n }) => {\n const formatter =\n orientation === 'horizontal' ? yTickFormatter : xTickFormatter;\n const value = formatter\n ? formatter(payload.value as never, index)\n : payload.value;\n return (\n <Text\n {...tickProps}\n className={cn(\n 'fill-muted-foreground',\n highlightedValues.has(payload.value) && 'fill-primary italic'\n )}\n fontSize={12}\n >\n {value}\n </Text>\n );\n }\n : undefined;\n\n // recharts spreads this over the bar's own props, so an explicitly\n // `undefined` fill would wipe the series color (an unfilled path paints\n // black). Only set what the caller asked for, and dim by default so\n // `showActiveBar` alone is visible.\n const activeBarOption = showActiveBar\n ? {\n ...(activeBar?.fill !== undefined ? { fill: activeBar.fill } : {}),\n fillOpacity: activeBar?.opacity ?? 0.85,\n }\n : false;\n\n // `gradient` and `pattern` paint from an SVG def, so the ids have to be\n // unique per chart instance — same guard the shared container applies.\n const defsId = `bar-${React.useId().replace(/:/g, '')}`;\n const usedShapes = new Set<BarChartBarShape>([barShape]);\n settingsByKey.forEach(({ settings }) => {\n if (settings.shape) usedShapes.add(settings.shape);\n });\n // recharts applies a flat minPointSize to zeroes too, which would draw a\n // sliver where there is nothing to show. For a grouped bar it hands the\n // callback the row's own value, but inside a stack it hands the running\n // total, so a zero segment riding on a non-zero stack would slip through —\n // there the value is read back off the row instead. That read uses the\n // index recharts counts from the *displayed* slice, so a stacked chart\n // whose brush has been dragged off its full range falls back to flooring\n // the zero; the plain (unbrushed) stack, which is what the prop is for, is\n // exact.\n const minPointSizeFor = (key: string) =>\n minPointSize === undefined\n ? undefined\n : (top: number | undefined | null, row: number) => {\n const own = isStacked ? chartData[row]?.[key] : top;\n return typeof own === 'number' && own !== 0 ? minPointSize : 0;\n };\n\n const fillOf = (key: string, shape: BarChartBarShape) =>\n shape === 'gradient'\n ? `url(#${defsId}-gradient-${key})`\n : shape === 'pattern'\n ? `url(#${defsId}-pattern-${key})`\n : `var(--color-${key})`;\n\n // Axis titles: the X title sits below the ticks; the Y title is rotated in\n // the left gutter. Passed to recharts' native `label` (themed via the\n // `.recharts-label` fill selector on the container).\n const xAxisTitle = resolveXAxisTitle(xAxisLabel);\n const yAxisTitle = resolveYAxisTitle(yAxisLabel);\n\n const yDomain = resolveAxisDomain(yAxisDomain);\n\n const xAxisHeight = resolveXAxisHeight(xAxisLabel, xAxisAngle);\n\n // Round only the growing end: top for vertical bars, right for horizontal.\n const endRadius: [number, number, number, number] =\n orientation === 'horizontal'\n ? [0, barRadius, barRadius, 0]\n : [barRadius, barRadius, 0, 0];\n // A pill rounds every corner; recharts clamps the radius to half the bar's\n // shorter side, so an oversized number gives a true capsule at any width.\n const radiusFor = (shape: BarChartBarShape, rounded: boolean) =>\n shape === 'pill'\n ? 9999\n : barRadius > 0 && rounded\n ? endRadius\n : undefined;\n\n // Both take the normalization unconditionally: gating it on \"is a\n // headroom/paint-server series in play\" is what let the legend's ordering\n // drift between otherwise identical charts. The helpers are no-ops when\n // there is nothing to strip or recolor.\n const tooltipElement = (\n <NormalizedTooltipContent content={tooltipContent} dataKeys={dataKeys} />\n );\n const legendElement = <NormalizedLegendContent dataKeys={dataKeys} />;\n\n // The long chart children are lifted into these renderers so the returned\n // tree reads as a flat list. They are plain functions, not components:\n // recharts looks some of its children up by element type (see `rangeCells`\n // above), so what they return has to stay a *direct* child — an array or a\n // fragment is flattened, a component wrapper would not be.\n\n // `orientation` decides which axis is numeric, and with it which axis the\n // value props (unit/tickCount/domain) and the category props (dataKey/tick)\n // belong to — recharts ignores each set on the other axis. Both branches\n // stay spelled out because what differs is the prop *set*, not a couple of\n // values: folding them into one shared props object would trade a readable\n // fork for a merge whose per-axis prop list has to be re-derived by eye.\n const renderAxes = () =>\n orientation === 'horizontal' ? (\n <>\n {/* Horizontal bars put the values on X, so the value-axis props\n (tickCount/domain) belong here — recharts ignores both on the\n category axis. */}\n <XAxis\n type=\"number\"\n hide={!showXAxis}\n tickLine={false}\n axisLine={false}\n unit={xUnit}\n tickFormatter={xTickFormatter}\n angle={xAxisAngle}\n interval={xAxisInterval}\n textAnchor={resolveRotatedTickAnchor(xAxisAngle)}\n tickCount={yAxisTickCount}\n domain={yDomain}\n height={xAxisHeight}\n label={xAxisTitle}\n />\n <YAxis\n dataKey={xKey}\n type=\"category\"\n hide={!showYAxis}\n tickLine={false}\n axisLine={false}\n tick={categoryTick}\n tickFormatter={yTickFormatter}\n width={yAxisLabel ? 96 : 80}\n label={yAxisTitle}\n />\n </>\n ) : (\n <>\n <XAxis\n dataKey={xKey}\n type=\"category\"\n hide={!showXAxis}\n tickLine={false}\n axisLine={false}\n tick={categoryTick}\n tickFormatter={xTickFormatter}\n angle={xAxisAngle}\n interval={xAxisInterval}\n textAnchor={resolveRotatedTickAnchor(xAxisAngle)}\n height={xAxisHeight}\n label={xAxisTitle}\n />\n <YAxis\n type=\"number\"\n hide={!showYAxis}\n tickLine={false}\n axisLine={false}\n unit={yUnit}\n tickFormatter={yTickFormatter}\n tickCount={yAxisTickCount}\n domain={yDomain}\n width={yAxisLabel ? 72 : undefined}\n label={yAxisTitle}\n />\n </>\n );\n\n const renderSeries = () =>\n dataKeys.map((key, index) => {\n // In a stack only the last segment's end is rounded; grouped bars\n // each round their own end.\n const rounded = isStacked ? index === dataKeys.length - 1 : true;\n const entry = settingsByKey.get(key);\n const inRange = (row: number) =>\n entry !== undefined && row >= entry.range[0] && row <= entry.range[1];\n const headroomKey = headroomKeys.get(key);\n const { shape, activeBar: activeBarShape } = resolveBarShapes({\n rangeBackground: entry?.settings.background === true,\n inRange,\n trackFill: backgroundFill,\n activeBarOption,\n });\n const cells =\n entry &&\n rangeCells({\n data,\n chartData,\n xKey,\n seriesKey: key,\n settings: entry.settings,\n range: entry.range,\n headroomKey,\n barShape,\n rounded,\n fillOf,\n radiusFor,\n });\n const labels = showLabels && (\n <LabelList\n dataKey={key}\n position={barLabelPosition}\n formatter={toLabelFormatter(labelFormatter)}\n className={resolveLabelFillClass(barLabelPosition)}\n fontSize={CHART_LABEL_FONT_SIZE}\n />\n );\n return (\n <React.Fragment key={key}>\n <Bar\n dataKey={key}\n fill={fillOf(key, barShape)}\n // Its own stack, so the headroom sits on this series' bar\n // while the series stay side by side.\n stackId={isStacked ? 'a' : headroomKey ? key : undefined}\n radius={radiusFor(barShape, rounded)}\n minPointSize={minPointSizeFor(key)}\n background={showBackground ? { fill: backgroundFill } : undefined}\n shape={shape}\n activeBar={activeBarShape}\n {...animation}\n >\n {cells}\n {labels}\n </Bar>\n {headroomKey && (\n <Bar\n dataKey={`${HEADROOM_FIELD_PREFIX}${key}`}\n stackId={key}\n fill={`var(--color-${key})`}\n fillOpacity={0.25}\n radius={radiusFor(barShape, true)}\n // Decoration for the bar below it — never its own row in the\n // tooltip or entry in the legend.\n legendType=\"none\"\n tooltipType=\"none\"\n {...animation}\n />\n )}\n </React.Fragment>\n );\n });\n\n const renderReferenceAreas = () =>\n referenceAreas.map(({ area, range }, index) => {\n const [start, end] = range;\n // Bands run along the category axis: X for vertical bars, Y for\n // horizontal ones.\n const bounds =\n orientation === 'horizontal'\n ? { y1: data[start]?.[xKey], y2: data[end]?.[xKey] }\n : { x1: data[start]?.[xKey], x2: data[end]?.[xKey] };\n return (\n <ReferenceArea\n key={`${area.label ?? 'area'}-${index}`}\n {...bounds}\n fill=\"var(--ui-background-surface-secondary)\"\n fillOpacity={0.6}\n ifOverflow=\"extendDomain\"\n shape={resolveBandShape({\n divider: area.divider,\n vertical: orientation !== 'horizontal',\n })}\n label={resolveBandLabel(area.label)}\n />\n );\n });\n\n const renderReferenceLines = () =>\n referenceLines.map((ref, index) => {\n const value = resolveChartReferenceValue(ref, data, dataKeys);\n if (value === undefined) return null;\n return (\n <ReferenceLine\n key={`${ref.label ?? 'ref'}-${index}`}\n // Draw on the value axis: Y for vertical bars, X for horizontal.\n {...(orientation === 'horizontal' ? { x: value } : { y: value })}\n // By default the caption sits at the top of the line: above the\n // right end of a horizontal line (vertical bars), or above the\n // top of a vertical line (horizontal bars).\n {...resolveReferenceLineProps(\n ref.label,\n ref.labelPosition ??\n (orientation === 'horizontal' ? 'top' : 'insideTopRight')\n )}\n />\n );\n });\n\n return (\n <div\n ref={ref}\n data-orientation={orientation}\n data-layout={layout}\n className={cn(barChartVariants({ orientation, layout }), className)}\n {...props}\n >\n <ChartContainer\n config={config}\n className=\"size-full [&_.recharts-label]:fill-foreground\"\n >\n <RechartsBarChart\n data={chartData as readonly unknown[]}\n layout={rechartsLayout}\n barSize={barSize}\n maxBarSize={maxBarSize}\n barGap={barGap}\n barCategoryGap={barCategoryGap}\n >\n <BarPaintServers\n id={defsId}\n dataKeys={dataKeys}\n shapes={usedShapes}\n horizontal={orientation === 'horizontal'}\n />\n {showGrid && (\n <CartesianGrid\n horizontal={gridHorizontal ?? orientation === 'vertical'}\n vertical={gridVertical ?? orientation === 'horizontal'}\n strokeDasharray={gridDashed ? '3 3' : undefined}\n />\n )}\n {renderAxes()}\n {showTooltip && <ChartTooltip content={tooltipElement} />}\n {showLegend && <ChartLegend content={legendElement} />}\n {renderSeries()}\n {renderReferenceAreas()}\n {renderReferenceLines()}\n {showBrush && (\n <Brush\n dataKey={xKey}\n // The brush slices rows by index, so its captions come from\n // whichever axis holds the categories — Y for horizontal bars.\n tickFormatter={\n orientation === 'horizontal' ? yTickFormatter : xTickFormatter\n }\n {...resolveBrushProps({ brushHeight, brushAriaLabel })}\n />\n )}\n </RechartsBarChart>\n </ChartContainer>\n </div>\n );\n }\n);\nBarChart.displayName = 'BarChart';\n\nexport { BarChart, barChartVariants };\n"],"names":["barChartVariants","cva","HEADROOM_FIELD_PREFIX","dropHeadroomSeries","payload","dataKeys","real","item","a","b","withSeriesColor","_a","NormalizedTooltipContent","content","props","merged","React","jsx","ChartTooltipContent","NormalizedLegendContent","ChartLegendContent","renderBarWithTrack","bar","track","trackFill","paint","jsxs","Fragment","Rectangle","createTrackShape","inRange","row","resolveBarShapes","rangeBackground","activeBarOption","renderBandWithDivider","band","vertical","x","y","width","height","fill","fillOpacity","resolveBandShape","divider","resolveBandLabel","label","BarPaintServers","id","shapes","horizontal","hasGradient","hasPattern","key","rangeCells","data","chartData","xKey","seriesKey","settings","range","headroomKey","barShape","rounded","fillOf","radiusFor","opacity","dashed","rowIndex","on","shape","stacksHeadroom","Cell","BarChart","className","config","referenceLine","referenceArea","barSettings","xAxisLabel","yAxisLabel","xUnit","yUnit","orientation","layout","barRadius","barSize","maxBarSize","barGap","barCategoryGap","minPointSize","showBackground","backgroundFill","showActiveBar","activeBar","showGrid","showTooltip","showLegend","showXAxis","showYAxis","xTickFormatter","yTickFormatter","xAxisAngle","xAxisInterval","yAxisTickCount","yAxisDomain","gridDashed","gridHorizontal","gridVertical","tooltipContent","animate","animationDuration","animationBegin","animationEasing","showLabels","labelPosition","labelFormatter","showBrush","brushHeight","brushAriaLabel","ref","animation","resolveAnimation","rechartsLayout","isStacked","barLabelPosition","resolveCartesianLabelPosition","referenceLines","toReferenceLineList","referenceAreas","area","resolveCategoryRange","entry","settingsByKey","headroomKeys","pair","extra","upperKey","start","end","value","upper","highlightedValues","categoryTick","index","tickProps","formatter","Text","cn","defsId","usedShapes","minPointSizeFor","top","own","xAxisTitle","resolveXAxisTitle","yAxisTitle","resolveYAxisTitle","yDomain","resolveAxisDomain","xAxisHeight","resolveXAxisHeight","endRadius","tooltipElement","legendElement","renderAxes","XAxis","resolveRotatedTickAnchor","YAxis","renderSeries","activeBarShape","cells","labels","LabelList","toLabelFormatter","resolveLabelFillClass","CHART_LABEL_FONT_SIZE","Bar","renderReferenceAreas","bounds","_b","_c","_d","ReferenceArea","renderReferenceLines","resolveChartReferenceValue","ReferenceLine","resolveReferenceLineProps","ChartContainer","RechartsBarChart","CartesianGrid","ChartTooltip","ChartLegend","Brush","resolveBrushProps"],"mappings":";;;;;;;AAgEA,MAAMA,KAAmBC,GAAI,IAAI;AAAA,EAC/B,UAAU;AAAA,IACR,aAAa;AAAA,MACX,UAAU;AAAA,MACV,YAAY;AAAA,IAAA;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;AAAA,kBAE7BY,MACC,gBAAA/E;AAAA,oBAAC8K;AAAA,oBAAA;AAAA,sBACC,YAAYnF,MAAkBxB,MAAgB;AAAA,sBAC9C,UAAUyB,MAAgBzB,MAAgB;AAAA,sBAC1C,iBAAiBuB,KAAa,QAAQ;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAGzC2D,GAAA;AAAA,kBACArE,MAAe,gBAAAhF,EAAC+K,IAAA,EAAa,SAAS5B,GAAA,CAAgB;AAAA,kBACtDlE,MAAc,gBAAAjF,EAACgL,IAAA,EAAY,SAAS5B,GAAA,CAAe;AAAA,kBACnDK,GAAA;AAAA,kBACAS,GAAA;AAAA,kBACAM,GAAA;AAAA,kBACAnE,MACC,gBAAArG;AAAA,oBAACiL;AAAA,oBAAA;AAAA,sBACC,SAASxI;AAAA,sBAGT,eACE0B,MAAgB,eAAekB,IAAiBD;AAAA,sBAEjD,GAAG8F,GAAkB,EAAE,aAAA5E,IAAa,gBAAAC,IAAgB;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACvD;AAAA,cAAA;AAAA,YAAA;AAAA,UAEJ;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAGN;AACF;AACA9C,GAAS,cAAc;"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { addMonths as o } from "../../../node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/addMonths.js";
|
|
2
|
+
const i = 50;
|
|
3
|
+
function s(r, t, n, e = i) {
|
|
4
|
+
return {
|
|
5
|
+
fromYear: r ?? n - e,
|
|
6
|
+
toYear: t ?? n + e
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function l(r, t) {
|
|
10
|
+
var n;
|
|
11
|
+
return r ?? ((n = t == null ? void 0 : t.options) == null ? void 0 : n.weekStartsOn) ?? 1;
|
|
12
|
+
}
|
|
13
|
+
function g(r) {
|
|
14
|
+
return Array.from({ length: 12 }, (t, n) => ({
|
|
15
|
+
value: n,
|
|
16
|
+
label: r(new Date(2e3, n, 1))
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
function m(r, t) {
|
|
20
|
+
return Array.from({ length: Math.max(t - r + 1, 1) }, (n, e) => ({
|
|
21
|
+
value: r + e,
|
|
22
|
+
label: String(r + e)
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
function d(r, t, n) {
|
|
26
|
+
return (t.getFullYear() - r.getFullYear()) * 12 + (t.getMonth() - r.getMonth()) < n - 1 ? o(t, -(n - 1)) : r;
|
|
27
|
+
}
|
|
28
|
+
function f(r, t, n, e, u) {
|
|
29
|
+
switch (r) {
|
|
30
|
+
case "single":
|
|
31
|
+
return {
|
|
32
|
+
mode: "single",
|
|
33
|
+
selected: t,
|
|
34
|
+
onSelect: n
|
|
35
|
+
};
|
|
36
|
+
case "multiple":
|
|
37
|
+
return {
|
|
38
|
+
mode: "multiple",
|
|
39
|
+
selected: t,
|
|
40
|
+
onSelect: n,
|
|
41
|
+
min: e,
|
|
42
|
+
max: u
|
|
43
|
+
};
|
|
44
|
+
case "range":
|
|
45
|
+
return {
|
|
46
|
+
mode: "range",
|
|
47
|
+
selected: t,
|
|
48
|
+
onSelect: n,
|
|
49
|
+
min: e,
|
|
50
|
+
max: u
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
i as DEFAULT_YEAR_SPAN,
|
|
56
|
+
f as buildModeProps,
|
|
57
|
+
g as buildMonthItems,
|
|
58
|
+
m as buildYearItems,
|
|
59
|
+
d as clampNavigationTarget,
|
|
60
|
+
l as resolveWeekStartsOn,
|
|
61
|
+
s as resolveYearRange
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=calendar-panel-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-panel-utils.js","sources":["../../../../src/components/ui/calendar-panel/calendar-panel-utils.ts"],"sourcesContent":["import { addMonths } from 'date-fns';\n\nimport type { CalendarPanelSelected, CalendarPanelVariant } from './calendar-panel';\nimport type { DateRange, DayPickerLocale, DayPickerProps } from 'react-day-picker';\n\n/** Number of years offered on each side of the current year by default. */\nexport const DEFAULT_YEAR_SPAN = 50;\n\n/** A `{value, label}` pair for one `InputSelect` option in the header dropdowns. */\nexport interface CalendarSelectItem<T> {\n value: T;\n label: string;\n}\n\n/**\n * Resolves the year dropdown's bounds: an explicit `fromYear`/`toYear` wins,\n * otherwise falls back to `currentYear` ± `span`.\n */\nexport function resolveYearRange(\n fromYear: number | undefined,\n toYear: number | undefined,\n currentYear: number,\n span: number = DEFAULT_YEAR_SPAN\n): { fromYear: number; toYear: number } {\n return {\n fromYear: fromYear ?? currentYear - span,\n toYear: toYear ?? currentYear + span,\n };\n}\n\n/** Day-of-week index DayPicker accepts for `weekStartsOn` (0 = Sunday). */\nexport type WeekStartsOn = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\n/**\n * Resolves the week's first day: an explicit `weekStartsOn` wins, then the\n * `locale`'s own week start, then Monday (per the design default).\n */\nexport function resolveWeekStartsOn(\n weekStartsOn: WeekStartsOn | undefined,\n locale: DayPickerLocale | undefined\n): WeekStartsOn {\n return weekStartsOn ?? (locale?.options?.weekStartsOn as WeekStartsOn | undefined) ?? 1;\n}\n\n/**\n * Builds the 12 month dropdown items. Formats each from year 2000 (a leap\n * year), so every month — including February 29 — formats from a valid date.\n */\nexport function buildMonthItems(\n formatMonthLabel: (date: Date) => string\n): CalendarSelectItem<number>[] {\n return Array.from({ length: 12 }, (_unused, index) => ({\n value: index,\n label: formatMonthLabel(new Date(2000, index, 1)),\n }));\n}\n\n/**\n * Builds the year dropdown items spanning `fromYear`..`toYear` inclusive.\n * An inverted range (`toYear < fromYear`) clamps to a single `fromYear` item\n * rather than producing an empty or negative-length list.\n */\nexport function buildYearItems(\n fromYear: number,\n toYear: number\n): CalendarSelectItem<number>[] {\n return Array.from({ length: Math.max(toYear - fromYear + 1, 1) }, (_unused, index) => ({\n value: fromYear + index,\n label: String(fromYear + index),\n }));\n}\n\n/**\n * Backs a header-dropdown navigation target off so the last of `numberOfMonths`\n * displayed months doesn't run past `endMonth`. Mirrors react-day-picker's own\n * `getInitialMonth` back-off — its `goToMonth` only clamps the *first* displayed\n * month to `endMonth`, so for a two-month `range` panel, requesting a first month\n * within one month of `endMonth` (e.g. `endMonth` itself) leaves the second month\n * past the bound, and `getDisplayMonths` silently drops it instead of the pair\n * sliding back.\n */\nexport function clampNavigationTarget(\n target: Date,\n endMonth: Date,\n numberOfMonths: number\n): Date {\n const monthsUntilEnd =\n (endMonth.getFullYear() - target.getFullYear()) * 12 +\n (endMonth.getMonth() - target.getMonth());\n return monthsUntilEnd < numberOfMonths - 1\n ? addMonths(endMonth, -(numberOfMonths - 1))\n : target;\n}\n\n/**\n * Assembles DayPicker's mode-specific selection props from `variant`. DayPicker's\n * props are a discriminated union keyed by a literal `mode`, so each branch is\n * built separately (rather than a single object with `mode: variant`) — a\n * literal tag is what lets TypeScript pick the matching union member without\n * an `as DayPickerProps` assertion. `selected`/`onSelect` are cast per branch\n * to their branch-specific shape only, which the discriminated `CalendarPanelProps`\n * union above guarantees is safe at the call site.\n */\nexport function buildModeProps(\n variant: CalendarPanelVariant,\n selected: CalendarPanelSelected,\n onSelect: ((selected: CalendarPanelSelected, triggerDate: Date) => void) | undefined,\n min: number | undefined,\n max: number | undefined\n): DayPickerProps {\n switch (variant) {\n case 'single':\n return {\n mode: 'single',\n selected: selected as Date | undefined,\n onSelect: onSelect as ((selected: Date | undefined, triggerDate: Date) => void) | undefined,\n };\n case 'multiple':\n return {\n mode: 'multiple',\n selected: selected as Date[] | undefined,\n onSelect: onSelect as ((selected: Date[] | undefined, triggerDate: Date) => void) | undefined,\n min,\n max,\n };\n case 'range':\n return {\n mode: 'range',\n selected: selected as DateRange | undefined,\n onSelect: onSelect as ((selected: DateRange | undefined, triggerDate: Date) => void) | undefined,\n min,\n max,\n };\n }\n}\n"],"names":["DEFAULT_YEAR_SPAN","resolveYearRange","fromYear","toYear","currentYear","span","resolveWeekStartsOn","weekStartsOn","locale","_a","buildMonthItems","formatMonthLabel","_unused","index","buildYearItems","clampNavigationTarget","target","endMonth","numberOfMonths","addMonths","buildModeProps","variant","selected","onSelect","min","max"],"mappings":";AAMO,MAAMA,IAAoB;AAY1B,SAASC,EACdC,GACAC,GACAC,GACAC,IAAeL,GACuB;AACtC,SAAO;AAAA,IACL,UAAUE,KAAYE,IAAcC;AAAA,IACpC,QAAQF,KAAUC,IAAcC;AAAA,EAAA;AAEpC;AASO,SAASC,EACdC,GACAC,GACc;;AACd,SAAOD,OAAiBE,IAAAD,KAAA,gBAAAA,EAAQ,YAAR,gBAAAC,EAAiB,iBAA6C;AACxF;AAMO,SAASC,EACdC,GAC8B;AAC9B,SAAO,MAAM,KAAK,EAAE,QAAQ,MAAM,CAACC,GAASC,OAAW;AAAA,IACrD,OAAOA;AAAA,IACP,OAAOF,EAAiB,IAAI,KAAK,KAAME,GAAO,CAAC,CAAC;AAAA,EAAA,EAChD;AACJ;AAOO,SAASC,EACdZ,GACAC,GAC8B;AAC9B,SAAO,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAIA,IAASD,IAAW,GAAG,CAAC,EAAA,GAAK,CAACU,GAASC,OAAW;AAAA,IACrF,OAAOX,IAAWW;AAAA,IAClB,OAAO,OAAOX,IAAWW,CAAK;AAAA,EAAA,EAC9B;AACJ;AAWO,SAASE,EACdC,GACAC,GACAC,GACM;AAIN,UAFGD,EAAS,YAAA,IAAgBD,EAAO,iBAAiB,MACjDC,EAAS,SAAA,IAAaD,EAAO,SAAA,KACRE,IAAiB,IACrCC,EAAUF,GAAU,EAAEC,IAAiB,EAAE,IACzCF;AACN;AAWO,SAASI,EACdC,GACAC,GACAC,GACAC,GACAC,GACgB;AAChB,UAAQJ,GAAA;AAAA,IACN,KAAK;AACH,aAAO;AAAA,QACL,MAAM;AAAA,QACN,UAAAC;AAAA,QACA,UAAAC;AAAA,MAAA;AAAA,IAEJ,KAAK;AACH,aAAO;AAAA,QACL,MAAM;AAAA,QACN,UAAAD;AAAA,QACA,UAAAC;AAAA,QACA,KAAAC;AAAA,QACA,KAAAC;AAAA,MAAA;AAAA,IAEJ,KAAK;AACH,aAAO;AAAA,QACL,MAAM;AAAA,QACN,UAAAH;AAAA,QACA,UAAAC;AAAA,QACA,KAAAC;AAAA,QACA,KAAAC;AAAA,MAAA;AAAA,EACF;AAEN;"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { jsxs as M, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import { cn as D } from "../../../lib/utils.js";
|
|
4
|
+
import { buildMonthItems as K, buildYearItems as Q, clampNavigationTarget as k, resolveWeekStartsOn as X, resolveYearRange as Z, buildModeProps as $, DEFAULT_YEAR_SPAN as ee } from "./calendar-panel-utils.js";
|
|
5
|
+
import { useDayPicker as ae } from "../../../node_modules/.pnpm/react-day-picker@10.0.1_@types_react@19.2.15_react@19.2.6/node_modules/react-day-picker/dist/esm/useDayPicker.js";
|
|
6
|
+
import { addMonths as F } from "../../../node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/addMonths.js";
|
|
7
|
+
import { format as re } from "../../../node_modules/.pnpm/date-fns@4.3.0/node_modules/date-fns/format.js";
|
|
8
|
+
import { DayPicker as te } from "../../../node_modules/.pnpm/react-day-picker@10.0.1_@types_react@19.2.15_react@19.2.6/node_modules/react-day-picker/dist/esm/DayPicker.js";
|
|
9
|
+
import { DialogFooterDefault as oe } from "../dialog-footer-default/dialog-footer-default.js";
|
|
10
|
+
import { Button as L } from "../button/button.js";
|
|
11
|
+
import { InputSelect as ne, InputSelectTrigger as de, InputSelectValue as le, InputSelectContent as ie, InputSelectItem as ce } from "../input-select/input-select.js";
|
|
12
|
+
const O = r.createContext(null);
|
|
13
|
+
function N({
|
|
14
|
+
items: n,
|
|
15
|
+
value: a,
|
|
16
|
+
ariaLabel: o,
|
|
17
|
+
onValueChange: d
|
|
18
|
+
}) {
|
|
19
|
+
return /* @__PURE__ */ M(
|
|
20
|
+
ne,
|
|
21
|
+
{
|
|
22
|
+
items: n,
|
|
23
|
+
value: a,
|
|
24
|
+
onValueChange: (e) => d(Number(e)),
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ t(de, { "aria-label": o, className: "min-w-0 flex-1", children: /* @__PURE__ */ t(le, {}) }),
|
|
27
|
+
/* @__PURE__ */ t(ie, { children: n.map((e) => /* @__PURE__ */ t(ce, { value: e.value, children: e.label }, e.value)) })
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
N.displayName = "CalendarHeaderSelect";
|
|
33
|
+
function R({
|
|
34
|
+
calendarMonth: n,
|
|
35
|
+
displayIndex: a,
|
|
36
|
+
className: o,
|
|
37
|
+
...d
|
|
38
|
+
}) {
|
|
39
|
+
const { goToMonth: e } = ae(), l = r.useContext(O);
|
|
40
|
+
if (!l)
|
|
41
|
+
throw new Error("CalendarHeader must be rendered inside <CalendarPanel>.");
|
|
42
|
+
const { monthLabel: u, yearLabel: c, fromYear: v, toYear: b, formatMonthLabel: h, endMonth: p, numberOfMonths: f } = l, g = n.date, i = g.getMonth(), s = g.getFullYear(), y = r.useMemo(
|
|
43
|
+
() => K(h),
|
|
44
|
+
[h]
|
|
45
|
+
), C = r.useMemo(
|
|
46
|
+
() => Q(v, b),
|
|
47
|
+
[v, b]
|
|
48
|
+
);
|
|
49
|
+
return /* @__PURE__ */ M(
|
|
50
|
+
"header",
|
|
51
|
+
{
|
|
52
|
+
className: D(
|
|
53
|
+
"flex items-center gap-[var(--ui-calendar-header-gap)] border-b-[length:var(--ui-calendar-header-border-width)] border-[color:var(--ui-calendar-header-border-color)] px-[var(--ui-calendar-header-padding-x)] py-[var(--ui-calendar-header-padding-y)] [border-bottom-style:var(--ui-calendar-header-border-style)]",
|
|
54
|
+
o
|
|
55
|
+
),
|
|
56
|
+
...d,
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ t(
|
|
59
|
+
N,
|
|
60
|
+
{
|
|
61
|
+
items: y,
|
|
62
|
+
value: i,
|
|
63
|
+
ariaLabel: u,
|
|
64
|
+
onValueChange: (m) => e(
|
|
65
|
+
k(
|
|
66
|
+
F(new Date(s, m, 1), -a),
|
|
67
|
+
p,
|
|
68
|
+
f
|
|
69
|
+
)
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ t(
|
|
74
|
+
N,
|
|
75
|
+
{
|
|
76
|
+
items: C,
|
|
77
|
+
value: s,
|
|
78
|
+
ariaLabel: c,
|
|
79
|
+
onValueChange: (m) => e(
|
|
80
|
+
k(
|
|
81
|
+
F(new Date(m, i, 1), -a),
|
|
82
|
+
p,
|
|
83
|
+
f
|
|
84
|
+
)
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
R.displayName = "CalendarHeader";
|
|
93
|
+
function _({
|
|
94
|
+
className: n,
|
|
95
|
+
day: a,
|
|
96
|
+
modifiers: o,
|
|
97
|
+
...d
|
|
98
|
+
}) {
|
|
99
|
+
const e = r.useRef(null);
|
|
100
|
+
r.useEffect(() => {
|
|
101
|
+
var c;
|
|
102
|
+
o.focused && ((c = e.current) == null || c.focus());
|
|
103
|
+
}, [o.focused]);
|
|
104
|
+
const l = !!o.range_middle, u = !!o.selected && !l;
|
|
105
|
+
return /* @__PURE__ */ t(
|
|
106
|
+
"button",
|
|
107
|
+
{
|
|
108
|
+
ref: e,
|
|
109
|
+
type: "button",
|
|
110
|
+
"data-day": a.date.toLocaleDateString(),
|
|
111
|
+
"data-active": u,
|
|
112
|
+
"data-range-middle": l,
|
|
113
|
+
className: D(
|
|
114
|
+
"ui-calendar-value-text-style",
|
|
115
|
+
"flex size-[var(--ui-calendar-item-width-min)] min-h-[var(--ui-calendar-item-height-min)] min-w-[var(--ui-calendar-item-width-min)] cursor-pointer items-center justify-center border border-[color:var(--ui-calendar-item-border-idle)] bg-[var(--ui-calendar-item-color-idle)] p-0 text-[var(--ui-calendar-value-color-idle-primary)] outline-none transition-colors [font-variant-numeric:var(--ui-calendar-value-font-variant-numeric)]",
|
|
116
|
+
"not-data-[active=true]:hover:border-[color:var(--ui-calendar-item-border-hover)] not-data-[active=true]:hover:bg-[var(--ui-calendar-item-color-hover)]",
|
|
117
|
+
"data-[range-middle=true]:bg-[var(--ui-calendar-item-color-hover)] data-[range-middle=true]:text-[var(--ui-calendar-value-color-idle-primary)]",
|
|
118
|
+
"data-[active=true]:border-[color:var(--ui-calendar-item-border-active)] data-[active=true]:bg-[var(--ui-calendar-item-color-active)] data-[active=true]:text-[var(--ui-calendar-value-color-active)]",
|
|
119
|
+
"group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-[var(--ui-focus-primary)]",
|
|
120
|
+
"disabled:pointer-events-none disabled:text-[var(--ui-calendar-value-color-disabled)]",
|
|
121
|
+
n
|
|
122
|
+
),
|
|
123
|
+
...d
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
_.displayName = "CalendarItem";
|
|
128
|
+
const ue = r.forwardRef(
|
|
129
|
+
({
|
|
130
|
+
className: n,
|
|
131
|
+
variant: a = "single",
|
|
132
|
+
selected: o,
|
|
133
|
+
onSelect: d,
|
|
134
|
+
defaultMonth: e,
|
|
135
|
+
month: l,
|
|
136
|
+
onMonthChange: u,
|
|
137
|
+
disabled: c,
|
|
138
|
+
min: v,
|
|
139
|
+
max: b,
|
|
140
|
+
showOutsideDays: h = !0,
|
|
141
|
+
weekStartsOn: p,
|
|
142
|
+
fromYear: f,
|
|
143
|
+
toYear: g,
|
|
144
|
+
locale: i,
|
|
145
|
+
monthLabel: s = "Month",
|
|
146
|
+
yearLabel: y = "Year",
|
|
147
|
+
formatMonthLabel: C,
|
|
148
|
+
cancelLabel: m = "Cancel",
|
|
149
|
+
applyLabel: A = "Apply",
|
|
150
|
+
onCancel: H,
|
|
151
|
+
onApply: T,
|
|
152
|
+
dir: S,
|
|
153
|
+
...z
|
|
154
|
+
}, B) => {
|
|
155
|
+
const E = (/* @__PURE__ */ new Date()).getFullYear(), { fromYear: x, toYear: w } = Z(
|
|
156
|
+
f,
|
|
157
|
+
g,
|
|
158
|
+
E,
|
|
159
|
+
ee
|
|
160
|
+
), V = X(p, i), j = a !== "single", I = a === "range" ? 2 : 1, W = r.useCallback(
|
|
161
|
+
(J) => re(J, "MMMM", { locale: i }),
|
|
162
|
+
[i]
|
|
163
|
+
), P = C ?? W, U = r.useMemo(() => new Date(x, 0, 1), [x]), Y = r.useMemo(() => new Date(w, 11, 1), [w]), q = r.useMemo(
|
|
164
|
+
() => ({
|
|
165
|
+
monthLabel: s,
|
|
166
|
+
yearLabel: y,
|
|
167
|
+
fromYear: x,
|
|
168
|
+
toYear: w,
|
|
169
|
+
formatMonthLabel: P,
|
|
170
|
+
endMonth: Y,
|
|
171
|
+
numberOfMonths: I
|
|
172
|
+
}),
|
|
173
|
+
[
|
|
174
|
+
s,
|
|
175
|
+
y,
|
|
176
|
+
x,
|
|
177
|
+
w,
|
|
178
|
+
P,
|
|
179
|
+
Y,
|
|
180
|
+
I
|
|
181
|
+
]
|
|
182
|
+
), G = $(
|
|
183
|
+
a,
|
|
184
|
+
o,
|
|
185
|
+
d,
|
|
186
|
+
v,
|
|
187
|
+
b
|
|
188
|
+
);
|
|
189
|
+
return /* @__PURE__ */ M(
|
|
190
|
+
"div",
|
|
191
|
+
{
|
|
192
|
+
ref: B,
|
|
193
|
+
dir: S,
|
|
194
|
+
"data-slot": "calendar-panel",
|
|
195
|
+
"data-variant": a,
|
|
196
|
+
className: D(
|
|
197
|
+
"inline-flex w-fit flex-col overflow-hidden rounded-[var(--ui-calendar-container-border-radius)] border-[length:var(--ui-calendar-container-border-width)] border-[color:var(--ui-calendar-container-border-color)] bg-[var(--ui-calendar-container-color)] shadow-md [border-style:var(--ui-calendar-container-border-style)]",
|
|
198
|
+
n
|
|
199
|
+
),
|
|
200
|
+
...z,
|
|
201
|
+
children: [
|
|
202
|
+
/* @__PURE__ */ t(O.Provider, { value: q, children: /* @__PURE__ */ t(
|
|
203
|
+
te,
|
|
204
|
+
{
|
|
205
|
+
...G,
|
|
206
|
+
dir: S,
|
|
207
|
+
defaultMonth: e,
|
|
208
|
+
month: l,
|
|
209
|
+
onMonthChange: u,
|
|
210
|
+
disabled: c,
|
|
211
|
+
startMonth: U,
|
|
212
|
+
endMonth: Y,
|
|
213
|
+
showOutsideDays: h,
|
|
214
|
+
weekStartsOn: V,
|
|
215
|
+
locale: i,
|
|
216
|
+
numberOfMonths: a === "range" ? 2 : 1,
|
|
217
|
+
hideNavigation: !0,
|
|
218
|
+
classNames: {
|
|
219
|
+
root: "flex",
|
|
220
|
+
months: "flex flex-row",
|
|
221
|
+
// The vertical rule between the two `range` months is the first
|
|
222
|
+
// column's inline-end border, so it mirrors under RTL.
|
|
223
|
+
// Width = 7 day columns + 2 sides of body padding, derived from tokens
|
|
224
|
+
// so it stays in sync if either is retokened.
|
|
225
|
+
month: "flex w-[calc(var(--ui-calendar-item-width-min)*7+var(--ui-calendar-body-padding-x)*2)] flex-col border-e-[length:var(--ui-calendar-body-border-width)] border-[color:var(--ui-calendar-body-border-color)] last:border-e-0 [border-inline-end-style:var(--ui-calendar-body-border-style)]",
|
|
226
|
+
// `table-fixed` (rather than the default `auto`) is what makes the
|
|
227
|
+
// 32px-per-column contract above actually hold: under `auto`
|
|
228
|
+
// layout a single wide weekday abbreviation (e.g. some `ar`/`te`/
|
|
229
|
+
// `kn` locales) widens its whole column past the fixed 248px month
|
|
230
|
+
// width, which the panel's `overflow-hidden` then clips — silently
|
|
231
|
+
// dropping a day column instead of just the label.
|
|
232
|
+
month_grid: "w-full table-fixed border-separate border-spacing-0 px-[var(--ui-calendar-body-padding-x)] py-[var(--ui-calendar-body-padding-y)]",
|
|
233
|
+
weekday: "ui-calendar-value-text-style size-[var(--ui-calendar-item-width-min)] overflow-hidden whitespace-nowrap p-0 text-center font-normal text-[var(--ui-calendar-value-color-idle-secondary)]",
|
|
234
|
+
day: "group/day size-[var(--ui-calendar-item-width-min)] p-0 text-center",
|
|
235
|
+
outside: "[&_button]:text-[var(--ui-calendar-value-color-disabled)]",
|
|
236
|
+
disabled: "[&_button]:text-[var(--ui-calendar-value-color-disabled)]",
|
|
237
|
+
hidden: "invisible"
|
|
238
|
+
},
|
|
239
|
+
components: {
|
|
240
|
+
MonthCaption: R,
|
|
241
|
+
DayButton: _
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
) }),
|
|
245
|
+
j && /* @__PURE__ */ M(oe, { children: [
|
|
246
|
+
/* @__PURE__ */ t(L, { variant: "secondary", onClick: H, children: m }),
|
|
247
|
+
/* @__PURE__ */ t(L, { onClick: T, children: A })
|
|
248
|
+
] })
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
ue.displayName = "CalendarPanel";
|
|
255
|
+
export {
|
|
256
|
+
R as CalendarHeader,
|
|
257
|
+
_ as CalendarItem,
|
|
258
|
+
ue as CalendarPanel
|
|
259
|
+
};
|
|
260
|
+
//# sourceMappingURL=calendar-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-panel.js","sources":["../../../../src/components/ui/calendar-panel/calendar-panel.tsx"],"sourcesContent":["import * as React from 'react';\nimport { addMonths, format } from 'date-fns';\nimport {\n DayPicker,\n useDayPicker,\n type DateRange,\n type DayButton,\n type DayPickerLocale,\n type Matcher,\n type MonthCaptionProps,\n} from 'react-day-picker';\n\nimport { cn } from '@/lib/utils';\nimport { Button } from '../button';\nimport { DialogFooterDefault } from '../dialog-footer-default';\nimport {\n InputSelect,\n InputSelectContent,\n InputSelectItem,\n InputSelectTrigger,\n InputSelectValue,\n} from '../input-select';\nimport {\n DEFAULT_YEAR_SPAN,\n buildModeProps,\n buildMonthItems,\n buildYearItems,\n clampNavigationTarget,\n resolveWeekStartsOn,\n resolveYearRange,\n type CalendarSelectItem,\n} from './calendar-panel-utils';\n\n// The Figma \"Calendar\" panel: a bordered, elevated day-picker panel themed by the\n// dedicated `--ui-calendar-*` tier. Its three variants are the three\n// `react-day-picker` selection modes, and each one changes the panel's structure:\n// • single — one 248px month, no footer.\n// • multiple — one 248px month + a Cancel/Apply footer.\n// • range — two 248px months side by side (divided by a vertical rule) sharing\n// one Cancel/Apply footer.\n// Figma's `state` axis (idle / selected) is demo-only — it is DayPicker's runtime\n// selection state, not a prop.\n//\n// The month/year pickers in the header are real `InputSelect` instances (as in the\n// design), wired through DayPicker's custom-component API: the whole `MonthCaption`\n// is replaced, rather than using `captionLayout=\"dropdown\"`'s native `<select>`\n// elements. Per-instance caption options (labels, year window, month formatter) reach\n// that override through `CalendarPanelCaptionContext`, since DayPicker instantiates\n// custom components itself and passes only its own props.\n//\n// Every cell — idle, hover, in-range, endpoint — is a flat square: this design has no\n// corner-radius differentiation, so there is deliberately no range-endpoint \"pill\"\n// rounding.\n\nexport type CalendarPanelVariant = 'single' | 'multiple' | 'range';\n\n/** Selected value, shaped by the active `variant`. */\nexport type CalendarPanelSelected = Date | Date[] | DateRange | undefined;\n\ninterface CalendarPanelCaptionContextValue {\n monthLabel: string;\n yearLabel: string;\n fromYear: number;\n toYear: number;\n formatMonthLabel: (date: Date) => string;\n endMonth: Date;\n numberOfMonths: number;\n}\n\nconst CalendarPanelCaptionContext =\n React.createContext<CalendarPanelCaptionContextValue | null>(null);\n\n/** One header dropdown (month or year) — an `InputSelect` over a fixed item list. */\nfunction CalendarHeaderSelect({\n items,\n value,\n ariaLabel,\n onValueChange,\n}: {\n items: CalendarSelectItem<number>[];\n value: number;\n ariaLabel: string;\n onValueChange: (next: number) => void;\n}) {\n return (\n <InputSelect\n items={items}\n value={value}\n onValueChange={(next) => onValueChange(Number(next))}\n >\n <InputSelectTrigger aria-label={ariaLabel} className=\"min-w-0 flex-1\">\n <InputSelectValue />\n </InputSelectTrigger>\n <InputSelectContent>\n {items.map((item) => (\n <InputSelectItem key={item.value} value={item.value}>\n {item.label}\n </InputSelectItem>\n ))}\n </InputSelectContent>\n </InputSelect>\n );\n}\nCalendarHeaderSelect.displayName = 'CalendarHeaderSelect';\n\n/**\n * The header of one month column: a month `InputSelect` and a year `InputSelect`.\n * Replaces DayPicker's `MonthCaption`.\n */\nfunction CalendarHeader({\n calendarMonth,\n displayIndex,\n className,\n ...props\n}: MonthCaptionProps) {\n const { goToMonth } = useDayPicker();\n const context = React.useContext(CalendarPanelCaptionContext);\n if (!context) {\n throw new Error('CalendarHeader must be rendered inside <CalendarPanel>.');\n }\n const { monthLabel, yearLabel, fromYear, toYear, formatMonthLabel, endMonth, numberOfMonths } =\n context;\n\n const date = calendarMonth.date;\n const month = date.getMonth();\n const year = date.getFullYear();\n\n const monthItems = React.useMemo(\n () => buildMonthItems(formatMonthLabel),\n [formatMonthLabel]\n );\n\n const yearItems = React.useMemo(\n () => buildYearItems(fromYear, toYear),\n [fromYear, toYear]\n );\n\n return (\n <header\n className={cn(\n 'flex items-center gap-[var(--ui-calendar-header-gap)] border-b-[length:var(--ui-calendar-header-border-width)] border-[color:var(--ui-calendar-header-border-color)] px-[var(--ui-calendar-header-padding-x)] py-[var(--ui-calendar-header-padding-y)] [border-bottom-style:var(--ui-calendar-header-border-style)]',\n className\n )}\n {...props}\n >\n <CalendarHeaderSelect\n items={monthItems}\n value={month}\n ariaLabel={monthLabel}\n onValueChange={(next) =>\n goToMonth(\n clampNavigationTarget(\n addMonths(new Date(year, next, 1), -displayIndex),\n endMonth,\n numberOfMonths\n )\n )\n }\n />\n <CalendarHeaderSelect\n items={yearItems}\n value={year}\n ariaLabel={yearLabel}\n onValueChange={(next) =>\n goToMonth(\n clampNavigationTarget(\n addMonths(new Date(next, month, 1), -displayIndex),\n endMonth,\n numberOfMonths\n )\n )\n }\n />\n </header>\n );\n}\nCalendarHeader.displayName = 'CalendarHeader';\n\n/**\n * One day cell (Figma's \"CalendarItem\") — a flat 32×32 square. `data-active`\n * (a selected day or either range endpoint) and `data-range-middle` are mutually\n * exclusive, so their backgrounds never compete.\n */\nfunction CalendarItem({\n className,\n day,\n modifiers,\n ...props\n}: React.ComponentProps<typeof DayButton>) {\n const ref = React.useRef<HTMLButtonElement>(null);\n React.useEffect(() => {\n if (modifiers.focused) ref.current?.focus();\n }, [modifiers.focused]);\n\n const isRangeMiddle = Boolean(modifiers.range_middle);\n const isActive = Boolean(modifiers.selected) && !isRangeMiddle;\n\n return (\n <button\n ref={ref}\n type=\"button\"\n data-day={day.date.toLocaleDateString()}\n data-active={isActive}\n data-range-middle={isRangeMiddle}\n className={cn(\n 'ui-calendar-value-text-style',\n 'flex size-[var(--ui-calendar-item-width-min)] min-h-[var(--ui-calendar-item-height-min)] min-w-[var(--ui-calendar-item-width-min)] cursor-pointer items-center justify-center border border-[color:var(--ui-calendar-item-border-idle)] bg-[var(--ui-calendar-item-color-idle)] p-0 text-[var(--ui-calendar-value-color-idle-primary)] outline-none transition-colors [font-variant-numeric:var(--ui-calendar-value-font-variant-numeric)]',\n 'not-data-[active=true]:hover:border-[color:var(--ui-calendar-item-border-hover)] not-data-[active=true]:hover:bg-[var(--ui-calendar-item-color-hover)]',\n 'data-[range-middle=true]:bg-[var(--ui-calendar-item-color-hover)] data-[range-middle=true]:text-[var(--ui-calendar-value-color-idle-primary)]',\n 'data-[active=true]:border-[color:var(--ui-calendar-item-border-active)] data-[active=true]:bg-[var(--ui-calendar-item-color-active)] data-[active=true]:text-[var(--ui-calendar-value-color-active)]',\n 'group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-[var(--ui-focus-primary)]',\n 'disabled:pointer-events-none disabled:text-[var(--ui-calendar-value-color-disabled)]',\n className\n )}\n {...props}\n />\n );\n}\nCalendarItem.displayName = 'CalendarItem';\n\ninterface CalendarPanelSharedProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect' | 'defaultValue'> {\n /**\n * Text direction. Forwarded to `DayPicker` explicitly — an ancestor's `dir`\n * mirrors the panel's CSS layout automatically (logical properties), but\n * `react-day-picker` only flips its Arrow Left/Right keyboard roaming when\n * `dir` is passed to it directly, so it must also be passed here.\n */\n dir?: 'ltr' | 'rtl';\n /** Uncontrolled initial month shown. */\n defaultMonth?: Date;\n /** Controlled month shown (the first month, for `range`). */\n month?: Date;\n /** Called when the displayed month changes (header dropdowns). */\n onMonthChange?: (month: Date) => void;\n /** Days that cannot be selected. */\n disabled?: Matcher | Matcher[];\n /** Minimum number of selectable days (`multiple` / `range`; ignored for `single`). */\n min?: number;\n /** Maximum number of selectable days (`multiple` / `range`; ignored for `single`). */\n max?: number;\n /** Render the leading/trailing days of the adjacent months. */\n showOutsideDays?: boolean;\n /**\n * First day of the week (0 = Sunday). Defaults to `locale`'s own week start,\n * falling back to Monday (per the design) when no `locale` is given.\n */\n weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n /**\n * First year offered by the year dropdown and the earliest month the grid\n * can navigate to. Defaults to 50 years back.\n */\n fromYear?: number;\n /**\n * Last year offered by the year dropdown and the latest month the grid can\n * navigate to. Defaults to 50 years ahead.\n */\n toYear?: number;\n /**\n * Localizes weekday names and DayPicker's default day-cell/caption accessible\n * labels (e.g. `import { es } from 'react-day-picker/locale'`). Defaults to\n * date-fns `enUS`. Does not translate `monthLabel`/`yearLabel`/`cancelLabel`/\n * `applyLabel`/`formatMonthLabel` — those are separate props the consumer\n * must localize themselves.\n */\n locale?: DayPickerLocale;\n /** Accessible name of the month dropdown. */\n monthLabel?: string;\n /** Accessible name of the year dropdown. */\n yearLabel?: string;\n /** Formats a month's name for the month dropdown. Defaults to `locale`-aware `date-fns` formatting. */\n formatMonthLabel?: (date: Date) => string;\n /** Footer \"Cancel\" button label (`multiple` / `range`). */\n cancelLabel?: string;\n /** Footer \"Apply\" button label (`multiple` / `range`). */\n applyLabel?: string;\n /** Called when the footer's Cancel button is pressed. */\n onCancel?: () => void;\n /** Called when the footer's Apply button is pressed. */\n onApply?: () => void;\n}\n\n/** `variant=\"single\"` (the default) — `selected` is a single optional `Date`. */\nexport interface CalendarPanelSingleProps extends CalendarPanelSharedProps {\n /** Selection mode + panel structure. `multiple`/`range` add the Cancel/Apply footer; `range` shows two months. */\n variant?: 'single';\n /** The selected date. Uncontrolled unless `onSelect` is provided. */\n selected?: Date;\n /** Called when the selection changes. Providing it makes `selected` controlled. */\n onSelect?: (selected: Date | undefined, triggerDate: Date) => void;\n}\n\n/** `variant=\"multiple\"` — `selected` is a `Date[]`, and the footer is shown. */\nexport interface CalendarPanelMultipleProps extends CalendarPanelSharedProps {\n variant: 'multiple';\n selected?: Date[];\n onSelect?: (selected: Date[] | undefined, triggerDate: Date) => void;\n}\n\n/** `variant=\"range\"` — `selected` is a `DateRange`, two months render, and the footer is shown. */\nexport interface CalendarPanelRangeProps extends CalendarPanelSharedProps {\n variant: 'range';\n selected?: DateRange;\n onSelect?: (selected: DateRange | undefined, triggerDate: Date) => void;\n}\n\n/**\n * `CalendarPanel`'s props, discriminated by `variant` — a `single` panel only\n * accepts a `Date`, `multiple` only a `Date[]`, `range` only a `DateRange`, so\n * mismatched `selected`/`onSelect` shapes are caught at the call site instead\n * of silently reaching `react-day-picker` with the wrong shape at runtime.\n */\nexport type CalendarPanelProps =\n | CalendarPanelSingleProps\n | CalendarPanelMultipleProps\n | CalendarPanelRangeProps;\n\nconst CalendarPanel = React.forwardRef<HTMLDivElement, CalendarPanelProps>(\n (\n {\n className,\n variant = 'single',\n selected,\n onSelect,\n defaultMonth,\n month,\n onMonthChange,\n disabled,\n min,\n max,\n showOutsideDays = true,\n weekStartsOn,\n fromYear,\n toYear,\n locale,\n monthLabel = 'Month',\n yearLabel = 'Year',\n formatMonthLabel,\n cancelLabel = 'Cancel',\n applyLabel = 'Apply',\n onCancel,\n onApply,\n dir,\n ...props\n },\n ref\n ) => {\n const currentYear = new Date().getFullYear();\n const { fromYear: resolvedFromYear, toYear: resolvedToYear } = resolveYearRange(\n fromYear,\n toYear,\n currentYear,\n DEFAULT_YEAR_SPAN\n );\n const resolvedWeekStartsOn = resolveWeekStartsOn(weekStartsOn, locale);\n const showFooter = variant !== 'single';\n const numberOfMonths = variant === 'range' ? 2 : 1;\n\n // Stable across renders when the consumer doesn't override `formatMonthLabel`,\n // so `captionContext` below doesn't get a new identity (and rebuild the month\n // dropdown items) on every render.\n const defaultFormatMonthLabel = React.useCallback(\n (date: Date) => format(date, 'MMMM', { locale }),\n [locale]\n );\n const resolvedFormatMonthLabel = formatMonthLabel ?? defaultFormatMonthLabel;\n\n // Bounds the header dropdowns' navigation to the same window their own\n // options list offers — without this, keyboard shortcuts (Shift+PageUp/\n // PageDown) and a controlled `month` can move the grid past `fromYear`/\n // `toYear` while the year dropdown still only lists that range.\n const startMonth = React.useMemo(() => new Date(resolvedFromYear, 0, 1), [resolvedFromYear]);\n const endMonth = React.useMemo(() => new Date(resolvedToYear, 11, 1), [resolvedToYear]);\n\n const captionContext = React.useMemo<CalendarPanelCaptionContextValue>(\n () => ({\n monthLabel,\n yearLabel,\n fromYear: resolvedFromYear,\n toYear: resolvedToYear,\n formatMonthLabel: resolvedFormatMonthLabel,\n endMonth,\n numberOfMonths,\n }),\n [\n monthLabel,\n yearLabel,\n resolvedFromYear,\n resolvedToYear,\n resolvedFormatMonthLabel,\n endMonth,\n numberOfMonths,\n ]\n );\n\n // `selected`/`onSelect` are already guaranteed consistent with `variant` by\n // the discriminated `CalendarPanelProps` union above — this is the one\n // place that bridges to `DayPickerProps`'s own (differently-shaped)\n // discriminated union.\n const modeProps = buildModeProps(\n variant,\n selected,\n onSelect as unknown as\n | ((selected: CalendarPanelSelected, triggerDate: Date) => void)\n | undefined,\n min,\n max\n );\n\n return (\n <div\n ref={ref}\n dir={dir}\n data-slot=\"calendar-panel\"\n data-variant={variant}\n className={cn(\n 'inline-flex w-fit flex-col overflow-hidden rounded-[var(--ui-calendar-container-border-radius)] border-[length:var(--ui-calendar-container-border-width)] border-[color:var(--ui-calendar-container-border-color)] bg-[var(--ui-calendar-container-color)] shadow-md [border-style:var(--ui-calendar-container-border-style)]',\n className\n )}\n {...props}\n >\n <CalendarPanelCaptionContext.Provider value={captionContext}>\n <DayPicker\n {...modeProps}\n dir={dir}\n defaultMonth={defaultMonth}\n month={month}\n onMonthChange={onMonthChange}\n disabled={disabled}\n startMonth={startMonth}\n endMonth={endMonth}\n showOutsideDays={showOutsideDays}\n weekStartsOn={resolvedWeekStartsOn}\n locale={locale}\n numberOfMonths={variant === 'range' ? 2 : 1}\n // The design navigates months through the header dropdowns only —\n // there are no prev/next chevrons.\n hideNavigation\n classNames={{\n root: 'flex',\n months: 'flex flex-row',\n // The vertical rule between the two `range` months is the first\n // column's inline-end border, so it mirrors under RTL.\n // Width = 7 day columns + 2 sides of body padding, derived from tokens\n // so it stays in sync if either is retokened.\n month:\n 'flex w-[calc(var(--ui-calendar-item-width-min)*7+var(--ui-calendar-body-padding-x)*2)] flex-col border-e-[length:var(--ui-calendar-body-border-width)] border-[color:var(--ui-calendar-body-border-color)] last:border-e-0 [border-inline-end-style:var(--ui-calendar-body-border-style)]',\n // `table-fixed` (rather than the default `auto`) is what makes the\n // 32px-per-column contract above actually hold: under `auto`\n // layout a single wide weekday abbreviation (e.g. some `ar`/`te`/\n // `kn` locales) widens its whole column past the fixed 248px month\n // width, which the panel's `overflow-hidden` then clips — silently\n // dropping a day column instead of just the label.\n month_grid:\n 'w-full table-fixed border-separate border-spacing-0 px-[var(--ui-calendar-body-padding-x)] py-[var(--ui-calendar-body-padding-y)]',\n weekday:\n 'ui-calendar-value-text-style size-[var(--ui-calendar-item-width-min)] overflow-hidden whitespace-nowrap p-0 text-center font-normal text-[var(--ui-calendar-value-color-idle-secondary)]',\n day: 'group/day size-[var(--ui-calendar-item-width-min)] p-0 text-center',\n outside: '[&_button]:text-[var(--ui-calendar-value-color-disabled)]',\n disabled: '[&_button]:text-[var(--ui-calendar-value-color-disabled)]',\n hidden: 'invisible',\n }}\n components={{\n MonthCaption: CalendarHeader,\n DayButton: CalendarItem,\n }}\n />\n </CalendarPanelCaptionContext.Provider>\n {showFooter && (\n <DialogFooterDefault>\n <Button variant=\"secondary\" onClick={onCancel}>\n {cancelLabel}\n </Button>\n <Button onClick={onApply}>{applyLabel}</Button>\n </DialogFooterDefault>\n )}\n </div>\n );\n }\n);\nCalendarPanel.displayName = 'CalendarPanel';\n\nexport { CalendarPanel, CalendarItem, CalendarHeader };\n"],"names":["CalendarPanelCaptionContext","React","CalendarHeaderSelect","items","value","ariaLabel","onValueChange","jsxs","InputSelect","next","jsx","InputSelectTrigger","InputSelectValue","InputSelectContent","item","InputSelectItem","CalendarHeader","calendarMonth","displayIndex","className","props","goToMonth","useDayPicker","context","monthLabel","yearLabel","fromYear","toYear","formatMonthLabel","endMonth","numberOfMonths","date","month","year","monthItems","buildMonthItems","yearItems","buildYearItems","cn","clampNavigationTarget","addMonths","CalendarItem","day","modifiers","ref","_a","isRangeMiddle","isActive","CalendarPanel","variant","selected","onSelect","defaultMonth","onMonthChange","disabled","min","max","showOutsideDays","weekStartsOn","locale","cancelLabel","applyLabel","onCancel","onApply","dir","currentYear","resolvedFromYear","resolvedToYear","resolveYearRange","DEFAULT_YEAR_SPAN","resolvedWeekStartsOn","resolveWeekStartsOn","showFooter","defaultFormatMonthLabel","format","resolvedFormatMonthLabel","startMonth","captionContext","modeProps","buildModeProps","DayPicker","DialogFooterDefault","Button"],"mappings":";;;;;;;;;;;AAqEA,MAAMA,IACJC,EAAM,cAAuD,IAAI;AAGnE,SAASC,EAAqB;AAAA,EAC5B,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AACF,GAKG;AACD,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,OAAAL;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