@onesy/ui-react 1.0.129 → 1.0.131

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 (445) hide show
  1. package/Accordion/Accordion.js +342 -242
  2. package/Accordion/index.js +12 -7
  3. package/AdvancedTextField/AdvancedTextField.js +165 -157
  4. package/AdvancedTextField/index.js +12 -7
  5. package/Append/Append.js +502 -519
  6. package/Append/index.js +12 -7
  7. package/AreaChart/AreaChart.js +53 -40
  8. package/AreaChart/index.js +12 -7
  9. package/AreaChartItem/AreaChartItem.js +325 -237
  10. package/AreaChartItem/index.js +12 -7
  11. package/AudioPlayer/AudioPlayer.js +683 -466
  12. package/AudioPlayer/index.js +12 -7
  13. package/AudioRecorder/AudioRecorder.js +359 -259
  14. package/AudioRecorder/index.js +12 -7
  15. package/AutoComplete/AutoComplete.js +693 -568
  16. package/AutoComplete/index.js +12 -7
  17. package/AutoCompleteCountry/AutoCompleteCountry.js +99 -62
  18. package/AutoCompleteCountry/index.js +12 -7
  19. package/AutoCompleteCurrency/AutoCompleteCurrency.js +73 -61
  20. package/AutoCompleteCurrency/index.js +12 -7
  21. package/Avatar/Avatar.js +113 -86
  22. package/Avatar/index.js +12 -7
  23. package/AvatarGroup/AvatarGroup.js +104 -87
  24. package/AvatarGroup/index.js +12 -7
  25. package/Backdrop/Backdrop.js +160 -139
  26. package/Backdrop/index.js +12 -7
  27. package/Badge/Badge.js +116 -96
  28. package/Badge/index.js +12 -7
  29. package/Banner/Banner.js +126 -85
  30. package/Banner/index.js +12 -7
  31. package/BottomAppBar/BottomAppBar.js +89 -60
  32. package/BottomAppBar/index.js +12 -7
  33. package/BottomSheet/BottomSheet.js +66 -59
  34. package/BottomSheet/index.js +12 -7
  35. package/Box/Box.js +43 -35
  36. package/Box/index.js +12 -7
  37. package/Breadcrumbs/Breadcrumbs.js +168 -144
  38. package/Breadcrumbs/index.js +12 -7
  39. package/BubbleChart/BubbleChart.js +261 -132
  40. package/BubbleChart/index.js +12 -7
  41. package/BubbleChartItem/BubbleChartItem.js +228 -161
  42. package/BubbleChartItem/index.js +12 -7
  43. package/Button/Button.js +488 -467
  44. package/Button/index.js +12 -7
  45. package/Buttons/Buttons.js +366 -293
  46. package/Buttons/index.js +12 -7
  47. package/Calendar/Calendar.js +715 -452
  48. package/Calendar/index.js +12 -7
  49. package/CalendarAvailability/CalendarAvailability.js +709 -388
  50. package/CalendarAvailability/index.js +12 -7
  51. package/CalendarMenu/CalendarMenu.js +430 -303
  52. package/CalendarMenu/index.js +12 -7
  53. package/CalendarMonth/CalendarMonth.js +537 -498
  54. package/CalendarMonth/index.js +12 -7
  55. package/CalendarViews/CalendarViews.js +403 -254
  56. package/CalendarViews/index.js +12 -7
  57. package/CalendarWeek/CalendarWeek.js +536 -395
  58. package/CalendarWeek/index.js +12 -7
  59. package/Card/Card.js +133 -101
  60. package/Card/index.js +12 -7
  61. package/CardButton/CardButton.js +78 -58
  62. package/CardButton/index.js +12 -7
  63. package/CardFooter/CardFooter.js +58 -39
  64. package/CardFooter/index.js +12 -7
  65. package/CardHeader/CardHeader.js +61 -44
  66. package/CardHeader/index.js +12 -7
  67. package/CardImage/CardImage.js +80 -67
  68. package/CardImage/index.js +12 -7
  69. package/CardMain/CardMain.js +53 -39
  70. package/CardMain/index.js +12 -7
  71. package/Carousel/Carousel.js +1025 -913
  72. package/Carousel/index.js +12 -7
  73. package/Chart/Chart.js +1325 -1174
  74. package/Chart/index.js +12 -7
  75. package/Checkbox/Checkbox.js +339 -325
  76. package/Checkbox/index.js +12 -7
  77. package/Chip/Chip.js +131 -102
  78. package/Chip/index.js +12 -7
  79. package/Chips/Chips.js +121 -94
  80. package/Chips/index.js +12 -7
  81. package/ClickListener/ClickListener.js +86 -89
  82. package/ClickListener/index.js +12 -7
  83. package/Clock/Clock.js +470 -417
  84. package/Clock/index.js +12 -7
  85. package/ColorTextField/ColorTextField.js +234 -171
  86. package/ColorTextField/index.js +12 -7
  87. package/ColumnChart/ColumnChart.js +63 -46
  88. package/ColumnChart/index.js +12 -7
  89. package/ColumnChartItem/ColumnChartItem.js +208 -149
  90. package/ColumnChartItem/index.js +12 -7
  91. package/Confirm/Confirm.js +184 -129
  92. package/Confirm/Context.js +9 -7
  93. package/Confirm/index.js +32 -13
  94. package/Confirm/useConfirm.js +11 -10
  95. package/Container/Container.js +154 -133
  96. package/Container/index.js +12 -7
  97. package/CookieBanner/CookieBanner.js +142 -76
  98. package/CookieBanner/index.js +12 -7
  99. package/Countdown/Countdown.js +403 -255
  100. package/Countdown/index.js +12 -7
  101. package/DatePicker/DatePicker.js +802 -547
  102. package/DatePicker/index.js +12 -7
  103. package/DateRangePicker/DateRangePicker.js +44 -37
  104. package/DateRangePicker/index.js +12 -7
  105. package/DateTimePicker/DateTimePicker.js +672 -459
  106. package/DateTimePicker/index.js +12 -7
  107. package/DateTimeRangePicker/DateTimeRangePicker.js +44 -37
  108. package/DateTimeRangePicker/index.js +12 -7
  109. package/Divider/Divider.js +198 -185
  110. package/Divider/index.js +12 -7
  111. package/DonutChart/DonutChart.js +49 -42
  112. package/DonutChart/index.js +12 -7
  113. package/DragAndDropList/DragAndDropList.js +160 -156
  114. package/DragAndDropList/index.js +12 -7
  115. package/Drawing/Drawing.js +850 -523
  116. package/Drawing/index.js +12 -7
  117. package/DropZone/DropZone.js +239 -201
  118. package/DropZone/index.js +12 -7
  119. package/Emojis/Emojis.js +409 -317
  120. package/Emojis/emojis_list.js +7279 -9250
  121. package/Emojis/index.js +19 -9
  122. package/Expand/Expand.js +201 -149
  123. package/Expand/index.js +12 -7
  124. package/Fab/Fab.js +46 -26
  125. package/Fab/index.js +12 -7
  126. package/Fade/Fade.js +131 -101
  127. package/Fade/index.js +12 -7
  128. package/FileChoose/FileChoose.js +218 -150
  129. package/FileChoose/index.js +12 -7
  130. package/Focus/Focus.js +87 -88
  131. package/Focus/index.js +12 -7
  132. package/Form/Form.js +194 -120
  133. package/Form/index.js +12 -7
  134. package/FormRow/FormRow.js +123 -78
  135. package/FormRow/index.js +12 -7
  136. package/Forms/Forms.js +55 -41
  137. package/Forms/index.js +12 -7
  138. package/Frame/Frame.js +212 -150
  139. package/Frame/index.js +12 -7
  140. package/Grid/Grid.js +231 -166
  141. package/Grid/index.js +12 -7
  142. package/Grow/Grow.js +137 -109
  143. package/Grow/index.js +12 -7
  144. package/HTMLCanvas/HTMLCanvas.js +752 -542
  145. package/HTMLCanvas/index.js +24 -21
  146. package/IFrame/IFrame.js +122 -104
  147. package/IFrame/index.js +12 -7
  148. package/Icon/Icon.js +112 -95
  149. package/Icon/index.js +24 -21
  150. package/IconButton/IconButton.js +49 -37
  151. package/IconButton/index.js +12 -7
  152. package/Image/Image.js +285 -252
  153. package/Image/index.js +12 -7
  154. package/ImageCrop/ImageCrop.js +1073 -1048
  155. package/ImageCrop/index.js +12 -7
  156. package/ImageEdit/ImageEdit.js +1088 -783
  157. package/ImageEdit/index.js +12 -7
  158. package/ImageGallery/ImageGallery.js +518 -473
  159. package/ImageGallery/index.js +12 -7
  160. package/ImageList/ImageList.js +136 -129
  161. package/ImageList/index.js +12 -7
  162. package/ImageListItem/ImageListItem.js +101 -87
  163. package/ImageListItem/index.js +12 -7
  164. package/ImageListItemBox/ImageListItemBox.js +61 -50
  165. package/ImageListItemBox/index.js +12 -7
  166. package/Info/Info.js +99 -63
  167. package/Info/index.js +12 -7
  168. package/Interaction/Interaction.js +405 -345
  169. package/Interaction/index.js +12 -7
  170. package/Keyframes/Context.js +9 -7
  171. package/Keyframes/Keyframes.js +189 -174
  172. package/Keyframes/index.js +42 -25
  173. package/Keyframes/useKeyframes.js +11 -10
  174. package/Label/Label.js +177 -151
  175. package/Label/index.js +12 -7
  176. package/Labels/Labels.js +126 -98
  177. package/Labels/index.js +12 -7
  178. package/Line/Line.js +296 -174
  179. package/Line/index.js +12 -7
  180. package/LineChart/LineChart.js +57 -40
  181. package/LineChart/index.js +12 -7
  182. package/LineChartItem/LineChartItem.js +239 -177
  183. package/LineChartItem/index.js +12 -7
  184. package/LinearMeter/LinearMeter.js +453 -377
  185. package/LinearMeter/index.js +12 -7
  186. package/LinearProgress/LinearProgress.js +324 -255
  187. package/LinearProgress/index.js +12 -7
  188. package/Link/Link.js +182 -127
  189. package/Link/index.js +12 -7
  190. package/Links/Links.js +277 -156
  191. package/Links/index.js +12 -7
  192. package/List/List.js +148 -113
  193. package/List/index.js +12 -7
  194. package/ListItem/ListItem.js +388 -362
  195. package/ListItem/index.js +12 -7
  196. package/ListSubheader/ListSubheader.js +52 -44
  197. package/ListSubheader/index.js +12 -7
  198. package/MainProgress/Context.js +9 -7
  199. package/MainProgress/MainProgress.js +193 -161
  200. package/MainProgress/index.js +32 -13
  201. package/MainProgress/useMainProgress.js +11 -10
  202. package/Markdown/Markdown.js +676 -704
  203. package/Markdown/index.js +12 -7
  204. package/Masonry/Masonry.js +207 -181
  205. package/Masonry/index.js +12 -7
  206. package/Medias/Medias.js +436 -398
  207. package/Medias/index.js +12 -7
  208. package/Menu/Menu.js +278 -243
  209. package/Menu/index.js +12 -7
  210. package/MenuDesktop/MenuDesktop.js +496 -419
  211. package/MenuDesktop/index.js +12 -7
  212. package/MenuItem/MenuItem.js +286 -231
  213. package/MenuItem/index.js +12 -7
  214. package/Meta/Meta.js +78 -54
  215. package/Meta/index.js +12 -7
  216. package/Modal/Modal.js +333 -272
  217. package/Modal/index.js +12 -7
  218. package/ModalFooter/ModalFooter.js +50 -39
  219. package/ModalFooter/index.js +12 -7
  220. package/ModalHeader/ModalHeader.js +51 -39
  221. package/ModalHeader/index.js +12 -7
  222. package/ModalIcon/ModalIcon.js +29 -23
  223. package/ModalIcon/index.js +12 -7
  224. package/ModalMain/ModalMain.js +50 -41
  225. package/ModalMain/index.js +12 -7
  226. package/ModalText/ModalText.js +47 -37
  227. package/ModalText/index.js +12 -7
  228. package/ModalTitle/ModalTitle.js +47 -37
  229. package/ModalTitle/index.js +12 -7
  230. package/MoreOptions/MoreOptions.js +72 -52
  231. package/MoreOptions/index.js +12 -7
  232. package/Move/Move.js +166 -141
  233. package/Move/index.js +12 -7
  234. package/NavigationBar/NavigationBar.js +133 -109
  235. package/NavigationBar/index.js +12 -7
  236. package/NavigationDrawer/NavigationDrawer.js +241 -211
  237. package/NavigationDrawer/index.js +12 -7
  238. package/NavigationItem/NavigationItem.js +293 -262
  239. package/NavigationItem/index.js +12 -7
  240. package/NavigationRail/NavigationRail.js +187 -150
  241. package/NavigationRail/index.js +12 -7
  242. package/NotFound/NotFound.js +89 -66
  243. package/NotFound/index.js +12 -7
  244. package/NumericTextField/NumericTextField.js +217 -212
  245. package/NumericTextField/index.js +12 -7
  246. package/Page/Page.js +131 -67
  247. package/Page/index.js +12 -7
  248. package/PageTransition/PageTransition.js +112 -102
  249. package/PageTransition/index.js +12 -7
  250. package/Pagination/Pagination.js +153 -98
  251. package/Pagination/index.js +12 -7
  252. package/PaginationItem/PaginationItem.js +85 -65
  253. package/PaginationItem/index.js +12 -7
  254. package/Parallax/Parallax.js +138 -145
  255. package/Parallax/index.js +12 -7
  256. package/Path/Path.js +40 -35
  257. package/Path/index.js +12 -7
  258. package/PieChart/PieChart.js +382 -267
  259. package/PieChart/index.js +12 -7
  260. package/Placeholder/Placeholder.js +125 -117
  261. package/Placeholder/index.js +12 -7
  262. package/Portal/Portal.js +37 -38
  263. package/Portal/index.js +12 -7
  264. package/Properties/Properties.js +85 -64
  265. package/Properties/index.js +12 -7
  266. package/Property/Property.js +120 -108
  267. package/Property/index.js +12 -7
  268. package/Radio/Radio.js +211 -181
  269. package/Radio/index.js +12 -7
  270. package/Radios/Radios.js +124 -92
  271. package/Radios/index.js +12 -7
  272. package/Rating/Rating.js +353 -360
  273. package/Rating/index.js +12 -7
  274. package/Reset/Reset.js +19 -24
  275. package/Reset/index.js +12 -7
  276. package/Reveal/Reveal.js +98 -89
  277. package/Reveal/index.js +12 -7
  278. package/RichTextEditor/RichTextEditor.js +1764 -972
  279. package/RichTextEditor/index.js +12 -7
  280. package/RoundMeter/RoundMeter.js +629 -537
  281. package/RoundMeter/index.js +12 -7
  282. package/RoundProgress/RoundProgress.js +233 -174
  283. package/RoundProgress/index.js +12 -7
  284. package/ScatterChart/ScatterChart.js +53 -40
  285. package/ScatterChart/index.js +12 -7
  286. package/ScatterChartItem/ScatterChartItem.js +214 -153
  287. package/ScatterChartItem/index.js +12 -7
  288. package/ScreenCapture/ScreenCapture.js +427 -335
  289. package/ScreenCapture/index.js +12 -7
  290. package/Section/Section.js +380 -319
  291. package/Section/index.js +12 -7
  292. package/SectionAction/SectionAction.js +72 -61
  293. package/SectionAction/index.js +12 -7
  294. package/SectionBoxes/SectionBoxes.js +240 -208
  295. package/SectionBoxes/index.js +12 -7
  296. package/SectionCards/SectionCards.js +256 -217
  297. package/SectionCards/index.js +12 -7
  298. package/SectionCarousel/SectionCarousel.js +284 -242
  299. package/SectionCarousel/index.js +12 -7
  300. package/SectionContact/SectionContact.js +174 -116
  301. package/SectionContact/index.js +12 -7
  302. package/SectionImageGallery/SectionImageGallery.js +64 -51
  303. package/SectionImageGallery/index.js +12 -7
  304. package/SectionLogos/SectionLogos.js +123 -109
  305. package/SectionLogos/index.js +12 -7
  306. package/SectionMedia/SectionMedia.js +170 -152
  307. package/SectionMedia/index.js +12 -7
  308. package/SectionReviews/SectionReviews.js +170 -129
  309. package/SectionReviews/index.js +12 -7
  310. package/SectionTextMedia/SectionTextMedia.js +187 -142
  311. package/SectionTextMedia/index.js +12 -7
  312. package/SectionTimeline/SectionTimeline.js +126 -95
  313. package/SectionTimeline/index.js +12 -7
  314. package/SectionWatch/SectionWatch.js +65 -53
  315. package/SectionWatch/index.js +12 -7
  316. package/Select/Select.js +517 -406
  317. package/Select/index.js +12 -7
  318. package/Share/Share.js +458 -319
  319. package/Share/index.js +12 -7
  320. package/Slide/Slide.js +184 -140
  321. package/Slide/index.js +12 -7
  322. package/Slider/Slider.js +927 -837
  323. package/Slider/index.js +12 -7
  324. package/SmartTextField/SmartTextField.js +1406 -1014
  325. package/SmartTextField/index.js +12 -7
  326. package/Snackbar/Snackbar.js +227 -185
  327. package/Snackbar/index.js +12 -7
  328. package/Snackbars/Context.js +9 -7
  329. package/Snackbars/Snackbars.js +234 -210
  330. package/Snackbars/index.js +32 -13
  331. package/Snackbars/useSnackbars.js +11 -10
  332. package/Space/Space.js +1683 -968
  333. package/Space/index.js +24 -21
  334. package/SpeechToText/SpeechToText.js +207 -172
  335. package/SpeechToText/index.js +12 -7
  336. package/SpeedDial/SpeedDial.js +434 -398
  337. package/SpeedDial/index.js +12 -7
  338. package/SpeedDialItem/SpeedDialItem.js +89 -63
  339. package/SpeedDialItem/index.js +12 -7
  340. package/SpyScroll/SpyScroll.js +154 -142
  341. package/SpyScroll/index.js +12 -7
  342. package/Step/Step.js +181 -127
  343. package/Step/index.js +12 -7
  344. package/Stepper/Stepper.js +159 -139
  345. package/Stepper/index.js +12 -7
  346. package/Surface/Surface.js +760 -798
  347. package/Surface/index.js +12 -7
  348. package/Switch/Switch.js +688 -532
  349. package/Switch/index.js +12 -7
  350. package/Tab/Tab.js +185 -150
  351. package/Tab/index.js +12 -7
  352. package/Table/Table.js +100 -77
  353. package/Table/index.js +12 -7
  354. package/TableBody/TableBody.js +76 -63
  355. package/TableBody/index.js +12 -7
  356. package/TableCell/TableCell.js +258 -220
  357. package/TableCell/index.js +12 -7
  358. package/TableFooter/TableFooter.js +60 -48
  359. package/TableFooter/index.js +12 -7
  360. package/TableHead/TableHead.js +139 -120
  361. package/TableHead/index.js +12 -7
  362. package/TableHeader/TableHeader.js +65 -50
  363. package/TableHeader/index.js +12 -7
  364. package/TablePagination/TablePagination.js +171 -98
  365. package/TablePagination/index.js +12 -7
  366. package/TableRow/TableRow.js +77 -64
  367. package/TableRow/index.js +12 -7
  368. package/Tabs/Tabs.js +425 -377
  369. package/Tabs/index.js +12 -7
  370. package/Text/Text.js +131 -113
  371. package/Text/index.js +12 -7
  372. package/TextField/TextField.js +940 -879
  373. package/TextField/index.js +12 -7
  374. package/TextToSpeech/TextToSpeech.js +176 -153
  375. package/TextToSpeech/index.js +12 -7
  376. package/TimePicker/TimePicker.js +985 -718
  377. package/TimePicker/index.js +12 -7
  378. package/TimeRangePicker/TimeRangePicker.js +44 -37
  379. package/TimeRangePicker/index.js +12 -7
  380. package/Timeline/Timeline.js +54 -42
  381. package/Timeline/index.js +12 -7
  382. package/TimelineItem/TimelineItem.js +144 -147
  383. package/TimelineItem/index.js +12 -7
  384. package/Timer/Timer.js +321 -204
  385. package/Timer/index.js +12 -7
  386. package/ToggleButton/ToggleButton.js +67 -58
  387. package/ToggleButton/index.js +12 -7
  388. package/ToggleButtons/ToggleButtons.js +46 -37
  389. package/ToggleButtons/index.js +12 -7
  390. package/Tooltip/Tooltip.js +489 -454
  391. package/Tooltip/index.js +12 -7
  392. package/TopAppBar/TopAppBar.js +237 -197
  393. package/TopAppBar/index.js +12 -7
  394. package/Transition/Context.js +9 -7
  395. package/Transition/Transition.js +321 -339
  396. package/Transition/index.js +42 -25
  397. package/Transition/useTransition.js +11 -10
  398. package/Transitions/Transitions.js +215 -179
  399. package/Transitions/index.js +12 -7
  400. package/Tree/Tree.js +375 -312
  401. package/Tree/index.js +12 -7
  402. package/Type/Type.js +251 -152
  403. package/Type/index.js +12 -7
  404. package/VideoPlayer/VideoPlayer.js +866 -656
  405. package/VideoPlayer/index.js +12 -7
  406. package/ViewSplit/ViewSplit.js +413 -387
  407. package/ViewSplit/index.js +12 -7
  408. package/Watch/Watch.js +436 -290
  409. package/Watch/index.js +12 -7
  410. package/Weather/Weather.js +294 -247
  411. package/Weather/index.js +12 -7
  412. package/Whiteboard/Whiteboard.js +1392 -1292
  413. package/Whiteboard/index.js +12 -7
  414. package/Widgets/Context.js +9 -7
  415. package/Widgets/Widgets.js +220 -168
  416. package/Widgets/index.js +32 -13
  417. package/Widgets/useWidgets.js +11 -10
  418. package/WindowSplit/WindowSplit.js +381 -336
  419. package/WindowSplit/index.js +12 -7
  420. package/Zoom/Zoom.js +126 -99
  421. package/Zoom/index.js +12 -7
  422. package/esm/BottomAppBar/BottomAppBar.js +5 -4
  423. package/esm/Buttons/Buttons.js +1 -1
  424. package/esm/index.js +1 -1
  425. package/index.js +4053 -660
  426. package/package.json +1 -1
  427. package/types.js +4 -1
  428. package/useForm/index.js +25 -11
  429. package/useForm/useForm.js +203 -174
  430. package/useForm/validate.js +215 -203
  431. package/useLocation/index.js +12 -7
  432. package/useLocation/useLocation.js +54 -49
  433. package/useMediaQuery/index.js +12 -7
  434. package/useMediaQuery/useMediaQuery.js +44 -43
  435. package/useQuery/index.js +12 -7
  436. package/useQuery/useQuery.js +14 -10
  437. package/useScroll/index.js +12 -7
  438. package/useScroll/useScroll.js +61 -56
  439. package/useSubscription/index.js +12 -7
  440. package/useSubscription/useSubscription.js +35 -35
  441. package/useSwipe/index.js +12 -7
  442. package/useSwipe/useSwipe.js +157 -131
  443. package/useVisible/index.js +12 -7
  444. package/useVisible/useVisible.js +86 -76
  445. package/utils.js +1224 -1362
