@acronis-platform/ui-react 0.57.1 → 0.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/dist/components/ui/area-chart/area-chart.js +177 -0
  2. package/dist/components/ui/area-chart/area-chart.js.map +1 -0
  3. package/dist/components/ui/bar-chart/bar-chart.js +184 -78
  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/calendar/calendar.js +17 -15
  10. package/dist/components/ui/calendar/calendar.js.map +1 -1
  11. package/dist/components/ui/card-filter/card-filter.js +40 -27
  12. package/dist/components/ui/card-filter/card-filter.js.map +1 -1
  13. package/dist/components/ui/carousel-dialog/carousel-dialog.js +87 -0
  14. package/dist/components/ui/carousel-dialog/carousel-dialog.js.map +1 -0
  15. package/dist/components/ui/category-bar/category-bar.js +126 -0
  16. package/dist/components/ui/category-bar/category-bar.js.map +1 -0
  17. package/dist/components/ui/chart/chart-format.js +40 -0
  18. package/dist/components/ui/chart/chart-format.js.map +1 -0
  19. package/dist/components/ui/chart/chart.js.map +1 -1
  20. package/dist/components/ui/chart-state/chart-state.js +42 -0
  21. package/dist/components/ui/chart-state/chart-state.js.map +1 -0
  22. package/dist/components/ui/chip/chip.js +13 -13
  23. package/dist/components/ui/chip/chip.js.map +1 -1
  24. package/dist/components/ui/composed-chart/composed-chart.js +135 -0
  25. package/dist/components/ui/composed-chart/composed-chart.js.map +1 -0
  26. package/dist/components/ui/confidence-cone/confidence-cone.js +223 -0
  27. package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -0
  28. package/dist/components/ui/date-range-picker/date-range-picker.js +21 -21
  29. package/dist/components/ui/date-range-picker/date-range-picker.js.map +1 -1
  30. package/dist/components/ui/dialog/dialog.js +248 -76
  31. package/dist/components/ui/dialog/dialog.js.map +1 -1
  32. package/dist/components/ui/dialog-footer-carousel/dialog-footer-carousel.js +57 -0
  33. package/dist/components/ui/dialog-footer-carousel/dialog-footer-carousel.js.map +1 -0
  34. package/dist/components/ui/dialog-footer-default/dialog-footer-default.js +26 -0
  35. package/dist/components/ui/dialog-footer-default/dialog-footer-default.js.map +1 -0
  36. package/dist/components/ui/dialog-welcome/dialog-welcome.js +272 -0
  37. package/dist/components/ui/dialog-welcome/dialog-welcome.js.map +1 -0
  38. package/dist/components/ui/dropdown-menu/dropdown-menu.js +21 -21
  39. package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
  40. package/dist/components/ui/filter-search/filter-search.js +91 -90
  41. package/dist/components/ui/filter-search/filter-search.js.map +1 -1
  42. package/dist/components/ui/funnel-chart/funnel-chart.js +87 -0
  43. package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -0
  44. package/dist/components/ui/histogram/histogram.js +136 -0
  45. package/dist/components/ui/histogram/histogram.js.map +1 -0
  46. package/dist/components/ui/input/input.js.map +1 -1
  47. package/dist/components/ui/input-otp/input-otp.js +104 -0
  48. package/dist/components/ui/input-otp/input-otp.js.map +1 -0
  49. package/dist/components/ui/input-password/input-password.js +120 -0
  50. package/dist/components/ui/input-password/input-password.js.map +1 -0
  51. package/dist/components/ui/input-text/input-text.js +9 -9
  52. package/dist/components/ui/input-text/input-text.js.map +1 -1
  53. package/dist/components/ui/line-chart/line-chart.js +234 -0
  54. package/dist/components/ui/line-chart/line-chart.js.map +1 -0
  55. package/dist/components/ui/link/link.js +5 -5
  56. package/dist/components/ui/link/link.js.map +1 -1
  57. package/dist/components/ui/loading/loading.js +79 -0
  58. package/dist/components/ui/loading/loading.js.map +1 -0
  59. package/dist/components/ui/meter/meter.js +93 -0
  60. package/dist/components/ui/meter/meter.js.map +1 -0
  61. package/dist/components/ui/metric/metric.js +185 -0
  62. package/dist/components/ui/metric/metric.js.map +1 -0
  63. package/dist/components/ui/pie-chart/pie-chart.js +113 -0
  64. package/dist/components/ui/pie-chart/pie-chart.js.map +1 -0
  65. package/dist/components/ui/popover/popover.js +57 -27
  66. package/dist/components/ui/popover/popover.js.map +1 -1
  67. package/dist/components/ui/radar-chart/radar-chart.js +74 -0
  68. package/dist/components/ui/radar-chart/radar-chart.js.map +1 -0
  69. package/dist/components/ui/radial-bar-chart/radial-bar-chart.js +69 -0
  70. package/dist/components/ui/radial-bar-chart/radial-bar-chart.js.map +1 -0
  71. package/dist/components/ui/sankey-chart/sankey-chart.js +192 -0
  72. package/dist/components/ui/sankey-chart/sankey-chart.js.map +1 -0
  73. package/dist/components/ui/scatter-chart/scatter-chart.js +130 -0
  74. package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -0
  75. package/dist/components/ui/search/search.js +16 -16
  76. package/dist/components/ui/search/search.js.map +1 -1
  77. package/dist/components/ui/sheet/sheet-details.js +16 -16
  78. package/dist/components/ui/sheet/sheet-details.js.map +1 -1
  79. package/dist/components/ui/spinner/spinner.js.map +1 -1
  80. package/dist/components/ui/timeline/timeline.js +175 -0
  81. package/dist/components/ui/timeline/timeline.js.map +1 -0
  82. package/dist/components/ui/toolbar/toolbar.js +82 -92
  83. package/dist/components/ui/toolbar/toolbar.js.map +1 -1
  84. package/dist/components/ui/treemap/treemap.js +83 -0
  85. package/dist/components/ui/treemap/treemap.js.map +1 -0
  86. package/dist/components/ui/trend-indicator/trend-indicator.js +97 -0
  87. package/dist/components/ui/trend-indicator/trend-indicator.js.map +1 -0
  88. package/dist/index.js +461 -400
  89. package/dist/index.js.map +1 -1
  90. package/dist/lib/breakpoints.js +9 -6
  91. package/dist/lib/breakpoints.js.map +1 -1
  92. package/dist/node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.6/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +25 -0
  93. package/dist/node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.6/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js.map +1 -0
  94. package/dist/node_modules/.pnpm/embla-carousel-reactive-utils@8.6.0_embla-carousel@8.6.0/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +36 -0
  95. package/dist/node_modules/.pnpm/embla-carousel-reactive-utils@8.6.0_embla-carousel@8.6.0/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js.map +1 -0
  96. package/dist/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.js +1205 -0
  97. package/dist/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.js.map +1 -0
  98. package/dist/react.js +461 -400
  99. package/dist/react.js.map +1 -1
  100. package/dist/src/components/ui/area-chart/area-chart.d.ts +34 -0
  101. package/dist/src/components/ui/area-chart/index.d.ts +1 -0
  102. package/dist/src/components/ui/avatar/avatar.d.ts +1 -1
  103. package/dist/src/components/ui/bar-chart/bar-chart.d.ts +30 -5
  104. package/dist/src/components/ui/bar-chart/index.d.ts +1 -1
  105. package/dist/src/components/ui/button-icon-input/button-icon-input.d.ts +21 -0
  106. package/dist/src/components/ui/button-icon-input/index.d.ts +1 -0
  107. package/dist/src/components/ui/card-filter/card-filter.d.ts +5 -0
  108. package/dist/src/components/ui/carousel-dialog/carousel-dialog.d.ts +28 -0
  109. package/dist/src/components/ui/carousel-dialog/index.d.ts +1 -0
  110. package/dist/src/components/ui/category-bar/category-bar.d.ts +51 -0
  111. package/dist/src/components/ui/category-bar/index.d.ts +1 -0
  112. package/dist/src/components/ui/chart/__tests__/chart-format.test.d.ts +1 -0
  113. package/dist/src/components/ui/chart/chart-format.d.ts +111 -0
  114. package/dist/src/components/ui/chart/chart.d.ts +2 -0
  115. package/dist/src/components/ui/chart/index.d.ts +3 -1
  116. package/dist/src/components/ui/chart-state/chart-state.d.ts +11 -0
  117. package/dist/src/components/ui/chart-state/index.d.ts +1 -0
  118. package/dist/src/components/ui/composed-chart/composed-chart.d.ts +33 -0
  119. package/dist/src/components/ui/composed-chart/index.d.ts +1 -0
  120. package/dist/src/components/ui/confidence-cone/confidence-cone.d.ts +62 -0
  121. package/dist/src/components/ui/confidence-cone/index.d.ts +1 -0
  122. package/dist/src/components/ui/dialog/dialog.d.ts +105 -9
  123. package/dist/src/components/ui/dialog/dialog.docs.d.ts +82 -5
  124. package/dist/src/components/ui/dialog/index.d.ts +1 -1
  125. package/dist/src/components/ui/dialog-footer-carousel/dialog-footer-carousel.d.ts +9 -0
  126. package/dist/src/components/ui/dialog-footer-carousel/index.d.ts +1 -0
  127. package/dist/src/components/ui/dialog-footer-default/dialog-footer-default.d.ts +11 -0
  128. package/dist/src/components/ui/dialog-footer-default/index.d.ts +1 -0
  129. package/dist/src/components/ui/dialog-welcome/dialog-welcome.d.ts +54 -0
  130. package/dist/src/components/ui/dialog-welcome/dialog-welcome.docs.d.ts +55 -0
  131. package/dist/src/components/ui/dialog-welcome/index.d.ts +1 -0
  132. package/dist/src/components/ui/filter-search/filter-search.d.ts +1 -1
  133. package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +39 -0
  134. package/dist/src/components/ui/funnel-chart/index.d.ts +1 -0
  135. package/dist/src/components/ui/histogram/histogram.d.ts +40 -0
  136. package/dist/src/components/ui/histogram/index.d.ts +1 -0
  137. package/dist/src/components/ui/input-otp/index.d.ts +1 -0
  138. package/dist/src/components/ui/input-otp/input-otp.d.ts +23 -0
  139. package/dist/src/components/ui/input-password/index.d.ts +1 -0
  140. package/dist/src/components/ui/input-password/input-password.d.ts +21 -0
  141. package/dist/src/components/ui/line-chart/index.d.ts +1 -0
  142. package/dist/src/components/ui/line-chart/line-chart.d.ts +68 -0
  143. package/dist/src/components/ui/loading/index.d.ts +1 -0
  144. package/dist/src/components/ui/loading/loading.d.ts +13 -0
  145. package/dist/src/components/ui/meter/index.d.ts +1 -0
  146. package/dist/src/components/ui/meter/meter.d.ts +25 -0
  147. package/dist/src/components/ui/metric/index.d.ts +1 -0
  148. package/dist/src/components/ui/metric/metric.d.ts +37 -0
  149. package/dist/src/components/ui/pie-chart/index.d.ts +1 -0
  150. package/dist/src/components/ui/pie-chart/pie-chart.d.ts +54 -0
  151. package/dist/src/components/ui/popover/index.d.ts +1 -1
  152. package/dist/src/components/ui/popover/popover.d.ts +13 -1
  153. package/dist/src/components/ui/radar-chart/index.d.ts +1 -0
  154. package/dist/src/components/ui/radar-chart/radar-chart.d.ts +40 -0
  155. package/dist/src/components/ui/radial-bar-chart/index.d.ts +1 -0
  156. package/dist/src/components/ui/radial-bar-chart/radial-bar-chart.d.ts +45 -0
  157. package/dist/src/components/ui/sankey-chart/index.d.ts +2 -0
  158. package/dist/src/components/ui/sankey-chart/sankey-chart.d.ts +69 -0
  159. package/dist/src/components/ui/scatter-chart/index.d.ts +1 -0
  160. package/dist/src/components/ui/scatter-chart/scatter-chart.d.ts +35 -0
  161. package/dist/src/components/ui/stack/stack.d.ts +1 -1
  162. package/dist/src/components/ui/timeline/index.d.ts +1 -0
  163. package/dist/src/components/ui/timeline/timeline.d.ts +41 -0
  164. package/dist/src/components/ui/treemap/index.d.ts +1 -0
  165. package/dist/src/components/ui/treemap/treemap.d.ts +44 -0
  166. package/dist/src/components/ui/trend-indicator/index.d.ts +1 -0
  167. package/dist/src/components/ui/trend-indicator/trend-indicator.d.ts +32 -0
  168. package/dist/src/index.d.ts +27 -2
  169. package/dist/ui-react.css +1 -1
  170. package/package.json +5 -4
