@foxford/ui 2.59.0 → 2.61.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 (318) hide show
  1. package/components/Accordion/Accordion.js +1 -1
  2. package/components/Accordion/Accordion.js.map +1 -1
  3. package/components/Accordion/Accordion.mjs +1 -1
  4. package/components/Accordion/Accordion.mjs.map +1 -1
  5. package/components/ActionBtn/ActionBtn.js +1 -1
  6. package/components/Alert/Alert.js +1 -1
  7. package/components/Alert/Alert.js.map +1 -1
  8. package/components/Alert/Alert.mjs +1 -1
  9. package/components/Alert/Alert.mjs.map +1 -1
  10. package/components/Alert/CountdownCircle.js +1 -1
  11. package/components/Amount/Amount.js +1 -1
  12. package/components/Anchor/Anchor.js +1 -1
  13. package/components/Anchor/style.js +1 -1
  14. package/components/Anchor/style.js.map +1 -1
  15. package/components/Anchor/style.mjs +1 -1
  16. package/components/Anchor/style.mjs.map +1 -1
  17. package/components/Arrow/Arrow.js +1 -1
  18. package/components/Arrow/style.js +1 -1
  19. package/components/Arrow/style.js.map +1 -1
  20. package/components/Arrow/style.mjs +1 -1
  21. package/components/Arrow/style.mjs.map +1 -1
  22. package/components/ArrowBadge/ArrowBadge.js +1 -1
  23. package/components/Avatar/Avatar.js +1 -1
  24. package/components/Badge/Badge.js +1 -1
  25. package/components/Button/Button.js +1 -1
  26. package/components/Button/style.js +1 -1
  27. package/components/Button/style.js.map +1 -1
  28. package/components/Button/style.mjs +1 -1
  29. package/components/Button/style.mjs.map +1 -1
  30. package/components/Checkbox/Checkbox.js +1 -1
  31. package/components/Checkbox/Group.js +1 -1
  32. package/components/Checkbox/style.js +1 -1
  33. package/components/Checkbox/style.js.map +1 -1
  34. package/components/Checkbox/style.mjs +1 -1
  35. package/components/Checkbox/style.mjs.map +1 -1
  36. package/components/Chip/Chip.js +1 -1
  37. package/components/Chip/style.js +1 -1
  38. package/components/Chip/style.js.map +1 -1
  39. package/components/Chip/style.mjs +1 -1
  40. package/components/Chip/style.mjs.map +1 -1
  41. package/components/Container/Container.js +1 -1
  42. package/components/ContextMenu/ContextMenu.js +1 -1
  43. package/components/ContextMenu/Item.js +1 -1
  44. package/components/ContextMenu.Multilevel/ContextMenu.Multilevel.js +1 -1
  45. package/components/ContextMenu.Multilevel/Controls.js +1 -1
  46. package/components/ContextMenu.Multilevel/Heading.js +1 -1
  47. package/components/ContextMenu.Multilevel/SubHeading.js +1 -1
  48. package/components/Dialog/Dialog.js +1 -1
  49. package/components/Dialog/Dialog.js.map +1 -1
  50. package/components/Dialog/Dialog.mjs.map +1 -1
  51. package/components/DialogComponent/DialogComponent.js +1 -1
  52. package/components/DialogComponent/DialogComponent.js.map +1 -1
  53. package/components/DialogComponent/DialogComponent.mjs +1 -1
  54. package/components/DialogComponent/DialogComponent.mjs.map +1 -1
  55. package/components/DialogComponent/DialogContainer.js +1 -1
  56. package/components/Dropdown/Dropdown.js +1 -1
  57. package/components/Dropdown/Dropdown.js.map +1 -1
  58. package/components/Dropdown/Dropdown.mjs +1 -1
  59. package/components/Dropdown/Dropdown.mjs.map +1 -1
  60. package/components/Dropdown/DropdownMenu.js +1 -1
  61. package/components/Dropdown/DropdownMenu.js.map +1 -1
  62. package/components/Dropdown/DropdownMenu.mjs +1 -1
  63. package/components/Dropdown/DropdownMenu.mjs.map +1 -1
  64. package/components/Dropdown/DropdownMenuNoOptions.js +1 -1
  65. package/components/Dropdown/style.js +1 -1
  66. package/components/Dropdown/style.js.map +1 -1
  67. package/components/Dropdown/style.mjs +1 -1
  68. package/components/Dropdown/style.mjs.map +1 -1
  69. package/components/FormInput/FormInput.js +1 -1
  70. package/components/FormInput/FormInput.js.map +1 -1
  71. package/components/FormInput/FormInput.mjs +1 -1
  72. package/components/FormInput/FormInput.mjs.map +1 -1
  73. package/components/FormInputLabel/FormInputLabel.js +1 -1
  74. package/components/FormInputLabel/style.js +1 -1
  75. package/components/FormInputLabel/style.js.map +1 -1
  76. package/components/FormInputLabel/style.mjs +1 -1
  77. package/components/FormInputLabel/style.mjs.map +1 -1
  78. package/components/FormLabel/FormLabel.js +1 -1
  79. package/components/FormLabel/style.js +1 -1
  80. package/components/FormLabel/style.js.map +1 -1
  81. package/components/FormLabel/style.mjs +1 -1
  82. package/components/FormLabel/style.mjs.map +1 -1
  83. package/components/Icon/Icon.js +1 -1
  84. package/components/Icon/Icon.js.map +1 -1
  85. package/components/Icon/Icon.mjs +1 -1
  86. package/components/Icon/Icon.mjs.map +1 -1
  87. package/components/Icon/list/icon-pack.js +1 -1
  88. package/components/Icon/list/icon-pack.js.map +1 -1
  89. package/components/Icon/list/icon-pack.mjs +1 -1
  90. package/components/Icon/list/icon-pack.mjs.map +1 -1
  91. package/components/IconButton/IconButton.js +1 -1
  92. package/components/IconButton/style.js +1 -1
  93. package/components/IconButton/style.js.map +1 -1
  94. package/components/IconButton/style.mjs +1 -1
  95. package/components/IconButton/style.mjs.map +1 -1
  96. package/components/Indicator/Indicator.js +1 -1
  97. package/components/Input/Input.js +1 -1
  98. package/components/Input/Input.js.map +1 -1
  99. package/components/Input/Input.mjs +1 -1
  100. package/components/Input/Input.mjs.map +1 -1
  101. package/components/Input/style.js +1 -1
  102. package/components/Input/style.js.map +1 -1
  103. package/components/Input/style.mjs +1 -1
  104. package/components/Input/style.mjs.map +1 -1
  105. package/components/Input.Phone/Input.Phone.js +1 -1
  106. package/components/Input.Phone/Input.Phone.js.map +1 -1
  107. package/components/Input.Phone/Input.Phone.mjs.map +1 -1
  108. package/components/InputCheckbox/InputCheckbox.js +1 -1
  109. package/components/InputRadio/InputRadio.js +1 -1
  110. package/components/ListItem/ListItem.js +1 -1
  111. package/components/Menu/Menu.js +1 -1
  112. package/components/Menu/Menu.js.map +1 -1
  113. package/components/Menu/Menu.mjs.map +1 -1
  114. package/components/MenuComponent/MenuComponent.js +1 -1
  115. package/components/MenuContainer/MenuContainer.js +1 -1
  116. package/components/MenuDivider/MenuDivider.js +1 -1
  117. package/components/MenuList/MenuList.js +1 -1
  118. package/components/Modal/Close.js +1 -1
  119. package/components/Modal/Modal.js +1 -1
  120. package/components/Modal/Modal.js.map +1 -1
  121. package/components/Modal/Modal.mjs.map +1 -1
  122. package/components/Modal/adapter.js +1 -1
  123. package/components/Notification/Notification.js +1 -1
  124. package/components/Paper/Paper.js +1 -1
  125. package/components/Popover/Popover.js +1 -1
  126. package/components/Popover/Popover.js.map +1 -1
  127. package/components/Popover/Popover.mjs.map +1 -1
  128. package/components/PopoverComponent/PopoverComponent.js +1 -1
  129. package/components/PopoverComponent/style.js +1 -1
  130. package/components/PopoverComponent/style.js.map +1 -1
  131. package/components/PopoverComponent/style.mjs +1 -1
  132. package/components/PopoverComponent/style.mjs.map +1 -1
  133. package/components/Progress/Progress.js +1 -1
  134. package/components/Progress/style.js +1 -1
  135. package/components/Progress/style.js.map +1 -1
  136. package/components/Progress/style.mjs +1 -1
  137. package/components/Progress/style.mjs.map +1 -1
  138. package/components/Progress.Circle/Progress.Circle.js +1 -1
  139. package/components/Progress.Segmented/Progress.Segmented.js +1 -1
  140. package/components/Radio/Group.js +1 -1
  141. package/components/Radio/Radio.js +1 -1
  142. package/components/Scrollable/Scrollable.js +1 -1
  143. package/components/Section/Section.js +1 -1
  144. package/components/Select/Select.js +1 -1
  145. package/components/Select/Select.js.map +1 -1
  146. package/components/Select/Select.mjs.map +1 -1
  147. package/components/Select/style.js +1 -1
  148. package/components/Select/style.js.map +1 -1
  149. package/components/Select/style.mjs +1 -1
  150. package/components/Select/style.mjs.map +1 -1
  151. package/components/Separator/Separator.js +1 -1
  152. package/components/Separator/SeparatorText.js +1 -1
  153. package/components/Skeleton/Skeleton.js +1 -1
  154. package/components/Spacer/Spacer.js +1 -1
  155. package/components/Spinner/Spinner.js +1 -1
  156. package/components/Switch/Knob.js +1 -1
  157. package/components/Switch/Switch.js +1 -1
  158. package/components/Switch/style.js +1 -1
  159. package/components/Switch/style.js.map +1 -1
  160. package/components/Switch/style.mjs +1 -1
  161. package/components/Switch/style.mjs.map +1 -1
  162. package/components/Switcher/Switcher.js +1 -1
  163. package/components/Switcher/style.js +1 -1
  164. package/components/Switcher/style.js.map +1 -1
  165. package/components/Switcher/style.mjs +1 -1
  166. package/components/Switcher/style.mjs.map +1 -1
  167. package/components/Tab/Tab.js +1 -1
  168. package/components/Tab/style.js +1 -1
  169. package/components/Tab/style.js.map +1 -1
  170. package/components/Tab/style.mjs +1 -1
  171. package/components/Tab/style.mjs.map +1 -1
  172. package/components/Tabs/Tabs.js +1 -1
  173. package/components/Tag/Tag.js +1 -1
  174. package/components/Text/Ellipsis.js +1 -1
  175. package/components/Text/Ellipsis.js.map +1 -1
  176. package/components/Text/Ellipsis.mjs +1 -1
  177. package/components/Text/Ellipsis.mjs.map +1 -1
  178. package/components/Text/Text.js +1 -1
  179. package/components/Text/style.js +1 -1
  180. package/components/Text/style.js.map +1 -1
  181. package/components/Text/style.mjs +1 -1
  182. package/components/Text/style.mjs.map +1 -1
  183. package/components/Text.Ellipse/Text.Ellipse.js +1 -1
  184. package/components/Text.Heading/Text.Heading.js +1 -1
  185. package/components/Textarea/Textarea.js +1 -1
  186. package/components/Textarea/Textarea.js.map +1 -1
  187. package/components/Textarea/Textarea.mjs +1 -1
  188. package/components/Textarea/Textarea.mjs.map +1 -1
  189. package/components/Tooltip/Tooltip.js +1 -1
  190. package/components/Tooltip/Tooltip.js.map +1 -1
  191. package/components/Tooltip/Tooltip.mjs +1 -1
  192. package/components/Tooltip/Tooltip.mjs.map +1 -1
  193. package/components/Tooltip/TooltipWrapper.js +1 -1
  194. package/components/Tooltip/default-constants.js.map +1 -1
  195. package/components/Tooltip/default-constants.mjs.map +1 -1
  196. package/components/TooltipComponent/TooltipComponent.js +1 -1
  197. package/components/TooltipComponent/style.js +1 -1
  198. package/components/TooltipComponent/style.js.map +1 -1
  199. package/components/TooltipComponent/style.mjs +1 -1
  200. package/components/TooltipComponent/style.mjs.map +1 -1
  201. package/components/Visibility/Visibility.js +1 -1
  202. package/dts/index.d.ts +273 -3560
  203. package/hocs/withMergedProps.js +1 -1
  204. package/hocs/withTranslation.js +1 -1
  205. package/hooks/useResizeObserver.js +2 -0
  206. package/hooks/useResizeObserver.js.map +1 -0
  207. package/hooks/useResizeObserver.mjs +2 -0
  208. package/hooks/useResizeObserver.mjs.map +1 -0
  209. package/package.json +16 -8
  210. package/theme/theme-provider.js +1 -1
  211. package/_virtual/ResizeObserver.js +0 -2
  212. package/_virtual/ResizeObserver.js.map +0 -1
  213. package/_virtual/ResizeObserver.mjs +0 -2
  214. package/_virtual/ResizeObserver.mjs.map +0 -1
  215. package/_virtual/_commonjsHelpers.js +0 -2
  216. package/_virtual/_commonjsHelpers.js.map +0 -1
  217. package/_virtual/_commonjsHelpers.mjs +0 -2
  218. package/_virtual/_commonjsHelpers.mjs.map +0 -1
  219. package/_virtual/index.js +0 -2
  220. package/_virtual/index.js.map +0 -1
  221. package/_virtual/index.mjs +0 -2
  222. package/_virtual/index.mjs.map +0 -1
  223. package/_virtual/index2.js +0 -2
  224. package/_virtual/index2.js.map +0 -1
  225. package/_virtual/index2.mjs +0 -2
  226. package/_virtual/index2.mjs.map +0 -1
  227. package/_virtual/index3.js +0 -2
  228. package/_virtual/index3.js.map +0 -1
  229. package/_virtual/index3.mjs +0 -2
  230. package/_virtual/index3.mjs.map +0 -1
  231. package/_virtual/index4.js +0 -2
  232. package/_virtual/index4.js.map +0 -1
  233. package/_virtual/index4.mjs +0 -2
  234. package/_virtual/index4.mjs.map +0 -1
  235. package/_virtual/index5.js +0 -2
  236. package/_virtual/index5.js.map +0 -1
  237. package/_virtual/index5.mjs +0 -2
  238. package/_virtual/index5.mjs.map +0 -1
  239. package/_virtual/index6.js +0 -2
  240. package/_virtual/index6.js.map +0 -1
  241. package/_virtual/index6.mjs +0 -2
  242. package/_virtual/index6.mjs.map +0 -1
  243. package/_virtual/index7.js +0 -2
  244. package/_virtual/index7.js.map +0 -1
  245. package/_virtual/index7.mjs +0 -2
  246. package/_virtual/index7.mjs.map +0 -1
  247. package/_virtual/index8.js +0 -2
  248. package/_virtual/index8.js.map +0 -1
  249. package/_virtual/index8.mjs +0 -2
  250. package/_virtual/index8.mjs.map +0 -1
  251. package/_virtual/purify.js +0 -2
  252. package/_virtual/purify.js.map +0 -1
  253. package/_virtual/purify.mjs +0 -2
  254. package/_virtual/purify.mjs.map +0 -1
  255. package/_virtual/tinycolor.js +0 -2
  256. package/_virtual/tinycolor.js.map +0 -1
  257. package/_virtual/tinycolor.mjs +0 -2
  258. package/_virtual/tinycolor.mjs.map +0 -1
  259. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/components.json.js +0 -2
  260. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/components.json.js.map +0 -1
  261. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/components.json.mjs +0 -2
  262. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/components.json.mjs.map +0 -1
  263. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/CheckCircleFill/index.js +0 -2
  264. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/CheckCircleFill/index.js.map +0 -1
  265. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/CheckCircleFill/index.mjs +0 -2
  266. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/CheckCircleFill/index.mjs.map +0 -1
  267. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/ChevronDown/index.js +0 -2
  268. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/ChevronDown/index.js.map +0 -1
  269. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/ChevronDown/index.mjs +0 -2
  270. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/ChevronDown/index.mjs.map +0 -1
  271. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/Close/index.js +0 -2
  272. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/Close/index.js.map +0 -1
  273. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/Close/index.mjs +0 -2
  274. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/Close/index.mjs.map +0 -1
  275. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/CloseCirlceFill/index.js +0 -2
  276. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/CloseCirlceFill/index.js.map +0 -1
  277. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/CloseCirlceFill/index.mjs +0 -2
  278. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/CloseCirlceFill/index.mjs.map +0 -1
  279. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/LoaderFill/index.js +0 -2
  280. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/LoaderFill/index.js.map +0 -1
  281. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/LoaderFill/index.mjs +0 -2
  282. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/LoaderFill/index.mjs.map +0 -1
  283. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/NotifFill/index.js +0 -2
  284. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/NotifFill/index.js.map +0 -1
  285. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/NotifFill/index.mjs +0 -2
  286. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/NotifFill/index.mjs.map +0 -1
  287. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/ResizeHandle/index.js +0 -2
  288. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/ResizeHandle/index.js.map +0 -1
  289. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/ResizeHandle/index.mjs +0 -2
  290. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/ResizeHandle/index.mjs.map +0 -1
  291. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/WarningTriangleFill/index.js +0 -2
  292. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/WarningTriangleFill/index.js.map +0 -1
  293. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/WarningTriangleFill/index.mjs +0 -2
  294. package/external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/WarningTriangleFill/index.mjs.map +0 -1
  295. package/external/.pnpm/dompurify@3.1.6/node_modules/dompurify/dist/purify.js +0 -2
  296. package/external/.pnpm/dompurify@3.1.6/node_modules/dompurify/dist/purify.js.map +0 -1
  297. package/external/.pnpm/dompurify@3.1.6/node_modules/dompurify/dist/purify.mjs +0 -2
  298. package/external/.pnpm/dompurify@3.1.6/node_modules/dompurify/dist/purify.mjs.map +0 -1
  299. package/external/.pnpm/fuse.js@7.0.0/node_modules/fuse.js/dist/fuse.js +0 -2
  300. package/external/.pnpm/fuse.js@7.0.0/node_modules/fuse.js/dist/fuse.js.map +0 -1
  301. package/external/.pnpm/fuse.js@7.0.0/node_modules/fuse.js/dist/fuse.mjs +0 -2
  302. package/external/.pnpm/fuse.js@7.0.0/node_modules/fuse.js/dist/fuse.mjs.map +0 -1
  303. package/external/.pnpm/nanoid@5.0.9/node_modules/nanoid/index.browser.js +0 -2
  304. package/external/.pnpm/nanoid@5.0.9/node_modules/nanoid/index.browser.js.map +0 -1
  305. package/external/.pnpm/nanoid@5.0.9/node_modules/nanoid/index.browser.mjs +0 -2
  306. package/external/.pnpm/nanoid@5.0.9/node_modules/nanoid/index.browser.mjs.map +0 -1
  307. package/external/.pnpm/nanoid@5.0.9/node_modules/nanoid/url-alphabet/index.js +0 -2
  308. package/external/.pnpm/nanoid@5.0.9/node_modules/nanoid/url-alphabet/index.js.map +0 -1
  309. package/external/.pnpm/nanoid@5.0.9/node_modules/nanoid/url-alphabet/index.mjs +0 -2
  310. package/external/.pnpm/nanoid@5.0.9/node_modules/nanoid/url-alphabet/index.mjs.map +0 -1
  311. package/external/.pnpm/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.js +0 -2
  312. package/external/.pnpm/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.js.map +0 -1
  313. package/external/.pnpm/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.mjs +0 -2
  314. package/external/.pnpm/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.mjs.map +0 -1
  315. package/external/.pnpm/tinycolor2@1.4.2/node_modules/tinycolor2/tinycolor.js +0 -2
  316. package/external/.pnpm/tinycolor2@1.4.2/node_modules/tinycolor2/tinycolor.js.map +0 -1
  317. package/external/.pnpm/tinycolor2@1.4.2/node_modules/tinycolor2/tinycolor.mjs +0 -2
  318. package/external/.pnpm/tinycolor2@1.4.2/node_modules/tinycolor2/tinycolor.mjs.map +0 -1
