@acronis-platform/ui-react 0.57.1 → 0.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/components/ui/area-chart/area-chart.js +149 -0
  2. package/dist/components/ui/area-chart/area-chart.js.map +1 -0
  3. package/dist/components/ui/bar-chart/bar-chart.js +152 -77
  4. package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
  5. package/dist/components/ui/button-icon-input/button-icon-input.js +36 -0
  6. package/dist/components/ui/button-icon-input/button-icon-input.js.map +1 -0
  7. package/dist/components/ui/button-menu/button-menu.js +1 -1
  8. package/dist/components/ui/button-menu/button-menu.js.map +1 -1
  9. package/dist/components/ui/card-filter/card-filter.js +40 -27
  10. package/dist/components/ui/card-filter/card-filter.js.map +1 -1
  11. package/dist/components/ui/chart-state/chart-state.js +42 -0
  12. package/dist/components/ui/chart-state/chart-state.js.map +1 -0
  13. package/dist/components/ui/chip/chip.js +13 -13
  14. package/dist/components/ui/chip/chip.js.map +1 -1
  15. package/dist/components/ui/composed-chart/composed-chart.js +107 -0
  16. package/dist/components/ui/composed-chart/composed-chart.js.map +1 -0
  17. package/dist/components/ui/confidence-cone/confidence-cone.js +195 -0
  18. package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -0
  19. package/dist/components/ui/date-range-picker/date-range-picker.js +21 -21
  20. package/dist/components/ui/date-range-picker/date-range-picker.js.map +1 -1
  21. package/dist/components/ui/dialog/dialog.js +250 -78
  22. package/dist/components/ui/dialog/dialog.js.map +1 -1
  23. package/dist/components/ui/dialog-footer-default/dialog-footer-default.js +26 -0
  24. package/dist/components/ui/dialog-footer-default/dialog-footer-default.js.map +1 -0
  25. package/dist/components/ui/dropdown-menu/dropdown-menu.js +21 -21
  26. package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
  27. package/dist/components/ui/filter-search/filter-search.js +91 -90
  28. package/dist/components/ui/filter-search/filter-search.js.map +1 -1
  29. package/dist/components/ui/funnel-chart/funnel-chart.js +87 -0
  30. package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -0
  31. package/dist/components/ui/histogram/histogram.js +108 -0
  32. package/dist/components/ui/histogram/histogram.js.map +1 -0
  33. package/dist/components/ui/input-otp/input-otp.js +104 -0
  34. package/dist/components/ui/input-otp/input-otp.js.map +1 -0
  35. package/dist/components/ui/input-password/input-password.js +120 -0
  36. package/dist/components/ui/input-password/input-password.js.map +1 -0
  37. package/dist/components/ui/input-text/input-text.js +9 -9
  38. package/dist/components/ui/input-text/input-text.js.map +1 -1
  39. package/dist/components/ui/line-chart/line-chart.js +206 -0
  40. package/dist/components/ui/line-chart/line-chart.js.map +1 -0
  41. package/dist/components/ui/link/link.js +5 -5
  42. package/dist/components/ui/link/link.js.map +1 -1
  43. package/dist/components/ui/loading/loading.js +79 -0
  44. package/dist/components/ui/loading/loading.js.map +1 -0
  45. package/dist/components/ui/meter/meter.js +93 -0
  46. package/dist/components/ui/meter/meter.js.map +1 -0
  47. package/dist/components/ui/metric/metric.js +185 -0
  48. package/dist/components/ui/metric/metric.js.map +1 -0
  49. package/dist/components/ui/pie-chart/pie-chart.js +113 -0
  50. package/dist/components/ui/pie-chart/pie-chart.js.map +1 -0
  51. package/dist/components/ui/popover/popover.js +57 -27
  52. package/dist/components/ui/popover/popover.js.map +1 -1
  53. package/dist/components/ui/radar-chart/radar-chart.js +74 -0
  54. package/dist/components/ui/radar-chart/radar-chart.js.map +1 -0
  55. package/dist/components/ui/radial-bar-chart/radial-bar-chart.js +69 -0
  56. package/dist/components/ui/radial-bar-chart/radial-bar-chart.js.map +1 -0
  57. package/dist/components/ui/scatter-chart/scatter-chart.js +102 -0
  58. package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -0
  59. package/dist/components/ui/search/search.js +16 -16
  60. package/dist/components/ui/search/search.js.map +1 -1
  61. package/dist/components/ui/sheet/sheet-details.js +16 -16
  62. package/dist/components/ui/sheet/sheet-details.js.map +1 -1
  63. package/dist/components/ui/spinner/spinner.js.map +1 -1
  64. package/dist/components/ui/timeline/timeline.js +175 -0
  65. package/dist/components/ui/timeline/timeline.js.map +1 -0
  66. package/dist/components/ui/treemap/treemap.js +83 -0
  67. package/dist/components/ui/treemap/treemap.js.map +1 -0
  68. package/dist/components/ui/trend-indicator/trend-indicator.js +97 -0
  69. package/dist/components/ui/trend-indicator/trend-indicator.js.map +1 -0
  70. package/dist/index.js +423 -384
  71. package/dist/index.js.map +1 -1
  72. package/dist/react.js +423 -384
  73. package/dist/react.js.map +1 -1
  74. package/dist/src/components/ui/area-chart/area-chart.d.ts +49 -0
  75. package/dist/src/components/ui/area-chart/index.d.ts +1 -0
  76. package/dist/src/components/ui/avatar/avatar.d.ts +1 -1
  77. package/dist/src/components/ui/bar-chart/bar-chart.d.ts +42 -2
  78. package/dist/src/components/ui/bar-chart/index.d.ts +1 -1
  79. package/dist/src/components/ui/button-icon-input/button-icon-input.d.ts +21 -0
  80. package/dist/src/components/ui/button-icon-input/index.d.ts +1 -0
  81. package/dist/src/components/ui/card-filter/card-filter.d.ts +5 -0
  82. package/dist/src/components/ui/chart-state/chart-state.d.ts +11 -0
  83. package/dist/src/components/ui/chart-state/index.d.ts +1 -0
  84. package/dist/src/components/ui/composed-chart/composed-chart.d.ts +48 -0
  85. package/dist/src/components/ui/composed-chart/index.d.ts +1 -0
  86. package/dist/src/components/ui/confidence-cone/confidence-cone.d.ts +79 -0
  87. package/dist/src/components/ui/confidence-cone/index.d.ts +1 -0
  88. package/dist/src/components/ui/dialog/dialog.d.ts +105 -9
  89. package/dist/src/components/ui/dialog/dialog.docs.d.ts +82 -5
  90. package/dist/src/components/ui/dialog/index.d.ts +1 -1
  91. package/dist/src/components/ui/dialog-footer-default/dialog-footer-default.d.ts +11 -0
  92. package/dist/src/components/ui/dialog-footer-default/index.d.ts +1 -0
  93. package/dist/src/components/ui/filter-search/filter-search.d.ts +1 -1
  94. package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +39 -0
  95. package/dist/src/components/ui/funnel-chart/index.d.ts +1 -0
  96. package/dist/src/components/ui/histogram/histogram.d.ts +55 -0
  97. package/dist/src/components/ui/histogram/index.d.ts +1 -0
  98. package/dist/src/components/ui/input-otp/index.d.ts +1 -0
  99. package/dist/src/components/ui/input-otp/input-otp.d.ts +23 -0
  100. package/dist/src/components/ui/input-password/index.d.ts +1 -0
  101. package/dist/src/components/ui/input-password/input-password.d.ts +21 -0
  102. package/dist/src/components/ui/line-chart/index.d.ts +1 -0
  103. package/dist/src/components/ui/line-chart/line-chart.d.ts +83 -0
  104. package/dist/src/components/ui/loading/index.d.ts +1 -0
  105. package/dist/src/components/ui/loading/loading.d.ts +13 -0
  106. package/dist/src/components/ui/meter/index.d.ts +1 -0
  107. package/dist/src/components/ui/meter/meter.d.ts +25 -0
  108. package/dist/src/components/ui/metric/index.d.ts +1 -0
  109. package/dist/src/components/ui/metric/metric.d.ts +37 -0
  110. package/dist/src/components/ui/pie-chart/index.d.ts +1 -0
  111. package/dist/src/components/ui/pie-chart/pie-chart.d.ts +54 -0
  112. package/dist/src/components/ui/popover/index.d.ts +1 -1
  113. package/dist/src/components/ui/popover/popover.d.ts +13 -1
  114. package/dist/src/components/ui/radar-chart/index.d.ts +1 -0
  115. package/dist/src/components/ui/radar-chart/radar-chart.d.ts +40 -0
  116. package/dist/src/components/ui/radial-bar-chart/index.d.ts +1 -0
  117. package/dist/src/components/ui/radial-bar-chart/radial-bar-chart.d.ts +45 -0
  118. package/dist/src/components/ui/scatter-chart/index.d.ts +1 -0
  119. package/dist/src/components/ui/scatter-chart/scatter-chart.d.ts +50 -0
  120. package/dist/src/components/ui/stack/stack.d.ts +1 -1
  121. package/dist/src/components/ui/timeline/index.d.ts +1 -0
  122. package/dist/src/components/ui/timeline/timeline.d.ts +41 -0
  123. package/dist/src/components/ui/treemap/index.d.ts +1 -0
  124. package/dist/src/components/ui/treemap/treemap.d.ts +44 -0
  125. package/dist/src/components/ui/trend-indicator/index.d.ts +1 -0
  126. package/dist/src/components/ui/trend-indicator/trend-indicator.d.ts +32 -0
  127. package/dist/src/index.d.ts +22 -2
  128. package/dist/ui-react.css +1 -1
  129. package/package.json +3 -3