@@ -0,0 +1,104 @@
1
+ import { jsx as h } from "react/jsx-runtime";
2
+ import * as c from "react";
3
+ import { cn as S } from "../../../lib/utils.js";
4
+ const _ = (s, e) => `Digit ${s} of ${e}`, $ = /^[0-9]$/, R = (s, e) => Array.from({ length: e }, (n, p) => s[p] ?? ""), E = c.forwardRef(
5
+ ({
6
+ className: s,
7
+ length: e = 6,
8
+ value: n,
9
+ defaultValue: p,
10
+ onChange: f,
11
+ onComplete: b,
12
+ disabled: w,
13
+ error: m,
14
+ autoFocus: x,
15
+ slotAriaLabel: A = _,
16
+ ...j
17
+ }, k) => {
18
+ const [I, P] = c.useState(
19
+ () => R(p ?? "", e)
20
+ ), y = n != null, u = y ? R(n, e) : I, g = c.useRef([]), d = c.useRef(!1), v = (r) => {
21
+ y || P(r);
22
+ const t = r.join("");
23
+ f == null || f(t), r.every((o) => o !== "") ? d.current || (d.current = !0, b == null || b(t)) : d.current = !1;
24
+ }, a = (r) => {
25
+ const t = g.current[r];
26
+ t == null || t.focus(), t == null || t.select();
27
+ };
28
+ c.useEffect(() => {
29
+ x && a(0);
30
+ }, []);
31
+ const D = (r, t) => {
32
+ const o = [...u];
33
+ let i = r;
34
+ for (const l of t) {
35
+ if (i >= e) break;
36
+ o[i] = l, i += 1;
37
+ }
38
+ v(o), a(Math.min(i, e - 1));
39
+ }, T = (r, t) => {
40
+ if (t.length > 1) {
41
+ const l = t.replace(/\D/g, "");
42
+ l && D(r, l);
43
+ return;
44
+ }
45
+ const o = t;
46
+ if (o !== "" && !$.test(o)) return;
47
+ const i = [...u];
48
+ i[r] = o, v(i), o && r < e - 1 && a(r + 1);
49
+ }, N = (r, t) => {
50
+ if (t.key === "Backspace" && !u[r] && r > 0) {
51
+ t.preventDefault();
52
+ const o = [...u];
53
+ o[r - 1] = "", v(o), a(r - 1);
54
+ } else t.key === "ArrowLeft" && r > 0 ? (t.preventDefault(), a(r - 1)) : t.key === "ArrowRight" && r < e - 1 && (t.preventDefault(), a(r + 1));
55
+ }, L = (r, t) => {
56
+ const o = t.clipboardData.getData("text").replace(/\D/g, "");
57
+ o && (t.preventDefault(), D(r, o));
58
+ };
59
+ return /* @__PURE__ */ h(
60
+ "div",
61
+ {
62
+ ref: k,
63
+ role: "group",
64
+ className: S(
65
+ "inline-flex justify-[var(--ui-input-otp-container-justify-content)] gap-3",
66
+ s
67
+ ),
68
+ ...j,
69
+ children: Array.from({ length: e }, (r, t) => /* @__PURE__ */ h(
70
+ "input",
71
+ {
72
+ ref: (o) => {
73
+ g.current[t] = o;
74
+ },
75
+ type: "text",
76
+ inputMode: "numeric",
77
+ pattern: "[0-9]*",
78
+ autoComplete: "one-time-code",
79
+ maxLength: 1,
80
+ value: u[t],
81
+ placeholder: String(t + 1),
82
+ disabled: w,
83
+ "aria-label": A(t + 1, e),
84
+ "aria-invalid": m || void 0,
85
+ onChange: (o) => T(t, o.target.value),
86
+ onKeyDown: (o) => N(t, o),
87
+ onPaste: (o) => L(t, o),
88
+ onFocus: (o) => o.target.select(),
89
+ className: S(
90
+ "ui-input-otp-value-text-style h-[var(--ui-input-otp-box-height)] w-[var(--ui-input-otp-box-width)] rounded-[var(--ui-input-otp-box-border-radius)] border-[length:var(--ui-input-otp-box-border-width)] bg-[var(--ui-input-otp-box-color)] px-[var(--ui-input-otp-box-padding-x)] py-[var(--ui-input-otp-box-padding-y)] text-center text-[var(--ui-input-otp-value-color)] caret-[var(--ui-input-otp-value-color)] placeholder:text-[var(--ui-input-otp-placeholder-color)] transition-colors focus-visible:outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
91
+ m ? "border-[var(--ui-input-otp-box-border-color-error)] focus-visible:ring-[var(--ui-focus-error)]" : "border-[var(--ui-input-otp-box-border-color-idle)] focus-visible:border-[var(--ui-input-otp-box-border-color-active)] focus-visible:ring-[var(--ui-focus-primary)]"
92
+ )
93
+ },
94
+ t
95
+ ))
96
+ }
97
+ );
98
+ }
99
+ );
100
+ E.displayName = "InputOTP";
101
+ export {
102
+ E as InputOTP
103
+ };
104
+ //# sourceMappingURL=input-otp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-otp.js","sources":["../../../../src/components/ui/input-otp/input-otp.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '@/lib/utils';\n\n// Mirrors the Figma \"inputOTP\" component: a bare row of single-character boxes\n// (no label/description — like `Input`, field furniture is a future `Field`\n// wrapper). Themed by the `--ui-input-otp-*` token tier. Each slot is a plain\n// `<input>`; typing a digit advances focus to the next slot, Backspace on an\n// empty slot clears and moves back to the previous one, and pasting — or a\n// browser/password-manager autofill that drops the full code into one slot's\n// `onChange` — distributes it across the slots from the focused one onward.\n// `error`\n// reddens every box (via `--ui-input-otp-box-border-color-error`); there is no\n// disabled treatment in the design, so `disabled` falls back to the generic\n// `disabled:opacity-50` convention used elsewhere in this package. OTP codes\n// are numeric-only by design (SMS/authenticator codes): `inputMode=\"numeric\"`\n// and `pattern=\"[0-9]*\"` are mobile-keyboard hints only, so both typed and\n// pasted input are also filtered to digits in JS — a non-digit keystroke is\n// rejected outright and non-digit characters are stripped from a paste.\nexport interface InputOTPProps\n extends Omit<\n React.ComponentPropsWithoutRef<'div'>,\n 'onChange' | 'defaultValue' | 'children'\n > {\n /** Number of single-character slots. */\n length?: number;\n /** Controlled value (the digits entered so far, left to right). */\n value?: string;\n /** Initial value for uncontrolled usage. */\n defaultValue?: string;\n /** Fires with the full value on every change. */\n onChange?: (value: string) => void;\n /** Fires once, the moment the value reaches `length` characters. */\n onComplete?: (value: string) => void;\n /** Disables every slot. */\n disabled?: boolean;\n /** Switches every slot to the error treatment. */\n error?: boolean;\n /** Focuses the first slot on mount. */\n autoFocus?: boolean;\n /** Builds the accessible name for a slot from its 1-based index and the total length. */\n slotAriaLabel?: (index: number, length: number) => string;\n}\n\nconst defaultSlotAriaLabel = (index: number, length: number) =>\n `Digit ${index} of ${length}`;\n\nconst DIGIT_PATTERN = /^[0-9]$/;\n\n// Fixed-length per-slot array, not a derived dense string — a slot's\n// position must survive edits to other slots (see `commitSlots`).\nconst toSlots = (value: string, length: number): string[] =>\n Array.from({ length }, (_, index) => value[index] ?? '');\n\nconst InputOTP = React.forwardRef<HTMLDivElement, InputOTPProps>(\n (\n {\n className,\n length = 6,\n value,\n defaultValue,\n onChange,\n onComplete,\n disabled,\n error,\n autoFocus,\n slotAriaLabel = defaultSlotAriaLabel,\n ...props\n },\n ref\n ) => {\n const [internalSlots, setInternalSlots] = React.useState(() =>\n toSlots(defaultValue ?? '', length)\n );\n const isControlled = value != null;\n const slots = isControlled ? toSlots(value, length) : internalSlots;\n const slotRefs = React.useRef<Array<HTMLInputElement | null>>([]);\n const completedRef = React.useRef(false);\n\n // `nextSlots` is the source of truth — each index keeps its own slot's\n // character regardless of whether earlier slots are filled. The joined\n // string handed to `onChange`/`onComplete` is a derived value; only\n // `nextSlots.every(...)` can tell whether every slot has been filled,\n // since a joined string with a blank slot collapses indistinguishably\n // from a shorter one.\n const commitSlots = (nextSlots: string[]) => {\n if (!isControlled) setInternalSlots(nextSlots);\n const joined = nextSlots.join('');\n onChange?.(joined);\n if (nextSlots.every((char) => char !== '')) {\n if (!completedRef.current) {\n completedRef.current = true;\n onComplete?.(joined);\n }\n } else {\n completedRef.current = false;\n }\n };\n\n const focusSlot = (index: number) => {\n const slot = slotRefs.current[index];\n slot?.focus();\n slot?.select();\n };\n\n React.useEffect(() => {\n if (autoFocus) focusSlot(0);\n // Only run on mount.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Distributes digits across slots starting at `index` — shared by a\n // multi-character paste and a multi-character autofill `onChange` (a\n // password manager or Chrome's OTP autofill can set a single slot's\n // `.value` to the entire code, bypassing `maxLength`).\n const distributeFrom = (index: number, digits: string) => {\n const nextSlots = [...slots];\n let cursor = index;\n for (const char of digits) {\n if (cursor >= length) break;\n nextSlots[cursor] = char;\n cursor += 1;\n }\n commitSlots(nextSlots);\n focusSlot(Math.min(cursor, length - 1));\n };\n\n const handleSlotChange = (index: number, raw: string) => {\n if (raw.length > 1) {\n const digits = raw.replace(/\\D/g, '');\n if (digits) distributeFrom(index, digits);\n return;\n }\n const char = raw;\n if (char !== '' && !DIGIT_PATTERN.test(char)) return;\n const nextSlots = [...slots];\n nextSlots[index] = char;\n commitSlots(nextSlots);\n if (char && index < length - 1) focusSlot(index + 1);\n };\n\n const handleKeyDown = (\n index: number,\n event: React.KeyboardEvent<HTMLInputElement>\n ) => {\n if (event.key === 'Backspace' && !slots[index] && index > 0) {\n event.preventDefault();\n const nextSlots = [...slots];\n nextSlots[index - 1] = '';\n commitSlots(nextSlots);\n focusSlot(index - 1);\n } else if (event.key === 'ArrowLeft' && index > 0) {\n event.preventDefault();\n focusSlot(index - 1);\n } else if (event.key === 'ArrowRight' && index < length - 1) {\n event.preventDefault();\n focusSlot(index + 1);\n }\n };\n\n const handlePaste = (\n index: number,\n event: React.ClipboardEvent<HTMLInputElement>\n ) => {\n const digits = event.clipboardData.getData('text').replace(/\\D/g, '');\n if (!digits) return;\n event.preventDefault();\n distributeFrom(index, digits);\n };\n\n return (\n <div\n ref={ref}\n role=\"group\"\n className={cn(\n 'inline-flex justify-[var(--ui-input-otp-container-justify-content)] gap-3',\n className\n )}\n {...props}\n >\n {Array.from({ length }, (_, index) => (\n <input\n key={index}\n ref={(el) => {\n slotRefs.current[index] = el;\n }}\n type=\"text\"\n inputMode=\"numeric\"\n pattern=\"[0-9]*\"\n autoComplete=\"one-time-code\"\n maxLength={1}\n value={slots[index]}\n placeholder={String(index + 1)}\n disabled={disabled}\n aria-label={slotAriaLabel(index + 1, length)}\n aria-invalid={error || undefined}\n onChange={(event) => handleSlotChange(index, event.target.value)}\n onKeyDown={(event) => handleKeyDown(index, event)}\n onPaste={(event) => handlePaste(index, event)}\n onFocus={(event) => event.target.select()}\n className={cn(\n 'ui-input-otp-value-text-style h-[var(--ui-input-otp-box-height)] w-[var(--ui-input-otp-box-width)] rounded-[var(--ui-input-otp-box-border-radius)] border-[length:var(--ui-input-otp-box-border-width)] bg-[var(--ui-input-otp-box-color)] px-[var(--ui-input-otp-box-padding-x)] py-[var(--ui-input-otp-box-padding-y)] text-center text-[var(--ui-input-otp-value-color)] caret-[var(--ui-input-otp-value-color)] placeholder:text-[var(--ui-input-otp-placeholder-color)] transition-colors focus-visible:outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',\n error\n ? 'border-[var(--ui-input-otp-box-border-color-error)] focus-visible:ring-[var(--ui-focus-error)]'\n : 'border-[var(--ui-input-otp-box-border-color-idle)] focus-visible:border-[var(--ui-input-otp-box-border-color-active)] focus-visible:ring-[var(--ui-focus-primary)]'\n )}\n />\n ))}\n </div>\n );\n }\n);\nInputOTP.displayName = 'InputOTP';\n\nexport { InputOTP };\n"],"names":["defaultSlotAriaLabel","index","length","DIGIT_PATTERN","toSlots","value","_","InputOTP","React","className","defaultValue","onChange","onComplete","disabled","error","autoFocus","slotAriaLabel","props","ref","internalSlots","setInternalSlots","isControlled","slots","slotRefs","completedRef","commitSlots","nextSlots","joined","char","focusSlot","slot","distributeFrom","digits","cursor","handleSlotChange","raw","handleKeyDown","event","handlePaste","jsx","cn","el"],"mappings":";;;AA4CA,MAAMA,IAAuB,CAACC,GAAeC,MAC3C,SAASD,CAAK,OAAOC,CAAM,IAEvBC,IAAgB,WAIhBC,IAAU,CAACC,GAAeH,MAC9B,MAAM,KAAK,EAAE,QAAAA,KAAU,CAACI,GAAGL,MAAUI,EAAMJ,CAAK,KAAK,EAAE,GAEnDM,IAAWC,EAAM;AAAA,EACrB,CACE;AAAA,IACE,WAAAC;AAAA,IACA,QAAAP,IAAS;AAAA,IACT,OAAAG;AAAA,IACA,cAAAK;AAAA,IACA,UAAAC;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC;AAAA,IACA,OAAAC;AAAA,IACA,WAAAC;AAAA,IACA,eAAAC,IAAgBhB;AAAA,IAChB,GAAGiB;AAAA,EAAA,GAELC,MACG;AACH,UAAM,CAACC,GAAeC,CAAgB,IAAIZ,EAAM;AAAA,MAAS,MACvDJ,EAAQM,KAAgB,IAAIR,CAAM;AAAA,IAAA,GAE9BmB,IAAehB,KAAS,MACxBiB,IAAQD,IAAejB,EAAQC,GAAOH,CAAM,IAAIiB,GAChDI,IAAWf,EAAM,OAAuC,EAAE,GAC1DgB,IAAehB,EAAM,OAAO,EAAK,GAQjCiB,IAAc,CAACC,MAAwB;AAC3C,MAAKL,KAAcD,EAAiBM,CAAS;AAC7C,YAAMC,IAASD,EA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AAA,YAC/D,WAAW,CAACA,MAAUD,EAAcnC,GAAOoC,CAAK;AAAA,YAChD,SAAS,CAACA,MAAUC,EAAYrC,GAAOoC,CAAK;AAAA,YAC5C,SAAS,CAACA,MAAUA,EAAM,OAAO,OAAA;AAAA,YACjC,WAAWG;AAAA,cACT;AAAA,cACA1B,IACI,mGACA;AAAA,YAAA;AAAA,UACN;AAAA,UAvBKb;AAAA,QAAA,CAyBR;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACAM,EAAS,cAAc;"}
@@ -0,0 +1,120 @@
1
+ import { jsxs as b, jsx as o } from "react/jsx-runtime";
2
+ import * as c from "react";
3
+ import { EyeIcon as P, EyeCrossedIcon as C } from "@acronis-platform/icons-react/stroke-mono";
4
+ import { cn as t } from "../../../lib/utils.js";
5
+ import { ButtonIconInput as E } from "../button-icon-input/button-icon-input.js";
6
+ function j({
7
+ htmlFor: a,
8
+ disabled: r,
9
+ required: s,
10
+ children: i
11
+ }) {
12
+ return /* @__PURE__ */ b(
13
+ "label",
14
+ {
15
+ htmlFor: a,
16
+ className: t(
17
+ "flex gap-[var(--ui-input-password-global-container-label-gap)] text-sm leading-4",
18
+ r ? "text-[var(--ui-input-password-global-label-color-disabled)]" : "text-[var(--ui-input-password-global-label-color-idle)]"
19
+ ),
20
+ children: [
21
+ i,
22
+ s && /* @__PURE__ */ o(
23
+ "span",
24
+ {
25
+ "aria-hidden": "true",
26
+ className: "text-[var(--ui-input-password-global-required-color)]",
27
+ children: "*"
28
+ }
29
+ )
30
+ ]
31
+ }
32
+ );
33
+ }
34
+ function k({
35
+ id: a,
36
+ hasError: r,
37
+ disabled: s,
38
+ children: i
39
+ }) {
40
+ return /* @__PURE__ */ o(
41
+ "p",
42
+ {
43
+ id: a,
44
+ className: t(
45
+ "text-xs leading-4",
46
+ r ? "text-[var(--ui-input-password-error-msg-error-color)]" : s ? "text-[var(--ui-input-password-normal-description-color-disabled)]" : "text-[var(--ui-input-password-normal-description-color-idle)]"
47
+ ),
48
+ children: i
49
+ }
50
+ );
51
+ }
52
+ function B(a, r) {
53
+ return t(
54
+ "flex h-[var(--ui-input-password-global-box-height)] items-center gap-[var(--ui-input-password-global-box-gap)] rounded-[var(--ui-input-password-global-box-border-radius)] border-[length:var(--ui-input-password-global-box-border-width)] px-[var(--ui-input-password-global-box-padding-x)] py-[var(--ui-input-password-global-box-padding-y)] transition-colors",
55
+ a ? "border-[var(--ui-input-password-error-msg-box-border-color-idle)] bg-[var(--ui-input-password-global-box-color-idle)] has-[:focus-visible]:border-[var(--ui-input-password-error-msg-box-border-color-hover)] has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-[var(--ui-focus-error)]" : t(
56
+ "border-[var(--ui-input-password-normal-box-border-color-idle)] bg-[var(--ui-input-password-global-box-color-idle)]",
57
+ !r && "hover:border-[var(--ui-input-password-normal-box-border-color-hover)] hover:bg-[var(--ui-input-password-global-box-color-hover)]",
58
+ "has-[:focus-visible]:border-[var(--ui-input-password-normal-box-border-color-hover)] has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-[var(--ui-focus-primary)]"
59
+ ),
60
+ r && "cursor-not-allowed border-[var(--ui-input-password-normal-box-border-color-disabled)] bg-[var(--ui-input-password-global-box-color-disabled)]"
61
+ );
62
+ }
63
+ const M = c.forwardRef(
64
+ ({
65
+ className: a,
66
+ id: r,
67
+ label: s,
68
+ required: i,
69
+ description: w,
70
+ error: d,
71
+ disabled: e,
72
+ showPasswordLabel: x = "Show password",
73
+ hidePasswordLabel: m = "Hide password",
74
+ ...h
75
+ }, f) => {
76
+ const I = c.useId(), p = r ?? I, v = `${p}-message`, [n, N] = c.useState(!1), l = d != null && d !== "", u = l ? d : w, g = u != null && u !== "";
77
+ return /* @__PURE__ */ b("div", { className: "flex w-full min-w-[var(--ui-input-password-global-container-width-min)] flex-col gap-[var(--ui-input-password-global-container-gap)]", children: [
78
+ s != null && s !== "" && /* @__PURE__ */ o(j, { htmlFor: p, disabled: e, required: i, children: s }),
79
+ /* @__PURE__ */ b("div", { className: B(l, e), children: [
80
+ /* @__PURE__ */ o(
81
+ "input",
82
+ {
83
+ ref: f,
84
+ id: p,
85
+ type: n ? "text" : "password",
86
+ disabled: e,
87
+ "aria-invalid": l || void 0,
88
+ "aria-required": i || void 0,
89
+ "aria-describedby": g ? v : void 0,
90
+ className: t(
91
+ "min-w-0 flex-1 bg-transparent text-sm leading-6 outline-none",
92
+ e ? "text-[var(--ui-input-password-global-value-color-disabled)] placeholder:text-[var(--ui-input-password-global-placeholder-color-disabled)]" : "text-[var(--ui-input-password-global-value-color-idle)] placeholder:text-[var(--ui-input-password-global-placeholder-color-idle)]",
93
+ a
94
+ ),
95
+ ...h
96
+ }
97
+ ),
98
+ /* @__PURE__ */ o(
99
+ E,
100
+ {
101
+ variant: l ? "error" : "normal",
102
+ onClick: () => N((y) => !y),
103
+ disabled: e,
104
+ "aria-label": n ? m : x,
105
+ "aria-pressed": n,
106
+ className: "shrink-0",
107
+ children: n ? /* @__PURE__ */ o(P, {}) : /* @__PURE__ */ o(C, {})
108
+ }
109
+ )
110
+ ] }),
111
+ g && /* @__PURE__ */ o(k, { id: v, hasError: l, disabled: e, children: u })
112
+ ] });
113
+ }
114
+ );
115
+ M.displayName = "InputPassword";
116
+ export {
117
+ M as InputPassword,
118
+ B as getInputPasswordBoxClassName
119
+ };
120
+ //# sourceMappingURL=input-password.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-password.js","sources":["../../../../src/components/ui/input-password/input-password.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n EyeIcon,\n EyeCrossedIcon,\n} from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\nimport { ButtonIconInput } from '../button-icon-input';\n\n// Mirrors the Figma \"InputPassword\" component: an `InputText`-shaped field\n// (label / required / description / error) with a built-in show/hide toggle.\n// Unlike `InputText`, the box itself isn't the bare `Input` primitive — the\n// design gives InputPassword its own token tier (`--ui-input-password-*`)\n// down to the box fill/border, so the value input renders borderless/\n// transparent inside a themed flex container alongside the toggle button\n// (the tier's own `global-box-gap` token implies this layout, not an\n// absolutely-positioned overlay). The toggle is the Figma \"ButtonIconInput\"\n// instance, rendered here via the `ButtonIconInput` component. Visibility is\n// fully internal state; nothing in the design calls for a consumer-controlled\n// mode.\nexport interface InputPasswordProps\n extends Omit<React.ComponentPropsWithoutRef<'input'>, 'children' | 'type'> {\n /** Field label, rendered above the input. */\n label?: React.ReactNode;\n /** Marks the field required — appends a `*` after the label. */\n required?: boolean;\n /** Helper text below the input. Hidden while `error` is set. */\n description?: React.ReactNode;\n /**\n * Error message below the input. Its presence switches the field to the error\n * treatment (red box border + red message).\n */\n error?: React.ReactNode;\n /** Accessible label for the toggle button while the password is hidden. */\n showPasswordLabel?: string;\n /** Accessible label for the toggle button while the password is shown. */\n hidePasswordLabel?: string;\n}\n\ninterface InputPasswordLabelProps {\n htmlFor: string;\n disabled?: boolean;\n required?: boolean;\n children: React.ReactNode;\n}\n\nfunction InputPasswordLabel({\n htmlFor,\n disabled,\n required,\n children,\n}: InputPasswordLabelProps) {\n return (\n <label\n htmlFor={htmlFor}\n className={cn(\n 'flex gap-[var(--ui-input-password-global-container-label-gap)] text-sm leading-4',\n disabled\n ? 'text-[var(--ui-input-password-global-label-color-disabled)]'\n : 'text-[var(--ui-input-password-global-label-color-idle)]'\n )}\n >\n {children}\n {required && (\n <span\n aria-hidden=\"true\"\n className=\"text-[var(--ui-input-password-global-required-color)]\"\n >\n *\n </span>\n )}\n </label>\n );\n}\n\ninterface InputPasswordMessageProps {\n id: string;\n hasError: boolean;\n disabled?: boolean;\n children: React.ReactNode;\n}\n\nfunction InputPasswordMessage({\n id,\n hasError,\n disabled,\n children,\n}: InputPasswordMessageProps) {\n return (\n <p\n id={id}\n className={cn(\n 'text-xs leading-4',\n hasError\n ? 'text-[var(--ui-input-password-error-msg-error-color)]'\n : disabled\n ? 'text-[var(--ui-input-password-normal-description-color-disabled)]'\n : 'text-[var(--ui-input-password-normal-description-color-idle)]'\n )}\n >\n {children}\n </p>\n );\n}\n\n// The box's border/background/focus-ring classes branch on `hasError` and\n// `disabled` independently, so inlining it is a 3-way nested ternary. Pulled\n// out as a pure function so the branches can be unit-tested directly.\nexport function getInputPasswordBoxClassName(\n hasError: boolean,\n disabled?: boolean\n) {\n return cn(\n 'flex h-[var(--ui-input-password-global-box-height)] items-center gap-[var(--ui-input-password-global-box-gap)] rounded-[var(--ui-input-password-global-box-border-radius)] border-[length:var(--ui-input-password-global-box-border-width)] px-[var(--ui-input-password-global-box-padding-x)] py-[var(--ui-input-password-global-box-padding-y)] transition-colors',\n hasError\n ? 'border-[var(--ui-input-password-error-msg-box-border-color-idle)] bg-[var(--ui-input-password-global-box-color-idle)] has-[:focus-visible]:border-[var(--ui-input-password-error-msg-box-border-color-hover)] has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-[var(--ui-focus-error)]'\n : cn(\n 'border-[var(--ui-input-password-normal-box-border-color-idle)] bg-[var(--ui-input-password-global-box-color-idle)]',\n !disabled &&\n 'hover:border-[var(--ui-input-password-normal-box-border-color-hover)] hover:bg-[var(--ui-input-password-global-box-color-hover)]',\n 'has-[:focus-visible]:border-[var(--ui-input-password-normal-box-border-color-hover)] has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-[var(--ui-focus-primary)]'\n ),\n disabled &&\n 'cursor-not-allowed border-[var(--ui-input-password-normal-box-border-color-disabled)] bg-[var(--ui-input-password-global-box-color-disabled)]'\n );\n}\n\nconst InputPassword = React.forwardRef<HTMLInputElement, InputPasswordProps>(\n (\n {\n className,\n id,\n label,\n required,\n description,\n error,\n disabled,\n showPasswordLabel = 'Show password',\n hidePasswordLabel = 'Hide password',\n ...props\n },\n ref\n ) => {\n const reactId = React.useId();\n const inputId = id ?? reactId;\n const messageId = `${inputId}-message`;\n const [visible, setVisible] = React.useState(false);\n\n const hasError = error != null && error !== '';\n const message = hasError ? error : description;\n const hasMessage = message != null && message !== '';\n\n return (\n <div className=\"flex w-full min-w-[var(--ui-input-password-global-container-width-min)] flex-col gap-[var(--ui-input-password-global-container-gap)]\">\n {label != null && label !== '' && (\n <InputPasswordLabel htmlFor={inputId} disabled={disabled} required={required}>\n {label}\n </InputPasswordLabel>\n )}\n\n <div className={getInputPasswordBoxClassName(hasError, disabled)}>\n <input\n ref={ref}\n id={inputId}\n type={visible ? 'text' : 'password'}\n disabled={disabled}\n aria-invalid={hasError || undefined}\n aria-required={required || undefined}\n aria-describedby={hasMessage ? messageId : undefined}\n className={cn(\n 'min-w-0 flex-1 bg-transparent text-sm leading-6 outline-none',\n disabled\n ? 'text-[var(--ui-input-password-global-value-color-disabled)] placeholder:text-[var(--ui-input-password-global-placeholder-color-disabled)]'\n : 'text-[var(--ui-input-password-global-value-color-idle)] placeholder:text-[var(--ui-input-password-global-placeholder-color-idle)]',\n className\n )}\n {...props}\n />\n <ButtonIconInput\n variant={hasError ? 'error' : 'normal'}\n onClick={() => setVisible((prev) => !prev)}\n disabled={disabled}\n aria-label={visible ? hidePasswordLabel : showPasswordLabel}\n aria-pressed={visible}\n className=\"shrink-0\"\n >\n {visible ? <EyeIcon /> : <EyeCrossedIcon />}\n </ButtonIconInput>\n </div>\n\n {hasMessage && (\n <InputPasswordMessage id={messageId} hasError={hasError} disabled={disabled}>\n {message}\n </InputPasswordMessage>\n )}\n </div>\n );\n }\n);\nInputPassword.displayName = 'InputPassword';\n\nexport { InputPassword };\n"],"names":["InputPasswordLabel","htmlFor","disabled","required","children","jsxs","cn","jsx","InputPasswordMessage","id","hasError","getInputPasswordBoxClassName","InputPassword","React","className","label","description","error","showPasswordLabel","hidePasswordLabel","props","ref","reactId","inputId","messageId","visible","setVisible","message","hasMessage","ButtonIconInput","prev","EyeIcon","EyeCrossedIcon"],"mappings":";;;;;AA8CA,SAASA,EAAmB;AAAA,EAC1B,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AACF,GAA4B;AAC1B,SACE,gBAAAC;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 error: o,
14
14
  clearable: f,
