@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,723 +0,0 @@
1
- // src/components/rich-editor.tsx
2
- import { cx as cx7 } from "@xjur-ui/util";
3
- import { useCallback, useMemo, useState as useState2 } from "react";
4
- import {
5
- EditorContent,
6
- EditorContext,
7
- useCurrentEditor as useRichTextEditor,
8
- useEditorState as useRichTextEditorState,
9
- useEditor
10
- } from "@tiptap/react";
11
- import { StarterKit } from "@tiptap/starter-kit";
12
- import { Heading } from "@tiptap/extension-heading";
13
- import { Placeholder } from "@tiptap/extensions";
14
-
15
- // src/hooks/use-os.ts
16
- import { useState, useEffect } from "react";
17
- function useOS() {
18
- const [os, setOs] = useState("unknown");
19
- useEffect(() => {
20
- if (typeof window === "undefined") return;
21
- const userAgent = window.navigator.userAgent;
22
- if (/iPad|iPhone|iPod/.test(userAgent)) {
23
- setOs("ios");
24
- } else if (/Mac/.test(userAgent)) {
25
- setOs("macos");
26
- } else if (/Win/.test(userAgent)) {
27
- setOs("windows");
28
- } else if (/Android/.test(userAgent)) {
29
- setOs("android");
30
- } else if (/Linux/.test(userAgent)) {
31
- setOs("linux");
32
- } else {
33
- setOs("unknown");
34
- }
35
- }, []);
36
- return {
37
- os,
38
- shortcut: ["macos", "ios"].includes(os) ? "\u2318" : "Ctrl"
39
- };
40
- }
41
-
42
- // src/components/icon.tsx
43
- import { cx } from "@xjur-ui/util";
44
- import { jsx } from "react/jsx-runtime";
45
- function Icon({ className, filled = false, name, ...props }) {
46
- return /* @__PURE__ */ jsx(
47
- "span",
48
- {
49
- ...props,
50
- className: cx(
51
- "material-symbols-outlined",
52
- "text-size-body-lg",
53
- className
54
- ),
55
- style: {
56
- fontVariationSettings: `'FILL' ${filled ? 1 : 0}, 'wght' 600, 'GRAD' 0, 'opsz' 20`,
57
- ...props.style
58
- },
59
- children: name
60
- }
61
- );
62
- }
63
-
64
- // src/components/button.tsx
65
- import { Slot } from "@radix-ui/react-slot";
66
- import { cva, cx as cx2 } from "@xjur-ui/util";
67
- import { jsx as jsx2 } from "react/jsx-runtime";
68
- var buttonVariants = cva(
69
- [
70
- "outline-none inline-flex items-center justify-center rounded-circle gap-small cursor-pointer disabled:opacity-38 disabled:pointer-events-none transition-colors"
71
- ],
72
- {
73
- variants: {
74
- size: {
75
- md: "py-small_1x-alt px-medium text-size-body-md",
76
- sm: "py-small-1x px-small text-size-label-sm",
77
- icon_md: "p-small text-size-body-md h-large-4x w-large-4x",
78
- icon_sm: "p-small-1x text-size-label-sm h-large-2x w-large-2x"
79
- },
80
- variant: {
81
- primary: "",
82
- secondary: "",
83
- tertiary: "",
84
- destructive: "",
85
- outlined: "bg-layer-2-idle border border-border-layer-2 hover:bg-layer-2-hover active:bg-layer-2-pressed"
86
- },
87
- appearance: {
88
- solid: "",
89
- ghost: "bg-transparent"
90
- }
91
- },
92
- compoundVariants: [
93
- {
94
- variant: "primary",
95
- appearance: "solid",
96
- class: "bg-primary-idle text-neutral-label hover:bg-primary-hover active:bg-primary-pressed"
97
- },
98
- {
99
- variant: "primary",
100
- appearance: "ghost",
101
- class: "text-primary-idle hover:bg-primary-alt-idle active:bg-primary-alt-pressed"
102
- },
103
- {
104
- variant: "secondary",
105
- appearance: "solid",
106
- class: "bg-layer-1-hover text-neutral-dark hover:bg-layer-1-pressed active:bg-layer-1-active"
107
- },
108
- {
109
- variant: "secondary",
110
- appearance: "ghost",
111
- class: "hover:bg-layer-1-hover active:bg-layer-1-pressed"
112
- },
113
- {
114
- variant: "tertiary",
115
- appearance: "solid",
116
- class: "bg-layer-2-hover text-neutral-dark hover:bg-layer-2-pressed active:bg-layer-2-active"
117
- },
118
- {
119
- variant: "tertiary",
120
- appearance: "ghost",
121
- class: "hover:bg-layer-2-hover active:bg-layer-2-pressed"
122
- },
123
- {
124
- variant: "destructive",
125
- appearance: "solid",
126
- class: "bg-danger-idle text-neutral-label hover:bg-danger-hover active:bg-danger-pressed"
127
- },
128
- {
129
- variant: "destructive",
130
- appearance: "ghost",
131
- class: "text-danger-label-idle hover:bg-danger-alt-idle active:bg-danger-alt-pressed"
132
- }
133
- ],
134
- defaultVariants: {
135
- size: "md",
136
- variant: "primary",
137
- appearance: "solid"
138
- }
139
- }
140
- );
141
- function Button({
142
- asChild,
143
- className,
144
- variant = "primary",
145
- size = "md",
146
- appearance = "solid",
147
- ...props
148
- }) {
149
- const Component = asChild ? Slot : "button";
150
- return /* @__PURE__ */ jsx2(
151
- Component,
152
- {
153
- className: cx2(buttonVariants({ variant, appearance, size }), className),
154
- ...props
155
- }
156
- );
157
- }
158
-
159
- // src/components/dropdown-menu.tsx
160
- import "react";
161
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
162
- import { cx as cx5 } from "@xjur-ui/util";
163
-
164
- // src/components/list.tsx
165
- import { Slot as Slot3 } from "@radix-ui/react-slot";
166
- import { cx as cx3, cva as cva3 } from "@xjur-ui/util";
167
-
168
- // src/components/typography.tsx
169
- import { Slot as Slot2 } from "@radix-ui/react-slot";
170
- import { cva as cva2 } from "@xjur-ui/util";
171
- import { memo } from "react";
172
- import { jsx as jsx3 } from "react/jsx-runtime";
173
- var typographyVariants = cva2("", {
174
- variants: {
175
- variant: {
176
- body: "",
177
- label: "",
178
- title: "",
179
- headline: ""
180
- },
181
- size: {
182
- "sm-2x": "",
183
- "sm-1x": "",
184
- sm: "",
185
- md: "",
186
- lg: ""
187
- },
188
- weight: {
189
- thin: "font-thin",
190
- extraLight: "font-extralight",
191
- light: "font-light",
192
- normal: "font-normal",
193
- medium: "font-medium",
194
- semibold: "font-semibold",
195
- bold: "font-bold",
196
- extraBold: "font-extrabold",
197
- black: "font-black"
198
- }
199
- },
200
- compoundVariants: [
201
- { variant: "body", size: "sm-1x", class: "text-size-body-sm-1x" },
202
- { variant: "body", size: "sm", class: "text-size-body-sm" },
203
- { variant: "body", size: "md", class: "text-size-body-md" },
204
- { variant: "body", size: "lg", class: "text-size-body-lg" },
205
- { variant: "label", size: "sm-2x", class: "text-size-label-sm-2x" },
206
- { variant: "label", size: "sm-1x", class: "text-size-label-sm-1x" },
207
- { variant: "label", size: "sm", class: "text-size-label-sm" },
208
- { variant: "label", size: "md", class: "text-size-label-md" },
209
- { variant: "label", size: "lg", class: "text-size-label-lg" },
210
- { variant: "title", size: "sm", class: "text-size-title-sm" },
211
- { variant: "title", size: "md", class: "text-size-title-md" },
212
- { variant: "title", size: "lg", class: "text-size-title-lg" },
213
- { variant: "headline", size: "sm", class: "text-size-headline-sm" },
214
- { variant: "headline", size: "md", class: "text-size-headline-md" },
215
- { variant: "headline", size: "lg", class: "text-size-headline-lg" }
216
- ],
217
- defaultVariants: {
218
- variant: "body",
219
- size: "md",
220
- weight: "normal"
221
- }
222
- });
223
- var Typography = memo(
224
- ({
225
- variant,
226
- size,
227
- weight,
228
- asChild,
229
- className,
230
- ...props
231
- }) => {
232
- const Component = asChild ? Slot2 : "span";
233
- return /* @__PURE__ */ jsx3(
234
- Component,
235
- {
236
- className: typographyVariants({ variant, size, weight, className }),
237
- ...props
238
- }
239
- );
240
- }
241
- );
242
- Typography.displayName = "Typography";
243
-
244
- // src/components/list.tsx
245
- import { jsx as jsx4 } from "react/jsx-runtime";
246
- function ListRoot({
247
- className,
248
- asChild,
249
- ...props
250
- }) {
251
- const Comp = asChild ? Slot3 : "div";
252
- return /* @__PURE__ */ jsx4(
253
- Comp,
254
- {
255
- ...props,
256
- className: cx3(
257
- className,
258
- "rounded-small scrollbar-hide bg-layer-2-idle border-border-layer-2 shadow-elevation-3 z-10 max-h-[400px] list-none overflow-y-auto border"
259
- )
260
- }
261
- );
262
- }
263
- function ListContent({
264
- className,
265
- asChild,
266
- ...props
267
- }) {
268
- const Comp = asChild ? Slot3 : "ul";
269
- return /* @__PURE__ */ jsx4(
270
- Comp,
271
- {
272
- ...props,
273
- className: cx3("gap-small-1x p-small flex flex-col", className)
274
- }
275
- );
276
- }
277
- var variants = cva3(
278
- [
279
- "py-medium px-small flex items-center gap-small rounded-small-1x",
280
- "bg-layer-2-idle text-neutral-dark",
281
- "hover:bg-layer-2-hover transition-colors duration-100 ease-out",
282
- "active:bg-layer-2-pressed"
283
- ],
284
- {
285
- variants: {
286
- size: {
287
- md: "h-large-4x",
288
- lg: "h-large-7x"
289
- },
290
- isActive: {
291
- true: "bg-primary-alt-active text-primary-label-active hover:bg-primary-alt-hover active:bg-primary-alt-pressed"
292
- }
293
- },
294
- defaultVariants: {
295
- size: "md",
296
- isActive: false
297
- }
298
- }
299
- );
300
- function ListItem({
301
- className,
302
- size,
303
- isActive,
304
- asChild,
305
- ...props
306
- }) {
307
- const Comp = asChild ? Slot3 : "li";
308
- return /* @__PURE__ */ jsx4(Comp, { ...props, className: cx3(variants({ size, isActive }), className) });
309
- }
310
-
311
- // src/components/divider.tsx
312
- import "react";
313
- import * as SeparatorPrimitive from "@radix-ui/react-separator";
314
- import { cx as cx4 } from "@xjur-ui/util";
315
- import { jsx as jsx5 } from "react/jsx-runtime";
316
-
317
- // src/components/dropdown-menu.tsx
318
- import { jsx as jsx6 } from "react/jsx-runtime";
319
- function DropdownMenuRoot({
320
- ...props
321
- }) {
322
- return /* @__PURE__ */ jsx6(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
323
- }
324
- function DropdownMenuTrigger({
325
- ...props
326
- }) {
327
- return /* @__PURE__ */ jsx6(
328
- DropdownMenuPrimitive.Trigger,
329
- {
330
- "data-slot": "dropdown-menu-trigger",
331
- ...props
332
- }
333
- );
334
- }
335
- function DropdownMenuContent({
336
- className,
337
- sideOffset = 4,
338
- align = "start",
339
- side = "bottom",
340
- children,
341
- ...props
342
- }) {
343
- return /* @__PURE__ */ jsx6(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx6(
344
- DropdownMenuPrimitive.Content,
345
- {
346
- align,
347
- className: cx5(
348
- "group z-10 max-h-[var(--radix-popover-content-available-height)] max-w-[var(--radix-popover-trigger-width)] min-w-[var(--radix-popover-trigger-width)]",
349
- className
350
- ),
351
- "data-slot": "dropdown-menu-content",
352
- side,
353
- sideOffset,
354
- ...props,
355
- children: /* @__PURE__ */ jsx6(ListRoot, { children })
356
- }
357
- ) });
358
- }
359
- function DropdownMenuList({
360
- ...props
361
- }) {
362
- return /* @__PURE__ */ jsx6(ListContent, { ...props });
363
- }
364
- function DropdownMenuItem({
365
- className,
366
- ...props
367
- }) {
368
- return /* @__PURE__ */ jsx6(ListItem, { className: cx5(className, "cursor-pointer"), ...props });
369
- }
370
- function DropdownMenuItemText({
371
- ...props
372
- }) {
373
- return /* @__PURE__ */ jsx6(Typography, { ...props });
374
- }
375
-
376
- // src/components/tooltip.tsx
377
- import * as TooltipPrimitive from "@radix-ui/react-tooltip";
378
- import { cx as cx6 } from "@xjur-ui/util";
379
- import { jsx as jsx7 } from "react/jsx-runtime";
380
- function TooltipProvider({
381
- delayDuration = 0,
382
- ...props
383
- }) {
384
- return /* @__PURE__ */ jsx7(
385
- TooltipPrimitive.Provider,
386
- {
387
- "data-slot": "tooltip-provider",
388
- delayDuration,
389
- ...props
390
- }
391
- );
392
- }
393
- function Tooltip({
394
- ...props
395
- }) {
396
- return /* @__PURE__ */ jsx7(TooltipProvider, { children: /* @__PURE__ */ jsx7(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
397
- }
398
- function TooltipTrigger({
399
- ...props
400
- }) {
401
- return /* @__PURE__ */ jsx7(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
402
- }
403
- function TooltipContent({
404
- className,
405
- sideOffset = 1,
406
- variant = "simple",
407
- children,
408
- ...props
409
- }) {
410
- return /* @__PURE__ */ jsx7(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx7(
411
- TooltipPrimitive.Content,
412
- {
413
- className: cx6(
414
- "text-size-body-sm text-balance",
415
- "data-[variant=simple]:bg-alt-2 data-[variant=simple]:text-neutral-label data-[variant=simple]:rounded-small-1x data-[variant=simple]:px-small data-[variant=simple]:py-small-1x",
416
- "data-[variant=rich]:bg-layer-2-idle data-[variant=rich]:text-neutral-dark data-[variant=rich]:rounded-small data-[variant=rich]:border-border-layer-2 data-[variant=rich]:p-large data-[variant=rich]:border",
417
- "animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin)",
418
- className
419
- ),
420
- "data-slot": "tooltip-content",
421
- "data-variant": variant,
422
- sideOffset,
423
- ...props,
424
- children
425
- }
426
- ) });
427
- }
428
-
429
- // src/components/rich-editor.tsx
430
- import { jsx as jsx8, jsxs } from "react/jsx-runtime";
431
- var headingClasses = {
432
- 1: "text-size-body-md",
433
- 2: "text-size-title-lg",
434
- 3: "text-size-headline-lg"
435
- };
436
- function RichEditorRoot({
437
- className,
438
- editorOptions,
439
- ...props
440
- }) {
441
- const editor = useEditor({
442
- ...editorOptions,
443
- extensions: [
444
- StarterKit.configure({
445
- bulletList: {
446
- HTMLAttributes: {
447
- class: "list-disc list-outside pl-large-1x"
448
- }
449
- },
450
- orderedList: {
451
- HTMLAttributes: {
452
- class: "list-decimal list-outside pl-large-1x"
453
- }
454
- },
455
- heading: false
456
- }),
457
- Placeholder.configure({
458
- placeholder: ({ node, editor: editor2 }) => node.type.name === "paragraph" && editor2.isEmpty ? "Digite aqui\u2026" : "",
459
- showOnlyWhenEditable: true,
460
- includeChildren: false,
461
- emptyNodeClass: "before:content-[attr(data-placeholder)] before:absolute before:top-0 before:left-0 before:text-neutral-placeholder first:before:float-left first:before:content-[attr(data-placeholder)] first:before:pointer-events-none"
462
- }),
463
- Heading.configure({
464
- levels: [1, 2, 3]
465
- }).extend({
466
- renderHTML({ node, HTMLAttributes }) {
467
- const level = node.attrs.level ?? 1;
468
- return [
469
- "h",
470
- {
471
- ...HTMLAttributes,
472
- class: headingClasses[level]
473
- },
474
- 0
475
- ];
476
- }
477
- }),
478
- ...editorOptions?.extensions ?? []
479
- ]
480
- });
481
- const value = useMemo(() => ({ editor }), [editor]);
482
- return /* @__PURE__ */ jsx8(EditorContext.Provider, { value, children: /* @__PURE__ */ jsx8(
483
- "div",
484
- {
485
- className: cx7("gap-small flex w-full flex-col", className),
486
- "data-slot": "text-area-root",
487
- ...props
488
- }
489
- ) });
490
- }
491
- function RichEditorContent({
492
- className,
493
- ...props
494
- }) {
495
- return /* @__PURE__ */ jsx8(
496
- "div",
497
- {
498
- className: cx7(
499
- "bg-layer-2-hover py-small_1x-alt px-small rounded-small-1x min-h-[116px] w-full border border-transparent",
500
- "hover:border-border-layer-2 transition-colors duration-200",
501
- "[&_ul_ul]:list-[circle]",
502
- "[&_ul_ul_ul]:list-[square]",
503
- "[&_ol_ol]:list-[lower-alpha]",
504
- "[&_ol_ol_ol]:list-[lower-roman]",
505
- "gap-small flex flex-col overflow-x-hidden overflow-y-auto",
506
- className
507
- ),
508
- "data-slot": "text-area-content",
509
- ...props
510
- }
511
- );
512
- }
513
- function RichEditorCaption({
514
- className,
515
- ...props
516
- }) {
517
- return /* @__PURE__ */ jsx8(
518
- "p",
519
- {
520
- ...props,
521
- className: cx7(
522
- "text-size-body-sm text-neutral-dark font-normal",
523
- className
524
- ),
525
- "data-slot": "text-area-caption"
526
- }
527
- );
528
- }
529
- function RichEditorAreaText({
530
- className,
531
- ...props
532
- }) {
533
- const { editor } = useRichTextEditor();
534
- return /* @__PURE__ */ jsx8(
535
- EditorContent,
536
- {
537
- className: cx7(
538
- "text-size-body-md text-neutral-dark max-h-[116px] *:h-full *:w-full *:outline-0",
539
- className
540
- ),
541
- editor,
542
- ...props
543
- }
544
- );
545
- }
546
- function RichEditorToolbar({
547
- className,
548
- ...props
549
- }) {
550
- return /* @__PURE__ */ jsx8(
551
- "div",
552
- {
553
- className: cx7(
554
- "h-large-4x gap-small-1x h-large-6px scrollbar-hide flex flex-nowrap items-center overflow-x-auto overflow-y-hidden",
555
- className
556
- ),
557
- "data-slot": "text-area-toolbar",
558
- ...props
559
- }
560
- );
561
- }
562
- function ToolbarButton({
563
- appearance = "ghost",
564
- variant = "secondary",
565
- onMouseDown,
566
- onPointerDown,
567
- ...props
568
- }) {
569
- return /* @__PURE__ */ jsx8(
570
- Button,
571
- {
572
- appearance,
573
- size: "icon_md",
574
- tabIndex: -1,
575
- type: "button",
576
- variant,
577
- onMouseDown: (e) => {
578
- e.preventDefault();
579
- onMouseDown?.(e);
580
- },
581
- onPointerDown: (e) => {
582
- e.preventDefault();
583
- onPointerDown?.(e);
584
- },
585
- ...props
586
- }
587
- );
588
- }
589
- function ToggleButton({
590
- name,
591
- ...props
592
- }) {
593
- const { editor } = useRichTextEditor();
594
- const { shortcut } = useOS();
595
- const isActive = useRichTextEditorState({
596
- editor,
597
- selector: (ctx) => ctx.editor?.isActive(name) ?? false
598
- });
599
- const icon = useMemo(() => {
600
- const iconsMap = /* @__PURE__ */ new Map([
601
- ["bold", "format_bold"],
602
- ["italic", "format_italic"],
603
- ["underline", "format_underlined"],
604
- ["strike", "format_strikethrough"],
605
- ["bulletList", "format_list_bulleted"],
606
- ["orderedList", "format_list_numbered"],
607
- ["undo", "undo"],
608
- ["redo", "redo"]
609
- ]);
610
- return iconsMap.get(name);
611
- }, [name]);
612
- const description = useMemo(() => {
613
- const descriptionsMap = /* @__PURE__ */ new Map([
614
- ["bold", `Negrito (${shortcut} + B)`],
615
- ["italic", `It\xE1lico (${shortcut} + I)`],
616
- ["underline", `Sublinhado (${shortcut} + U)`],
617
- ["strike", `Tachado (${shortcut} + S)`],
618
- ["bulletList", `Lista (${shortcut} + Shift + 7)`],
619
- ["orderedList", `Lista numerada (${shortcut} + Shift + 8)`],
620
- ["undo", `Desfazer (${shortcut} + Z)`],
621
- ["redo", `Refazer (${shortcut} + Y)`]
622
- ]);
623
- return descriptionsMap.get(name);
624
- }, [name, shortcut]);
625
- const handleToggle = useCallback(() => {
626
- if (!editor) throw new Error("Editor not found");
627
- const commandsMap = /* @__PURE__ */ new Map([
628
- ["bold", () => editor.chain().focus().toggleBold().run()],
629
- ["italic", () => editor.chain().focus().toggleItalic().run()],
630
- ["underline", () => editor.chain().focus().toggleUnderline().run()],
631
- ["strike", () => editor.chain().focus().toggleStrike().run()],
632
- ["bulletList", () => editor.chain().focus().toggleBulletList().run()],
633
- ["orderedList", () => editor.chain().focus().toggleOrderedList().run()],
634
- ["undo", () => editor.chain().focus().undo().run()],
635
- ["redo", () => editor.chain().focus().redo().run()]
636
- ]);
637
- commandsMap.get(name)?.();
638
- }, [editor, name]);
639
- return /* @__PURE__ */ jsxs(Tooltip, { children: [
640
- /* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(
641
- ToolbarButton,
642
- {
643
- onClick: handleToggle,
644
- ...isActive && { appearance: "solid" },
645
- ...props,
646
- children: icon && /* @__PURE__ */ jsx8(Icon, { className: "text-icon-neutral-3", name: icon })
647
- }
648
- ) }),
649
- /* @__PURE__ */ jsx8(TooltipContent, { children: description && /* @__PURE__ */ jsx8(Typography, { size: "sm", children: description }) })
650
- ] });
651
- }
652
- function HeadingButton({
653
- appearance = "ghost",
654
- variant = "secondary",
655
- ...props
656
- }) {
657
- const [isOpen, setIsOpen] = useState2(false);
658
- const { editor } = useRichTextEditor();
659
- const isActive = useRichTextEditorState({
660
- editor,
661
- selector: (ctx) => ctx.editor?.isActive("heading") ?? false
662
- });
663
- const isLevelActive = useCallback(
664
- (level) => {
665
- if (!editor) throw new Error("Editor not found");
666
- return editor.isActive("heading", { level });
667
- },
668
- [editor]
669
- );
670
- const toggleHeading = useCallback(
671
- (level) => {
672
- if (!editor) throw new Error("Editor not found");
673
- setIsOpen(false);
674
- setTimeout(() => {
675
- editor.chain().focus().toggleHeading({ level }).run();
676
- }, 0);
677
- },
678
- [editor]
679
- );
680
- const levels = [
681
- { level: 1, label: "Normal", className: headingClasses[1] },
682
- { level: 2, label: "Grande", className: headingClasses[2] },
683
- { level: 3, label: "Enorme", className: headingClasses[3] }
684
- ];
685
- return /* @__PURE__ */ jsxs(DropdownMenuRoot, { open: isOpen, onOpenChange: (open) => setIsOpen(open), children: [
686
- /* @__PURE__ */ jsx8(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(
687
- Button,
688
- {
689
- appearance: isActive ? "solid" : appearance,
690
- size: "icon_md",
691
- tabIndex: -1,
692
- type: "button",
693
- variant,
694
- ...props,
695
- children: /* @__PURE__ */ jsxs(Tooltip, { children: [
696
- /* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(Icon, { className: "text-icon-neutral-3", name: "format_size" }) }),
697
- /* @__PURE__ */ jsx8(TooltipContent, { children: /* @__PURE__ */ jsx8(Typography, { size: "sm", children: "Tamanho" }) })
698
- ] })
699
- }
700
- ) }),
701
- /* @__PURE__ */ jsx8(DropdownMenuContent, { children: /* @__PURE__ */ jsx8(DropdownMenuList, { children: levels.map((level) => /* @__PURE__ */ jsx8(
702
- DropdownMenuItem,
703
- {
704
- isActive: isLevelActive(level.level),
705
- onPointerDown: () => toggleHeading(level.level),
706
- children: /* @__PURE__ */ jsx8(DropdownMenuItemText, { className: level.className, children: level.label })
707
- },
708
- level.level
709
- )) }) })
710
- ] });
711
- }
712
- export {
713
- HeadingButton,
714
- RichEditorAreaText,
715
- RichEditorCaption,
716
- RichEditorContent,
717
- RichEditorRoot,
718
- RichEditorToolbar,
719
- ToggleButton,
720
- ToolbarButton,
721
- useRichTextEditor,
722
- useRichTextEditorState
723
- };