@@ -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 type ChartConfig,\n type ChartLegendContentProps,\n type ChartTooltipContentProps,\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 /**\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 /** Title rendered beneath the horizontal (X) axis. */\n xAxisLabel?: string;\n /** Title rendered beside the vertical (Y) axis (rotated). */\n yAxisLabel?: string;\n /** Unit suffix appended to Y-axis tick values (recharts `unit`; the X axis is categorical). */\n yUnit?: 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 showGrid?: boolean;\n showTooltip?: boolean;\n showLegend?: boolean;\n /**\n * Replace the default tooltip. Pass a configured `ChartTooltipContent`\n * (imported from this library) — e.g. with a `formatter` / `labelFormatter` —\n * to customize the tooltip without composing recharts yourself. The synthetic\n * cone band is filtered out of the payload before your tooltip sees it, so a\n * `__cone` item never reaches your formatter. Ignored when `showTooltip` is\n * false.\n */\n tooltipContent?: React.ComponentProps<typeof ChartTooltip>['content'];\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 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 // 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 && <CartesianGrid vertical={false} />}\n <XAxis\n dataKey={xKey}\n type=\"category\"\n tickLine={false}\n axisLine={false}\n tickMargin={8}\n height={xAxisLabel ? 48 : undefined}\n label={xAxisTitle}\n />\n <YAxis\n type=\"number\"\n tickLine={false}\n axisLine={false}\n unit={yUnit}\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","ref","customTooltip","xAxisTitle","yAxisTitle","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":";;;;;AAoCA,MAAMA,IAAW;AAQV,SAASC,EACdC,GACiB;AACjB,SAAOA,KAAA,gBAAAA,EAAS,OAAO,CAACC,MAASA,EAAK,YAAYH;AACpD;AAiBO,SAASI,EAAkBC,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,EAAM,aAAaH,GAAgBE,CAAM;AAA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EAAe,cAAc;"}
@@ -1,6 +1,6 @@
1
1
  import { jsxs as b, jsx as o } from "react/jsx-runtime";
