@xjur-ui/react 1.0.6 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (336) hide show
  1. package/.turbo/turbo-build.log +279 -68
  2. package/CHANGELOG.md +114 -0
  3. package/README.md +146 -0
  4. package/dist/chunk-2CM3SFOY.js +2 -0
  5. package/dist/chunk-2CM3SFOY.js.map +1 -0
  6. package/dist/chunk-2CTBH6VI.js +2 -0
  7. package/dist/chunk-2CTBH6VI.js.map +1 -0
  8. package/dist/chunk-4BGTC333.js +2 -0
  9. package/dist/chunk-4BGTC333.js.map +1 -0
  10. package/dist/chunk-5WLIDYZH.js +2 -0
  11. package/dist/chunk-5WLIDYZH.js.map +1 -0
  12. package/dist/chunk-6AD6O6II.js +2 -0
  13. package/dist/chunk-6AD6O6II.js.map +1 -0
  14. package/dist/chunk-AA6V5YEC.js +2 -0
  15. package/dist/chunk-AA6V5YEC.js.map +1 -0
  16. package/dist/chunk-BK6FP63A.js +2 -0
  17. package/dist/chunk-BK6FP63A.js.map +1 -0
  18. package/dist/chunk-BZDGWC5O.js +2 -0
  19. package/dist/chunk-BZDGWC5O.js.map +1 -0
  20. package/dist/chunk-CBFC4QME.js +2 -0
  21. package/dist/chunk-CBFC4QME.js.map +1 -0
  22. package/dist/chunk-CI3ZXWEX.js +2 -0
  23. package/dist/chunk-CI3ZXWEX.js.map +1 -0
  24. package/dist/chunk-DFXHNK5D.js +2 -0
  25. package/dist/chunk-DFXHNK5D.js.map +1 -0
  26. package/dist/chunk-EIG6CBTQ.js +2 -0
  27. package/dist/chunk-EIG6CBTQ.js.map +1 -0
  28. package/dist/chunk-EXC2XOL6.js +2 -0
  29. package/dist/chunk-EXC2XOL6.js.map +1 -0
  30. package/dist/chunk-F4DYKYWJ.js +2 -0
  31. package/dist/chunk-F4DYKYWJ.js.map +1 -0
  32. package/dist/chunk-F5ZLEQGN.js +2 -0
  33. package/dist/chunk-F5ZLEQGN.js.map +1 -0
  34. package/dist/chunk-IKL6PSXU.js +2 -0
  35. package/dist/chunk-IKL6PSXU.js.map +1 -0
  36. package/dist/chunk-IRHU7PDO.js +2 -0
  37. package/dist/chunk-IRHU7PDO.js.map +1 -0
  38. package/dist/chunk-J4X5RQTR.js +2 -0
  39. package/dist/chunk-J4X5RQTR.js.map +1 -0
  40. package/dist/chunk-KIFR5VIE.js +2 -0
  41. package/dist/chunk-KIFR5VIE.js.map +1 -0
  42. package/dist/chunk-KS6WGBHQ.js +2 -0
  43. package/dist/chunk-KS6WGBHQ.js.map +1 -0
  44. package/dist/chunk-L4ET6GIZ.js +2 -0
  45. package/dist/chunk-L4ET6GIZ.js.map +1 -0
  46. package/dist/chunk-MZSV4LNY.js +2 -0
  47. package/dist/chunk-MZSV4LNY.js.map +1 -0
  48. package/dist/chunk-NELCN6E2.js +2 -0
  49. package/dist/chunk-NELCN6E2.js.map +1 -0
  50. package/dist/chunk-OS53BV63.js +3 -0
  51. package/dist/chunk-OS53BV63.js.map +1 -0
  52. package/dist/chunk-PKCW37CJ.js +2 -0
  53. package/dist/chunk-PKCW37CJ.js.map +1 -0
  54. package/dist/chunk-RWMV7APX.js +2 -0
  55. package/dist/chunk-RWMV7APX.js.map +1 -0
  56. package/dist/chunk-SLAAEXWI.js +2 -0
  57. package/dist/chunk-SLAAEXWI.js.map +1 -0
  58. package/dist/chunk-SXGSWVMZ.js +2 -0
  59. package/dist/chunk-SXGSWVMZ.js.map +1 -0
  60. package/dist/chunk-TB6KI6CL.js +2 -0
  61. package/dist/chunk-TB6KI6CL.js.map +1 -0
  62. package/dist/chunk-TSVURBUY.js +2 -0
  63. package/dist/chunk-TSVURBUY.js.map +1 -0
  64. package/dist/chunk-UXIVZWLB.js +2 -0
  65. package/dist/chunk-UXIVZWLB.js.map +1 -0
  66. package/dist/chunk-WEBAXQID.js +2 -0
  67. package/dist/chunk-WEBAXQID.js.map +1 -0
  68. package/dist/chunk-WV7QV2PU.js +2 -0
  69. package/dist/chunk-WV7QV2PU.js.map +1 -0
  70. package/dist/chunk-Z47R2CIM.js +2 -0
  71. package/dist/chunk-Z47R2CIM.js.map +1 -0
  72. package/dist/chunk-ZVVPUP7V.js +2 -0
  73. package/dist/chunk-ZVVPUP7V.js.map +1 -0
  74. package/dist/components/avatar-group.js +2 -179
  75. package/dist/components/avatar-group.js.map +1 -0
  76. package/dist/components/avatar.js +2 -59
  77. package/dist/components/avatar.js.map +1 -0
  78. package/dist/components/badge.js +2 -111
  79. package/dist/components/badge.js.map +1 -0
  80. package/dist/components/breadcrumb.d.ts +20 -0
  81. package/dist/components/breadcrumb.js +2 -0
  82. package/dist/components/breadcrumb.js.map +1 -0
  83. package/dist/components/chip.d.ts +5 -2
  84. package/dist/components/chip.js +2 -256
  85. package/dist/components/chip.js.map +1 -0
  86. package/dist/components/collapsible.js +2 -41
  87. package/dist/components/collapsible.js.map +1 -0
  88. package/dist/components/dialog.d.ts +51 -0
  89. package/dist/components/dialog.js +2 -0
  90. package/dist/components/dialog.js.map +1 -0
  91. package/dist/components/divider.js +2 -29
  92. package/dist/components/divider.js.map +1 -0
  93. package/dist/components/drag-and-drop/drag-handle.d.ts +15 -0
  94. package/dist/components/drag-and-drop/drag-handle.js +2 -0
  95. package/dist/components/drag-and-drop/drag-handle.js.map +1 -0
  96. package/dist/components/drag-and-drop/drag-list-item.d.ts +14 -0
  97. package/dist/components/drag-and-drop/drag-list-item.js +2 -0
  98. package/dist/components/drag-and-drop/drag-list-item.js.map +1 -0
  99. package/dist/components/drag-and-drop/drag-list.d.ts +14 -0
  100. package/dist/components/drag-and-drop/drag-list.js +2 -0
  101. package/dist/components/drag-and-drop/drag-list.js.map +1 -0
  102. package/dist/components/drag-and-drop/drag-root.d.ts +6 -0
  103. package/dist/components/drag-and-drop/drag-root.js +2 -0
  104. package/dist/components/drag-and-drop/drag-root.js.map +1 -0
  105. package/dist/components/drag-and-drop/index.d.ts +10 -0
  106. package/dist/components/drag-and-drop/index.js +2 -0
  107. package/dist/components/drag-and-drop/index.js.map +1 -0
  108. package/dist/components/drag-and-drop/types/drag-item.d.ts +9 -0
  109. package/dist/components/drag-and-drop/types/drag-item.js +2 -0
  110. package/dist/components/drag-and-drop/types/drag-item.js.map +1 -0
  111. package/dist/components/dropdown-menu.js +2 -295
  112. package/dist/components/dropdown-menu.js.map +1 -0
  113. package/dist/components/form/button.js +2 -0
  114. package/dist/components/form/button.js.map +1 -0
  115. package/dist/components/form/calendar.js +2 -0
  116. package/dist/components/form/calendar.js.map +1 -0
  117. package/dist/components/form/checkbox.js +2 -0
  118. package/dist/components/form/checkbox.js.map +1 -0
  119. package/dist/components/form/context/field.context.d.ts +15 -0
  120. package/dist/components/form/context/field.context.js +2 -0
  121. package/dist/components/form/context/field.context.js.map +1 -0
  122. package/dist/components/form/date-picker.d.ts +84 -0
  123. package/dist/components/form/date-picker.js +2 -0
  124. package/dist/components/form/date-picker.js.map +1 -0
  125. package/dist/components/form/floating-label.d.ts +6 -0
  126. package/dist/components/form/floating-label.js +2 -0
  127. package/dist/components/form/floating-label.js.map +1 -0
  128. package/dist/components/form/input.d.ts +95 -0
  129. package/dist/components/form/input.js +2 -0
  130. package/dist/components/form/input.js.map +1 -0
  131. package/dist/components/form/otp-input.js +2 -0
  132. package/dist/components/form/otp-input.js.map +1 -0
  133. package/dist/components/form/radio.js +2 -0
  134. package/dist/components/form/radio.js.map +1 -0
  135. package/dist/components/{rich-editor.d.ts → form/rich-editor.d.ts} +2 -1
  136. package/dist/components/form/rich-editor.js +2 -0
  137. package/dist/components/form/rich-editor.js.map +1 -0
  138. package/dist/components/form/search-input.js +2 -0
  139. package/dist/components/form/search-input.js.map +1 -0
  140. package/dist/components/form/select.d.ts +94 -0
  141. package/dist/components/form/select.js +2 -0
  142. package/dist/components/form/select.js.map +1 -0
  143. package/dist/components/form/switch.js +2 -0
  144. package/dist/components/form/switch.js.map +1 -0
  145. package/dist/components/full-calendar/calendar-add-event.d.ts +9 -0
  146. package/dist/components/full-calendar/calendar-add-event.js +2 -0
  147. package/dist/components/full-calendar/calendar-add-event.js.map +1 -0
  148. package/dist/components/full-calendar/calendar-body.d.ts +6 -0
  149. package/dist/components/full-calendar/calendar-body.js +2 -0
  150. package/dist/components/full-calendar/calendar-body.js.map +1 -0
  151. package/dist/components/full-calendar/calendar-cell.d.ts +11 -0
  152. package/dist/components/full-calendar/calendar-cell.js +2 -0
  153. package/dist/components/full-calendar/calendar-cell.js.map +1 -0
  154. package/dist/components/full-calendar/calendar-day-view.d.ts +5 -0
  155. package/dist/components/full-calendar/calendar-day-view.js +2 -0
  156. package/dist/components/full-calendar/calendar-day-view.js.map +1 -0
  157. package/dist/components/full-calendar/calendar-event.d.ts +18 -0
  158. package/dist/components/full-calendar/calendar-event.js +2 -0
  159. package/dist/components/full-calendar/calendar-event.js.map +1 -0
  160. package/dist/components/full-calendar/calendar-header.d.ts +6 -0
  161. package/dist/components/full-calendar/calendar-header.js +2 -0
  162. package/dist/components/full-calendar/calendar-header.js.map +1 -0
  163. package/dist/components/full-calendar/calendar-month-view.d.ts +5 -0
  164. package/dist/components/full-calendar/calendar-month-view.js +2 -0
  165. package/dist/components/full-calendar/calendar-month-view.js.map +1 -0
  166. package/dist/components/full-calendar/calendar-more-events-dropdown.d.ts +9 -0
  167. package/dist/components/full-calendar/calendar-more-events-dropdown.js +2 -0
  168. package/dist/components/full-calendar/calendar-more-events-dropdown.js.map +1 -0
  169. package/dist/components/full-calendar/calendar-navigator.d.ts +5 -0
  170. package/dist/components/full-calendar/calendar-navigator.js +2 -0
  171. package/dist/components/full-calendar/calendar-navigator.js.map +1 -0
  172. package/dist/components/full-calendar/calendar-root.d.ts +30 -0
  173. package/dist/components/full-calendar/calendar-root.js +2 -0
  174. package/dist/components/full-calendar/calendar-root.js.map +1 -0
  175. package/dist/components/full-calendar/calendar-today-button.d.ts +9 -0
  176. package/dist/components/full-calendar/calendar-today-button.js +2 -0
  177. package/dist/components/full-calendar/calendar-today-button.js.map +1 -0
  178. package/dist/components/full-calendar/calendar-toggle-view.d.ts +5 -0
  179. package/dist/components/full-calendar/calendar-toggle-view.js +2 -0
  180. package/dist/components/full-calendar/calendar-toggle-view.js.map +1 -0
  181. package/dist/components/full-calendar/calendar-view-renderer.d.ts +5 -0
  182. package/dist/components/full-calendar/calendar-view-renderer.js +2 -0
  183. package/dist/components/full-calendar/calendar-view-renderer.js.map +1 -0
  184. package/dist/components/full-calendar/calendar-week-day.d.ts +10 -0
  185. package/dist/components/full-calendar/calendar-week-day.js +2 -0
  186. package/dist/components/full-calendar/calendar-week-day.js.map +1 -0
  187. package/dist/components/full-calendar/calendar-week-view.d.ts +5 -0
  188. package/dist/components/full-calendar/calendar-week-view.js +2 -0
  189. package/dist/components/full-calendar/calendar-week-view.js.map +1 -0
  190. package/dist/components/full-calendar/helpers/calendar.d.ts +25 -0
  191. package/dist/components/full-calendar/helpers/calendar.js +2 -0
  192. package/dist/components/full-calendar/helpers/calendar.js.map +1 -0
  193. package/dist/components/full-calendar/index.d.ts +18 -0
  194. package/dist/components/full-calendar/index.js +2 -0
  195. package/dist/components/full-calendar/index.js.map +1 -0
  196. package/dist/components/full-calendar/types/calendar-cell.d.ts +6 -0
  197. package/dist/components/full-calendar/types/calendar-cell.js +2 -0
  198. package/dist/components/full-calendar/types/calendar-cell.js.map +1 -0
  199. package/dist/components/full-calendar/types/calendar-event.d.ts +8 -0
  200. package/dist/components/full-calendar/types/calendar-event.js +2 -0
  201. package/dist/components/full-calendar/types/calendar-event.js.map +1 -0
  202. package/dist/components/full-calendar/types/calendar-view.d.ts +3 -0
  203. package/dist/components/full-calendar/types/calendar-view.js +2 -0
  204. package/dist/components/full-calendar/types/calendar-view.js.map +1 -0
  205. package/dist/components/full-calendar/types/calendar-week-hour.d.ts +6 -0
  206. package/dist/components/full-calendar/types/calendar-week-hour.js +2 -0
  207. package/dist/components/full-calendar/types/calendar-week-hour.js.map +1 -0
  208. package/dist/components/horizontal-scroll.d.ts +11 -0
  209. package/dist/components/horizontal-scroll.js +2 -0
  210. package/dist/components/horizontal-scroll.js.map +1 -0
  211. package/dist/components/icon.d.ts +3 -4
  212. package/dist/components/icon.js +2 -177
  213. package/dist/components/icon.js.map +1 -0
  214. package/dist/components/list.js +2 -179
  215. package/dist/components/list.js.map +1 -0
  216. package/dist/components/logo.js +2 -324
  217. package/dist/components/logo.js.map +1 -0
  218. package/dist/components/selection-bar.d.ts +57 -0
  219. package/dist/components/selection-bar.js +2 -0
  220. package/dist/components/selection-bar.js.map +1 -0
  221. package/dist/components/sheet.d.ts +8 -8
  222. package/dist/components/sheet.js +2 -251
  223. package/dist/components/sheet.js.map +1 -0
  224. package/dist/components/skeleton.js +2 -16
  225. package/dist/components/skeleton.js.map +1 -0
  226. package/dist/components/status.js +2 -111
  227. package/dist/components/status.js.map +1 -0
  228. package/dist/components/table.js +2 -196
  229. package/dist/components/table.js.map +1 -0
  230. package/dist/components/tabs.d.ts +9 -6
  231. package/dist/components/tabs.js +2 -54
  232. package/dist/components/tabs.js.map +1 -0
  233. package/dist/components/tag.d.ts +5 -2
  234. package/dist/components/tag.js +2 -189
  235. package/dist/components/tag.js.map +1 -0
  236. package/dist/components/tooltip.js +2 -58
  237. package/dist/components/tooltip.js.map +1 -0
  238. package/dist/components/typography.js +2 -78
  239. package/dist/components/typography.js.map +1 -0
  240. package/dist/components/upload.d.ts +74 -0
  241. package/dist/components/upload.js +2 -0
  242. package/dist/components/upload.js.map +1 -0
  243. package/dist/hooks/index.d.ts +7 -0
  244. package/dist/hooks/index.js +2 -0
  245. package/dist/hooks/index.js.map +1 -0
  246. package/dist/icons-CmDuL0gZ.d.ts +4 -0
  247. package/dist/index.css +2 -2322
  248. package/dist/index.css.map +1 -0
  249. package/dist/logo-PQRZORCS.js +3 -0
  250. package/dist/logo-PQRZORCS.js.map +1 -0
  251. package/package.json +60 -18
  252. package/src/components/breadcrumb.tsx +119 -0
  253. package/src/components/chip.tsx +11 -3
  254. package/src/components/dialog.tsx +242 -0
  255. package/src/components/drag-and-drop/drag-handle.tsx +46 -0
  256. package/src/components/drag-and-drop/drag-list-item.tsx +91 -0
  257. package/src/components/drag-and-drop/drag-list.tsx +47 -0
  258. package/src/components/drag-and-drop/drag-root.tsx +30 -0
  259. package/src/components/drag-and-drop/index.ts +39 -0
  260. package/src/components/drag-and-drop/types/drag-item.ts +7 -0
  261. package/src/components/{calendar.tsx → form/calendar.tsx} +9 -8
  262. package/src/components/{checkbox.tsx → form/checkbox.tsx} +2 -2
  263. package/src/components/form/context/field.context.ts +27 -0
  264. package/src/components/form/date-picker.tsx +199 -0
  265. package/src/components/form/floating-label.tsx +60 -0
  266. package/src/components/form/input.tsx +235 -0
  267. package/src/components/{radio.tsx → form/radio.tsx} +1 -1
  268. package/src/components/{rich-editor.tsx → form/rich-editor.tsx} +10 -9
  269. package/src/components/{search-input.tsx → form/search-input.tsx} +2 -2
  270. package/src/components/form/select.tsx +274 -0
  271. package/src/components/full-calendar/calendar-add-event.tsx +15 -0
  272. package/src/components/full-calendar/calendar-body.tsx +12 -0
  273. package/src/components/full-calendar/calendar-cell.tsx +120 -0
  274. package/src/components/full-calendar/calendar-day-view.tsx +76 -0
  275. package/src/components/full-calendar/calendar-event.tsx +178 -0
  276. package/src/components/full-calendar/calendar-header.tsx +14 -0
  277. package/src/components/full-calendar/calendar-month-view.tsx +69 -0
  278. package/src/components/full-calendar/calendar-more-events-dropdown.tsx +39 -0
  279. package/src/components/full-calendar/calendar-navigator.tsx +86 -0
  280. package/src/components/full-calendar/calendar-root.tsx +165 -0
  281. package/src/components/full-calendar/calendar-today-button.tsx +21 -0
  282. package/src/components/full-calendar/calendar-toggle-view.tsx +61 -0
  283. package/src/components/full-calendar/calendar-view-renderer.tsx +19 -0
  284. package/src/components/full-calendar/calendar-week-day.tsx +49 -0
  285. package/src/components/full-calendar/calendar-week-view.tsx +88 -0
  286. package/src/components/full-calendar/helpers/calendar.ts +158 -0
  287. package/src/components/full-calendar/index.ts +16 -0
  288. package/src/components/full-calendar/types/calendar-cell.ts +4 -0
  289. package/src/components/full-calendar/types/calendar-event.ts +7 -0
  290. package/src/components/full-calendar/types/calendar-view.ts +1 -0
  291. package/src/components/full-calendar/types/calendar-week-hour.ts +4 -0
  292. package/src/components/horizontal-scroll.tsx +159 -0
  293. package/src/components/icon.tsx +1 -1
  294. package/src/components/logo.tsx +25 -20
  295. package/src/components/selection-bar.tsx +273 -0
  296. package/src/components/sheet.tsx +2 -2
  297. package/src/components/tabs.tsx +56 -37
  298. package/src/components/tag.tsx +11 -3
  299. package/src/components/upload.tsx +647 -0
  300. package/src/index.css +2 -2
  301. package/src/resources/icons.ts +4 -1
  302. package/src/resources/logo/index.tsx +33 -0
  303. package/tsup.config.ts +23 -5
  304. package/dist/components/button.js +0 -98
  305. package/dist/components/calendar.js +0 -751
  306. package/dist/components/checkbox.js +0 -153
  307. package/dist/components/date-picker.d.ts +0 -20
  308. package/dist/components/date-picker.js +0 -232
  309. package/dist/components/input.d.ts +0 -32
  310. package/dist/components/input.js +0 -315
  311. package/dist/components/otp-input.js +0 -47
  312. package/dist/components/radio.js +0 -156
  313. package/dist/components/rich-editor.js +0 -723
  314. package/dist/components/search-input.js +0 -274
  315. package/dist/components/select.d.ts +0 -33
  316. package/dist/components/select.js +0 -550
  317. package/dist/components/switch.js +0 -36
  318. package/dist/components/test.d.ts +0 -5
  319. package/dist/components/test.js +0 -8
  320. package/dist/index.js +0 -0
  321. package/src/components/date-picker.tsx +0 -160
  322. package/src/components/input.tsx +0 -256
  323. package/src/components/select.tsx +0 -240
  324. package/src/components/test.tsx +0 -3
  325. package/src/index.ts +0 -1
  326. package/src/resources/logo/index.ts +0 -3
  327. /package/dist/components/{button.d.ts → form/button.d.ts} +0 -0
  328. /package/dist/components/{calendar.d.ts → form/calendar.d.ts} +0 -0
  329. /package/dist/components/{checkbox.d.ts → form/checkbox.d.ts} +0 -0
  330. /package/dist/components/{otp-input.d.ts → form/otp-input.d.ts} +0 -0
  331. /package/dist/components/{radio.d.ts → form/radio.d.ts} +0 -0
  332. /package/dist/components/{search-input.d.ts → form/search-input.d.ts} +0 -0
  333. /package/dist/components/{switch.d.ts → form/switch.d.ts} +0 -0
  334. /package/src/components/{button.tsx → form/button.tsx} +0 -0
  335. /package/src/components/{otp-input.tsx → form/otp-input.tsx} +0 -0
  336. /package/src/components/{switch.tsx → form/switch.tsx} +0 -0
