@acronis-platform/ui-react 2.0.0 → 4.0.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 (243) hide show
  1. package/dist/components/ui/accordion-container/accordion-container.js +144 -0
  2. package/dist/components/ui/accordion-container/accordion-container.js.map +1 -0
  3. package/dist/components/ui/app-shell-chat/app-shell-chat.js.map +1 -1
  4. package/dist/components/ui/area-chart/area-chart.js +141 -139
  5. package/dist/components/ui/area-chart/area-chart.js.map +1 -1
  6. package/dist/components/ui/avatar/avatar.js +33 -22
  7. package/dist/components/ui/avatar/avatar.js.map +1 -1
  8. package/dist/components/ui/bar-chart/bar-chart.js +295 -293
  9. package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
  10. package/dist/components/ui/card/card.js +150 -74
  11. package/dist/components/ui/card/card.js.map +1 -1
  12. package/dist/components/ui/card-section/card-section.js +111 -0
  13. package/dist/components/ui/card-section/card-section.js.map +1 -0
  14. package/dist/components/ui/category-bar/category-bar.js +109 -93
  15. package/dist/components/ui/category-bar/category-bar.js.map +1 -1
  16. package/dist/components/ui/chart/chart-palette.js +113 -0
  17. package/dist/components/ui/chart/chart-palette.js.map +1 -0
  18. package/dist/components/ui/chart/chart.js +176 -129
  19. package/dist/components/ui/chart/chart.js.map +1 -1
  20. package/dist/components/ui/chart-state/chart-state-illustrations.js +310 -0
  21. package/dist/components/ui/chart-state/chart-state-illustrations.js.map +1 -0
  22. package/dist/components/ui/chart-state/chart-state.js +48 -34
  23. package/dist/components/ui/chart-state/chart-state.js.map +1 -1
  24. package/dist/components/ui/chart-widget/chart-widget.js +87 -0
  25. package/dist/components/ui/chart-widget/chart-widget.js.map +1 -0
  26. package/dist/components/ui/composed-chart/composed-chart.js +117 -115
  27. package/dist/components/ui/composed-chart/composed-chart.js.map +1 -1
  28. package/dist/components/ui/confidence-cone/confidence-cone.js +166 -158
  29. package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -1
  30. package/dist/components/ui/data-table/data-table.js +4 -2
  31. package/dist/components/ui/data-table/data-table.js.map +1 -1
  32. package/dist/components/ui/empty-overlay/empty-overlay.js +49 -0
  33. package/dist/components/ui/empty-overlay/empty-overlay.js.map +1 -0
  34. package/dist/components/ui/funnel-chart/funnel-chart.js +162 -161
  35. package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -1
  36. package/dist/components/ui/histogram/histogram.js +94 -92
  37. package/dist/components/ui/histogram/histogram.js.map +1 -1
  38. package/dist/components/ui/input/input.js.map +1 -1
  39. package/dist/components/ui/label/label.js +2 -9
  40. package/dist/components/ui/label/label.js.map +1 -1
  41. package/dist/components/ui/line-chart/line-chart.js +143 -141
  42. package/dist/components/ui/line-chart/line-chart.js.map +1 -1
  43. package/dist/components/ui/metric/metric.js +74 -185
  44. package/dist/components/ui/metric/metric.js.map +1 -1
  45. package/dist/components/ui/page-content/page-content.js.map +1 -1
  46. package/dist/components/ui/pie-chart/pie-chart.js +201 -195
  47. package/dist/components/ui/pie-chart/pie-chart.js.map +1 -1
  48. package/dist/components/ui/radar-chart/radar-chart.js +133 -131
  49. package/dist/components/ui/radar-chart/radar-chart.js.map +1 -1
  50. package/dist/components/ui/radial-bar-chart/radial-bar-chart.js +297 -265
  51. package/dist/components/ui/radial-bar-chart/radial-bar-chart.js.map +1 -1
  52. package/dist/components/ui/sankey-chart/sankey-chart.js +123 -101
  53. package/dist/components/ui/sankey-chart/sankey-chart.js.map +1 -1
  54. package/dist/components/ui/scatter-chart/scatter-chart.js +76 -74
  55. package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -1
  56. package/dist/components/ui/section/section.js +157 -31
  57. package/dist/components/ui/section/section.js.map +1 -1
  58. package/dist/components/ui/stepper/stepper.js +24 -24
  59. package/dist/components/ui/stepper/stepper.js.map +1 -1
  60. package/dist/components/ui/stepper-item/stepper-item.js +43 -24
  61. package/dist/components/ui/stepper-item/stepper-item.js.map +1 -1
  62. package/dist/components/ui/table/table.js +27 -27
  63. package/dist/components/ui/table/table.js.map +1 -1
  64. package/dist/components/ui/treemap/treemap.js +133 -124
  65. package/dist/components/ui/treemap/treemap.js.map +1 -1
  66. package/dist/components/ui/trend-indicator/trend-indicator.js +34 -69
  67. package/dist/components/ui/trend-indicator/trend-indicator.js.map +1 -1
  68. package/dist/components/ui/wizard/wizard.js +59 -0
  69. package/dist/components/ui/wizard/wizard.js.map +1 -0
  70. package/dist/hooks/use-wizard.js +75 -0
  71. package/dist/hooks/use-wizard.js.map +1 -0
  72. package/dist/index.js +540 -525
  73. package/dist/index.js.map +1 -1
  74. package/dist/llms/accordion-container.md +181 -0
  75. package/dist/llms/accordion.md +124 -0
  76. package/dist/llms/alert.md +225 -0
  77. package/dist/llms/app-shell-chat.md +415 -0
  78. package/dist/llms/area-chart.md +355 -0
  79. package/dist/llms/avatar.md +208 -0
  80. package/dist/llms/bar-chart.md +406 -0
  81. package/dist/llms/breadcrumb.md +326 -0
  82. package/dist/llms/button-group.md +298 -0
  83. package/dist/llms/button-icon-input.md +142 -0
  84. package/dist/llms/button-icon-menu.md +209 -0
  85. package/dist/llms/button-icon.md +128 -0
  86. package/dist/llms/button-menu.md +172 -0
  87. package/dist/llms/button.md +185 -0
  88. package/dist/llms/calendar-panel.md +733 -0
  89. package/dist/llms/calendar.md +188 -0
  90. package/dist/llms/card-filter.md +214 -0
  91. package/dist/llms/card-section.md +293 -0
  92. package/dist/llms/card.md +447 -0
  93. package/dist/llms/carousel-dialog.md +156 -0
  94. package/dist/llms/category-bar.md +193 -0
  95. package/dist/llms/chart-state.md +190 -0
  96. package/dist/llms/chart-widget.md +209 -0
  97. package/dist/llms/chart.md +182 -0
  98. package/dist/llms/checkbox.md +257 -0
  99. package/dist/llms/chip.md +195 -0
  100. package/dist/llms/combobox.md +164 -0
  101. package/dist/llms/composed-chart.md +508 -0
  102. package/dist/llms/confidence-cone.md +277 -0
  103. package/dist/llms/data-table.md +474 -0
  104. package/dist/llms/date-range-picker.md +272 -0
  105. package/dist/llms/description-list.md +131 -0
  106. package/dist/llms/dialog-footer-carousel.md +147 -0
  107. package/dist/llms/dialog-footer-default.md +142 -0
  108. package/dist/llms/dialog-root.md +246 -0
  109. package/dist/llms/dialog-welcome.md +223 -0
  110. package/dist/llms/dialog.md +403 -0
  111. package/dist/llms/dropdown-menu.md +193 -0
  112. package/dist/llms/empty-overlay.md +146 -0
  113. package/dist/llms/empty.md +156 -0
  114. package/dist/llms/field.md +185 -0
  115. package/dist/llms/filter-cards.md +157 -0
  116. package/dist/llms/filter-chips.md +323 -0
  117. package/dist/llms/filter-search.md +512 -0
  118. package/dist/llms/form.md +154 -0
  119. package/dist/llms/funnel-chart.md +333 -0
  120. package/dist/llms/grid.md +80 -0
  121. package/dist/llms/histogram.md +190 -0
  122. package/dist/llms/input-date-picker.md +203 -0
  123. package/dist/llms/input-otp.md +173 -0
  124. package/dist/llms/input-password.md +197 -0
  125. package/dist/llms/input-search.md +170 -0
  126. package/dist/llms/input-select.md +278 -0
  127. package/dist/llms/input-text-area.md +271 -0
  128. package/dist/llms/input-text.md +192 -0
  129. package/dist/llms/line-chart.md +369 -0
  130. package/dist/llms/link.md +209 -0
  131. package/dist/llms/loading.md +130 -0
  132. package/dist/llms/meter.md +177 -0
  133. package/dist/llms/metric.md +204 -0
  134. package/dist/llms/number-field.md +122 -0
  135. package/dist/llms/page-content.md +69 -0
  136. package/dist/llms/page-header.md +182 -0
  137. package/dist/llms/pagination.md +133 -0
  138. package/dist/llms/pie-chart.md +307 -0
  139. package/dist/llms/popover.md +252 -0
  140. package/dist/llms/progress-circle.md +126 -0
  141. package/dist/llms/progress.md +111 -0
  142. package/dist/llms/radar-chart.md +316 -0
  143. package/dist/llms/radial-bar-chart.md +319 -0
  144. package/dist/llms/radio.md +255 -0
  145. package/dist/llms/resizable.md +195 -0
  146. package/dist/llms/sankey-chart.md +208 -0
  147. package/dist/llms/scatter-chart.md +239 -0
  148. package/dist/llms/scroll-area.md +183 -0
  149. package/dist/llms/section.md +401 -0
  150. package/dist/llms/select.md +210 -0
  151. package/dist/llms/separator.md +87 -0
  152. package/dist/llms/sheet.md +202 -0
  153. package/dist/llms/sidebar-primary.md +360 -0
  154. package/dist/llms/sidebar-secondary.md +417 -0
  155. package/dist/llms/skeleton.md +81 -0
  156. package/dist/llms/slider.md +97 -0
  157. package/dist/llms/spinner.md +100 -0
  158. package/dist/llms/stack.md +80 -0
  159. package/dist/llms/stepper-item.md +309 -0
  160. package/dist/llms/stepper.md +251 -0
  161. package/dist/llms/switch.md +140 -0
  162. package/dist/llms/table.md +436 -0
  163. package/dist/llms/tabs.md +197 -0
  164. package/dist/llms/tag.md +139 -0
  165. package/dist/llms/timeline.md +361 -0
  166. package/dist/llms/timer.md +259 -0
  167. package/dist/llms/toast.md +241 -0
  168. package/dist/llms/toggle-group.md +121 -0
  169. package/dist/llms/toolbar.md +453 -0
  170. package/dist/llms/tooltip.md +164 -0
  171. package/dist/llms/treemap.md +254 -0
  172. package/dist/llms/trend-indicator.md +132 -0
  173. package/dist/llms/widget-placeholder.md +169 -0
  174. package/dist/llms/wizard.md +412 -0
  175. package/dist/llms.txt +142 -0
  176. package/dist/react.js +540 -525
  177. package/dist/react.js.map +1 -1
  178. package/dist/src/components/ui/accordion-container/accordion-container.d.ts +44 -0
  179. package/dist/src/components/ui/accordion-container/index.d.ts +1 -0
  180. package/dist/src/components/ui/area-chart/area-chart.d.ts +9 -4
  181. package/dist/src/components/ui/avatar/avatar.d.ts +27 -8
  182. package/dist/src/components/ui/bar-chart/bar-chart.d.ts +9 -4
  183. package/dist/src/components/ui/button/button.d.ts +1 -1
  184. package/dist/src/components/ui/card/card.d.ts +69 -8
  185. package/dist/src/components/ui/card/index.d.ts +1 -1
  186. package/dist/src/components/ui/card-section/card-section.d.ts +50 -0
  187. package/dist/src/components/ui/card-section/index.d.ts +1 -0
  188. package/dist/src/components/ui/category-bar/category-bar.d.ts +10 -4
  189. package/dist/src/components/ui/chart/__stories__/palette-control.d.ts +48 -0
  190. package/dist/src/components/ui/chart/__tests__/chart-palette.test.d.ts +1 -0
  191. package/dist/src/components/ui/chart/chart-palette.d.ts +128 -0
  192. package/dist/src/components/ui/chart/chart.d.ts +66 -15
  193. package/dist/src/components/ui/chart/index.d.ts +4 -2
  194. package/dist/src/components/ui/chart-state/chart-state-illustrations.d.ts +6 -0
  195. package/dist/src/components/ui/chart-state/chart-state.d.ts +13 -2
  196. package/dist/src/components/ui/chart-state/index.d.ts +1 -0
  197. package/dist/src/components/ui/chart-widget/chart-widget.d.ts +64 -0
  198. package/dist/src/components/ui/chart-widget/index.d.ts +1 -0
  199. package/dist/src/components/ui/composed-chart/composed-chart.d.ts +12 -7
  200. package/dist/src/components/ui/confidence-cone/confidence-cone.d.ts +10 -5
  201. package/dist/src/components/ui/dialog/dialog.d.ts +1 -1
  202. package/dist/src/components/ui/empty-overlay/empty-overlay.d.ts +20 -0
  203. package/dist/src/components/ui/empty-overlay/index.d.ts +2 -0
  204. package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +11 -5
  205. package/dist/src/components/ui/grid/grid.d.ts +1 -1
  206. package/dist/src/components/ui/histogram/histogram.d.ts +10 -4
  207. package/dist/src/components/ui/label/index.d.ts +1 -1
  208. package/dist/src/components/ui/label/label.d.ts +1 -5
  209. package/dist/src/components/ui/line-chart/line-chart.d.ts +9 -4
  210. package/dist/src/components/ui/metric/metric.d.ts +13 -14
  211. package/dist/src/components/ui/pie-chart/pie-chart.d.ts +17 -8
  212. package/dist/src/components/ui/radar-chart/radar-chart.d.ts +10 -5
  213. package/dist/src/components/ui/radial-bar-chart/radial-bar-chart.d.ts +17 -6
  214. package/dist/src/components/ui/sankey-chart/sankey-chart.d.ts +10 -5
  215. package/dist/src/components/ui/scatter-chart/scatter-chart.d.ts +10 -5
  216. package/dist/src/components/ui/section/index.d.ts +1 -1
  217. package/dist/src/components/ui/section/section.d.ts +75 -6
  218. package/dist/src/components/ui/sheet/sheet.d.ts +1 -1
  219. package/dist/src/components/ui/stack/stack.d.ts +1 -1
  220. package/dist/src/components/ui/stepper-item/stepper-item.d.ts +6 -5
  221. package/dist/src/components/ui/tag/tag.d.ts +1 -1
  222. package/dist/src/components/ui/treemap/treemap.d.ts +11 -5
  223. package/dist/src/components/ui/trend-indicator/trend-indicator.d.ts +3 -7
  224. package/dist/src/components/ui/wizard/index.d.ts +1 -0
  225. package/dist/src/components/ui/wizard/wizard.d.ts +6 -0
  226. package/dist/src/hooks/index.d.ts +1 -0
  227. package/dist/src/hooks/use-wizard.d.ts +80 -0
  228. package/dist/src/index.d.ts +5 -3
  229. package/dist/ui-react.css +1 -1
  230. package/package.json +12 -6
  231. package/dist/components/ui/app-shell/app-shell.js +0 -75
  232. package/dist/components/ui/app-shell/app-shell.js.map +0 -1
  233. package/dist/components/ui/auth-layout/auth-layout.js +0 -56
  234. package/dist/components/ui/auth-layout/auth-layout.js.map +0 -1
  235. package/dist/components/ui/collapsible/collapsible.js +0 -22
  236. package/dist/components/ui/collapsible/collapsible.js.map +0 -1
  237. package/dist/src/components/ui/app-shell/app-shell.d.ts +0 -8
  238. package/dist/src/components/ui/app-shell/index.d.ts +0 -1
  239. package/dist/src/components/ui/auth-layout/auth-layout.d.ts +0 -6
  240. package/dist/src/components/ui/auth-layout/index.d.ts +0 -1
  241. package/dist/src/components/ui/collapsible/collapsible.d.ts +0 -5
  242. package/dist/src/components/ui/collapsible/index.d.ts +0 -1
  243. package/dist/src/components/ui/label/label.docs.d.ts +0 -10