@@ -1,900 +1,961 @@
1
1
  "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+ var _react = _interopRequireDefault(require("react"));
12
+ var _utils = require("@onesy/utils");
13
+ var _styleReact = require("@onesy/style-react");
14
+ var _IconMaterialPassword2W = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialPassword2W100"));
15
+ var _IconMaterialPassword2OffW = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialPassword2OffW100"));
16
+ var _IconMaterialCloseW = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialCloseW100"));
17
+ var _Tooltip = _interopRequireDefault(require("../Tooltip"));
18
+ var _IconButton = _interopRequireDefault(require("../IconButton"));
19
+ var _Type = _interopRequireDefault(require("../Type"));
20
+ var _Line = _interopRequireDefault(require("../Line"));
21
+ var _useMediaQuery = _interopRequireDefault(require("../useMediaQuery"));
22
+ var _utils2 = require("../utils");
23
+ const _excluded = ["tonal", "color", "version", "size", "rootRef", "valueDefault", "value", "onChange", "name", "label", "align", "start", "startVerticalAlign", "end", "endVerticalAlign", "placeholder", "fullWidth", "helperText", "counter", "prefix", "sufix", "noPrefixMargin", "noSufixMargin", "enabled", "autoFocus", "autoComplete", "type", "required", "optional", "optionalText", "error", "multiline", "rows", "minRows", "maxRows", "clear", "focus", "footer", "subscription", "controlled", "minimal", "restoreSelection", "minWidth", "readOnly", "disabled", "onInput", "onFocus", "onBlur", "onMouseEnter", "onMouseLeave", "inputProps", "InputWrapperProps", "HelperTextProps", "IconProps", "IconClear", "InputComponent", "WrapperComponent", "Component", "className", "style", "children", "colorUnchecked"];
24
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
25
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
26
+ const useStyle = (0, _styleReact.style)(theme => {
27
+ const other = {
28
+ pointerEvents: 'none',
29
+ borderRadius: 'inherit',
30
+ boxSizing: 'border-box',
31
+ position: 'absolute',
32
+ inset: '0',
33
+ width: '100%',
34
+ height: '100%'
35
+ };
36
+ const overflow = {
37
+ width: '100%',
38
+ overflow: 'hidden',
39
+ whiteSpace: 'nowrap',
40
+ textOverflow: 'ellipsis'
41
+ };
42
+ return {
43
+ wrapper: {
44
+ position: 'relative',
45
+ display: 'inline-flex',
46
+ flexDirection: 'column'
47
+ },
48
+ root: {
49
+ display: 'inline-flex',
50
+ alignItems: 'center',
51
+ position: 'relative',
52
+ borderRadius: `${theme.shape.radius.unit}px ${theme.shape.radius.unit}px 0 0`,
53
+ '& > *': {
54
+ '&::-webkit-scrollbar': {
55
+ width: '0px',
56
+ height: '0px'
10
57
  }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- const jsx_runtime_1 = require("react/jsx-runtime");
18
- const react_1 = __importDefault(require("react"));
19
- const utils_1 = require("@onesy/utils");
20
- const style_react_1 = require("@onesy/style-react");
21
- const IconMaterialPassword2W100_1 = __importDefault(require("@onesy/icons-material-rounded-react/IconMaterialPassword2W100"));
22
- const IconMaterialPassword2OffW100_1 = __importDefault(require("@onesy/icons-material-rounded-react/IconMaterialPassword2OffW100"));
23
- const IconMaterialCloseW100_1 = __importDefault(require("@onesy/icons-material-rounded-react/IconMaterialCloseW100"));
24
- const Tooltip_1 = __importDefault(require("../Tooltip"));
25
- const IconButton_1 = __importDefault(require("../IconButton"));
26
- const Type_1 = __importDefault(require("../Type"));
27
- const Line_1 = __importDefault(require("../Line"));
28
- const useMediaQuery_1 = __importDefault(require("../useMediaQuery"));
29
- const utils_2 = require("../utils");
30
- const useStyle = (0, style_react_1.style)(theme => {
31
- const other = {
32
- pointerEvents: 'none',
33
- borderRadius: 'inherit',
34
- boxSizing: 'border-box',
35
- position: 'absolute',
36
- inset: '0',
37
- width: '100%',
38
- height: '100%'
39
- };
40
- const overflow = {
41
- width: '100%',
42
- overflow: 'hidden',
43
- whiteSpace: 'nowrap',
44
- textOverflow: 'ellipsis'
45
- };
58
+ }
59
+ },
60
+ // Color
61
+ color_default: {
62
+ color: theme.palette.text.default.primary
63
+ },
64
+ color_neutral: {
65
+ color: theme.palette.color.neutral.main
66
+ },
67
+ color_primary: {
68
+ color: theme.palette.color.primary.main
69
+ },
70
+ color_secondary: {
71
+ color: theme.palette.color.secondary.main
72
+ },
73
+ color_tertiary: {
74
+ color: theme.palette.color.tertiary.main
75
+ },
76
+ color_quaternary: {
77
+ color: theme.palette.color.quaternary.main
78
+ },
79
+ color_info: {
80
+ color: theme.palette.color.info.main
81
+ },
82
+ color_success: {
83
+ color: theme.palette.color.success.main
84
+ },
85
+ color_warning: {
86
+ color: theme.palette.color.warning.main
87
+ },
88
+ color_error: {
89
+ color: theme.palette.color.error.main
90
+ },
91
+ error_color: {
92
+ color: [theme.palette.light ? theme.palette.color.error[40] : theme.palette.color.error[80], '!important']
93
+ },
94
+ error_hover_color: {
95
+ color: [theme.palette.light ? theme.palette.color.error[20] : theme.palette.color.error[90], '!important']
96
+ },
97
+ inputWrapper: _objectSpread({
98
+ // Reset
99
+ margin: '0',
100
+ border: '0',
101
+ fontFamily: 'inherit',
102
+ fontSize: '100%',
103
+ lineHeight: '1.15',
104
+ overflow: 'visible',
105
+ boxSizing: 'border-box',
106
+ display: 'flex',
107
+ flexDirection: 'row',
108
+ flexWrap: 'wrap',
109
+ alignItems: 'center',
110
+ opacity: '0',
111
+ transition: theme.methods.transitions.make('opacity'),
112
+ borderRadius: `${theme.shape.radius.unit}px ${theme.shape.radius.unit}px 0 0`,
113
+ cursor: 'text',
114
+ zIndex: '1',
115
+ flex: '1 1 auto'
116
+ }, theme.typography.values.b2),
117
+ inputWrapper_focus: {
118
+ opacity: '1'
119
+ },
120
+ input: _objectSpread(_objectSpread({
121
+ // Reset
122
+ margin: '0',
123
+ border: '0',
124
+ outline: 'none',
125
+ color: theme.palette.text.default.primary,
126
+ background: 'transparent',
127
+ '-webkit-tap-highlight-color': 'transparent',
128
+ textAlign: 'start'
129
+ }, theme.typography.values.b2), overflow),
130
+ multiline: {
131
+ resize: 'none',
132
+ overflow: 'auto',
133
+ whiteSpace: 'normal'
134
+ },
135
+ input_size_small: {
136
+ // height: '48px',
137
+ padding: `${theme.methods.space.value(1, 'px')} ${theme.methods.space.value(2, 'px')}`,
138
+ paddingTop: theme.methods.space.value(2.5, 'px')
139
+ },
140
+ input_size_regular: {
141
+ // height: '56px',
142
+ padding: `11px ${theme.methods.space.value(2, 'px')}`,
143
+ paddingTop: theme.methods.space.value(3, 'px')
144
+ },
145
+ input_size_large: {
146
+ // height: '64px',
147
+ padding: theme.methods.space.value(2, 'px'),
148
+ paddingTop: theme.methods.space.value(3.5, 'px')
149
+ },
150
+ inputWrapper_without_label_size_small: {
151
+ paddingTop: `${theme.methods.space.value(1, 'px')}`
152
+ },
153
+ inputWrapper_without_label_size_regular: {
154
+ paddingTop: `${theme.methods.space.value(2, 'px')}`
155
+ },
156
+ inputWrapper_without_label_size_large: {
157
+ paddingTop: `${theme.methods.space.value(2, 'px')}`
158
+ },
159
+ input_version_text: {
160
+ '&:not($input_start_icon)': {
161
+ paddingInline: '0'
162
+ }
163
+ },
164
+ input_start_icon: {
165
+ paddingInlineStart: '0'
166
+ },
167
+ input_end_icon: {
168
+ paddingInlineEnd: '0'
169
+ },
170
+ input_version_outlined_size_small: {
171
+ paddingTop: theme.methods.space.value(1.75, 'px'),
172
+ paddingBottom: theme.methods.space.value(1.75, 'px')
173
+ },
174
+ input_version_outlined_size_regular: {
175
+ paddingTop: theme.methods.space.value(2.25, 'px'),
176
+ paddingBottom: theme.methods.space.value(2.25, 'px')
177
+ },
178
+ input_version_outlined_size_large: {
179
+ paddingTop: theme.methods.space.value(2.75, 'px'),
180
+ paddingBottom: theme.methods.space.value(2.75, 'px')
181
+ },
182
+ input_align_start: {
183
+ textAlign: 'start'
184
+ },
185
+ input_align_center: {
186
+ textAlign: 'center'
187
+ },
188
+ input_align_end: {
189
+ textAlign: 'end'
190
+ },
191
+ label: _objectSpread(_objectSpread({
192
+ position: 'absolute',
193
+ insetInlineStart: '16px',
194
+ transformOrigin: 'top left',
195
+ transition: theme.methods.transitions.make(['color', 'inset', 'margin', 'transform']),
196
+ pointerEvents: 'none',
197
+ userSelect: 'none',
198
+ zIndex: '1'
199
+ }, overflow), {}, {
200
+ width: 'auto'
201
+ }),
202
+ label_regular: {
203
+ top: '50%',
204
+ transform: 'translate(0px, -50%) scale(1)'
205
+ },
206
+ label_multiline: {
207
+ top: '0px'
208
+ },
209
+ label_rtl: {
210
+ transformOrigin: 'top right'
211
+ },
212
+ label_version_text: {
213
+ insetInlineStart: '0px'
214
+ },
215
+ label_icon_start: {
216
+ insetInlineStart: theme.methods.space.value(6.5, 'px')
217
+ },
218
+ label_size_small_multiline: {
219
+ transform: 'translate(4px, 14px) scale(1)'
220
+ },
221
+ label_size_regular_multiline: {
222
+ transform: 'translate(4px, 18px) scale(1)'
223
+ },
224
+ label_size_large_multiline: {
225
+ transform: 'translate(4px, 22px) scale(1)'
226
+ },
227
+ // Focus
228
+ label_version_text_focus: {
229
+ top: '0px',
230
+ insetInlineStart: '0px',
231
+ transform: 'translate(0, 6px) scale(0.667)'
232
+ },
233
+ label_version_outlined_focus: {
234
+ top: '0px',
235
+ insetInlineStart: '15px',
236
+ marginInlineStart: '4px',
237
+ transform: 'translate(0, -6px) scale(0.667)'
238
+ },
239
+ label_version_filled_focus: {
240
+ top: '0px',
241
+ insetInlineStart: '15px',
242
+ transform: 'translate(0, 6px) scale(0.667)'
243
+ },
244
+ background: _objectSpread(_objectSpread({}, other), {}, {
245
+ background: 'currentColor',
246
+ borderRadius: `${theme.shape.radius.unit}px ${theme.shape.radius.unit}px 0 0`,
247
+ opacity: theme.palette.light ? theme.palette.visual_contrast.default.opacity.hover : theme.palette.visual_contrast.default.opacity.selected,
248
+ zIndex: '0',
249
+ transition: theme.methods.transitions.make(['opacity'])
250
+ }),
251
+ background_hover: {
252
+ opacity: theme.palette.visual_contrast.default.opacity.focus
253
+ },
254
+ background_focus: {
255
+ opacity: theme.palette.light ? theme.palette.visual_contrast.default.opacity.hover : theme.palette.visual_contrast.default.opacity.selected
256
+ },
257
+ border: _objectSpread(_objectSpread({}, other), {}, {
258
+ borderRadius: `${theme.shape.radius.unit}px ${theme.shape.radius.unit}px 0 0`,
259
+ boxShadow: 'inset 0px -1px 0px 0px currentColor',
260
+ zIndex: '1',
261
+ transition: theme.methods.transitions.make(['box-shadow'])
262
+ }),
263
+ border_focus: {
264
+ boxShadow: 'inset 0px -2px 0px 0px currentColor'
265
+ },
266
+ fieldset: _objectSpread(_objectSpread({}, other), {}, {
267
+ top: '-5px',
268
+ height: 'calc(100% + 5px)',
269
+ borderRadius: `${theme.shape.radius.unit}px`,
270
+ border: '1px solid currentColor',
271
+ padding: '0',
272
+ paddingInline: `${theme.methods.space.value(1.5, 'px')} ${theme.methods.space.value(2, 'px')}`,
273
+ transition: theme.methods.transitions.make(['border', 'padding'])
274
+ }),
275
+ fieldset_focus: {
276
+ borderWidth: '2px',
277
+ paddingInline: `${theme.methods.space.value(1.5, 'px')} ${theme.methods.space.value(2, 'px')}`
278
+ },
279
+ legend: _objectSpread(_objectSpread({
280
+ display: 'inline-flex',
281
+ height: '11px',
282
+ width: 'auto',
283
+ padding: '0px',
284
+ maxWidth: '0.001px',
285
+ whiteSpace: 'nowrap',
286
+ visibility: 'hidden',
287
+ overflow: 'hidden',
288
+ transition: theme.methods.transitions.make(['max-width', 'padding'], {
289
+ duration: 'xxs'
290
+ })
291
+ }, theme.typography.values.b2), {}, {
292
+ fontSize: '0.64rem',
293
+ letterSpacing: 'normal'
294
+ }),
295
+ legend_focus: {
296
+ maxWidth: '100%',
297
+ padding: `0 ${theme.methods.space.value(0.5, 'px')}`,
298
+ transition: theme.methods.transitions.make(['max-width', 'padding'], {
299
+ duration: 'xs'
300
+ })
301
+ },
302
+ footer: {
303
+ marginTop: '4px',
304
+ paddingInline: theme.methods.space.value(2, 'px')
305
+ },
306
+ footer_version_text: {
307
+ paddingInline: '0'
308
+ },
309
+ helperText: {
310
+ display: 'inline-flex',
311
+ color: theme.palette.text.default.secondary,
312
+ userSelect: 'none'
313
+ },
314
+ counterText: {
315
+ display: 'inline-flex',
316
+ justifyContent: 'flex-end',
317
+ color: theme.palette.text.default.secondary,
318
+ userSelect: 'none',
319
+ flex: '1 0 auto'
320
+ },
321
+ // Start and end icon
322
+ icon: {
323
+ display: 'inline-flex',
324
+ alignItems: 'center',
325
+ flex: '0 0 auto'
326
+ },
327
+ icon_size_small: {
328
+ paddingBlock: '12px'
329
+ },
330
+ icon_size_regular: {
331
+ paddingBlock: '16px'
332
+ },
333
+ icon_size_large: {
334
+ paddingBlock: '24px'
335
+ },
336
+ icon_version_text_size_small: {
337
+ paddingBlock: '6px'
338
+ },
339
+ icon_version_text_size_regular: {
340
+ paddingBlock: '8px'
341
+ },
342
+ icon_version_text_size_large: {
343
+ paddingBlock: '12px'
344
+ },
345
+ icon_version_outlined_size_small: {
346
+ paddingBlock: '9px'
347
+ },
348
+ icon_version_outlined_size_regular: {
349
+ paddingBlock: '12px'
350
+ },
351
+ icon_version_outlined_size_large: {
352
+ paddingBlock: '17px'
353
+ },
354
+ icon_version_filled_size_small: {
355
+ paddingBlock: '9px'
356
+ },
357
+ icon_version_filled_size_regular: {
358
+ paddingBlock: '12px'
359
+ },
360
+ icon_version_filled_size_large: {
361
+ paddingBlock: '17px'
362
+ },
363
+ icon_button_size_small: {
364
+ paddingBlock: '4px'
365
+ },
366
+ icon_button_size_regular: {
367
+ paddingBlock: '8px'
368
+ },
369
+ icon_button_size_large: {
370
+ paddingBlock: '12px'
371
+ },
372
+ icon_start: {
373
+ maxWidth: '40%',
374
+ overflow: 'auto hidden',
375
+ paddingInlineEnd: '16px',
376
+ paddingInlineStart: '12px'
377
+ },
378
+ icon_vertical_align_start: {
379
+ alignSelf: 'flex-start'
380
+ },
381
+ icon_vertical_align_center: {
382
+ alignSelf: 'center',
383
+ paddingBlock: '0px !important'
384
+ },
385
+ icon_vertical_align_end: {
386
+ alignSelf: 'flex-end'
387
+ },
388
+ icon_end: {
389
+ maxWidth: '40%',
390
+ overflow: 'auto hidden',
391
+ paddingInlineStart: theme.methods.space.value(2, 'px'),
392
+ paddingInlineEnd: theme.methods.space.value(1.5, 'px')
393
+ },
394
+ addition: {
395
+ color: theme.palette.text.default.secondary
396
+ },
397
+ addition_size_small: {
398
+ paddingBottom: theme.methods.space.value(1, 'px'),
399
+ paddingTop: theme.methods.space.value(2.5, 'px')
400
+ },
401
+ addition_size_regular: {
402
+ paddingBottom: theme.methods.space.value(2, 'px'),
403
+ paddingTop: theme.methods.space.value(3, 'px')
404
+ },
405
+ addition_size_large: {
406
+ paddingBottom: theme.methods.space.value(2, 'px'),
407
+ paddingTop: theme.methods.space.value(3.5, 'px')
408
+ },
409
+ addition_version_outlined_size_small: {
410
+ paddingTop: theme.methods.space.value(1.75, 'px'),
411
+ paddingBottom: theme.methods.space.value(1.75, 'px')
412
+ },
413
+ addition_version_outlined_size_regular: {
414
+ paddingTop: theme.methods.space.value(2.25, 'px'),
415
+ paddingBottom: theme.methods.space.value(2.25, 'px')
416
+ },
417
+ addition_version_outlined_size_large: {
418
+ paddingTop: theme.methods.space.value(2.75, 'px'),
419
+ paddingBottom: theme.methods.space.value(2.75, 'px')
420
+ },
421
+ addition_without_label_size_small: {
422
+ paddingTop: `${theme.methods.space.value(1, 'px')}`
423
+ },
424
+ addition_without_label_size_regular: {
425
+ paddingTop: `${theme.methods.space.value(2, 'px')}`
426
+ },
427
+ addition_without_label_size_large: {
428
+ paddingTop: `${theme.methods.space.value(2, 'px')}`
429
+ },
430
+ prefix: {
431
+ flex: '0 0 auto',
432
+ marginInlineStart: '16px',
433
+ marginInlineEnd: '8px',
434
+ opacity: '0',
435
+ transition: theme.methods.transitions.make('opacity')
436
+ },
437
+ prefix_noStartMargin: {
438
+ marginInlineStart: '0px'
439
+ },
440
+ prefix_focus: {
441
+ opacity: '1'
442
+ },
443
+ noPrefixMargin: {
444
+ marginInlineEnd: '0'
445
+ },
446
+ sufix: {
447
+ flex: '0 0 auto',
448
+ marginInlineEnd: '16px',
449
+ marginInlineStart: '8px',
450
+ opacity: '0',
451
+ transition: theme.methods.transitions.make('opacity')
452
+ },
453
+ sufix_focus: {
454
+ opacity: '1'
455
+ },
456
+ sufix_noEndMargin: {
457
+ marginInlineEnd: '0px'
458
+ },
459
+ noSufixMargin: {
460
+ marginInlineStart: '0'
461
+ },
462
+ fullWidth: {
463
+ width: '100%'
464
+ },
465
+ clear: {
466
+ cursor: 'pointer',
467
+ pointerEvents: 'all !important',
468
+ userSelect: 'none',
469
+ transition: theme.methods.transitions.make('transform', {
470
+ duration: 'xs'
471
+ }),
472
+ '&:active': {
473
+ transform: 'scale(0.87)'
474
+ }
475
+ },
476
+ disabled: {
477
+ opacity: '0.54',
478
+ pointerEvents: 'none',
479
+ cursor: 'default'
480
+ }
481
+ };
482
+ }, {
483
+ name: 'onesy-TextField'
484
+ });
485
+ const TextField = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
486
+ var _ComponentProps, _type, _type2, _String;
487
+ const theme = (0, _styleReact.useOnesyTheme)();
488
+ const l = theme.l;
489
+ const props = _react.default.useMemo(() => {
490
+ var _theme$ui, _theme$ui2;
491
+ return _objectSpread(_objectSpread(_objectSpread({}, theme === null || theme === void 0 || (_theme$ui = theme.ui) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.elements) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.all) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.props) === null || _theme$ui === void 0 ? void 0 : _theme$ui.default), theme === null || theme === void 0 || (_theme$ui2 = theme.ui) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.elements) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.onesyTextField) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.props) === null || _theme$ui2 === void 0 ? void 0 : _theme$ui2.default), props_);
492
+ }, [props_]);
493
+ const Line = _react.default.useMemo(() => {
494
+ var _theme$elements;
495
+ return (theme === null || theme === void 0 || (_theme$elements = theme.elements) === null || _theme$elements === void 0 ? void 0 : _theme$elements.Line) || _Line.default;
496
+ }, [theme]);
497
+ const Type = _react.default.useMemo(() => {
498
+ var _theme$elements2;
499
+ return (theme === null || theme === void 0 || (_theme$elements2 = theme.elements) === null || _theme$elements2 === void 0 ? void 0 : _theme$elements2.Type) || _Type.default;
500
+ }, [theme]);
501
+ const Tooltip = _react.default.useMemo(() => {
502
+ var _theme$elements3;
503
+ return (theme === null || theme === void 0 || (_theme$elements3 = theme.elements) === null || _theme$elements3 === void 0 ? void 0 : _theme$elements3.Tooltip) || _Tooltip.default;
504
+ }, [theme]);
505
+ const IconButton = _react.default.useMemo(() => {
506
+ var _theme$elements4;
507
+ return (theme === null || theme === void 0 || (_theme$elements4 = theme.elements) === null || _theme$elements4 === void 0 ? void 0 : _theme$elements4.IconButton) || _IconButton.default;
508
+ }, [theme]);
509
+ const {
510
+ tonal = true,
511
+ color = 'primary',
512
+ version = 'filled',
513
+ size = 'regular',
514
+ rootRef,
515
+ valueDefault,
516
+ value: value_,
517
+ onChange,
518
+ name,
519
+ label: label_,
520
+ align,
521
+ start,
522
+ startVerticalAlign: startVerticalAlign_ = 'start',
523
+ end: end_,
524
+ endVerticalAlign: endVerticalAlign_ = 'start',
525
+ placeholder,
526
+ fullWidth: fullWidth_,
527
+ helperText,
528
+ counter,
529
+ prefix,
530
+ sufix,
531
+ noPrefixMargin,
532
+ noSufixMargin,
533
+ enabled,
534
+ autoFocus,
535
+ autoComplete,
536
+ type: type_ = 'text',
537
+ required,
538
+ optional,
539
+ optionalText = 'optional',
540
+ error,
541
+ multiline,
542
+ rows: rows_,
543
+ minRows = 1,
544
+ maxRows,
545
+ clear,
546
+ focus: focus_,
547
+ footer: footer_,
548
+ subscription,
549
+ controlled,
550
+ minimal,
551
+ restoreSelection = false,
552
+ minWidth,
553
+ readOnly,
554
+ disabled,
555
+ onInput: onInput_,
556
+ onFocus: onFocus_,
557
+ onBlur: onBlur_,
558
+ onMouseEnter: onMouseEnter_,
559
+ onMouseLeave: onMouseLeave_,
560
+ inputProps = {},
561
+ InputWrapperProps = {},
562
+ HelperTextProps,
563
+ IconProps,
564
+ IconClear = _IconMaterialCloseW.default,
565
+ InputComponent: InputComponent_,
566
+ WrapperComponent = 'div',
567
+ Component = 'div',
568
+ className,
569
+ style,
570
+ children,
571
+ // Other
572
+ colorUnchecked
573
+ } = props,
574
+ other = (0, _objectWithoutProperties2.default)(props, _excluded);
575
+ const {
576
+ classes
577
+ } = useStyle();
578
+ const refs = {
579
+ root: _react.default.useRef(undefined),
580
+ input: _react.default.useRef(undefined),
581
+ carret: _react.default.useRef(undefined),
582
+ restoreSelection: _react.default.useRef(restoreSelection),
583
+ controlled: _react.default.useRef(controlled),
584
+ ids: {
585
+ label: _react.default.useId(),
586
+ clear: _react.default.useId()
587
+ }
588
+ };
589
+ refs.controlled.current = controlled;
590
+ const keys = _react.default.useMemo(() => {
591
+ const result = [];
592
+ const items = [fullWidth_];
593
+ items.forEach(item => {
594
+ if ((0, _utils.is)('object', item)) Object.keys(item).filter(key => theme.breakpoints.media[key]).forEach(key => result.push(key));
595
+ });
596
+ return (0, _utils.unique)(result);
597
+ }, [fullWidth_]);
598
+ const breakpoints = {};
599
+ keys.forEach(key => {
600
+ breakpoints[key] = (0, _useMediaQuery.default)(theme.breakpoints.media[key], {
601
+ element: refs.root.current
602
+ });
603
+ });
604
+ const label = name !== undefined ? name : label_;
605
+ let startVerticalAlign = startVerticalAlign_;
606
+ let endVerticalAlign = endVerticalAlign_;
607
+ const fullWidth = (0, _utils2.valueBreakpoints)(fullWidth_, undefined, breakpoints, theme);
608
+ const rowValue = () => {
609
+ var _refs$root$current;
610
+ const rootDocument = (0, _utils.isEnvironment)('browser') ? ((_refs$root$current = refs.root.current) === null || _refs$root$current === void 0 ? void 0 : _refs$root$current.ownerDocument) || window.document : undefined;
611
+ const htmlFontSize = (0, _utils.isEnvironment)('browser') ? +window.getComputedStyle(rootDocument.documentElement).fontSize.slice(0, -2) : 16;
612
+ const padding = size === 'small' ? 28 : size === 'regular' ? 36 : 44;
613
+ const row_ = Math.round(htmlFontSize * 0.875 * 1.4285714285714286);
46
614
  return {
47
- wrapper: {
48
- position: 'relative',
49
- display: 'inline-flex',
50
- flexDirection: 'column'
51
- },
52
- root: {
53
- display: 'inline-flex',
54
- alignItems: 'center',
55
- position: 'relative',
56
- borderRadius: `${theme.shape.radius.unit}px ${theme.shape.radius.unit}px 0 0`,
57
- '& > *': {
58
- '&::-webkit-scrollbar': {
59
- width: '0px',
60
- height: '0px'
61
- }
62
- }
63
- },
64
- // Color
65
- color_default: { color: theme.palette.text.default.primary },
66
- color_neutral: { color: theme.palette.color.neutral.main },
67
- color_primary: { color: theme.palette.color.primary.main },
68
- color_secondary: { color: theme.palette.color.secondary.main },
69
- color_tertiary: { color: theme.palette.color.tertiary.main },
70
- color_quaternary: { color: theme.palette.color.quaternary.main },
71
- color_info: { color: theme.palette.color.info.main },
72
- color_success: { color: theme.palette.color.success.main },
73
- color_warning: { color: theme.palette.color.warning.main },
74
- color_error: { color: theme.palette.color.error.main },
75
- error_color: {
76
- color: [theme.palette.light ? theme.palette.color.error[40] : theme.palette.color.error[80], '!important']
77
- },
78
- error_hover_color: {
79
- color: [theme.palette.light ? theme.palette.color.error[20] : theme.palette.color.error[90], '!important']
80
- },
81
- inputWrapper: Object.assign({
82
- // Reset
83
- margin: '0', border: '0', fontFamily: 'inherit', fontSize: '100%', lineHeight: '1.15', overflow: 'visible', boxSizing: 'border-box', display: 'flex', flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', opacity: '0', transition: theme.methods.transitions.make('opacity'), borderRadius: `${theme.shape.radius.unit}px ${theme.shape.radius.unit}px 0 0`, cursor: 'text', zIndex: '1', flex: '1 1 auto' }, theme.typography.values.b2),
84
- inputWrapper_focus: {
85
- opacity: '1'
86
- },
87
- input: Object.assign(Object.assign({
88
- // Reset
89
- margin: '0', border: '0', outline: 'none', color: theme.palette.text.default.primary, background: 'transparent', '-webkit-tap-highlight-color': 'transparent', textAlign: 'start' }, theme.typography.values.b2), overflow),
90
- multiline: {
91
- resize: 'none',
92
- overflow: 'auto',
93
- whiteSpace: 'normal'
94
- },
95
- input_size_small: {
96
- // height: '48px',
97
- padding: `${theme.methods.space.value(1, 'px')} ${theme.methods.space.value(2, 'px')}`,
98
- paddingTop: theme.methods.space.value(2.5, 'px')
99
- },
100
- input_size_regular: {
101
- // height: '56px',
102
- padding: `11px ${theme.methods.space.value(2, 'px')}`,
103
- paddingTop: theme.methods.space.value(3, 'px')
104
- },
105
- input_size_large: {
106
- // height: '64px',
107
- padding: theme.methods.space.value(2, 'px'),
108
- paddingTop: theme.methods.space.value(3.5, 'px')
109
- },
110
- inputWrapper_without_label_size_small: {
111
- paddingTop: `${theme.methods.space.value(1, 'px')}`
112
- },
113
- inputWrapper_without_label_size_regular: {
114
- paddingTop: `${theme.methods.space.value(2, 'px')}`
115
- },
116
- inputWrapper_without_label_size_large: {
117
- paddingTop: `${theme.methods.space.value(2, 'px')}`
118
- },
119
- input_version_text: {
120
- '&:not($input_start_icon)': {
121
- paddingInline: '0'
122
- }
123
- },
124
- input_start_icon: {
125
- paddingInlineStart: '0'
126
- },
127
- input_end_icon: {
128
- paddingInlineEnd: '0'
129
- },
130
- input_version_outlined_size_small: {
131
- paddingTop: theme.methods.space.value(1.75, 'px'),
132
- paddingBottom: theme.methods.space.value(1.75, 'px')
133
- },
134
- input_version_outlined_size_regular: {
135
- paddingTop: theme.methods.space.value(2.25, 'px'),
136
- paddingBottom: theme.methods.space.value(2.25, 'px')
137
- },
138
- input_version_outlined_size_large: {
139
- paddingTop: theme.methods.space.value(2.75, 'px'),
140
- paddingBottom: theme.methods.space.value(2.75, 'px')
141
- },
142
- input_align_start: {
143
- textAlign: 'start'
144
- },
145
- input_align_center: {
146
- textAlign: 'center'
147
- },
148
- input_align_end: {
149
- textAlign: 'end'
150
- },
151
- label: Object.assign(Object.assign({ position: 'absolute', insetInlineStart: '16px', transformOrigin: 'top left', transition: theme.methods.transitions.make(['color', 'inset', 'margin', 'transform']), pointerEvents: 'none', userSelect: 'none', zIndex: '1' }, overflow), { width: 'auto' }),
152
- label_regular: {
153
- top: '50%',
154
- transform: 'translate(0px, -50%) scale(1)'
155
- },
156
- label_multiline: {
157
- top: '0px'
158
- },
159
- label_rtl: {
160
- transformOrigin: 'top right'
161
- },
162
- label_version_text: {
163
- insetInlineStart: '0px'
164
- },
165
- label_icon_start: {
166
- insetInlineStart: theme.methods.space.value(6.5, 'px')
167
- },
168
- label_size_small_multiline: {
169
- transform: 'translate(4px, 14px) scale(1)'
170
- },
171
- label_size_regular_multiline: {
172
- transform: 'translate(4px, 18px) scale(1)'
173
- },
174
- label_size_large_multiline: {
175
- transform: 'translate(4px, 22px) scale(1)'
176
- },
177
- // Focus
178
- label_version_text_focus: {
179
- top: '0px',
180
- insetInlineStart: '0px',
181
- transform: 'translate(0, 6px) scale(0.667)'
182
- },
183
- label_version_outlined_focus: {
184
- top: '0px',
185
- insetInlineStart: '15px',
186
- marginInlineStart: '4px',
187
- transform: 'translate(0, -6px) scale(0.667)'
188
- },
189
- label_version_filled_focus: {
190
- top: '0px',
191
- insetInlineStart: '15px',
192
- transform: 'translate(0, 6px) scale(0.667)'
193
- },
194
- background: Object.assign(Object.assign({}, other), { background: 'currentColor', borderRadius: `${theme.shape.radius.unit}px ${theme.shape.radius.unit}px 0 0`, opacity: theme.palette.light ? theme.palette.visual_contrast.default.opacity.hover : theme.palette.visual_contrast.default.opacity.selected, zIndex: '0', transition: theme.methods.transitions.make(['opacity']) }),
195
- background_hover: {
196
- opacity: theme.palette.visual_contrast.default.opacity.focus
197
- },
198
- background_focus: {
199
- opacity: theme.palette.light ? theme.palette.visual_contrast.default.opacity.hover : theme.palette.visual_contrast.default.opacity.selected
200
- },
201
- border: Object.assign(Object.assign({}, other), { borderRadius: `${theme.shape.radius.unit}px ${theme.shape.radius.unit}px 0 0`, boxShadow: 'inset 0px -1px 0px 0px currentColor', zIndex: '1', transition: theme.methods.transitions.make(['box-shadow']) }),
202
- border_focus: {
203
- boxShadow: 'inset 0px -2px 0px 0px currentColor'
204
- },
205
- fieldset: Object.assign(Object.assign({}, other), { top: '-5px', height: 'calc(100% + 5px)', borderRadius: `${theme.shape.radius.unit}px`, border: '1px solid currentColor', padding: '0', paddingInline: `${theme.methods.space.value(1.5, 'px')} ${theme.methods.space.value(2, 'px')}`, transition: theme.methods.transitions.make(['border', 'padding']) }),
206
- fieldset_focus: {
207
- borderWidth: '2px',
208
- paddingInline: `${theme.methods.space.value(1.5, 'px')} ${theme.methods.space.value(2, 'px')}`
209
- },
210
- legend: Object.assign(Object.assign({ display: 'inline-flex', height: '11px', width: 'auto', padding: '0px', maxWidth: '0.001px', whiteSpace: 'nowrap', visibility: 'hidden', overflow: 'hidden', transition: theme.methods.transitions.make(['max-width', 'padding'], { duration: 'xxs' }) }, theme.typography.values.b2), { fontSize: '0.64rem', letterSpacing: 'normal' }),
211
- legend_focus: {
212
- maxWidth: '100%',
213
- padding: `0 ${theme.methods.space.value(0.5, 'px')}`,
214
- transition: theme.methods.transitions.make(['max-width', 'padding'], { duration: 'xs' })
215
- },
216
- footer: {
217
- marginTop: '4px',
218
- paddingInline: theme.methods.space.value(2, 'px')
219
- },
220
- footer_version_text: {
221
- paddingInline: '0'
222
- },
223
- helperText: {
224
- display: 'inline-flex',
225
- color: theme.palette.text.default.secondary,
226
- userSelect: 'none'
227
- },
228
- counterText: {
229
- display: 'inline-flex',
230
- justifyContent: 'flex-end',
231
- color: theme.palette.text.default.secondary,
232
- userSelect: 'none',
233
- flex: '1 0 auto'
234
- },
235
- // Start and end icon
236
- icon: {
237
- display: 'inline-flex',
238
- alignItems: 'center',
239
- flex: '0 0 auto'
240
- },
241
- icon_size_small: {
242
- paddingBlock: '12px'
243
- },
244
- icon_size_regular: {
245
- paddingBlock: '16px'
246
- },
247
- icon_size_large: {
248
- paddingBlock: '24px'
249
- },
250
- icon_version_text_size_small: {
251
- paddingBlock: '6px'
252
- },
253
- icon_version_text_size_regular: {
254
- paddingBlock: '8px'
255
- },
256
- icon_version_text_size_large: {
257
- paddingBlock: '12px'
258
- },
259
- icon_version_outlined_size_small: {
260
- paddingBlock: '9px'
261
- },
262
- icon_version_outlined_size_regular: {
263
- paddingBlock: '12px'
264
- },
265
- icon_version_outlined_size_large: {
266
- paddingBlock: '17px'
267
- },
268
- icon_version_filled_size_small: {
269
- paddingBlock: '9px'
270
- },
271
- icon_version_filled_size_regular: {
272
- paddingBlock: '12px'
273
- },
274
- icon_version_filled_size_large: {
275
- paddingBlock: '17px'
276
- },
277
- icon_button_size_small: {
278
- paddingBlock: '4px'
279
- },
280
- icon_button_size_regular: {
281
- paddingBlock: '8px'
282
- },
283
- icon_button_size_large: {
284
- paddingBlock: '12px'
285
- },
286
- icon_start: {
287
- maxWidth: '40%',
288
- overflow: 'auto hidden',
289
- paddingInlineEnd: '16px',
290
- paddingInlineStart: '12px'
291
- },
292
- icon_vertical_align_start: {
293
- alignSelf: 'flex-start'
294
- },
295
- icon_vertical_align_center: {
296
- alignSelf: 'center',
297
- paddingBlock: '0px !important'
298
- },
299
- icon_vertical_align_end: {
300
- alignSelf: 'flex-end'
301
- },
302
- icon_end: {
303
- maxWidth: '40%',
304
- overflow: 'auto hidden',
305
- paddingInlineStart: theme.methods.space.value(2, 'px'),
306
- paddingInlineEnd: theme.methods.space.value(1.5, 'px')
307
- },
308
- addition: {
309
- color: theme.palette.text.default.secondary
310
- },
311
- addition_size_small: {
312
- paddingBottom: theme.methods.space.value(1, 'px'),
313
- paddingTop: theme.methods.space.value(2.5, 'px')
314
- },
315
- addition_size_regular: {
316
- paddingBottom: theme.methods.space.value(2, 'px'),
317
- paddingTop: theme.methods.space.value(3, 'px')
318
- },
319
- addition_size_large: {
320
- paddingBottom: theme.methods.space.value(2, 'px'),
321
- paddingTop: theme.methods.space.value(3.5, 'px')
322
- },
323
- addition_version_outlined_size_small: {
324
- paddingTop: theme.methods.space.value(1.75, 'px'),
325
- paddingBottom: theme.methods.space.value(1.75, 'px')
326
- },
327
- addition_version_outlined_size_regular: {
328
- paddingTop: theme.methods.space.value(2.25, 'px'),
329
- paddingBottom: theme.methods.space.value(2.25, 'px')
330
- },
331
- addition_version_outlined_size_large: {
332
- paddingTop: theme.methods.space.value(2.75, 'px'),
333
- paddingBottom: theme.methods.space.value(2.75, 'px')
334
- },
335
- addition_without_label_size_small: {
336
- paddingTop: `${theme.methods.space.value(1, 'px')}`
337
- },
338
- addition_without_label_size_regular: {
339
- paddingTop: `${theme.methods.space.value(2, 'px')}`
340
- },
341
- addition_without_label_size_large: {
342
- paddingTop: `${theme.methods.space.value(2, 'px')}`
343
- },
344
- prefix: {
345
- flex: '0 0 auto',
346
- marginInlineStart: '16px',
347
- marginInlineEnd: '8px',
348
- opacity: '0',
349
- transition: theme.methods.transitions.make('opacity'),
350
- },
351
- prefix_noStartMargin: {
352
- marginInlineStart: '0px'
353
- },
354
- prefix_focus: {
355
- opacity: '1'
356
- },
357
- noPrefixMargin: {
358
- marginInlineEnd: '0'
359
- },
360
- sufix: {
361
- flex: '0 0 auto',
362
- marginInlineEnd: '16px',
363
- marginInlineStart: '8px',
364
- opacity: '0',
365
- transition: theme.methods.transitions.make('opacity'),
366
- },
367
- sufix_focus: {
368
- opacity: '1'
369
- },
370
- sufix_noEndMargin: {
371
- marginInlineEnd: '0px'
372
- },
373
- noSufixMargin: {
374
- marginInlineStart: '0'
375
- },
376
- fullWidth: {
377
- width: '100%'
378
- },
379
- clear: {
380
- cursor: 'pointer',
381
- pointerEvents: 'all !important',
382
- userSelect: 'none',
383
- transition: theme.methods.transitions.make('transform', { duration: 'xs' }),
384
- '&:active': {
385
- transform: 'scale(0.87)'
386
- }
387
- },
388
- disabled: {
389
- opacity: '0.54',
390
- pointerEvents: 'none',
391
- cursor: 'default'
392
- }
615
+ height: row_,
616
+ padding
393
617
  };
394
- }, { name: 'onesy-TextField' });
395
- const TextField = react_1.default.forwardRef((props_, ref) => {
396
- var _a, _b, _c, _d, _e, _f;
397
- const theme = (0, style_react_1.useOnesyTheme)();
398
- const l = theme.l;
399
- const props = react_1.default.useMemo(() => { var _a, _b, _c, _d, _e, _f, _g, _h; return (Object.assign(Object.assign(Object.assign({}, (_d = (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _a === void 0 ? void 0 : _a.elements) === null || _b === void 0 ? void 0 : _b.all) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.default), (_h = (_g = (_f = (_e = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.onesyTextField) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props_)); }, [props_]);
400
- const Line = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Line) || Line_1.default; }, [theme]);
401
- const Type = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Type) || Type_1.default; }, [theme]);
402
- const Tooltip = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Tooltip) || Tooltip_1.default; }, [theme]);
403
- const IconButton = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.IconButton) || IconButton_1.default; }, [theme]);
404
- const { tonal = true, color = 'primary', version = 'filled', size = 'regular', rootRef, valueDefault, value: value_, onChange, name, label: label_, align, start, startVerticalAlign: startVerticalAlign_ = 'start', end: end_, endVerticalAlign: endVerticalAlign_ = 'start', placeholder, fullWidth: fullWidth_, helperText, counter, prefix, sufix, noPrefixMargin, noSufixMargin, enabled, autoFocus, autoComplete, type: type_ = 'text', required, optional, optionalText = 'optional', error, multiline, rows: rows_, minRows = 1, maxRows, clear, focus: focus_, footer: footer_, subscription, controlled, minimal, restoreSelection = false, minWidth, readOnly, disabled, onInput: onInput_, onFocus: onFocus_, onBlur: onBlur_, onMouseEnter: onMouseEnter_, onMouseLeave: onMouseLeave_, inputProps = {}, InputWrapperProps = {}, HelperTextProps, IconProps, IconClear = IconMaterialCloseW100_1.default, InputComponent: InputComponent_, WrapperComponent = 'div', Component = 'div', className, style, children,
405
- // Other
406
- colorUnchecked } = props, other = __rest(props, ["tonal", "color", "version", "size", "rootRef", "valueDefault", "value", "onChange", "name", "label", "align", "start", "startVerticalAlign", "end", "endVerticalAlign", "placeholder", "fullWidth", "helperText", "counter", "prefix", "sufix", "noPrefixMargin", "noSufixMargin", "enabled", "autoFocus", "autoComplete", "type", "required", "optional", "optionalText", "error", "multiline", "rows", "minRows", "maxRows", "clear", "focus", "footer", "subscription", "controlled", "minimal", "restoreSelection", "minWidth", "readOnly", "disabled", "onInput", "onFocus", "onBlur", "onMouseEnter", "onMouseLeave", "inputProps", "InputWrapperProps", "HelperTextProps", "IconProps", "IconClear", "InputComponent", "WrapperComponent", "Component", "className", "style", "children", "colorUnchecked"]);
407
- const { classes } = useStyle();
408
- const refs = {
409
- root: react_1.default.useRef(undefined),
410
- input: react_1.default.useRef(undefined),
411
- carret: react_1.default.useRef(undefined),
412
- restoreSelection: react_1.default.useRef(restoreSelection),
413
- controlled: react_1.default.useRef(controlled),
414
- ids: {
415
- label: react_1.default.useId(),
416
- clear: react_1.default.useId()
417
- }
418
- };
419
- refs.controlled.current = controlled;
420
- const keys = react_1.default.useMemo(() => {
421
- const result = [];
422
- const items = [fullWidth_];
423
- items.forEach(item => {
424
- if ((0, utils_1.is)('object', item))
425
- Object.keys(item).filter(key => theme.breakpoints.media[key]).forEach(key => result.push(key));
426
- });
427
- return (0, utils_1.unique)(result);
428
- }, [fullWidth_]);
429
- const breakpoints = {};
430
- keys.forEach(key => {
431
- breakpoints[key] = (0, useMediaQuery_1.default)(theme.breakpoints.media[key], { element: refs.root.current });
618
+ };
619
+ const [value, setValue] = _react.default.useState(valueDefault !== undefined ? valueDefault : value_);
620
+ const [focus, setFocus] = _react.default.useState(focus_);
621
+ const [mouseDown, setMouseDown] = _react.default.useState(false);
622
+ const [hover, setHover] = _react.default.useState(false);
623
+ const [row, setRow] = _react.default.useState(rowValue);
624
+ const [rows, setRows] = _react.default.useState(1);
625
+ const [visible, setVisible] = _react.default.useState(false);
626
+ let type = type_;
627
+ const styles = {
628
+ root: {},
629
+ input: {},
630
+ inputWrapper: {},
631
+ background: {
632
+ color: theme.palette.text.default.secondary
633
+ }
634
+ };
635
+ refs.restoreSelection.current = restoreSelection;
636
+ _react.default.useEffect(() => {
637
+ var _refs$root$current2;
638
+ const rootDocument = (0, _utils.isEnvironment)('browser') ? ((_refs$root$current2 = refs.root.current) === null || _refs$root$current2 === void 0 ? void 0 : _refs$root$current2.ownerDocument) || window.document : undefined;
639
+ const htmlObserver = new MutationObserver(() => setRow(rowValue));
640
+ htmlObserver.observe(rootDocument.documentElement, {
641
+ attributes: true,
642
+ attributeFilter: ['style']
432
643
  });
433
- const label = name !== undefined ? name : label_;
434
- let startVerticalAlign = startVerticalAlign_;
435
- let endVerticalAlign = endVerticalAlign_;
436
- const fullWidth = (0, utils_2.valueBreakpoints)(fullWidth_, undefined, breakpoints, theme);
437
- const rowValue = () => {
438
- var _a;
439
- const rootDocument = (0, utils_1.isEnvironment)('browser') ? (((_a = refs.root.current) === null || _a === void 0 ? void 0 : _a.ownerDocument) || window.document) : undefined;
440
- const htmlFontSize = (0, utils_1.isEnvironment)('browser') ? +window.getComputedStyle(rootDocument.documentElement).fontSize.slice(0, -2) : 16;
441
- const padding = size === 'small' ? 28 : size === 'regular' ? 36 : 44;
442
- const row_ = Math.round(htmlFontSize * 0.875 * 1.4285714285714286);
443
- return {
444
- height: row_,
445
- padding
446
- };
447
- };
448
- const [value, setValue] = react_1.default.useState((valueDefault !== undefined ? valueDefault : value_));
449
- const [focus, setFocus] = react_1.default.useState(focus_);
450
- const [mouseDown, setMouseDown] = react_1.default.useState(false);
451
- const [hover, setHover] = react_1.default.useState(false);
452
- const [row, setRow] = react_1.default.useState(rowValue);
453
- const [rows, setRows] = react_1.default.useState(1);
454
- const [visible, setVisible] = react_1.default.useState(false);
455
- let type = type_;
456
- const styles = {
457
- root: {},
458
- input: {},
459
- inputWrapper: {},
460
- background: {
461
- color: theme.palette.text.default.secondary
462
- }
463
- };
464
- refs.restoreSelection.current = restoreSelection;
465
- react_1.default.useEffect(() => {
466
- var _a;
467
- const rootDocument = (0, utils_1.isEnvironment)('browser') ? (((_a = refs.root.current) === null || _a === void 0 ? void 0 : _a.ownerDocument) || window.document) : undefined;
468
- const htmlObserver = new MutationObserver(() => setRow(rowValue));
469
- htmlObserver.observe(rootDocument.documentElement, { attributes: true, attributeFilter: ['style'] });
470
- rootDocument.addEventListener('mouseup', onInputWrapperMouseUp);
471
- return () => {
472
- // Clean up
473
- rootDocument.removeEventListener('mouseup', onInputWrapperMouseUp);
474
- htmlObserver.disconnect();
475
- };
476
- }, []);
477
- react_1.default.useEffect(() => {
478
- setTimeout(() => {
479
- if (refs.restoreSelection.current && refs.carret.current) {
480
- // Carret restore previous value
481
- try {
482
- refs.input.current.selectionStart = refs.carret.current.start;
483
- refs.input.current.selectionEnd = refs.carret.current.end;
484
- }
485
- catch (error) { }
486
- }
487
- });
488
- }, [value]);
489
- react_1.default.useEffect(() => {
490
- if (value_ !== undefined && value_ !== value) {
491
- setValue(value_);
492
- }
493
- }, [value_]);
494
- react_1.default.useEffect(() => {
495
- if (focus_ !== focus && focus_ !== undefined)
496
- setFocus(focus_);
497
- }, [focus_]);
498
- react_1.default.useEffect(() => {
499
- const method = (event) => {
500
- if (event === 'clear')
501
- onClear();
502
- };
503
- if (subscription)
504
- subscription.subscribe(method);
505
- return () => {
506
- if (subscription)
507
- subscription.unsubscribe(method);
508
- };
509
- }, [subscription]);
510
- const onToggleVisible = react_1.default.useCallback(() => {
511
- setVisible((item) => !item);
512
- }, []);
513
- const onUpdateRows = () => {
514
- if (multiline && row !== undefined) {
515
- const heightValue = refs.input.current.style.height;
516
- // Get actual height with auto
517
- refs.input.current.style.height = 'auto';
518
- const scrollHeight = refs.input.current.scrollHeight;
519
- // Revert back to previous value
520
- refs.input.current.style.height = heightValue;
521
- const newRows = Math.floor(scrollHeight / row.height);
522
- setRows(newRows);
523
- }
524
- };
525
- const onUpdate = (event) => {
526
- const inputValue = event.target.value;
527
- // Carret save previous value
528
- refs.carret.current = { start: refs.input.current.selectionStart, end: refs.input.current.selectionEnd };
529
- // Only restore if it's not regular carret value
530
- if (refs.carret.current.start === inputValue.length)
531
- refs.carret.current = undefined;
532
- onUpdateRows();
533
- // Inner controlled value
534
- if (!refs.controlled.current)
535
- setValue(inputValue);
536
- if ((0, utils_1.is)('function', onChange))
537
- onChange(inputValue, event);
644
+ rootDocument.addEventListener('mouseup', onInputWrapperMouseUp);
645
+ return () => {
646
+ // Clean up
647
+ rootDocument.removeEventListener('mouseup', onInputWrapperMouseUp);
648
+ htmlObserver.disconnect();
538
649
  };
539
- const onInput = (event) => {
540
- onUpdateRows();
541
- if ((0, utils_1.is)('function', onInput_))
542
- onInput_(event);
650
+ }, []);
651
+ _react.default.useEffect(() => {
652
+ setTimeout(() => {
653
+ if (refs.restoreSelection.current && refs.carret.current) {
654
+ // Carret restore previous value
655
+ try {
656
+ refs.input.current.selectionStart = refs.carret.current.start;
657
+ refs.input.current.selectionEnd = refs.carret.current.end;
658
+ } catch (error) {}
659
+ }
660
+ });
661
+ }, [value]);
662
+ _react.default.useEffect(() => {
663
+ if (value_ !== undefined && value_ !== value) {
664
+ setValue(value_);
665
+ }
666
+ }, [value_]);
667
+ _react.default.useEffect(() => {
668
+ if (focus_ !== focus && focus_ !== undefined) setFocus(focus_);
669
+ }, [focus_]);
670
+ _react.default.useEffect(() => {
671
+ const method = event => {
672
+ if (event === 'clear') onClear();
543
673
  };
544
- const onClear = react_1.default.useCallback(() => {
545
- if (!disabled) {
546
- const valueNew = '';
547
- // Inner controlled value
548
- if (!refs.controlled.current)
549
- setValue(valueNew);
550
- if ((0, utils_1.is)('function', onChange))
551
- onChange(valueNew);
552
- }
553
- }, [disabled, onChange]);
554
- const onInputWrapperMouseDown = react_1.default.useCallback((event) => {
555
- if (!disabled) {
556
- setMouseDown(true);
557
- refs.input.current.focus();
558
- if ((0, utils_1.is)('function', InputWrapperProps.onMouseDown))
559
- InputWrapperProps.onMouseDown(event);
560
- }
561
- }, []);
562
- const onInputWrapperMouseUp = react_1.default.useCallback((event) => {
563
- if (!disabled) {
564
- setMouseDown(false);
565
- if ((0, utils_1.is)('function', InputWrapperProps.onMouseUp))
566
- InputWrapperProps.onMouseUp(event);
567
- }
568
- }, []);
569
- const onInputWrapperClick = react_1.default.useCallback((event) => {
570
- var _a;
571
- if (!disabled) {
572
- if (event.target === event.currentTarget)
573
- (_a = refs.input.current) === null || _a === void 0 ? void 0 : _a.focus();
574
- if ((0, utils_1.is)('function', InputWrapperProps === null || InputWrapperProps === void 0 ? void 0 : InputWrapperProps.onClick))
575
- InputWrapperProps.onClick(event);
576
- }
577
- }, []);
578
- const onFocus = (event) => {
579
- if (!disabled) {
580
- setFocus(focus_ !== undefined ? focus_ : true);
581
- if ((0, utils_1.is)('function', onFocus_))
582
- onFocus_(event);
583
- }
674
+ if (subscription) subscription.subscribe(method);
675
+ return () => {
676
+ if (subscription) subscription.unsubscribe(method);
584
677
  };
585
- const onBlur = (event) => {
586
- if (!disabled) {
587
- setFocus(focus_ !== undefined ? focus_ : false);
588
- if ((0, utils_1.is)('function', onBlur_))
589
- onBlur_(event);
590
- }
678
+ }, [subscription]);
679
+ const onToggleVisible = _react.default.useCallback(() => {
680
+ setVisible(item => !item);
681
+ }, []);
682
+ const onUpdateRows = () => {
683
+ if (multiline && row !== undefined) {
684
+ const heightValue = refs.input.current.style.height;
685
+
686
+ // Get actual height with auto
687
+ refs.input.current.style.height = 'auto';
688
+ const scrollHeight = refs.input.current.scrollHeight;
689
+
690
+ // Revert back to previous value
691
+ refs.input.current.style.height = heightValue;
692
+ const newRows = Math.floor(scrollHeight / row.height);
693
+ setRows(newRows);
694
+ }
695
+ };
696
+ const onUpdate = event => {
697
+ const inputValue = event.target.value;
698
+
699
+ // Carret save previous value
700
+ refs.carret.current = {
701
+ start: refs.input.current.selectionStart,
702
+ end: refs.input.current.selectionEnd
591
703
  };
592
- const onMouseEnter = react_1.default.useCallback((event) => {
593
- if (!disabled) {
594
- setHover(true);
595
- if ((0, utils_1.is)('function', onMouseEnter_))
596
- onMouseEnter_(event);
597
- }
598
- }, []);
599
- const onMouseLeave = react_1.default.useCallback((event) => {
600
- if (!disabled) {
601
- setHover(false);
602
- if ((0, utils_1.is)('function', onMouseLeave_))
603
- onMouseLeave_(event);
604
- }
605
- }, []);
606
- const palette = color === 'default' ? theme.palette.color.neutral : !theme.palette.color[color] ? theme.methods.color(color) : theme.palette.color[color];
607
- if (!focus) {
608
- styles.root.color = theme.palette.text.default.secondary;
704
+
705
+ // Only restore if it's not regular carret value
706
+ if (refs.carret.current.start === inputValue.length) refs.carret.current = undefined;
707
+ onUpdateRows();
708
+
709
+ // Inner controlled value
710
+ if (!refs.controlled.current) setValue(inputValue);
711
+ if ((0, _utils.is)('function', onChange)) onChange(inputValue, event);
712
+ };
713
+ const onInput = event => {
714
+ onUpdateRows();
715
+ if ((0, _utils.is)('function', onInput_)) onInput_(event);
716
+ };
717
+ const onClear = _react.default.useCallback(() => {
718
+ if (!disabled) {
719
+ const valueNew = '';
720
+
721
+ // Inner controlled value
722
+ if (!refs.controlled.current) setValue(valueNew);
723
+ if ((0, _utils.is)('function', onChange)) onChange(valueNew);
609
724
  }
610
- else {
611
- styles.root.color = styles.input.caretColor = tonal ? theme.methods.palette.color.value(color, 30, true, palette) : (color === 'default' ? theme.palette.text.default.primary : ((_a = theme.palette.color[color]) === null || _a === void 0 ? void 0 : _a.main) || color);
725
+ }, [disabled, onChange]);
726
+ const onInputWrapperMouseDown = _react.default.useCallback(event => {
727
+ if (!disabled) {
728
+ setMouseDown(true);
729
+ refs.input.current.focus();
730
+ if ((0, _utils.is)('function', InputWrapperProps.onMouseDown)) InputWrapperProps.onMouseDown(event);
612
731
  }
613
- if (error) {
614
- styles.input.caretColor = theme.palette.light ? theme.palette.color.error[40] : theme.palette.color.error[80];
732
+ }, []);
733
+ const onInputWrapperMouseUp = _react.default.useCallback(event => {
734
+ if (!disabled) {
735
+ setMouseDown(false);
736
+ if ((0, _utils.is)('function', InputWrapperProps.onMouseUp)) InputWrapperProps.onMouseUp(event);
615
737
  }
616
- if (tonal)
617
- styles.background.color = theme.methods.palette.color.value(color, 20, true, palette);
618
- const footer = (footer_ || !!helperText || counter !== undefined || required);
619
- const Wrapper = footer ? WrapperComponent : react_1.default.Fragment;
620
- let ComponentProps = {};
621
- let WrapperProps = {};
622
- if (footer) {
623
- WrapperProps = Object.assign({}, other);
624
- WrapperProps.ref = item => {
625
- if (rootRef) {
626
- if ((0, utils_1.is)('function', rootRef))
627
- rootRef(item);
628
- else
629
- rootRef.current = item;
630
- }
631
- refs.root.current = item;
632
- };
633
- WrapperProps['className'] = (0, style_react_1.classNames)([
634
- (0, utils_2.staticClassName)('TextField', theme) && [
635
- 'onesy-TextField-wrapper',
636
- fullWidth && 'onesy-TextField-full-width',
637
- disabled && 'onesy-TextField-disabled',
638
- fullWidth && 'onesy-full-width'
639
- ],
640
- className,
641
- classes.wrapper,
642
- fullWidth && classes.fullWidth,
643
- disabled && classes.disabled
644
- ]);
645
- WrapperProps.style = Object.assign({}, style);
738
+ }, []);
739
+ const onInputWrapperClick = _react.default.useCallback(event => {
740
+ if (!disabled) {
741
+ var _refs$input$current;
742
+ if (event.target === event.currentTarget) (_refs$input$current = refs.input.current) === null || _refs$input$current === void 0 || _refs$input$current.focus();
743
+ if ((0, _utils.is)('function', InputWrapperProps === null || InputWrapperProps === void 0 ? void 0 : InputWrapperProps.onClick)) InputWrapperProps.onClick(event);
646
744
  }
647
- else {
648
- ComponentProps = Object.assign({}, other);
649
- ComponentProps.ref = item => {
650
- if (rootRef) {
651
- if ((0, utils_1.is)('function', rootRef))
652
- rootRef(item);
653
- else
654
- rootRef.current = item;
655
- }
656
- refs.root.current = item;
657
- };
658
- ComponentProps.className = className;
659
- ComponentProps.style = Object.assign({}, style);
745
+ }, []);
746
+ const onFocus = event => {
747
+ if (!disabled) {
748
+ setFocus(focus_ !== undefined ? focus_ : true);
749
+ if ((0, _utils.is)('function', onFocus_)) onFocus_(event);
660
750
  }
661
- ComponentProps.style = Object.assign(Object.assign({}, ComponentProps.style), styles.root);
662
- let InputComponent = 'input';
663
- if (multiline) {
664
- InputComponent = 'textarea';
665
- inputProps.rows = 1;
666
- type = undefined;
667
- if (row) {
668
- if (rows_) {
669
- styles.input.height = (rows_ * row.height);
670
- styles.inputWrapper.height = (rows_ * row.height) + row.padding;
671
- }
672
- else {
673
- styles.input.height = (row.height * (0, utils_1.clamp)(rows, minRows, maxRows));
674
- styles.inputWrapper.height = (row.height * (0, utils_1.clamp)(rows, minRows, maxRows)) + row.padding;
675
- }
676
- }
751
+ };
752
+ const onBlur = event => {
753
+ if (!disabled) {
754
+ setFocus(focus_ !== undefined ? focus_ : false);
755
+ if ((0, _utils.is)('function', onBlur_)) onBlur_(event);
677
756
  }
678
- // override the input element
679
- // with a custom value
680
- if (InputComponent_)
681
- InputComponent = InputComponent_;
682
- // onInput
683
- if (!['input', 'textarea'].includes(InputComponent)) {
684
- inputProps.onInput = onInput;
757
+ };
758
+ const onMouseEnter = _react.default.useCallback(event => {
759
+ if (!disabled) {
760
+ setHover(true);
761
+ if ((0, _utils.is)('function', onMouseEnter_)) onMouseEnter_(event);
685
762
  }
686
- const iconProps = {
687
- size
688
- };
689
- const isTypePassword = type === 'password';
690
- const end = (Array.isArray(end_) ? end_ : [end_]).filter(Boolean);
691
- if (value && clear) {
692
- const exists = end === null || end === void 0 ? void 0 : end.find(item => item.key === refs.ids.clear);
693
- if (!exists) {
694
- end.push((0, jsx_runtime_1.jsx)(IconClear, Object.assign({ color: 'inherit', onClick: onClear }, IconProps, { className: (0, style_react_1.classNames)([
695
- IconProps === null || IconProps === void 0 ? void 0 : IconProps.className,
696
- classes.clear
697
- ]) }), refs.ids.clear));
698
- }
763
+ }, []);
764
+ const onMouseLeave = _react.default.useCallback(event => {
765
+ if (!disabled) {
766
+ setHover(false);
767
+ if ((0, _utils.is)('function', onMouseLeave_)) onMouseLeave_(event);
699
768
  }
700
- if (value && isTypePassword) {
701
- end.unshift((0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: visible ? l('Hide password') : l('View password'), color: 'inverted' }, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ onClick: onToggleVisible, color: 'default', size: size === 'large' ? 'regular' : 'small' }, { children: visible ? (0, jsx_runtime_1.jsx)(IconMaterialPassword2OffW100_1.default, Object.assign({}, iconProps)) : (0, jsx_runtime_1.jsx)(IconMaterialPassword2W100_1.default, Object.assign({}, iconProps)) })) })));
769
+ }, []);
770
+ const palette = color === 'default' ? theme.palette.color.neutral : !theme.palette.color[color] ? theme.methods.color(color) : theme.palette.color[color];
771
+ if (!focus) {
772
+ styles.root.color = theme.palette.text.default.secondary;
773
+ } else {
774
+ var _theme$palette$color$;
775
+ styles.root.color = styles.input.caretColor = tonal ? theme.methods.palette.color.value(color, 30, true, palette) : color === 'default' ? theme.palette.text.default.primary : ((_theme$palette$color$ = theme.palette.color[color]) === null || _theme$palette$color$ === void 0 ? void 0 : _theme$palette$color$.main) || color;
776
+ }
777
+ if (error) {
778
+ styles.input.caretColor = theme.palette.light ? theme.palette.color.error[40] : theme.palette.color.error[80];
779
+ }
780
+ if (tonal) styles.background.color = theme.methods.palette.color.value(color, 20, true, palette);
781
+ const footer = footer_ || !!helperText || counter !== undefined || required;
782
+ const Wrapper = footer ? WrapperComponent : _react.default.Fragment;
783
+ let ComponentProps = {};
784
+ let WrapperProps = {};
785
+ if (footer) {
786
+ WrapperProps = _objectSpread({}, other);
787
+ WrapperProps.ref = item => {
788
+ if (rootRef) {
789
+ if ((0, _utils.is)('function', rootRef)) rootRef(item);else rootRef.current = item;
790
+ }
791
+ refs.root.current = item;
792
+ };
793
+ WrapperProps['className'] = (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-wrapper', fullWidth && 'onesy-TextField-full-width', disabled && 'onesy-TextField-disabled', fullWidth && 'onesy-full-width'], className, classes.wrapper, fullWidth && classes.fullWidth, disabled && classes.disabled]);
794
+ WrapperProps.style = _objectSpread({}, style);
795
+ } else {
796
+ ComponentProps = _objectSpread({}, other);
797
+ ComponentProps.ref = item => {
798
+ if (rootRef) {
799
+ if ((0, _utils.is)('function', rootRef)) rootRef(item);else rootRef.current = item;
800
+ }
801
+ refs.root.current = item;
802
+ };
803
+ ComponentProps.className = className;
804
+ ComponentProps.style = _objectSpread({}, style);
805
+ }
806
+ ComponentProps.style = _objectSpread(_objectSpread({}, ComponentProps.style), styles.root);
807
+ let InputComponent = 'input';
808
+ if (multiline) {
809
+ InputComponent = 'textarea';
810
+ inputProps.rows = 1;
811
+ type = undefined;
812
+ if (row) {
813
+ if (rows_) {
814
+ styles.input.height = rows_ * row.height;
815
+ styles.inputWrapper.height = rows_ * row.height + row.padding;
816
+ } else {
817
+ styles.input.height = row.height * (0, _utils.clamp)(rows, minRows, maxRows);
818
+ styles.inputWrapper.height = row.height * (0, _utils.clamp)(rows, minRows, maxRows) + row.padding;
819
+ }
702
820
  }
703
- if (!multiline) {
704
- if (props.startVerticalAlign === undefined)
705
- startVerticalAlign = version === 'text' ? 'end' : 'center';
706
- if (props.endVerticalAlign === undefined)
707
- endVerticalAlign = version === 'text' ? 'end' : 'center';
821
+ }
822
+
823
+ // override the input element
824
+ // with a custom value
825
+ if (InputComponent_) InputComponent = InputComponent_;
826
+
827
+ // onInput
828
+ if (!['input', 'textarea'].includes(InputComponent)) {
829
+ inputProps.onInput = onInput;
830
+ }
831
+ const iconProps = {
832
+ size
833
+ };
834
+ const isTypePassword = type === 'password';
835
+ const end = (Array.isArray(end_) ? end_ : [end_]).filter(Boolean);
836
+ if (value && clear) {
837
+ const exists = end === null || end === void 0 ? void 0 : end.find(item => item.key === refs.ids.clear);
838
+ if (!exists) {
839
+ end.push(/*#__PURE__*/_react.default.createElement(IconClear, (0, _extends2.default)({
840
+ key: refs.ids.clear,
841
+ color: "inherit",
842
+ onClick: onClear
843
+ }, IconProps, {
844
+ className: (0, _styleReact.classNames)([IconProps === null || IconProps === void 0 ? void 0 : IconProps.className, classes.clear])
845
+ })));
708
846
  }
709
- const valueWithData = value !== undefined && String(value);
710
- return ((0, jsx_runtime_1.jsxs)(Wrapper, Object.assign({}, WrapperProps, { children: [(0, jsx_runtime_1.jsxs)(Component, Object.assign({ onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onTouchStart: onMouseEnter, onTouchEnd: onMouseLeave, role: 'textbox', "aria-multiline": multiline, "aria-labelledby": refs.ids.label }, ComponentProps, { className: (0, style_react_1.classNames)([
711
- (0, utils_2.staticClassName)('TextField', theme) && [
712
- 'onesy-TextField-root', ,
713
- `onesy-TextField-version-${version}`,
714
- `onesy-TextField-size-${size}`,
715
- multiline && `onesy-TextField-multiline`,
716
- valueWithData && 'onesy-TextField-value',
717
- error && `onesy-TextField-error`,
718
- required && 'onesy-TextField-required',
719
- enabled && 'onesy-TextField-enabled',
720
- hover && `onesy-TextField-hover`,
721
- mouseDown && `onesy-TextField-mouse-down`,
722
- focus && `onesy-TextField-focus`,
723
- readOnly && `onesy-TextField-read-only`,
724
- disabled && 'onesy-TextField-disabled',
725
- fullWidth && 'onesy-full-width'
726
- ],
727
- ComponentProps.className,
728
- classes.root,
729
- classes[`color_${color}`],
730
- fullWidth && classes.fullWidth,
731
- error && (hover ? classes.error_hover_color : classes.error_color),
732
- !footer && disabled && classes.disabled
733
- ]), style: Object.assign({ minWidth }, ComponentProps === null || ComponentProps === void 0 ? void 0 : ComponentProps.style) }, { children: [!minimal && (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [['filled'].includes(version) && ((0, jsx_runtime_1.jsx)("span", { className: (0, style_react_1.classNames)([
734
- (0, utils_2.staticClassName)('TextField', theme) && [
735
- 'onesy-TextField-background'
736
- ],
737
- classes.background,
738
- (enabled || valueWithData || focus) && classes.background_focus,
739
- hover && classes.background_hover
740
- ]), style: styles.background })), ['text', 'filled'].includes(version) && ((0, jsx_runtime_1.jsx)("span", { className: (0, style_react_1.classNames)([
741
- (0, utils_2.staticClassName)('TextField', theme) && [
742
- 'onesy-TextField-border'
743
- ],
744
- classes.border,
745
- focus && classes.border_focus
746
- ]), style: styles.border })), ['outlined'].includes(version) && ((0, jsx_runtime_1.jsx)("fieldset", Object.assign({ className: (0, style_react_1.classNames)([
747
- (0, utils_2.staticClassName)('TextField', theme) && [
748
- 'onesy-TextField-fieldset'
749
- ],
750
- classes.fieldset,
751
- focus && classes.fieldset_focus
752
- ]), style: styles.fieldset }, { children: (0, jsx_runtime_1.jsxs)("legend", Object.assign({ className: (0, style_react_1.classNames)([
753
- (0, utils_2.staticClassName)('TextField', theme) && [
754
- 'onesy-TextField-legend'
755
- ],
756
- classes.legend,
757
- (enabled || valueWithData || focus) && label !== undefined && classes.legend_focus
758
- ]) }, { children: [label, required ? '*' : '', optional ? ` (${optionalText})` : ''] })) })))] }), label && ((0, jsx_runtime_1.jsxs)(Type, Object.assign({ version: 'b2', id: refs.ids.label, Component: 'label', className: (0, style_react_1.classNames)([
759
- (0, utils_2.staticClassName)('TextField', theme) && [
760
- 'onesy-TextField-label'
761
- ],
762
- classes.label,
763
- classes[`label_${multiline ? 'multiline' : 'regular'}`],
764
- classes[`label_version_${version}`],
765
- classes[`label_size_${size}`],
766
- multiline && classes[`label_size_${size}_multiline`],
767
- classes[`label_version_${version}_size_${size}`],
768
- (enabled || valueWithData || focus) && [
769
- classes[`label_focus`],
770
- classes[`label_version_${version}_focus`],
771
- classes[`label_version_${version}_size_${size}${multiline ? '_multiline' : ''}_focus`],
772
- multiline && classes.label_multiline_focus
773
- ],
774
- theme.direction === 'rtl' && classes.label_rtl,
775
- start && [
776
- classes.label_icon_start,
777
- classes[`label_version_${version}_icon_start`]
778
- ]
779
- ]) }, { children: [label, required ? '*' : '', optional ? ` (${optionalText})` : ''] }))), !minimal && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !!react_1.default.Children.toArray(start).length && ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: (0, style_react_1.classNames)([
780
- (0, utils_2.staticClassName)('TextField', theme) && [
781
- 'onesy-TextField-icon',
782
- 'onesy-TextField-icon-start'
783
- ],
784
- classes.icon,
785
- classes.icon_start,
786
- classes[`icon${((_c = (_b = start === null || start === void 0 ? void 0 : start.type) === null || _b === void 0 ? void 0 : _b.displayName) === null || _c === void 0 ? void 0 : _c.includes('IconButton')) ? '_button' : ''}_size_${size}`],
787
- classes[`icon_version_${version}`],
788
- classes[`icon_version_${version}_size_${size}`],
789
- classes[`icon_vertical_align_${startVerticalAlign}`]
790
- ]) }, { children: react_1.default.Children.toArray(start).map((item, index) => {
791
- var _a, _b, _c, _d;
792
- return (react_1.default.cloneElement(item, {
793
- key: index,
794
- size: ((_a = item.props) === null || _a === void 0 ? void 0 : _a.size) !== undefined ? (_b = item.props) === null || _b === void 0 ? void 0 : _b.size : 'regular',
795
- color: ((_c = item.props) === null || _c === void 0 ? void 0 : _c.color) !== undefined ? (_d = item.props) === null || _d === void 0 ? void 0 : _d.color : theme.palette.text.default.secondary,
796
- style: Object.assign(Object.assign({}, item.props.style), styles.icon)
797
- }));
798
- }) }))) }), prefix !== undefined && ((0, jsx_runtime_1.jsx)(Type, Object.assign({ className: (0, style_react_1.classNames)([
799
- (0, utils_2.staticClassName)('TextField', theme) && [
800
- 'onesy-TextField-addition',
801
- 'onesy-TextField-prefix'
802
- ],
803
- classes.addition,
804
- classes.prefix,
805
- (start || version === 'text') && classes.prefix_noStartMargin,
806
- classes[`addition_size_${size}`],
807
- classes[`addition_version_${version}_size_${size}`],
808
- (enabled || valueWithData || focus) && classes.prefix_focus,
809
- noPrefixMargin && classes.noPrefixMargin,
810
- minimal && !label && classes[`addition_without_label_size_${size}`]
811
- ]), version: 'b2' }, { children: prefix }))), (0, jsx_runtime_1.jsxs)("div", Object.assign({}, InputWrapperProps, { className: (0, style_react_1.classNames)([
812
- (0, utils_2.staticClassName)('TextField', theme) && [
813
- 'onesy-TextField-input-wrapper'
814
- ],
815
- classes.inputWrapper,
816
- InputWrapperProps === null || InputWrapperProps === void 0 ? void 0 : InputWrapperProps.className,
817
- (enabled || label === undefined || valueWithData || focus) && classes.inputWrapper_focus,
818
- classes[`input_version_${version}`],
819
- classes[`input_size_${size}`],
820
- classes[`input_version_${version}_size_${size}`],
821
- (prefix || start) && classes.input_start_icon,
822
- (sufix || end) && classes.input_end_icon,
823
- minimal && !label && classes[`inputWrapper_without_label_size_${size}`]
824
- ]), onClick: onInputWrapperClick, onMouseUp: onInputWrapperMouseUp, onMouseDown: onInputWrapperMouseDown, style: Object.assign(Object.assign({}, styles.inputWrapper), InputWrapperProps.style) }, { children: [children, (0, jsx_runtime_1.jsx)(InputComponent, Object.assign({}, inputProps, { ref: item => {
825
- if (ref) {
826
- if ((0, utils_1.is)('function', ref))
827
- ref(item);
828
- else
829
- ref.current = item;
830
- }
831
- refs.input.current = item;
832
- if (inputProps.ref) {
833
- if ((0, utils_1.is)('function', inputProps.ref))
834
- inputProps.ref(item);
835
- else
836
- inputProps.ref.current = item;
837
- }
838
- }, className: (0, style_react_1.classNames)([
839
- (0, utils_2.staticClassName)('TextField', theme) && [
840
- 'onesy-TextField-input'
841
- ],
842
- classes.input,
843
- inputProps === null || inputProps === void 0 ? void 0 : inputProps.className,
844
- multiline && classes.multiline,
845
- align && classes[`input_align_${align}`]
846
- ]), onFocus: onFocus, onBlur: onBlur, placeholder: placeholder, onChange: onUpdate, value: value !== undefined ? value : '', type: type === 'password' && visible ? 'text' : type, autoFocus: autoFocus, autoComplete: autoComplete, readOnly: readOnly, disabled: disabled, style: Object.assign(Object.assign({}, styles.input), inputProps.style) }))] })), sufix !== undefined && ((0, jsx_runtime_1.jsx)(Type, Object.assign({ className: (0, style_react_1.classNames)([
847
- (0, utils_2.staticClassName)('TextField', theme) && [
848
- 'onesy-TextField-addition',
849
- 'onesy-TextField-sufix'
850
- ],
851
- classes.addition,
852
- classes.sufix,
853
- (end || version === 'text') && classes.sufix_noEndMargin,
854
- classes[`addition_size_${size}`],
855
- classes[`addition_version_${version}_size_${size}`],
856
- (enabled || valueWithData || focus) && classes.sufix_focus,
857
- noSufixMargin && classes.noSufixMargin
858
- ]), version: 'b2' }, { children: sufix }))), !minimal && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !!react_1.default.Children.toArray(end).length && ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: (0, style_react_1.classNames)([
859
- (0, utils_2.staticClassName)('TextField', theme) && [
860
- 'onesy-TextField-icon',
861
- 'onesy-TextField-icon-end'
862
- ],
863
- classes.icon,
864
- classes.icon_end,
865
- classes[`icon${((_e = (_d = end === null || end === void 0 ? void 0 : end.type) === null || _d === void 0 ? void 0 : _d.displayName) === null || _e === void 0 ? void 0 : _e.includes('IconButton')) ? '_button' : ''}_size_${size}`],
866
- classes[`icon_version_${version}`],
867
- classes[`icon_version_${version}_size_${size}`],
868
- classes[`icon_vertical_align_${endVerticalAlign}`]
869
- ]) }, { children: react_1.default.Children.toArray(end).map((item, index) => {
870
- var _a, _b, _c, _d;
871
- return (react_1.default.cloneElement(item, {
872
- key: index,
873
- size: ((_a = item.props) === null || _a === void 0 ? void 0 : _a.size) !== undefined ? (_b = item.props) === null || _b === void 0 ? void 0 : _b.size : size,
874
- color: ((_c = item.props) === null || _c === void 0 ? void 0 : _c.color) !== undefined ? (_d = item.props) === null || _d === void 0 ? void 0 : _d.color : error ? theme.palette.light ? theme.palette.color.error[hover ? 20 : 40] : theme.palette.color.error[hover ? 90 : 80] : theme.palette.text.default.secondary,
875
- style: Object.assign(Object.assign({}, item.props.style), styles.icon)
876
- }));
877
- }) }))) })] })), footer && (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(!!helperText || counter !== undefined || required) && ((0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 2, direction: 'row', justify: 'space-between', className: (0, style_react_1.classNames)([
878
- (0, utils_2.staticClassName)('TextField', theme) && [
879
- 'onesy-TextField-footer'
880
- ],
881
- classes.footer,
882
- classes[`footer_version_${version}`]
883
- ]) }, { children: [(helperText || required) && ((0, jsx_runtime_1.jsx)(Type, Object.assign({ version: 'b3' }, HelperTextProps, { className: (0, style_react_1.classNames)([
884
- (0, utils_2.staticClassName)('TextField', theme) && [
885
- 'onesy-TextField-helper-text',
886
- error && 'onesy-TextField-error'
887
- ],
888
- HelperTextProps === null || HelperTextProps === void 0 ? void 0 : HelperTextProps.className,
889
- classes.helperText,
890
- error && classes.error_color
891
- ]) }, { children: helperText !== undefined ? helperText : required ? `*${l('required')}` : '' }))), counter && ((0, jsx_runtime_1.jsxs)(Type, Object.assign({ version: 'b3', className: (0, style_react_1.classNames)([
892
- (0, utils_2.staticClassName)('TextField', theme) && [
893
- 'onesy-TextField-counter'
894
- ],
895
- classes.counterText,
896
- error && classes.error_color
897
- ]) }, { children: [((_f = String(value)) === null || _f === void 0 ? void 0 : _f.length) || 0, "/", counter] })))] }))), footer_] })] })));
847
+ }
848
+ if (value && isTypePassword) {
849
+ end.unshift(/*#__PURE__*/_react.default.createElement(Tooltip, {
850
+ name: visible ? l('Hide password') : l('View password'),
851
+ color: "inverted"
852
+ }, /*#__PURE__*/_react.default.createElement(IconButton, {
853
+ onClick: onToggleVisible,
854
+ color: "default",
855
+ size: size === 'large' ? 'regular' : 'small'
856
+ }, visible ? /*#__PURE__*/_react.default.createElement(_IconMaterialPassword2OffW.default, iconProps) : /*#__PURE__*/_react.default.createElement(_IconMaterialPassword2W.default, iconProps))));
857
+ }
858
+ if (!multiline) {
859
+ if (props.startVerticalAlign === undefined) startVerticalAlign = version === 'text' ? 'end' : 'center';
860
+ if (props.endVerticalAlign === undefined) endVerticalAlign = version === 'text' ? 'end' : 'center';
861
+ }
862
+ const valueWithData = value !== undefined && String(value);
863
+ return /*#__PURE__*/_react.default.createElement(Wrapper, WrapperProps, /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({
864
+ onMouseEnter: onMouseEnter,
865
+ onMouseLeave: onMouseLeave,
866
+ onTouchStart: onMouseEnter,
867
+ onTouchEnd: onMouseLeave,
868
+ role: "textbox",
869
+ "aria-multiline": multiline,
870
+ "aria-labelledby": refs.ids.label
871
+ }, ComponentProps, {
872
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-root',, `onesy-TextField-version-${version}`, `onesy-TextField-size-${size}`, multiline && `onesy-TextField-multiline`, valueWithData && 'onesy-TextField-value', error && `onesy-TextField-error`, required && 'onesy-TextField-required', enabled && 'onesy-TextField-enabled', hover && `onesy-TextField-hover`, mouseDown && `onesy-TextField-mouse-down`, focus && `onesy-TextField-focus`, readOnly && `onesy-TextField-read-only`, disabled && 'onesy-TextField-disabled', fullWidth && 'onesy-full-width'], ComponentProps.className, classes.root, classes[`color_${color}`], fullWidth && classes.fullWidth, error && (hover ? classes.error_hover_color : classes.error_color), !footer && disabled && classes.disabled]),
873
+ style: _objectSpread({
874
+ minWidth
875
+ }, (_ComponentProps = ComponentProps) === null || _ComponentProps === void 0 ? void 0 : _ComponentProps.style)
876
+ }), !minimal && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, ['filled'].includes(version) && /*#__PURE__*/_react.default.createElement("span", {
877
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-background'], classes.background, (enabled || valueWithData || focus) && classes.background_focus, hover && classes.background_hover]),
878
+ style: styles.background
879
+ }), ['text', 'filled'].includes(version) && /*#__PURE__*/_react.default.createElement("span", {
880
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-border'], classes.border, focus && classes.border_focus]),
881
+ style: styles.border
882
+ }), ['outlined'].includes(version) && /*#__PURE__*/_react.default.createElement("fieldset", {
883
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-fieldset'], classes.fieldset, focus && classes.fieldset_focus]),
884
+ style: styles.fieldset
885
+ }, /*#__PURE__*/_react.default.createElement("legend", {
886
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-legend'], classes.legend, (enabled || valueWithData || focus) && label !== undefined && classes.legend_focus])
887
+ }, label, required ? '*' : '', optional ? ` (${optionalText})` : ''))), label && /*#__PURE__*/_react.default.createElement(Type, {
888
+ version: "b2",
889
+ id: refs.ids.label,
890
+ Component: "label",
891
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-label'], classes.label, classes[`label_${multiline ? 'multiline' : 'regular'}`], classes[`label_version_${version}`], classes[`label_size_${size}`], multiline && classes[`label_size_${size}_multiline`], classes[`label_version_${version}_size_${size}`], (enabled || valueWithData || focus) && [classes[`label_focus`], classes[`label_version_${version}_focus`], classes[`label_version_${version}_size_${size}${multiline ? '_multiline' : ''}_focus`], multiline && classes.label_multiline_focus], theme.direction === 'rtl' && classes.label_rtl, start && [classes.label_icon_start, classes[`label_version_${version}_icon_start`]]])
892
+ }, label, required ? '*' : '', optional ? ` (${optionalText})` : ''), !minimal && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !!_react.default.Children.toArray(start).length && /*#__PURE__*/_react.default.createElement("span", {
893
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-icon', 'onesy-TextField-icon-start'], classes.icon, classes.icon_start, classes[`icon${start !== null && start !== void 0 && (_type = start.type) !== null && _type !== void 0 && (_type = _type.displayName) !== null && _type !== void 0 && _type.includes('IconButton') ? '_button' : ''}_size_${size}`], classes[`icon_version_${version}`], classes[`icon_version_${version}_size_${size}`], classes[`icon_vertical_align_${startVerticalAlign}`]])
894
+ }, _react.default.Children.toArray(start).map((item, index) => {
895
+ var _item$props, _item$props2, _item$props3, _item$props4;
896
+ return /*#__PURE__*/_react.default.cloneElement(item, {
897
+ key: index,
898
+ size: ((_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.size) !== undefined ? (_item$props2 = item.props) === null || _item$props2 === void 0 ? void 0 : _item$props2.size : 'regular',
899
+ color: ((_item$props3 = item.props) === null || _item$props3 === void 0 ? void 0 : _item$props3.color) !== undefined ? (_item$props4 = item.props) === null || _item$props4 === void 0 ? void 0 : _item$props4.color : theme.palette.text.default.secondary,
900
+ style: _objectSpread(_objectSpread({}, item.props.style), styles.icon)
901
+ });
902
+ }))), prefix !== undefined && /*#__PURE__*/_react.default.createElement(Type, {
903
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-addition', 'onesy-TextField-prefix'], classes.addition, classes.prefix, (start || version === 'text') && classes.prefix_noStartMargin, classes[`addition_size_${size}`], classes[`addition_version_${version}_size_${size}`], (enabled || valueWithData || focus) && classes.prefix_focus, noPrefixMargin && classes.noPrefixMargin, minimal && !label && classes[`addition_without_label_size_${size}`]]),
904
+ version: "b2"
905
+ }, prefix), /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, InputWrapperProps, {
906
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-input-wrapper'], classes.inputWrapper, InputWrapperProps === null || InputWrapperProps === void 0 ? void 0 : InputWrapperProps.className, (enabled || label === undefined || valueWithData || focus) && classes.inputWrapper_focus, classes[`input_version_${version}`], classes[`input_size_${size}`], classes[`input_version_${version}_size_${size}`], (prefix || start) && classes.input_start_icon, (sufix || end) && classes.input_end_icon, minimal && !label && classes[`inputWrapper_without_label_size_${size}`]]),
907
+ onClick: onInputWrapperClick,
908
+ onMouseUp: onInputWrapperMouseUp,
909
+ onMouseDown: onInputWrapperMouseDown,
910
+ style: _objectSpread(_objectSpread({}, styles.inputWrapper), InputWrapperProps.style)
911
+ }), children, /*#__PURE__*/_react.default.createElement(InputComponent, (0, _extends2.default)({}, inputProps, {
912
+ ref: item => {
913
+ if (ref) {
914
+ if ((0, _utils.is)('function', ref)) ref(item);else ref.current = item;
915
+ }
916
+ refs.input.current = item;
917
+ if (inputProps.ref) {
918
+ if ((0, _utils.is)('function', inputProps.ref)) inputProps.ref(item);else inputProps.ref.current = item;
919
+ }
920
+ },
921
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-input'], classes.input, inputProps === null || inputProps === void 0 ? void 0 : inputProps.className, multiline && classes.multiline, align && classes[`input_align_${align}`]]),
922
+ onFocus: onFocus,
923
+ onBlur: onBlur,
924
+ placeholder: placeholder,
925
+ onChange: onUpdate,
926
+ value: value !== undefined ? value : '',
927
+ type: type === 'password' && visible ? 'text' : type,
928
+ autoFocus: autoFocus,
929
+ autoComplete: autoComplete,
930
+ readOnly: readOnly,
931
+ disabled: disabled,
932
+ style: _objectSpread(_objectSpread({}, styles.input), inputProps.style)
933
+ }))), sufix !== undefined && /*#__PURE__*/_react.default.createElement(Type, {
934
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-addition', 'onesy-TextField-sufix'], classes.addition, classes.sufix, (end || version === 'text') && classes.sufix_noEndMargin, classes[`addition_size_${size}`], classes[`addition_version_${version}_size_${size}`], (enabled || valueWithData || focus) && classes.sufix_focus, noSufixMargin && classes.noSufixMargin]),
935
+ version: "b2"
936
+ }, sufix), !minimal && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !!_react.default.Children.toArray(end).length && /*#__PURE__*/_react.default.createElement("span", {
937
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-icon', 'onesy-TextField-icon-end'], classes.icon, classes.icon_end, classes[`icon${end !== null && end !== void 0 && (_type2 = end.type) !== null && _type2 !== void 0 && (_type2 = _type2.displayName) !== null && _type2 !== void 0 && _type2.includes('IconButton') ? '_button' : ''}_size_${size}`], classes[`icon_version_${version}`], classes[`icon_version_${version}_size_${size}`], classes[`icon_vertical_align_${endVerticalAlign}`]])
938
+ }, _react.default.Children.toArray(end).map((item, index) => {
939
+ var _item$props5, _item$props6, _item$props7, _item$props8;
940
+ return /*#__PURE__*/_react.default.cloneElement(item, {
941
+ key: index,
942
+ size: ((_item$props5 = item.props) === null || _item$props5 === void 0 ? void 0 : _item$props5.size) !== undefined ? (_item$props6 = item.props) === null || _item$props6 === void 0 ? void 0 : _item$props6.size : size,
943
+ color: ((_item$props7 = item.props) === null || _item$props7 === void 0 ? void 0 : _item$props7.color) !== undefined ? (_item$props8 = item.props) === null || _item$props8 === void 0 ? void 0 : _item$props8.color : error ? theme.palette.light ? theme.palette.color.error[hover ? 20 : 40] : theme.palette.color.error[hover ? 90 : 80] : theme.palette.text.default.secondary,
944
+ style: _objectSpread(_objectSpread({}, item.props.style), styles.icon)
945
+ });
946
+ })))), footer && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (!!helperText || counter !== undefined || required) && /*#__PURE__*/_react.default.createElement(Line, {
947
+ gap: 2,
948
+ direction: "row",
949
+ justify: "space-between",
950
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-footer'], classes.footer, classes[`footer_version_${version}`]])
951
+ }, (helperText || required) && /*#__PURE__*/_react.default.createElement(Type, (0, _extends2.default)({
952
+ version: "b3"
953
+ }, HelperTextProps, {
954
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-helper-text', error && 'onesy-TextField-error'], HelperTextProps === null || HelperTextProps === void 0 ? void 0 : HelperTextProps.className, classes.helperText, error && classes.error_color])
955
+ }), helperText !== undefined ? helperText : required ? `*${l('required')}` : ''), counter && /*#__PURE__*/_react.default.createElement(Type, {
956
+ version: "b3",
957
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TextField', theme) && ['onesy-TextField-counter'], classes.counterText, error && classes.error_color])
958
+ }, ((_String = String(value)) === null || _String === void 0 ? void 0 : _String.length) || 0, "/", counter)), footer_));
898
959
  });
899
960
  TextField.displayName = 'onesy-TextField';
900
- exports.default = TextField;
961
+ var _default = exports.default = TextField;