@@ -1,2 +1,2 @@
1
- 'use strict';var styled=require('styled-components');var tinycolor=require('../../external/.pnpm/tinycolor2@1.4.2/node_modules/tinycolor2/tinycolor.js');var display=require('../../mixins/display.js');var color=require('../../mixins/color.js');var responsiveSize=require('../../mixins/responsive-size.js');var responsiveMargin=require('../../mixins/responsive-margin.js');var focus=require('../../mixins/focus.js');var style=require('../../shared/utils/style.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var styled__default=_interopDefault(styled);const WEIGHT_MAP={lighter:100,normal:400,bold:600,bolder:800};const LINE_HEIGHT_MAP={l:1.5,m:1.3,s:1.15,xs:1};const shouldForwardTextProp=style.createShouldForwardProp((e=>!['appearance','fontFamily','weight','fontStyle','transform','underlineLinks','textAlign','lineHeight','content','display','chars','quoted','showZeroMinorPart','separator','whiteSpace','wordBreak','underline','ellipsis'].includes(e)));const template=e=>`\n color: ${e.color};\n background-color: ${e.backgroundColor};\n &:hover {\n color: ${e.colorHover};\n }\n &:active {\n color: ${e.color};\n }\n &:disabled {\n color: ${e.colorDisabled};\n }\n`;const COLOR_SCHEMA={primary:styled.css(["",""],(e=>template({color:e.theme.colors['content-link'],colorHover:tinycolor.default(e.theme.colors['content-link']).lighten(10).toString(),colorDisabled:e.theme.colors['content-disabled'],backgroundColor:e.theme.colors.transparent,...e.palette}))),contrast:styled.css(["",""],(e=>template({color:e.theme.colors['content-oncolor-primary'],colorHover:tinycolor.default(e.theme.colors['content-oncolor-primary']).darken(10).toString(),colorDisabled:e.theme.colors['content-oncolor-disabled'],backgroundColor:e.theme.colors.transparent,...e.palette})))};const Root=styled__default.default.div.withConfig({shouldForwardProp:shouldForwardTextProp}).withConfig({displayName:"Text__Root",componentId:"ui__sc-s2fogy-0"})([""," "," "," "," "," ",""],(e=>`\n margin: 0;\n padding: 0;\n ${e.fontFamily?`font-family: ${e.fontFamily};`:''}\n ${e.transform?`text-transform: ${e.transform};`:''}\n ${e.weight?`font-weight: ${WEIGHT_MAP[e.weight]??e.weight};`:''}\n ${e.fontStyle?`font-style: ${e.fontStyle};`:''}\n ${e.textAlign?`text-align: ${e.textAlign};`:''}\n ${e.lineHeight?`line-height: ${LINE_HEIGHT_MAP[e.lineHeight]??e.lineHeight};`:''}\n ${e.whiteSpace?`white-space: ${e.whiteSpace};`:''}\n ${e.wordBreak?`word-break: ${e.wordBreak};`:''}\n a {\n text-decoration: ${e.underlineLinks?'underline':'none'};\n &:hover {\n text-decoration: none;\n }\n }\n `),(e=>e.underline&&!e.ellipsis&&`\n text-decoration-line: underline;\n text-decoration-style: ${typeof e.underline=='string'?e.underline:'solid'};\n text-underline-offset: 0.3em;\n `),responsiveSize.responsiveSize,responsiveMargin.responsiveMargin,(e=>e.display?display.display(e.display):null),(e=>color.color(e.color?e.color:e.theme.textColor)));const TextEllipsis=styled__default.default.span.withConfig({shouldForwardProp:e=>!['lines','expanded','underline'].includes(e)}).withConfig({displayName:"Text__TextEllipsis",componentId:"ui__sc-s2fogy-1"})(["box-sizing:border-box;display:block;position:relative;"," ",""],(e=>!e.expanded&&`\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: ${e.lines};\n overflow: hidden;\n text-overflow: ellipsis;\n `),(e=>e.underline&&`\n text-decoration-line: underline;\n text-decoration-style: ${typeof e.underline=='string'?e.underline:'solid'};\n text-underline-offset: 0.3em;\n `));const LineHeight=styled__default.default.span.withConfig({displayName:"Text__LineHeight",componentId:"ui__sc-s2fogy-2"})(["box-sizing:border-box;position:absolute;visibility:hidden;"]);const ExpandButton=styled__default.default.button.withConfig({shouldForwardProp:e=>!['contrast','palette'].includes(e)}).withConfig({displayName:"Text__ExpandButton",componentId:"ui__sc-s2fogy-3"})(["box-sizing:border-box;appearance:none;padding:0;border:0;font-size:inherit;font-family:inherit;font-weight:inherit;font-style:inherit;margin-top:0.2em;text-decoration-line:underline;text-decoration-style:dashed;text-underline-offset:0.3em;cursor:pointer;&:disabled{cursor:not-allowed;}"," ",""],(e=>e.contrast?COLOR_SCHEMA.contrast:COLOR_SCHEMA.primary),focus.focus);exports.ExpandButton=ExpandButton,exports.LineHeight=LineHeight,exports.Root=Root,exports.TextEllipsis=TextEllipsis;
1
+ 'use strict';var styled=require('styled-components');var tinycolor=require('tinycolor2');var display=require('../../mixins/display.js');var color=require('../../mixins/color.js');var responsiveSize=require('../../mixins/responsive-size.js');var responsiveMargin=require('../../mixins/responsive-margin.js');var focus=require('../../mixins/focus.js');var style=require('../../shared/utils/style.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var styled__default=_interopDefault(styled);var tinycolor__default=_interopDefault(tinycolor);const WEIGHT_MAP={lighter:100,normal:400,bold:600,bolder:800};const LINE_HEIGHT_MAP={l:1.5,m:1.3,s:1.15,xs:1};const shouldForwardTextProp=style.createShouldForwardProp((e=>!['appearance','fontFamily','weight','fontStyle','transform','underlineLinks','textAlign','lineHeight','content','display','chars','quoted','showZeroMinorPart','separator','whiteSpace','wordBreak','underline','ellipsis'].includes(e)));const template=e=>`\n color: ${e.color};\n background-color: ${e.backgroundColor};\n &:hover {\n color: ${e.colorHover};\n }\n &:active {\n color: ${e.color};\n }\n &:disabled {\n color: ${e.colorDisabled};\n }\n`;const COLOR_SCHEMA={primary:styled.css(["",""],(e=>template({color:e.theme.colors['content-link'],colorHover:tinycolor__default.default(e.theme.colors['content-link']).lighten(10).toString(),colorDisabled:e.theme.colors['content-disabled'],backgroundColor:e.theme.colors.transparent,...e.palette}))),contrast:styled.css(["",""],(e=>template({color:e.theme.colors['content-oncolor-primary'],colorHover:tinycolor__default.default(e.theme.colors['content-oncolor-primary']).darken(10).toString(),colorDisabled:e.theme.colors['content-oncolor-disabled'],backgroundColor:e.theme.colors.transparent,...e.palette})))};const Root=styled__default.default.div.withConfig({shouldForwardProp:shouldForwardTextProp}).withConfig({displayName:"Text__Root",componentId:"ui__sc-s2fogy-0"})([""," "," "," "," "," ",""],(e=>`\n margin: 0;\n padding: 0;\n ${e.fontFamily?`font-family: ${e.fontFamily};`:''}\n ${e.transform?`text-transform: ${e.transform};`:''}\n ${e.weight?`font-weight: ${WEIGHT_MAP[e.weight]??e.weight};`:''}\n ${e.fontStyle?`font-style: ${e.fontStyle};`:''}\n ${e.textAlign?`text-align: ${e.textAlign};`:''}\n ${e.lineHeight?`line-height: ${LINE_HEIGHT_MAP[e.lineHeight]??e.lineHeight};`:''}\n ${e.whiteSpace?`white-space: ${e.whiteSpace};`:''}\n ${e.wordBreak?`word-break: ${e.wordBreak};`:''}\n a {\n text-decoration: ${e.underlineLinks?'underline':'none'};\n &:hover {\n text-decoration: none;\n }\n }\n `),(e=>e.underline&&!e.ellipsis&&`\n text-decoration-line: underline;\n text-decoration-style: ${typeof e.underline=='string'?e.underline:'solid'};\n text-underline-offset: 0.3em;\n `),responsiveSize.responsiveSize,responsiveMargin.responsiveMargin,(e=>e.display?display.display(e.display):null),(e=>color.color(e.color?e.color:e.theme.textColor)));const TextEllipsis=styled__default.default.span.withConfig({shouldForwardProp:e=>!['lines','expanded','underline'].includes(e)}).withConfig({displayName:"Text__TextEllipsis",componentId:"ui__sc-s2fogy-1"})(["box-sizing:border-box;display:block;position:relative;"," ",""],(e=>!e.expanded&&`\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: ${e.lines};\n overflow: hidden;\n text-overflow: ellipsis;\n `),(e=>e.underline&&`\n text-decoration-line: underline;\n text-decoration-style: ${typeof e.underline=='string'?e.underline:'solid'};\n text-underline-offset: 0.3em;\n `));const LineHeight=styled__default.default.span.withConfig({displayName:"Text__LineHeight",componentId:"ui__sc-s2fogy-2"})(["box-sizing:border-box;position:absolute;visibility:hidden;"]);const ExpandButton=styled__default.default.button.withConfig({shouldForwardProp:e=>!['contrast','palette'].includes(e)}).withConfig({displayName:"Text__ExpandButton",componentId:"ui__sc-s2fogy-3"})(["box-sizing:border-box;appearance:none;padding:0;border:0;font-size:inherit;font-family:inherit;font-weight:inherit;font-style:inherit;margin-top:0.2em;text-decoration-line:underline;text-decoration-style:dashed;text-underline-offset:0.3em;cursor:pointer;&:disabled{cursor:not-allowed;}"," ",""],(e=>e.contrast?COLOR_SCHEMA.contrast:COLOR_SCHEMA.primary),focus.focus);exports.ExpandButton=ExpandButton,exports.LineHeight=LineHeight,exports.Root=Root,exports.TextEllipsis=TextEllipsis;
2
2
  //# sourceMappingURL=style.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","sources":["../../../../src/components/Text/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport tinycolor from 'tinycolor2'\nimport { display } from 'mixins/display'\nimport { color } from 'mixins/color'\nimport { responsiveSize } from 'mixins/responsive-size'\nimport { responsiveMargin } from 'mixins/responsive-margin'\nimport { focus } from 'mixins/focus'\nimport { createShouldForwardProp } from 'shared/utils/style'\nimport type { Color, CSSColor } from 'shared/types'\nimport type { StyledTextProps, ExpandButtonPalette, StyledTextEllipsisProps, StyledExpandButtonProps } from './types'\n\nconst WEIGHT_MAP = {\n lighter: 100,\n normal: 400,\n bold: 600,\n bolder: 800,\n}\n\nconst LINE_HEIGHT_MAP = {\n l: 1.5,\n m: 1.3,\n s: 1.15,\n xs: 1,\n}\n\nconst shouldForwardTextProp = createShouldForwardProp(\n (propKey) =>\n ![\n 'appearance',\n 'fontFamily',\n 'weight',\n 'fontStyle',\n 'transform',\n 'underlineLinks',\n 'textAlign',\n 'lineHeight',\n 'content',\n 'display',\n 'chars',\n 'quoted',\n 'showZeroMinorPart',\n 'separator',\n 'whiteSpace',\n 'wordBreak',\n 'underline',\n 'ellipsis',\n ].includes(propKey)\n)\n\nconst template = (palette: ExpandButtonPalette) => `\n color: ${palette.color};\n background-color: ${palette.backgroundColor};\n &:hover {\n color: ${palette.colorHover};\n }\n &:active {\n color: ${palette.color};\n }\n &:disabled {\n color: ${palette.colorDisabled};\n }\n`\n\nconst COLOR_SCHEMA = {\n primary: css<StyledExpandButtonProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-link'],\n colorHover: tinycolor(props.theme.colors['content-link']).lighten(10).toString() as CSSColor,\n colorDisabled: props.theme.colors['content-disabled'],\n backgroundColor: props.theme.colors.transparent,\n ...props.palette,\n })}\n `,\n contrast: css<StyledExpandButtonProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-oncolor-primary'],\n colorHover: tinycolor(props.theme.colors['content-oncolor-primary']).darken(10).toString() as CSSColor,\n colorDisabled: props.theme.colors['content-oncolor-disabled'],\n backgroundColor: props.theme.colors.transparent,\n ...props.palette,\n })}\n `,\n}\n\nexport const Root = styled.div.withConfig<StyledTextProps>({\n shouldForwardProp: shouldForwardTextProp,\n})`\n ${(props) => `\n margin: 0;\n padding: 0;\n ${props.fontFamily ? `font-family: ${props.fontFamily};` : ''}\n ${props.transform ? `text-transform: ${props.transform};` : ''}\n ${props.weight ? `font-weight: ${WEIGHT_MAP[props.weight] ?? props.weight};` : ''}\n ${props.fontStyle ? `font-style: ${props.fontStyle};` : ''}\n ${props.textAlign ? `text-align: ${props.textAlign};` : ''}\n ${props.lineHeight ? `line-height: ${LINE_HEIGHT_MAP[props.lineHeight] ?? props.lineHeight};` : ''}\n ${props.whiteSpace ? `white-space: ${props.whiteSpace};` : ''}\n ${props.wordBreak ? `word-break: ${props.wordBreak};` : ''}\n a {\n text-decoration: ${props.underlineLinks ? 'underline' : 'none'};\n &:hover {\n text-decoration: none;\n }\n }\n `}\n\n ${(props) =>\n props.underline &&\n !props.ellipsis &&\n `\n text-decoration-line: underline;\n text-decoration-style: ${typeof props.underline === 'string' ? props.underline : 'solid'};\n text-underline-offset: 0.3em;\n `}\n\n ${responsiveSize}\n ${responsiveMargin}\n\n ${(props) => (props.display ? display(props.display) : null)}\n ${(props) => (props.color ? color(props.color) : color(props.theme.textColor as Color))}\n`\n\nexport const TextEllipsis = styled.span.withConfig<StyledTextEllipsisProps>({\n shouldForwardProp: (propKey) => !['lines', 'expanded', 'underline'].includes(propKey),\n})`\n box-sizing: border-box;\n display: block;\n position: relative;\n\n ${(props) =>\n !props.expanded &&\n `\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: ${props.lines};\n overflow: hidden;\n text-overflow: ellipsis;\n `}\n\n ${(props) =>\n props.underline &&\n `\n text-decoration-line: underline;\n text-decoration-style: ${typeof props.underline === 'string' ? props.underline : 'solid'};\n text-underline-offset: 0.3em;\n `}\n`\n\nexport const LineHeight = styled.span`\n box-sizing: border-box;\n position: absolute;\n visibility: hidden;\n`\n\nexport const ExpandButton = styled.button.withConfig<StyledExpandButtonProps>({\n shouldForwardProp: (propKey) => !['contrast', 'palette'].includes(propKey),\n})`\n box-sizing: border-box;\n appearance: none;\n padding: 0;\n border: 0;\n font-size: inherit;\n font-family: inherit;\n font-weight: inherit;\n font-style: inherit;\n margin-top: 0.2em;\n text-decoration-line: underline;\n text-decoration-style: dashed;\n text-underline-offset: 0.3em;\n cursor: pointer;\n &:disabled {\n cursor: not-allowed;\n }\n\n ${(props) => (props.contrast ? COLOR_SCHEMA.contrast : COLOR_SCHEMA.primary)}\n\n ${focus}\n`\n"],"names":["WEIGHT_MAP","lighter","normal","bold","bolder","LINE_HEIGHT_MAP","l","m","s","xs","shouldForwardTextProp","createShouldForwardProp","propKey","includes","template","palette","color","backgroundColor","colorHover","colorDisabled","COLOR_SCHEMA","primary","css","props","theme","colors","tinycolor","default","lighten","toString","transparent","contrast","darken","Root","styled","div","withConfig","shouldForwardProp","displayName","componentId","fontFamily","transform","weight","fontStyle","textAlign","lineHeight","whiteSpace","wordBreak","underlineLinks","underline","ellipsis","responsiveSize","responsiveMargin","display","textColor","TextEllipsis","span","expanded","lines","LineHeight","ExpandButton","button","focus"],"mappings":"4jBAWA,MAAMA,WAAa,CACjBC,QAAS,IACTC,OAAQ,IACRC,KAAM,IACNC,OAAQ,KAGV,MAAMC,gBAAkB,CACtBC,EAAG,IACHC,EAAG,IACHC,EAAG,KACHC,GAAI,GAGN,MAAMC,sBAAwBC,MAAuBA,yBAClDC,IACE,CACC,aACA,aACA,SACA,YACA,YACA,iBACA,YACA,aACA,UACA,UACA,QACA,SACA,oBACA,YACA,aACA,YACA,YACA,YACAC,SAASD,KAGf,MAAME,SAAYC,GAAiC,cACxCA,EAAQC,+BACGD,EAAQE,6CAEjBF,EAAQG,8CAGRH,EAAQC,2CAGRD,EAAQI,wBAIrB,MAAMC,aAAe,CACnBC,QAASC,OAAGA,IAAA,CAAA,GAAA,KACPC,GACDT,SAAS,CACPE,MAAO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,EAAM8B,QAAUA,gBAAQ9B,EAAM8B,SAAW,OACpD9B,GAAyBP,MAAKA,MAAnBO,EAAMP,MAAcO,EAAMP,MAAeO,EAAMC,MAAM8B,aAG9D,MAAMC,aAAerB,gBAAAA,QAAOsB,KAAKpB,WAAoC,CAC1EC,kBAAoBzB,IAAa,CAAC,QAAS,WAAY,aAAaC,SAASD,KAC7EwB,WAAA,CAAAE,YAAA,qBAAAC,YAAA,mBAF0BL,CAE1B,CAAA,yDAAA,IAAA,KAKGX,IACAA,EAAMkC,UACP,iGAGwBlC,EAAMmC,0EAK7BnC,GACDA,EAAM0B,WACN,iFAEkC1B,EAAM0B,WAAc,SAAW1B,EAAM0B,UAAY,8DAK1EU,WAAazB,gBAAAA,QAAOsB,KAAIpB,WAAA,CAAAE,YAAA,mBAAAC,YAAA,mBAAXL,CAIzB,CAAA,+DAEM,MAAM0B,aAAe1B,gBAAAA,QAAO2B,OAAOzB,WAAoC,CAC5EC,kBAAoBzB,IAAa,CAAC,WAAY,WAAWC,SAASD,KAClEwB,WAAA,CAAAE,YAAA,qBAAAC,YAAA,mBAF0BL,CAE1B,CAAA,gSAAA,IAAA,KAkBGX,GAAWA,EAAMQ,SAAWX,aAAaW,SAAWX,aAAaC,SAElEyC,MAAKA"}
1
+ {"version":3,"file":"style.js","sources":["../../../../src/components/Text/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport tinycolor from 'tinycolor2'\nimport { display } from 'mixins/display'\nimport { color } from 'mixins/color'\nimport { responsiveSize } from 'mixins/responsive-size'\nimport { responsiveMargin } from 'mixins/responsive-margin'\nimport { focus } from 'mixins/focus'\nimport { createShouldForwardProp } from 'shared/utils/style'\nimport type { Color, CSSColor } from 'shared/types'\nimport type { StyledTextProps, ExpandButtonPalette, StyledTextEllipsisProps, StyledExpandButtonProps } from './types'\n\nconst WEIGHT_MAP = {\n lighter: 100,\n normal: 400,\n bold: 600,\n bolder: 800,\n}\n\nconst LINE_HEIGHT_MAP = {\n l: 1.5,\n m: 1.3,\n s: 1.15,\n xs: 1,\n}\n\nconst shouldForwardTextProp = createShouldForwardProp(\n (propKey) =>\n ![\n 'appearance',\n 'fontFamily',\n 'weight',\n 'fontStyle',\n 'transform',\n 'underlineLinks',\n 'textAlign',\n 'lineHeight',\n 'content',\n 'display',\n 'chars',\n 'quoted',\n 'showZeroMinorPart',\n 'separator',\n 'whiteSpace',\n 'wordBreak',\n 'underline',\n 'ellipsis',\n ].includes(propKey)\n)\n\nconst template = (palette: ExpandButtonPalette) => `\n color: ${palette.color};\n background-color: ${palette.backgroundColor};\n &:hover {\n color: ${palette.colorHover};\n }\n &:active {\n color: ${palette.color};\n }\n &:disabled {\n color: ${palette.colorDisabled};\n }\n`\n\nconst COLOR_SCHEMA = {\n primary: css<StyledExpandButtonProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-link'],\n colorHover: tinycolor(props.theme.colors['content-link']).lighten(10).toString() as CSSColor,\n colorDisabled: props.theme.colors['content-disabled'],\n backgroundColor: props.theme.colors.transparent,\n ...props.palette,\n })}\n `,\n contrast: css<StyledExpandButtonProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-oncolor-primary'],\n colorHover: tinycolor(props.theme.colors['content-oncolor-primary']).darken(10).toString() as CSSColor,\n colorDisabled: props.theme.colors['content-oncolor-disabled'],\n backgroundColor: props.theme.colors.transparent,\n ...props.palette,\n })}\n `,\n}\n\nexport const Root = styled.div.withConfig<StyledTextProps>({\n shouldForwardProp: shouldForwardTextProp,\n})`\n ${(props) => `\n margin: 0;\n padding: 0;\n ${props.fontFamily ? `font-family: ${props.fontFamily};` : ''}\n ${props.transform ? `text-transform: ${props.transform};` : ''}\n ${props.weight ? `font-weight: ${WEIGHT_MAP[props.weight] ?? props.weight};` : ''}\n ${props.fontStyle ? `font-style: ${props.fontStyle};` : ''}\n ${props.textAlign ? `text-align: ${props.textAlign};` : ''}\n ${props.lineHeight ? `line-height: ${LINE_HEIGHT_MAP[props.lineHeight] ?? props.lineHeight};` : ''}\n ${props.whiteSpace ? `white-space: ${props.whiteSpace};` : ''}\n ${props.wordBreak ? `word-break: ${props.wordBreak};` : ''}\n a {\n text-decoration: ${props.underlineLinks ? 'underline' : 'none'};\n &:hover {\n text-decoration: none;\n }\n }\n `}\n\n ${(props) =>\n props.underline &&\n !props.ellipsis &&\n `\n text-decoration-line: underline;\n text-decoration-style: ${typeof props.underline === 'string' ? props.underline : 'solid'};\n text-underline-offset: 0.3em;\n `}\n\n ${responsiveSize}\n ${responsiveMargin}\n\n ${(props) => (props.display ? display(props.display) : null)}\n ${(props) => (props.color ? color(props.color) : color(props.theme.textColor as Color))}\n`\n\nexport const TextEllipsis = styled.span.withConfig<StyledTextEllipsisProps>({\n shouldForwardProp: (propKey) => !['lines', 'expanded', 'underline'].includes(propKey),\n})`\n box-sizing: border-box;\n display: block;\n position: relative;\n\n ${(props) =>\n !props.expanded &&\n `\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: ${props.lines};\n overflow: hidden;\n text-overflow: ellipsis;\n `}\n\n ${(props) =>\n props.underline &&\n `\n text-decoration-line: underline;\n text-decoration-style: ${typeof props.underline === 'string' ? props.underline : 'solid'};\n text-underline-offset: 0.3em;\n `}\n`\n\nexport const LineHeight = styled.span`\n box-sizing: border-box;\n position: absolute;\n visibility: hidden;\n`\n\nexport const ExpandButton = styled.button.withConfig<StyledExpandButtonProps>({\n shouldForwardProp: (propKey) => !['contrast', 'palette'].includes(propKey),\n})`\n box-sizing: border-box;\n appearance: none;\n padding: 0;\n border: 0;\n font-size: inherit;\n font-family: inherit;\n font-weight: inherit;\n font-style: inherit;\n margin-top: 0.2em;\n text-decoration-line: underline;\n text-decoration-style: dashed;\n text-underline-offset: 0.3em;\n cursor: pointer;\n &:disabled {\n cursor: not-allowed;\n }\n\n ${(props) => (props.contrast ? COLOR_SCHEMA.contrast : COLOR_SCHEMA.primary)}\n\n ${focus}\n`\n"],"names":["WEIGHT_MAP","lighter","normal","bold","bolder","LINE_HEIGHT_MAP","l","m","s","xs","shouldForwardTextProp","createShouldForwardProp","propKey","includes","template","palette","color","backgroundColor","colorHover","colorDisabled","COLOR_SCHEMA","primary","css","props","theme","colors","tinycolor","default","lighten","toString","transparent","contrast","darken","Root","styled","div","withConfig","shouldForwardProp","displayName","componentId","fontFamily","transform","weight","fontStyle","textAlign","lineHeight","whiteSpace","wordBreak","underlineLinks","underline","ellipsis","responsiveSize","responsiveMargin","display","textColor","TextEllipsis","span","expanded","lines","LineHeight","ExpandButton","button","focus"],"mappings":"8iBAWA,MAAMA,WAAa,CACjBC,QAAS,IACTC,OAAQ,IACRC,KAAM,IACNC,OAAQ,KAGV,MAAMC,gBAAkB,CACtBC,EAAG,IACHC,EAAG,IACHC,EAAG,KACHC,GAAI,GAGN,MAAMC,sBAAwBC,MAAuBA,yBAClDC,IACE,CACC,aACA,aACA,SACA,YACA,YACA,iBACA,YACA,aACA,UACA,UACA,QACA,SACA,oBACA,YACA,aACA,YACA,YACA,YACAC,SAASD,KAGf,MAAME,SAAYC,GAAiC,cACxCA,EAAQC,+BACGD,EAAQE,6CAEjBF,EAAQG,8CAGRH,EAAQC,2CAGRD,EAAQI,wBAIrB,MAAMC,aAAe,CACnBC,QAASC,OAAGA,IAAA,CAAA,GAAA,KACPC,GACDT,SAAS,CACPE,MAAOO,EAAMC,MAAMC,OAAO,gBAC1BP,WAAYQ,mBAASC,QAACJ,EAAMC,MAAMC,OAAO,iBAAiBG,QAAQ,IAAIC,WACtEV,cAAeI,EAAMC,MAAMC,OAAO,oBAClCR,gBAAiBM,EAAMC,MAAMC,OAAOK,eACjCP,EAAMR,YAGfgB,SAAUT,OAAGA,IAAA,CAAA,GAAA,KACRC,GACDT,SAAS,CACPE,MAAOO,EAAMC,MAAMC,OAAO,2BAC1BP,WAAYQ,mBAASC,QAACJ,EAAMC,MAAMC,OAAO,4BAA4BO,OAAO,IAAIH,WAChFV,cAAeI,EAAMC,MAAMC,OAAO,4BAClCR,gBAAiBM,EAAMC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W1B,EAAM0B,UAAY,8DAK1EU,WAAazB,gBAAAA,QAAOsB,KAAIpB,WAAA,CAAAE,YAAA,mBAAAC,YAAA,mBAAXL,CAIzB,CAAA,+DAEM,MAAM0B,aAAe1B,gBAAAA,QAAO2B,OAAOzB,WAAoC,CAC5EC,kBAAoBzB,IAAa,CAAC,WAAY,WAAWC,SAASD,KAClEwB,WAAA,CAAAE,YAAA,qBAAAC,YAAA,mBAF0BL,CAE1B,CAAA,gSAAA,IAAA,KAkBGX,GAAWA,EAAMQ,SAAWX,aAAaW,SAAWX,aAAaC,SAElEyC,MAAKA"}
@@ -1,2 +1,2 @@
1
- import styled,{css}from'styled-components';import tinycolor from'../../external/.pnpm/tinycolor2@1.4.2/node_modules/tinycolor2/tinycolor.mjs';import{display}from'../../mixins/display.mjs';import{color}from'../../mixins/color.mjs';import{responsiveSize}from'../../mixins/responsive-size.mjs';import{responsiveMargin}from'../../mixins/responsive-margin.mjs';import{focus}from'../../mixins/focus.mjs';import{createShouldForwardProp}from'../../shared/utils/style.mjs';const WEIGHT_MAP={lighter:100,normal:400,bold:600,bolder:800};const LINE_HEIGHT_MAP={l:1.5,m:1.3,s:1.15,xs:1};const shouldForwardTextProp=createShouldForwardProp((o=>!['appearance','fontFamily','weight','fontStyle','transform','underlineLinks','textAlign','lineHeight','content','display','chars','quoted','showZeroMinorPart','separator','whiteSpace','wordBreak','underline','ellipsis'].includes(o)));const template=o=>`\n color: ${o.color};\n background-color: ${o.backgroundColor};\n &:hover {\n color: ${o.colorHover};\n }\n &:active {\n color: ${o.color};\n }\n &:disabled {\n color: ${o.colorDisabled};\n }\n`;const COLOR_SCHEMA={primary:css(["",""],(o=>template({color:o.theme.colors['content-link'],colorHover:tinycolor(o.theme.colors['content-link']).lighten(10).toString(),colorDisabled:o.theme.colors['content-disabled'],backgroundColor:o.theme.colors.transparent,...o.palette}))),contrast:css(["",""],(o=>template({color:o.theme.colors['content-oncolor-primary'],colorHover:tinycolor(o.theme.colors['content-oncolor-primary']).darken(10).toString(),colorDisabled:o.theme.colors['content-oncolor-disabled'],backgroundColor:o.theme.colors.transparent,...o.palette})))};const Root=styled.div.withConfig({shouldForwardProp:shouldForwardTextProp}).withConfig({displayName:"Text__Root",componentId:"ui__sc-s2fogy-0"})([""," "," "," "," "," ",""],(o=>`\n margin: 0;\n padding: 0;\n ${o.fontFamily?`font-family: ${o.fontFamily};`:''}\n ${o.transform?`text-transform: ${o.transform};`:''}\n ${o.weight?`font-weight: ${WEIGHT_MAP[o.weight]??o.weight};`:''}\n ${o.fontStyle?`font-style: ${o.fontStyle};`:''}\n ${o.textAlign?`text-align: ${o.textAlign};`:''}\n ${o.lineHeight?`line-height: ${LINE_HEIGHT_MAP[o.lineHeight]??o.lineHeight};`:''}\n ${o.whiteSpace?`white-space: ${o.whiteSpace};`:''}\n ${o.wordBreak?`word-break: ${o.wordBreak};`:''}\n a {\n text-decoration: ${o.underlineLinks?'underline':'none'};\n &:hover {\n text-decoration: none;\n }\n }\n `),(o=>o.underline&&!o.ellipsis&&`\n text-decoration-line: underline;\n text-decoration-style: ${typeof o.underline=='string'?o.underline:'solid'};\n text-underline-offset: 0.3em;\n `),responsiveSize,responsiveMargin,(o=>o.display?display(o.display):null),(o=>color(o.color?o.color:o.theme.textColor)));const TextEllipsis=styled.span.withConfig({shouldForwardProp:o=>!['lines','expanded','underline'].includes(o)}).withConfig({displayName:"Text__TextEllipsis",componentId:"ui__sc-s2fogy-1"})(["box-sizing:border-box;display:block;position:relative;"," ",""],(o=>!o.expanded&&`\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: ${o.lines};\n overflow: hidden;\n text-overflow: ellipsis;\n `),(o=>o.underline&&`\n text-decoration-line: underline;\n text-decoration-style: ${typeof o.underline=='string'?o.underline:'solid'};\n text-underline-offset: 0.3em;\n `));const LineHeight=styled.span.withConfig({displayName:"Text__LineHeight",componentId:"ui__sc-s2fogy-2"})(["box-sizing:border-box;position:absolute;visibility:hidden;"]);const ExpandButton=styled.button.withConfig({shouldForwardProp:o=>!['contrast','palette'].includes(o)}).withConfig({displayName:"Text__ExpandButton",componentId:"ui__sc-s2fogy-3"})(["box-sizing:border-box;appearance:none;padding:0;border:0;font-size:inherit;font-family:inherit;font-weight:inherit;font-style:inherit;margin-top:0.2em;text-decoration-line:underline;text-decoration-style:dashed;text-underline-offset:0.3em;cursor:pointer;&:disabled{cursor:not-allowed;}"," ",""],(o=>o.contrast?COLOR_SCHEMA.contrast:COLOR_SCHEMA.primary),focus);export{ExpandButton,LineHeight,Root,TextEllipsis};
1
+ import styled,{css}from'styled-components';import tinycolor from'tinycolor2';import{display}from'../../mixins/display.mjs';import{color}from'../../mixins/color.mjs';import{responsiveSize}from'../../mixins/responsive-size.mjs';import{responsiveMargin}from'../../mixins/responsive-margin.mjs';import{focus}from'../../mixins/focus.mjs';import{createShouldForwardProp}from'../../shared/utils/style.mjs';const WEIGHT_MAP={lighter:100,normal:400,bold:600,bolder:800};const LINE_HEIGHT_MAP={l:1.5,m:1.3,s:1.15,xs:1};const shouldForwardTextProp=createShouldForwardProp((o=>!['appearance','fontFamily','weight','fontStyle','transform','underlineLinks','textAlign','lineHeight','content','display','chars','quoted','showZeroMinorPart','separator','whiteSpace','wordBreak','underline','ellipsis'].includes(o)));const template=o=>`\n color: ${o.color};\n background-color: ${o.backgroundColor};\n &:hover {\n color: ${o.colorHover};\n }\n &:active {\n color: ${o.color};\n }\n &:disabled {\n color: ${o.colorDisabled};\n }\n`;const COLOR_SCHEMA={primary:css(["",""],(o=>template({color:o.theme.colors['content-link'],colorHover:tinycolor(o.theme.colors['content-link']).lighten(10).toString(),colorDisabled:o.theme.colors['content-disabled'],backgroundColor:o.theme.colors.transparent,...o.palette}))),contrast:css(["",""],(o=>template({color:o.theme.colors['content-oncolor-primary'],colorHover:tinycolor(o.theme.colors['content-oncolor-primary']).darken(10).toString(),colorDisabled:o.theme.colors['content-oncolor-disabled'],backgroundColor:o.theme.colors.transparent,...o.palette})))};const Root=styled.div.withConfig({shouldForwardProp:shouldForwardTextProp}).withConfig({displayName:"Text__Root",componentId:"ui__sc-s2fogy-0"})([""," "," "," "," "," ",""],(o=>`\n margin: 0;\n padding: 0;\n ${o.fontFamily?`font-family: ${o.fontFamily};`:''}\n ${o.transform?`text-transform: ${o.transform};`:''}\n ${o.weight?`font-weight: ${WEIGHT_MAP[o.weight]??o.weight};`:''}\n ${o.fontStyle?`font-style: ${o.fontStyle};`:''}\n ${o.textAlign?`text-align: ${o.textAlign};`:''}\n ${o.lineHeight?`line-height: ${LINE_HEIGHT_MAP[o.lineHeight]??o.lineHeight};`:''}\n ${o.whiteSpace?`white-space: ${o.whiteSpace};`:''}\n ${o.wordBreak?`word-break: ${o.wordBreak};`:''}\n a {\n text-decoration: ${o.underlineLinks?'underline':'none'};\n &:hover {\n text-decoration: none;\n }\n }\n `),(o=>o.underline&&!o.ellipsis&&`\n text-decoration-line: underline;\n text-decoration-style: ${typeof o.underline=='string'?o.underline:'solid'};\n text-underline-offset: 0.3em;\n `),responsiveSize,responsiveMargin,(o=>o.display?display(o.display):null),(o=>color(o.color?o.color:o.theme.textColor)));const TextEllipsis=styled.span.withConfig({shouldForwardProp:o=>!['lines','expanded','underline'].includes(o)}).withConfig({displayName:"Text__TextEllipsis",componentId:"ui__sc-s2fogy-1"})(["box-sizing:border-box;display:block;position:relative;"," ",""],(o=>!o.expanded&&`\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: ${o.lines};\n overflow: hidden;\n text-overflow: ellipsis;\n `),(o=>o.underline&&`\n text-decoration-line: underline;\n text-decoration-style: ${typeof o.underline=='string'?o.underline:'solid'};\n text-underline-offset: 0.3em;\n `));const LineHeight=styled.span.withConfig({displayName:"Text__LineHeight",componentId:"ui__sc-s2fogy-2"})(["box-sizing:border-box;position:absolute;visibility:hidden;"]);const ExpandButton=styled.button.withConfig({shouldForwardProp:o=>!['contrast','palette'].includes(o)}).withConfig({displayName:"Text__ExpandButton",componentId:"ui__sc-s2fogy-3"})(["box-sizing:border-box;appearance:none;padding:0;border:0;font-size:inherit;font-family:inherit;font-weight:inherit;font-style:inherit;margin-top:0.2em;text-decoration-line:underline;text-decoration-style:dashed;text-underline-offset:0.3em;cursor:pointer;&:disabled{cursor:not-allowed;}"," ",""],(o=>o.contrast?COLOR_SCHEMA.contrast:COLOR_SCHEMA.primary),focus);export{ExpandButton,LineHeight,Root,TextEllipsis};
2
2
  //# sourceMappingURL=style.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"style.mjs","sources":["../../../../src/components/Text/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport tinycolor from 'tinycolor2'\nimport { display } from 'mixins/display'\nimport { color } from 'mixins/color'\nimport { responsiveSize } from 'mixins/responsive-size'\nimport { responsiveMargin } from 'mixins/responsive-margin'\nimport { focus } from 'mixins/focus'\nimport { createShouldForwardProp } from 'shared/utils/style'\nimport type { Color, CSSColor } from 'shared/types'\nimport type { StyledTextProps, ExpandButtonPalette, StyledTextEllipsisProps, StyledExpandButtonProps } from './types'\n\nconst WEIGHT_MAP = {\n lighter: 100,\n normal: 400,\n bold: 600,\n bolder: 800,\n}\n\nconst LINE_HEIGHT_MAP = {\n l: 1.5,\n m: 1.3,\n s: 1.15,\n xs: 1,\n}\n\nconst shouldForwardTextProp = createShouldForwardProp(\n (propKey) =>\n ![\n 'appearance',\n 'fontFamily',\n 'weight',\n 'fontStyle',\n 'transform',\n 'underlineLinks',\n 'textAlign',\n 'lineHeight',\n 'content',\n 'display',\n 'chars',\n 'quoted',\n 'showZeroMinorPart',\n 'separator',\n 'whiteSpace',\n 'wordBreak',\n 'underline',\n 'ellipsis',\n ].includes(propKey)\n)\n\nconst template = (palette: ExpandButtonPalette) => `\n color: ${palette.color};\n background-color: ${palette.backgroundColor};\n &:hover {\n color: ${palette.colorHover};\n }\n &:active {\n color: ${palette.color};\n }\n &:disabled {\n color: ${palette.colorDisabled};\n }\n`\n\nconst COLOR_SCHEMA = {\n primary: css<StyledExpandButtonProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-link'],\n colorHover: tinycolor(props.theme.colors['content-link']).lighten(10).toString() as CSSColor,\n colorDisabled: props.theme.colors['content-disabled'],\n backgroundColor: props.theme.colors.transparent,\n ...props.palette,\n })}\n `,\n contrast: css<StyledExpandButtonProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-oncolor-primary'],\n colorHover: tinycolor(props.theme.colors['content-oncolor-primary']).darken(10).toString() as CSSColor,\n colorDisabled: props.theme.colors['content-oncolor-disabled'],\n backgroundColor: props.theme.colors.transparent,\n ...props.palette,\n })}\n `,\n}\n\nexport const Root = styled.div.withConfig<StyledTextProps>({\n shouldForwardProp: shouldForwardTextProp,\n})`\n ${(props) => `\n margin: 0;\n padding: 0;\n ${props.fontFamily ? `font-family: ${props.fontFamily};` : ''}\n ${props.transform ? `text-transform: ${props.transform};` : ''}\n ${props.weight ? `font-weight: ${WEIGHT_MAP[props.weight] ?? props.weight};` : ''}\n ${props.fontStyle ? `font-style: ${props.fontStyle};` : ''}\n ${props.textAlign ? `text-align: ${props.textAlign};` : ''}\n ${props.lineHeight ? `line-height: ${LINE_HEIGHT_MAP[props.lineHeight] ?? props.lineHeight};` : ''}\n ${props.whiteSpace ? `white-space: ${props.whiteSpace};` : ''}\n ${props.wordBreak ? `word-break: ${props.wordBreak};` : ''}\n a {\n text-decoration: ${props.underlineLinks ? 'underline' : 'none'};\n &:hover {\n text-decoration: none;\n }\n }\n `}\n\n ${(props) =>\n props.underline &&\n !props.ellipsis &&\n `\n text-decoration-line: underline;\n text-decoration-style: ${typeof props.underline === 'string' ? props.underline : 'solid'};\n text-underline-offset: 0.3em;\n `}\n\n ${responsiveSize}\n ${responsiveMargin}\n\n ${(props) => (props.display ? display(props.display) : null)}\n ${(props) => (props.color ? color(props.color) : color(props.theme.textColor as Color))}\n`\n\nexport const TextEllipsis = styled.span.withConfig<StyledTextEllipsisProps>({\n shouldForwardProp: (propKey) => !['lines', 'expanded', 'underline'].includes(propKey),\n})`\n box-sizing: border-box;\n display: block;\n position: relative;\n\n ${(props) =>\n !props.expanded &&\n `\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: ${props.lines};\n overflow: hidden;\n text-overflow: ellipsis;\n `}\n\n ${(props) =>\n props.underline &&\n `\n text-decoration-line: underline;\n text-decoration-style: ${typeof props.underline === 'string' ? props.underline : 'solid'};\n text-underline-offset: 0.3em;\n `}\n`\n\nexport const LineHeight = styled.span`\n box-sizing: border-box;\n position: absolute;\n visibility: hidden;\n`\n\nexport const ExpandButton = styled.button.withConfig<StyledExpandButtonProps>({\n shouldForwardProp: (propKey) => !['contrast', 'palette'].includes(propKey),\n})`\n box-sizing: border-box;\n appearance: none;\n padding: 0;\n border: 0;\n font-size: inherit;\n font-family: inherit;\n font-weight: inherit;\n font-style: inherit;\n margin-top: 0.2em;\n text-decoration-line: underline;\n text-decoration-style: dashed;\n text-underline-offset: 0.3em;\n cursor: pointer;\n &:disabled {\n cursor: not-allowed;\n }\n\n ${(props) => (props.contrast ? COLOR_SCHEMA.contrast : COLOR_SCHEMA.primary)}\n\n ${focus}\n`\n"],"names":["WEIGHT_MAP","lighter","normal","bold","bolder","LINE_HEIGHT_MAP","l","m","s","xs","shouldForwardTextProp","createShouldForwardProp","propKey","includes","template","palette","color","backgroundColor","colorHover","colorDisabled","COLOR_SCHEMA","primary","css","props","theme","colors","tinycolor","lighten","toString","transparent","contrast","darken","Root","styled","div","withConfig","shouldForwardProp","displayName","componentId","fontFamily","transform","weight","fontStyle","textAlign","lineHeight","whiteSpace","wordBreak","underlineLinks","underline","ellipsis","responsiveSize","responsiveMargin","display","textColor","TextEllipsis","span","expanded","lines","LineHeight","ExpandButton","button","focus"],"mappings":"gdAWA,MAAMA,WAAa,CACjBC,QAAS,IACTC,OAAQ,IACRC,KAAM,IACNC,OAAQ,KAGV,MAAMC,gBAAkB,CACtBC,EAAG,IACHC,EAAG,IACHC,EAAG,KACHC,GAAI,GAGN,M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,EAAMqB,cAAgB,WAC9FrB,EAAMsB,WAAa,gBAAgBtB,EAAMsB,cAAgB,WACzDtB,EAAMuB,UAAY,eAAevB,EAAMuB,aAAe,uCAEnCvB,EAAMwB,eAAiB,YAAc,iFAOzDxB,GACDA,EAAMyB,YACLzB,EAAM0B,UACP,iFAEkC1B,EAAMyB,WAAc,SAAWzB,EAAMyB,UAAY,uDAInFE,eACAC,kBAEC5B,GAAWA,EAAM6B,QAAUA,QAAQ7B,EAAM6B,SAAW,OACpD7B,GAAyBP,MAAdO,EAAMP,MAAcO,EAAMP,MAAeO,EAAMC,MAAM6B,aAG9D,MAAMC,aAAerB,OAAOsB,KAAKpB,WAAoC,CAC1EC,kBAAoBxB,IAAa,CAAC,QAAS,WAAY,aAAaC,SAASD,KAC7EuB,WAAA,CAAAE,YAAA,qBAAAC,YAAA,mBAF0BL,CAE1B,CAAA,yDAAA,IAAA,KAKGV,IACAA,EAAMiC,UACP,iGAGwBjC,EAAMkC,0EAK7BlC,GACDA,EAAMyB,WACN,iFAEkCzB,EAAMyB,WAAc,SAAWzB,EAAMyB,UAAY,8DAK1EU,WAAazB,OAAOsB,KAAIpB,WAAA,CAAAE,YAAA,mBAAAC,YAAA,mBAAXL,CAIzB,CAAA,+DAEM,MAAM0B,aAAe1B,OAAO2B,OAAOzB,WAAoC,CAC5EC,kBAAoBxB,IAAa,CAAC,WAAY,WAAWC,SAASD,KAClEuB,WAAA,CAAAE,YAAA,qBAAAC,YAAA,mBAF0BL,CAE1B,CAAA,gSAAA,IAAA,KAkBGV,GAAWA,EAAMO,SAAWV,aAAaU,SAAWV,aAAaC,SAElEwC"}
1
+ {"version":3,"file":"style.mjs","sources":["../../../../src/components/Text/style.ts"],"sourcesContent":["import styled, { css } from 'styled-components'\nimport tinycolor from 'tinycolor2'\nimport { display } from 'mixins/display'\nimport { color } from 'mixins/color'\nimport { responsiveSize } from 'mixins/responsive-size'\nimport { responsiveMargin } from 'mixins/responsive-margin'\nimport { focus } from 'mixins/focus'\nimport { createShouldForwardProp } from 'shared/utils/style'\nimport type { Color, CSSColor } from 'shared/types'\nimport type { StyledTextProps, ExpandButtonPalette, StyledTextEllipsisProps, StyledExpandButtonProps } from './types'\n\nconst WEIGHT_MAP = {\n lighter: 100,\n normal: 400,\n bold: 600,\n bolder: 800,\n}\n\nconst LINE_HEIGHT_MAP = {\n l: 1.5,\n m: 1.3,\n s: 1.15,\n xs: 1,\n}\n\nconst shouldForwardTextProp = createShouldForwardProp(\n (propKey) =>\n ![\n 'appearance',\n 'fontFamily',\n 'weight',\n 'fontStyle',\n 'transform',\n 'underlineLinks',\n 'textAlign',\n 'lineHeight',\n 'content',\n 'display',\n 'chars',\n 'quoted',\n 'showZeroMinorPart',\n 'separator',\n 'whiteSpace',\n 'wordBreak',\n 'underline',\n 'ellipsis',\n ].includes(propKey)\n)\n\nconst template = (palette: ExpandButtonPalette) => `\n color: ${palette.color};\n background-color: ${palette.backgroundColor};\n &:hover {\n color: ${palette.colorHover};\n }\n &:active {\n color: ${palette.color};\n }\n &:disabled {\n color: ${palette.colorDisabled};\n }\n`\n\nconst COLOR_SCHEMA = {\n primary: css<StyledExpandButtonProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-link'],\n colorHover: tinycolor(props.theme.colors['content-link']).lighten(10).toString() as CSSColor,\n colorDisabled: props.theme.colors['content-disabled'],\n backgroundColor: props.theme.colors.transparent,\n ...props.palette,\n })}\n `,\n contrast: css<StyledExpandButtonProps>`\n ${(props) =>\n template({\n color: props.theme.colors['content-oncolor-primary'],\n colorHover: tinycolor(props.theme.colors['content-oncolor-primary']).darken(10).toString() as CSSColor,\n colorDisabled: props.theme.colors['content-oncolor-disabled'],\n backgroundColor: props.theme.colors.transparent,\n ...props.palette,\n })}\n `,\n}\n\nexport const Root = styled.div.withConfig<StyledTextProps>({\n shouldForwardProp: shouldForwardTextProp,\n})`\n ${(props) => `\n margin: 0;\n padding: 0;\n ${props.fontFamily ? `font-family: ${props.fontFamily};` : ''}\n ${props.transform ? `text-transform: ${props.transform};` : ''}\n ${props.weight ? `font-weight: ${WEIGHT_MAP[props.weight] ?? props.weight};` : ''}\n ${props.fontStyle ? `font-style: ${props.fontStyle};` : ''}\n ${props.textAlign ? `text-align: ${props.textAlign};` : ''}\n ${props.lineHeight ? `line-height: ${LINE_HEIGHT_MAP[props.lineHeight] ?? props.lineHeight};` : ''}\n ${props.whiteSpace ? `white-space: ${props.whiteSpace};` : ''}\n ${props.wordBreak ? `word-break: ${props.wordBreak};` : ''}\n a {\n text-decoration: ${props.underlineLinks ? 'underline' : 'none'};\n &:hover {\n text-decoration: none;\n }\n }\n `}\n\n ${(props) =>\n props.underline &&\n !props.ellipsis &&\n `\n text-decoration-line: underline;\n text-decoration-style: ${typeof props.underline === 'string' ? props.underline : 'solid'};\n text-underline-offset: 0.3em;\n `}\n\n ${responsiveSize}\n ${responsiveMargin}\n\n ${(props) => (props.display ? display(props.display) : null)}\n ${(props) => (props.color ? color(props.color) : color(props.theme.textColor as Color))}\n`\n\nexport const TextEllipsis = styled.span.withConfig<StyledTextEllipsisProps>({\n shouldForwardProp: (propKey) => !['lines', 'expanded', 'underline'].includes(propKey),\n})`\n box-sizing: border-box;\n display: block;\n position: relative;\n\n ${(props) =>\n !props.expanded &&\n `\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: ${props.lines};\n overflow: hidden;\n text-overflow: ellipsis;\n `}\n\n ${(props) =>\n props.underline &&\n `\n text-decoration-line: underline;\n text-decoration-style: ${typeof props.underline === 'string' ? props.underline : 'solid'};\n text-underline-offset: 0.3em;\n `}\n`\n\nexport const LineHeight = styled.span`\n box-sizing: border-box;\n position: absolute;\n visibility: hidden;\n`\n\nexport const ExpandButton = styled.button.withConfig<StyledExpandButtonProps>({\n shouldForwardProp: (propKey) => !['contrast', 'palette'].includes(propKey),\n})`\n box-sizing: border-box;\n appearance: none;\n padding: 0;\n border: 0;\n font-size: inherit;\n font-family: inherit;\n font-weight: inherit;\n font-style: inherit;\n margin-top: 0.2em;\n text-decoration-line: underline;\n text-decoration-style: dashed;\n text-underline-offset: 0.3em;\n cursor: pointer;\n &:disabled {\n cursor: not-allowed;\n }\n\n ${(props) => (props.contrast ? COLOR_SCHEMA.contrast : COLOR_SCHEMA.primary)}\n\n ${focus}\n`\n"],"names":["WEIGHT_MAP","lighter","normal","bold","bolder","LINE_HEIGHT_MAP","l","m","s","xs","shouldForwardTextProp","createShouldForwardProp","propKey","includes","template","palette","color","backgroundColor","colorHover","colorDisabled","COLOR_SCHEMA","primary","css","props","theme","colors","tinycolor","lighten","toString","transparent","contrast","darken","Root","styled","div","withConfig","shouldForwardProp","displayName","componentId","fontFamily","transform","weight","fontStyle","textAlign","lineHeight","whiteSpace","wordBreak","underlineLinks","underline","ellipsis","responsiveSize","responsiveMargin","display","textColor","TextEllipsis","span","expanded","lines","LineHeight","ExpandButton","button","focus"],"mappings":"+YAWA,MAAMA,WAAa,CACjBC,QAAS,IACTC,OAAQ,IACRC,KAAM,IACNC,OAAQ,KAGV,MAAMC,gBAAkB,CACtBC,EAAG,IACHC,EAAG,IACHC,EAAG,KACHC,GAAI,GAGN,MAAMC,sBAAwBC,yBAC3BC,IACE,CACC,aACA,aACA,SACA,YACA,YACA,iBACA,YACA,aACA,UACA,UACA,QACA,SACA,oBACA,YACA,aACA,YACA,YACA,YACAC,SAASD,KAGf,MAAME,SAAYC,GAAiC,cACxCA,EAAQC,+BACGD,EAAQE,6CAEjBF,EAAQG,8CAGRH,EAAQC,2CAGRD,EAAQI,wBAIrB,MAAMC,aAAe,CACnBC,QAASC,IAAG,CAAA,GAAA,KACPC,GACDT,SAAS,CACPE,MAAOO,EAAMC,MAAMC,OAAO,gBAC1BP,WAAYQ,UAAUH,EAAMC,MAAMC,OAAO,iBAAiBE,QAAQ,IAAIC,WACtET,cAAeI,EAAMC,MAAMC,OAAO,oBAClCR,gBAAiBM,EAAMC,MAAMC,OAAOI,eACjCN,EAAMR,YAGfe,SAAUR,IAAG,CAAA,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mBAF0BL,CAE1B,CAAA,yDAAA,IAAA,KAKGV,IACAA,EAAMiC,UACP,iGAGwBjC,EAAMkC,0EAK7BlC,GACDA,EAAMyB,WACN,iFAEkCzB,EAAMyB,WAAc,SAAWzB,EAAMyB,UAAY,8DAK1EU,WAAazB,OAAOsB,KAAIpB,WAAA,CAAAE,YAAA,mBAAAC,YAAA,mBAAXL,CAIzB,CAAA,+DAEM,MAAM0B,aAAe1B,OAAO2B,OAAOzB,WAAoC,CAC5EC,kBAAoBxB,IAAa,CAAC,WAAY,WAAWC,SAASD,KAClEuB,WAAA,CAAAE,YAAA,qBAAAC,YAAA,mBAF0BL,CAE1B,CAAA,gSAAA,IAAA,KAkBGV,GAAWA,EAAMO,SAAWV,aAAaU,SAAWV,aAAaC,SAElEwC"}
@@ -1,2 +1,2 @@
1
- 'use strict';var React=require('react');var Spacer=require('../Spacer/Spacer.js');var Anchor=require('../Anchor/Anchor.js');var style=require('./style.js');var require$$0=require('react/jsx-runtime');var Text=require('../Text/Text.js');exports.TextEllipse=class TextEllipse extends React.Component{static displayName='Text.Ellipse';constructor(e){super(e),this.state={isUnFolded:!1,isEllipsed:!1}}componentDidUpdate({content:e}){e!==this.props.content&&this.state.isUnFolded&&this.toggle()}getContent=e=>{const{content:t,chars:s=0}=this.props;if(!t)return'';let{isEllipsed:r}=this.state;let i=typeof t=='string'?'':[];if(this.state.isUnFolded)i=t;else if(typeof i=='string')r=s!==0&&t.length>s,i=r&&s!==0?`${t.slice(0,s)}...`:t;else{let e=s;for(let s=0;s<t.length;s++){if(!(e-t[s].length>0)){r=!0,i[s]=`${t[s].slice(0,e)}...`;break}e-=t[s].length,i[s]=t[s]}}return this.state.isEllipsed!==r&&setTimeout((()=>this.setState({isEllipsed:r}))),typeof i=='string'?require$$0.jsx(Text.Text,{...e,children:this.getQuted(i)}):require$$0.jsx(style.Ul,{children:i.map(((t,s)=>require$$0.jsx(style.Li,{children:require$$0.jsx(Text.Text,{...e,display:"inline",children:t})},s)))})};getQuted=e=>this.props.quoted?`«${e}»`:e;toggle=()=>{this.setState({isUnFolded:!this.state.isUnFolded})};render(){const{className:e="",style:t,moreText:s="Читать полностью",lessText:r="Свернуть",showToggler:i=!0,...l}=this.props;const{isUnFolded:n,isEllipsed:o}=this.state;return require$$0.jsxs("div",{className:e,style:t,children:[this.getContent(l),i&&o&&require$$0.jsx(Spacer.Spacer,{marginTop:16,marginBottom:1,children:require$$0.jsx(Anchor.Anchor,{pseudo:!0,onClick:this.toggle,children:n?r:s})})]})}};
1
+ 'use strict';var React=require('react');var Spacer=require('../Spacer/Spacer.js');var Anchor=require('../Anchor/Anchor.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var Text=require('../Text/Text.js');exports.TextEllipse=class TextEllipse extends React.Component{static displayName='Text.Ellipse';constructor(e){super(e),this.state={isUnFolded:!1,isEllipsed:!1}}componentDidUpdate({content:e}){e!==this.props.content&&this.state.isUnFolded&&this.toggle()}getContent=e=>{const{content:t,chars:s=0}=this.props;if(!t)return'';let{isEllipsed:i}=this.state;let r=typeof t=='string'?'':[];if(this.state.isUnFolded)r=t;else if(typeof r=='string')i=s!==0&&t.length>s,r=i&&s!==0?`${t.slice(0,s)}...`:t;else{let e=s;for(let s=0;s<t.length;s++){if(!(e-t[s].length>0)){i=!0,r[s]=`${t[s].slice(0,e)}...`;break}e-=t[s].length,r[s]=t[s]}}return this.state.isEllipsed!==i&&setTimeout((()=>this.setState({isEllipsed:i}))),typeof r=='string'?jsxRuntime.jsx(Text.Text,{...e,children:this.getQuted(r)}):jsxRuntime.jsx(style.Ul,{children:r.map(((t,s)=>jsxRuntime.jsx(style.Li,{children:jsxRuntime.jsx(Text.Text,{...e,display:"inline",children:t})},s)))})};getQuted=e=>this.props.quoted?`«${e}»`:e;toggle=()=>{this.setState({isUnFolded:!this.state.isUnFolded})};render(){const{className:e="",style:t,moreText:s="Читать полностью",lessText:i="Свернуть",showToggler:r=!0,...n}=this.props;const{isUnFolded:l,isEllipsed:o}=this.state;return jsxRuntime.jsxs("div",{className:e,style:t,children:[this.getContent(n),r&&o&&jsxRuntime.jsx(Spacer.Spacer,{marginTop:16,marginBottom:1,children:jsxRuntime.jsx(Anchor.Anchor,{pseudo:!0,onClick:this.toggle,children:l?i:s})})]})}};
2
2
  //# sourceMappingURL=Text.Ellipse.js.map
@@ -1,2 +1,2 @@
1
- 'use strict';var styled=require('styled-components');var useConfigPriority=require('../../hooks/use-config-priority.js');var require$$0=require('react/jsx-runtime');var Text=require('../Text/Text.js');const PARAMS={h1:{size:44,sizeM:32,lineHeight:'s',weight:'bold'},h2:{size:32,sizeM:28,lineHeight:'s',weight:'bold'},h3:{size:28,lineHeight:'s',weight:'bold'},h4:{size:24,lineHeight:'s',weight:'bold'}};const TextHeading=e=>{const i=styled.useTheme();const{h:t="h1",fontFamily:s,...r}=useConfigPriority.useConfigPriority(i.components?.["Text.Heading"],e);return require$$0.jsx(Text.Text,{as:t,fontFamily:s,...PARAMS[t],...r})};TextHeading.displayName="Text.Heading",exports.COMPONENT_NAME="Text.Heading",exports.TextHeading=TextHeading;
1
+ 'use strict';var styled=require('styled-components');var useConfigPriority=require('../../hooks/use-config-priority.js');var jsxRuntime=require('react/jsx-runtime');var Text=require('../Text/Text.js');const PARAMS={h1:{size:44,sizeM:32,lineHeight:'s',weight:'bold'},h2:{size:32,sizeM:28,lineHeight:'s',weight:'bold'},h3:{size:28,lineHeight:'s',weight:'bold'},h4:{size:24,lineHeight:'s',weight:'bold'}};const TextHeading=e=>{const i=styled.useTheme();const{h:t="h1",fontFamily:s,...n}=useConfigPriority.useConfigPriority(i.components?.["Text.Heading"],e);return jsxRuntime.jsx(Text.Text,{as:t,fontFamily:s,...PARAMS[t],...n})};TextHeading.displayName="Text.Heading",exports.COMPONENT_NAME="Text.Heading",exports.TextHeading=TextHeading;
2
2
  //# sourceMappingURL=Text.Heading.js.map
@@ -1,2 +1,2 @@
1
- 'use strict';var React=require('react');var styled=require('styled-components');var index_browser=require('../../external/.pnpm/nanoid@5.0.9/node_modules/nanoid/index.browser.js');var withMergedProps=require('../../hocs/withMergedProps.js');var useResizable=require('../../hooks/useResizable.js');var misc=require('../../shared/utils/misc.js');var constants=require('./constants.js');var style=require('./style.js');var require$$0=require('react/jsx-runtime');var FormInputLabel=require('../FormInputLabel/FormInputLabel.js');var index=require('../../external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/ResizeHandle/index.js');const Textarea=withMergedProps.withMergedProps(React.forwardRef(((e,r)=>{const t=styled.useTheme();const{size:a="m",rows:i=2,maxRows:n=30,labelPosition:o="dynamic",primary:s=!0,width:l=t.defaultInputControlsWidth,autosize:c=!0,rounded:m=!0,color:d="mineShaft",placeholderColor:g="silver",autoRows:u,resize:h,contrast:p,inline:X,secondary:b,success:L,error:S,sizeXXS:f,sizeXS:R,sizeS:w,sizeM:z,sizeL:v,sizeXL:x,sizes:M,sizeUnits:T,margin:C,marginXXS:y,marginXS:$,marginS:q,marginM:j,marginL:B,marginXL:I,marginTop:k,marginTopXXS:D,marginTopXS:F,marginTopS:_,marginTopM:N,marginTopL:E,marginTopXL:H,marginRight:P,marginRightXXS:A,marginRightXS:O,marginRightS:U,marginRightM:W,marginRightL:Z,marginRightXL:G,marginBottom:K,marginBottomXXS:V,marginBottomXS:J,marginBottomS:Q,marginBottomM:Y,marginBottomL:ee,marginBottomXL:re,marginLeft:te,marginLeftXXS:ae,marginLeftXS:ie,marginLeftS:ne,marginLeftM:oe,marginLeftL:se,marginLeftXL:le,widthXXS:ce,widthXS:me,widthS:de,widthM:ge,widthL:ue,widthXL:he,preset:pe,palette:Xe,label:be,fluid:Le,className:Se,style:fe,disabled:Re,...we}=e;const ze=React.useRef(null);const ve=React.useRef(null);const xe=React.useRef(null);React.useImperativeHandle(r,(()=>ze.current),[]);const[Me,Te,Ce]=useResizable.useResizable({target:xe,direction:h});const ye=React.useMemo((()=>index_browser.nanoid()),[]);const[$e,qe]=React.useState((()=>{const e=we.value??we.defaultValue;return typeof e=='string'&&e.length>0}));const[je,Be]=React.useState((()=>Math.min(i,n)));const Ie=pe==='brand'&&u||pe!=='brand'&&c?je:Math.min(i,n);const ke=h==='horizontal'?'ew-resize':h==='vertical'?'ns-resize':'nwse-resize';const De=React.useCallback((()=>{if(!ze.current)return;if(pe==='brand'){if(!ve.current)return;ve.current.value=ze.current.value;const e=Math.max(Math.round(ve.current.scrollHeight/ve.current.clientHeight),i);return void Be(Math.min(e,n))}const e=getComputedStyle(ze.current);const r=parseFloat(e.lineHeight);const t=Math.max(Math.round((ze.current.scrollHeight-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom))/(Number.isNaN(r)?parseFloat(e.fontSize)*1.2:r)),i);Be((e=>t>e?Math.min(t,n):ze.current&&!ze.current.value?i:e))}),[pe,i,n]);return React.useLayoutEffect((()=>{pe==='brand'&&typeof we.value=='string'&&ze.current&&ze.current!==document.activeElement&&qe(we.value.length>0)}),[pe,we.value]),React.useEffect((()=>{const e=misc.createThrottledCallback(De,200);return(pe==='brand'&&u||pe!=='brand'&&c)&&(De(),window.addEventListener('resize',e)),()=>{window.removeEventListener('resize',e)}}),[pe,u,c,De]),pe!=='brand'?require$$0.jsx(style.Root,{...we,ref:ze,className:Se,style:fe,onChange:e=>{c&&De(),we.onChange&&we.onChange(e)},rows:Ie,color:d,rounded:m,placeholderColor:g,disabled:Re,error:S,fluid:Le,width:l,widthXXS:ce,widthXS:me,widthS:de,widthM:ge,widthL:ue,widthXL:he}):require$$0.jsx(FormInputLabel.FormInputLabel,{ref:xe,size:a,sizeXXS:f,sizeXS:R,sizeS:w,sizeM:z,sizeL:v,sizeXL:x,sizes:M,sizeUnits:T,margin:C,marginXXS:y,marginXS:$,marginS:q,marginM:j,marginL:B,marginXL:I,marginTop:k,marginTopXXS:D,marginTopXS:F,marginTopS:_,marginTopM:N,marginTopL:E,marginTopXL:H,marginRight:P,marginRightXXS:A,marginRightXS:O,marginRightS:U,marginRightM:W,marginRightL:Z,marginRightXL:G,marginBottom:K,marginBottomXXS:V,marginBottomXS:J,marginBottomS:Q,marginBottomM:Y,marginBottomL:ee,marginBottomXL:re,marginLeft:te,marginLeftXXS:ae,marginLeftXS:ie,marginLeftS:ne,marginLeftM:oe,marginLeftL:se,marginLeftXL:le,className:Se,style:fe,contrast:p,error:S,inline:X,label:be,labelId:ye,labelPosition:o,disabled:Re,active:$e,primary:s,secondary:b,success:L,palette:{color:Re?Xe.colorDisabled:Xe.color,backgroundColor:Re?Xe.backgroundColorDisabled:Xe.backgroundColor,backgroundColorHover:Re?Xe.backgroundColorDisabled:Xe.backgroundColorHover,borderColor:Re?Xe.borderColorDisabled:Xe.borderColor},onClick:()=>{ze.current&&ze.current.focus()},onFocus:()=>{qe(!0)},onPointerDown:e=>{e.target!==ze.current&&e.target instanceof Node&&e.preventDefault()},onBlur:e=>{ze.current&&!e.currentTarget.contains(e.relatedTarget)&&qe(Boolean(ze.current.value))},overflow:"hidden",inputPosition:"stretch",input:require$$0.jsxs(require$$0.Fragment,{children:[u&&require$$0.jsx(style.TextareaMimic,{ref:ve,rows:1}),require$$0.jsx(style.Textarea,{...we,ref:ze,"aria-labelledby":be?ye:void 0,disabled:Re,onChange:e=>{u&&De(),we.onChange&&we.onChange(e)},rows:Ie,palette:{color:Xe.color,colorDisabled:Xe.colorDisabled,placeholderColor:Xe.placeholderColor,placeholderColorDisabled:Xe.placeholderColorDisabled}})]}),addon:h?require$$0.jsxs(require$$0.Fragment,{children:[Me&&require$$0.jsx(style.ResizeGlobals,{cursor:ke}),require$$0.jsx(style.ResizeIcon,{size:"l",icon:require$$0.jsx(index.ResizeHandle,{}),color:"border-onmain-default-small",tabIndex:0,onPointerDown:Te,onKeyDown:Ce,cursor:ke})]}):void 0})})),{displayName:"Textarea",sizes:e=>e.label?constants.SIZES_WITH_LABEL:constants.SIZES});exports.COMPONENT_NAME="Textarea",exports.Textarea=Textarea;
1
+ 'use strict';var React=require('react');var styled=require('styled-components');var nanoid=require('nanoid');var iconPack=require('@foxford/icon-pack');var withMergedProps=require('../../hocs/withMergedProps.js');var useResizable=require('../../hooks/useResizable.js');var misc=require('../../shared/utils/misc.js');var constants=require('./constants.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var FormInputLabel=require('../FormInputLabel/FormInputLabel.js');const Textarea=withMergedProps.withMergedProps(React.forwardRef(((e,r)=>{const t=styled.useTheme();const{size:a="m",rows:n=2,maxRows:i=30,labelPosition:o="dynamic",primary:s=!0,width:l=t.defaultInputControlsWidth,autosize:m=!0,rounded:c=!0,color:g="mineShaft",placeholderColor:u="silver",autoRows:d,resize:h,contrast:X,inline:p,secondary:L,success:R,error:b,sizeXXS:S,sizeXS:f,sizeS:x,sizeM:z,sizeL:w,sizeXL:v,sizes:M,sizeUnits:j,margin:T,marginXXS:C,marginXS:y,marginS:B,marginM:k,marginL:I,marginXL:D,marginTop:F,marginTopXXS:P,marginTopXS:q,marginTopS:N,marginTopM:E,marginTopL:H,marginTopXL:_,marginRight:A,marginRightXXS:O,marginRightXS:U,marginRightS:W,marginRightM:Z,marginRightL:G,marginRightXL:K,marginBottom:V,marginBottomXXS:J,marginBottomXS:Q,marginBottomS:Y,marginBottomM:$,marginBottomL:ee,marginBottomXL:re,marginLeft:te,marginLeftXXS:ae,marginLeftXS:ne,marginLeftS:ie,marginLeftM:oe,marginLeftL:se,marginLeftXL:le,widthXXS:me,widthXS:ce,widthS:ge,widthM:ue,widthL:de,widthXL:he,preset:Xe,palette:pe,label:Le,fluid:Re,className:be,style:Se,disabled:fe,...xe}=e;const ze=React.useRef(null);const we=React.useRef(null);const ve=React.useRef(null);React.useImperativeHandle(r,(()=>ze.current),[]);const[Me,je,Te]=useResizable.useResizable({target:ve,direction:h});const Ce=React.useMemo((()=>nanoid.nanoid()),[]);const[ye,Be]=React.useState((()=>{const e=xe.value??xe.defaultValue;return typeof e=='string'&&e.length>0}));const[ke,Ie]=React.useState((()=>Math.min(n,i)));const De=Xe==='brand'&&d||Xe!=='brand'&&m?ke:Math.min(n,i);const Fe=h==='horizontal'?'ew-resize':h==='vertical'?'ns-resize':'nwse-resize';const Pe=React.useCallback((()=>{if(!ze.current)return;if(Xe==='brand'){if(!we.current)return;we.current.value=ze.current.value;const e=Math.max(Math.round(we.current.scrollHeight/we.current.clientHeight),n);return void Ie(Math.min(e,i))}const e=getComputedStyle(ze.current);const r=parseFloat(e.lineHeight);const t=Math.max(Math.round((ze.current.scrollHeight-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom))/(Number.isNaN(r)?parseFloat(e.fontSize)*1.2:r)),n);Ie((e=>t>e?Math.min(t,i):ze.current&&!ze.current.value?n:e))}),[Xe,n,i]);return React.useLayoutEffect((()=>{Xe==='brand'&&typeof xe.value=='string'&&ze.current&&ze.current!==document.activeElement&&Be(xe.value.length>0)}),[Xe,xe.value]),React.useEffect((()=>{const e=misc.createThrottledCallback(Pe,200);return(Xe==='brand'&&d||Xe!=='brand'&&m)&&(Pe(),window.addEventListener('resize',e)),()=>{window.removeEventListener('resize',e)}}),[Xe,d,m,Pe]),Xe!=='brand'?jsxRuntime.jsx(style.Root,{...xe,ref:ze,className:be,style:Se,onChange:e=>{m&&Pe(),xe.onChange&&xe.onChange(e)},rows:De,color:g,rounded:c,placeholderColor:u,disabled:fe,error:b,fluid:Re,width:l,widthXXS:me,widthXS:ce,widthS:ge,widthM:ue,widthL:de,widthXL:he}):jsxRuntime.jsx(FormInputLabel.FormInputLabel,{ref:ve,size:a,sizeXXS:S,sizeXS:f,sizeS:x,sizeM:z,sizeL:w,sizeXL:v,sizes:M,sizeUnits:j,margin:T,marginXXS:C,marginXS:y,marginS:B,marginM:k,marginL:I,marginXL:D,marginTop:F,marginTopXXS:P,marginTopXS:q,marginTopS:N,marginTopM:E,marginTopL:H,marginTopXL:_,marginRight:A,marginRightXXS:O,marginRightXS:U,marginRightS:W,marginRightM:Z,marginRightL:G,marginRightXL:K,marginBottom:V,marginBottomXXS:J,marginBottomXS:Q,marginBottomS:Y,marginBottomM:$,marginBottomL:ee,marginBottomXL:re,marginLeft:te,marginLeftXXS:ae,marginLeftXS:ne,marginLeftS:ie,marginLeftM:oe,marginLeftL:se,marginLeftXL:le,className:be,style:Se,contrast:X,error:b,inline:p,label:Le,labelId:Ce,labelPosition:o,disabled:fe,active:ye,primary:s,secondary:L,success:R,palette:{color:fe?pe.colorDisabled:pe.color,backgroundColor:fe?pe.backgroundColorDisabled:pe.backgroundColor,backgroundColorHover:fe?pe.backgroundColorDisabled:pe.backgroundColorHover,borderColor:fe?pe.borderColorDisabled:pe.borderColor},onClick:()=>{ze.current&&ze.current.focus()},onFocus:()=>{Be(!0)},onPointerDown:e=>{e.target!==ze.current&&e.target instanceof Node&&e.preventDefault()},onBlur:e=>{ze.current&&!e.currentTarget.contains(e.relatedTarget)&&Be(Boolean(ze.current.value))},overflow:"hidden",inputPosition:"stretch",input:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[d&&jsxRuntime.jsx(style.TextareaMimic,{ref:we,rows:1}),jsxRuntime.jsx(style.Textarea,{...xe,ref:ze,"aria-labelledby":Le?Ce:void 0,disabled:fe,onChange:e=>{d&&Pe(),xe.onChange&&xe.onChange(e)},rows:De,palette:{color:pe.color,colorDisabled:pe.colorDisabled,placeholderColor:pe.placeholderColor,placeholderColorDisabled:pe.placeholderColorDisabled}})]}),addon:h?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Me&&jsxRuntime.jsx(style.ResizeGlobals,{cursor:Fe}),jsxRuntime.jsx(style.ResizeIcon,{size:"l",icon:jsxRuntime.jsx(iconPack.ResizeHandle,{}),color:"border-onmain-default-small",tabIndex:0,onPointerDown:je,onKeyDown:Te,cursor:Fe})]}):void 0})})),{displayName:"Textarea",sizes:e=>e.label?constants.SIZES_WITH_LABEL:constants.SIZES});exports.COMPONENT_NAME="Textarea",exports.Textarea=Textarea;
2
2
  //# sourceMappingURL=Textarea.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.js","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import {\n forwardRef,\n useImperativeHandle,\n useLayoutEffect,\n useEffect,\n useRef,\n useState,\n useMemo,\n useCallback,\n} from 'react'\nimport { useTheme } from 'styled-components'\nimport { nanoid } from 'nanoid'\nimport { ResizeHandle } from '@foxford/icon-pack'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { useResizable } from 'hooks/useResizable'\nimport { createThrottledCallback } from 'shared/utils/misc'\nimport { FormInputLabel } from 'components/FormInputLabel'\nimport { SIZES, SIZES_WITH_LABEL } from './constants'\nimport * as Styled from './style'\nimport type { TextareaProps } from './types'\n\nconst COMPONENT_NAME = 'Textarea'\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<textarea\\> элемента.\n *\n * Поддерживаются пропсы определения размеров и внешних отступов в зависимости от ширины вьюпорта.\n *\n * Можно передать \"ref\", который будет ассоциирован с \\<textarea\\>.\n *\n * Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/Textarea/types.ts).\n */\nconst Textarea: React.ForwardRefExoticComponent<TextareaProps> = withMergedProps<TextareaProps, HTMLTextAreaElement>(\n forwardRef((props, forwardedRef) => {\n const theme = useTheme()\n\n const {\n size = 'm',\n rows = 2,\n maxRows = 30,\n labelPosition = 'dynamic',\n primary = true,\n width = theme.defaultInputControlsWidth,\n autosize = true,\n rounded = true,\n color = 'mineShaft',\n placeholderColor = 'silver',\n autoRows,\n resize,\n contrast,\n inline,\n secondary,\n success,\n error,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizes,\n sizeUnits,\n margin,\n marginXXS,\n marginXS,\n marginS,\n marginM,\n marginL,\n marginXL,\n marginTop,\n marginTopXXS,\n marginTopXS,\n marginTopS,\n marginTopM,\n marginTopL,\n marginTopXL,\n marginRight,\n marginRightXXS,\n marginRightXS,\n marginRightS,\n marginRightM,\n marginRightL,\n marginRightXL,\n marginBottom,\n marginBottomXXS,\n marginBottomXS,\n marginBottomS,\n marginBottomM,\n marginBottomL,\n marginBottomXL,\n marginLeft,\n marginLeftXXS,\n marginLeftXS,\n marginLeftS,\n marginLeftM,\n marginLeftL,\n marginLeftXL,\n widthXXS,\n widthXS,\n widthS,\n widthM,\n widthL,\n widthXL,\n preset,\n palette,\n label,\n fluid,\n className,\n style,\n disabled,\n ...textareaProps\n } = props\n\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n\n const textareaMimicRef = useRef<HTMLTextAreaElement>(null)\n\n const formInputLabelRef = useRef<HTMLDivElement>(null)\n\n useImperativeHandle(forwardedRef, () => textareaRef.current as HTMLTextAreaElement, [])\n\n const [resizing, handleResizeStart, handleResizeOnNudge] = useResizable<HTMLDivElement, HTMLSpanElement>({\n target: formInputLabelRef,\n direction: resize,\n })\n\n const labelId = useMemo(() => nanoid(), [])\n\n const [active, setActive] = useState(() => {\n const valueInit = textareaProps.value ?? textareaProps.defaultValue\n\n return typeof valueInit === 'string' && valueInit.length > 0\n })\n\n const [autoRowsCount, setAutoRowsCount] = useState(() => Math.min(rows, maxRows))\n\n const rowsVisible =\n (preset === 'brand' && autoRows) || (preset !== 'brand' && autosize) ? autoRowsCount : Math.min(rows, maxRows)\n\n const cursorResize = resize === 'horizontal' ? 'ew-resize' : resize === 'vertical' ? 'ns-resize' : 'nwse-resize'\n\n const updateAutoRowsCount = useCallback(() => {\n if (!textareaRef.current) return\n\n if (preset === 'brand') {\n if (!textareaMimicRef.current) return\n\n textareaMimicRef.current.value = textareaRef.current.value\n\n const nextRows = Math.max(\n Math.round(textareaMimicRef.current.scrollHeight / textareaMimicRef.current.clientHeight),\n rows\n )\n\n setAutoRowsCount(Math.min(nextRows, maxRows))\n\n return\n }\n\n const styles = getComputedStyle(textareaRef.current)\n\n const lineHeight = parseFloat(styles.lineHeight)\n\n const nextRows = Math.max(\n Math.round(\n (textareaRef.current.scrollHeight - parseFloat(styles.paddingTop) - parseFloat(styles.paddingBottom)) /\n (Number.isNaN(lineHeight) ? parseFloat(styles.fontSize) * 1.2 : lineHeight)\n ),\n rows\n )\n\n setAutoRowsCount((prevRows) => {\n if (nextRows > prevRows) return Math.min(nextRows, maxRows)\n if (textareaRef.current && !textareaRef.current.value) return rows\n\n return prevRows\n })\n }, [preset, rows, maxRows])\n\n useLayoutEffect(() => {\n if (\n preset === 'brand' &&\n typeof textareaProps.value === 'string' &&\n textareaRef.current &&\n textareaRef.current !== document.activeElement\n ) {\n setActive(textareaProps.value.length > 0)\n }\n }, [preset, textareaProps.value])\n\n useEffect(() => {\n const handleResize = createThrottledCallback<UIEvent>(updateAutoRowsCount, 200)\n\n if ((preset === 'brand' && autoRows) || (preset !== 'brand' && autosize)) {\n updateAutoRowsCount()\n window.addEventListener('resize', handleResize)\n }\n\n return () => {\n window.removeEventListener('resize', handleResize)\n }\n }, [preset, autoRows, autosize, updateAutoRowsCount])\n\n if (preset !== 'brand') {\n return (\n <Styled.Root\n {...textareaProps}\n ref={textareaRef}\n className={className}\n style={style}\n onChange={(evt) => {\n if (autosize) updateAutoRowsCount()\n if (textareaProps.onChange) textareaProps.onChange(evt)\n }}\n rows={rowsVisible}\n color={color}\n rounded={rounded}\n placeholderColor={placeholderColor}\n disabled={disabled}\n error={error}\n fluid={fluid}\n width={width}\n widthXXS={widthXXS}\n widthXS={widthXS}\n widthS={widthS}\n widthM={widthM}\n widthL={widthL}\n widthXL={widthXL}\n />\n )\n }\n\n return (\n <FormInputLabel\n ref={formInputLabelRef}\n size={size}\n sizeXXS={sizeXXS}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n sizes={sizes}\n sizeUnits={sizeUnits}\n margin={margin}\n marginXXS={marginXXS}\n marginXS={marginXS}\n marginS={marginS}\n marginM={marginM}\n marginL={marginL}\n marginXL={marginXL}\n marginTop={marginTop}\n marginTopXXS={marginTopXXS}\n marginTopXS={marginTopXS}\n marginTopS={marginTopS}\n marginTopM={marginTopM}\n marginTopL={marginTopL}\n marginTopXL={marginTopXL}\n marginRight={marginRight}\n marginRightXXS={marginRightXXS}\n marginRightXS={marginRightXS}\n marginRightS={marginRightS}\n marginRightM={marginRightM}\n marginRightL={marginRightL}\n marginRightXL={marginRightXL}\n marginBottom={marginBottom}\n marginBottomXXS={marginBottomXXS}\n marginBottomXS={marginBottomXS}\n marginBottomS={marginBottomS}\n marginBottomM={marginBottomM}\n marginBottomL={marginBottomL}\n marginBottomXL={marginBottomXL}\n marginLeft={marginLeft}\n marginLeftXXS={marginLeftXXS}\n marginLeftXS={marginLeftXS}\n marginLeftS={marginLeftS}\n marginLeftM={marginLeftM}\n marginLeftL={marginLeftL}\n marginLeftXL={marginLeftXL}\n className={className}\n style={style}\n contrast={contrast}\n error={error}\n inline={inline}\n label={label}\n labelId={labelId}\n labelPosition={labelPosition}\n disabled={disabled}\n active={active}\n primary={primary}\n secondary={secondary}\n success={success}\n palette={{\n color: disabled ? palette.colorDisabled : palette.color,\n backgroundColor: disabled ? palette.backgroundColorDisabled : palette.backgroundColor,\n backgroundColorHover: disabled ? palette.backgroundColorDisabled : palette.backgroundColorHover,\n borderColor: disabled ? palette.borderColorDisabled : palette.borderColor,\n }}\n onClick={() => {\n if (textareaRef.current) {\n textareaRef.current.focus()\n }\n }}\n onFocus={() => {\n setActive(true)\n }}\n onPointerDown={(evt) => {\n if (evt.target === textareaRef.current || !(evt.target instanceof Node)) {\n return\n }\n evt.preventDefault()\n }}\n onBlur={(evt) => {\n if (textareaRef.current && !evt.currentTarget.contains(evt.relatedTarget)) {\n setActive(Boolean(textareaRef.current.value))\n }\n }}\n overflow='hidden'\n inputPosition='stretch'\n input={\n <>\n {autoRows && <Styled.TextareaMimic ref={textareaMimicRef} rows={1} />}\n <Styled.Textarea\n {...textareaProps}\n ref={textareaRef}\n aria-labelledby={label ? labelId : undefined}\n disabled={disabled}\n onChange={(evt) => {\n if (autoRows) updateAutoRowsCount()\n if (textareaProps.onChange) textareaProps.onChange(evt)\n }}\n rows={rowsVisible}\n palette={{\n color: palette.color,\n colorDisabled: palette.colorDisabled,\n placeholderColor: palette.placeholderColor,\n placeholderColorDisabled: palette.placeholderColorDisabled,\n }}\n />\n </>\n }\n addon={\n resize ? (\n <>\n {resizing && <Styled.ResizeGlobals cursor={cursorResize} />}\n <Styled.ResizeIcon\n size='l'\n icon={<ResizeHandle />}\n color='border-onmain-default-small'\n tabIndex={0}\n onPointerDown={handleResizeStart}\n onKeyDown={handleResizeOnNudge}\n cursor={cursorResize}\n />\n </>\n ) : undefined\n }\n />\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: (props) => (props.label ? SIZES_WITH_LABEL : SIZES),\n }\n)\n\nexport { Textarea, COMPONENT_NAME }\n"],"names":["Textarea","withMergedProps","forwardRef","props","forwardedRef","theme","useTheme","size","rows","maxRows","labelPosition","primary","width","defaultInputControlsWidth","autosize","rounded","color","placeholderColor","autoRows","resize","contrast","inline","secondary","success","error","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizes","sizeUnits","margin","marginXXS","marginXS","marginS","marginM","marginL","marginXL","marginTop","marginTopXXS","marginTopXS","marginTopS","marginTopM","marginTopL","marginTopXL","marginRight","marginRightXXS","marginRightXS","marginRightS","marginRightM","marginRightL","marginRightXL","marginBottom","marginBottomXXS","marginBottomXS","marginBottomS","marginBottomM","marginBottomL","marginBottomXL","marginLeft","marginLeftXXS","marginLeftXS","marginLeftS","marginLeftM","marginLeftL","marginLeftXL","widthXXS","widthXS","widthS","widthM","widthL","widthXL","preset","palette","label","fluid","className","style","disabled","textareaProps","textareaRef","useRef","textareaMimicRef","formInputLabelRef","useImperativeHandle","current","resizing","handleResizeStart","handleResizeOnNudge","useResizable","target","direction","labelId","useMemo","nanoid","active","setActive","useState","valueInit","value","defaultValue","length","autoRowsCount","setAutoRowsCount","Math","min","rowsVisible","cursorResize","updateAutoRowsCount","useCallback","nextRows","max","round","scrollHeight","clientHeight","styles","getComputedStyle","lineHeight","parseFloat","paddingTop","paddingBottom","Number","isNaN","fontSize","prevRows","useLayoutEffect","document","activeElement","useEffect","handleResize","createThrottledCallback","window","addEventListener","removeEventListener","_jsx","Styled","ref","onChange","evt","FormInputLabel","colorDisabled","backgroundColor","backgroundColorDisabled","backgroundColorHover","borderColor","borderColorDisabled","onClick","focus","onFocus","onPointerDown","Node","preventDefault","onBlur","currentTarget","contains","relatedTarget","Boolean","overflow","inputPosition","input","_jsxs","jsxs","_Fragment","children","jsx","undefined","placeholderColorDisabled","addon","cursor","icon","ResizeHandle","tabIndex","onKeyDown","displayName","SIZES_WITH_LABEL","SIZES"],"mappings":"0rBAiCMA,MAAAA,SAA2DC,gBAAAA,gBAC/DC,MAAAA,YAAW,CAACC,EAAOC,KACjB,MAAMC,EAAQC,OAAAA,WAEd,MAAMC,KACJA,EAAO,IAAGC,KACVA,EAAO,EAACC,QACRA,EAAU,GAAEC,cACZA,EAAgB,UAASC,QACzBA,GAAU,EAAIC,MACdA,EAAQP,EAAMQ,0BAAyBC,SACvCA,GAAW,EAAIC,QACfA,GAAU,EAAIC,MACdA,EAAQ,YAAWC,iBACnBA,EAAmB,SAAQC,SAC3BA,EAAQC,OACRA,EAAMC,SACNA,EAAQC,OACRA,EAAMC,UACNA,EAASC,QACTA,EAAOC,MACPA,EAAKC,QACLA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,MACNA,EAAKC,UACLA,EAASC,OACTA,EAAMC,UACNA,EAASC,SACTA,EAAQC,QACRA,EAAOC,QACPA,EAAOC,QACPA,EAAOC,SACPA,EAAQC,UACRA,EAASC,aACTA,EAAYC,YACZA,EAAWC,WACXA,EAAUC,WACVA,EAAUC,WACVA,EAAUC,YACVA,EAAWC,YACXA,EAAWC,eACXA,EAAcC,cACdA,EAAaC,aACbA,EAAYC,aACZA,EAAYC,aACZA,EAAYC,cACZA,EAAaC,aACbA,EAAYC,gBACZA,EAAeC,eACfA,EAAcC,cACdA,EAAaC,cACb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AAIa,gBAAgB,EAEtBC,OAASd,IACH1D,GAAYK,UAAYqD,EAAIe,cAAcC,SAAShB,EAAIiB,gBACzD3D,GAAU4D,QAAQ5E,GAAYK,QAAQc,OACxC,EAEF0D,SAAS,SACTC,cAAc,UACdC,MACEC,WAAAC,KAAAC,oBAAA,CAAAC,UACGnJ,GAAYsH,WAAA8B,IAAC7B,oBAAoB,CAACC,IAAKtD,GAAkB5E,KAAM,IAChEgI,WAAA8B,IAAC7B,eAAe,IACVxD,GACJyD,IAAKxD,GACL,kBAAiBN,GAAQkB,QAAUyE,EACnCvF,SAAUA,GACV2D,SAAWC,IACL1H,GAAU4F,KACV7B,GAAc0D,UAAU1D,GAAc0D,SAASC,EAAI,EAEzDpI,KAAMoG,GACNjC,QAAS,CACP3D,MAAO2D,GAAQ3D,MACf8H,cAAenE,GAAQmE,cACvB7H,iBAAkB0D,GAAQ1D,iBAC1BuJ,yBAA0B7F,GAAQ6F,+BAK1CC,MACEtJ,EACE+I,WAAAC,KAAAC,oBAAA,CAAAC,UACG7E,IAAYgD,WAAA8B,IAAC7B,oBAAoB,CAACiC,OAAQ7D,KAC3C2B,WAAA8B,IAAC7B,iBAAiB,CAChBlI,KAAK,IACLoK,KAAMnC,WAAAA,IAACoC,MAAYA,iBACnB5J,MAAM,8BACN6J,SAAU,EACVtB,cAAe9D,GACfqF,UAAWpF,GACXgF,OAAQ7D,aAGV0D,GAEN,IAGN,CACEQ,YArVmB,WAsVnBhJ,MAAQ5B,GAAWA,EAAMyE,MAAQoG,UAAgBA,iBAAGC,UAAAA,+BAtVjC"}
1
+ {"version":3,"file":"Textarea.js","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import {\n forwardRef,\n useImperativeHandle,\n useLayoutEffect,\n useEffect,\n useRef,\n useState,\n useMemo,\n useCallback,\n} from 'react'\nimport { useTheme } from 'styled-components'\nimport { nanoid } from 'nanoid'\nimport { ResizeHandle } from '@foxford/icon-pack'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { useResizable } from 'hooks/useResizable'\nimport { createThrottledCallback } from 'shared/utils/misc'\nimport { FormInputLabel } from 'components/FormInputLabel'\nimport { SIZES, SIZES_WITH_LABEL } from './constants'\nimport * as Styled from './style'\nimport type { TextareaProps } from './types'\n\nconst COMPONENT_NAME = 'Textarea'\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<textarea\\> элемента.\n *\n * Поддерживаются пропсы определения размеров и внешних отступов в зависимости от ширины вьюпорта.\n *\n * Можно передать \"ref\", который будет ассоциирован с \\<textarea\\>.\n *\n * Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/Textarea/types.ts).\n */\nconst Textarea: React.ForwardRefExoticComponent<TextareaProps> = withMergedProps<TextareaProps, HTMLTextAreaElement>(\n forwardRef((props, forwardedRef) => {\n const theme = useTheme()\n\n const {\n size = 'm',\n rows = 2,\n maxRows = 30,\n labelPosition = 'dynamic',\n primary = true,\n width = theme.defaultInputControlsWidth,\n autosize = true,\n rounded = true,\n color = 'mineShaft',\n placeholderColor = 'silver',\n autoRows,\n resize,\n contrast,\n inline,\n secondary,\n success,\n error,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizes,\n sizeUnits,\n margin,\n marginXXS,\n marginXS,\n marginS,\n marginM,\n marginL,\n marginXL,\n marginTop,\n marginTopXXS,\n marginTopXS,\n marginTopS,\n marginTopM,\n marginTopL,\n marginTopXL,\n marginRight,\n marginRightXXS,\n marginRightXS,\n marginRightS,\n marginRightM,\n marginRightL,\n marginRightXL,\n marginBottom,\n marginBottomXXS,\n marginBottomXS,\n marginBottomS,\n marginBottomM,\n marginBottomL,\n marginBottomXL,\n marginLeft,\n marginLeftXXS,\n marginLeftXS,\n marginLeftS,\n marginLeftM,\n marginLeftL,\n marginLeftXL,\n widthXXS,\n widthXS,\n widthS,\n widthM,\n widthL,\n widthXL,\n preset,\n palette,\n label,\n fluid,\n className,\n style,\n disabled,\n ...textareaProps\n } = props\n\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n\n const textareaMimicRef = useRef<HTMLTextAreaElement>(null)\n\n const formInputLabelRef = useRef<HTMLDivElement>(null)\n\n useImperativeHandle(forwardedRef, () => textareaRef.current as HTMLTextAreaElement, [])\n\n const [resizing, handleResizeStart, handleResizeOnNudge] = useResizable<HTMLDivElement, HTMLSpanElement>({\n target: formInputLabelRef,\n direction: resize,\n })\n\n const labelId = useMemo(() => nanoid(), [])\n\n const [active, setActive] = useState(() => {\n const valueInit = textareaProps.value ?? textareaProps.defaultValue\n\n return typeof valueInit === 'string' && valueInit.length > 0\n })\n\n const [autoRowsCount, setAutoRowsCount] = useState(() => Math.min(rows, maxRows))\n\n const rowsVisible =\n (preset === 'brand' && autoRows) || (preset !== 'brand' && autosize) ? autoRowsCount : Math.min(rows, maxRows)\n\n const cursorResize = resize === 'horizontal' ? 'ew-resize' : resize === 'vertical' ? 'ns-resize' : 'nwse-resize'\n\n const updateAutoRowsCount = useCallback(() => {\n if (!textareaRef.current) return\n\n if (preset === 'brand') {\n if (!textareaMimicRef.current) return\n\n textareaMimicRef.current.value = textareaRef.current.value\n\n const nextRows = Math.max(\n Math.round(textareaMimicRef.current.scrollHeight / textareaMimicRef.current.clientHeight),\n rows\n )\n\n setAutoRowsCount(Math.min(nextRows, maxRows))\n\n return\n }\n\n const styles = getComputedStyle(textareaRef.current)\n\n const lineHeight = parseFloat(styles.lineHeight)\n\n const nextRows = Math.max(\n Math.round(\n (textareaRef.current.scrollHeight - parseFloat(styles.paddingTop) - parseFloat(styles.paddingBottom)) /\n (Number.isNaN(lineHeight) ? parseFloat(styles.fontSize) * 1.2 : lineHeight)\n ),\n rows\n )\n\n setAutoRowsCount((prevRows) => {\n if (nextRows > prevRows) return Math.min(nextRows, maxRows)\n if (textareaRef.current && !textareaRef.current.value) return rows\n\n return prevRows\n })\n }, [preset, rows, maxRows])\n\n useLayoutEffect(() => {\n if (\n preset === 'brand' &&\n typeof textareaProps.value === 'string' &&\n textareaRef.current &&\n textareaRef.current !== document.activeElement\n ) {\n setActive(textareaProps.value.length > 0)\n }\n }, [preset, textareaProps.value])\n\n useEffect(() => {\n const handleResize = createThrottledCallback<UIEvent>(updateAutoRowsCount, 200)\n\n if ((preset === 'brand' && autoRows) || (preset !== 'brand' && autosize)) {\n updateAutoRowsCount()\n window.addEventListener('resize', handleResize)\n }\n\n return () => {\n window.removeEventListener('resize', handleResize)\n }\n }, [preset, autoRows, autosize, updateAutoRowsCount])\n\n if (preset !== 'brand') {\n return (\n <Styled.Root\n {...textareaProps}\n ref={textareaRef}\n className={className}\n style={style}\n onChange={(evt) => {\n if (autosize) updateAutoRowsCount()\n if (textareaProps.onChange) textareaProps.onChange(evt)\n }}\n rows={rowsVisible}\n color={color}\n rounded={rounded}\n placeholderColor={placeholderColor}\n disabled={disabled}\n error={error}\n fluid={fluid}\n width={width}\n widthXXS={widthXXS}\n widthXS={widthXS}\n widthS={widthS}\n widthM={widthM}\n widthL={widthL}\n widthXL={widthXL}\n />\n )\n }\n\n return (\n <FormInputLabel\n ref={formInputLabelRef}\n size={size}\n sizeXXS={sizeXXS}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n sizes={sizes}\n sizeUnits={sizeUnits}\n margin={margin}\n marginXXS={marginXXS}\n marginXS={marginXS}\n marginS={marginS}\n marginM={marginM}\n marginL={marginL}\n marginXL={marginXL}\n marginTop={marginTop}\n marginTopXXS={marginTopXXS}\n marginTopXS={marginTopXS}\n marginTopS={marginTopS}\n marginTopM={marginTopM}\n marginTopL={marginTopL}\n marginTopXL={marginTopXL}\n marginRight={marginRight}\n marginRightXXS={marginRightXXS}\n marginRightXS={marginRightXS}\n marginRightS={marginRightS}\n marginRightM={marginRightM}\n marginRightL={marginRightL}\n marginRightXL={marginRightXL}\n marginBottom={marginBottom}\n marginBottomXXS={marginBottomXXS}\n marginBottomXS={marginBottomXS}\n marginBottomS={marginBottomS}\n marginBottomM={marginBottomM}\n marginBottomL={marginBottomL}\n marginBottomXL={marginBottomXL}\n marginLeft={marginLeft}\n marginLeftXXS={marginLeftXXS}\n marginLeftXS={marginLeftXS}\n marginLeftS={marginLeftS}\n marginLeftM={marginLeftM}\n marginLeftL={marginLeftL}\n marginLeftXL={marginLeftXL}\n className={className}\n style={style}\n contrast={contrast}\n error={error}\n inline={inline}\n label={label}\n labelId={labelId}\n labelPosition={labelPosition}\n disabled={disabled}\n active={active}\n primary={primary}\n secondary={secondary}\n success={success}\n palette={{\n color: disabled ? palette.colorDisabled : palette.color,\n backgroundColor: disabled ? palette.backgroundColorDisabled : palette.backgroundColor,\n backgroundColorHover: disabled ? palette.backgroundColorDisabled : palette.backgroundColorHover,\n borderColor: disabled ? palette.borderColorDisabled : palette.borderColor,\n }}\n onClick={() => {\n if (textareaRef.current) {\n textareaRef.current.focus()\n }\n }}\n onFocus={() => {\n setActive(true)\n }}\n onPointerDown={(evt) => {\n if (evt.target === textareaRef.current || !(evt.target instanceof Node)) {\n return\n }\n evt.preventDefault()\n }}\n onBlur={(evt) => {\n if (textareaRef.current && !evt.currentTarget.contains(evt.relatedTarget)) {\n setActive(Boolean(textareaRef.current.value))\n }\n }}\n overflow='hidden'\n inputPosition='stretch'\n input={\n <>\n {autoRows && <Styled.TextareaMimic ref={textareaMimicRef} rows={1} />}\n <Styled.Textarea\n {...textareaProps}\n ref={textareaRef}\n aria-labelledby={label ? labelId : undefined}\n disabled={disabled}\n onChange={(evt) => {\n if (autoRows) updateAutoRowsCount()\n if (textareaProps.onChange) textareaProps.onChange(evt)\n }}\n rows={rowsVisible}\n palette={{\n color: palette.color,\n colorDisabled: palette.colorDisabled,\n placeholderColor: palette.placeholderColor,\n placeholderColorDisabled: palette.placeholderColorDisabled,\n }}\n />\n </>\n }\n addon={\n resize ? (\n <>\n {resizing && <Styled.ResizeGlobals cursor={cursorResize} />}\n <Styled.ResizeIcon\n size='l'\n icon={<ResizeHandle />}\n color='border-onmain-default-small'\n tabIndex={0}\n onPointerDown={handleResizeStart}\n onKeyDown={handleResizeOnNudge}\n cursor={cursorResize}\n />\n </>\n ) : undefined\n }\n />\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: (props) => (props.label ? SIZES_WITH_LABEL : SIZES),\n }\n)\n\nexport { Textarea, COMPONENT_NAME }\n"],"names":["Textarea","withMergedProps","forwardRef","props","forwardedRef","theme","useTheme","size","rows","maxRows","labelPosition","primary","width","defaultInputControlsWidth","autosize","rounded","color","placeholderColor","autoRows","resize","contrast","inline","secondary","success","error","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizes","sizeUnits","margin","marginXXS","marginXS","marginS","marginM","marginL","marginXL","marginTop","marginTopXXS","marginTopXS","marginTopS","marginTopM","marginTopL","marginTopXL","marginRight","marginRightXXS","marginRightXS","marginRightS","marginRightM","marginRightL","marginRightXL","marginBottom","marginBottomXXS","marginBottomXS","marginBottomS","marginBottomM","marginBottomL","marginBottomXL","marginLeft","marginLeftXXS","marginLeftXS","marginLeftS","marginLeftM","marginLeftL","marginLeftXL","widthXXS","widthXS","widthS","widthM","widthL","widthXL","preset","palette","label","fluid","className","style","disabled","textareaProps","textareaRef","useRef","textareaMimicRef","formInputLabelRef","useImperativeHandle","current","resizing","handleResizeStart","handleResizeOnNudge","useResizable","target","direction","labelId","useMemo","nanoid","active","setActive","useState","valueInit","value","defaultValue","length","autoRowsCount","setAutoRowsCount","Math","min","rowsVisible","cursorResize","updateAutoRowsCount","useCallback","nextRows","max","round","scrollHeight","clientHeight","styles","getComputedStyle","lineHeight","parseFloat","paddingTop","paddingBottom","Number","isNaN","fontSize","prevRows","useLayoutEffect","document","activeElement","useEffect","handleResize","createThrottledCallback","window","addEventListener","removeEventListener","_jsx","Styled","ref","onChange","evt","FormInputLabel","colorDisabled","backgroundColor","backgroundColorDisabled","backgroundColorHover","borderColor","borderColorDisabled","onClick","focus","onFocus","onPointerDown","Node","preventDefault","onBlur","currentTarget","contains","relatedTarget","Boolean","overflow","inputPosition","input","_jsxs","jsxs","_Fragment","children","jsx","undefined","placeholderColorDisabled","addon","cursor","icon","ResizeHandle","tabIndex","onKeyDown","displayName","SIZES_WITH_LABEL","SIZES"],"mappings":"kfAiCMA,MAAAA,SAA2DC,gBAAAA,gBAC/DC,MAAAA,YAAW,CAACC,EAAOC,KACjB,MAAMC,EAAQC,OAAAA,WAEd,MAAMC,KACJA,EAAO,IAAGC,KACVA,EAAO,EAACC,QACRA,EAAU,GAAEC,cACZA,EAAgB,UAASC,QACzBA,GAAU,EAAIC,MACdA,EAAQP,EAAMQ,0BAAyBC,SACvCA,GAAW,EAAIC,QACfA,GAAU,EAAIC,MACdA,EAAQ,YAAWC,iBACnBA,EAAmB,SAAQC,SAC3BA,EAAQC,OACRA,EAAMC,SACNA,EAAQC,OACRA,EAAMC,UACNA,EAASC,QACTA,EAAOC,MACPA,EAAKC,QACLA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,MACNA,EAAKC,UACLA,EAASC,OACTA,EAAMC,UACNA,EAASC,SACTA,EAAQC,QACRA,EAAOC,QACPA,EAAOC,QACPA,EAAOC,SACPA,EAAQC,UACRA,EAASC,aACTA,EAAYC,YACZA,EAAWC,WACXA,EAAUC,WACVA,EAAUC,WACVA,EAAUC,YACVA,EAAWC,YACXA,EAAWC,eACXA,EAAcC,cACdA,EAAaC,aACbA,EAAYC,aACZA,EAAYC,aACZA,EAAYC,cACZA,EAAaC,aACbA,EAAYC,gBACZA,EAAeC,eACfA,EAAcC,cACdA,EAAaC,cACbA,EAAaC,cACbA,GAAaC,eACbA,GAAcC,WACdA,GAAUC,cACVA,GAAaC,aACbA,GAAYC,YACZA,GAAWC,YACXA,GAAWC,YACXA,GAAWC,aACXA,GAAYC,SACZA,GAAQC,QACRA,GAAOC,OACPA,GAAMC,OACNA,GAAMC,OACNA,GAAMC,QACNA,GAAOC,OACPA,GAAMC,QACNA,G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B,oBAAoB,CAACC,IAAKtD,GAAkB5E,KAAM,IAChEgI,WAAA8B,IAAC7B,eAAe,IACVxD,GACJyD,IAAKxD,GACL,kBAAiBN,GAAQkB,QAAUyE,EACnCvF,SAAUA,GACV2D,SAAWC,IACL1H,GAAU4F,KACV7B,GAAc0D,UAAU1D,GAAc0D,SAASC,EAAI,EAEzDpI,KAAMoG,GACNjC,QAAS,CACP3D,MAAO2D,GAAQ3D,MACf8H,cAAenE,GAAQmE,cACvB7H,iBAAkB0D,GAAQ1D,iBAC1BuJ,yBAA0B7F,GAAQ6F,+BAK1CC,MACEtJ,EACE+I,WAAAC,KAAAC,oBAAA,CAAAC,UACG7E,IAAYgD,WAAA8B,IAAC7B,oBAAoB,CAACiC,OAAQ7D,KAC3C2B,WAAA8B,IAAC7B,iBAAiB,CAChBlI,KAAK,IACLoK,KAAMnC,WAAAA,IAACoC,SAAYA,iBACnB5J,MAAM,8BACN6J,SAAU,EACVtB,cAAe9D,GACfqF,UAAWpF,GACXgF,OAAQ7D,aAGV0D,GAEN,IAGN,CACEQ,YArVmB,WAsVnBhJ,MAAQ5B,GAAWA,EAAMyE,MAAQoG,UAAgBA,iBAAGC,UAAAA,+BAtVjC"}
@@ -1,2 +1,2 @@
1
- import{forwardRef,useRef,useImperativeHandle,useMemo,useState,useCallback,useLayoutEffect,useEffect}from'react';import{useTheme}from'styled-components';import{nanoid}from'../../external/.pnpm/nanoid@5.0.9/node_modules/nanoid/index.browser.mjs';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{useResizable}from'../../hooks/useResizable.mjs';import{createThrottledCallback}from'../../shared/utils/misc.mjs';import{SIZES_WITH_LABEL,SIZES}from'./constants.mjs';import{Root,TextareaMimic,Textarea as Textarea$1,ResizeGlobals,ResizeIcon}from'./style.mjs';import{jsx,jsxs,Fragment}from'react/jsx-runtime';import{FormInputLabel}from'../FormInputLabel/FormInputLabel.mjs';import{ResizeHandle as ResizeHandle_2}from'../../external/.pnpm/@foxford_icon-pack@0.11.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@foxford/icon-pack/icons/ResizeHandle/index.mjs';const COMPONENT_NAME='Textarea';const Textarea=withMergedProps(forwardRef(((e,r)=>{const o=useTheme();const{size:t="m",rows:a=2,maxRows:n=30,labelPosition:i="dynamic",primary:s=!0,width:m=o.defaultInputControlsWidth,autosize:l=!0,rounded:d=!0,color:c="mineShaft",placeholderColor:g="silver",autoRows:u,resize:h,contrast:p,inline:f,secondary:S,success:X,error:L,sizeXXS:b,sizeXS:z,sizeS:w,sizeM:R,sizeL:T,sizeXL:M,sizes:x,sizeUnits:C,margin:v,marginXXS:j,marginXS:B,marginS:y,marginM:E,marginL:I,marginXL:_,marginTop:k,marginTopXXS:H,marginTopXS:N,marginTopS:D,marginTopM:F,marginTopL:P,marginTopXL:A,marginRight:O,marginRightXXS:Z,marginRightXS:W,marginRightS:G,marginRightM:U,marginRightL:$,marginRightXL:K,marginBottom:V,marginBottomXXS:q,marginBottomXS:J,marginBottomS:Q,marginBottomM:Y,marginBottomL:ee,marginBottomXL:re,marginLeft:oe,marginLeftXXS:te,marginLeftXS:ae,marginLeftS:ne,marginLeftM:ie,marginLeftL:se,marginLeftXL:me,widthXXS:le,widthXS:de,widthS:ce,widthM:ge,widthL:ue,widthXL:he,preset:pe,palette:fe,label:Se,fluid:Xe,className:Le,style:be,disabled:ze,...we}=e;const Re=useRef(null);const Te=useRef(null);const Me=useRef(null);useImperativeHandle(r,(()=>Re.current),[]);const[xe,Ce,ve]=useResizable({target:Me,direction:h});const je=useMemo((()=>nanoid()),[]);const[Be,ye]=useState((()=>{const e=we.value??we.defaultValue;return typeof e=='string'&&e.length>0}));const[Ee,Ie]=useState((()=>Math.min(a,n)));const _e=pe==='brand'&&u||pe!=='brand'&&l?Ee:Math.min(a,n);const ke=h==='horizontal'?'ew-resize':h==='vertical'?'ns-resize':'nwse-resize';const He=useCallback((()=>{if(!Re.current)return;if(pe==='brand'){if(!Te.current)return;Te.current.value=Re.current.value;const e=Math.max(Math.round(Te.current.scrollHeight/Te.current.clientHeight),a);return void Ie(Math.min(e,n))}const e=getComputedStyle(Re.current);const r=parseFloat(e.lineHeight);const o=Math.max(Math.round((Re.current.scrollHeight-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom))/(Number.isNaN(r)?parseFloat(e.fontSize)*1.2:r)),a);Ie((e=>o>e?Math.min(o,n):Re.current&&!Re.current.value?a:e))}),[pe,a,n]);return useLayoutEffect((()=>{pe==='brand'&&typeof we.value=='string'&&Re.current&&Re.current!==document.activeElement&&ye(we.value.length>0)}),[pe,we.value]),useEffect((()=>{const e=createThrottledCallback(He,200);return(pe==='brand'&&u||pe!=='brand'&&l)&&(He(),window.addEventListener('resize',e)),()=>{window.removeEventListener('resize',e)}}),[pe,u,l,He]),pe!=='brand'?jsx(Root,{...we,ref:Re,className:Le,style:be,onChange:e=>{l&&He(),we.onChange&&we.onChange(e)},rows:_e,color:c,rounded:d,placeholderColor:g,disabled:ze,error:L,fluid:Xe,width:m,widthXXS:le,widthXS:de,widthS:ce,widthM:ge,widthL:ue,widthXL:he}):jsx(FormInputLabel,{ref:Me,size:t,sizeXXS:b,sizeXS:z,sizeS:w,sizeM:R,sizeL:T,sizeXL:M,sizes:x,sizeUnits:C,margin:v,marginXXS:j,marginXS:B,marginS:y,marginM:E,marginL:I,marginXL:_,marginTop:k,marginTopXXS:H,marginTopXS:N,marginTopS:D,marginTopM:F,marginTopL:P,marginTopXL:A,marginRight:O,marginRightXXS:Z,marginRightXS:W,marginRightS:G,marginRightM:U,marginRightL:$,marginRightXL:K,marginBottom:V,marginBottomXXS:q,marginBottomXS:J,marginBottomS:Q,marginBottomM:Y,marginBottomL:ee,marginBottomXL:re,marginLeft:oe,marginLeftXXS:te,marginLeftXS:ae,marginLeftS:ne,marginLeftM:ie,marginLeftL:se,marginLeftXL:me,className:Le,style:be,contrast:p,error:L,inline:f,label:Se,labelId:je,labelPosition:i,disabled:ze,active:Be,primary:s,secondary:S,success:X,palette:{color:ze?fe.colorDisabled:fe.color,backgroundColor:ze?fe.backgroundColorDisabled:fe.backgroundColor,backgroundColorHover:ze?fe.backgroundColorDisabled:fe.backgroundColorHover,borderColor:ze?fe.borderColorDisabled:fe.borderColor},onClick:()=>{Re.current&&Re.current.focus()},onFocus:()=>{ye(!0)},onPointerDown:e=>{e.target!==Re.current&&e.target instanceof Node&&e.preventDefault()},onBlur:e=>{Re.current&&!e.currentTarget.contains(e.relatedTarget)&&ye(Boolean(Re.current.value))},overflow:"hidden",inputPosition:"stretch",input:jsxs(Fragment,{children:[u&&jsx(TextareaMimic,{ref:Te,rows:1}),jsx(Textarea$1,{...we,ref:Re,"aria-labelledby":Se?je:void 0,disabled:ze,onChange:e=>{u&&He(),we.onChange&&we.onChange(e)},rows:_e,palette:{color:fe.color,colorDisabled:fe.colorDisabled,placeholderColor:fe.placeholderColor,placeholderColorDisabled:fe.placeholderColorDisabled}})]}),addon:h?jsxs(Fragment,{children:[xe&&jsx(ResizeGlobals,{cursor:ke}),jsx(ResizeIcon,{size:"l",icon:jsx(ResizeHandle_2,{}),color:"border-onmain-default-small",tabIndex:0,onPointerDown:Ce,onKeyDown:ve,cursor:ke})]}):void 0})})),{displayName:"Textarea",sizes:e=>e.label?SIZES_WITH_LABEL:SIZES});export{COMPONENT_NAME,Textarea};
1
+ import{forwardRef,useRef,useImperativeHandle,useMemo,useState,useCallback,useLayoutEffect,useEffect}from'react';import{useTheme}from'styled-components';import{nanoid}from'nanoid';import{ResizeHandle}from'@foxford/icon-pack';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{useResizable}from'../../hooks/useResizable.mjs';import{createThrottledCallback}from'../../shared/utils/misc.mjs';import{SIZES_WITH_LABEL,SIZES}from'./constants.mjs';import{Root,TextareaMimic,Textarea as Textarea$1,ResizeGlobals,ResizeIcon}from'./style.mjs';import{jsx,jsxs,Fragment}from'react/jsx-runtime';import{FormInputLabel}from'../FormInputLabel/FormInputLabel.mjs';const COMPONENT_NAME='Textarea';const Textarea=withMergedProps(forwardRef(((e,r)=>{const o=useTheme();const{size:t="m",rows:a=2,maxRows:n=30,labelPosition:i="dynamic",primary:s=!0,width:m=o.defaultInputControlsWidth,autosize:l=!0,rounded:g=!0,color:c="mineShaft",placeholderColor:d="silver",autoRows:u,resize:h,contrast:p,inline:f,secondary:S,success:X,error:L,sizeXXS:b,sizeXS:z,sizeS:w,sizeM:T,sizeL:M,sizeXL:R,sizes:C,sizeUnits:x,margin:v,marginXXS:B,marginXS:j,marginS:y,marginM:E,marginL:I,marginXL:N,marginTop:k,marginTopXXS:D,marginTopXS:F,marginTopS:H,marginTopM:P,marginTopL:_,marginTopXL:A,marginRight:O,marginRightXXS:Z,marginRightXS:W,marginRightS:G,marginRightM:U,marginRightL:$,marginRightXL:K,marginBottom:V,marginBottomXXS:q,marginBottomXS:J,marginBottomS:Q,marginBottomM:Y,marginBottomL:ee,marginBottomXL:re,marginLeft:oe,marginLeftXXS:te,marginLeftXS:ae,marginLeftS:ne,marginLeftM:ie,marginLeftL:se,marginLeftXL:me,widthXXS:le,widthXS:ge,widthS:ce,widthM:de,widthL:ue,widthXL:he,preset:pe,palette:fe,label:Se,fluid:Xe,className:Le,style:be,disabled:ze,...we}=e;const Te=useRef(null);const Me=useRef(null);const Re=useRef(null);useImperativeHandle(r,(()=>Te.current),[]);const[Ce,xe,ve]=useResizable({target:Re,direction:h});const Be=useMemo((()=>nanoid()),[]);const[je,ye]=useState((()=>{const e=we.value??we.defaultValue;return typeof e=='string'&&e.length>0}));const[Ee,Ie]=useState((()=>Math.min(a,n)));const Ne=pe==='brand'&&u||pe!=='brand'&&l?Ee:Math.min(a,n);const ke=h==='horizontal'?'ew-resize':h==='vertical'?'ns-resize':'nwse-resize';const De=useCallback((()=>{if(!Te.current)return;if(pe==='brand'){if(!Me.current)return;Me.current.value=Te.current.value;const e=Math.max(Math.round(Me.current.scrollHeight/Me.current.clientHeight),a);return void Ie(Math.min(e,n))}const e=getComputedStyle(Te.current);const r=parseFloat(e.lineHeight);const o=Math.max(Math.round((Te.current.scrollHeight-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom))/(Number.isNaN(r)?parseFloat(e.fontSize)*1.2:r)),a);Ie((e=>o>e?Math.min(o,n):Te.current&&!Te.current.value?a:e))}),[pe,a,n]);return useLayoutEffect((()=>{pe==='brand'&&typeof we.value=='string'&&Te.current&&Te.current!==document.activeElement&&ye(we.value.length>0)}),[pe,we.value]),useEffect((()=>{const e=createThrottledCallback(De,200);return(pe==='brand'&&u||pe!=='brand'&&l)&&(De(),window.addEventListener('resize',e)),()=>{window.removeEventListener('resize',e)}}),[pe,u,l,De]),pe!=='brand'?jsx(Root,{...we,ref:Te,className:Le,style:be,onChange:e=>{l&&De(),we.onChange&&we.onChange(e)},rows:Ne,color:c,rounded:g,placeholderColor:d,disabled:ze,error:L,fluid:Xe,width:m,widthXXS:le,widthXS:ge,widthS:ce,widthM:de,widthL:ue,widthXL:he}):jsx(FormInputLabel,{ref:Re,size:t,sizeXXS:b,sizeXS:z,sizeS:w,sizeM:T,sizeL:M,sizeXL:R,sizes:C,sizeUnits:x,margin:v,marginXXS:B,marginXS:j,marginS:y,marginM:E,marginL:I,marginXL:N,marginTop:k,marginTopXXS:D,marginTopXS:F,marginTopS:H,marginTopM:P,marginTopL:_,marginTopXL:A,marginRight:O,marginRightXXS:Z,marginRightXS:W,marginRightS:G,marginRightM:U,marginRightL:$,marginRightXL:K,marginBottom:V,marginBottomXXS:q,marginBottomXS:J,marginBottomS:Q,marginBottomM:Y,marginBottomL:ee,marginBottomXL:re,marginLeft:oe,marginLeftXXS:te,marginLeftXS:ae,marginLeftS:ne,marginLeftM:ie,marginLeftL:se,marginLeftXL:me,className:Le,style:be,contrast:p,error:L,inline:f,label:Se,labelId:Be,labelPosition:i,disabled:ze,active:je,primary:s,secondary:S,success:X,palette:{color:ze?fe.colorDisabled:fe.color,backgroundColor:ze?fe.backgroundColorDisabled:fe.backgroundColor,backgroundColorHover:ze?fe.backgroundColorDisabled:fe.backgroundColorHover,borderColor:ze?fe.borderColorDisabled:fe.borderColor},onClick:()=>{Te.current&&Te.current.focus()},onFocus:()=>{ye(!0)},onPointerDown:e=>{e.target!==Te.current&&e.target instanceof Node&&e.preventDefault()},onBlur:e=>{Te.current&&!e.currentTarget.contains(e.relatedTarget)&&ye(Boolean(Te.current.value))},overflow:"hidden",inputPosition:"stretch",input:jsxs(Fragment,{children:[u&&jsx(TextareaMimic,{ref:Me,rows:1}),jsx(Textarea$1,{...we,ref:Te,"aria-labelledby":Se?Be:void 0,disabled:ze,onChange:e=>{u&&De(),we.onChange&&we.onChange(e)},rows:Ne,palette:{color:fe.color,colorDisabled:fe.colorDisabled,placeholderColor:fe.placeholderColor,placeholderColorDisabled:fe.placeholderColorDisabled}})]}),addon:h?jsxs(Fragment,{children:[Ce&&jsx(ResizeGlobals,{cursor:ke}),jsx(ResizeIcon,{size:"l",icon:jsx(ResizeHandle,{}),color:"border-onmain-default-small",tabIndex:0,onPointerDown:xe,onKeyDown:ve,cursor:ke})]}):void 0})})),{displayName:"Textarea",sizes:e=>e.label?SIZES_WITH_LABEL:SIZES});export{COMPONENT_NAME,Textarea};
2
2
  //# sourceMappingURL=Textarea.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.mjs","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import {\n forwardRef,\n useImperativeHandle,\n useLayoutEffect,\n useEffect,\n useRef,\n useState,\n useMemo,\n useCallback,\n} from 'react'\nimport { useTheme } from 'styled-components'\nimport { nanoid } from 'nanoid'\nimport { ResizeHandle } from '@foxford/icon-pack'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { useResizable } from 'hooks/useResizable'\nimport { createThrottledCallback } from 'shared/utils/misc'\nimport { FormInputLabel } from 'components/FormInputLabel'\nimport { SIZES, SIZES_WITH_LABEL } from './constants'\nimport * as Styled from './style'\nimport type { TextareaProps } from './types'\n\nconst COMPONENT_NAME = 'Textarea'\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<textarea\\> элемента.\n *\n * Поддерживаются пропсы определения размеров и внешних отступов в зависимости от ширины вьюпорта.\n *\n * Можно передать \"ref\", который будет ассоциирован с \\<textarea\\>.\n *\n * Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/Textarea/types.ts).\n */\nconst Textarea: React.ForwardRefExoticComponent<TextareaProps> = withMergedProps<TextareaProps, HTMLTextAreaElement>(\n forwardRef((props, forwardedRef) => {\n const theme = useTheme()\n\n const {\n size = 'm',\n rows = 2,\n maxRows = 30,\n labelPosition = 'dynamic',\n primary = true,\n width = theme.defaultInputControlsWidth,\n autosize = true,\n rounded = true,\n color = 'mineShaft',\n placeholderColor = 'silver',\n autoRows,\n resize,\n contrast,\n inline,\n secondary,\n success,\n error,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizes,\n sizeUnits,\n margin,\n marginXXS,\n marginXS,\n marginS,\n marginM,\n marginL,\n marginXL,\n marginTop,\n marginTopXXS,\n marginTopXS,\n marginTopS,\n marginTopM,\n marginTopL,\n marginTopXL,\n marginRight,\n marginRightXXS,\n marginRightXS,\n marginRightS,\n marginRightM,\n marginRightL,\n marginRightXL,\n marginBottom,\n marginBottomXXS,\n marginBottomXS,\n marginBottomS,\n marginBottomM,\n marginBottomL,\n marginBottomXL,\n marginLeft,\n marginLeftXXS,\n marginLeftXS,\n marginLeftS,\n marginLeftM,\n marginLeftL,\n marginLeftXL,\n widthXXS,\n widthXS,\n widthS,\n widthM,\n widthL,\n widthXL,\n preset,\n palette,\n label,\n fluid,\n className,\n style,\n disabled,\n ...textareaProps\n } = props\n\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n\n const textareaMimicRef = useRef<HTMLTextAreaElement>(null)\n\n const formInputLabelRef = useRef<HTMLDivElement>(null)\n\n useImperativeHandle(forwardedRef, () => textareaRef.current as HTMLTextAreaElement, [])\n\n const [resizing, handleResizeStart, handleResizeOnNudge] = useResizable<HTMLDivElement, HTMLSpanElement>({\n target: formInputLabelRef,\n direction: resize,\n })\n\n const labelId = useMemo(() => nanoid(), [])\n\n const [active, setActive] = useState(() => {\n const valueInit = textareaProps.value ?? textareaProps.defaultValue\n\n return typeof valueInit === 'string' && valueInit.length > 0\n })\n\n const [autoRowsCount, setAutoRowsCount] = useState(() => Math.min(rows, maxRows))\n\n const rowsVisible =\n (preset === 'brand' && autoRows) || (preset !== 'brand' && autosize) ? autoRowsCount : Math.min(rows, maxRows)\n\n const cursorResize = resize === 'horizontal' ? 'ew-resize' : resize === 'vertical' ? 'ns-resize' : 'nwse-resize'\n\n const updateAutoRowsCount = useCallback(() => {\n if (!textareaRef.current) return\n\n if (preset === 'brand') {\n if (!textareaMimicRef.current) return\n\n textareaMimicRef.current.value = textareaRef.current.value\n\n const nextRows = Math.max(\n Math.round(textareaMimicRef.current.scrollHeight / textareaMimicRef.current.clientHeight),\n rows\n )\n\n setAutoRowsCount(Math.min(nextRows, maxRows))\n\n return\n }\n\n const styles = getComputedStyle(textareaRef.current)\n\n const lineHeight = parseFloat(styles.lineHeight)\n\n const nextRows = Math.max(\n Math.round(\n (textareaRef.current.scrollHeight - parseFloat(styles.paddingTop) - parseFloat(styles.paddingBottom)) /\n (Number.isNaN(lineHeight) ? parseFloat(styles.fontSize) * 1.2 : lineHeight)\n ),\n rows\n )\n\n setAutoRowsCount((prevRows) => {\n if (nextRows > prevRows) return Math.min(nextRows, maxRows)\n if (textareaRef.current && !textareaRef.current.value) return rows\n\n return prevRows\n })\n }, [preset, rows, maxRows])\n\n useLayoutEffect(() => {\n if (\n preset === 'brand' &&\n typeof textareaProps.value === 'string' &&\n textareaRef.current &&\n textareaRef.current !== document.activeElement\n ) {\n setActive(textareaProps.value.length > 0)\n }\n }, [preset, textareaProps.value])\n\n useEffect(() => {\n const handleResize = createThrottledCallback<UIEvent>(updateAutoRowsCount, 200)\n\n if ((preset === 'brand' && autoRows) || (preset !== 'brand' && autosize)) {\n updateAutoRowsCount()\n window.addEventListener('resize', handleResize)\n }\n\n return () => {\n window.removeEventListener('resize', handleResize)\n }\n }, [preset, autoRows, autosize, updateAutoRowsCount])\n\n if (preset !== 'brand') {\n return (\n <Styled.Root\n {...textareaProps}\n ref={textareaRef}\n className={className}\n style={style}\n onChange={(evt) => {\n if (autosize) updateAutoRowsCount()\n if (textareaProps.onChange) textareaProps.onChange(evt)\n }}\n rows={rowsVisible}\n color={color}\n rounded={rounded}\n placeholderColor={placeholderColor}\n disabled={disabled}\n error={error}\n fluid={fluid}\n width={width}\n widthXXS={widthXXS}\n widthXS={widthXS}\n widthS={widthS}\n widthM={widthM}\n widthL={widthL}\n widthXL={widthXL}\n />\n )\n }\n\n return (\n <FormInputLabel\n ref={formInputLabelRef}\n size={size}\n sizeXXS={sizeXXS}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n sizes={sizes}\n sizeUnits={sizeUnits}\n margin={margin}\n marginXXS={marginXXS}\n marginXS={marginXS}\n marginS={marginS}\n marginM={marginM}\n marginL={marginL}\n marginXL={marginXL}\n marginTop={marginTop}\n marginTopXXS={marginTopXXS}\n marginTopXS={marginTopXS}\n marginTopS={marginTopS}\n marginTopM={marginTopM}\n marginTopL={marginTopL}\n marginTopXL={marginTopXL}\n marginRight={marginRight}\n marginRightXXS={marginRightXXS}\n marginRightXS={marginRightXS}\n marginRightS={marginRightS}\n marginRightM={marginRightM}\n marginRightL={marginRightL}\n marginRightXL={marginRightXL}\n marginBottom={marginBottom}\n marginBottomXXS={marginBottomXXS}\n marginBottomXS={marginBottomXS}\n marginBottomS={marginBottomS}\n marginBottomM={marginBottomM}\n marginBottomL={marginBottomL}\n marginBottomXL={marginBottomXL}\n marginLeft={marginLeft}\n marginLeftXXS={marginLeftXXS}\n marginLeftXS={marginLeftXS}\n marginLeftS={marginLeftS}\n marginLeftM={marginLeftM}\n marginLeftL={marginLeftL}\n marginLeftXL={marginLeftXL}\n className={className}\n style={style}\n contrast={contrast}\n error={error}\n inline={inline}\n label={label}\n labelId={labelId}\n labelPosition={labelPosition}\n disabled={disabled}\n active={active}\n primary={primary}\n secondary={secondary}\n success={success}\n palette={{\n color: disabled ? palette.colorDisabled : palette.color,\n backgroundColor: disabled ? palette.backgroundColorDisabled : palette.backgroundColor,\n backgroundColorHover: disabled ? palette.backgroundColorDisabled : palette.backgroundColorHover,\n borderColor: disabled ? palette.borderColorDisabled : palette.borderColor,\n }}\n onClick={() => {\n if (textareaRef.current) {\n textareaRef.current.focus()\n }\n }}\n onFocus={() => {\n setActive(true)\n }}\n onPointerDown={(evt) => {\n if (evt.target === textareaRef.current || !(evt.target instanceof Node)) {\n return\n }\n evt.preventDefault()\n }}\n onBlur={(evt) => {\n if (textareaRef.current && !evt.currentTarget.contains(evt.relatedTarget)) {\n setActive(Boolean(textareaRef.current.value))\n }\n }}\n overflow='hidden'\n inputPosition='stretch'\n input={\n <>\n {autoRows && <Styled.TextareaMimic ref={textareaMimicRef} rows={1} />}\n <Styled.Textarea\n {...textareaProps}\n ref={textareaRef}\n aria-labelledby={label ? labelId : undefined}\n disabled={disabled}\n onChange={(evt) => {\n if (autoRows) updateAutoRowsCount()\n if (textareaProps.onChange) textareaProps.onChange(evt)\n }}\n rows={rowsVisible}\n palette={{\n color: palette.color,\n colorDisabled: palette.colorDisabled,\n placeholderColor: palette.placeholderColor,\n placeholderColorDisabled: palette.placeholderColorDisabled,\n }}\n />\n </>\n }\n addon={\n resize ? (\n <>\n {resizing && <Styled.ResizeGlobals cursor={cursorResize} />}\n <Styled.ResizeIcon\n size='l'\n icon={<ResizeHandle />}\n color='border-onmain-default-small'\n tabIndex={0}\n onPointerDown={handleResizeStart}\n onKeyDown={handleResizeOnNudge}\n cursor={cursorResize}\n />\n </>\n ) : undefined\n }\n />\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: (props) => (props.label ? SIZES_WITH_LABEL : SIZES),\n }\n)\n\nexport { Textarea, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","Textarea","withMergedProps","forwardRef","props","forwardedRef","theme","useTheme","size","rows","maxRows","labelPosition","primary","width","defaultInputControlsWidth","autosize","rounded","color","placeholderColor","autoRows","resize","contrast","inline","secondary","success","error","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizes","sizeUnits","margin","marginXXS","marginXS","marginS","marginM","marginL","marginXL","marginTop","marginTopXXS","marginTopXS","marginTopS","marginTopM","marginTopL","marginTopXL","marginRight","marginRightXXS","marginRightXS","marginRightS","marginRightM","marginRightL","marginRightXL","marginBottom","marginBottomXXS","marginBottomXS","marginBottomS","marginBottomM","marginBottomL","marginBottomXL","marginLeft","marginLeftXXS","marginLeftXS","marginLeftS","marginLeftM","marginLeftL","marginLeftXL","widthXXS","widthXS","widthS","widthM","widthL","widthXL","preset","palette","label","fluid","className","style","disabled","textareaProps","textareaRef","useRef","textareaMimicRef","formInputLabelRef","useImperativeHandle","current","resizing","handleResizeStart","handleResizeOnNudge","useResizable","target","direction","labelId","useMemo","nanoid","active","setActive","useState","valueInit","value","defaultValue","length","autoRowsCount","setAutoRowsCount","Math","min","rowsVisible","cursorResize","updateAutoRowsCount","useCallback","nextRows","max","round","scrollHeight","clientHeight","styles","getComputedStyle","lineHeight","parseFloat","paddingTop","paddingBottom","Number","isNaN","fontSize","prevRows","useLayoutEffect","document","activeElement","useEffect","handleResize","createThrottledCallback","window","addEventListener","removeEventListener","_jsx","Styled","ref","onChange","evt","FormInputLabel","colorDisabled","backgroundColor","backgroundColorDisabled","backgroundColorHover","borderColor","borderColorDisabled","onClick","focus","onFocus","onPointerDown","Node","preventDefault","onBlur","currentTarget","contains","relatedTarget","Boolean","overflow","inputPosition","input","_jsxs","_Fragment","children","undefined","placeholderColorDisabled","addon","cursor","icon","ResizeHandle","tabIndex","onKeyDown","displayName","SIZES_WITH_LABEL","SIZES"],"mappings":"82BAqBMA,MAAAA,eAAiB,WAYjBC,MAAAA,SAA2DC,gBAC/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1BqJ,yBAA0B3F,GAAQ2F,+BAK1CC,MACEpJ,EACE+I,KAAAC,SAAA,CAAAC,UACG5E,IAAYgD,IAACC,cAAoB,CAAC+B,OAAQ3D,KAC3C2B,IAACC,WAAiB,CAChBlI,KAAK,IACLkK,KAAMjC,IAACkC,mBACP1J,MAAM,8BACN2J,SAAU,EACVpB,cAAe9D,GACfmF,UAAWlF,GACX8E,OAAQ3D,aAGVwD,GAEN,IAGN,CACEQ,YArVmB,WAsVnB9I,MAAQ5B,GAAWA,EAAMyE,MAAQkG,iBAAmBC"}