2
- import * as s from "react";
3
- import { formatDate as a, normalizeRange as P, rangesEqual as g, DISPLAY_FORMAT as _, parseDate as G } from "./date-range-picker-utils.js";
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 = s.forwardRef(
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, M] = s.useState(
46
+ const T = p !== void 0, [I, w] = a.useState(
47
47
  d ?? {}
48
- ), e = T ? p : I, [v, R] = s.useState(!1), [c, m] = s.useState(e), [j, S] = s.useState(a(e.from)), [w, y] = s.useState(a(e.to)), u = (t) => {
49
- S(a(t.from)), y(a(t.to));
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
- m(e), u(e), R(t);
51
+ c(e), u(e), R(t);
52
52
  }, E = () => {
53
53
  const t = d ?? {};
54
- m(t), u(t);
54
+ c(t), u(t);
55
55
  }, q = () => {
56
- const t = P(c);
57
- T || M(t), i == null || i(t), R(!1);
58
- }, r = P(c);
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
- m(n), u(n);
64
- }, L = g(c, e), Y = g(c, d ?? {});
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: a(e.from),
81
- endDate: a(e.to),
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: c.from ?? e.from
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: j,
104
+ text: M,
105
105
  onTextChange: S,
106
- onParsedChange: (t) => m((n) => ({ ...n, from: 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: w,
114
+ text: j,
115
115
  onTextChange: y,
116
- onParsedChange: (t) => m((n) => ({ ...n, to: 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;AAG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L;AAAA,YAAA;AAAA,cACC,OAAM;AAAA,cACN,MAAMgC;AAAA,cACN,cAAcC;AAAA,cACd,gBAAgB,CAACvB,MACfqB,EAAS,CAAC0B,OAAc,EAAE,GAAGA,GAAU,MAAM/C,IAAS;AAAA,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;AA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AAMmC;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,141 +1,313 @@
1
- import { jsx as t, jsxs as s, Fragment as D } from "react/jsx-runtime";
2
- import * as i from "react";
3
- import { Dialog as r } from "@base-ui/react/dialog";
4
- import { TimesIcon as b } from "@acronis-platform/icons-react/stroke-mono";
5
- import { cva as w } from "../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
1
+ import { jsx as o, jsxs as c, Fragment as D } from "react/jsx-runtime";
2
+ import * as n from "react";
3
+ import { Dialog as i } from "@base-ui/react/dialog";
4
+ import { TimesIcon as $ } from "@acronis-platform/icons-react/stroke-mono";
5
+ import { cva as E } from "../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
6
6
  import { cn as l } from "../../../lib/utils.js";
7
- import { usePortalContainer as y } from "../../../lib/portal-container.js";
8
- const v = w(
9
- "fixed left-1/2 top-1/2 z-50 flex w-full -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-lg bg-muted text-foreground shadow-lg duration-200 data-[open]:animate-in data-[open]:fade-in-0 data-[open]:zoom-in-95 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95",
7
+ import { usePortalContainer as H } from "../../../lib/portal-container.js";
8
+ import { DialogFooterDefault as _ } from "../dialog-footer-default/dialog-footer-default.js";
9
+ import { Loading as U } from "../loading/loading.js";
10
+ import { InputText as Y } from "../input-text/input-text.js";
11
+ import { Button as y } from "../button/button.js";
12
+ const q = E(
13
+ "fixed left-1/2 top-1/2 z-50 flex w-full min-w-[var(--ui-dialog-container-width-min)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-[var(--ui-dialog-container-border-radius)] bg-[var(--ui-dialog-container-color)] text-foreground shadow-lg duration-200 data-[open]:animate-in data-[open]:fade-in-0 data-[open]:zoom-in-95 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95",
10
14
  {
11
15
  variants: {
12
16
  size: {
13
- xs: "max-w-[464px]",
14
- sm: "max-w-lg",
15
- md: "max-w-2xl",
16
- lg: "max-w-[832px]",
17
- xl: "max-w-[992px]",
18
- "2xl": "max-w-[1136px]"
17
+ sm: "max-w-[var(--ui-dialog-container-size-sm)]",
18
+ large: "max-w-[832px]"
19
19
  }
20
20
  },
21
21
  defaultVariants: {
22
22
  size: "sm"
23
23
  }
24
24
  }
25
- ), V = r.Root, I = r.Trigger, $ = r.Portal, q = r.Close, d = i.forwardRef(({ className: o, ...a }, e) => /* @__PURE__ */ t(
26
- r.Backdrop,
25
+ ), J = i.Root;
26
+ i.Trigger;
27
+ i.Portal;
28
+ const x = i.Close, C = n.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ o(
29
+ i.Backdrop,
27
30
  {
28
- ref: e,
31
+ ref: r,
29
32
  className: l(
30
33
  "fixed inset-0 z-50 bg-[var(--ui-background-backdrop-screen)] duration-200 data-[open]:animate-in data-[open]:fade-in-0 data-[closed]:animate-out data-[closed]:fade-out-0",
31
- o
34
+ e
32
35
  ),
33
36
  ...a
34
37
  }
35
38
  ));
36
- d.displayName = "DialogOverlay";
37
- const N = i.forwardRef(
39
+ C.displayName = "DialogOverlay";
40
+ const w = n.forwardRef(
38
41
  ({
39
- className: o,
42
+ className: e,
40
43
  children: a,
41
- size: e,
42
- portal: c = !0,
43
- portalContainer: m,
44
- keepMounted: f,
45
- ...g
46
- }, p) => {
47
- const u = y(), x = m ?? u, n = /* @__PURE__ */ s(D, { children: [
48
- /* @__PURE__ */ t(d, {}),
49
- /* @__PURE__ */ t(
50
- r.Popup,
44
+ size: r,
45
+ portal: d = !0,
46
+ portalContainer: s,
47
+ keepMounted: g,
48
+ ...p
49
+ }, u) => {
50
+ const b = H(), f = s ?? b, m = /* @__PURE__ */ c(D, { children: [
51
+ /* @__PURE__ */ o(C, {}),
52
+ /* @__PURE__ */ o(
53
+ i.Popup,
51
54
  {
52
- ref: p,
53
- className: l(v({ size: e }), o),
54
- ...g,
55
+ ref: u,
56
+ className: l(q({ size: r }), e),
57
+ ...p,
55
58
  children: a
56
59
  }
57
60
  )
58
61
  ] });
59
- return c ? /* @__PURE__ */ t(r.Portal, { container: x, keepMounted: f, children: n }) : n;
62
+ return d ? /* @__PURE__ */ o(i.Portal, { container: f, keepMounted: g, children: m }) : m;
60
63
  }
61
64
  );
62
- N.displayName = "DialogContent";
63
- const C = i.forwardRef(({ className: o, ...a }, e) => /* @__PURE__ */ t(
65
+ w.displayName = "DialogContent";
66
+ const K = n.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ o(
64
67
  "div",
65
68
  {
66
- ref: e,
69
+ ref: r,
67
70
  className: l(
68
71
  "flex h-16 items-center gap-4 border-b border-border bg-background px-5 py-4",
69
- o
72
+ e
70
73
  ),
71
74
  ...a
72
75
  }
73
76
  ));
74
- C.displayName = "DialogHeader";
75
- const R = i.forwardRef(({ className: o, ...a }, e) => /* @__PURE__ */ t(
77
+ K.displayName = "DialogHeaderRoot";
78
+ const M = n.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ o(
76
79
  "div",
77
80
  {
78
- ref: e,
81
+ ref: r,
79
82
  className: l(
80
83
  "flex h-16 items-center justify-end gap-4 border-t border-border bg-background px-6 py-4",
81
- o
84
+ e
82
85
  ),
83
86
  ...a
84
87
  }
85
88
  ));
86
- R.displayName = "DialogFooter";
87
- const h = i.forwardRef(({ className: o, ...a }, e) => /* @__PURE__ */ t("div", { ref: e, className: l("flex-1 overflow-auto p-6", o), ...a }));
88
- h.displayName = "DialogBody";
89
- const z = i.forwardRef(({ className: o, ...a }, e) => /* @__PURE__ */ t(
90
- r.Title,
89
+ M.displayName = "DialogFooterRoot";
90
+ const Q = n.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ o("div", { ref: r, className: l("flex-1 overflow-auto p-6", e), ...a }));
91
+ Q.displayName = "DialogBodyRoot";
92
+ const v = n.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ o(
93
+ i.Title,
91
94
  {
92
- ref: e,
95
+ ref: r,
93
96
  className: l(
94
97
  "flex-1 text-2xl font-normal leading-8 text-foreground",
95
- o
98
+ e
96
99
  ),
97
100
  ...a
98
101
  }
99
102
  ));
100
- z.displayName = "DialogTitle";
101
- const T = i.forwardRef(({ className: o, ...a }, e) => /* @__PURE__ */ t(
102
- r.Description,
103
+ v.displayName = "DialogTitle";
104
+ const W = n.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ o(
105
+ i.Description,
103
106
  {
104
- ref: e,
105
- className: l("text-sm text-muted-foreground", o),
107
+ ref: r,
108
+ className: l("text-sm text-muted-foreground", e),
106
109
  ...a
107
110
  }
108
111
  ));
109
- T.displayName = "DialogDescription";
110
- const k = i.forwardRef(({ className: o, ...a }, e) => /* @__PURE__ */ s(
111
- r.Close,
112
+ W.displayName = "DialogDescription";
113
+ const N = n.forwardRef(({ className: e, closeLabel: a = "Close", ...r }, d) => /* @__PURE__ */ c(
114
+ i.Close,
112
115
  {
113
- ref: e,
116
+ ref: d,
114
117
  className: l(
115
- "rounded p-1 text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ui-focus-primary)] disabled:pointer-events-none",
116
- o
118
+ "cursor-pointer rounded p-1 text-[var(--ui-button-icon-global-icon-color-idle)] transition-colors hover:bg-[var(--ui-button-icon-global-container-color-hover)] hover:text-[var(--ui-button-icon-global-icon-color-hover)] active:bg-[var(--ui-button-icon-global-container-color-active)] active:text-[var(--ui-button-icon-global-icon-color-active)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ui-focus-primary)] disabled:pointer-events-none disabled:cursor-default disabled:text-[var(--ui-button-icon-global-icon-color-disabled)]",
119
+ e
117
120
  ),
118
- ...a,
121
+ ...r,
119
122
  children: [
120
- /* @__PURE__ */ t(b, { size: 24 }),
121
- /* @__PURE__ */ t("span", { className: "sr-only", children: "Close" })
123
+ /* @__PURE__ */ o($, { size: 24 }),
124
+ /* @__PURE__ */ o("span", { className: "sr-only", children: a })
122
125
  ]
123
126
  }
124
127
  ));
125
- k.displayName = "DialogCloseButton";
128
+ N.displayName = "DialogCloseButton";
129
+ function X({ title: e, closeLabel: a }) {
130
+ return /* @__PURE__ */ c("div", { className: "flex h-[var(--ui-dialog-header-height)] items-center gap-[var(--ui-dialog-header-gap)] border-b-[length:var(--ui-dialog-header-border-width)] border-[var(--ui-dialog-header-border-color)] bg-[var(--ui-dialog-header-color)] px-[var(--ui-dialog-header-padding-x)]", children: [
131
+ /* @__PURE__ */ o(v, { children: e }),
132
+ /* @__PURE__ */ o(N, { closeLabel: a })
133
+ ] });
134
+ }
135
+ function Z({ children: e, inert: a }) {
136
+ return /* @__PURE__ */ o(
137
+ "div",
138
+ {
139
+ inert: a,
140
+ className: "flex min-h-[var(--ui-dialog-body-height-min)] flex-col justify-center gap-[var(--ui-dialog-body-gap)] px-4 py-[var(--ui-dialog-body-padding-y)]",
141
+ children: typeof e == "string" ? /* @__PURE__ */ o("p", { className: "text-sm leading-6 text-foreground", children: e }) : e
142
+ }
143
+ );
144
+ }
145
+ function ee({
146
+ secondaryLabel: e,
147
+ primaryLabel: a,
148
+ primaryVariant: r,
149
+ primaryCloses: d,
150
+ onPrimaryAction: s
151
+ }) {
152
+ return /* @__PURE__ */ c(D, { children: [
153
+ e && /* @__PURE__ */ o(x, { render: /* @__PURE__ */ o(y, { variant: "secondary", children: e }) }),
154
+ d ? /* @__PURE__ */ o(
155
+ x,
156
+ {
157
+ onClick: s,
158
+ render: /* @__PURE__ */ o(y, { variant: r, children: a })
159
+ }
160
+ ) : /* @__PURE__ */ o(y, { variant: r, onClick: s, children: a })
161
+ ] });
162
+ }
163
+ const ae = {
164
+ default: {
165
+ title: "Dialog title",
166
+ body: "Drop any content into this slot.",
167
+ secondaryLabel: "Cancel",
168
+ primaryLabel: "Label",
169
+ primaryVariant: "default"
170
+ },
171
+ rename: {
172
+ title: (e = "object name") => `Rename ${e}`,
173
+ // `objectName` prefills the field with the real current name; the field's
174
+ // accessible name (`objectNameLabel`) is separate — it's the label, not the value.
175
+ body: (e = "Current name", a = "Object name") => /* @__PURE__ */ o(Y, { "aria-label": a, defaultValue: e }),
176
+ secondaryLabel: "Cancel",
177
+ primaryLabel: "Rename",
178
+ primaryVariant: "default"
179
+ },
180
+ "save changes": {
181
+ title: "Save changes",
182
+ body: "You have unsaved changes. Do you want to save them before leaving?",
183
+ secondaryLabel: "Go back",
184
+ primaryLabel: "Save",
185
+ primaryVariant: "default"
186
+ },
187
+ "reset password": {
188
+ title: "Reset password",
189
+ body: "Further instructions will be sent to your email address.",
190
+ secondaryLabel: "Cancel",
191
+ primaryLabel: "Reset",
192
+ primaryVariant: "default"
193
+ },
194
+ "discard changes": {
195
+ title: "Discard changes",
196
+ body: (e = "Object name") => /* @__PURE__ */ c("p", { className: "text-sm leading-6 text-foreground", children: [
197
+ "Are you sure you want to discard the unsaved changes to",
198
+ " ",
199
+ /* @__PURE__ */ o("strong", { className: "font-semibold", children: e }),
200
+ "?"
201
+ ] }),
202
+ secondaryLabel: "Go back",
203
+ primaryLabel: "Confirm",
204
+ primaryVariant: "destructive"
205
+ },
206
+ accept: {
207
+ title: (e = "object name") => `Accept ${e}`,
208
+ body: "Click Accept to confirm that you have read, understood, and agree to the terms and conditions below.",
209
+ secondaryLabel: "Cancel",
210
+ primaryLabel: "Accept",
211
+ primaryVariant: "default"
212
+ },
213
+ "read-only": {
214
+ title: "License agreement",
215
+ body: "This is a read-only dialog used to view legal documents such as the License Agreement, EULA updates, Terms of Service, and other legal documents.",
216
+ primaryLabel: "Done",
217
+ primaryVariant: "default",
218
+ primaryCloses: !0
219
+ },
220
+ // No Figma preset — a legacy, free-form escape hatch (see the `footer` prop
221
+ // and the `Large` story). This fallback title/body/footer only renders if
222
+ // the caller supplies neither `footer` nor `title`/`children` — every real
223
+ // `wide` call site overrides them.
224
+ wide: {
225
+ title: "Dialog title",
226
+ body: "Drop any content into this slot.",
227
+ secondaryLabel: "Cancel",
228
+ primaryLabel: "Confirm",
229
+ primaryVariant: "default"
230
+ }
231
+ }, oe = n.forwardRef(
232
+ ({
233
+ variant: e = "default",
234
+ hasLoading: a = !1,
235
+ loadingLabel: r,
236
+ hasHeader: d = !0,
237
+ hasFooter: s = !0,
238
+ children: g,
239
+ title: p,
240
+ objectName: u,
241
+ objectNameLabel: b,
242
+ secondaryLabel: f,
243
+ primaryLabel: m,
244
+ onPrimaryAction: L,
245
+ footer: R,
246
+ closeLabel: T,
247
+ size: V,
248
+ portal: z,
249
+ portalContainer: k,
250
+ keepMounted: A,
251
+ className: B,
252
+ ...j
253
+ }, S) => {
254
+ const t = ae[e], F = typeof t.title == "function" ? t.title(u) : t.title, O = typeof t.body == "function" ? t.body(u, b) : t.body, I = g ?? O, h = p ?? F, G = f ?? t.secondaryLabel, P = m ?? t.primaryLabel;
255
+ return /* @__PURE__ */ o(J, { ...j, children: /* @__PURE__ */ c(
256
+ w,
257
+ {
258
+ ref: S,
259
+ size: V ?? (e === "wide" ? "large" : "sm"),
260
+ portal: z,
261
+ portalContainer: k,
262
+ keepMounted: A,
263
+ className: B,
264
+ "aria-busy": a || void 0,
265
+ children: [
266
+ d ? /* @__PURE__ */ o(X, { title: h, closeLabel: T }) : (
267
+ // Header hidden, but the dialog still needs an accessible name.
268
+ /* @__PURE__ */ o(v, { className: "sr-only", children: h })
269
+ ),
270
+ /* @__PURE__ */ o(Z, { inert: a, children: I }),
271
+ s && /* @__PURE__ */ o(_, { inert: a, children: R ?? /* @__PURE__ */ o(
272
+ ee,
273
+ {
274
+ secondaryLabel: G,
275
+ primaryLabel: P,
276
+ primaryVariant: t.primaryVariant,
277
+ primaryCloses: t.primaryCloses,
278
+ onPrimaryAction: L
279
+ }
280
+ ) }),
281
+ a && /* @__PURE__ */ o(
282
+ U,
283
+ {
284
+ variant: "onSurfaceSecondary",
285
+ hasLabel: !1,
286
+ label: r,
287
+ className: l(
288
+ "absolute inset-x-0 bottom-0 rounded-none",
289
+ d ? "top-[var(--ui-dialog-header-height)]" : "top-0"
290
+ )
291
+ }
292
+ )
293
+ ]
294
+ }
295
+ ) });
296
+ }
297
+ );
298
+ oe.displayName = "Dialog";
126
299
  export {
127
- V as Dialog,
128
- h as DialogBody,
129
- q as DialogClose,
130
- k as DialogCloseButton,
131
- N as DialogContent,
132
- T as DialogDescription,
133
- R as DialogFooter,
134
- C as DialogHeader,
135
- d as DialogOverlay,
136
- $ as DialogPortal,
137
- z as DialogTitle,
138
- I as DialogTrigger,
139
- v as dialogContentVariants
300
+ oe as Dialog,
301
+ Q as DialogBodyRoot,
302
+ x as DialogClose,
303
+ N as DialogCloseButton,
304
+ w as DialogContent,
305
+ W as DialogDescription,
306
+ M as DialogFooterRoot,
307
+ K as DialogHeaderRoot,
308
+ C as DialogOverlay,
309
+ J as DialogRoot,
310
+ v as DialogTitle,
311
+ q as dialogContentVariants
140
312
  };
141
313
  //# sourceMappingURL=dialog.js.map