15
15
  onClear: h,
16
16
  disabled: e,
17
- value: o,
17
+ value: a,
18
18
  ...I
19
19
  }, N) => {
20
- const y = m.useId(), l = b ?? y, d = `${l}-message`, r = a != null && a !== "", w = o != null && o !== "", p = !!f && w && !e, n = r ? a : v, x = n != null && n !== "";
20
+ const y = m.useId(), r = b ?? y, d = `${r}-message`, l = o != null && o !== "", w = a != null && a !== "", p = !!f && w && !e, n = l ? o : v, x = n != null && n !== "";
21
21
  return /* @__PURE__ */ s("div", { className: "flex w-full min-w-[var(--ui-input-text-global-container-width-min)] flex-col gap-[var(--ui-input-text-global-container-gap)]", children: [
22
22
  i != null && i !== "" && /* @__PURE__ */ s(
23
23
  "label",
24
24
  {
25
- htmlFor: l,
25
+ htmlFor: r,
26
26
  className: c(
27
27
  "flex gap-[var(--ui-input-text-global-container-label-gap)] text-sm leading-4",
28
28
  e ? "text-[var(--ui-input-text-global-label-color-disabled)]" : "text-[var(--ui-input-text-global-label-color-idle)]"
@@ -45,10 +45,10 @@ const T = m.forwardRef(
45
45
  C,
46
46
  {
47
47
  ref: N,
48
- id: l,
48
+ id: r,
49
49
  disabled: e,
50
- value: o,
51
- "aria-invalid": r || void 0,
50
+ value: a,
51
+ "aria-invalid": l || void 0,
52
52
  "aria-required": u || void 0,
53
53
  "aria-describedby": x ? d : void 0,
54
54
  className: c(p && "pe-9", g),
@@ -61,7 +61,7 @@ const T = m.forwardRef(
61
61
  type: "button",
62
62
  onClick: h,
63
63
  "aria-label": "Clear",
64
- className: "absolute end-[var(--ui-input-text-global-box-padding-x)] top-1/2 flex size-4 -translate-y-1/2 items-center justify-center rounded-[var(--ui-input-text-global-box-border-radius)] text-[var(--ui-button-icon-global-icon-color-idle)] outline-none focus-visible:ring-[3px] focus-visible:ring-[var(--ui-focus-primary)] [&_svg]:size-4 [&_svg]:shrink-0",
64
+ className: "absolute end-[var(--ui-input-text-global-box-padding-x)] top-1/2 flex size-5 -translate-y-1/2 cursor-pointer items-center justify-center rounded-[var(--ui-input-text-global-box-border-radius)] p-0.5 text-[var(--ui-button-icon-global-icon-color-idle)] outline-none hover:bg-[var(--ui-button-icon-global-container-color-hover)] active:bg-[var(--ui-button-icon-global-container-color-active)] focus-visible:ring-[3px] focus-visible:ring-[var(--ui-focus-primary)] [&_svg]:size-4 [&_svg]:shrink-0",
65
65
  children: /* @__PURE__ */ t(j, {})
66
66
  }
67
67
  )
@@ -72,7 +72,7 @@ const T = m.forwardRef(
72
72
  id: d,
73
73
  className: c(
74
74
  "text-xs leading-4",
75
- r ? "text-[var(--ui-input-text-error-msg-error-color)]" : e ? "text-[var(--ui-input-text-normal-description-color-disabled)]" : "text-[var(--ui-input-text-normal-description-color-idle)]"
75
+ l ? "text-[var(--ui-input-text-error-msg-error-color)]" : e ? "text-[var(--ui-input-text-normal-description-color-disabled)]" : "text-[var(--ui-input-text-normal-description-color-idle)]"
76
76
  ),
77
77
  children: n
78
78
  }
@@ -1 +1 @@
1
- {"version":3,"file":"input-text.js","sources":["../../../../src/components/ui/input-text/input-text.tsx"],"sourcesContent":["import * as React from 'react';\nimport { TimesIcon } from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\nimport { InputBox } from '../input';\n\n// Mirrors the Figma \"InputText\" component: a full single-line text field built\n// around the bare `InputBox` primitive (themed by the `--ui-input-text-*` tier). It\n// adds the field furniture: an optional `label` (with an optional `required` `*`),\n// an optional clear (✕) button, and an optional `description` or `error` message\n// below. Passing `error` switches the field to its error treatment — the box gets\n// the red error border (via the input's `aria-invalid` styling) and the red error\n// message replaces the description. The clear button appears only while `clearable`\n// is set and the (controlled) field has a value, and calls `onClear`. Colors come\n// from the `--ui-input-text-*` tokens — label/required/description/error — so brand\n// overrides are honored; the clear button is a ghost ButtonIcon (glyph\n// `--ui-button-icon-global-icon-color-idle`, since the input-text tier dropped its\n// own clear-icon token in the Figma sync) with a 3px `--ui-focus-primary` ring.\nexport interface InputTextProps\n extends Omit<React.ComponentPropsWithoutRef<'input'>, 'children'> {\n /** Field label, rendered above the input. */\n label?: React.ReactNode;\n /** Marks the field required — appends a `*` after the label. */\n required?: boolean;\n /** Helper text below the input. Hidden while `error` is set. */\n description?: React.ReactNode;\n /**\n * Error message below the input. Its presence switches the field to the error\n * treatment (red box border + red message).\n */\n error?: React.ReactNode;\n /** Show a clear (✕) button while the (controlled) field has a value. */\n clearable?: boolean;\n /** Called when the clear button is activated. */\n onClear?: () => void;\n}\n\nconst InputText = React.forwardRef<HTMLInputElement, InputTextProps>(\n (\n {\n className,\n id,\n label,\n required,\n description,\n error,\n clearable,\n onClear,\n disabled,\n value,\n ...props\n },\n ref\n ) => {\n const reactId = React.useId();\n const inputId = id ?? reactId;\n const messageId = `${inputId}-message`;\n\n const hasError = error != null && error !== '';\n const hasValue = value != null && value !== '';\n const showClear = Boolean(clearable) && hasValue && !disabled;\n const message = hasError ? error : description;\n const hasMessage = message != null && message !== '';\n\n return (\n <div className=\"flex w-full min-w-[var(--ui-input-text-global-container-width-min)] flex-col gap-[var(--ui-input-text-global-container-gap)]\">\n {label != null && label !== '' && (\n <label\n htmlFor={inputId}\n className={cn(\n 'flex gap-[var(--ui-input-text-global-container-label-gap)] text-sm leading-4',\n disabled\n ? 'text-[var(--ui-input-text-global-label-color-disabled)]'\n : 'text-[var(--ui-input-text-global-label-color-idle)]'\n )}\n >\n {label}\n {required && (\n <span\n aria-hidden=\"true\"\n className=\"text-[var(--ui-input-text-global-required-color)]\"\n >\n *\n </span>\n )}\n </label>\n )}\n\n <div className=\"relative\">\n <InputBox\n ref={ref}\n id={inputId}\n disabled={disabled}\n value={value}\n aria-invalid={hasError || undefined}\n aria-required={required || undefined}\n aria-describedby={hasMessage ? messageId : undefined}\n className={cn(showClear && 'pe-9', className)}\n {...props}\n />\n {showClear && (\n <button\n type=\"button\"\n onClick={onClear}\n aria-label=\"Clear\"\n className=\"absolute end-[var(--ui-input-text-global-box-padding-x)] top-1/2 flex size-4 -translate-y-1/2 items-center justify-center rounded-[var(--ui-input-text-global-box-border-radius)] text-[var(--ui-button-icon-global-icon-color-idle)] outline-none focus-visible:ring-[3px] focus-visible:ring-[var(--ui-focus-primary)] [&_svg]:size-4 [&_svg]:shrink-0\"\n >\n <TimesIcon />\n </button>\n )}\n </div>\n\n {hasMessage && (\n <p\n id={messageId}\n className={cn(\n 'text-xs leading-4',\n hasError\n ? 'text-[var(--ui-input-text-error-msg-error-color)]'\n : disabled\n ? 'text-[var(--ui-input-text-normal-description-color-disabled)]'\n : 'text-[var(--ui-input-text-normal-description-color-idle)]'\n )}\n >\n {message}\n </p>\n )}\n </div>\n );\n }\n);\nInputText.displayName = 'InputText';\n\nexport { InputText };\n"],"names":["InputText","React","className","id","label","required","description","error","clearable","onClear","disabled","value","props","ref","reactId","inputId","messageId","hasError","hasValue","showClear","message","hasMessage","jsxs","cn","jsx","InputBox","TimesIcon"],"mappings":";;;;;AAqCA,MAAMA,IAAYC,EAAM;AAAA,EACtB,CACE;AAAA,IACE,WAAAC;AAAA,IACA,IAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,OAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,OAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAMC,IAAUb,EAAM,MAAA,GAChBc,IAAUZ,KAAMW,GAChBE,IAAY,GAAGD,CAAO,YAEtBE,IAAWV,KAAS,QAAQA,MAAU,IACtCW,IAAWP,KAAS,QAAQA,MAAU,IACtCQ,IAAY,EAAQX,KAAcU,KAAY,CAACR,GAC/CU,IAAUH,IAAWV,IAAQD,GAC7Be,IAAaD,KAAW,QAAQA,MAAY;AAElD,WACE,gBAAAE,EAAC,OAAA,EAAI,WAAU,gIACZ,UAAA;AAAA,MAAAlB,KAAS,QAAQA,MAAU,MAC1B,gBAAAkB;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,SAASP;AAAA,UACT,WAAWQ;AAAA,YACT;AAAA,YACAb,IACI,4DACA;AAAA,UAAA;AAAA,UAGL,UAAA;AAAA,YAAAN;AAAA,YACAC,KACC,gBAAAmB;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,eAAY;AAAA,gBACZ,WAAU;AAAA,gBACX,UAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UAED;AAAA,QAAA;AAAA,MAAA;AAAA,MAKN,gBAAAF,EAAC,OAAA,EAAI,WAAU,YACb,UAAA;AAAA,QAAA,gBAAAE;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,KAAAZ;AAAA,YACA,IAAIE;AAAA,YACJ,UAAAL;AAAA,YACA,OAAAC;AAAA,YACA,gBAAcM,KAAY;AAAA,YAC1B,iBAAeZ,KAAY;AAAA,YAC3B,oBAAkBgB,IAAaL,IAAY;AAAA,YAC3C,WAAWO,EAAGJ,KAAa,QAAQjB,CAAS;AAAA,YAC3C,GAAGU;AAAA,UAAA;AAAA,QAAA;AAAA,QAELO,KACC,gBAAAK;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,SAASf;AAAA,YACT,cAAW;AAAA,YACX,WAAU;AAAA,YAEV,4BAACiB,GAAA,CAAA,CAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MACb,GAEJ;AAAA,MAECL,KACC,gBAAAG;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,IAAIR;AAAA,UACJ,WAAWO;AAAA,YACT;AAAA,YACAN,IACI,sDACAP,IACE,kEACA;AAAA,UAAA;AAAA,UAGP,UAAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IACH,GAEJ;AAAA,EAEJ;AACF;AACApB,EAAU,cAAc;"}
1
+ {"version":3,"file":"input-text.js","sources":["../../../../src/components/ui/input-text/input-text.tsx"],"sourcesContent":["import * as React from 'react';\nimport { TimesIcon } from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\nimport { InputBox } from '../input';\n\n// Mirrors the Figma \"InputText\" component: a full single-line text field built\n// around the bare `InputBox` primitive (themed by the `--ui-input-text-*` tier). It\n// adds the field furniture: an optional `label` (with an optional `required` `*`),\n// an optional clear (✕) button, and an optional `description` or `error` message\n// below. Passing `error` switches the field to its error treatment — the box gets\n// the red error border (via the input's `aria-invalid` styling) and the red error\n// message replaces the description. The clear button appears only while `clearable`\n// is set and the (controlled) field has a value, and calls `onClear`. Colors come\n// from the `--ui-input-text-*` tokens — label/required/description/error — so brand\n// overrides are honored; the clear button is a ghost ButtonIcon (glyph\n// `--ui-button-icon-global-icon-color-idle`, since the input-text tier dropped its\n// own clear-icon token in the Figma sync) with a 3px `--ui-focus-primary` ring.\nexport interface InputTextProps\n extends Omit<React.ComponentPropsWithoutRef<'input'>, 'children'> {\n /** Field label, rendered above the input. */\n label?: React.ReactNode;\n /** Marks the field required — appends a `*` after the label. */\n required?: boolean;\n /** Helper text below the input. Hidden while `error` is set. */\n description?: React.ReactNode;\n /**\n * Error message below the input. Its presence switches the field to the error\n * treatment (red box border + red message).\n */\n error?: React.ReactNode;\n /** Show a clear (✕) button while the (controlled) field has a value. */\n clearable?: boolean;\n /** Called when the clear button is activated. */\n onClear?: () => void;\n}\n\nconst InputText = React.forwardRef<HTMLInputElement, InputTextProps>(\n (\n {\n className,\n id,\n label,\n required,\n description,\n error,\n clearable,\n onClear,\n disabled,\n value,\n ...props\n },\n ref\n ) => {\n const reactId = React.useId();\n const inputId = id ?? reactId;\n const messageId = `${inputId}-message`;\n\n const hasError = error != null && error !== '';\n const hasValue = value != null && value !== '';\n const showClear = Boolean(clearable) && hasValue && !disabled;\n const message = hasError ? error : description;\n const hasMessage = message != null && message !== '';\n\n return (\n <div className=\"flex w-full min-w-[var(--ui-input-text-global-container-width-min)] flex-col gap-[var(--ui-input-text-global-container-gap)]\">\n {label != null && label !== '' && (\n <label\n htmlFor={inputId}\n className={cn(\n 'flex gap-[var(--ui-input-text-global-container-label-gap)] text-sm leading-4',\n disabled\n ? 'text-[var(--ui-input-text-global-label-color-disabled)]'\n : 'text-[var(--ui-input-text-global-label-color-idle)]'\n )}\n >\n {label}\n {required && (\n <span\n aria-hidden=\"true\"\n className=\"text-[var(--ui-input-text-global-required-color)]\"\n >\n *\n </span>\n )}\n </label>\n )}\n\n <div className=\"relative\">\n <InputBox\n ref={ref}\n id={inputId}\n disabled={disabled}\n value={value}\n aria-invalid={hasError || undefined}\n aria-required={required || undefined}\n aria-describedby={hasMessage ? messageId : undefined}\n className={cn(showClear && 'pe-9', className)}\n {...props}\n />\n {showClear && (\n <button\n type=\"button\"\n onClick={onClear}\n aria-label=\"Clear\"\n className=\"absolute end-[var(--ui-input-text-global-box-padding-x)] top-1/2 flex size-5 -translate-y-1/2 cursor-pointer items-center justify-center rounded-[var(--ui-input-text-global-box-border-radius)] p-0.5 text-[var(--ui-button-icon-global-icon-color-idle)] outline-none hover:bg-[var(--ui-button-icon-global-container-color-hover)] active:bg-[var(--ui-button-icon-global-container-color-active)] focus-visible:ring-[3px] focus-visible:ring-[var(--ui-focus-primary)] [&_svg]:size-4 [&_svg]:shrink-0\"\n >\n <TimesIcon />\n </button>\n )}\n </div>\n\n {hasMessage && (\n <p\n id={messageId}\n className={cn(\n 'text-xs leading-4',\n hasError\n ? 'text-[var(--ui-input-text-error-msg-error-color)]'\n : disabled\n ? 'text-[var(--ui-input-text-normal-description-color-disabled)]'\n : 'text-[var(--ui-input-text-normal-description-color-idle)]'\n )}\n >\n {message}\n </p>\n )}\n </div>\n );\n }\n);\nInputText.displayName = 'InputText';\n\nexport { InputText };\n"],"names":["InputText","React","className","id","label","required","description","error","clearable","onClear","disabled","value","props","ref","reactId","inputId","messageId","hasError","hasValue","showClear","message","hasMessage","jsxs","cn","jsx","InputBox","TimesIcon"],"mappings":";;;;;AAqCA,MAAMA,IAAYC,EAAM;AAAA,EACtB,CACE;AAAA,IACE,WAAAC;AAAA,IACA,IAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;A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AASf;AAAA,YACT,cAAW;AAAA,YACX,WAAU;AAAA,YAEV,4BAACiB,GAAA,CAAA,CAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MACb,GAEJ;AAAA,MAECL,KACC,gBAAAG;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,IAAIR;AAAA,UACJ,WAAWO;AAAA,YACT;AAAA,YACAN,IACI,sDACAP,IACE,kEACA;AAAA,UAAA;AAAA,UAGP,UAAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IACH,GAEJ;AAAA,EAEJ;AACF;AACApB,EAAU,cAAc;"}
@@ -0,0 +1,234 @@
1
+ import { jsx as e, jsxs as at } from "react/jsx-runtime";
2
+ import * as m from "react";
3
+ import { cva as nt } from "../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
4
+ import { ComposedChart as ot, LineChart as it, CartesianGrid as rt, XAxis as lt, YAxis as st, Area as dt, Line as ct } from "recharts";
5
+ import { cn as mt } from "../../../lib/utils.js";
6
+ import { ChartContainer as ft, ChartTooltip as C, ChartTooltipContent as b, ChartLegend as _, ChartLegendContent as B } from "../chart/chart.js";
7
+ import { resolveAxisDomain as ht } from "../chart/chart-format.js";
8
+ const ut = nt("", {
9
+ variants: {
10
+ curve: {
11
+ linear: "",
12
+ monotone: "",
13
+ step: ""
14
+ },
15
+ lineStyle: {
16
+ solid: "",
17
+ dashed: ""
18
+ }
19
+ },
20
+ defaultVariants: {
21
+ curve: "monotone",
22
+ lineStyle: "solid"
23
+ }
24
+ }), $ = "__band_";
25
+ function T(n) {
26
+ return n == null ? void 0 : n.filter(
27
+ (l) => !String(l.dataKey).startsWith($)
28
+ );
29
+ }
30
+ function vt(n) {
31
+ return function(i) {
32
+ const s = {
33
+ ...i,
34
+ payload: T(i.payload)
35
+ };
36
+ return typeof n == "function" ? m.createElement(
37
+ n,
38
+ s
39
+ ) : m.cloneElement(n, s);
40
+ };
41
+ }
42
+ const pt = m.forwardRef(
43
+ ({
44
+ className: n,
45
+ config: l,
46
+ data: i,
47
+ dataKeys: s,
48
+ comparisonKeys: f,
49
+ deltaBands: A,
50
+ xKey: E,
51
+ xAxisLabel: d,
52
+ yAxisLabel: h,
53
+ yUnit: F,
54
+ curve: c = "monotone",
55
+ lineStyle: u = "solid",
56
+ strokeWidth: M = 2,
57
+ showDots: k = !0,
58
+ connectNulls: D = !1,
59
+ showGrid: R = !0,
60
+ showTooltip: S = !0,
61
+ showLegend: N = !0,
62
+ showXAxis: j = !0,
63
+ showYAxis: z = !0,
64
+ xTickFormatter: I,
65
+ yTickFormatter: O,
66
+ xAxisAngle: r,
67
+ xAxisInterval: V,
68
+ yAxisTickCount: X,
69
+ yAxisDomain: G,
70
+ gridDashed: H,
71
+ gridHorizontal: P,
72
+ gridVertical: W,
73
+ tooltipContent: v,
74
+ ...Y
75
+ }, q) => {
76
+ const x = u === "dashed" ? "5 5" : void 0, J = ht(G), K = d || r != null ? 30 + (r != null ? 20 : 0) + (d ? 18 : 0) : void 0, L = m.useMemo(
77
+ () => v ? vt(v) : void 0,
78
+ [v]
79
+ ), Q = d ? { value: d, position: "insideBottom", offset: 0 } : void 0, U = h ? {
80
+ value: h,
81
+ angle: -90,
82
+ position: "insideLeft",
83
+ style: { textAnchor: "middle" }
84
+ } : void 0, o = (A ?? []).map(([t, a], p) => ({
85
+ field: `${$}${p}`,
86
+ current: t,
87
+ comparison: a
88
+ })), Z = o.length ? i.map((t) => {
89
+ const a = { ...t };
90
+ for (const { field: p, current: tt, comparison: et } of o) {
91
+ const y = t[tt], g = t[et];
92
+ a[p] = typeof y == "number" && typeof g == "number" ? [Math.min(y, g), Math.max(y, g)] : void 0;
93
+ }
94
+ return a;
95
+ }) : i, w = o.length > 0 ? ot : it;
96
+ return /* @__PURE__ */ e(
97
+ "div",
98
+ {
99
+ ref: q,
100
+ "data-curve": c,
101
+ "data-line-style": u,
102
+ className: mt(ut({ curve: c, lineStyle: u }), n),
103
+ ...Y,
104
+ children: /* @__PURE__ */ e(
105
+ ft,
106
+ {
107
+ config: l,
108
+ className: "size-full [&_.recharts-label]:fill-foreground",
109
+ children: /* @__PURE__ */ at(w, { data: Z, children: [
110
+ R && /* @__PURE__ */ e(
111
+ rt,
112
+ {
113
+ horizontal: P ?? !0,
114
+ vertical: W ?? !1,
115
+ strokeDasharray: H ? "3 3" : void 0
116
+ }
117
+ ),
118
+ /* @__PURE__ */ e(
119
+ lt,
120
+ {
121
+ dataKey: E,
122
+ type: "category",
123
+ hide: !j,
124
+ tickLine: !1,
125
+ axisLine: !1,
126
+ tickMargin: 8,
127
+ tickFormatter: I,
128
+ angle: r,
129
+ interval: V,
130
+ textAnchor: r != null ? r < 0 ? "end" : "start" : void 0,
131
+ height: K,
132
+ label: Q
133
+ }
134
+ ),
135
+ /* @__PURE__ */ e(
136
+ st,
137
+ {
138
+ type: "number",
139
+ hide: !z,
140
+ tickLine: !1,
141
+ axisLine: !1,
142
+ unit: F,
143
+ tickFormatter: O,
144
+ tickCount: X,
145
+ domain: J,
146
+ width: h ? 72 : void 0,
147
+ label: U
148
+ }
149
+ ),
150
+ S && (L ? (
151
+ // Strips the synthetic delta bands before the caller's tooltip
152
+ // sees them — the `__band_*` series feed the Areas, not the
153
+ // tooltip (a no-op when no bands are configured).
154
+ /* @__PURE__ */ e(C, { content: L })
155
+ ) : o.length > 0 ? /* @__PURE__ */ e(
156
+ C,
157
+ {
158
+ content: (t) => /* @__PURE__ */ e(
159
+ b,
160
+ {
161
+ active: t.active,
162
+ label: t.label,
163
+ payload: T(
164
+ t.payload
165
+ )
166
+ }
167
+ )
168
+ }
169
+ ) : /* @__PURE__ */ e(C, { content: /* @__PURE__ */ e(b, {}) })),
170
+ N && (o.length > 0 ? /* @__PURE__ */ e(
171
+ _,
172
+ {
173
+ content: (t) => /* @__PURE__ */ e(
174
+ B,
175
+ {
176
+ verticalAlign: t.verticalAlign,
177
+ payload: T(
178
+ t.payload
179
+ )
180
+ }
181
+ )
182
+ }
183
+ ) : /* @__PURE__ */ e(_, { content: /* @__PURE__ */ e(B, {}) })),
184
+ o.map(({ field: t, current: a }) => /* @__PURE__ */ e(
185
+ dt,
186
+ {
187
+ dataKey: t,
188
+ type: c ?? "monotone",
189
+ stroke: "none",
190
+ fill: `var(--color-${a})`,
191
+ fillOpacity: 0.12,
192
+ connectNulls: D,
193
+ dot: !1,
194
+ activeDot: !1,
195
+ isAnimationActive: !1,
196
+ legendType: "none",
197
+ tooltipType: "none"
198
+ },
199
+ t
200
+ )),
201
+ s.map((t) => {
202
+ const a = f == null ? void 0 : f.includes(t);
203
+ return /* @__PURE__ */ e(
204
+ ct,
205
+ {
206
+ type: c ?? "monotone",
207
+ dataKey: t,
208
+ stroke: `var(--color-${t})`,
209
+ strokeWidth: M,
210
+ strokeDasharray: a ? "5 5" : x,
211
+ strokeOpacity: a ? 0.5 : void 0,
212
+ dot: !a && k ? { r: 3 } : !1,
213
+ activeDot: !a && k ? { r: 5 } : !1,
214
+ connectNulls: D,
215
+ isAnimationActive: !1
216
+ },
217
+ t
218
+ );
219
+ })
220
+ ] })
221
+ }
222
+ )
223
+ }
224
+ );
225
+ }
226
+ );
227
+ pt.displayName = "LineChart";
228
+ export {
229
+ pt as LineChart,
230
+ vt as createBandStrippedTooltip,
231
+ T as dropBandSeries,
232
+ ut as lineChartVariants
233
+ };
234
+ //# sourceMappingURL=line-chart.js.map