@acronis-platform/ui-react 0.57.1 → 0.60.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/dist/components/ui/area-chart/area-chart.js +177 -0
- package/dist/components/ui/area-chart/area-chart.js.map +1 -0
- package/dist/components/ui/bar-chart/bar-chart.js +184 -78
- package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
- package/dist/components/ui/button-icon-input/button-icon-input.js +36 -0
- package/dist/components/ui/button-icon-input/button-icon-input.js.map +1 -0
- package/dist/components/ui/button-menu/button-menu.js +1 -1
- package/dist/components/ui/button-menu/button-menu.js.map +1 -1
- package/dist/components/ui/calendar/calendar.js +17 -15
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/card-filter/card-filter.js +40 -27
- package/dist/components/ui/card-filter/card-filter.js.map +1 -1
- package/dist/components/ui/carousel-dialog/carousel-dialog.js +87 -0
- package/dist/components/ui/carousel-dialog/carousel-dialog.js.map +1 -0
- package/dist/components/ui/category-bar/category-bar.js +126 -0
- package/dist/components/ui/category-bar/category-bar.js.map +1 -0
- package/dist/components/ui/chart/chart-format.js +40 -0
- package/dist/components/ui/chart/chart-format.js.map +1 -0
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/chart-state/chart-state.js +42 -0
- package/dist/components/ui/chart-state/chart-state.js.map +1 -0
- package/dist/components/ui/chip/chip.js +13 -13
- package/dist/components/ui/chip/chip.js.map +1 -1
- package/dist/components/ui/composed-chart/composed-chart.js +135 -0
- package/dist/components/ui/composed-chart/composed-chart.js.map +1 -0
- package/dist/components/ui/confidence-cone/confidence-cone.js +223 -0
- package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -0
- package/dist/components/ui/date-range-picker/date-range-picker.js +21 -21
- package/dist/components/ui/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/ui/dialog/dialog.js +248 -76
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/dialog-footer-carousel/dialog-footer-carousel.js +57 -0
- package/dist/components/ui/dialog-footer-carousel/dialog-footer-carousel.js.map +1 -0
- package/dist/components/ui/dialog-footer-default/dialog-footer-default.js +26 -0
- package/dist/components/ui/dialog-footer-default/dialog-footer-default.js.map +1 -0
- package/dist/components/ui/dialog-welcome/dialog-welcome.js +272 -0
- package/dist/components/ui/dialog-welcome/dialog-welcome.js.map +1 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +21 -21
- package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/ui/filter-search/filter-search.js +91 -90
- package/dist/components/ui/filter-search/filter-search.js.map +1 -1
- package/dist/components/ui/funnel-chart/funnel-chart.js +87 -0
- package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -0
- package/dist/components/ui/histogram/histogram.js +136 -0
- package/dist/components/ui/histogram/histogram.js.map +1 -0
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/input-otp/input-otp.js +104 -0
- package/dist/components/ui/input-otp/input-otp.js.map +1 -0
- package/dist/components/ui/input-password/input-password.js +120 -0
- package/dist/components/ui/input-password/input-password.js.map +1 -0
- package/dist/components/ui/input-text/input-text.js +9 -9
- package/dist/components/ui/input-text/input-text.js.map +1 -1
- package/dist/components/ui/line-chart/line-chart.js +234 -0
- package/dist/components/ui/line-chart/line-chart.js.map +1 -0
- package/dist/components/ui/link/link.js +5 -5
- package/dist/components/ui/link/link.js.map +1 -1
- package/dist/components/ui/loading/loading.js +79 -0
- package/dist/components/ui/loading/loading.js.map +1 -0
- package/dist/components/ui/meter/meter.js +93 -0
- package/dist/components/ui/meter/meter.js.map +1 -0
- package/dist/components/ui/metric/metric.js +185 -0
- package/dist/components/ui/metric/metric.js.map +1 -0
- package/dist/components/ui/pie-chart/pie-chart.js +113 -0
- package/dist/components/ui/pie-chart/pie-chart.js.map +1 -0
- package/dist/components/ui/popover/popover.js +57 -27
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/radar-chart/radar-chart.js +74 -0
- package/dist/components/ui/radar-chart/radar-chart.js.map +1 -0
- package/dist/components/ui/radial-bar-chart/radial-bar-chart.js +69 -0
- package/dist/components/ui/radial-bar-chart/radial-bar-chart.js.map +1 -0
- package/dist/components/ui/sankey-chart/sankey-chart.js +192 -0
- package/dist/components/ui/sankey-chart/sankey-chart.js.map +1 -0
- package/dist/components/ui/scatter-chart/scatter-chart.js +130 -0
- package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -0
- package/dist/components/ui/search/search.js +16 -16
- package/dist/components/ui/search/search.js.map +1 -1
- package/dist/components/ui/sheet/sheet-details.js +16 -16
- package/dist/components/ui/sheet/sheet-details.js.map +1 -1
- package/dist/components/ui/spinner/spinner.js.map +1 -1
- package/dist/components/ui/timeline/timeline.js +175 -0
- package/dist/components/ui/timeline/timeline.js.map +1 -0
- package/dist/components/ui/toolbar/toolbar.js +82 -92
- package/dist/components/ui/toolbar/toolbar.js.map +1 -1
- package/dist/components/ui/treemap/treemap.js +83 -0
- package/dist/components/ui/treemap/treemap.js.map +1 -0
- package/dist/components/ui/trend-indicator/trend-indicator.js +97 -0
- package/dist/components/ui/trend-indicator/trend-indicator.js.map +1 -0
- package/dist/index.js +461 -400
- package/dist/index.js.map +1 -1
- package/dist/lib/breakpoints.js +9 -6
- package/dist/lib/breakpoints.js.map +1 -1
- package/dist/node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.6/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +25 -0
- package/dist/node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.6/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js.map +1 -0
- package/dist/node_modules/.pnpm/embla-carousel-reactive-utils@8.6.0_embla-carousel@8.6.0/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +36 -0
- package/dist/node_modules/.pnpm/embla-carousel-reactive-utils@8.6.0_embla-carousel@8.6.0/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js.map +1 -0
- package/dist/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.js +1205 -0
- package/dist/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.js.map +1 -0
- package/dist/react.js +461 -400
- package/dist/react.js.map +1 -1
- package/dist/src/components/ui/area-chart/area-chart.d.ts +34 -0
- package/dist/src/components/ui/area-chart/index.d.ts +1 -0
- package/dist/src/components/ui/avatar/avatar.d.ts +1 -1
- package/dist/src/components/ui/bar-chart/bar-chart.d.ts +30 -5
- package/dist/src/components/ui/bar-chart/index.d.ts +1 -1
- package/dist/src/components/ui/button-icon-input/button-icon-input.d.ts +21 -0
- package/dist/src/components/ui/button-icon-input/index.d.ts +1 -0
- package/dist/src/components/ui/card-filter/card-filter.d.ts +5 -0
- package/dist/src/components/ui/carousel-dialog/carousel-dialog.d.ts +28 -0
- package/dist/src/components/ui/carousel-dialog/index.d.ts +1 -0
- package/dist/src/components/ui/category-bar/category-bar.d.ts +51 -0
- package/dist/src/components/ui/category-bar/index.d.ts +1 -0
- package/dist/src/components/ui/chart/__tests__/chart-format.test.d.ts +1 -0
- package/dist/src/components/ui/chart/chart-format.d.ts +111 -0
- package/dist/src/components/ui/chart/chart.d.ts +2 -0
- package/dist/src/components/ui/chart/index.d.ts +3 -1
- package/dist/src/components/ui/chart-state/chart-state.d.ts +11 -0
- package/dist/src/components/ui/chart-state/index.d.ts +1 -0
- package/dist/src/components/ui/composed-chart/composed-chart.d.ts +33 -0
- package/dist/src/components/ui/composed-chart/index.d.ts +1 -0
- package/dist/src/components/ui/confidence-cone/confidence-cone.d.ts +62 -0
- package/dist/src/components/ui/confidence-cone/index.d.ts +1 -0
- package/dist/src/components/ui/dialog/dialog.d.ts +105 -9
- package/dist/src/components/ui/dialog/dialog.docs.d.ts +82 -5
- package/dist/src/components/ui/dialog/index.d.ts +1 -1
- package/dist/src/components/ui/dialog-footer-carousel/dialog-footer-carousel.d.ts +9 -0
- package/dist/src/components/ui/dialog-footer-carousel/index.d.ts +1 -0
- package/dist/src/components/ui/dialog-footer-default/dialog-footer-default.d.ts +11 -0
- package/dist/src/components/ui/dialog-footer-default/index.d.ts +1 -0
- package/dist/src/components/ui/dialog-welcome/dialog-welcome.d.ts +54 -0
- package/dist/src/components/ui/dialog-welcome/dialog-welcome.docs.d.ts +55 -0
- package/dist/src/components/ui/dialog-welcome/index.d.ts +1 -0
- package/dist/src/components/ui/filter-search/filter-search.d.ts +1 -1
- package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +39 -0
- package/dist/src/components/ui/funnel-chart/index.d.ts +1 -0
- package/dist/src/components/ui/histogram/histogram.d.ts +40 -0
- package/dist/src/components/ui/histogram/index.d.ts +1 -0
- package/dist/src/components/ui/input-otp/index.d.ts +1 -0
- package/dist/src/components/ui/input-otp/input-otp.d.ts +23 -0
- package/dist/src/components/ui/input-password/index.d.ts +1 -0
- package/dist/src/components/ui/input-password/input-password.d.ts +21 -0
- package/dist/src/components/ui/line-chart/index.d.ts +1 -0
- package/dist/src/components/ui/line-chart/line-chart.d.ts +68 -0
- package/dist/src/components/ui/loading/index.d.ts +1 -0
- package/dist/src/components/ui/loading/loading.d.ts +13 -0
- package/dist/src/components/ui/meter/index.d.ts +1 -0
- package/dist/src/components/ui/meter/meter.d.ts +25 -0
- package/dist/src/components/ui/metric/index.d.ts +1 -0
- package/dist/src/components/ui/metric/metric.d.ts +37 -0
- package/dist/src/components/ui/pie-chart/index.d.ts +1 -0
- package/dist/src/components/ui/pie-chart/pie-chart.d.ts +54 -0
- package/dist/src/components/ui/popover/index.d.ts +1 -1
- package/dist/src/components/ui/popover/popover.d.ts +13 -1
- package/dist/src/components/ui/radar-chart/index.d.ts +1 -0
- package/dist/src/components/ui/radar-chart/radar-chart.d.ts +40 -0
- package/dist/src/components/ui/radial-bar-chart/index.d.ts +1 -0
- package/dist/src/components/ui/radial-bar-chart/radial-bar-chart.d.ts +45 -0
- package/dist/src/components/ui/sankey-chart/index.d.ts +2 -0
- package/dist/src/components/ui/sankey-chart/sankey-chart.d.ts +69 -0
- package/dist/src/components/ui/scatter-chart/index.d.ts +1 -0
- package/dist/src/components/ui/scatter-chart/scatter-chart.d.ts +35 -0
- package/dist/src/components/ui/stack/stack.d.ts +1 -1
- package/dist/src/components/ui/timeline/index.d.ts +1 -0
- package/dist/src/components/ui/timeline/timeline.d.ts +41 -0
- package/dist/src/components/ui/treemap/index.d.ts +1 -0
- package/dist/src/components/ui/treemap/treemap.d.ts +44 -0
- package/dist/src/components/ui/trend-indicator/index.d.ts +1 -0
- package/dist/src/components/ui/trend-indicator/trend-indicator.d.ts +32 -0
- package/dist/src/index.d.ts +27 -2
- package/dist/ui-react.css +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { jsx as e, jsxs as U } from "react/jsx-runtime";
|
|
2
|
+
import * as f from "react";
|
|
3
|
+
import { ComposedChart as V, CartesianGrid as Z, XAxis as K, YAxis as W, ReferenceArea as ee, ReferenceLine as te, Area as b, Line as oe } from "recharts";
|
|
4
|
+
import { cn as ne } from "../../../lib/utils.js";
|
|
5
|
+
import { ChartContainer as re, ChartTooltip as N, ChartTooltipContent as ie, ChartLegend as ae, ChartLegendContent as le } from "../chart/chart.js";
|
|
6
|
+
import { resolveAxisDomain as ce } from "../chart/chart-format.js";
|
|
7
|
+
const m = "__cone";
|
|
8
|
+
function v(o) {
|
|
9
|
+
return o == null ? void 0 : o.filter((l) => l.dataKey !== m);
|
|
10
|
+
}
|
|
11
|
+
function se(o) {
|
|
12
|
+
return function(n) {
|
|
13
|
+
const r = {
|
|
14
|
+
...n,
|
|
15
|
+
payload: v(n.payload)
|
|
16
|
+
};
|
|
17
|
+
return typeof o == "function" ? f.createElement(
|
|
18
|
+
o,
|
|
19
|
+
r
|
|
20
|
+
) : f.cloneElement(o, r);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const fe = f.forwardRef(
|
|
24
|
+
({
|
|
25
|
+
className: o,
|
|
26
|
+
config: l,
|
|
27
|
+
data: n,
|
|
28
|
+
xKey: r,
|
|
29
|
+
actualKey: i,
|
|
30
|
+
forecastKey: p,
|
|
31
|
+
lowerKey: A,
|
|
32
|
+
upperKey: L,
|
|
33
|
+
xAxisLabel: c,
|
|
34
|
+
yAxisLabel: d,
|
|
35
|
+
yUnit: O,
|
|
36
|
+
strokeWidth: h = 2,
|
|
37
|
+
showForecastRegion: R = !0,
|
|
38
|
+
showGrid: _ = !0,
|
|
39
|
+
showTooltip: $ = !0,
|
|
40
|
+
showLegend: B = !0,
|
|
41
|
+
showXAxis: E = !0,
|
|
42
|
+
showYAxis: j = !0,
|
|
43
|
+
xTickFormatter: w,
|
|
44
|
+
yTickFormatter: z,
|
|
45
|
+
xAxisAngle: a,
|
|
46
|
+
xAxisInterval: F,
|
|
47
|
+
yAxisTickCount: M,
|
|
48
|
+
yAxisDomain: X,
|
|
49
|
+
gridDashed: Y,
|
|
50
|
+
gridHorizontal: x,
|
|
51
|
+
gridVertical: G,
|
|
52
|
+
tooltipContent: u,
|
|
53
|
+
...H
|
|
54
|
+
}, S) => {
|
|
55
|
+
var k, g;
|
|
56
|
+
const y = f.useMemo(
|
|
57
|
+
() => u ? se(u) : void 0,
|
|
58
|
+
[u]
|
|
59
|
+
), q = c ? { value: c, position: "insideBottom", offset: 0 } : void 0, I = d ? {
|
|
60
|
+
value: d,
|
|
61
|
+
angle: -90,
|
|
62
|
+
position: "insideLeft",
|
|
63
|
+
style: { textAnchor: "middle" }
|
|
64
|
+
} : void 0, J = ce(X), P = c || a != null ? 30 + (a != null ? 20 : 0) + (c ? 18 : 0) : void 0, Q = n.map((t) => {
|
|
65
|
+
const D = t[A], T = t[L];
|
|
66
|
+
return {
|
|
67
|
+
...t,
|
|
68
|
+
[m]: typeof D == "number" && typeof T == "number" ? [D, T] : void 0
|
|
69
|
+
};
|
|
70
|
+
}), s = R ? (k = n.find((t) => typeof t[p] == "number")) == null ? void 0 : k[r] : void 0, C = (g = n[n.length - 1]) == null ? void 0 : g[r];
|
|
71
|
+
return /* @__PURE__ */ e("div", { ref: S, className: ne(o), ...H, children: /* @__PURE__ */ e(
|
|
72
|
+
re,
|
|
73
|
+
{
|
|
74
|
+
config: l,
|
|
75
|
+
className: "size-full [&_.recharts-label]:fill-foreground",
|
|
76
|
+
children: /* @__PURE__ */ U(V, { data: Q, children: [
|
|
77
|
+
_ && /* @__PURE__ */ e(
|
|
78
|
+
Z,
|
|
79
|
+
{
|
|
80
|
+
horizontal: x ?? !0,
|
|
81
|
+
vertical: G ?? !1,
|
|
82
|
+
strokeDasharray: Y ? "3 3" : void 0
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ e(
|
|
86
|
+
K,
|
|
87
|
+
{
|
|
88
|
+
dataKey: r,
|
|
89
|
+
type: "category",
|
|
90
|
+
hide: !E,
|
|
91
|
+
tickLine: !1,
|
|
92
|
+
axisLine: !1,
|
|
93
|
+
tickMargin: 8,
|
|
94
|
+
tickFormatter: w,
|
|
95
|
+
angle: a,
|
|
96
|
+
interval: F,
|
|
97
|
+
textAnchor: a != null ? a < 0 ? "end" : "start" : void 0,
|
|
98
|
+
height: P,
|
|
99
|
+
label: q
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ e(
|
|
103
|
+
W,
|
|
104
|
+
{
|
|
105
|
+
type: "number",
|
|
106
|
+
hide: !j,
|
|
107
|
+
tickLine: !1,
|
|
108
|
+
axisLine: !1,
|
|
109
|
+
unit: O,
|
|
110
|
+
tickFormatter: z,
|
|
111
|
+
tickCount: M,
|
|
112
|
+
domain: J,
|
|
113
|
+
width: d ? 72 : void 0,
|
|
114
|
+
label: I
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
s != null && C != null && /* @__PURE__ */ e(
|
|
118
|
+
ee,
|
|
119
|
+
{
|
|
120
|
+
x1: s,
|
|
121
|
+
x2: C,
|
|
122
|
+
fill: "var(--ui-background-surface-secondary)",
|
|
123
|
+
fillOpacity: 0.5,
|
|
124
|
+
ifOverflow: "extendDomain"
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
s != null && /* @__PURE__ */ e(
|
|
128
|
+
te,
|
|
129
|
+
{
|
|
130
|
+
x: s,
|
|
131
|
+
stroke: "var(--ui-border-on-surface-border)",
|
|
132
|
+
strokeDasharray: "4 4"
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
$ && (y ? (
|
|
136
|
+
// Strips the synthetic band before the caller's tooltip sees it
|
|
137
|
+
// — the `__cone` series feeds the Area, not the tooltip.
|
|
138
|
+
/* @__PURE__ */ e(N, { content: y })
|
|
139
|
+
) : /* @__PURE__ */ e(
|
|
140
|
+
N,
|
|
141
|
+
{
|
|
142
|
+
content: (t) => /* @__PURE__ */ e(
|
|
143
|
+
ie,
|
|
144
|
+
{
|
|
145
|
+
active: t.active,
|
|
146
|
+
label: t.label,
|
|
147
|
+
payload: v(
|
|
148
|
+
t.payload
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
)),
|
|
154
|
+
B && /* @__PURE__ */ e(
|
|
155
|
+
ae,
|
|
156
|
+
{
|
|
157
|
+
content: (t) => /* @__PURE__ */ e(
|
|
158
|
+
le,
|
|
159
|
+
{
|
|
160
|
+
verticalAlign: t.verticalAlign,
|
|
161
|
+
payload: v(
|
|
162
|
+
t.payload
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
),
|
|
168
|
+
/* @__PURE__ */ e(
|
|
169
|
+
b,
|
|
170
|
+
{
|
|
171
|
+
dataKey: m,
|
|
172
|
+
type: "monotone",
|
|
173
|
+
stroke: "none",
|
|
174
|
+
fill: `var(--color-${i})`,
|
|
175
|
+
fillOpacity: 0.15,
|
|
176
|
+
connectNulls: !1,
|
|
177
|
+
dot: !1,
|
|
178
|
+
activeDot: !1,
|
|
179
|
+
isAnimationActive: !1,
|
|
180
|
+
legendType: "none",
|
|
181
|
+
tooltipType: "none"
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
/* @__PURE__ */ e(
|
|
185
|
+
b,
|
|
186
|
+
{
|
|
187
|
+
dataKey: i,
|
|
188
|
+
type: "monotone",
|
|
189
|
+
stroke: `var(--color-${i})`,
|
|
190
|
+
strokeWidth: h,
|
|
191
|
+
fill: `var(--color-${i})`,
|
|
192
|
+
fillOpacity: 0.15,
|
|
193
|
+
dot: !1,
|
|
194
|
+
activeDot: !1,
|
|
195
|
+
connectNulls: !0,
|
|
196
|
+
isAnimationActive: !1
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
/* @__PURE__ */ e(
|
|
200
|
+
oe,
|
|
201
|
+
{
|
|
202
|
+
dataKey: p,
|
|
203
|
+
type: "monotone",
|
|
204
|
+
stroke: `var(--color-${i})`,
|
|
205
|
+
strokeWidth: h,
|
|
206
|
+
strokeDasharray: "5 5",
|
|
207
|
+
dot: !1,
|
|
208
|
+
connectNulls: !0,
|
|
209
|
+
isAnimationActive: !1
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
] })
|
|
213
|
+
}
|
|
214
|
+
) });
|
|
215
|
+
}
|
|
216
|
+
);
|
|
217
|
+
fe.displayName = "ConfidenceCone";
|
|
218
|
+
export {
|
|
219
|
+
fe as ConfidenceCone,
|
|
220
|
+
se as createConeTooltip,
|
|
221
|
+
v as dropConeBand
|
|
222
|
+
};
|
|
223
|
+
//# sourceMappingURL=confidence-cone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confidence-cone.js","sources":["../../../../src/components/ui/confidence-cone/confidence-cone.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n Area,\n CartesianGrid,\n ComposedChart,\n Line,\n ReferenceArea,\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 ChartLegendContentProps,\n type ChartTooltipContentProps,\n type CartesianChartProps,\n} from '../chart';\n\n// A forecast confidence-cone: a solid line over the known/actual period, a\n// dashed line over the forecast period, and a shaded band (the \"cone\") between\n// a lower and upper bound that typically widens with the horizon — visualizing\n// growing uncertainty. Built on the shared Chart primitives; no new tokens\n// (series colors are caller-supplied via `config`). The whole metric renders in\n// one hue — actual and forecast differ by line style, not color — so the cone\n// band and the forecast line both reuse the actual series' color.\n\n// The band is a synthetic `[lower, upper]` range field per row that a recharts\n// <Area> shades; kept out of the tooltip/legend (see the filters below).\nconst BAND_KEY = '__cone';\n\n/**\n * Drop the synthetic cone-band range series from a recharts tooltip/legend\n * payload, keeping the real actual/forecast series (and their order). Applied to\n * both the default tooltip and any caller-supplied `tooltipContent`, so the\n * `__cone` band never surfaces regardless of which path renders.\n */\nexport function dropConeBand<T extends { dataKey?: unknown }>(\n payload: readonly T[] | undefined\n): T[] | undefined {\n return payload?.filter((item) => item.dataKey !== BAND_KEY);\n}\n\n/**\n * Wrap a caller-supplied `tooltipContent` so the synthetic cone band is stripped\n * from the payload before it renders, while preserving recharts' own mount\n * semantics — a function is mounted via `createElement` (its own component\n * identity + hook state), an element via `cloneElement`. This mirrors what the\n * pass-through charts get by handing `content` straight to recharts, so a\n * function-form tooltip keeps its state across re-renders here too. The returned\n * component is a stable content type (memoize it on `tooltipContent`).\n */\ntype TooltipContentType = NonNullable<\n React.ComponentProps<typeof ChartTooltip>['content']\n>;\ntype TooltipContentFn = Extract<TooltipContentType, (...args: never[]) => unknown>;\ntype TooltipRenderProps = Parameters<TooltipContentFn>[0];\n\nexport function createConeTooltip(tooltipContent: TooltipContentType) {\n return function ConeTooltip(props: TooltipRenderProps) {\n const merged = {\n ...props,\n payload: dropConeBand(props.payload),\n } as TooltipRenderProps;\n return typeof tooltipContent === 'function'\n ? React.createElement(\n tooltipContent as React.FunctionComponent<TooltipRenderProps>,\n merged\n )\n : React.cloneElement(tooltipContent, merged);\n };\n}\n\nexport interface ConfidenceConeProps\n extends Omit<React.ComponentProps<'div'>, 'children'>,\n CartesianChartProps {\n /**\n * Row-per-point data — the shared x dimension plus the actual / forecast /\n * bound fields. Rows are naturally sparse (a point has either an actual or a\n * forecast + bounds), so missing fields are allowed. Avoid a field named\n * `__cone` — it's reserved for the internal prediction-band series.\n */\n data: ReadonlyArray<Record<string, string | number | null | undefined>>;\n /**\n * Per-series map of `label` / `color` for the actual + forecast lines\n * (imported from the shared `Chart` primitives). Colors are caller-supplied —\n * reference an existing semantic `--ui-*` token; there is no chart palette tier\n * yet. The cone band and the forecast line both reuse the actual series'\n * color — actual and forecast differ by line style, not hue.\n */\n config: ChartConfig;\n /** Category / time axis key (the shared dimension across rows). */\n xKey: string;\n /** Field for the known/actual values — drawn as a solid line with a filled area. */\n actualKey: string;\n /** Field for the projected values — drawn as a dashed line. */\n forecastKey: string;\n /** Field for the cone's lower bound. */\n lowerKey: string;\n /** Field for the cone's upper bound. */\n upperKey: string;\n /** Stroke width of the actual + forecast lines. */\n strokeWidth?: number;\n /**\n * Set off the forecast period from the actuals with a dashed divider at the\n * hand-off point (the first row with a forecast value) and a subtle shaded\n * band over the forecast region.\n */\n showForecastRegion?: boolean;\n showLegend?: boolean;\n}\n\nconst ConfidenceCone = React.forwardRef<HTMLDivElement, ConfidenceConeProps>(\n (\n {\n className,\n config,\n data,\n xKey,\n actualKey,\n forecastKey,\n lowerKey,\n upperKey,\n xAxisLabel,\n yAxisLabel,\n yUnit,\n strokeWidth = 2,\n showForecastRegion = true,\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 // Memoized so recharts sees a stable content type across renders — a fresh\n // wrapper each render would remount the caller's tooltip and reset its state.\n const customTooltip = React.useMemo(\n () => (tooltipContent ? createConeTooltip(tooltipContent) : undefined),\n [tooltipContent]\n );\n\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 // Augment each row with the `[lower, upper]` band tuple the Area shades.\n // Rows missing a numeric bound are left un-coned (the band breaks there).\n const chartData = data.map((row) => {\n const lower = row[lowerKey];\n const upper = row[upperKey];\n return {\n ...row,\n [BAND_KEY]:\n typeof lower === 'number' && typeof upper === 'number'\n ? [lower, upper]\n : undefined,\n };\n });\n\n // The forecast begins at the first row carrying a forecast value; set that\n // region off from the actuals with a shaded band + a divider at the hand-off.\n const forecastStart = showForecastRegion\n ? data.find((row) => typeof row[forecastKey] === 'number')?.[xKey]\n : undefined;\n const lastX = data[data.length - 1]?.[xKey];\n\n return (\n <div ref={ref} className={cn(className)} {...props}>\n <ChartContainer\n config={config}\n className=\"size-full [&_.recharts-label]:fill-foreground\"\n >\n <ComposedChart data={chartData as readonly unknown[]}>\n {showGrid && (\n <CartesianGrid\n horizontal={gridHorizontal ?? true}\n vertical={gridVertical ?? false}\n strokeDasharray={gridDashed ? '3 3' : undefined}\n />\n )}\n <XAxis\n dataKey={xKey}\n type=\"category\"\n hide={!showXAxis}\n tickLine={false}\n axisLine={false}\n tickMargin={8}\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 {/* Set the forecast region off from the actuals (behind everything). */}\n {forecastStart != null && lastX != null && (\n <ReferenceArea\n x1={forecastStart}\n x2={lastX}\n fill=\"var(--ui-background-surface-secondary)\"\n fillOpacity={0.5}\n ifOverflow=\"extendDomain\"\n />\n )}\n {forecastStart != null && (\n <ReferenceLine\n x={forecastStart}\n stroke=\"var(--ui-border-on-surface-border)\"\n strokeDasharray=\"4 4\"\n />\n )}\n {showTooltip &&\n (customTooltip ? (\n // Strips the synthetic band before the caller's tooltip sees it\n // — the `__cone` series feeds the Area, not the tooltip.\n <ChartTooltip content={customTooltip} />\n ) : (\n <ChartTooltip\n content={(tp) => (\n <ChartTooltipContent\n active={tp.active}\n label={tp.label}\n // The synthetic band feeds the Area, not the tooltip.\n payload={\n dropConeBand(\n tp.payload\n ) as ChartTooltipContentProps['payload']\n }\n />\n )}\n />\n ))}\n {showLegend && (\n <ChartLegend\n content={(lp) => (\n <ChartLegendContent\n verticalAlign={lp.verticalAlign}\n payload={\n dropConeBand(\n lp.payload\n ) as ChartLegendContentProps['payload']\n }\n />\n )}\n />\n )}\n {/* The cone renders first so the lines draw on top. One color for the\n whole metric — actual and forecast differ by line style, not hue —\n so the cone + forecast line reuse the actual series' color. */}\n <Area\n dataKey={BAND_KEY}\n type=\"monotone\"\n stroke=\"none\"\n fill={`var(--color-${actualKey})`}\n fillOpacity={0.15}\n connectNulls={false}\n dot={false}\n activeDot={false}\n isAnimationActive={false}\n legendType=\"none\"\n tooltipType=\"none\"\n />\n <Area\n dataKey={actualKey}\n type=\"monotone\"\n stroke={`var(--color-${actualKey})`}\n strokeWidth={strokeWidth}\n fill={`var(--color-${actualKey})`}\n fillOpacity={0.15}\n dot={false}\n activeDot={false}\n connectNulls\n isAnimationActive={false}\n />\n <Line\n dataKey={forecastKey}\n type=\"monotone\"\n stroke={`var(--color-${actualKey})`}\n strokeWidth={strokeWidth}\n strokeDasharray=\"5 5\"\n dot={false}\n connectNulls\n isAnimationActive={false}\n />\n </ComposedChart>\n </ChartContainer>\n </div>\n );\n }\n);\nConfidenceCone.displayName = 'ConfidenceCone';\n\nexport { ConfidenceCone };\n"],"names":["BAND_KEY","dropConeBand","payload","item","createConeTooltip","tooltipContent","props","merged","React","ConfidenceCone","className","config","data","xKey","actualKey","forecastKey","lowerKey","upperKey","xAxisLabel","yAxisLabel","yUnit","strokeWidth","showForecastRegion","showGrid","showTooltip","showLegend","showXAxis","showYAxis","xTickFormatter","yTickFormatter","xAxisAngle","xAxisInterval","yAxisTickCount","yAxisDomain","gridDashed","gridHorizontal","gridVertical","ref","customTooltip","xAxisTitle","yAxisTitle","yDomain","resolveAxisDomain","xAxisHeight","chartData","row","lower","upper","forecastStart","_a","lastX","_b","jsx","cn","ChartContainer","jsxs","ComposedChart","CartesianGrid","XAxis","YAxis","ReferenceArea","ReferenceLine","ChartTooltip","tp","ChartTooltipContent","ChartLegend","lp","ChartLegendContent","Area","Line"],"mappings":";;;;;;AAsCA,MAAMA,IAAW;AAQV,SAASC,EACdC,GACiB;AACjB,SAAOA,KAAA,gBAAAA,EAAS,OAAO,CAACC,MAASA,EAAK,YAAYH;AACpD;AAiBO,SAASI,GAAkBC,GAAoC;AACpE,SAAO,SAAqBC,GAA2B;AACrD,UAAMC,IAAS;AAAA,MACb,GAAGD;AAAA,MACH,SAASL,EAAaK,EAAM,OAAO;AAAA,IAAA;AAErC,WAAO,OAAOD,KAAmB,aAC7BG,EAAM;AAAA,MACJH;AAAA,MACAE;AAAA,IAAA,IAEFC,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AAAA,cACL,WAAW;AAAA,cACX,mBAAmB;AAAA,cACnB,YAAW;AAAA,cACX,aAAY;AAAA,YAAA;AAAA,UAAA;AAAA,UAEd,gBAAAsC;AAAA,YAACgB;AAAA,YAAA;AAAA,cACC,SAAStD;AAAA,cACT,MAAK;AAAA,cACL,QAAQ,eAAeA,CAAS;AAAA,cAChC,aAAAO;AAAA,cACA,MAAM,eAAeP,CAAS;AAAA,cAC9B,aAAa;AAAA,cACb,KAAK;AAAA,cACL,WAAW;AAAA,cACX,cAAY;AAAA,cACZ,mBAAmB;AAAA,YAAA;AAAA,UAAA;AAAA,UAErB,gBAAAsC;AAAA,YAACiB;AAAA,YAAA;AAAA,cACC,SAAStD;AAAA,cACT,MAAK;AAAA,cACL,QAAQ,eAAeD,CAAS;AAAA,cAChC,aAAAO;AAAA,cACA,iBAAgB;AAAA,cAChB,KAAK;AAAA,cACL,cAAY;AAAA,cACZ,mBAAmB;AAAA,YAAA;AAAA,UAAA;AAAA,QACrB,EAAA,CACF;AAAA,MAAA;AAAA,IAAA,GAEJ;AAAA,EAEJ;AACF;AACAZ,GAAe,cAAc;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as b, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { formatDate as
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
import { formatDate as s, normalizeRange as P, rangesEqual as g, DISPLAY_FORMAT as _, parseDate as G } from "./date-range-picker-utils.js";
|
|
4
4
|
import { Popover as H, PopoverTrigger as J, PopoverContent as K } from "../popover/popover.js";
|
|
5
5
|
import { InputDatePicker as Q } from "../input-date-picker/input-date-picker.js";
|
|
6
6
|
import { Calendar as U } from "../calendar/calendar.js";
|
|
@@ -30,7 +30,7 @@ function k({
|
|
|
30
30
|
}
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
|
-
const X =
|
|
33
|
+
const X = a.forwardRef(
|
|
34
34
|
({
|
|
35
35
|
value: p,
|
|
36
36
|
defaultValue: d,
|
|
@@ -43,25 +43,25 @@ const X = s.forwardRef(
|
|
|
43
43
|
required: N,
|
|
44
44
|
className: F
|
|
45
45
|
}, O) => {
|
|
46
|
-
const T = p !== void 0, [I,
|
|
46
|
+
const T = p !== void 0, [I, w] = a.useState(
|
|
47
47
|
d ?? {}
|
|
48
|
-
), e = T ? p : I, [v, R] =
|
|
49
|
-
S(
|
|
48
|
+
), e = T ? p : I, [v, R] = a.useState(!1), [m, c] = a.useState(e), [M, S] = a.useState(s(e.from)), [j, y] = a.useState(s(e.to)), u = (t) => {
|
|
49
|
+
S(s(t.from)), y(s(t.to));
|
|
50
50
|
}, z = (t) => {
|
|
51
|
-
|
|
51
|
+
c(e), u(e), R(t);
|
|
52
52
|
}, E = () => {
|
|
53
53
|
const t = d ?? {};
|
|
54
|
-
|
|
54
|
+
c(t), u(t);
|
|
55
55
|
}, q = () => {
|
|
56
|
-
const t = P(
|
|
57
|
-
T ||
|
|
58
|
-
}, r = P(
|
|
56
|
+
const t = P(m);
|
|
57
|
+
T || w(t), i == null || i(t), R(!1);
|
|
58
|
+
}, r = P(m);
|
|
59
59
|
let D;
|
|
60
60
|
r.from ? D = { from: r.from, to: r.to } : r.to && (D = { from: r.to, to: r.to });
|
|
61
61
|
const B = (t) => {
|
|
62
62
|
const n = { from: t == null ? void 0 : t.from, to: t == null ? void 0 : t.to };
|
|
63
|
-
|
|
64
|
-
}, L = g(
|
|
63
|
+
c(n), u(n);
|
|
64
|
+
}, L = g(m, e), Y = g(m, d ?? {});
|
|
65
65
|
return /* @__PURE__ */ b(H, { open: v, onOpenChange: z, children: [
|
|
66
66
|
/* @__PURE__ */ o(
|
|
67
67
|
J,
|
|
@@ -77,15 +77,15 @@ const X = s.forwardRef(
|
|
|
77
77
|
placeholder: x,
|
|
78
78
|
disabled: A,
|
|
79
79
|
required: N,
|
|
80
|
-
startDate:
|
|
81
|
-
endDate:
|
|
80
|
+
startDate: s(e.from),
|
|
81
|
+
endDate: s(e.to),
|
|
82
82
|
open: v,
|
|
83
83
|
className: F
|
|
84
84
|
}
|
|
85
85
|
)
|
|
86
86
|
}
|
|
87
87
|
),
|
|
88
|
-
/* @__PURE__ */ b(K, { align: "start", className: "w-auto p-0", children: [
|
|
88
|
+
/* @__PURE__ */ b(K, { align: "start", className: "w-auto max-w-none p-0", children: [
|
|
89
89
|
/* @__PURE__ */ o(
|
|
90
90
|
U,
|
|
91
91
|
{
|
|
@@ -93,7 +93,7 @@ const X = s.forwardRef(
|
|
|
93
93
|
numberOfMonths: 2,
|
|
94
94
|
selected: D,
|
|
95
95
|
onSelect: B,
|
|
96
|
-
defaultMonth:
|
|
96
|
+
defaultMonth: m.from ?? e.from
|
|
97
97
|
}
|
|
98
98
|
),
|
|
99
99
|
/* @__PURE__ */ b("div", { className: "flex items-end gap-2 border-t border-border p-3", children: [
|
|
@@ -101,9 +101,9 @@ const X = s.forwardRef(
|
|
|
101
101
|
k,
|
|
102
102
|
{
|
|
103
103
|
label: "Start date",
|
|
104
|
-
text:
|
|
104
|
+
text: M,
|
|
105
105
|
onTextChange: S,
|
|
106
|
-
onParsedChange: (t) =>
|
|
106
|
+
onParsedChange: (t) => c((n) => ({ ...n, from: t }))
|
|
107
107
|
}
|
|
108
108
|
),
|
|
109
109
|
/* @__PURE__ */ o("span", { className: "pb-2 text-muted-foreground", children: "–" }),
|
|
@@ -111,9 +111,9 @@ const X = s.forwardRef(
|
|
|
111
111
|
k,
|
|
112
112
|
{
|
|
113
113
|
label: "End date",
|
|
114
|
-
text:
|
|
114
|
+
text: j,
|
|
115
115
|
onTextChange: y,
|
|
116
|
-
onParsedChange: (t) =>
|
|
116
|
+
onParsedChange: (t) => c((n) => ({ ...n, to: t }))
|
|
117
117
|
}
|
|
118
118
|
)
|
|
119
119
|
] }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-range-picker.js","sources":["../../../../src/components/ui/date-range-picker/date-range-picker.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { DateRange as RdpDateRange } from 'react-day-picker';\n\nimport { Button } from '../button';\nimport { Calendar } from '../calendar';\nimport { InputDatePicker } from '../input-date-picker';\nimport { InputText } from '../input-text';\nimport { Popover, PopoverContent, PopoverTrigger } from '../popover';\nimport {\n DISPLAY_FORMAT,\n formatDate,\n normalizeRange,\n parseDate,\n rangesEqual,\n type DateRange,\n} from './date-range-picker-utils';\n\nexport type { DateRange };\n\n// One of the two editable start/end fields. Kept internal (only ever used twice,\n// here) — it wires an `InputText` to the draft: typing echoes verbatim into the\n// field via `onTextChange` (so a partial mid-type value isn't reformatted), and a\n// successfully parsed date is forwarded via `onParsedChange`.\nfunction DateField({\n label,\n text,\n onTextChange,\n onParsedChange,\n}: {\n label: string;\n text: string;\n onTextChange: (text: string) => void;\n onParsedChange: (date: Date | undefined) => void;\n}) {\n return (\n <InputText\n aria-label={label}\n value={text}\n placeholder={DISPLAY_FORMAT}\n onChange={(event) => {\n const next = event.target.value;\n onTextChange(next);\n\n if (next.trim() === '') {\n onParsedChange(undefined);\n return;\n }\n\n const parsed = parseDate(next);\n if (parsed) {\n onParsedChange(parsed);\n }\n }}\n />\n );\n}\n\n// A range date picker: the `InputDatePicker` trigger (pickerType=\"dateRange\")\n// opens a Popover holding a dual-month range `Calendar`, two editable start/end\n// date fields bound to the in-progress draft, and a Reset / Apply footer. Mirrors\n// the draft/commit/revert idiom of `FilterSearchFilters`: the applied range is\n// snapshotted into a draft on open; editing (calendar or text fields) mutates only\n// the draft; dismissing the popover (outside press / Escape) reverts the draft, and\n// only Apply commits it via `onValueChange` and closes.\n//\n// No dedicated token tier — the trigger brings `--ui-input-date-picker-*`, the\n// Calendar / Popover / Buttons bring their own semantic tokens. Reconcile with\n// `/figma-component DateRangePicker <url> --update` once a mockup lands.\n\nexport interface DateRangePickerProps {\n /** The applied range (controlled). Omit for uncontrolled use with `defaultValue`. */\n value?: DateRange;\n /** The initial applied range (uncontrolled) and the target of \"Reset to default\". */\n defaultValue?: DateRange;\n /** Called with the committed range when Apply is pressed. */\n onValueChange?: (range: DateRange) => void;\n /** Field label for the trigger. */\n label?: React.ReactNode;\n /** Helper text below the trigger. */\n description?: React.ReactNode;\n /** Error message below the trigger (switches the trigger to its error treatment). */\n error?: React.ReactNode;\n /** Hint shown in the trigger when no range is selected. */\n placeholder?: React.ReactNode;\n /** Disables the trigger and prevents opening the popover. */\n disabled?: boolean;\n /** Marks the trigger required. */\n required?: boolean;\n /** Extra classes merged onto the trigger. */\n className?: string;\n}\n\nconst DateRangePicker = React.forwardRef<\n HTMLButtonElement,\n DateRangePickerProps\n>(\n (\n {\n value,\n defaultValue,\n onValueChange,\n label,\n description,\n error,\n placeholder,\n disabled,\n required,\n className,\n },\n ref\n ) => {\n const isControlled = value !== undefined;\n const [internalApplied, setInternalApplied] = React.useState<DateRange>(\n defaultValue ?? {}\n );\n const applied = isControlled ? (value as DateRange) : internalApplied;\n\n const [open, setOpen] = React.useState(false);\n const [draft, setDraft] = React.useState<DateRange>(applied);\n\n const [fromText, setFromText] = React.useState(formatDate(applied.from));\n const [toText, setToText] = React.useState(formatDate(applied.to));\n\n // Sync the editable fields from a range whenever the draft changes for a\n // reason OTHER than the user typing (open / calendar click / reset). We do\n // NOT resync on every draft change: a `[draft]` effect would rewrite the\n // field mid-type (e.g. a partial year \"2\" parses, then gets echoed back\n // zero-padded as \"0002\"), scrambling further keystrokes.\n const syncFieldsFrom = (range: DateRange) => {\n setFromText(formatDate(range.from));\n setToText(formatDate(range.to));\n };\n\n const handleOpenChange = (nextOpen: boolean) => {\n // Snapshot the applied range on open; revert the draft on any dismiss\n // (outside press / Escape) so an un-applied edit never leaks out.\n setDraft(applied);\n syncFieldsFrom(applied);\n setOpen(nextOpen);\n };\n\n const handleReset = () => {\n const next = defaultValue ?? {};\n setDraft(next);\n syncFieldsFrom(next);\n };\n\n const handleApply = () => {\n // Commit chronologically ordered so a typed end-before-start range is\n // normalized rather than committed inverted.\n const committed = normalizeRange(draft);\n if (!isControlled) setInternalApplied(committed);\n onValueChange?.(committed);\n setOpen(false);\n };\n\n // Feed the calendar a normalized range so a typed inverted range still\n // highlights the correct band (the editable fields keep the raw typed text).\n // react-day-picker's `DateRange` requires `from`, so a to-only draft (end\n // typed before start) is fed as a single selected day at `to` — otherwise\n // `selected` would be `undefined` and the next calendar click would start a\n // fresh range instead of completing this one, discarding the typed end date.\n const normalizedDraft = normalizeRange(draft);\n let selectedRange: RdpDateRange | undefined;\n if (normalizedDraft.from) {\n selectedRange = { from: normalizedDraft.from, to: normalizedDraft.to };\n } else if (normalizedDraft.to) {\n selectedRange = { from: normalizedDraft.to, to: normalizedDraft.to };\n }\n\n const handleSelect = (range: RdpDateRange | undefined) => {\n const next = { from: range?.from, to: range?.to };\n setDraft(next);\n syncFieldsFrom(next);\n };\n\n const applyDisabled = rangesEqual(draft, applied);\n const resetDisabled = rangesEqual(draft, defaultValue ?? {});\n\n return (\n <Popover open={open} onOpenChange={handleOpenChange}>\n <PopoverTrigger\n render={\n <InputDatePicker\n ref={ref}\n pickerType=\"dateRange\"\n label={label}\n description={description}\n error={error}\n placeholder={placeholder}\n disabled={disabled}\n required={required}\n startDate={formatDate(applied.from)}\n endDate={formatDate(applied.to)}\n open={open}\n className={className}\n />\n }\n />\n <PopoverContent align=\"start\" className=\"w-auto p-0\">\n <Calendar\n mode=\"range\"\n numberOfMonths={2}\n selected={selectedRange}\n onSelect={handleSelect}\n defaultMonth={draft.from ?? applied.from}\n />\n <div className=\"flex items-end gap-2 border-t border-border p-3\">\n <DateField\n label=\"Start date\"\n text={fromText}\n onTextChange={setFromText}\n onParsedChange={(parsed) =>\n setDraft((previous) => ({ ...previous, from: parsed }))\n }\n />\n <span className=\"pb-2 text-muted-foreground\">–</span>\n <DateField\n label=\"End date\"\n text={toText}\n onTextChange={setToText}\n onParsedChange={(parsed) =>\n setDraft((previous) => ({ ...previous, to: parsed }))\n }\n />\n </div>\n <div className=\"flex items-center gap-2 border-t border-border p-3\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n disabled={resetDisabled}\n onClick={handleReset}\n >\n Reset to default\n </Button>\n <Button\n type=\"button\"\n variant=\"default\"\n className=\"ms-auto\"\n disabled={applyDisabled}\n onClick={handleApply}\n >\n Apply\n </Button>\n </div>\n </PopoverContent>\n </Popover>\n );\n }\n);\nDateRangePicker.displayName = 'DateRangePicker';\n\nexport { DateRangePicker };\n"],"names":["DateField","label","text","onTextChange","onParsedChange","jsx","InputText","DISPLAY_FORMAT","event","next","parsed","parseDate","DateRangePicker","React","value","defaultValue","onValueChange","description","error","placeholder","disabled","required","className","ref","isControlled","internalApplied","setInternalApplied","applied","open","setOpen","draft","setDraft","fromText","setFromText","formatDate","toText","setToText","syncFieldsFrom","range","handleOpenChange","nextOpen","handleReset","handleApply","committed","normalizeRange","normalizedDraft","selectedRange","handleSelect","applyDisabled","rangesEqual","resetDisabled","jsxs","Popover","PopoverTrigger","InputDatePicker","PopoverContent","Calendar","previous","Button"],"mappings":";;;;;;;;AAuBA,SAASA,EAAU;AAAA,EACjB,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AACF,GAKG;AACD,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,cAAYL;AAAA,MACZ,OAAOC;AAAA,MACP,aAAaK;AAAA,MACb,UAAU,CAACC,MAAU;AACnB,cAAMC,IAAOD,EAAM,OAAO;AAG1B,YAFAL,EAAaM,CAAI,GAEbA,EAAK,KAAA,MAAW,IAAI;AACtB,UAAAL,EAAe,MAAS;AACxB;AAAA,QACF;AAEA,cAAMM,IAASC,EAAUF,CAAI;AAC7B,QAAIC,KACFN,EAAeM,CAAM;AAAA,MAEzB;AAAA,IAAA;AAAA,EAAA;AAGN;AAqCA,MAAME,IAAkBC,EAAM;AAAA,EAI5B,CACE;AAAA,IACE,OAAAC;AAAA,IACA,cAAAC;AAAA,IACA,eAAAC;AAAA,IACA,OAAAf;AAAA,IACA,aAAAgB;AAAA,IACA,OAAAC;AA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A,YAAA;AAAA,UAAA;AAAA,UAG1D,gBAAAL,EAAC,QAAA,EAAK,WAAU,8BAA6B,UAAA,KAAC;AAAA,UAC9C,gBAAAA;AAAA,YAACL;AAAA,YAAA;AAAA,cACC,OAAM;AAAA,cACN,MAAMmC;AAAA,cACN,cAAcC;AAAA,cACd,gBAAgB,CAAC1B,MACfqB,EAAS,CAAC0B,OAAc,EAAE,GAAGA,GAAU,IAAI/C,IAAS;AAAA,YAAA;AAAA,UAAA;AAAA,QAExD,GACF;AAAA,QACA,gBAAAyC,EAAC,OAAA,EAAI,WAAU,sDACb,UAAA;AAAA,UAAA,gBAAA9C;AAAA,YAACqD;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,UAAUR;AAAA,cACV,SAAST;AAAA,cACV,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAGD,gBAAApC;AAAA,YAACqD;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,WAAU;AAAA,cACV,UAAUV;AAAA,cACV,SAASN;AAAA,cACV,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAED,EAAA,CACF;AAAA,MAAA,EAAA,CACF;AAAA,IAAA,GACF;AAAA,EAEJ;AACF;AACA9B,EAAgB,cAAc;"}
|
|
1
|
+
{"version":3,"file":"date-range-picker.js","sources":["../../../../src/components/ui/date-range-picker/date-range-picker.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { DateRange as RdpDateRange } from 'react-day-picker';\n\nimport { Button } from '../button';\nimport { Calendar } from '../calendar';\nimport { InputDatePicker } from '../input-date-picker';\nimport { InputText } from '../input-text';\nimport { Popover, PopoverContent, PopoverTrigger } from '../popover';\nimport {\n DISPLAY_FORMAT,\n formatDate,\n normalizeRange,\n parseDate,\n rangesEqual,\n type DateRange,\n} from './date-range-picker-utils';\n\nexport type { DateRange };\n\n// One of the two editable start/end fields. Kept internal (only ever used twice,\n// here) — it wires an `InputText` to the draft: typing echoes verbatim into the\n// field via `onTextChange` (so a partial mid-type value isn't reformatted), and a\n// successfully parsed date is forwarded via `onParsedChange`.\nfunction DateField({\n label,\n text,\n onTextChange,\n onParsedChange,\n}: {\n label: string;\n text: string;\n onTextChange: (text: string) => void;\n onParsedChange: (date: Date | undefined) => void;\n}) {\n return (\n <InputText\n aria-label={label}\n value={text}\n placeholder={DISPLAY_FORMAT}\n onChange={(event) => {\n const next = event.target.value;\n onTextChange(next);\n\n if (next.trim() === '') {\n onParsedChange(undefined);\n return;\n }\n\n const parsed = parseDate(next);\n if (parsed) {\n onParsedChange(parsed);\n }\n }}\n />\n );\n}\n\n// A range date picker: the `InputDatePicker` trigger (pickerType=\"dateRange\")\n// opens a Popover holding a dual-month range `Calendar`, two editable start/end\n// date fields bound to the in-progress draft, and a Reset / Apply footer. Mirrors\n// the draft/commit/revert idiom of `FilterSearchFilters`: the applied range is\n// snapshotted into a draft on open; editing (calendar or text fields) mutates only\n// the draft; dismissing the popover (outside press / Escape) reverts the draft, and\n// only Apply commits it via `onValueChange` and closes.\n//\n// No dedicated token tier — the trigger brings `--ui-input-date-picker-*`, the\n// Calendar / Popover / Buttons bring their own semantic tokens. Reconcile with\n// `/figma-component DateRangePicker <url> --update` once a mockup lands.\n\nexport interface DateRangePickerProps {\n /** The applied range (controlled). Omit for uncontrolled use with `defaultValue`. */\n value?: DateRange;\n /** The initial applied range (uncontrolled) and the target of \"Reset to default\". */\n defaultValue?: DateRange;\n /** Called with the committed range when Apply is pressed. */\n onValueChange?: (range: DateRange) => void;\n /** Field label for the trigger. */\n label?: React.ReactNode;\n /** Helper text below the trigger. */\n description?: React.ReactNode;\n /** Error message below the trigger (switches the trigger to its error treatment). */\n error?: React.ReactNode;\n /** Hint shown in the trigger when no range is selected. */\n placeholder?: React.ReactNode;\n /** Disables the trigger and prevents opening the popover. */\n disabled?: boolean;\n /** Marks the trigger required. */\n required?: boolean;\n /** Extra classes merged onto the trigger. */\n className?: string;\n}\n\nconst DateRangePicker = React.forwardRef<\n HTMLButtonElement,\n DateRangePickerProps\n>(\n (\n {\n value,\n defaultValue,\n onValueChange,\n label,\n description,\n error,\n placeholder,\n disabled,\n required,\n className,\n },\n ref\n ) => {\n const isControlled = value !== undefined;\n const [internalApplied, setInternalApplied] = React.useState<DateRange>(\n defaultValue ?? {}\n );\n const applied = isControlled ? (value as DateRange) : internalApplied;\n\n const [open, setOpen] = React.useState(false);\n const [draft, setDraft] = React.useState<DateRange>(applied);\n\n const [fromText, setFromText] = React.useState(formatDate(applied.from));\n const [toText, setToText] = React.useState(formatDate(applied.to));\n\n // Sync the editable fields from a range whenever the draft changes for a\n // reason OTHER than the user typing (open / calendar click / reset). We do\n // NOT resync on every draft change: a `[draft]` effect would rewrite the\n // field mid-type (e.g. a partial year \"2\" parses, then gets echoed back\n // zero-padded as \"0002\"), scrambling further keystrokes.\n const syncFieldsFrom = (range: DateRange) => {\n setFromText(formatDate(range.from));\n setToText(formatDate(range.to));\n };\n\n const handleOpenChange = (nextOpen: boolean) => {\n // Snapshot the applied range on open; revert the draft on any dismiss\n // (outside press / Escape) so an un-applied edit never leaks out.\n setDraft(applied);\n syncFieldsFrom(applied);\n setOpen(nextOpen);\n };\n\n const handleReset = () => {\n const next = defaultValue ?? {};\n setDraft(next);\n syncFieldsFrom(next);\n };\n\n const handleApply = () => {\n // Commit chronologically ordered so a typed end-before-start range is\n // normalized rather than committed inverted.\n const committed = normalizeRange(draft);\n if (!isControlled) setInternalApplied(committed);\n onValueChange?.(committed);\n setOpen(false);\n };\n\n // Feed the calendar a normalized range so a typed inverted range still\n // highlights the correct band (the editable fields keep the raw typed text).\n // react-day-picker's `DateRange` requires `from`, so a to-only draft (end\n // typed before start) is fed as a single selected day at `to` — otherwise\n // `selected` would be `undefined` and the next calendar click would start a\n // fresh range instead of completing this one, discarding the typed end date.\n const normalizedDraft = normalizeRange(draft);\n let selectedRange: RdpDateRange | undefined;\n if (normalizedDraft.from) {\n selectedRange = { from: normalizedDraft.from, to: normalizedDraft.to };\n } else if (normalizedDraft.to) {\n selectedRange = { from: normalizedDraft.to, to: normalizedDraft.to };\n }\n\n const handleSelect = (range: RdpDateRange | undefined) => {\n const next = { from: range?.from, to: range?.to };\n setDraft(next);\n syncFieldsFrom(next);\n };\n\n const applyDisabled = rangesEqual(draft, applied);\n const resetDisabled = rangesEqual(draft, defaultValue ?? {});\n\n return (\n <Popover open={open} onOpenChange={handleOpenChange}>\n <PopoverTrigger\n render={\n <InputDatePicker\n ref={ref}\n pickerType=\"dateRange\"\n label={label}\n description={description}\n error={error}\n placeholder={placeholder}\n disabled={disabled}\n required={required}\n startDate={formatDate(applied.from)}\n endDate={formatDate(applied.to)}\n open={open}\n className={className}\n />\n }\n />\n <PopoverContent align=\"start\" className=\"w-auto max-w-none p-0\">\n <Calendar\n mode=\"range\"\n numberOfMonths={2}\n selected={selectedRange}\n onSelect={handleSelect}\n defaultMonth={draft.from ?? applied.from}\n />\n <div className=\"flex items-end gap-2 border-t border-border p-3\">\n <DateField\n label=\"Start date\"\n text={fromText}\n onTextChange={setFromText}\n onParsedChange={(parsed) =>\n setDraft((previous) => ({ ...previous, from: parsed }))\n }\n />\n <span className=\"pb-2 text-muted-foreground\">–</span>\n <DateField\n label=\"End date\"\n text={toText}\n onTextChange={setToText}\n onParsedChange={(parsed) =>\n setDraft((previous) => ({ ...previous, to: parsed }))\n }\n />\n </div>\n <div className=\"flex items-center gap-2 border-t border-border p-3\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n disabled={resetDisabled}\n onClick={handleReset}\n >\n Reset to default\n </Button>\n <Button\n type=\"button\"\n variant=\"default\"\n className=\"ms-auto\"\n disabled={applyDisabled}\n onClick={handleApply}\n >\n Apply\n </Button>\n </div>\n </PopoverContent>\n </Popover>\n );\n }\n);\nDateRangePicker.displayName = 'DateRangePicker';\n\nexport { DateRangePicker };\n"],"names":["DateField","label","text","onTextChange","onParsedChange","jsx","InputText","DISPLAY_FORMAT","event","next","parsed","parseDate","DateRangePicker","React","value","defaultValue","onValueChange","description","error","placeholder","disabled","required","className","ref","isControlled","internalApplied","setInternalApplied","applied","open","setOpen","draft","setDraft","fromText","setFromText","formatDate","toText","setToText","syncFieldsFrom","range","handleOpenChange","nextOpen","handleReset","handleApply","committed","normalizeRange","normalizedDraft","selectedRange","handleSelect","applyDisabled","rangesEqual","resetDisabled","jsxs","Popover","PopoverTrigger","InputDatePicker","PopoverContent","Calendar","previous","Button"],"mappings":";;;;;;;;AAuBA,SAASA,EAAU;AAAA,EACjB,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AACF,GAKG;AACD,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,cAAYL;AAAA,MACZ,OAAOC;AAAA,MACP,aAAaK;AAAA,MACb,UAAU,CAACC,MAAU;AACnB,cAAMC,IAAOD,EAAM,OAAO;AAG1B,YAFAL,EAAaM,CAAI,GAEbA,EAAK,KAAA,MAAW,IAAI;AACtB,UAAAL,EAAe,MAAS;AACxB;AAAA,QACF;AAEA,cAAMM,IAASC,EAAUF,CAAI;AAC7B,QAAIC,KACFN,EAAeM,CAAM;AAAA,MAEzB;AAAA,IAAA;AAAA,EAAA;AAGN;AAqCA,MAAME,IAAkBC,EAAM;AAAA,EAI5B,CACE;AAAA,IACE,OAAAC;AAAA,IACA,cAAAC;AAAA,IACA,eAAAC;AAAA,IACA,OAAAf;AAAA,IACA,aAAAgB;AAAA,IACA,OAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,EAAA,GAEFC,MACG;AACH,UAAMC,IAAeV,MAAU,QACzB,CAACW,GAAiBC,CAAkB,IAAIb,EAAM;AAAA,MAClDE,KAAgB,CAAA;AAAA,IAAC,GAEbY,IAAUH,IAAgBV,IAAsBW,GAEhD,CAACG,GAAMC,CAAO,IAAIhB,EAAM,SAAS,EAAK,GACtC,CAACiB,GAAOC,CAAQ,IAAI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