@@ -1,7 +1,7 @@
1
1
  import * as CheckoxPrimitive from '@radix-ui/react-checkbox'
2
2
  import { cx } from '@xjur-ui/util'
3
- import { Icon } from './icon'
4
- import { Typography } from './typography'
3
+ import { Icon } from '../icon'
4
+ import { Typography } from '../typography'
5
5
 
6
6
  export function Checkbox({
7
7
  label,
@@ -0,0 +1,27 @@
1
+ import { createContext, useContext } from 'react'
2
+ import type { MaskOptions } from '@react-input/mask'
3
+ import type { InputMaskType } from '../../../resources/input-mask'
4
+
5
+ export interface FieldContextValue {
6
+ state?: 'normal' | 'error' | 'disabled'
7
+ variant?: 'normal' | 'filter'
8
+ customMask?: MaskOptions
9
+ mask?: InputMaskType
10
+ }
11
+
12
+ export const FieldContext = createContext<FieldContextValue>({
13
+ state: 'normal',
14
+ variant: 'normal',
15
+ customMask: undefined,
16
+ mask: undefined
17
+ })
18
+
19
+ export function useFieldContext() {
20
+ const context = useContext(FieldContext)
21
+ if (!context) {
22
+ throw new Error(
23
+ 'useFieldContext must be used within a InputRoot, SelectRoot, DatePickerRoot, etc.'
24
+ )
25
+ }
26
+ return context
27
+ }
@@ -0,0 +1,199 @@
1
+ import { tv, twJoin, twMerge } from '@xjur-ui/util'
2
+ import { useMemo, type ComponentProps } from 'react'
3
+ import * as RadixPopover from '@radix-ui/react-popover'
4
+ import { Icon, type IconType } from '../icon'
5
+ import { Typography } from '../typography'
6
+ import {
7
+ FieldContext,
8
+ useFieldContext,
9
+ type FieldContextValue
10
+ } from './context/field.context'
11
+ import { FloatingLabel } from './floating-label'
12
+
13
+ export const datePicker = tv({
14
+ slots: {
15
+ wrapper: 'group flex w-full flex-col gap-small-2x',
16
+ trigger: [
17
+ 'h-large-4x w-full cursor-pointer relative',
18
+ 'flex items-center gap-small rounded-small-1x',
19
+ 'py-small_1x-alt px-small',
20
+ 'bg-layer-2-hover border border-transparent',
21
+ 'group-has-[div[data-slot=input-action-slot]]:rounded-r-none',
22
+ 'transition-all duration-200'
23
+ ],
24
+ content: [
25
+ 'group z-10 max-h-[var(--radix-popover-content-available-height)] max-w-[var(--radix-popover-content-available-width)] min-w-[var(--radix-popover-trigger-width)]'
26
+ ],
27
+ icon: 'size-large text-icon-neutral-3 flex items-center justify-center',
28
+ slotText:
29
+ 'size-large flex items-center justify-center !text-size-label-md text-neutral-placeholder',
30
+ caption: '!text-size-body-sm font-normal'
31
+ },
32
+ variants: {
33
+ state: {
34
+ normal: {
35
+ trigger:
36
+ 'hover:border-border-layer-1 data-[state=open]:border-primary-idle data-[state=open]:hover:border-primary-idle'
37
+ },
38
+ error: {
39
+ trigger:
40
+ 'border-danger-idle hover:border-danger-idle data-[state=open]:border-danger-idle data-[state=open]:hover:border-danger-idle',
41
+ caption: 'text-danger-label-idle'
42
+ },
43
+ disabled: {
44
+ trigger: 'pointer-events-none border-transparent bg-layer-2-idle'
45
+ }
46
+ }
47
+ }
48
+ })
49
+
50
+ const { wrapper, trigger, icon, caption, slotText, content } = datePicker()
51
+
52
+ export function DatePickerRoot({
53
+ className,
54
+ state = 'normal',
55
+ defaultOpen,
56
+ variant = 'normal',
57
+ modal,
58
+ open,
59
+ onOpenChange: handleOpenChange,
60
+ ...props
61
+ }: ComponentProps<'div'> &
62
+ FieldContextValue &
63
+ ComponentProps<typeof RadixPopover.Root>) {
64
+ return (
65
+ <RadixPopover.Root
66
+ defaultOpen={defaultOpen}
67
+ modal={modal}
68
+ open={open}
69
+ onOpenChange={handleOpenChange}
70
+ >
71
+ <FieldContext.Provider value={{ state, variant }}>
72
+ <div className={wrapper({ className, state })} {...props} />
73
+ </FieldContext.Provider>
74
+ </RadixPopover.Root>
75
+ )
76
+ }
77
+
78
+ export function DatePickerTrigger({
79
+ className,
80
+ ...props
81
+ }: ComponentProps<typeof RadixPopover.Trigger>) {
82
+ const { state, variant } = useFieldContext()
83
+
84
+ const filterTrigger = tv({
85
+ base: ['group bg-layer-2-idle relative'],
86
+ variants: {
87
+ state: {
88
+ normal: [
89
+ 'border-border-layer-2 hover:border-border-layer-3 has-[input:not(:placeholder-shown)]:border-primary-idle'
90
+ ],
91
+ error: ['border-danger-idle hover:border-danger-idle'],
92
+ disabled: ['border border-border-layer-2 opacity-60']
93
+ }
94
+ }
95
+ })
96
+
97
+ const mergedClassName = twMerge(
98
+ trigger({ state, className }),
99
+ variant === 'filter' && filterTrigger({ state, className })
100
+ )
101
+
102
+ return (
103
+ <RadixPopover.Trigger
104
+ className={mergedClassName}
105
+ disabled={state === 'disabled'}
106
+ {...props}
107
+ />
108
+ )
109
+ }
110
+
111
+ export function DatePickerLabel(props: ComponentProps<typeof FloatingLabel>) {
112
+ return <FloatingLabel {...props} />
113
+ }
114
+
115
+ export function DatePickerIcon({
116
+ className,
117
+ name,
118
+ ...props
119
+ }: ComponentProps<'div'> & {
120
+ name: IconType
121
+ }) {
122
+ const { state } = useFieldContext()
123
+
124
+ return (
125
+ <div className={icon({ className, state })} {...props}>
126
+ <Icon name={name} />
127
+ </div>
128
+ )
129
+ }
130
+
131
+ export function DatePickerSlot({
132
+ className,
133
+ ...props
134
+ }: ComponentProps<'span'>) {
135
+ const { state } = useFieldContext()
136
+ return <span className={slotText({ className, state })} {...props} />
137
+ }
138
+
139
+ export function DatePickerValue({
140
+ className,
141
+ displayValue = '',
142
+ value,
143
+ ...props
144
+ }: ComponentProps<'input'> & { displayValue?: string }) {
145
+ const { variant } = useFieldContext()
146
+
147
+ const valueOrPlaceholder = useMemo(() => {
148
+ if (variant === 'filter') return displayValue
149
+ return displayValue || props.placeholder
150
+ }, [displayValue, props.placeholder, variant])
151
+
152
+ return (
153
+ <>
154
+ <Typography className="text-neutral-dark group-has-[div[data-slot=date-picker-left-slot]]:pl-large-1x">
155
+ {valueOrPlaceholder}
156
+ </Typography>
157
+
158
+ <input
159
+ {...props}
160
+ aria-readonly={true}
161
+ className={twJoin('pointer-events-none', className)}
162
+ hidden={true}
163
+ placeholder={' '}
164
+ readOnly={true}
165
+ value={value ?? ''}
166
+ />
167
+ </>
168
+ )
169
+ }
170
+
171
+ export function DatePickerContent({
172
+ className,
173
+ sideOffset = 5,
174
+ side = 'bottom',
175
+ align = 'start',
176
+ ...props
177
+ }: ComponentProps<typeof RadixPopover.Content>) {
178
+ const { state } = useFieldContext()
179
+
180
+ return (
181
+ <RadixPopover.Portal>
182
+ <RadixPopover.Content
183
+ align={align}
184
+ className={content({ className, state })}
185
+ side={side}
186
+ sideOffset={sideOffset}
187
+ {...props}
188
+ />
189
+ </RadixPopover.Portal>
190
+ )
191
+ }
192
+
193
+ export function DatePickerCaption({
194
+ className,
195
+ ...props
196
+ }: ComponentProps<'p'>) {
197
+ const { state } = useFieldContext()
198
+ return <p className={caption({ className, state })} {...props} />
199
+ }
@@ -0,0 +1,60 @@
1
+ import type { ComponentProps } from 'react'
2
+ import { tv } from '@xjur-ui/util'
3
+ import { useFieldContext } from './context/field.context'
4
+
5
+ export function FloatingLabel({
6
+ className,
7
+ htmlFor,
8
+ children,
9
+ ...props
10
+ }: ComponentProps<'label'>) {
11
+ const { state } = useFieldContext()
12
+
13
+ const label = tv({
14
+ base: [
15
+ 'group inline-block max-w-full truncate text-left',
16
+ 'ease animate-in left-small right-small pointer-events-none absolute top-1/2 -translate-y-1/2 transition-all duration-250',
17
+ 'text-size-body-md',
18
+ // Filled
19
+ 'group-focus-within:-top-[3px]',
20
+ 'group-data-[state=open]:-top-[3px]',
21
+
22
+ 'group-focus-within:text-size-label-sm-1x group-focus-within:font-medium',
23
+ 'group-data-[state=open]:text-size-label-sm-1x group-data-[state=open]:font-medium',
24
+
25
+ 'group-has-[input:not(:placeholder-shown)]:-top-[3px]',
26
+ 'group-has-[input:not(:placeholder-shown)]:text-size-label-sm-1x',
27
+ 'group-has-[input:not(:placeholder-shown)]:font-medium',
28
+ // If has left slot
29
+ 'group-has-[div[data-slot=control-slot]]:left-large-4x',
30
+ 'group-has-[div[data-slot=control-slot]]:group-focus-within:left-small',
31
+ 'group-has-[div[data-slot=control-slot]]:group-has-[input:not(:placeholder-shown)]:left-small',
32
+ 'group-has-[div[data-slot=control-slot]]:group-data-[state=open]:left-small',
33
+ // Animate
34
+ 'group-focus-within:animate-in',
35
+ 'group-has-[input:not(:placeholder-shown)]:animate-out',
36
+ 'data-[disabled=true]:hidden'
37
+ ],
38
+ variants: {
39
+ state: {
40
+ normal: [
41
+ 'group-focus-within:!text-primary-idle group-data-[state=open]:!text-primary-idle',
42
+ 'group-has-[input:not(:placeholder-shown)]:!text-primary-idle'
43
+ ],
44
+ error: [
45
+ 'group-focus-within:!text-danger-label-active group-data-[state=open]:!text-danger-label-active',
46
+ 'group-has-[input:not(:placeholder-shown)]:!text-danger-label-active'
47
+ ],
48
+ disabled: []
49
+ }
50
+ }
51
+ })
52
+
53
+ return (
54
+ <label className={label({ className, state })} htmlFor={htmlFor} {...props}>
55
+ <span className="rounded-small-1x bg-layer-2-idle max-w-full">
56
+ {children}
57
+ </span>
58
+ </label>
59
+ )
60
+ }
@@ -0,0 +1,235 @@
1
+ import { tv, twMerge } from '@xjur-ui/util'
2
+ import type { ComponentProps } from 'react'
3
+ import { InputMask as InputMaskComponent } from '@react-input/mask'
4
+ import {
5
+ InputNumberFormat,
6
+ type InputNumberFormatProps
7
+ } from '@react-input/number-format'
8
+ import { Icon, type IconType } from '../icon'
9
+ import { inputMask } from '../../resources/input-mask'
10
+ import { Divider } from '../divider'
11
+ import {
12
+ type FieldContextValue,
13
+ FieldContext,
14
+ useFieldContext
15
+ } from './context/field.context'
16
+ import { FloatingLabel } from './floating-label'
17
+
18
+ export const input = tv({
19
+ slots: {
20
+ wrapper: 'group flex w-full flex-col gap-small-2x',
21
+ trigger: [
22
+ 'h-large-4x w-full relative',
23
+ 'flex items-center gap-small rounded-small-1x',
24
+ 'py-small_1x-alt px-small',
25
+ 'bg-layer-2-hover border border-transparent',
26
+ 'group-has-[div[data-slot=input-action-slot]]:rounded-r-none',
27
+ 'transition-all duration-200'
28
+ ],
29
+ content: 'flex w-full',
30
+ value:
31
+ 'text-size-body-md font-normal placeholder:text-neutral-placeholder flex-1 outline-none',
32
+ icon: 'size-large text-icon-neutral-3 flex items-center justify-center',
33
+ slotText:
34
+ 'size-large flex items-center justify-center !text-size-label-md text-neutral-placeholder',
35
+ caption: '!text-size-body-sm font-normal',
36
+ action: 'h-large-4x overflow-hidden'
37
+ },
38
+ variants: {
39
+ state: {
40
+ normal: {
41
+ trigger:
42
+ 'hover:border-border-layer-1 focus-within:border-primary-idle focus-within:hover:border-primary-idle'
43
+ },
44
+ error: {
45
+ trigger:
46
+ 'border-danger-idle hover:border-danger-idle focus-within:border-danger-idle focus-within:hover:border-danger-idle',
47
+ caption: 'text-danger-label-idle'
48
+ },
49
+ disabled: {
50
+ trigger: 'pointer-events-none border-transparent bg-layer-2-idle'
51
+ }
52
+ }
53
+ }
54
+ })
55
+
56
+ const { wrapper, trigger, content, value, icon, caption, action, slotText } =
57
+ input()
58
+
59
+ export function InputRoot({
60
+ className,
61
+ state = 'normal',
62
+ customMask,
63
+ variant = 'normal',
64
+ mask,
65
+ ...props
66
+ }: ComponentProps<'div'> & FieldContextValue) {
67
+ return (
68
+ <FieldContext.Provider value={{ state, customMask, mask, variant }}>
69
+ <div className={wrapper({ className, state })} {...props} />
70
+ </FieldContext.Provider>
71
+ )
72
+ }
73
+
74
+ export function InputContent({ className, ...props }: ComponentProps<'div'>) {
75
+ const { state } = useFieldContext()
76
+ return <div className={content({ className, state })} {...props} />
77
+ }
78
+
79
+ export function InputLabel(props: ComponentProps<typeof FloatingLabel>) {
80
+ return <FloatingLabel {...props} />
81
+ }
82
+
83
+ export function InputTrigger({ className, ...props }: ComponentProps<'div'>) {
84
+ const { state, variant } = useFieldContext()
85
+
86
+ const filterTrigger = tv({
87
+ base: ['group bg-layer-2-idle relative'],
88
+ variants: {
89
+ state: {
90
+ normal: [
91
+ 'border-border-layer-2 hover:border-border-layer-3 has-[input:not(:placeholder-shown)]:border-primary-idle'
92
+ ],
93
+ error: ['border-danger-idle hover:border-danger-idle'],
94
+ disabled: ['border border-border-layer-2 opacity-60']
95
+ }
96
+ }
97
+ })
98
+
99
+ const mergedClassName = twMerge(
100
+ trigger({ state, className }),
101
+ variant === 'filter' && filterTrigger({ state, className })
102
+ )
103
+
104
+ return (
105
+ <div
106
+ aria-disabled={state === 'disabled'}
107
+ className={mergedClassName}
108
+ {...props}
109
+ />
110
+ )
111
+ }
112
+
113
+ export function InputMask({
114
+ className,
115
+ placeholder,
116
+ ...props
117
+ }: ComponentProps<'input'>) {
118
+ const { customMask, state, mask, variant } = useFieldContext()
119
+
120
+ return (
121
+ <InputMaskComponent
122
+ {...props}
123
+ {...(mask ? { ...inputMask(mask) } : customMask && { ...customMask })}
124
+ className={value({ className, state })}
125
+ disabled={state === 'disabled'}
126
+ placeholder={variant === 'filter' ? ' ' : placeholder}
127
+ readOnly={state === 'disabled'}
128
+ />
129
+ )
130
+ }
131
+
132
+ export function InputText({
133
+ className,
134
+ placeholder,
135
+ ...props
136
+ }: ComponentProps<'input'>) {
137
+ const { state, variant } = useFieldContext()
138
+
139
+ return (
140
+ <input
141
+ {...props}
142
+ className={value({ className, state })}
143
+ disabled={state === 'disabled'}
144
+ placeholder={variant === 'filter' ? ' ' : placeholder}
145
+ readOnly={state === 'disabled'}
146
+ />
147
+ )
148
+ }
149
+
150
+ export function InputNumber({
151
+ className,
152
+ locales = 'pt-BR',
153
+ placeholder,
154
+ ...props
155
+ }: InputNumberFormatProps) {
156
+ const { state, variant } = useFieldContext()
157
+
158
+ return (
159
+ <InputNumberFormat
160
+ {...props}
161
+ className={value({ className, state })}
162
+ disabled={state === 'disabled'}
163
+ locales={locales}
164
+ placeholder={variant === 'filter' ? ' ' : placeholder}
165
+ readOnly={state === 'disabled'}
166
+ />
167
+ )
168
+ }
169
+
170
+ export function InputIcon({
171
+ className,
172
+ name,
173
+ ...props
174
+ }: ComponentProps<'div'> & {
175
+ name: IconType
176
+ }) {
177
+ const { state } = useFieldContext()
178
+
179
+ return (
180
+ <div className={icon({ className, state })} {...props}>
181
+ <Icon name={name} />
182
+ </div>
183
+ )
184
+ }
185
+
186
+ export function InputSlot({ className, ...props }: ComponentProps<'span'>) {
187
+ const { state } = useFieldContext()
188
+ return <span className={slotText({ className, state })} {...props} />
189
+ }
190
+
191
+ export function InputCaption({ className, ...props }: ComponentProps<'p'>) {
192
+ const { state } = useFieldContext()
193
+ return <p className={caption({ className, state })} {...props} />
194
+ }
195
+
196
+ export function InputAction({ className, ...props }: ComponentProps<'div'>) {
197
+ const { state } = useFieldContext()
198
+ return (
199
+ <div
200
+ className={action({ className, state })}
201
+ data-slot="input-action-slot"
202
+ {...props}
203
+ />
204
+ )
205
+ }
206
+
207
+ export function InputNumericStepper({
208
+ handleIncrement,
209
+ handleDecrement
210
+ }: {
211
+ handleIncrement: () => void
212
+ handleDecrement: () => void
213
+ }) {
214
+ return (
215
+ <InputAction className="w-large-4x border-border-layer-2 rounded-r-small-1x bg-layer-2-hover flex flex-col items-center justify-center border">
216
+ <button
217
+ className="flex h-1/2 items-center justify-center"
218
+ type="button"
219
+ onClick={handleIncrement}
220
+ >
221
+ <Icon className="text-icon-neutral-3" name="keyboard_arrow_up" />
222
+ </button>
223
+
224
+ <Divider />
225
+
226
+ <button
227
+ className="flex h-1/2 items-center justify-center"
228
+ type="button"
229
+ onClick={handleDecrement}
230
+ >
231
+ <Icon className="text-icon-neutral-3" name="keyboard_arrow_down" />
232
+ </button>
233
+ </InputAction>
234
+ )
235
+ }
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react'
2
2
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group'
3
3
  import { cx } from '@xjur-ui/util'
4
- import { Typography } from './typography'
4
+ import { Typography } from '../typography'
5
5
 
6
6
  export function RadioGroup({
7
7
  className,
@@ -6,15 +6,16 @@ import {
6
6
  useCurrentEditor as useRichTextEditor,
7
7
  useEditorState as useRichTextEditorState,
8
8
  useEditor,
9
- type EditorOptions,
10
- Extension
9
+ type EditorOptions
11
10
  } from '@tiptap/react'
11
+ import type { Extension } from '@tiptap/core'
12
12
  import { StarterKit } from '@tiptap/starter-kit'
13
13
  import { Heading, type Level } from '@tiptap/extension-heading'
14
- import { Placeholder } from '@tiptap/extensions'
15
- import { useOS } from '../hooks'
16
- import { Icon, type IconType } from './icon'
17
- import { Button, type ButtonProps } from './button'
14
+ // Import specific extension instead of full extensions bundle
15
+ import { Placeholder } from '@tiptap/extension-placeholder'
16
+ import { useOS } from '../../hooks'
17
+ import { Icon, type IconType } from '../icon'
18
+ import { Button, type ButtonProps } from '../form/button'
18
19
  import {
19
20
  DropdownMenuContent,
20
21
  DropdownMenuItem,
@@ -22,9 +23,9 @@ import {
22
23
  DropdownMenuList,
23
24
  DropdownMenuRoot,
24
25
  DropdownMenuTrigger
25
- } from './dropdown-menu'
26
- import { Tooltip, TooltipTrigger, TooltipContent } from './tooltip'
27
- import { Typography } from './typography'
26
+ } from '../dropdown-menu'
27
+ import { Tooltip, TooltipTrigger, TooltipContent } from '../tooltip'
28
+ import { Typography } from '../typography'
28
29
 
29
30
  const headingClasses: Partial<Record<Level, string>> = {
30
31
  1: 'text-size-body-md',
@@ -1,7 +1,7 @@
1
1
  import { cva, cx } from '@xjur-ui/util'
2
2
  import { createContext, type ComponentProps } from 'react'
3
- import { Typography } from './typography'
4
- import { Button, type ButtonProps } from './button'
3
+ import { Typography } from '../typography'
4
+ import { Button, type ButtonProps } from '../form/button'
5
5
 
6
6
  export type SearchInputProps = {
7
7
  variant?: 'outlined' | 'line' | 'action'