1
+ {"version":3,"file":"Textarea.mjs","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import {\n forwardRef,\n useImperativeHandle,\n useLayoutEffect,\n useEffect,\n useRef,\n useState,\n useMemo,\n useCallback,\n} from 'react'\nimport { useTheme } from 'styled-components'\nimport { nanoid } from 'nanoid'\nimport { ResizeHandle } from '@foxford/icon-pack'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { useResizable } from 'hooks/useResizable'\nimport { createThrottledCallback } from 'shared/utils/misc'\nimport { FormInputLabel } from 'components/FormInputLabel'\nimport { SIZES, SIZES_WITH_LABEL } from './constants'\nimport * as Styled from './style'\nimport type { TextareaProps } from './types'\n\nconst COMPONENT_NAME = 'Textarea'\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<textarea\\> элемента.\n *\n * Поддерживаются пропсы определения размеров и внешних отступов в зависимости от ширины вьюпорта.\n *\n * Можно передать \"ref\", который будет ассоциирован с \\<textarea\\>.\n *\n * Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/Textarea/types.ts).\n */\nconst Textarea: React.ForwardRefExoticComponent<TextareaProps> = withMergedProps<TextareaProps, HTMLTextAreaElement>(\n forwardRef((props, forwardedRef) => {\n const theme = useTheme()\n\n const {\n size = 'm',\n rows = 2,\n maxRows = 30,\n labelPosition = 'dynamic',\n primary = true,\n width = theme.defaultInputControlsWidth,\n autosize = true,\n rounded = true,\n color = 'mineShaft',\n placeholderColor = 'silver',\n autoRows,\n resize,\n contrast,\n inline,\n secondary,\n success,\n error,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizes,\n sizeUnits,\n margin,\n marginXXS,\n marginXS,\n marginS,\n marginM,\n marginL,\n marginXL,\n marginTop,\n marginTopXXS,\n marginTopXS,\n marginTopS,\n marginTopM,\n marginTopL,\n marginTopXL,\n marginRight,\n marginRightXXS,\n marginRightXS,\n marginRightS,\n marginRightM,\n marginRightL,\n marginRightXL,\n marginBottom,\n marginBottomXXS,\n marginBottomXS,\n marginBottomS,\n marginBottomM,\n marginBottomL,\n marginBottomXL,\n marginLeft,\n marginLeftXXS,\n marginLeftXS,\n marginLeftS,\n marginLeftM,\n marginLeftL,\n marginLeftXL,\n widthXXS,\n widthXS,\n widthS,\n widthM,\n widthL,\n widthXL,\n preset,\n palette,\n label,\n fluid,\n className,\n style,\n disabled,\n ...textareaProps\n } = props\n\n const textareaRef = useRef<HTMLTextAreaElement>(null)\n\n const textareaMimicRef = useRef<HTMLTextAreaElement>(null)\n\n const formInputLabelRef = useRef<HTMLDivElement>(null)\n\n useImperativeHandle(forwardedRef, () => textareaRef.current as HTMLTextAreaElement, [])\n\n const [resizing, handleResizeStart, handleResizeOnNudge] = useResizable<HTMLDivElement, HTMLSpanElement>({\n target: formInputLabelRef,\n direction: resize,\n })\n\n const labelId = useMemo(() => nanoid(), [])\n\n const [active, setActive] = useState(() => {\n const valueInit = textareaProps.value ?? textareaProps.defaultValue\n\n return typeof valueInit === 'string' && valueInit.length > 0\n })\n\n const [autoRowsCount, setAutoRowsCount] = useState(() => Math.min(rows, maxRows))\n\n const rowsVisible =\n (preset === 'brand' && autoRows) || (preset !== 'brand' && autosize) ? autoRowsCount : Math.min(rows, maxRows)\n\n const cursorResize = resize === 'horizontal' ? 'ew-resize' : resize === 'vertical' ? 'ns-resize' : 'nwse-resize'\n\n const updateAutoRowsCount = useCallback(() => {\n if (!textareaRef.current) return\n\n if (preset === 'brand') {\n if (!textareaMimicRef.current) return\n\n textareaMimicRef.current.value = textareaRef.current.value\n\n const nextRows = Math.max(\n Math.round(textareaMimicRef.current.scrollHeight / textareaMimicRef.current.clientHeight),\n rows\n )\n\n setAutoRowsCount(Math.min(nextRows, maxRows))\n\n return\n }\n\n const styles = getComputedStyle(textareaRef.current)\n\n const lineHeight = parseFloat(styles.lineHeight)\n\n const nextRows = Math.max(\n Math.round(\n (textareaRef.current.scrollHeight - parseFloat(styles.paddingTop) - parseFloat(styles.paddingBottom)) /\n (Number.isNaN(lineHeight) ? parseFloat(styles.fontSize) * 1.2 : lineHeight)\n ),\n rows\n )\n\n setAutoRowsCount((prevRows) => {\n if (nextRows > prevRows) return Math.min(nextRows, maxRows)\n if (textareaRef.current && !textareaRef.current.value) return rows\n\n return prevRows\n })\n }, [preset, rows, maxRows])\n\n useLayoutEffect(() => {\n if (\n preset === 'brand' &&\n typeof textareaProps.value === 'string' &&\n textareaRef.current &&\n textareaRef.current !== document.activeElement\n ) {\n setActive(textareaProps.value.length > 0)\n }\n }, [preset, textareaProps.value])\n\n useEffect(() => {\n const handleResize = createThrottledCallback<UIEvent>(updateAutoRowsCount, 200)\n\n if ((preset === 'brand' && autoRows) || (preset !== 'brand' && autosize)) {\n updateAutoRowsCount()\n window.addEventListener('resize', handleResize)\n }\n\n return () => {\n window.removeEventListener('resize', handleResize)\n }\n }, [preset, autoRows, autosize, updateAutoRowsCount])\n\n if (preset !== 'brand') {\n return (\n <Styled.Root\n {...textareaProps}\n ref={textareaRef}\n className={className}\n style={style}\n onChange={(evt) => {\n if (autosize) updateAutoRowsCount()\n if (textareaProps.onChange) textareaProps.onChange(evt)\n }}\n rows={rowsVisible}\n color={color}\n rounded={rounded}\n placeholderColor={placeholderColor}\n disabled={disabled}\n error={error}\n fluid={fluid}\n width={width}\n widthXXS={widthXXS}\n widthXS={widthXS}\n widthS={widthS}\n widthM={widthM}\n widthL={widthL}\n widthXL={widthXL}\n />\n )\n }\n\n return (\n <FormInputLabel\n ref={formInputLabelRef}\n size={size}\n sizeXXS={sizeXXS}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n sizes={sizes}\n sizeUnits={sizeUnits}\n margin={margin}\n marginXXS={marginXXS}\n marginXS={marginXS}\n marginS={marginS}\n marginM={marginM}\n marginL={marginL}\n marginXL={marginXL}\n marginTop={marginTop}\n marginTopXXS={marginTopXXS}\n marginTopXS={marginTopXS}\n marginTopS={marginTopS}\n marginTopM={marginTopM}\n marginTopL={marginTopL}\n marginTopXL={marginTopXL}\n marginRight={marginRight}\n marginRightXXS={marginRightXXS}\n marginRightXS={marginRightXS}\n marginRightS={marginRightS}\n marginRightM={marginRightM}\n marginRightL={marginRightL}\n marginRightXL={marginRightXL}\n marginBottom={marginBottom}\n marginBottomXXS={marginBottomXXS}\n marginBottomXS={marginBottomXS}\n marginBottomS={marginBottomS}\n marginBottomM={marginBottomM}\n marginBottomL={marginBottomL}\n marginBottomXL={marginBottomXL}\n marginLeft={marginLeft}\n marginLeftXXS={marginLeftXXS}\n marginLeftXS={marginLeftXS}\n marginLeftS={marginLeftS}\n marginLeftM={marginLeftM}\n marginLeftL={marginLeftL}\n marginLeftXL={marginLeftXL}\n className={className}\n style={style}\n contrast={contrast}\n error={error}\n inline={inline}\n label={label}\n labelId={labelId}\n labelPosition={labelPosition}\n disabled={disabled}\n active={active}\n primary={primary}\n secondary={secondary}\n success={success}\n palette={{\n color: disabled ? palette.colorDisabled : palette.color,\n backgroundColor: disabled ? palette.backgroundColorDisabled : palette.backgroundColor,\n backgroundColorHover: disabled ? palette.backgroundColorDisabled : palette.backgroundColorHover,\n borderColor: disabled ? palette.borderColorDisabled : palette.borderColor,\n }}\n onClick={() => {\n if (textareaRef.current) {\n textareaRef.current.focus()\n }\n }}\n onFocus={() => {\n setActive(true)\n }}\n onPointerDown={(evt) => {\n if (evt.target === textareaRef.current || !(evt.target instanceof Node)) {\n return\n }\n evt.preventDefault()\n }}\n onBlur={(evt) => {\n if (textareaRef.current && !evt.currentTarget.contains(evt.relatedTarget)) {\n setActive(Boolean(textareaRef.current.value))\n }\n }}\n overflow='hidden'\n inputPosition='stretch'\n input={\n <>\n {autoRows && <Styled.TextareaMimic ref={textareaMimicRef} rows={1} />}\n <Styled.Textarea\n {...textareaProps}\n ref={textareaRef}\n aria-labelledby={label ? labelId : undefined}\n disabled={disabled}\n onChange={(evt) => {\n if (autoRows) updateAutoRowsCount()\n if (textareaProps.onChange) textareaProps.onChange(evt)\n }}\n rows={rowsVisible}\n palette={{\n color: palette.color,\n colorDisabled: palette.colorDisabled,\n placeholderColor: palette.placeholderColor,\n placeholderColorDisabled: palette.placeholderColorDisabled,\n }}\n />\n </>\n }\n addon={\n resize ? (\n <>\n {resizing && <Styled.ResizeGlobals cursor={cursorResize} />}\n <Styled.ResizeIcon\n size='l'\n icon={<ResizeHandle />}\n color='border-onmain-default-small'\n tabIndex={0}\n onPointerDown={handleResizeStart}\n onKeyDown={handleResizeOnNudge}\n cursor={cursorResize}\n />\n </>\n ) : undefined\n }\n />\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: (props) => (props.label ? SIZES_WITH_LABEL : SIZES),\n }\n)\n\nexport { Textarea, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","Textarea","withMergedProps","forwardRef","props","forwardedRef","theme","useTheme","size","rows","maxRows","labelPosition","primary","width","defaultInputControlsWidth","autosize","rounded","color","placeholderColor","autoRows","resize","contrast","inline","secondary","success","error","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizes","sizeUnits","margin","marginXXS","marginXS","marginS","marginM","marginL","marginXL","marginTop","marginTopXXS","marginTopXS","marginTopS","marginTopM","marginTopL","marginTopXL","marginRight","marginRightXXS","marginRightXS","marginRightS","marginRightM","marginRightL","marginRightXL","marginBottom","marginBottomXXS","marginBottomXS","marginBottomS","marginBottomM","marginBottomL","marginBottomXL","marginLeft","marginLeftXXS","marginLeftXS","marginLeftS","marginLeftM","marginLeftL","marginLeftXL","widthXXS","widthXS","widthS","widthM","widthL","widthXL","preset","palette","label","fluid","className","style","disabled","textareaProps","textareaRef","useRef","textareaMimicRef","formInputLabelRef","useImperativeHandle","current","resizing","handleResizeStart","handleResizeOnNudge","useResizable","target","direction","labelId","useMemo","nanoid","active","setActive","useState","valueInit","value","defaultValue","length","autoRowsCount","setAutoRowsCount","Math","min","rowsVisible","cursorResize","updateAutoRowsCount","useCallback","nextRows","max","round","scrollHeight","clientHeight","styles","getComputedStyle","lineHeight","parseFloat","paddingTop","paddingBottom","Number","isNaN","fontSize","prevRows","useLayoutEffect","document","activeElement","useEffect","handleResize","createThrottledCallback","window","addEventListener","removeEventListener","_jsx","Styled","ref","onChange","evt","FormInputLabel","colorDisabled","backgroundColor","backgroundColorDisabled","backgroundColorHover","borderColor","borderColorDisabled","onClick","focus","onFocus","onPointerDown","Node","preventDefault","onBlur","currentTarget","contains","relatedTarget","Boolean","overflow","inputPosition","input","_jsxs","_Fragment","children","undefined","placeholderColorDisabled","addon","cursor","icon","ResizeHandle","tabIndex","onKeyDown","displayName","SIZES_WITH_LABEL","SIZES"],"mappings":"spBAqBMA,MAAAA,eAAiB,WAYjBC,MAAAA,SAA2DC,gBAC/DC,YAAW,CAACC,EAAOC,KACjB,MAAMC,EAAQC,WAEd,MAAMC,KACJA,EAAO,IAAGC,KACVA,EAAO,EAACC,QACRA,EAAU,GAAEC,cACZA,EAAgB,UAASC,QACzBA,GAAU,EAAIC,MACdA,EAAQP,EAAMQ,0BAAyBC,SACvCA,GAAW,EAAIC,QACfA,GAAU,EAAIC,MACdA,EAAQ,YAAWC,iBACnBA,EAAmB,SAAQC,SAC3BA,EAAQC,OACRA,EAAMC,SACNA,EAAQC,OACRA,EAAMC,UACNA,EAASC,QACTA,EAAOC,MACPA,EAAKC,QACLA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,E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E,gBACtEE,qBAAsBjE,GAAWL,GAAQqE,wBAA0BrE,GAAQsE,qBAC3EC,YAAalE,GAAWL,GAAQwE,oBAAsBxE,GAAQuE,aAEhEE,QAASA,KACHlE,GAAYK,SACdL,GAAYK,QAAQ8D,OACtB,EAEFC,QAASA,KACPpD,IAAU,EAAK,EAEjBqD,cAAgBX,IACVA,EAAIhD,SAAWV,GAAYK,SAAaqD,EAAIhD,kBAAkB4D,MAGlEZ,EAAIa,gBAAgB,EAEtBC,OAASd,IACH1D,GAAYK,UAAYqD,EAAIe,cAAcC,SAAShB,EAAIiB,gBACzD3D,GAAU4D,QAAQ5E,GAAYK,QAAQc,OACxC,EAEF0D,SAAS,SACTC,cAAc,UACdC,MACEC,KAAAC,SAAA,CAAAC,UACGlJ,GAAYsH,IAACC,cAAoB,CAACC,IAAKtD,GAAkB5E,KAAM,IAChEgI,IAACC,WAAe,IACVxD,GACJyD,IAAKxD,GACL,kBAAiBN,GAAQkB,QAAUuE,EACnCrF,SAAUA,GACV2D,SAAWC,IACL1H,GAAU4F,KACV7B,GAAc0D,UAAU1D,GAAc0D,SAASC,EAAI,EAEzDpI,KAAMoG,GACNjC,QAAS,CACP3D,MAAO2D,GAAQ3D,MACf8H,cAAenE,GAAQmE,cACvB7H,iBAAkB0D,GAAQ1D,iBAC1BqJ,yBAA0B3F,GAAQ2F,+BAK1CC,MACEpJ,EACE+I,KAAAC,SAAA,CAAAC,UACG5E,IAAYgD,IAACC,cAAoB,CAAC+B,OAAQ3D,KAC3C2B,IAACC,WAAiB,CAChBlI,KAAK,IACLkK,KAAMjC,IAACkC,iBACP1J,MAAM,8BACN2J,SAAU,EACVpB,cAAe9D,GACfmF,UAAWlF,GACX8E,OAAQ3D,aAGVwD,GAEN,IAGN,CACEQ,YArVmB,WAsVnB9I,MAAQ5B,GAAWA,EAAMyE,MAAQkG,iBAAmBC"}
@@ -1,2 +1,2 @@
1
- 'use strict';var React=require('react');var styled=require('styled-components');var Floater=require('react-floater');var ramda=require('ramda');var withMergedProps=require('../../hocs/withMergedProps.js');var TooltipWrapper=require('./TooltipWrapper.js');var defaultConstants=require('./default-constants.js');var require$$0=require('react/jsx-runtime');var TooltipComponent=require('../TooltipComponent/TooltipComponent.js');var constants=require('../TooltipComponent/constants.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Floater__default=_interopDefault(Floater);const Tooltip=Object.assign(withMergedProps.withMergedProps(React.forwardRef(((e,o)=>{const{preset:t,size:r="s",sizeXXS:s,sizeXS:i,sizeS:n,sizeM:l,sizeL:a,sizeXL:p,sizeUnits:c,sizes:u,palette:d,black:f,contrast:m,titleProps:T,contentProps:z,closeButtonProps:C,closeOnClickOutside:b,closeOnScroll:g,...q}=e;const h=styled.useTheme();if(t!=='brand'){const e={...q,styles:ramda.mergeDeepLeft(q.styles??{},defaultConstants.TOOLTIP_STYLES_DEFAULT)};return require$$0.jsx(Floater__default.default,{...e,children:require$$0.jsx("span",{children:e.children})})}let v=h.colors['bg-onmain-primary'];f&&(v=h.colors['bg-onmain-inverse']),m&&(v=h.colors['bg-brand-primary-basic']),d?.backgroundColor&&(v=h.colors[d.backgroundColor]??d.backgroundColor);const _={...q,offset:q.offset??8,styles:ramda.mergeDeepLeft(q.styles??{},{arrow:{color:v,spread:16,length:8},floater:{filter:`drop-shadow(0 6px 10px ${h.colors['bg-oncolor-hover']})`}}),component:require$$0.jsx(TooltipWrapper.TooltipWrapper,{ref:o,size:r,sizeXXS:s,sizeXS:i,sizeS:n,sizeM:l,sizeL:a,sizeXL:p,sizeUnits:c,sizes:u,palette:d,black:f,contrast:m,title:q.title,titleProps:T,content:q.content,contentProps:z,footer:q.footer,showCloseButton:q.showCloseButton,closeButtonProps:C,closeOnClickOutside:b,closeOnScroll:g,component:q.component})};return require$$0.jsx(Floater__default.default,{..._,modifiers:{flip:{enabled:!_.disableFlip}}})})),{displayName:"Tooltip",sizes:constants.SIZES}),{Component:TooltipComponent.TooltipComponent});exports.COMPONENT_NAME="Tooltip",exports.Tooltip=Tooltip;
1
+ 'use strict';var React=require('react');var styled=require('styled-components');var Floater=require('react-floater');var ramda=require('ramda');var withMergedProps=require('../../hocs/withMergedProps.js');var useResizeObserver=require('../../hooks/useResizeObserver.js');var TooltipWrapper=require('./TooltipWrapper.js');var defaultConstants=require('./default-constants.js');var jsxRuntime=require('react/jsx-runtime');var TooltipComponent=require('../TooltipComponent/TooltipComponent.js');var constants=require('../TooltipComponent/constants.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Floater__default=_interopDefault(Floater);const Tooltip=Object.assign(withMergedProps.withMergedProps(React.forwardRef(((e,t)=>{const{preset:o,size:r="s",styles:s={},sizeXXS:n,sizeXS:l,sizeS:a,sizeM:i,sizeL:p,sizeXL:c,sizeUnits:u,sizes:d,palette:m,black:f,contrast:z,titleProps:b,contentProps:g,closeButtonProps:T,closeOnClickOutside:v,closeOnScroll:C,portalElement:j,zIndex:y,...h}=e;const x=styled.useTheme();const[P,R]=React.useState(null);const[O,S]=React.useState(null);const _=typeof y=='number'?ramda.mergeDeepLeft({options:{zIndex:y}},s):s;if(React.useLayoutEffect((()=>{if(j)R(null);else if(document.body){let e=document.querySelector('[data-popper-portal]');e||(e=document.createElement('div'),e.dataset.popperPortal='true',e.style.position='relative',document.body.appendChild(e)),R(e)}}),[j]),useResizeObserver.useResizeObserver({target:document.body,onResize:()=>{O&&O.state.options.strategy==='absolute'&&O.update()}}),!j&&!P)return null;if(o!=='brand'){const e={...h,portalElement:j??P,styles:ramda.mergeDeepLeft(_,defaultConstants.TOOLTIP_STYLES_DEFAULT)};return jsxRuntime.jsx(Floater__default.default,{...e,children:jsxRuntime.jsx("span",{children:e.children})})}let q=x.colors['bg-onmain-primary'];f&&(q=x.colors['bg-onmain-inverse']),z&&(q=x.colors['bg-brand-primary-basic']),m?.backgroundColor&&(q=x.colors[m.backgroundColor]??m.backgroundColor);const L={...h,portalElement:j??P,getPopper:(e,t)=>{S(e),h.getPopper&&h.getPopper(e,t)},offset:h.offset??8,styles:ramda.mergeDeepLeft(_,{arrow:{color:q,spread:16,length:8},floater:{filter:`drop-shadow(0 6px 10px ${x.colors['bg-oncolor-hover']})`}}),component:jsxRuntime.jsx(TooltipWrapper.TooltipWrapper,{ref:t,size:r,sizeXXS:n,sizeXS:l,sizeS:a,sizeM:i,sizeL:p,sizeXL:c,sizeUnits:u,sizes:d,palette:m,black:f,contrast:z,title:h.title,titleProps:b,content:h.content,contentProps:g,footer:h.footer,showCloseButton:h.showCloseButton,closeButtonProps:T,closeOnClickOutside:v,closeOnScroll:C,component:h.component})};return jsxRuntime.jsx(Floater__default.default,{...L,modifiers:{flip:{enabled:!L.disableFlip}}})})),{displayName:"Tooltip",sizes:constants.SIZES}),{Component:TooltipComponent.TooltipComponent});exports.COMPONENT_NAME="Tooltip",exports.Tooltip=Tooltip;
2
2
  //# sourceMappingURL=Tooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useTheme } from 'styled-components'\nimport Floater from 'react-floater'\nimport { mergeDeepLeft } from 'ramda'\nimport type { Props as FloaterProps } from 'react-floater/lib/types'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { SIZES, TooltipComponent } from 'components/TooltipComponent'\nimport { TooltipWrapper } from './TooltipWrapper'\nimport { TOOLTIP_STYLES_DEFAULT } from './default-constants'\nimport type { TooltipProps } from './types'\n\nconst COMPONENT_NAME = 'Tooltip'\n\n/**\n *\n * Component accepts [\"react-floater\"](https://www.npmjs.com/package/react-floater/v/0.8.2) v0.8.2 props.\n *\n * Responsive \"size\" props are supported.\n *\n * Exposed \"ref\" attached to tooltip component root.\n *\n * See full [TooltipProps](https://github.com/foxford/ui/blob/master/src/components/Tooltip/types.ts)\n */\nconst Tooltip: React.ForwardRefExoticComponent<TooltipProps> & { Component: typeof TooltipComponent } = Object.assign(\n withMergedProps<TooltipProps, HTMLDivElement>(\n forwardRef((props, ref) => {\n const {\n preset,\n size = 's',\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizeUnits,\n sizes,\n palette,\n black,\n contrast,\n titleProps,\n contentProps,\n closeButtonProps,\n closeOnClickOutside,\n closeOnScroll,\n ...restProps\n } = props\n\n const theme = useTheme()\n\n if (preset !== 'brand') {\n const tooltipProps = {\n ...restProps,\n styles: mergeDeepLeft(restProps.styles ?? {}, TOOLTIP_STYLES_DEFAULT),\n } as FloaterProps\n\n return (\n <Floater {...tooltipProps}>\n <span>{tooltipProps.children}</span>\n </Floater>\n )\n }\n\n let color = theme.colors['bg-onmain-primary']\n\n if (black) color = theme.colors['bg-onmain-inverse']\n if (contrast) color = theme.colors['bg-brand-primary-basic']\n if (palette?.backgroundColor) color = theme.colors[palette.backgroundColor] ?? palette.backgroundColor\n\n const tooltipProps = {\n ...restProps,\n offset: restProps.offset ?? 8,\n styles: mergeDeepLeft(restProps.styles ?? {}, {\n arrow: {\n color,\n spread: 16,\n length: 8,\n },\n floater: {\n filter: `drop-shadow(0 6px 10px ${theme.colors['bg-oncolor-hover']})`,\n },\n }),\n component: (\n <TooltipWrapper\n ref={ref}\n size={size}\n sizeXXS={sizeXXS}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n sizeUnits={sizeUnits}\n sizes={sizes}\n palette={palette}\n black={black}\n contrast={contrast}\n title={restProps.title}\n titleProps={titleProps}\n content={restProps.content}\n contentProps={contentProps}\n footer={restProps.footer}\n showCloseButton={restProps.showCloseButton}\n closeButtonProps={closeButtonProps}\n closeOnClickOutside={closeOnClickOutside}\n closeOnScroll={closeOnScroll}\n component={restProps.component}\n />\n ),\n } as FloaterProps\n\n return (\n <Floater\n {...tooltipProps}\n modifiers={{\n flip: {\n enabled: !tooltipProps.disableFlip,\n },\n }}\n />\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n ),\n {\n Component: TooltipComponent,\n }\n)\n\nexport { Tooltip }\n\nexport { COMPONENT_NAME }\n"],"names":["Tooltip","Object","assign","withMergedProps","forwardRef","props","ref","preset","size","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizeUnits","sizes","palette","black","contrast","titleProps","contentProps","closeButtonProps","closeOnClickOutside","closeOnScroll","restProps","theme","useTheme","tooltipProps","styles","mergeDeepLeft","TOOLTIP_STYLES_DEFAULT","_jsx","Floater","children","jsx","color","colors","backgroundColor","offset","arrow","spread","length","floater","filter","component","TooltipWrapper","title","content","footer","showCloseButton","modifiers","flip","enabled","disableFlip","displayName","SIZES","Component","TooltipComponent"],"mappings":"mlBAuBA,MAAMA,QAAkGC,OAAOC,OAC7GC,gBAAAA,gBACEC,MAAAA,YAAW,CAACC,EAAOC,KACjB,MAAMC,OACJA,EAAMC,KACNA,EAAO,IAAGC,QACVA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,UACNA,EAASC,MACTA,EAAKC,QACLA,EAAOC,MACPA,EAAKC,SACLA,EAAQC,WACRA,EAAUC,aACVA,EAAYC,iBACZA,EAAgBC,oBAChBA,EAAmBC,cACnBA,KACGC,GACDpB,EAEJ,MAAMqB,EAAQC,OAAAA,WAEd,GAAIpB,IAAW,QAAS,CACtB,MAAMqB,EAAe,IAChBH,EACHI,OAAQC,MAAAA,cAAcL,EAAUI,QAAU,CAAA,EAAIE,iBAAAA,yBAGhD,OACEC,WAAAA,IAACC,iBAAAA,QAAO,IAAKL,EAAYM,SACvBF,WAAAG,IAAA,OAAA,CAAAD,SAAON,EAAaM,YAG1B,CAEA,IAAIE,EAAQV,EAAMW,OAAO,qBAErBnB,IAAOkB,EAAQV,EAAMW,OAAO,sBAC5BlB,IAAUiB,EAAQV,EAAMW,OAAO,2BAC/BpB,GAASqB,kBAAiBF,EAAQV,EAAMW,OAAOpB,EAAQqB,kBAAoBrB,EAAQqB,iBAEvF,MAAMV,EAAe,IAChBH,EACHc,OAAQd,EAAUc,QAAU,EAC5BV,OAAQC,MAAaA,cAACL,EAAUI,QAAU,CAAA,EAAI,CAC5CW,MAAO,CACLJ,QACAK,OAAQ,GACRC,OAAQ,GAEVC,QAAS,CACPC,OAAQ,0BAA0BlB,EAAMW,OAAO,0BAGnDQ,UACEb,WAAAG,IAACW,8BAAc,CACbxC,IAAKA,EACLE,KAAMA,EACNC,QAASA,EACTC,OAAQA,EACRC,MAAOA,EACPC,MAAOA,EACPC,MAAOA,EACPC,OAAQA,EACRC,UAAWA,EACXC,MAAOA,EACPC,QAASA,EACTC,MAAOA,EACPC,SAAUA,EACV4B,MAAOtB,EAAUsB,MACjB3B,WAAYA,EACZ4B,QAASvB,EAAUuB,QACnB3B,aAAcA,EACd4B,OAAQxB,EAAUwB,OAClBC,gBAAiBzB,EAAUyB,gBAC3B5B,iBAAkBA,EAClBC,oBAAqBA,EACrBC,cAAeA,EACfqB,UAAWpB,EAAUoB,aAK3B,OACEb,WAAAA,IAACC,iBAAAA,QAAO,IACFL,EACJuB,UAAW,CACTC,KAAM,CACJC,SAAUzB,EAAa0B,eAG3B,IAGN,CACEC,YAhHiB,UAiHjBvC,MAAOwC,UAAAA,QAGX,CACEC,UAAWC,iBAAAA,0CArHQ"}
1
+ {"version":3,"file":"Tooltip.js","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { forwardRef, useState, useLayoutEffect } from 'react'\nimport { useTheme } from 'styled-components'\nimport Floater from 'react-floater'\nimport { mergeDeepLeft } from 'ramda'\nimport type { Props as FloaterProps, PopperInstance, Styles } from 'react-floater'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { useResizeObserver } from 'hooks/useResizeObserver'\nimport { SIZES, TooltipComponent } from 'components/TooltipComponent'\nimport { TooltipWrapper } from './TooltipWrapper'\nimport { TOOLTIP_STYLES_DEFAULT } from './default-constants'\nimport type { TooltipProps } from './types'\n\nconst COMPONENT_NAME = 'Tooltip'\n\n/**\n *\n * Component based on [\"react-floater\"](https://www.npmjs.com/package/react-floater).\n *\n * Responsive \"size\" props are supported.\n *\n * Exposed \"ref\" attached to tooltip component root.\n *\n * See full [TooltipProps](https://github.com/foxford/ui/blob/master/src/components/Tooltip/types.ts)\n */\nconst Tooltip: React.ForwardRefExoticComponent<TooltipProps> & { Component: typeof TooltipComponent } = Object.assign(\n withMergedProps<TooltipProps, HTMLDivElement>(\n forwardRef((props, ref) => {\n const {\n preset,\n size = 's',\n styles = {},\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizeUnits,\n sizes,\n palette,\n black,\n contrast,\n titleProps,\n contentProps,\n closeButtonProps,\n closeOnClickOutside,\n closeOnScroll,\n portalElement,\n zIndex,\n ...restProps\n } = props\n\n const theme = useTheme()\n\n const [portal, setPortal] = useState<HTMLElement | null>(null)\n const [popper, setPopper] = useState<PopperInstance | null>(null)\n\n const floaterStyles: Partial<Styles> =\n typeof zIndex === 'number' ? mergeDeepLeft({ options: { zIndex } }, styles) : styles\n\n useLayoutEffect(() => {\n if (portalElement) {\n setPortal(null)\n } else if (document.body) {\n let popperPortal = document.querySelector<HTMLElement>('[data-popper-portal]')\n\n if (!popperPortal) {\n popperPortal = document.createElement('div')\n popperPortal.dataset.popperPortal = 'true'\n popperPortal.style.position = 'relative'\n\n document.body.appendChild(popperPortal)\n }\n\n setPortal(popperPortal)\n }\n }, [portalElement])\n\n useResizeObserver({\n target: document.body,\n onResize: () => {\n if (popper && popper.state.options.strategy === 'absolute') {\n popper.update()\n }\n },\n })\n\n if (!portalElement && !portal) {\n return null\n }\n\n if (preset !== 'brand') {\n const tooltipProps = {\n ...restProps,\n portalElement: portalElement ?? portal,\n styles: mergeDeepLeft(floaterStyles, TOOLTIP_STYLES_DEFAULT),\n } as FloaterProps\n\n return (\n <Floater {...tooltipProps}>\n <span>{tooltipProps.children}</span>\n </Floater>\n )\n }\n\n let color = theme.colors['bg-onmain-primary']\n\n if (black) color = theme.colors['bg-onmain-inverse']\n if (contrast) color = theme.colors['bg-brand-primary-basic']\n if (palette?.backgroundColor) color = theme.colors[palette.backgroundColor] ?? palette.backgroundColor\n\n const tooltipProps = {\n ...restProps,\n portalElement: portalElement ?? portal,\n getPopper: (popper, origin) => {\n setPopper(popper)\n if (restProps.getPopper) {\n restProps.getPopper(popper, origin)\n }\n },\n offset: restProps.offset ?? 8,\n styles: mergeDeepLeft(floaterStyles, {\n arrow: {\n color,\n spread: 16,\n length: 8,\n },\n floater: {\n filter: `drop-shadow(0 6px 10px ${theme.colors['bg-oncolor-hover']})`,\n },\n }),\n component: (\n <TooltipWrapper\n ref={ref}\n size={size}\n sizeXXS={sizeXXS}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n sizeUnits={sizeUnits}\n sizes={sizes}\n palette={palette}\n black={black}\n contrast={contrast}\n title={restProps.title}\n titleProps={titleProps}\n content={restProps.content}\n contentProps={contentProps}\n footer={restProps.footer}\n showCloseButton={restProps.showCloseButton}\n closeButtonProps={closeButtonProps}\n closeOnClickOutside={closeOnClickOutside}\n closeOnScroll={closeOnScroll}\n component={restProps.component}\n />\n ),\n } as FloaterProps\n\n return (\n <Floater\n {...tooltipProps}\n modifiers={{\n flip: {\n enabled: !tooltipProps.disableFlip,\n },\n }}\n />\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n ),\n {\n Component: TooltipComponent,\n }\n)\n\nexport { Tooltip }\n\nexport { COMPONENT_NAME }\n"],"names":["Tooltip","Object","assign","withMergedProps","forwardRef","props","ref","preset","size","styles","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizeUnits","sizes","palette","black","contrast","titleProps","contentProps","closeButtonProps","closeOnClickOutside","closeOnScroll","portalElement","zIndex","restProps","theme","useTheme","portal","setPortal","useState","popper","setPopper","floaterStyles","mergeDeepLeft","options","useLayoutEffect","document","body","popperPortal","querySelector","createElement","dataset","style","position","appendChild","useResizeObserver","target","onResize","state","strategy","update","tooltipProps","TOOLTIP_STYLES_DEFAULT","_jsx","Floater","children","jsx","color","colors","backgroundColor","getPopper","origin","offset","arrow","spread","length","floater","filter","component","TooltipWrapper","title","content","footer","showCloseButton","modifiers","flip","enabled","disableFlip","displayName","SIZES","Component","TooltipComponent"],"mappings":"qpBAwBA,MAAMA,QAAkGC,OAAOC,OAC7GC,gBAAAA,gBACEC,MAAAA,YAAW,CAACC,EAAOC,KACjB,MAAMC,OACJA,EAAMC,KACNA,EAAO,IAAGC,OACVA,EAAS,CAAE,EAAAC,QACXA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,UACNA,EAASC,MACTA,EAAKC,QACLA,EAAOC,MACPA,EAAKC,SACLA,EAAQC,WACRA,EAAUC,aACVA,EAAYC,iBACZA,EAAgBC,oBAChBA,EAAmBC,cACnBA,EAAaC,cACbA,EAAaC,OACbA,KACGC,GACDvB,EAEJ,MAAMwB,EAAQC,OAAAA,WAEd,MAAOC,EAAQC,GAAaC,MAAQA,SAAqB,MACzD,MAAOC,EAAQC,GAAaF,MAAQA,SAAwB,MAE5D,MAAMG,SACGT,GAAW,SAAWU,MAAAA,cAAc,CAAEC,QAAS,CAAEX,WAAYlB,GAAUA,EA6BhF,GA3BA8B,MAAAA,iBAAgB,KACd,GAAIb,EACFM,EAAU,WACL,GAAIQ,SAASC,KAAM,CACxB,IAAIC,EAAeF,SAASG,cAA2B,wBAElDD,IACHA,EAAeF,SAASI,cAAc,OACtCF,EAAaG,QAAQH,aAAe,OACpCA,EAAaI,MAAMC,SAAW,WAE9BP,SAASC,KAAKO,YAAYN,IAG5BV,EAAUU,EACZ,IACC,CAAChB,IAEJuB,oCAAkB,CAChBC,OAAQV,SAASC,KACjBU,SAAUA,KACJjB,GAAUA,EAAOkB,MAAMd,QAAQe,WAAa,YAC9CnB,EAAOoB,QACT,KAIC5B,IAAkBK,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JuB,UAAW,CACTC,KAAM,CACJC,SAAUzB,EAAa0B,eAG3B,IAGN,CACEC,YAhKiB,UAiKjBjE,MAAOkE,UAAAA,QAGX,CACEC,UAAWC,iBAAAA,0CArKQ"}
@@ -1,2 +1,2 @@
1
- import{forwardRef}from'react';import{useTheme}from'styled-components';import Floater from'react-floater';import{mergeDeepLeft}from'ramda';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{TooltipWrapper}from'./TooltipWrapper.mjs';import{TOOLTIP_STYLES_DEFAULT}from'./default-constants.mjs';import{jsx}from'react/jsx-runtime';import{TooltipComponent}from'../TooltipComponent/TooltipComponent.mjs';import{SIZES}from'../TooltipComponent/constants.mjs';const COMPONENT_NAME='Tooltip';const Tooltip=Object.assign(withMergedProps(forwardRef(((o,e)=>{const{preset:t,size:s="s",sizeXXS:r,sizeXS:i,sizeS:n,sizeM:l,sizeL:p,sizeXL:c,sizeUnits:m,sizes:a,palette:f,black:d,contrast:T,titleProps:z,contentProps:S,closeButtonProps:b,closeOnClickOutside:g,closeOnScroll:u,...C}=o;const O=useTheme();if(t!=='brand'){const o={...C,styles:mergeDeepLeft(C.styles??{},TOOLTIP_STYLES_DEFAULT)};return jsx(Floater,{...o,children:jsx("span",{children:o.children})})}let h=O.colors['bg-onmain-primary'];d&&(h=O.colors['bg-onmain-inverse']),T&&(h=O.colors['bg-brand-primary-basic']),f?.backgroundColor&&(h=O.colors[f.backgroundColor]??f.backgroundColor);const L={...C,offset:C.offset??8,styles:mergeDeepLeft(C.styles??{},{arrow:{color:h,spread:16,length:8},floater:{filter:`drop-shadow(0 6px 10px ${O.colors['bg-oncolor-hover']})`}}),component:jsx(TooltipWrapper,{ref:e,size:s,sizeXXS:r,sizeXS:i,sizeS:n,sizeM:l,sizeL:p,sizeXL:c,sizeUnits:m,sizes:a,palette:f,black:d,contrast:T,title:C.title,titleProps:z,content:C.content,contentProps:S,footer:C.footer,showCloseButton:C.showCloseButton,closeButtonProps:b,closeOnClickOutside:g,closeOnScroll:u,component:C.component})};return jsx(Floater,{...L,modifiers:{flip:{enabled:!L.disableFlip}}})})),{displayName:"Tooltip",sizes:SIZES}),{Component:TooltipComponent});export{COMPONENT_NAME,Tooltip};
1
+ import{forwardRef,useState,useLayoutEffect}from'react';import{useTheme}from'styled-components';import Floater from'react-floater';import{mergeDeepLeft}from'ramda';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{useResizeObserver}from'../../hooks/useResizeObserver.mjs';import{TooltipWrapper}from'./TooltipWrapper.mjs';import{TOOLTIP_STYLES_DEFAULT}from'./default-constants.mjs';import{jsx}from'react/jsx-runtime';import{TooltipComponent}from'../TooltipComponent/TooltipComponent.mjs';import{SIZES}from'../TooltipComponent/constants.mjs';const COMPONENT_NAME='Tooltip';const Tooltip=Object.assign(withMergedProps(forwardRef(((e,o)=>{const{preset:t,size:r="s",styles:s={},sizeXXS:n,sizeXS:l,sizeS:p,sizeM:i,sizeL:a,sizeXL:m,sizeUnits:c,sizes:d,palette:f,black:u,contrast:z,titleProps:T,contentProps:b,closeButtonProps:g,closeOnClickOutside:S,closeOnScroll:O,portalElement:P,zIndex:h,...y}=e;const C=useTheme();const[E,L]=useState(null);const[j,x]=useState(null);const w=typeof h=='number'?mergeDeepLeft({options:{zIndex:h}},s):s;if(useLayoutEffect((()=>{if(P)L(null);else if(document.body){let e=document.querySelector('[data-popper-portal]');e||(e=document.createElement('div'),e.dataset.popperPortal='true',e.style.position='relative',document.body.appendChild(e)),L(e)}}),[P]),useResizeObserver({target:document.body,onResize:()=>{j&&j.state.options.strategy==='absolute'&&j.update()}}),!P&&!E)return null;if(t!=='brand'){const e={...y,portalElement:P??E,styles:mergeDeepLeft(w,TOOLTIP_STYLES_DEFAULT)};return jsx(Floater,{...e,children:jsx("span",{children:e.children})})}let M=C.colors['bg-onmain-primary'];u&&(M=C.colors['bg-onmain-inverse']),z&&(M=C.colors['bg-brand-primary-basic']),f?.backgroundColor&&(M=C.colors[f.backgroundColor]??f.backgroundColor);const k={...y,portalElement:P??E,getPopper:(e,o)=>{x(e),y.getPopper&&y.getPopper(e,o)},offset:y.offset??8,styles:mergeDeepLeft(w,{arrow:{color:M,spread:16,length:8},floater:{filter:`drop-shadow(0 6px 10px ${C.colors['bg-oncolor-hover']})`}}),component:jsx(TooltipWrapper,{ref:o,size:r,sizeXXS:n,sizeXS:l,sizeS:p,sizeM:i,sizeL:a,sizeXL:m,sizeUnits:c,sizes:d,palette:f,black:u,contrast:z,title:y.title,titleProps:T,content:y.content,contentProps:b,footer:y.footer,showCloseButton:y.showCloseButton,closeButtonProps:g,closeOnClickOutside:S,closeOnScroll:O,component:y.component})};return jsx(Floater,{...k,modifiers:{flip:{enabled:!k.disableFlip}}})})),{displayName:"Tooltip",sizes:SIZES}),{Component:TooltipComponent});export{COMPONENT_NAME,Tooltip};
2
2
  //# sourceMappingURL=Tooltip.mjs.map