@ensi-platform/admin-ui 0.5.0 → 0.6.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 (296) hide show
  1. package/dist/Component-CBWeJZfB.js +92 -0
  2. package/dist/Component-CBWeJZfB.js.map +1 -0
  3. package/dist/Component-DFwWbzFS.js +128 -0
  4. package/dist/Component-DFwWbzFS.js.map +1 -0
  5. package/dist/{Component-Bk0VFhAQ.js → Component-DhhrZEMr.js} +2 -2
  6. package/dist/{Component-Bk0VFhAQ.js.map → Component-DhhrZEMr.js.map} +1 -1
  7. package/dist/Component-Dkvzqo0L.js +155 -0
  8. package/dist/Component-Dkvzqo0L.js.map +1 -0
  9. package/dist/action-popup/index.js +1 -1
  10. package/dist/arrangement-settings/index.js +1 -1
  11. package/dist/assets/Component16.css +1 -1
  12. package/dist/assets/Component5.css +1 -1
  13. package/dist/assets/Component7.css +1 -1
  14. package/dist/assets/Component9.css +1 -1
  15. package/dist/assets/index.css +1 -1
  16. package/dist/assets/index17.css +1 -1
  17. package/dist/assets/index26.css +1 -1
  18. package/dist/assets/index27.css +1 -1
  19. package/dist/autocomplete/index.js +1 -1
  20. package/dist/autocomplete-async/index.js +1 -1
  21. package/dist/button/Component.d.ts +1 -1
  22. package/dist/button/Component.d.ts.map +1 -1
  23. package/dist/button/index.js +1 -1
  24. package/dist/button/theme.d.ts +1 -0
  25. package/dist/button/theme.d.ts.map +1 -1
  26. package/dist/button/types.d.ts +2 -0
  27. package/dist/button/types.d.ts.map +1 -1
  28. package/dist/checkbox/index.js +1 -1
  29. package/dist/checkbox-group/index.js +1 -1
  30. package/dist/data-table/index.js +1 -1
  31. package/dist/date-picker/index.js +1 -1
  32. package/dist/date-range-picker/index.js +1 -1
  33. package/dist/form/Component.d.ts +1 -1
  34. package/dist/form/Component.d.ts.map +1 -1
  35. package/dist/form/context.d.ts +3 -1
  36. package/dist/form/context.d.ts.map +1 -1
  37. package/dist/form/hooks/useFieldHook.d.ts +2 -1
  38. package/dist/form/hooks/useFieldHook.d.ts.map +1 -1
  39. package/dist/form/index.js +84 -74
  40. package/dist/form/index.js.map +1 -1
  41. package/dist/form/types.d.ts +15 -2
  42. package/dist/form/types.d.ts.map +1 -1
  43. package/dist/form/utils.d.ts +3 -0
  44. package/dist/form/utils.d.ts.map +1 -1
  45. package/dist/input/Component.d.ts +1 -1
  46. package/dist/input/Component.d.ts.map +1 -1
  47. package/dist/input/FormInput.d.ts +1 -1
  48. package/dist/input/FormInput.d.ts.map +1 -1
  49. package/dist/input/index.js +27 -25
  50. package/dist/input/index.js.map +1 -1
  51. package/dist/input/types.d.ts +5 -1
  52. package/dist/input/types.d.ts.map +1 -1
  53. package/dist/multi-autocomplete/index.js +1 -1
  54. package/dist/multi-autocomplete-async/index.js +1 -1
  55. package/dist/multi-select/index.js +1 -1
  56. package/dist/number-input/Component.d.ts +1 -1
  57. package/dist/number-input/Component.d.ts.map +1 -1
  58. package/dist/number-input/FormNumberInput.d.ts +1 -1
  59. package/dist/number-input/FormNumberInput.d.ts.map +1 -1
  60. package/dist/number-input/index.js +41 -39
  61. package/dist/number-input/index.js.map +1 -1
  62. package/dist/number-input/types.d.ts +5 -1
  63. package/dist/number-input/types.d.ts.map +1 -1
  64. package/dist/number-range/index.js +2 -2
  65. package/dist/select/index.js +1 -1
  66. package/dist/slider/index.js +1 -1
  67. package/dist/suggest-checklist/index.js +1 -1
  68. package/dist/switch/index.js +1 -1
  69. package/dist/table/index.js +1 -1
  70. package/dist/textarea/Component.d.ts +1 -1
  71. package/dist/textarea/Component.d.ts.map +1 -1
  72. package/dist/textarea/FormTextArea.d.ts +1 -1
  73. package/dist/textarea/FormTextArea.d.ts.map +1 -1
  74. package/dist/textarea/index.js +91 -86
  75. package/dist/textarea/index.js.map +1 -1
  76. package/dist/textarea/types.d.ts +5 -1
  77. package/dist/textarea/types.d.ts.map +1 -1
  78. package/dist/time-field/index.js +1 -1
  79. package/dist/useFieldHook-Bt9nST7g.js +52 -0
  80. package/dist/useFieldHook-Bt9nST7g.js.map +1 -0
  81. package/docs/README.md +3 -4
  82. package/docs/ai.md +42 -28
  83. package/docs/architecture.md +23 -23
  84. package/docs/design-language.md +103 -0
  85. package/docs/skills/SKILL.md +64 -25
  86. package/package.json +10 -6
  87. package/scripts/sync-agents-consumer.ts +2 -1
  88. package/src/button/docs/{Description.en.md → Description.md} +1 -0
  89. package/src/button/types.ts +2 -0
  90. package/src/cascade-menu/docs/cssVariables.ts +2 -1
  91. package/src/combobox/docs/Description.md +27 -0
  92. package/src/combobox/docs/Example.md +11 -0
  93. package/src/docs/ai/Description.md +60 -0
  94. package/src/docs/getting-started/Description.md +81 -0
  95. package/src/ds/tokens/docs/Description.md +30 -0
  96. package/src/ds/typography/docs/{Description.en.md → Description.md} +3 -3
  97. package/src/form/docs/{Description.en.md → Description.md} +2 -1
  98. package/src/form/types.ts +18 -3
  99. package/src/hooks/docs/Description.md +30 -0
  100. package/src/hooks/docs/Example.md +9 -0
  101. package/src/icons/docs/Description.md +23 -0
  102. package/src/icons/docs/Example.md +5 -0
  103. package/src/input/docs/{Description.en.md → Description.md} +3 -1
  104. package/src/input/docs/cssVariables.ts +1 -0
  105. package/src/input/types.ts +5 -1
  106. package/src/link/docs/cssVariables.ts +1 -1
  107. package/src/number-input/docs/{Description.en.md → Description.md} +3 -1
  108. package/src/number-input/docs/cssVariables.ts +1 -0
  109. package/src/number-input/types.ts +5 -0
  110. package/src/table/docs/cssVariables.ts +3 -3
  111. package/src/tabs/docs/{Description.en.md → Description.md} +17 -0
  112. package/src/textarea/docs/{Description.en.md → Description.md} +3 -1
  113. package/src/textarea/docs/cssVariables.ts +1 -0
  114. package/src/textarea/types.ts +5 -1
  115. package/src/toast/docs/cssVariables.ts +1 -1
  116. package/src/tooltip/docs/cssVariables.ts +2 -2
  117. package/dist/Component-BBFBVrTt.js +0 -152
  118. package/dist/Component-BBFBVrTt.js.map +0 -1
  119. package/dist/Component-C4pVS7OW.js +0 -125
  120. package/dist/Component-C4pVS7OW.js.map +0 -1
  121. package/dist/Component-VS3iDpxE.js +0 -85
  122. package/dist/Component-VS3iDpxE.js.map +0 -1
  123. package/dist/utils-CizYZV2a.js +0 -50
  124. package/dist/utils-CizYZV2a.js.map +0 -1
  125. package/docs/skills/evals/evals.json +0 -23
  126. package/src/action-popup/docs/Description.ru.md +0 -40
  127. package/src/action-popup/docs/Example.ru.md +0 -14
  128. package/src/active-filters/docs/Description.ru.md +0 -49
  129. package/src/active-filters/docs/Example.ru.md +0 -15
  130. package/src/arrangement-settings/docs/Description.ru.md +0 -25
  131. package/src/arrangement-settings/docs/Example.ru.md +0 -15
  132. package/src/autocomplete/docs/Description.ru.md +0 -51
  133. package/src/autocomplete/docs/Example.ru.md +0 -17
  134. package/src/autocomplete-async/docs/Description.ru.md +0 -71
  135. package/src/autocomplete-async/docs/Example.ru.md +0 -19
  136. package/src/avatar/docs/Description.ru.md +0 -23
  137. package/src/avatar/docs/Example.ru.md +0 -7
  138. package/src/badge/docs/Description.ru.md +0 -22
  139. package/src/badge/docs/Example.ru.md +0 -8
  140. package/src/bottom-sheet/docs/Description.ru.md +0 -27
  141. package/src/bottom-sheet/docs/Example.ru.md +0 -14
  142. package/src/button/docs/Description.ru.md +0 -24
  143. package/src/button/docs/Example.ru.md +0 -11
  144. package/src/cascade-menu/docs/Description.ru.md +0 -43
  145. package/src/cascade-menu/docs/Example.ru.md +0 -107
  146. package/src/checkbox/docs/Description.ru.md +0 -42
  147. package/src/checkbox/docs/Example.ru.md +0 -13
  148. package/src/checkbox-group/docs/Description.ru.md +0 -39
  149. package/src/checkbox-group/docs/Example.ru.md +0 -17
  150. package/src/context-menu/docs/Description.ru.md +0 -44
  151. package/src/context-menu/docs/Example.ru.md +0 -22
  152. package/src/data-table/docs/Description.ru.md +0 -33
  153. package/src/data-table/docs/Example.ru.md +0 -82
  154. package/src/date-picker/docs/Description.ru.md +0 -43
  155. package/src/date-picker/docs/Example.ru.md +0 -15
  156. package/src/date-range-picker/docs/Description.ru.md +0 -39
  157. package/src/date-range-picker/docs/Example.ru.md +0 -19
  158. package/src/drawer/docs/Description.ru.md +0 -28
  159. package/src/drawer/docs/Example.ru.md +0 -14
  160. package/src/ds/typography/docs/Description.ru.md +0 -35
  161. package/src/field/docs/Description.ru.md +0 -28
  162. package/src/field/docs/Example.ru.md +0 -16
  163. package/src/filters/docs/Description.ru.md +0 -40
  164. package/src/filters/docs/Example.ru.md +0 -21
  165. package/src/form/docs/Description.ru.md +0 -33
  166. package/src/form/docs/Example.ru.md +0 -18
  167. package/src/input/docs/Description.ru.md +0 -41
  168. package/src/input/docs/Example.ru.md +0 -21
  169. package/src/link/docs/Description.ru.md +0 -21
  170. package/src/link/docs/Example.ru.md +0 -16
  171. package/src/loader/docs/Description.ru.md +0 -21
  172. package/src/loader/docs/Example.ru.md +0 -10
  173. package/src/menu-list/docs/Description.ru.md +0 -45
  174. package/src/menu-list/docs/Example.ru.md +0 -14
  175. package/src/modal/docs/Description.ru.md +0 -25
  176. package/src/modal/docs/Example.ru.md +0 -15
  177. package/src/modal-hub/docs/Description.ru.md +0 -35
  178. package/src/modal-hub/docs/Example.ru.md +0 -20
  179. package/src/multi-autocomplete/docs/Description.ru.md +0 -52
  180. package/src/multi-autocomplete/docs/Example.ru.md +0 -12
  181. package/src/multi-autocomplete-async/docs/Description.ru.md +0 -55
  182. package/src/multi-autocomplete-async/docs/Example.ru.md +0 -5
  183. package/src/multi-select/docs/Description.ru.md +0 -46
  184. package/src/multi-select/docs/Example.ru.md +0 -20
  185. package/src/number-input/docs/Description.ru.md +0 -46
  186. package/src/number-input/docs/Example.ru.md +0 -19
  187. package/src/number-range/docs/Description.ru.md +0 -49
  188. package/src/number-range/docs/Example.ru.md +0 -25
  189. package/src/popover/docs/Description.ru.md +0 -33
  190. package/src/popover/docs/Example.ru.md +0 -13
  191. package/src/provider/docs/Description.ru.md +0 -27
  192. package/src/provider/docs/Example.ru.md +0 -10
  193. package/src/select/docs/Description.ru.md +0 -46
  194. package/src/select/docs/Example.ru.md +0 -20
  195. package/src/slider/docs/Description.ru.md +0 -45
  196. package/src/slider/docs/Example.ru.md +0 -17
  197. package/src/suggest-checklist/docs/Description.ru.md +0 -26
  198. package/src/suggest-checklist/docs/Example.ru.md +0 -11
  199. package/src/switch/docs/Description.ru.md +0 -39
  200. package/src/switch/docs/Example.ru.md +0 -13
  201. package/src/table/docs/Description.ru.md +0 -32
  202. package/src/table/docs/Example.ru.md +0 -67
  203. package/src/tabs/docs/Description.ru.md +0 -24
  204. package/src/tabs/docs/Example.ru.md +0 -12
  205. package/src/tag/docs/Description.ru.md +0 -24
  206. package/src/tag/docs/Example.ru.md +0 -6
  207. package/src/textarea/docs/Description.ru.md +0 -40
  208. package/src/textarea/docs/Example.ru.md +0 -21
  209. package/src/time-field/docs/Description.ru.md +0 -41
  210. package/src/time-field/docs/Example.ru.md +0 -9
  211. package/src/toast/docs/Description.ru.md +0 -57
  212. package/src/toast/docs/Example.ru.md +0 -25
  213. package/src/tooltip/docs/Description.ru.md +0 -34
  214. package/src/tooltip/docs/Example.ru.md +0 -10
  215. /package/src/action-popup/docs/{Description.en.md → Description.md} +0 -0
  216. /package/src/action-popup/docs/{Example.en.md → Example.md} +0 -0
  217. /package/src/active-filters/docs/{Description.en.md → Description.md} +0 -0
  218. /package/src/active-filters/docs/{Example.en.md → Example.md} +0 -0
  219. /package/src/arrangement-settings/docs/{Description.en.md → Description.md} +0 -0
  220. /package/src/arrangement-settings/docs/{Example.en.md → Example.md} +0 -0
  221. /package/src/autocomplete/docs/{Description.en.md → Description.md} +0 -0
  222. /package/src/autocomplete/docs/{Example.en.md → Example.md} +0 -0
  223. /package/src/autocomplete-async/docs/{Description.en.md → Description.md} +0 -0
  224. /package/src/autocomplete-async/docs/{Example.en.md → Example.md} +0 -0
  225. /package/src/avatar/docs/{Description.en.md → Description.md} +0 -0
  226. /package/src/avatar/docs/{Example.en.md → Example.md} +0 -0
  227. /package/src/badge/docs/{Description.en.md → Description.md} +0 -0
  228. /package/src/badge/docs/{Example.en.md → Example.md} +0 -0
  229. /package/src/bottom-sheet/docs/{Description.en.md → Description.md} +0 -0
  230. /package/src/bottom-sheet/docs/{Example.en.md → Example.md} +0 -0
  231. /package/src/button/docs/{Example.en.md → Example.md} +0 -0
  232. /package/src/cascade-menu/docs/{Description.en.md → Description.md} +0 -0
  233. /package/src/cascade-menu/docs/{Example.en.md → Example.md} +0 -0
  234. /package/src/checkbox/docs/{Description.en.md → Description.md} +0 -0
  235. /package/src/checkbox/docs/{Example.en.md → Example.md} +0 -0
  236. /package/src/checkbox-group/docs/{Description.en.md → Description.md} +0 -0
  237. /package/src/checkbox-group/docs/{Example.en.md → Example.md} +0 -0
  238. /package/src/context-menu/docs/{Description.en.md → Description.md} +0 -0
  239. /package/src/context-menu/docs/{Example.en.md → Example.md} +0 -0
  240. /package/src/data-table/docs/{Description.en.md → Description.md} +0 -0
  241. /package/src/data-table/docs/{Example.en.md → Example.md} +0 -0
  242. /package/src/date-picker/docs/{Description.en.md → Description.md} +0 -0
  243. /package/src/date-picker/docs/{Example.en.md → Example.md} +0 -0
  244. /package/src/date-range-picker/docs/{Description.en.md → Description.md} +0 -0
  245. /package/src/date-range-picker/docs/{Example.en.md → Example.md} +0 -0
  246. /package/src/drawer/docs/{Description.en.md → Description.md} +0 -0
  247. /package/src/drawer/docs/{Example.en.md → Example.md} +0 -0
  248. /package/src/field/docs/{Description.en.md → Description.md} +0 -0
  249. /package/src/field/docs/{Example.en.md → Example.md} +0 -0
  250. /package/src/filters/docs/{Description.en.md → Description.md} +0 -0
  251. /package/src/filters/docs/{Example.en.md → Example.md} +0 -0
  252. /package/src/form/docs/{Example.en.md → Example.md} +0 -0
  253. /package/src/input/docs/{Example.en.md → Example.md} +0 -0
  254. /package/src/link/docs/{Description.en.md → Description.md} +0 -0
  255. /package/src/link/docs/{Example.en.md → Example.md} +0 -0
  256. /package/src/loader/docs/{Description.en.md → Description.md} +0 -0
  257. /package/src/loader/docs/{Example.en.md → Example.md} +0 -0
  258. /package/src/menu-list/docs/{Description.en.md → Description.md} +0 -0
  259. /package/src/menu-list/docs/{Example.en.md → Example.md} +0 -0
  260. /package/src/modal/docs/{Description.en.md → Description.md} +0 -0
  261. /package/src/modal/docs/{Example.en.md → Example.md} +0 -0
  262. /package/src/modal-hub/docs/{Description.en.md → Description.md} +0 -0
  263. /package/src/modal-hub/docs/{Example.en.md → Example.md} +0 -0
  264. /package/src/multi-autocomplete/docs/{Description.en.md → Description.md} +0 -0
  265. /package/src/multi-autocomplete/docs/{Example.en.md → Example.md} +0 -0
  266. /package/src/multi-autocomplete-async/docs/{Description.en.md → Description.md} +0 -0
  267. /package/src/multi-autocomplete-async/docs/{Example.en.md → Example.md} +0 -0
  268. /package/src/multi-select/docs/{Description.en.md → Description.md} +0 -0
  269. /package/src/multi-select/docs/{Example.en.md → Example.md} +0 -0
  270. /package/src/number-input/docs/{Example.en.md → Example.md} +0 -0
  271. /package/src/number-range/docs/{Description.en.md → Description.md} +0 -0
  272. /package/src/number-range/docs/{Example.en.md → Example.md} +0 -0
  273. /package/src/popover/docs/{Description.en.md → Description.md} +0 -0
  274. /package/src/popover/docs/{Example.en.md → Example.md} +0 -0
  275. /package/src/provider/docs/{Description.en.md → Description.md} +0 -0
  276. /package/src/provider/docs/{Example.en.md → Example.md} +0 -0
  277. /package/src/select/docs/{Description.en.md → Description.md} +0 -0
  278. /package/src/select/docs/{Example.en.md → Example.md} +0 -0
  279. /package/src/slider/docs/{Description.en.md → Description.md} +0 -0
  280. /package/src/slider/docs/{Example.en.md → Example.md} +0 -0
  281. /package/src/suggest-checklist/docs/{Description.en.md → Description.md} +0 -0
  282. /package/src/suggest-checklist/docs/{Example.en.md → Example.md} +0 -0
  283. /package/src/switch/docs/{Description.en.md → Description.md} +0 -0
  284. /package/src/switch/docs/{Example.en.md → Example.md} +0 -0
  285. /package/src/table/docs/{Description.en.md → Description.md} +0 -0
  286. /package/src/table/docs/{Example.en.md → Example.md} +0 -0
  287. /package/src/tabs/docs/{Example.en.md → Example.md} +0 -0
  288. /package/src/tag/docs/{Description.en.md → Description.md} +0 -0
  289. /package/src/tag/docs/{Example.en.md → Example.md} +0 -0
  290. /package/src/textarea/docs/{Example.en.md → Example.md} +0 -0
  291. /package/src/time-field/docs/{Description.en.md → Description.md} +0 -0
  292. /package/src/time-field/docs/{Example.en.md → Example.md} +0 -0
  293. /package/src/toast/docs/{Description.en.md → Description.md} +0 -0
  294. /package/src/toast/docs/{Example.en.md → Example.md} +0 -0
  295. /package/src/tooltip/docs/{Description.en.md → Description.md} +0 -0
  296. /package/src/tooltip/docs/{Example.en.md → Example.md} +0 -0