@@ -1 +1 @@
1
- {"version":3,"file":"trend-indicator.js","sources":["../../../../src/components/ui/trend-indicator/trend-indicator.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n ArrowRightIcon,\n ArrowTrendDownIcon,\n ArrowTrendUpIcon,\n} from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip';\n\n// A small, presentational trend/delta indicator: a direction glyph + a\n// pre-formatted change value + an optional comparison label. It deliberately\n// separates `direction` (what happened mathematically) from `sentiment`\n// (whether that change is good or bad), because the kit can't assume up = good —\n// revenue ↑ is positive, threats ↑ is negative, MTTR ↓ is positive. The consumer\n// computes both and passes an already-formatted `value`; this component never\n// diffs two numbers, rounds, or interprets domain rules. Sentiment drives the\n// color through the semantic status text tokens (the glyph inherits via\n// `currentColor`), and the `badge` variant adds a matching status tint — no new\n// tokens.\nconst trendIndicatorVariants = cva(\n 'inline-flex items-center align-middle font-medium [&_svg]:shrink-0',\n {\n variants: {\n sentiment: {\n positive: 'text-[var(--ui-text-on-status-success)]',\n negative: 'text-[var(--ui-text-on-status-danger)]',\n neutral: 'text-[var(--ui-text-on-status-neutral)]',\n },\n size: {\n small: 'gap-0.5 text-xs [&_svg]:size-3.5',\n medium: 'gap-1 text-sm [&_svg]:size-4',\n },\n variant: {\n inline: '',\n badge: 'rounded-sm px-1.5 py-0.5',\n },\n },\n // The badge tint pairs with the same status family as the text color.\n compoundVariants: [\n {\n variant: 'badge',\n sentiment: 'positive',\n className: 'bg-[var(--ui-background-status-success)]',\n },\n {\n variant: 'badge',\n sentiment: 'negative',\n className: 'bg-[var(--ui-background-status-danger)]',\n },\n {\n variant: 'badge',\n sentiment: 'neutral',\n className: 'bg-[var(--ui-background-status-neutral)]',\n },\n ],\n defaultVariants: {\n sentiment: 'neutral',\n size: 'medium',\n variant: 'inline',\n },\n }\n);\n\n// `flat` uses a horizontal arrow (the \"no meaningful change\" glyph); up/down use\n// the trend arrows. All three carry a horizontal direction, so they mirror under\n// `dir=\"rtl\"` (`rtl:-scale-x-100`) to stay aligned with the mirrored text flow.\nconst DIRECTION_ICON = {\n up: ArrowTrendUpIcon,\n down: ArrowTrendDownIcon,\n flat: ArrowRightIcon,\n} as const;\n\nexport interface TrendIndicatorProps\n extends Omit<React.ComponentProps<'span'>, 'children'>,\n VariantProps<typeof trendIndicatorVariants> {\n /** What changed mathematically — selects the direction glyph. */\n direction: 'up' | 'down' | 'flat';\n /**\n * Already-formatted change to display — e.g. `\"12%\"`, `\"3.5 h\"`,\n * `\"Improving\"`, `\"4.2 h → 2.8 h\"`. The kit does not format or compute it.\n */\n value?: React.ReactNode;\n /** Secondary comparison caption — e.g. `\"vs previous quarter\"`, `\"YoY\"`. */\n comparisonLabel?: React.ReactNode;\n /** Contextual hint shown on hover/focus (Base UI Tooltip). */\n tooltip?: React.ReactNode;\n /** Show the leading direction glyph. Defaults to `true` — color alone isn't enough. */\n showIcon?: boolean;\n /**\n * Accessible sentence describing the trend (e.g. \"Revenue increased 12%\n * compared with the previous quarter\"). Applied as the element's label via\n * `role=\"img\"`, since the kit can't build a correct, localized sentence from\n * `direction` + `value` alone. Without it, assistive tech reads the visible\n * `value` / `comparisonLabel` text (the glyph is decorative).\n */\n ariaLabel?: string;\n}\n\nconst TrendIndicator = React.forwardRef<HTMLSpanElement, TrendIndicatorProps>(\n (\n {\n className,\n direction,\n sentiment,\n size,\n variant,\n value,\n comparisonLabel,\n tooltip,\n showIcon = true,\n ariaLabel,\n ...props\n },\n ref\n ) => {\n const Icon = DIRECTION_ICON[direction];\n const hasTooltip = tooltip != null;\n\n const root = (\n <span\n data-direction={direction}\n data-sentiment={sentiment ?? 'neutral'}\n className={cn(\n trendIndicatorVariants({ sentiment, size, variant }),\n className\n )}\n // With an explicit sentence, the whole unit is one labelled image and\n // the inner text/glyph is decorative; otherwise the visible text carries\n // the meaning and the glyph is hidden.\n {...(ariaLabel ? { role: 'img', 'aria-label': ariaLabel } : {})}\n // When it's a tooltip trigger, make it keyboard-reachable so the hint\n // isn't hover-only.\n tabIndex={hasTooltip ? 0 : undefined}\n {...props}\n >\n {showIcon && <Icon aria-hidden className=\"rtl:-scale-x-100\" />}\n {value != null && <span className=\"tabular-nums\">{value}</span>}\n {comparisonLabel != null && (\n <span className=\"text-[var(--ui-text-on-surface-secondary)]\">\n {comparisonLabel}\n </span>\n )}\n </span>\n );\n\n if (!hasTooltip) {\n return React.cloneElement(root, { ref });\n }\n\n return (\n <Tooltip>\n {/* Base UI's Trigger ref is typed to its default <button>; the trigger\n here is the span, so the runtime ref is that span. */}\n <TooltipTrigger ref={ref as React.Ref<HTMLButtonElement>} render={root} />\n <TooltipContent>{tooltip}</TooltipContent>\n </Tooltip>\n );\n }\n);\nTrendIndicator.displayName = 'TrendIndicator';\n\nexport { TrendIndicator, trendIndicatorVariants };\n"],"names":["trendIndicatorVariants","cva","DIRECTION_ICON","ArrowTrendUpIcon","ArrowTrendDownIcon","ArrowRightIcon","TrendIndicator","React","className","direction","sentiment","size","variant","value","comparisonLabel","tooltip","showIcon","ariaLabel","props","ref","Icon","hasTooltip","root","jsxs","cn","jsx","Tooltip","TooltipTrigger","TooltipContent"],"mappings":";;;;;;AAuBA,MAAMA,IAAyBC;AAAA,EAC7B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,WAAW;AAAA,QACT,UAAU;AAAA,QACV,UAAU;AAAA,QACV,SAAS;AAAA,MAAA;AAAA,MAEX,MAAM;AAAA,QACJ,OAAO;AAAA,QACP,QAAQ;AAAA,MAAA;AAAA,MAEV,SAAS;AAAA,QACP,QAAQ;AAAA,QACR,OAAO;AAAA,MAAA;AAAA,IACT;AAAA;AAAA,IAGF,kBAAkB;AAAA,MAChB;AAAA,QACE,SAAS;AAAA,QACT,WAAW;AAAA,QACX,WAAW;AAAA,MAAA;AAAA,MAEb;AAAA,QACE,SAAS;AAAA,QACT,WAAW;AAAA,QACX,WAAW;AAAA,MAAA;AAAA,MAEb;AAAA,QACE,SAAS;AAAA,QACT,WAAW;AAAA,QACX,WAAW;AAAA,MAAA;AAAA,IACb;AAAA,IAEF,iBAAiB;AAAA,MACf,WAAW;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ,GAKMC,IAAiB;AAAA,EACrB,IAAIC;AAAA,EACJ,MAAMC;AAAA,EACN,MAAMC;AACR,GA4BMC,IAAiBC,EAAM;AAAA,EAC3B,CACE;AAAA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sx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n ArrowRightIcon,\n ArrowTrendDownIcon,\n ArrowTrendUpIcon,\n} from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip';\n\n// A small, presentational trend/delta indicator: a direction glyph + a\n// pre-formatted change value. It deliberately separates `direction` (what\n// happened mathematically) from `sentiment` (whether that change is good or\n// bad), because the kit can't assume up = good — revenue ↑ is positive,\n// threats ↑ is negative, MTTR ↓ is positive. The consumer computes both and\n// passes an already-formatted `value`; this component never diffs two numbers,\n// rounds, or interprets domain rules. Sentiment drives the color through the\n// semantic status text tokens (the glyph inherits via `currentColor`).\nconst trendIndicatorVariants = cva(\n 'inline-flex items-center gap-0.5 align-middle text-xs font-medium [&_svg]:size-3.5 [&_svg]:shrink-0',\n {\n variants: {\n sentiment: {\n positive: 'text-[var(--ui-text-on-status-success)]',\n negative: 'text-[var(--ui-text-on-status-danger)]',\n neutral: 'text-[var(--ui-text-on-status-neutral)]',\n },\n },\n defaultVariants: {\n sentiment: 'neutral',\n },\n }\n);\n\n// `flat` uses a horizontal arrow (the \"no meaningful change\" glyph); up/down use\n// the trend arrows. All three carry a horizontal direction, so they mirror under\n// `dir=\"rtl\"` (`rtl:-scale-x-100`) to stay aligned with the mirrored text flow.\nconst DIRECTION_ICON = {\n up: ArrowTrendUpIcon,\n down: ArrowTrendDownIcon,\n flat: ArrowRightIcon,\n} as const;\n\nexport interface TrendIndicatorProps\n extends Omit<React.ComponentProps<'span'>, 'children'>,\n VariantProps<typeof trendIndicatorVariants> {\n /** What changed mathematically — selects the direction glyph. */\n direction: 'up' | 'down' | 'flat';\n /**\n * Already-formatted change to display — e.g. `\"12%\"`, `\"3.5 h\"`,\n * `\"Improving\"`. The kit does not format or compute it.\n */\n value?: React.ReactNode;\n /** Contextual hint shown on hover/focus (Base UI Tooltip). */\n tooltip?: React.ReactNode;\n /** Show the leading direction glyph. Defaults to `true` — color alone isn't enough. */\n showIcon?: boolean;\n /**\n * Accessible sentence describing the trend (e.g. \"Revenue increased 12%\n * compared with the previous quarter\"). Applied as the element's label via\n * `role=\"img\"`, since the kit can't build a correct, localized sentence from\n * `direction` + `value` alone. Without it, assistive tech reads the visible\n * `value` text (the glyph is decorative).\n */\n ariaLabel?: string;\n}\n\nconst TrendIndicator = React.forwardRef<HTMLSpanElement, TrendIndicatorProps>(\n (\n {\n className,\n direction,\n sentiment,\n value,\n tooltip,\n showIcon = true,\n ariaLabel,\n ...props\n },\n ref\n ) => {\n const Icon = DIRECTION_ICON[direction];\n const hasTooltip = tooltip != null;\n\n const root = (\n <span\n data-direction={direction}\n data-sentiment={sentiment ?? 'neutral'}\n className={cn(trendIndicatorVariants({ sentiment }), className)}\n {...(ariaLabel ? { role: 'img', 'aria-label': ariaLabel } : {})}\n tabIndex={hasTooltip ? 0 : undefined}\n {...props}\n >\n {showIcon && <Icon aria-hidden className=\"rtl:-scale-x-100\" />}\n {value != null && <span className=\"tabular-nums\">{value}</span>}\n </span>\n );\n\n if (!hasTooltip) {\n return React.cloneElement(root, { ref });\n }\n\n return (\n <Tooltip>\n <TooltipTrigger ref={ref as React.Ref<HTMLButtonElement>} render={root} />\n <TooltipContent>{tooltip}</TooltipContent>\n </Tooltip>\n );\n }\n);\nTrendIndicator.displayName = 'TrendIndicator';\n\nexport { TrendIndicator, trendIndicatorVariants };\n"],"names":["trendIndicatorVariants","cva","DIRECTION_ICON","ArrowTrendUpIcon","ArrowTrendDownIcon","ArrowRightIcon","TrendIndicator","React","className","direction","sentiment","value","tooltip","showIcon","ariaLabel","props","ref","Icon","hasTooltip","root","jsxs","cn","jsx","Tooltip","TooltipTrigger","TooltipContent"],"mappings":";;;;;;AAqBA,MAAMA,IAAyBC;AAAA,EAC7B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,WAAW;AAAA,QACT,UAAU;AAAA,QACV,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
@@ -0,0 +1,59 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import * as o from "react";
3
+ import { cn as i } from "../../../lib/utils.js";
4
+ const l = o.forwardRef(({ className: a, ...r }, d) => /* @__PURE__ */ e(
5
+ "div",
6
+ {
7
+ ref: d,
8
+ "data-slot": "wizard",
9
+ className: i("flex h-full w-full flex-col", a),
10
+ ...r
11
+ }
12
+ ));
13
+ l.displayName = "Wizard";
14
+ const t = o.forwardRef(({ className: a, ...r }, d) => /* @__PURE__ */ e(
15
+ "div",
16
+ {
17
+ ref: d,
18
+ "data-slot": "wizard-header",
19
+ className: i(
20
+ "sticky top-0 z-10 flex w-full flex-col gap-[var(--ui-gap-12)] border-b border-[var(--ui-border-on-surface-divider)] bg-[var(--ui-background-surface-secondary)] p-[var(--ui-gap-16)]",
21
+ a
22
+ ),
23
+ ...r
24
+ }
25
+ ));
26
+ t.displayName = "WizardHeader";
27
+ const s = o.forwardRef(({ className: a, ...r }, d) => /* @__PURE__ */ e(
28
+ "p",
29
+ {
30
+ ref: d,
31
+ "data-slot": "wizard-subtitle",
32
+ className: i(
33
+ "text-sm font-normal leading-6 text-muted-foreground",
34
+ a
35
+ ),
36
+ ...r
37
+ }
38
+ ));
39
+ s.displayName = "WizardSubtitle";
40
+ const f = o.forwardRef(({ className: a, ...r }, d) => /* @__PURE__ */ e(
41
+ "div",
42
+ {
43
+ ref: d,
44
+ "data-slot": "wizard-body",
45
+ className: i(
46
+ "mx-auto flex w-full max-w-[1024px] flex-col pb-[var(--ui-gap-16)]",
47
+ a
48
+ ),
49
+ ...r
50
+ }
51
+ ));
52
+ f.displayName = "WizardBody";
53
+ export {
54
+ l as Wizard,
55
+ f as WizardBody,
56
+ t as WizardHeader,
57
+ s as WizardSubtitle
58
+ };
59
+ //# sourceMappingURL=wizard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wizard.js","sources":["../../../../src/components/ui/wizard/wizard.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '@/lib/utils';\n\n// The full-page wizard page template, from the Figma \"RegionMain\" frame\n// (ui-react file, node 10511-61418).\n//\n// ── Why this is layout only ──\n// Wizard is a *composition*, not a new primitive: every visual part it needs\n// already exists in this package (`Breadcrumb`, `PageHeaderRow` /\n// `PageHeaderTitle` / `PageHeaderActions`, `Stepper` + `StepperItem`,\n// `Section`, `Button`). Its whole job is the structural skeleton — the sticky\n// header band, its stacking gap, and the capped content column — plus slots for\n// those parts. It deliberately owns **no** step state, no navigation, and no\n// button wiring: which of Cancel / Back / Next / Submit shows on which step is a\n// per-flow product decision the design brief assigns to the consuming UI block,\n// not to the kit (the same call `PageHeader` makes about its own actions slot).\n// So there is no `step`/`currentStep`/`onNext` prop here by omission, not\n// oversight.\n//\n// That boundary is about these *components*, not about the package: a consumer\n// that would rather not hand-maintain one `StepperItem` block per step can opt\n// into `useWizard` (`src/hooks/use-wizard.ts`), a headless hook that holds the\n// step index and derives the `Stepper` summary props plus each step's\n// `variant` + avatar presentation. It is separate and optional — it renders\n// nothing, decides no button visibility, and `Wizard` neither knows nor\n// requires it.\n//\n// ── Reuse over new parts ──\n// The title row is functionally identical to `PageHeader`'s, so consumers place\n// `PageHeaderRow` / `PageHeaderTitle` / `PageHeaderActions` directly inside\n// `WizardHeader` rather than getting near-duplicate `WizardTitle` /\n// `WizardActions` parts. `PageHeader`'s *root* is intentionally not reused: it\n// carries `role=\"banner\"`, and the wizard header band is not a page banner —\n// composing the row parts alone keeps the landmark structure honest.\n// `WizardSubtitle` is the one piece of typography with no existing home (a\n// dedicated `Subtitle` component was considered and rejected upstream), so it\n// reuses `PageHeaderDescription`'s exact body/secondary text treatment instead\n// of inventing a scale.\n//\n// ── Tokens ──\n// The header band's surface, divider, padding, and stacking gap come from the\n// generic semantic tiers (`--ui-background-surface-secondary`,\n// `--ui-border-on-surface-divider`, `--ui-gap-16`, `--ui-gap-12`) — Figma\n// references no `components/Wizard/*` variables, and there is no\n// `--ui-wizard-*` tier in @acronis-platform/tokens-pd.\n//\n// The body's 1024px cap is the one hardcoded number, and it is a plain layout\n// constant rather than a themed value — the same call `dialog.tsx` makes for its\n// `large` size's 832px. It deliberately does *not* read from the\n// `--ui-breakpoint-lg` bridge var even though that hand-authored var also\n// resolves to 1024px: a content column's max width and a viewport breakpoint are\n// independent facts that happen to coincide today, and tying them would make a\n// future change to either silently move the other. No `cva` variant either —\n// Figma shows exactly one width; a per-step override goes through `className`,\n// exactly as Dialog's per-instance width override does.\n//\n// The body is horizontally centered (`mx-auto`), not left-aligned with the\n// header's content: the Figma frame is 1344px wide with `containerBody` at\n// x=160/width=1024 — (1344 - 1024) / 2 = 160 on both sides, a centered column,\n// while `WizardHeader`'s content spans edge-to-edge inside its own 16px padding.\n// The two rows are intentionally not flush on the same left edge.\n\nconst Wizard = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"wizard\"\n className={cn('flex h-full w-full flex-col', className)}\n {...props}\n />\n));\nWizard.displayName = 'Wizard';\n\n// The header band: breadcrumb, title row, optional subtitle, and optional\n// stepper, stacked in that order as children. Sticky, so the step context and\n// the Cancel/Back/Next actions stay reachable while a long step body scrolls.\nconst WizardHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"wizard-header\"\n className={cn(\n 'sticky top-0 z-10 flex w-full flex-col gap-[var(--ui-gap-12)] border-b border-[var(--ui-border-on-surface-divider)] bg-[var(--ui-background-surface-secondary)] p-[var(--ui-gap-16)]',\n className\n )}\n {...props}\n />\n));\nWizardHeader.displayName = 'WizardHeader';\n\n// Optional supporting line under the title row. Same treatment as\n// `PageHeaderDescription` — body size, secondary (muted) color.\nconst WizardSubtitle = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <p\n ref={ref}\n data-slot=\"wizard-subtitle\"\n className={cn(\n 'text-sm font-normal leading-6 text-muted-foreground',\n className\n )}\n {...props}\n />\n));\nWizardSubtitle.displayName = 'WizardSubtitle';\n\n// The step's content column, capped at 1024px. Always meant to wrap a\n// `Section` (or several) — the wizard step's own fields live inside that, not\n// here.\nconst WizardBody = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"wizard-body\"\n className={cn(\n 'mx-auto flex w-full max-w-[1024px] flex-col pb-[var(--ui-gap-16)]',\n className\n )}\n {...props}\n />\n));\nWizardBody.displayName = 'WizardBody';\n\nexport { Wizard, WizardHeader, WizardSubtitle, WizardBody };\n"],"names":["Wizard","React","className","props","ref","jsx","cn","WizardHeader","WizardSubtitle","WizardBody"],"mappings":";;;AA+DA,MAAMA,IAASC,EAAM,WAGnB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,KAAAD;AAAA,IACA,aAAU;AAAA,IACV,WAAWE,EAAG,+BAA+BJ,CAAS;AAAA,IACrD,GAAGC;AAAA,EAAA;AACN,CACD;AACDH,EAAO,cAAc;AAKrB,MAAMO,IAAeN,EAAM,WAGzB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,KAAAD;AAAA,IACA,aAAU;AAAA,IACV,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDI,EAAa,cAAc;AAI3B,MAAMC,IAAiBP,EAAM,WAG3B,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,KAAAD;AAAA,IACA,aAAU;AAAA,IACV,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDK,EAAe,cAAc;AAK7B,MAAMC,IAAaR,EAAM,WAGvB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,KAAAD;AAAA,IACA,aAAU;AAAA,IACV,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDM,EAAW,cAAc;"}
@@ -0,0 +1,75 @@
1
+ import * as l from "react";
2
+ const f = {
3
+ completed: { avatarColor: "green", avatarClassName: "[box-shadow:none]" },
4
+ current: {
5
+ avatarColor: "blue",
6
+ avatarClassName: "[box-shadow:none] text-[var(--ui-stepper-item-current-label-color)]"
7
+ },
8
+ future: {
9
+ avatarColor: "gray",
10
+ avatarClassName: "[box-shadow:none] text-[var(--ui-stepper-item-future-label-color)]"
11
+ }
12
+ };
13
+ function u(e, n) {
14
+ return Math.min(Math.max(e, 0), n - 1);
15
+ }
16
+ function d(e, n) {
17
+ if (typeof n == "number")
18
+ return Number.isNaN(n) ? null : u(Math.trunc(n), e.length);
19
+ const t = e.findIndex((c) => c.id === n);
20
+ return t === -1 ? null : t;
21
+ }
22
+ function S({
23
+ steps: e,
24
+ initialStep: n = 0
25
+ }) {
26
+ var i;
27
+ if (e.length === 0)
28
+ throw new Error("useWizard: `steps` must not be empty.");
29
+ const t = e.length, [c, s] = l.useState(
30
+ () => d(e, n) ?? 0
31
+ ), r = u(c, t), b = l.useCallback(() => {
32
+ s(
33
+ (a) => u(u(a, t) + 1, t)
34
+ );
35
+ }, [t]), p = l.useCallback(() => {
36
+ s(
37
+ (a) => u(u(a, t) - 1, t)
38
+ );
39
+ }, [t]), x = l.useCallback(
40
+ (a) => {
41
+ const o = d(e, a);
42
+ o !== null && s(o);
43
+ },
44
+ [e]
45
+ );
46
+ return {
47
+ steps: l.useMemo(
48
+ () => e.map((a, o) => {
49
+ const m = o < r ? "completed" : o === r ? "current" : "future";
50
+ return {
51
+ ...a,
52
+ index: o,
53
+ stepNumber: o + 1,
54
+ variant: m,
55
+ ...f[m]
56
+ };
57
+ }),
58
+ [e, r]
59
+ ),
60
+ currentIndex: r,
61
+ currentStepNumber: r + 1,
62
+ stepCount: t,
63
+ currentStepLabel: e[r].label,
64
+ nextStepLabel: (i = e[r + 1]) == null ? void 0 : i.label,
65
+ isFirstStep: r === 0,
66
+ isLastStep: r === t - 1,
67
+ goToNextStep: b,
68
+ goToPreviousStep: p,
69
+ goToStep: x
70
+ };
71
+ }
72
+ export {
73
+ S as useWizard
74
+ };
75
+ //# sourceMappingURL=use-wizard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-wizard.js","sources":["../../src/hooks/use-wizard.ts"],"sourcesContent":["import * as React from 'react';\n\nexport interface WizardStep {\n /** Stable identifier; `goToStep` and `initialStep` accept it as a string. */\n id: string;\n /** Step label, rendered by `StepperItem` and the `Stepper` summary. */\n label: string;\n}\n\nexport type WizardStepAvatarColor = 'blue' | 'green' | 'gray';\n\nexport type WizardStepVariant = 'completed' | 'current' | 'future';\n\n/**\n * A step enriched with everything a `StepperItem` needs. Intersects `TStep`, so\n * any extra fields the consumer put on their own step objects survive.\n */\nexport type WizardStepState<TStep extends WizardStep = WizardStep> = TStep & {\n /** Zero-based position in `steps`. */\n index: number;\n /** One-based position, for the avatar's displayed number. */\n stepNumber: number;\n /** `StepperItem`'s `variant`, derived from the position vs. `currentIndex`. */\n variant: WizardStepVariant;\n /** `Avatar`'s `color` for this step's variant. */\n avatarColor: WizardStepAvatarColor;\n /** Classes to merge onto this step's `Avatar`. */\n avatarClassName: string;\n};\n\nexport interface UseWizardOptions<TStep extends WizardStep = WizardStep> {\n /** The flow's steps, in order. Must not be empty. */\n steps: TStep[];\n /**\n * Where the flow starts — a zero-based index or a step `id`. A numeric\n * index is truncated toward zero and clamped into range; `NaN` and an id\n * that matches no step fall back to the first step. A seed, not a\n * controlled input: later changes are ignored.\n */\n initialStep?: number | string;\n}\n\nexport interface UseWizardResult<TStep extends WizardStep = WizardStep> {\n /** `steps` with per-step `variant`/avatar presentation derived. */\n steps: WizardStepState<TStep>[];\n /**\n * Zero-based index of the active step. Always a valid index into `steps`:\n * if `steps` shrinks so that the stored index is past the end, the\n * effective index clamps to `steps.length - 1`.\n */\n currentIndex: number;\n /** One-based number of the active step, for `Stepper`'s `currentStep`. */\n currentStepNumber: number;\n /** Total number of steps, for `Stepper`'s `totalSteps`. */\n stepCount: number;\n /** The active step's label, for `Stepper`'s `current`. */\n currentStepLabel: string;\n /** The following step's label, or `undefined` on the last step. */\n nextStepLabel: string | undefined;\n isFirstStep: boolean;\n isLastStep: boolean;\n /** Advance one step; no-op on the last step (never wraps). */\n goToNextStep: () => void;\n /** Go back one step; no-op on the first step (never wraps). */\n goToPreviousStep: () => void;\n /**\n * Jump to a zero-based index or a step `id`. A numeric index is truncated\n * toward zero (`1.5` → `1`) and clamped into range; `NaN` is a no-op. An\n * id that matches no step is a no-op; on duplicate ids the first wins.\n */\n goToStep: (target: number | string) => void;\n}\n\nconst AVATAR_BY_VARIANT: Record<\n WizardStepVariant,\n { avatarColor: WizardStepAvatarColor; avatarClassName: string }\n> = {\n completed: { avatarColor: 'green', avatarClassName: '[box-shadow:none]' },\n current: {\n avatarColor: 'blue',\n avatarClassName:\n '[box-shadow:none] text-[var(--ui-stepper-item-current-label-color)]',\n },\n future: {\n avatarColor: 'gray',\n avatarClassName:\n '[box-shadow:none] text-[var(--ui-stepper-item-future-label-color)]',\n },\n};\n\nfunction clampIndex(index: number, stepCount: number): number {\n return Math.min(Math.max(index, 0), stepCount - 1);\n}\n\n// Numbers are truncated toward zero and clamped into range; `NaN` and ids that\n// match nothing resolve to `null`, which callers treat as a no-op.\nfunction resolveStepIndex(\n steps: readonly WizardStep[],\n target: number | string\n): number | null {\n if (typeof target === 'number') {\n if (Number.isNaN(target)) return null;\n return clampIndex(Math.trunc(target), steps.length);\n }\n const index = steps.findIndex((step) => step.id === target);\n return index === -1 ? null : index;\n}\n\n/**\n * Headless step state for a `Wizard`'s `Stepper` (the `Wizard` components\n * themselves stay presentational and own no state). Returns the `Stepper`\n * summary props plus a per-step `variant` + avatar presentation, and the\n * navigation callbacks a consumer wires to its Back/Next buttons.\n *\n * Opt-in: a consumer that already owns its step state can keep driving\n * `Stepper`/`StepperItem` by hand.\n *\n * `steps` may be a live, per-render value. The active index is stored as\n * state but re-clamped against the *current* `steps.length` on every read,\n * so a `steps` array that shrinks past the active index resolves to the last\n * remaining step instead of reading past the end.\n */\nexport function useWizard<TStep extends WizardStep = WizardStep>({\n steps,\n initialStep = 0,\n}: UseWizardOptions<TStep>): UseWizardResult<TStep> {\n if (steps.length === 0) {\n throw new Error('useWizard: `steps` must not be empty.');\n }\n\n const stepCount = steps.length;\n\n const [storedIndex, setCurrentIndex] = React.useState(\n () => resolveStepIndex(steps, initialStep) ?? 0\n );\n\n // `storedIndex` can outlive the step it pointed at, so every read goes\n // through the clamp rather than trusting the stored value.\n const currentIndex = clampIndex(storedIndex, stepCount);\n\n // Both step relative to the *clamped* current index, so a `steps` array that\n // shrank does not leave the stored value skipping steps on the way back.\n const goToNextStep = React.useCallback(() => {\n setCurrentIndex((current) =>\n clampIndex(clampIndex(current, stepCount) + 1, stepCount)\n );\n }, [stepCount]);\n\n const goToPreviousStep = React.useCallback(() => {\n setCurrentIndex((current) =>\n clampIndex(clampIndex(current, stepCount) - 1, stepCount)\n );\n }, [stepCount]);\n\n const goToStep = React.useCallback(\n (target: number | string) => {\n const index = resolveStepIndex(steps, target);\n if (index === null) return;\n setCurrentIndex(index);\n },\n [steps]\n );\n\n const derivedSteps = React.useMemo(\n () =>\n steps.map((step, index) => {\n const variant: WizardStepVariant =\n index < currentIndex\n ? 'completed'\n : index === currentIndex\n ? 'current'\n : 'future';\n return {\n ...step,\n index,\n stepNumber: index + 1,\n variant,\n ...AVATAR_BY_VARIANT[variant],\n };\n }),\n [steps, currentIndex]\n );\n\n return {\n steps: derivedSteps,\n currentIndex,\n currentStepNumber: currentIndex + 1,\n stepCount,\n currentStepLabel: steps[currentIndex].label,\n nextStepLabel: steps[currentIndex + 1]?.label,\n isFirstStep: currentIndex === 0,\n isLastStep: currentIndex === stepCount - 1,\n goToNextStep,\n goToPreviousStep,\n goToStep,\n };\n}\n"],"names":["AVATAR_BY_VARIANT","clampIndex","index","stepCount","resolveStepIndex","steps","target","step","useWizard","initialStep","storedIndex","setCurrentIndex","React","currentIndex","goToNextStep","current","goToPreviousStep","goToStep","variant","_a"],"mappings":";AAyEA,MAAMA,IAGF;AAAA,EACF,WAAW,EAAE,aAAa,SAAS,iBAAiB,oBAAA;AAAA,EACpD,SAAS;AAAA,IACP,aAAa;AAAA,IACb,iBACE;AAAA,EAAA;AAAA,EAEJ,QAAQ;AAAA,IACN,aAAa;AAAA,IACb,iBACE;AAAA,EAAA;AAEN;AAEA,SAASC,EAAWC,GAAeC,GAA2B;AAC5D,SAAO,KAAK,IAAI,KAAK,IAAID,GAAO,CAAC,GAAGC,IAAY,CAAC;AACnD;AAIA,SAASC,EACPC,GACAC,GACe;AACf,MAAI,OAAOA,KAAW;AACpB,WAAI,OAAO,MAAMA,CAAM,IAAU,OAC1BL,EAAW,KAAK,MAAMK,CAAM,GAAGD,EAAM,MAAM;AAEpD,QAAMH,IAAQG,EAAM,UAAU,CAACE,MAASA,EAAK,OAAOD,CAAM;AAC1D,SAAOJ,MAAU,KAAK,OAAOA;AAC/B;AAgBO,SAASM,EAAiD;AAAA,EAC/D,OAAAH;AAAA,EACA,aAAAI,IAAc;AAChB,GAAoD;;AAClD,MAAIJ,EAAM,WAAW;AACnB,UAAM,IAAI,MAAM,uCAAuC;AAGzD,QAAMF,IAAYE,EAAM,QAElB,CAACK,GAAaC,CAAe,IAAIC,EAAM;AAAA,IAC3C,MAAMR,EAAiBC,GAAOI,CAAW,KAAK;AAAA,EAAA,GAK1CI,IAAeZ,EAAWS,GAAaP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