@@ -1,30 +1,30 @@
1
- import { jsxs as T, jsx as a } from "react/jsx-runtime";
1
+ import { jsxs as E, jsx as s } from "react/jsx-runtime";
2
2
  import { useRef as N, useState as V } from "react";
3
- import b from "classnames";
3
+ import x from "classnames";
4
4
  import { Group as w, TextArea as H } from "react-aria-components";
5
- import { s as I } from "../index-h8z54aFR.js";
5
+ import { s as F } from "../index-h8z54aFR.js";
6
6
  import { C as B } from "../Clear-DcxADxz6.js";
7
- import { u as R } from "../hooks-BAkrGC45.js";
7
+ import { u as O } from "../hooks-BAkrGC45.js";
8
8
  import { cva as j } from "class-variance-authority";
9
- import { typographyStyles as v } from "../typography/index.js";
10
- import { F as y, u as z } from "../Component-BPN5FgKq.js";
11
- import { u as L, g as M } from "../utils-CizYZV2a.js";
12
- import '../assets/index17.css';const O = "aub_styles-module_root_6dcd6", G = "aub_styles-module_block_9fd7b", U = "aub_styles-module_sm_8e3c9", $ = "aub_styles-module_md_9f5d6", q = "aub_styles-module_lg_459d3", J = "aub_styles-module_fieldInput_f9bcf", K = "aub_styles-module_clear_97555", Q = "aub_styles-module_clearIcon_dd0fc", W = "aub_styles-module_primary_af5fb", o = {
13
- root: O,
14
- block: G,
15
- sm: U,
16
- md: $,
17
- lg: q,
18
- fieldInput: J,
19
- clear: K,
20
- clearIcon: Q,
21
- primary: W
22
- }, X = j(o.root, {
9
+ import { typographyStyles as k } from "../typography/index.js";
10
+ import { F as g, u as z } from "../Component-BPN5FgKq.js";
11
+ import { u as L, g as M } from "../useFieldHook-Bt9nST7g.js";
12
+ import '../assets/index17.css';const G = "aub_styles-module_root_6dcd6", U = "aub_styles-module_block_9fd7b", $ = "aub_styles-module_sm_8e3c9", q = "aub_styles-module_md_9f5d6", J = "aub_styles-module_lg_459d3", K = "aub_styles-module_fieldInput_f9bcf", Q = "aub_styles-module_clear_97555", W = "aub_styles-module_clearIcon_dd0fc", X = "aub_styles-module_primary_af5fb", o = {
13
+ root: G,
14
+ block: U,
15
+ sm: $,
16
+ md: q,
17
+ lg: J,
18
+ fieldInput: K,
19
+ clear: Q,
20
+ clearIcon: W,
21
+ primary: X
22
+ }, Y = j(o.root, {
23
23
  variants: {
24
24
  size: {
25
- sm: b(o.sm, v.bodyS),
26
- md: b(o.md, v.bodyS),
27
- lg: b(o.lg, v.bodyM)
25
+ sm: x(o.sm, k.bodyS),
26
+ md: x(o.md, k.bodyS),
27
+ lg: x(o.lg, k.bodyM)
28
28
  },
29
29
  variant: {
30
30
  primary: o.primary
@@ -39,22 +39,22 @@ import '../assets/index17.css';const O = "aub_styles-module_root_6dcd6", G = "au
39
39
  variant: "primary",
40
40
  block: !0
41
41
  }
42
- }), Y = (e) => ({
42
+ }), Z = (e) => ({
43
43
  target: e ?? { value: "" },
44
44
  currentTarget: e ?? { value: "" }
45
- }), Z = (e) => {
45
+ }), ee = (e) => {
46
46
  if (!e)
47
47
  return;
48
48
  Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, "value")?.set?.call(e, "");
49
- }, C = (e) => e == null ? "" : String(e), ee = (e, t) => {
49
+ }, D = (e) => e == null ? "" : String(e), te = (e, t) => {
50
50
  if (typeof e == "function") {
51
51
  e(t);
52
52
  return;
53
53
  }
54
54
  e && (e.current = t);
55
- }, te = ({ onClear: e }) => {
56
- const { clear: t } = R();
57
- return /* @__PURE__ */ a(
55
+ }, re = ({ onClear: e }) => {
56
+ const { clear: t } = O();
57
+ return /* @__PURE__ */ s(
58
58
  "button",
59
59
  {
60
60
  type: "button",
@@ -66,108 +66,113 @@ import '../assets/index17.css';const O = "aub_styles-module_root_6dcd6", G = "au
66
66
  onClick: (r) => {
67
67
  r.preventDefault(), r.stopPropagation(), e();
68
68
  },
69
- children: /* @__PURE__ */ a(B, { className: o.clearIcon })
69
+ children: /* @__PURE__ */ s(B, { className: o.clearIcon })
70
70
  }
71
71
  );
72
- }, k = I(
72
+ }, P = F(
73
73
  ({
74
74
  ref: e,
75
75
  size: t = "md",
76
76
  variant: r = "primary",
77
- block: u = !0,
77
+ block: i = !0,
78
78
  invalid: l = !1,
79
- disabled: m = !1,
80
- clear: _ = !1,
81
- className: g,
82
- dataTestId: x,
83
- value: n,
79
+ disabled: u = !1,
80
+ readOnly: n = !1,
81
+ clear: h = !1,
82
+ className: v,
83
+ dataTestId: A,
84
+ value: c,
84
85
  defaultValue: p,
85
- onChange: d,
86
- ...h
86
+ onChange: f,
87
+ ...C
87
88
  }) => {
88
- const f = N(null), c = n !== void 0, [A, i] = V(() => C(p)), E = c ? C(n) : A, F = _ && !m && E !== "", P = (s) => {
89
- c || i(s.target.value), d?.(s);
90
- }, S = () => {
91
- const s = f.current, D = Y(s);
92
- Z(s), c || i(""), d?.(D);
89
+ const y = N(null), m = c !== void 0, [T, b] = V(() => D(p)), _ = m ? D(c) : T, I = h && !u && !n && _ !== "", R = (a) => {
90
+ m || b(a.target.value), f?.(a);
91
+ }, d = () => {
92
+ const a = y.current, S = Z(a);
93
+ ee(a), m || b(""), f?.(S);
93
94
  };
94
- return /* @__PURE__ */ T(
95
+ return /* @__PURE__ */ E(
95
96
  w,
96
97
  {
97
- className: b(X({ size: t, variant: r, block: u }), g),
98
- "data-test-id": x,
98
+ className: x(Y({ size: t, variant: r, block: i }), v),
99
+ "data-test-id": A,
99
100
  isInvalid: l,
100
- isDisabled: m,
101
+ isDisabled: u,
102
+ isReadOnly: n,
101
103
  children: [
102
- /* @__PURE__ */ a(
104
+ /* @__PURE__ */ s(
103
105
  H,
104
106
  {
105
- ...h,
106
- ref: (s) => {
107
- f.current = s, ee(e, s);
107
+ ...C,
108
+ readOnly: n,
109
+ ref: (a) => {
110
+ y.current = a, te(e, a);
108
111
  },
109
- value: n,
112
+ value: c,
110
113
  defaultValue: p,
111
- onChange: P,
112
- disabled: m,
114
+ onChange: R,
115
+ disabled: u,
113
116
  "aria-invalid": l || void 0,
114
117
  className: o.fieldInput
115
118
  }
116
119
  ),
117
- F ? /* @__PURE__ */ a(te, { onClear: S }) : null
120
+ I ? /* @__PURE__ */ s(re, { onClear: d }) : null
118
121
  ]
119
122
  }
120
123
  );
121
124
  }
122
125
  );
123
- k.displayName = "TextArea";
124
- const re = I((e) => {
125
- const { controlProps: t, size: r, invalid: u, disabled: l } = z();
126
- return /* @__PURE__ */ a(k, { ...t, size: r, invalid: u, disabled: l, ...e });
127
- }), oe = ({
126
+ P.displayName = "TextArea";
127
+ const oe = F((e) => {
128
+ const { controlProps: t, size: r, invalid: i, disabled: l } = z();
129
+ return /* @__PURE__ */ s(P, { ...e, ...t, size: r, invalid: i, disabled: l });
130
+ }), se = ({
128
131
  name: e,
129
132
  label: t,
130
133
  hint: r,
131
- size: u = "md",
134
+ size: i = "md",
132
135
  block: l = !0,
133
- disabled: m,
134
- className: _,
135
- dataTestId: g,
136
- ...x
136
+ disabled: u,
137
+ readOnly: n,
138
+ className: h,
139
+ dataTestId: v,
140
+ ...A
137
141
  }) => {
138
- const { field: n, fieldState: p, inputProps: d, onChangeHandler: h, onBlurHandler: f } = L({ name: e }), c = M(p.error)?.message, A = m ?? d.disabled;
139
- return /* @__PURE__ */ T(
140
- y,
142
+ const { field: c, fieldState: p, inputProps: f, onChangeHandler: C, onBlurHandler: y } = L({ name: e }), { disabled: m, readOnly: T, ...b } = f, _ = M(p.error)?.message, I = u ?? m, R = n !== void 0 ? n : T;
143
+ return /* @__PURE__ */ E(
144
+ g,
141
145
  {
142
- invalid: !!c,
143
- disabled: A,
144
- size: u,
146
+ invalid: !!_,
147
+ disabled: I,
148
+ size: i,
145
149
  block: l,
146
- className: _,
147
- dataTestId: g,
150
+ className: h,
151
+ dataTestId: v,
148
152
  children: [
149
- t ? /* @__PURE__ */ a(y.Label, { children: t }) : null,
150
- /* @__PURE__ */ a(
151
- re,
153
+ t ? /* @__PURE__ */ s(g.Label, { children: t }) : null,
154
+ /* @__PURE__ */ s(
155
+ oe,
152
156
  {
153
- ...x,
154
- ...d,
157
+ ...A,
158
+ ...b,
159
+ readOnly: R || void 0,
155
160
  block: l,
156
- ref: n.ref,
157
- value: n.value ?? "",
158
- onChange: (i) => h(i),
159
- onBlur: (i) => f(i)
161
+ ref: c.ref,
162
+ value: c.value ?? "",
163
+ onChange: (d) => C(d),
164
+ onBlur: (d) => y(d)
160
165
  }
161
166
  ),
162
- r ? /* @__PURE__ */ a(y.Hint, { children: r }) : null,
163
- /* @__PURE__ */ a(y.Error, { children: c })
167
+ r ? /* @__PURE__ */ s(g.Hint, { children: r }) : null,
168
+ /* @__PURE__ */ s(g.Error, { children: _ })
164
169
  ]
165
170
  }
166
171
  );
167
172
  };
168
- oe.displayName = "FormTextArea";
173
+ se.displayName = "FormTextArea";
169
174
  export {
170
- oe as FormTextArea,
171
- k as TextArea
175
+ se as FormTextArea,
176
+ P as TextArea
172
177
  };
173
178
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/textarea/theme.ts","../../src/textarea/utils.ts","../../src/textarea/Component.tsx","../../src/textarea/FormTextArea.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority';\nimport cn from 'classnames';\n\nimport { typographyStyles } from '@ds/typography';\n\nimport styles from './styles.module.css';\n\nexport const textAreaVariants = cva(styles.root, {\n variants: {\n size: {\n sm: cn(styles.sm, typographyStyles.bodyS),\n md: cn(styles.md, typographyStyles.bodyS),\n lg: cn(styles.lg, typographyStyles.bodyM),\n },\n variant: {\n primary: styles.primary,\n },\n block: {\n true: styles.block,\n false: null,\n },\n },\n defaultVariants: {\n size: 'md',\n variant: 'primary',\n block: true,\n },\n});\n","import { type ChangeEvent } from 'react';\n\n/** Synthetic change event used by clear control. */\nexport const toEmptyTextAreaChangeEvent = (el: HTMLTextAreaElement | null): ChangeEvent<HTMLTextAreaElement> =>\n ({\n target: el ?? { value: '' },\n currentTarget: el ?? { value: '' },\n }) as ChangeEvent<HTMLTextAreaElement>;\n\n/** Sets native textarea value via the prototype setter when the node exists. */\nexport const clearTextAreaElementValue = (el: HTMLTextAreaElement | null) => {\n if (!el) {\n return;\n }\n\n const setter = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, 'value')?.set;\n setter?.call(el, '');\n};\n","import { type ChangeEventHandler, useRef, useState } from 'react';\n\nimport cn from 'classnames';\nimport { Group, TextArea as RacTextArea } from 'react-aria-components';\n\nimport { supportRef } from '@ds/common/support-ref';\n\nimport { Clear } from '@/icons';\nimport { useAuiLabels } from '@/provider';\n\nimport { textAreaVariants } from './theme';\nimport { type ITextAreaProps } from './types';\nimport { clearTextAreaElementValue, toEmptyTextAreaChangeEvent } from './utils';\n\nimport styles from './styles.module.css';\n\nconst toStringValue = (value: unknown) => (value == null ? '' : String(value));\n\nconst assignRef = <T,>(ref: ITextAreaProps['ref'], node: T | null) => {\n if (typeof ref === 'function') {\n ref(node as never);\n return;\n }\n\n if (ref) {\n ref.current = node as never;\n }\n};\n\nconst TextAreaClearButton = ({ onClear }: { onClear: () => void }) => {\n const { clear } = useAuiLabels();\n\n return (\n <button\n type=\"button\"\n className={styles.clear}\n aria-label={clear}\n onPointerDown={event => {\n event.preventDefault();\n event.stopPropagation();\n }}\n onClick={event => {\n event.preventDefault();\n event.stopPropagation();\n onClear();\n }}\n >\n <Clear className={styles.clearIcon} />\n </button>\n );\n};\n\nexport const TextArea = supportRef(\n ({\n ref,\n size = 'md',\n variant = 'primary',\n block = true,\n invalid = false,\n disabled = false,\n clear = false,\n className,\n dataTestId,\n value,\n defaultValue,\n onChange,\n ...props\n }: ITextAreaProps) => {\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n const isControlled = value !== undefined;\n const [uncontrolledValue, setUncontrolledValue] = useState(() => toStringValue(defaultValue));\n const currentValue = isControlled ? toStringValue(value) : uncontrolledValue;\n const showClear = clear && !disabled && currentValue !== '';\n\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = event => {\n if (!isControlled) {\n setUncontrolledValue(event.target.value);\n }\n\n onChange?.(event);\n };\n\n const emitEmptyChange = () => {\n const el = textAreaRef.current;\n const event = toEmptyTextAreaChangeEvent(el);\n\n clearTextAreaElementValue(el);\n\n if (!isControlled) {\n setUncontrolledValue('');\n }\n\n onChange?.(event);\n };\n\n return (\n <Group\n className={cn(textAreaVariants({ size, variant, block }), className)}\n data-test-id={dataTestId}\n isInvalid={invalid}\n isDisabled={disabled}\n >\n <RacTextArea\n {...props}\n ref={node => {\n textAreaRef.current = node;\n assignRef(ref, node);\n }}\n value={value}\n defaultValue={defaultValue}\n onChange={handleChange}\n disabled={disabled}\n aria-invalid={invalid || undefined}\n className={styles.fieldInput}\n />\n {showClear ? <TextAreaClearButton onClear={emitEmptyChange} /> : null}\n </Group>\n );\n }\n);\n\nTextArea.displayName = 'TextArea';\n","import { type ComponentProps } from 'react';\n\nimport { supportRef } from '@ds/common/support-ref';\n\nimport { Field, useField } from '@/field';\nimport { useFieldHook } from '@/form/hooks/useFieldHook';\nimport { getError } from '@/form/utils';\n\nimport { TextArea } from './Component';\nimport { type IFormTextAreaProps } from './types';\n\ntype TFormTextAreaControlProps = Omit<ComponentProps<typeof TextArea>, 'size' | 'invalid' | 'disabled'>;\n\nconst FormTextAreaControl = supportRef((props: TFormTextAreaControlProps) => {\n const { controlProps, size, invalid, disabled } = useField();\n\n return <TextArea {...controlProps} size={size} invalid={invalid} disabled={disabled} {...props} />;\n});\n\nexport const FormTextArea = ({\n name,\n label,\n hint,\n size = 'md',\n block = true,\n disabled,\n className,\n dataTestId,\n ...textAreaProps\n}: IFormTextAreaProps) => {\n const { field, fieldState, inputProps: rhfInputProps, onChangeHandler, onBlurHandler } = useFieldHook({ name });\n const error = getError(fieldState.error)?.message;\n const isDisabled = disabled ?? rhfInputProps.disabled;\n\n return (\n <Field\n invalid={Boolean(error)}\n disabled={isDisabled}\n size={size}\n block={block}\n className={className}\n dataTestId={dataTestId}\n >\n {label ? <Field.Label>{label}</Field.Label> : null}\n <FormTextAreaControl\n {...textAreaProps}\n {...rhfInputProps}\n block={block}\n ref={field.ref}\n value={field.value ?? ''}\n onChange={e => onChangeHandler(e)}\n onBlur={e => onBlurHandler(e)}\n />\n {hint ? <Field.Hint>{hint}</Field.Hint> : null}\n <Field.Error>{error}</Field.Error>\n </Field>\n );\n};\n\nFormTextArea.displayName = 'FormTextArea';\n"],"names":["textAreaVariants","cva","styles","cn","typographyStyles","toEmptyTextAreaChangeEvent","el","clearTextAreaElementValue","toStringValue","value","assignRef","ref","node","TextAreaClearButton","onClear","clear","useAuiLabels","jsx","event","Clear","TextArea","supportRef","size","variant","block","invalid","disabled","className","dataTestId","defaultValue","onChange","props","textAreaRef","useRef","isControlled","uncontrolledValue","setUncontrolledValue","useState","currentValue","showClear","handleChange","emitEmptyChange","jsxs","Group","RacTextArea","FormTextAreaControl","controlProps","useField","FormTextArea","name","label","hint","textAreaProps","field","fieldState","rhfInputProps","onChangeHandler","onBlurHandler","useFieldHook","error","getError","isDisabled","Field","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;GAOaA,IAAmBC,EAAIC,EAAO,MAAM;AAAA,EAC7C,UAAU;AAAA,IACN,MAAM;AAAA,MACF,IAAIC,EAAGD,EAAO,IAAIE,EAAiB,KAAK;AAAA,MACxC,IAAID,EAAGD,EAAO,IAAIE,EAAiB,KAAK;AAAA,MACxC,IAAID,EAAGD,EAAO,IAAIE,EAAiB,KAAK;AAAA,IAAA;AAAA,IAE5C,SAAS;AAAA,MACL,SAASF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AOA,EAAM,SAAS;AAAA,YACtB,UAAU,CAAAU,MAAKP,EAAgBO,CAAC;AAAA,YAChC,QAAQ,CAAAA,MAAKN,EAAcM,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,QAE/BZ,IAAO,gBAAAlC,EAAC6C,EAAM,MAAN,EAAY,aAAK,IAAgB;AAAA,QAC1C,gBAAA7C,EAAC6C,EAAM,OAAN,EAAa,UAAAH,EAAA,CAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGhC;AAEAX,GAAa,cAAc;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/textarea/theme.ts","../../src/textarea/utils.ts","../../src/textarea/Component.tsx","../../src/textarea/FormTextArea.tsx"],"sourcesContent":["import { cva } from 'class-variance-authority';\nimport cn from 'classnames';\n\nimport { typographyStyles } from '@ds/typography';\n\nimport styles from './styles.module.css';\n\nexport const textAreaVariants = cva(styles.root, {\n variants: {\n size: {\n sm: cn(styles.sm, typographyStyles.bodyS),\n md: cn(styles.md, typographyStyles.bodyS),\n lg: cn(styles.lg, typographyStyles.bodyM),\n },\n variant: {\n primary: styles.primary,\n },\n block: {\n true: styles.block,\n false: null,\n },\n },\n defaultVariants: {\n size: 'md',\n variant: 'primary',\n block: true,\n },\n});\n","import { type ChangeEvent } from 'react';\n\n/** Synthetic change event used by clear control. */\nexport const toEmptyTextAreaChangeEvent = (el: HTMLTextAreaElement | null): ChangeEvent<HTMLTextAreaElement> =>\n ({\n target: el ?? { value: '' },\n currentTarget: el ?? { value: '' },\n }) as ChangeEvent<HTMLTextAreaElement>;\n\n/** Sets native textarea value via the prototype setter when the node exists. */\nexport const clearTextAreaElementValue = (el: HTMLTextAreaElement | null) => {\n if (!el) {\n return;\n }\n\n const setter = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, 'value')?.set;\n setter?.call(el, '');\n};\n","import { type ChangeEventHandler, useRef, useState } from 'react';\n\nimport cn from 'classnames';\nimport { Group, TextArea as RacTextArea } from 'react-aria-components';\n\nimport { supportRef } from '@ds/common/support-ref';\n\nimport { Clear } from '@/icons';\nimport { useAuiLabels } from '@/provider';\n\nimport { textAreaVariants } from './theme';\nimport { type ITextAreaProps } from './types';\nimport { clearTextAreaElementValue, toEmptyTextAreaChangeEvent } from './utils';\n\nimport styles from './styles.module.css';\n\nconst toStringValue = (value: unknown) => (value == null ? '' : String(value));\n\nconst assignRef = <T,>(ref: ITextAreaProps['ref'], node: T | null) => {\n if (typeof ref === 'function') {\n ref(node as never);\n return;\n }\n\n if (ref) {\n ref.current = node as never;\n }\n};\n\nconst TextAreaClearButton = ({ onClear }: { onClear: () => void }) => {\n const { clear } = useAuiLabels();\n\n return (\n <button\n type=\"button\"\n className={styles.clear}\n aria-label={clear}\n onPointerDown={event => {\n event.preventDefault();\n event.stopPropagation();\n }}\n onClick={event => {\n event.preventDefault();\n event.stopPropagation();\n onClear();\n }}\n >\n <Clear className={styles.clearIcon} />\n </button>\n );\n};\n\nexport const TextArea = supportRef(\n ({\n ref,\n size = 'md',\n variant = 'primary',\n block = true,\n invalid = false,\n disabled = false,\n readOnly = false,\n clear = false,\n className,\n dataTestId,\n value,\n defaultValue,\n onChange,\n ...props\n }: ITextAreaProps) => {\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n const isControlled = value !== undefined;\n const [uncontrolledValue, setUncontrolledValue] = useState(() => toStringValue(defaultValue));\n const currentValue = isControlled ? toStringValue(value) : uncontrolledValue;\n const showClear = clear && !disabled && !readOnly && currentValue !== '';\n\n const handleChange: ChangeEventHandler<HTMLTextAreaElement> = event => {\n if (!isControlled) {\n setUncontrolledValue(event.target.value);\n }\n\n onChange?.(event);\n };\n\n const emitEmptyChange = () => {\n const el = textAreaRef.current;\n const event = toEmptyTextAreaChangeEvent(el);\n\n clearTextAreaElementValue(el);\n\n if (!isControlled) {\n setUncontrolledValue('');\n }\n\n onChange?.(event);\n };\n\n return (\n <Group\n className={cn(textAreaVariants({ size, variant, block }), className)}\n data-test-id={dataTestId}\n isInvalid={invalid}\n isDisabled={disabled}\n isReadOnly={readOnly}\n >\n <RacTextArea\n {...props}\n readOnly={readOnly}\n ref={node => {\n textAreaRef.current = node;\n assignRef(ref, node);\n }}\n value={value}\n defaultValue={defaultValue}\n onChange={handleChange}\n disabled={disabled}\n aria-invalid={invalid || undefined}\n className={styles.fieldInput}\n />\n {showClear ? <TextAreaClearButton onClear={emitEmptyChange} /> : null}\n </Group>\n );\n }\n);\n\nTextArea.displayName = 'TextArea';\n","import { type ComponentProps } from 'react';\n\nimport { supportRef } from '@ds/common/support-ref';\n\nimport { Field, useField } from '@/field';\nimport { useFieldHook } from '@/form/hooks/useFieldHook';\nimport { getError } from '@/form/utils';\n\nimport { TextArea } from './Component';\nimport { type IFormTextAreaProps } from './types';\n\ntype TFormTextAreaControlProps = Omit<ComponentProps<typeof TextArea>, 'size' | 'invalid' | 'disabled'>;\n\nconst FormTextAreaControl = supportRef((props: TFormTextAreaControlProps) => {\n const { controlProps, size, invalid, disabled } = useField();\n\n return <TextArea {...props} {...controlProps} size={size} invalid={invalid} disabled={disabled} />;\n});\n\nexport const FormTextArea = ({\n name,\n label,\n hint,\n size = 'md',\n block = true,\n disabled,\n readOnly,\n className,\n dataTestId,\n ...textAreaProps\n}: IFormTextAreaProps) => {\n const { field, fieldState, inputProps: rhfInputProps, onChangeHandler, onBlurHandler } = useFieldHook({ name });\n const { disabled: formDisabled, readOnly: formReadOnly, ...restRhf } = rhfInputProps;\n const error = getError(fieldState.error)?.message;\n const isDisabled = disabled ?? formDisabled;\n const isReadOnly = readOnly !== undefined ? readOnly : formReadOnly;\n\n return (\n <Field\n invalid={Boolean(error)}\n disabled={isDisabled}\n size={size}\n block={block}\n className={className}\n dataTestId={dataTestId}\n >\n {label ? <Field.Label>{label}</Field.Label> : null}\n <FormTextAreaControl\n {...textAreaProps}\n {...restRhf}\n readOnly={isReadOnly || undefined}\n block={block}\n ref={field.ref}\n value={field.value ?? ''}\n onChange={e => onChangeHandler(e)}\n onBlur={e => onBlurHandler(e)}\n />\n {hint ? <Field.Hint>{hint}</Field.Hint> : null}\n <Field.Error>{error}</Field.Error>\n </Field>\n );\n};\n\nFormTextArea.displayName = 'FormTextArea';\n"],"names":["textAreaVariants","cva","styles","cn","typographyStyles","toEmptyTextAreaChangeEvent","el","clearTextAreaElementValue","toStringValue","value","assignRef","ref","node","TextAreaClearButton","onClear","clear","useAuiLabels","jsx","event","Clear","TextArea","supportRef","size","variant","block","invalid","disabled","readOnly","className","dataTestId","defaultValue","onChange","props","textAreaRef","useRef","isControlled","uncontrolledValue","setUncontrolledValue","useState","currentValue","showClear","handleChange","emitEmptyChange","jsxs","Group","RacTextArea","FormTextAreaControl","controlProps","useField","FormTextArea","name","label","hint","textAreaProps","field","fieldState","rhfInputProps","onChangeHandler","onBlurHandler","useFieldHook","formDisabled","formReadOnly","restRhf","error","getError","isDisabled","isReadOnly","Field","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;GAOaA,IAAmBC,EAAIC,EAAO,MAAM;AAAA,EAC7C,UAAU;AAAA,IACN,MAAM;AAAA,MACF,IAAIC,EAAGD,EAAO,IAAIE,EAAiB,KAAK;AAAA,MACxC,IAAID,EAAGD,EAAO,IAAIE,EAAiB,KAAK;AAAA,MACxC,IAAID,EAAGD,EAAO,IAAIE,EAAiB,KAAK;AAAA,IAAA;AAAA,IAE5C,SAAS;AAAA,MACL,SAASF,EAAO;AAAA,IAAA;AAAA,IAEpB,OAAO;AAAA,MACH,MAAMA,EAAO;AAAA,MACb,OAAO;AAAA,IAAA;AAAA,EACX;AAAA,EAEJ,iBAAiB;AAAA,IACb,MAAM;AAAA,IACN,SAAS;AAAA,IACT,OAAO;AAAA,EAAA;AAEf,CAAC,GCxBYG,IAA6B,CAACC,OACtC;AAAA,EACG,QAAQA,KAAM,EAAE,OAAO,GAAA;AAAA,EACvB,eAAeA,KAAM,EAAE,OAAO,GAAA;AAClC,IAGSC,KAA4B,CAACD,MAAmC;AACzE,MAAI,CAACA;AACD;AA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kD,EAAM,MAAN,EAAY,aAAK,IAAgB;AAAA,QAC1C,gBAAAlD,EAACkD,EAAM,OAAN,EAAa,UAAAJ,EAAA,CAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGhC;AAEAd,GAAa,cAAc;"}
@@ -16,18 +16,22 @@ export interface ITextAreaThemeProps {
16
16
  export interface ITextAreaOwnProps extends IDataTestIdProps {
17
17
  /** Clear button for the current value. */
18
18
  clear?: boolean;
19
+ /** Visible and copyable, but not editable. Not `disabled`. */
20
+ readOnly?: boolean;
19
21
  /** Ref to the native textarea (React 19 prop). */
20
22
  ref?: Ref<HTMLTextAreaElement>;
21
23
  }
22
24
  export interface ITextAreaBaseProps extends ITextAreaThemeProps, IFieldStateProps, ITextAreaOwnProps {
23
25
  }
24
- export type TTextAreaRacOmit = 'disabled' | 'isDisabled' | 'isInvalid';
26
+ export type TTextAreaRacOmit = 'disabled' | 'readOnly' | 'isDisabled' | 'isInvalid' | 'isReadOnly';
25
27
  export interface ITextAreaProps extends ITextAreaBaseProps, Omit<RacTextAreaProps, keyof ITextAreaBaseProps | TTextAreaRacOmit> {
26
28
  }
27
29
  /** className belongs on the Field shell. */
28
30
  export type TTextAreaFormRacOmit = TTextAreaRacOmit | keyof ITextAreaBaseProps | 'value' | 'defaultValue' | 'onChange' | 'onBlur' | 'name' | 'className';
29
31
  export interface ITextAreaContentProps extends Omit<RacTextAreaProps, TTextAreaFormRacOmit> {
30
32
  clear?: boolean;
33
+ /** Visible and copyable, but not editable. Not `disabled`. */
34
+ readOnly?: boolean;
31
35
  }
32
36
  export interface IFormTextAreaProps extends IFormFieldLayoutProps, Pick<ITextAreaThemeProps, 'variant'>, ITextAreaContentProps {
33
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/textarea/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,KAAK,aAAa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AA4C;AAC5C,MAAM,MAAM,oBAAoB,GAC1B,gBAAgB,GAChB,MAAM,kBAAkB,GACxB,OAAO,GACP,cAAc,GACd,UAAU,GACV,QAAQ,GACR,MAAM,GACN,WAAW,CAAC;AAElB,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,oBAAoB,CAAC;IACvF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,kBACb,SAAQ,qBAAqB,EAAE,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,EAAE,qBAAqB;CAAG"}
@@ -8,7 +8,7 @@ import { u as M } from "../hooks-BAkrGC45.js";
8
8
  import { cva as O } from "class-variance-authority";
9
9
  import { typographyStyles as C } from "../typography/index.js";
10
10
  import { F as _, u as R } from "../Component-BPN5FgKq.js";
11
- import { u as U, g as $ } from "../utils-CizYZV2a.js";
11
+ import { u as U, g as $ } from "../useFieldHook-Bt9nST7g.js";
12
12
  import '../assets/index12.css';const q = "aub_styles-module_root_184e6", J = "aub_styles-module_block_45f0f", K = "aub_styles-module_group_9f460", Q = "aub_styles-module_sm_f51c2", W = "aub_styles-module_md_be9a9", X = "aub_styles-module_lg_8553c", Y = "aub_styles-module_primary_43afd", Z = "aub_styles-module_input_f5120", ee = "aub_styles-module_segment_b8349", le = "aub_styles-module_clear_04e5c", oe = "aub_styles-module_icon_2d638", e = {
13
13
  root: q,
14
14
  block: J,
@@ -0,0 +1,52 @@
1
+ import { createContext as x, useContext as y, useCallback as l } from "react";
2
+ import { useFormContext as b, useController as B } from "react-hook-form";
3
+ const m = x(void 0), w = () => {
4
+ const o = y(m);
5
+ if (!o)
6
+ throw new Error("This component must be used within a <Form> component");
7
+ return o;
8
+ }, T = (o) => Array.isArray(o) ? o[0] : o, a = (o, e) => typeof o == "boolean" ? o : o == null ? !1 : o[e] ?? !1, k = ({ name: o }) => {
9
+ const { onChange: e, onBlur: c, disabled: d, readOnly: f } = w(), { control: C, setValue: F } = b(), { field: t, fieldState: g } = B({
10
+ name: o,
11
+ control: C
12
+ }), i = l(
13
+ (r) => {
14
+ t.onBlur();
15
+ const n = r?.currentTarget, u = n && "value" in n && typeof n.value == "string" ? n.value : t.value;
16
+ c(o, u);
17
+ },
18
+ [t, o, c]
19
+ ), p = {
20
+ name: o,
21
+ onBlur: i,
22
+ disabled: a(d, o),
23
+ readOnly: a(f, o) || void 0
24
+ }, s = l(
25
+ (r) => {
26
+ t.onChange(r), e(o, r);
27
+ },
28
+ [t, o, e]
29
+ ), h = l(
30
+ (r, n) => {
31
+ if (n !== void 0) {
32
+ s(n);
33
+ return;
34
+ }
35
+ if (!r)
36
+ return;
37
+ t.onChange(r);
38
+ const u = r.currentTarget, { value: v } = u;
39
+ e(o, v);
40
+ },
41
+ [t, o, e, s]
42
+ );
43
+ return { field: t, onChange: e, setValue: F, fieldState: g, inputProps: p, setFieldValue: s, onChangeHandler: h, onBlurHandler: i };
44
+ };
45
+ export {
46
+ m as F,
47
+ w as a,
48
+ T as g,
49
+ a as r,
50
+ k as u
51
+ };
52
+ //# sourceMappingURL=useFieldHook-Bt9nST7g.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFieldHook-Bt9nST7g.js","sources":["../src/form/context.ts","../src/form/utils.ts","../src/form/hooks/useFieldHook.ts"],"sourcesContent":["import { type BaseSyntheticEvent, createContext, useContext } from 'react';\n\nimport { type NativeFieldValue } from 'react-hook-form';\n\nimport { type TFormFieldFlag } from './types';\n\nexport interface IFormContextValue {\n onChange: (key: string, value: NativeFieldValue) => void;\n onBlur: (key: string, value: NativeFieldValue) => void;\n onSubmitHandler: (event?: BaseSyntheticEvent) => void;\n disabled?: TFormFieldFlag;\n readOnly?: TFormFieldFlag;\n}\n\nexport const FormContext = createContext<IFormContextValue | undefined>(undefined);\n\nexport const useAuiForm = (): IFormContextValue => {\n const context = useContext(FormContext);\n\n if (!context) {\n throw new Error('This component must be used within a <Form> component');\n }\n\n return context;\n};\n","import { type FieldError } from 'react-hook-form';\n\nimport { type TFormFieldFlag } from './types';\n\nexport const getError = (value?: FieldError) => (Array.isArray(value) ? value[0] : value);\n\n/** Resolves a form-level boolean or a per-field map. Keys are exact RHF names. */\nexport const resolveFieldFlag = (flag: TFormFieldFlag | undefined, name: string): boolean => {\n if (typeof flag === 'boolean') {\n return flag;\n }\n\n if (flag == null) {\n return false;\n }\n\n return flag[name] ?? false;\n};\n","import { type FocusEvent, type SyntheticEvent, useCallback } from 'react';\n\nimport { type NativeFieldValue, useController, useFormContext } from 'react-hook-form';\n\nimport { useAuiForm } from '../context';\nimport { type IFormFieldComponent } from '../types';\nimport { resolveFieldFlag } from '../utils';\n\n/** Builds controlled field wiring by `name` for FormInput / FormSelect / …. */\nexport const useFieldHook = <TElement extends HTMLElement = HTMLElement>({ name }: IFormFieldComponent) => {\n const { onChange, onBlur: onFormBlur, disabled, readOnly } = useAuiForm();\n const { control, setValue } = useFormContext();\n\n const { field, fieldState } = useController({\n name,\n control,\n });\n\n const onBlurHandler = useCallback(\n (e?: FocusEvent<TElement>) => {\n field.onBlur();\n const target = e?.currentTarget;\n const value = target && 'value' in target && typeof target.value === 'string' ? target.value : field.value;\n onFormBlur(name, value);\n },\n [field, name, onFormBlur]\n );\n\n const inputProps = {\n name,\n onBlur: onBlurHandler,\n disabled: resolveFieldFlag(disabled, name),\n readOnly: resolveFieldFlag(readOnly, name) || undefined,\n };\n\n const setFieldValue = useCallback(\n (value: NativeFieldValue) => {\n field.onChange(value);\n onChange(name, value);\n },\n [field, name, onChange]\n );\n\n const onChangeHandler = useCallback(\n <T extends HTMLInputElement | HTMLTextAreaElement, E extends Event>(\n e?: SyntheticEvent<T, E>,\n val?: NativeFieldValue\n ) => {\n if (val !== undefined) {\n setFieldValue(val);\n return;\n }\n\n if (!e) {\n return;\n }\n\n field.onChange(e);\n const target = e.currentTarget;\n const { value } = target as HTMLInputElement | HTMLTextAreaElement;\n onChange(name, value);\n },\n [field, name, onChange, setFieldValue]\n );\n\n return { field, onChange, setValue, fieldState, inputProps, setFieldValue, onChangeHandler, onBlurHandler };\n};\n"],"names":["FormContext","createContext","useAuiForm","context","useContext","getError","value","resolveFieldFlag","flag","name","useFieldHook","onChange","onFormBlur","disabled","readOnly","control","setValue","useFormContext","field","fieldState","useController","onBlurHandler","useCallback","e","target","inputProps","setFieldValue","onChangeHandler","val"],"mappings":";;AAcO,MAAMA,IAAcC,EAA6C,MAAS,GAEpEC,IAAa,MAAyB;AAC/C,QAAMC,IAAUC,EAAWJ,CAAW;AAEtC,MAAI,CAACG;AACD,UAAM,IAAI,MAAM,uDAAuD;AAG3E,SAAOA;AACX,GCpBaE,IAAW,CAACC,MAAwB,MAAM,QAAQA,CAAK,IAAIA,EAAM,CAAC,IAAIA,GAGtEC,IAAmB,CAACC,GAAkCC,MAC3D,OAAOD,KAAS,YACTA,IAGPA,KAAQ,OACD,KAGJA,EAAKC,CAAI,KAAK,ICPZC,IAAe,CAA6C,EAAE,MAAAD,QAAgC;AACvG,QAAM,EAAE,UAAAE,GAAU,QAAQC,GAAY,UAAAC,GAAU,UAAAC,EAAA,IAAaZ,EAAA,GACvD,EAAE,SAAAa,GAAS,UAAAC,EAAA,IAAaC,EAAA,GAExB,EAAE,OAAAC,GAAO,YAAAC,EAAA,IAAeC,EAAc;AAAA,IACxC,MAAAX;AAAA,IACA,SAAAM;AAAA,EAAA,CACH,GAEKM,IAAgBC;AAAA,IAClB,CAACC,MAA6B;AAC1B,MAAAL,EAAM,OAAA;AACN,YAAMM,IAASD,GAAG,eACZjB,IAAQkB,KAAU,WAAWA,KAAU,OAAOA,EAAO,SAAU,WAAWA,EAAO,QAAQN,EAAM;AACrG,MAAAN,EAAWH,GAAMH,CAAK;AAAA,IAC1B;AAAA,IACA,CAACY,GAAOT,GAAMG,CAAU;AAAA,EAAA,GAGtBa,IAAa;AAAA,IACf,MAAAhB;AAAA,IACA,QAAQY;AAAA,IACR,UAAUd,EAAiBM,GAAUJ,CAAI;AAAA,IACzC,UAAUF,EAAiBO,GAAUL,CAAI,KAAK;AAAA,EAAA,GAG5CiB,IAAgBJ;AAAA,IAClB,CAAChB,MAA4B;AACzB,MAAAY,EAAM,SAASZ,CAAK,GACpBK,EAASF,GAAMH,CAAK;AAAA,IACxB;AAAA,IACA,CAACY,GAAOT,GAAME,CAAQ;AAAA,EAAA,GAGpBgB,IAAkBL;AAAA,IACpB,CACIC,GACAK,MACC;AACD,UAAIA,MAAQ,QAAW;AACnB,QAAAF,EAAcE,CAAG;AACjB;AAAA,MACJ;AAEA,UAAI,CAACL;AACD;AAGJ,MAAAL,EAAM,SAASK,CAAC;AAChB,YAAMC,IAASD,EAAE,eACX,EAAE,OAAAjB,MAAUkB;AAClB,MAAAb,EAASF,GAAMH,CAAK;AAAA,IACxB;AAAA,IACA,CAACY,GAAOT,GAAME,GAAUe,CAAa;AAAA,EAAA;AAGzC,SAAO,EAAE,OAAAR,GAAO,UAAAP,GAAU,UAAAK,GAAU,YAAAG,GAAY,YAAAM,GAAY,eAAAC,GAAe,iBAAAC,GAAiB,eAAAN,EAAA;AAChG;"}
package/docs/README.md CHANGED
@@ -1,20 +1,19 @@
1
1
  # Документация пакета
2
2
 
3
- Карта каналов. API примитивов сюда **не** пишем — source of truth: `src/<name>/docs/Description.*.md` и `types.ts`.
3
+ Карта каналов. API примитивов сюда **не** пишем — source of truth в репо: `src/<name>/docs/Description.ru.md` / `Description.en.md` и `types.ts`. В npm для агента английский файл называется `Description.md`.
4
4
 
5
5
  | Канал | Где | Для кого |
6
6
  | --- | --- | --- |
7
7
  | Онбординг / API примитивов | Storybook + `src/<name>/docs/` | люди + агенты |
8
8
  | Пакет (этот каталог) | `docs/*.md`, `docs/skills/` | контрибьюторы, АП |
9
- | Визуал АП | [`design-language.md`](./design-language.md) + [`concepts/`](./concepts/) | продукт / дизайн (в npm не публикуется) |
9
+ | Визуал АП (текст) | [`design-language.md`](./design-language.md) | продукт / дизайн (в npm публикуется) |
10
10
 
11
11
  ## В этом каталоге
12
12
 
13
13
  - [architecture.md](./architecture.md) — стек, токены, Form, exports
14
14
  - [ai.md](./ai.md) — канал для АП / skills
15
- - [design-language.md](./design-language.md) — визуальный канон (слои, CascadeMenu WIP, list/detail); **v3** = content only, сайдбар на скринах не канон
15
+ - [design-language.md](./design-language.md) — визуальный канон (слои, CascadeMenu WIP, list/detail); в npm уходит [design-language.en.md](./design-language.en.md)
16
16
  - [skills/](./skills/) — skill `admin-ui` (публикуется с пакетом; автосинк в `.cursor/skills`, `.claude/skills` и маркер-блок в `AGENTS.md` через postinstall, см. [ai.md](./ai.md))
17
- - [concepts/](./concepts/) — скриншоты-референсы интерфейса АП (индекс: [concepts/README.md](./concepts/README.md))
18
17
 
19
18
  ## Storybook
20
19
 
package/docs/ai.md CHANGED
@@ -1,46 +1,60 @@
1
- # Канал для АП
2
-
3
- Как агенты (Cursor и др.) опираются на `@ensi-platform/admin-ui`.
1
+ How agents (Cursor and others) use `@ensi-platform/admin-ui`.
4
2
 
5
3
  ## Source of truth
6
4
 
7
- Контракт примитива:
5
+ Per primitive, the contract in this repo (Storybook) is:
8
6
 
9
7
  - `src/<name>/docs/Description.ru.md` / `Description.en.md`
10
- - `Example.*.md`, при необходимости `cssVariables.ts`
11
- - `types.ts` (когда есть)
8
+ - `Example.ru.md` / `Example.en.md`, and `cssVariables.ts` when needed
9
+ - `types.ts` when present
10
+ - screen visual canon — `docs/design-language.md`
11
+
12
+ Storybook Docs reads both languages. Do not duplicate component API under package `docs/`.
13
+
14
+ The npm package ships English only, renamed for agents:
15
+
16
+ - `Description.en.md` → `src/<name>/docs/Description.md`
17
+ - `Example.en.md` → `Example.md`
18
+ - getting started → `src/docs/getting-started/Description.md`
19
+
20
+ `*.ru.md` and stories stay in the repo. Read the published files from `node_modules/@ensi-platform/admin-ui/...`.
21
+
22
+ ## Skill
12
23
 
13
- Storybook Docs читает те же файлы (+ stories в репо). В npm уходят Description / Example / cssVariables / types — без stories. В `docs/` пакета API компонентов не дублируем.
24
+ Thin router for **consuming** the UI kit (pick a primitive, then read its Description). Authoring Description / stories — separate skill `write-component-docs`.
14
25
 
15
- ## Skill `admin-ui`
26
+ Location in the package: `docs/skills/` (`SKILL.md`).
16
27
 
17
- Source of truth: [`docs/skills/`](./skills/) (`SKILL.md` + `evals/`). Публикуется вместе с пакетом.
28
+ In a consumer app:
18
29
 
19
- В consumer-приложении агент читает:
30
+ - skill — `node_modules/@ensi-platform/admin-ui/docs/skills/`
31
+ - contract — `node_modules/@ensi-platform/admin-ui/src/<name>/docs/`, `…/types.ts` (`icons`, `hooks`, `combobox` included)
20
32
 
21
- - skill: `node_modules/@ensi-platform/admin-ui/docs/skills/`
22
- - контракт: `node_modules/@ensi-platform/admin-ui/src/<name>/docs/`, `…/types.ts`
33
+ `postinstall` (`scripts/sync-consumer.ts`) copies the skill and writes a pointer. No manual path setup:
23
34
 
24
- Skill тонкий:
35
+ - `.cursor/skills/admin-ui/SKILL.md`
36
+ - `.claude/skills/admin-ui/SKILL.md` — same file
37
+ - marker `<!-- @ensi-platform/admin-ui:start -->` … `:end` in the consumer repo `AGENTS.md` (rest of the file stays)
25
38
 
26
- - когда триггериться
27
- - короткая таблица выбора примитива (Button vs Badge vs Tag, …)
28
- - указание: читай Description / types / Example — без копипасты длинных текстов
39
+ Limits:
29
40
 
30
- ### Автосинк в consumer-приложении
41
+ - consumer root is the nearest `.git` from `INIT_CWD`; if none, the script does nothing
42
+ - **pnpm ≥ 9** ignores dependency lifecycle scripts until `pnpm approve-builds @ensi-platform/admin-ui` (or `pnpm.onlyBuiltDependencies`), then `pnpm install` again
43
+ - manual run: `node node_modules/@ensi-platform/admin-ui/scripts/sync-consumer.ts`
44
+ - opt out of all three: `ADMIN_UI_SKIP_CONSUMER_SYNC=1`
31
45
 
32
- При установке пакета (`pnpm add` / `npm install`) `postinstall`-скрипт (`scripts/sync-consumer.ts`) синхронизирует три канала без ручной настройки:
46
+ Updating a Description does not require editing the skill.
33
47
 
34
- - `.cursor/skills/admin-ui/SKILL.md` — Cursor;
35
- - `.claude/skills/admin-ui/SKILL.md` — Claude Code (тот же контент, тот же frontmatter-формат Agent Skills);
36
- - маркер-блок `<!-- @ensi-platform/admin-ui:start -->…:end` в `AGENTS.md` в корне consumer-репо — для агентов без концепции skills (Codex CLI, Copilot coding agent и др.), которые читают только `AGENTS.md` целиком. Блок создаётся/обновляется идемпотентно; остальной `AGENTS.md` не трогается.
48
+ ## Rules for agents
37
49
 
38
- Условия и ограничения:
50
+ - do not invent API — read Description / types first;
51
+ - assemble screens (lists, filters, detail pages) from `docs/design-language.md`;
52
+ - app layout colours — `src/ds/tokens/docs/Description.md` (control chrome stays on the primitive);
53
+ - imports only via subpaths (`@ensi-platform/admin-ui/button`, …) — no package root barrel;
54
+ - setup (tokens, Provider, theme) — see **Getting started**.
39
55
 
40
- - корень consumer-репо ищется по ближайшему `.git` от `INIT_CWD`; не находит — тихо ничего не делает;
41
- - **pnpm ≥ 9** по умолчанию блокирует lifecycle-скрипты зависимостей («ignored build scripts»). Если синк не сработал сам — один раз выполнить `pnpm approve-builds @ensi-platform/admin-ui` (или добавить пакет в `pnpm.onlyBuiltDependencies` в корневом `package.json` consumer-репо), затем `pnpm install` ещё раз;
42
- - ручной запуск без переустановки: `node node_modules/@ensi-platform/admin-ui/scripts/sync-consumer.ts`;
43
- - опт-аут (отключает все три канала сразу): `ADMIN_UI_SKIP_CONSUMER_SYNC=1`;
44
- - в самом репозитории admin-ui `.cursor/skills/admin-ui`, `.claude/skills/admin-ui` и корневой `AGENTS.md` не трогаем — скрипт детектит dev-режим и ничего не пишет.
56
+ ## Next
45
57
 
46
- См. также `.cursor/rules/component-docs.mdc` → «Канал для АП».
58
+ - **Getting started** — install and first screen
59
+ - `Base/Button`, `Form/Input`, `Overlays/Modal` — primitives
60
+ - Package docs: `docs/ai.md`, `docs/architecture.md`
@@ -1,42 +1,42 @@
1
- # Архитектура
1
+ # Architecture
2
2
 
3
- Пакет `@ensi-platform/admin-ui` — UI для админ-панели Ensi: контролы, формы, оверлеи, таблица, токены, типографика.
3
+ `@ensi-platform/admin-ui` is the UI for the Ensi admin panel: controls, forms, overlays, table, tokens, typography.
4
4
 
5
- ## Слои компонентов
5
+ ## Component layers
6
6
 
7
- | Слой | Storybook | Примеры | Роль |
7
+ | Layer | Storybook | Examples | Role |
8
8
  | --- | --- | --- | --- |
9
- | Base | `Base/*` | `Button`, `MenuList`, `Avatar`, `Table`, … | примитивы и составные части |
10
- | App | `App/*` | `CascadeMenu` | готовые сборки chrome АП |
9
+ | Base | `Base/*` | `Button`, `MenuList`, `Avatar`, `Table`, … | primitives and their parts |
10
+ | App | `App/*` | `CascadeMenu` | ready-made admin chrome |
11
11
 
12
- App собирается из Base; layout `sidebar \| page` остаётся у consumer (без `AppShell`).
12
+ App is built from Base. The `sidebar | page` layout stays in the consumer app (there is no `AppShell`). List and detail page frames are application code; the package does not ship them. Screen visuals — `docs/design-language.md`.
13
13
 
14
- ## Стек
14
+ ## Stack
15
15
 
16
- - стили — CSS-переменные `--aui-*` (CSS Modules у примитивов)
17
- - поведение — [React Aria Components](https://react-aria.adobe.com) внутри; публичный API наш (`size` / `variant` / `dataTestId`, …)
18
- - не shadcn / не Tailwind-рецепты «из коробки»
16
+ - styles — `--aui-*` CSS variables (CSS Modules on primitives)
17
+ - behavior — [React Aria Components](https://react-aria.adobe.com) inside; the public API is ours (`size` / `variant` / `dataTestId`, …)
18
+ - not shadcn and not Tailwind recipes
19
19
 
20
- ## Подключение
20
+ ## Setup
21
21
 
22
- 1. Токены **один раз** в entry приложения: `import '@ensi-platform/admin-ui/tokens'`
23
- 2. `AdminUiProvider` у корня UI — locale, порталы, встроенные a11y-строки, page-подложка (`--aui-page-bg-primary` / `--aui-page-fg-primary`; inset контента — у host)
24
- 3. Тема на `document.documentElement`: `data-theme="light"` | `"dark"`
22
+ 1. Tokens **once** in the app entry: `import '@ensi-platform/admin-ui/tokens'`
23
+ 2. `AdminUiProvider` at the UI root — locale, portals, built-in a11y strings, page substrate (`--aui-page-bg-primary` / `--aui-page-fg-primary`; content inset stays on the host)
24
+ 3. Theme on `document.documentElement`: `data-theme="light"` | `"dark"`
25
25
 
26
- Компоненты тему не знают — только читают `--aui-*`. Light — `semantic.css`, dark — remap в `semantic.dark.css`.
26
+ Components do not know the theme — they only read `--aui-*`. Light is `semantic.css`, dark is a remap in `semantic.dark.css`.
27
27
 
28
- Импорт только через subpath: `@ensi-platform/admin-ui/button`, `@ensi-platform/admin-ui/provider`, … Корневого barrel нет.
28
+ Import only via subpath: `@ensi-platform/admin-ui/button`, `@ensi-platform/admin-ui/provider`, … There is no package root barrel.
29
29
 
30
- Онбординг с примерами — Storybook **Getting started** и корневой [README](../README.md).
30
+ Onboarding with examples — Storybook **Getting started** and the root [README](../README.md).
31
31
 
32
32
  ## Form
33
33
 
34
- - `Form` (RHF + zod) — state / submit / validation в пакете
35
- - FormX (`FormInput`, `FormSelect`, …) — рядом с контролом, не отдельный `FormFieldWrapper`
36
- - `FormControl` не заводим: лейбл / хинт / ошибка закрывает `Field` (+ RAC `Label` / `Text`)
34
+ - `Form` (RHF + zod) — state / submit / validation live in the package
35
+ - FormX (`FormInput`, `FormSelect`, …) — next to the control, not a separate `FormFieldWrapper`
36
+ - no `FormControl`: label / hint / error belong to `Field` (+ RAC `Label` / `Text`)
37
37
 
38
- Peers для Form*: `react-hook-form`, `@hookform/resolvers`, `zod`.
38
+ Peers for Form*: `react-hook-form`, `@hookform/resolvers`, `zod`.
39
39
 
40
40
  ## Exports
41
41
 
42
- `exports` в корневом `package.json` **не** коммитятся: `pnpm build` / `prepublishOnly` гоняет `sync-package` — пишет только subpath `exports` (`./button`, `./tokens`, …) из `src/*/index.ts` (плюс nested `tokens` / `typography`). Ключа `"."` нет. Без build workspace-subpath импорты не резолвятся.
42
+ `exports` in the root `package.json` are **not** the source of truth: `pnpm build` / `prepublishOnly` runs `sync-package` and writes only subpath `exports` (`./button`, `./tokens`, …) from `src/*/index.ts` (plus nested `tokens` / `typography`). There is no `"."` key. Without a build, workspace subpath imports do not resolve.