@contember/create 2.1.0-alpha.3 → 2.1.0-alpha.35

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 (314) hide show
  1. package/dist/development/run.cjs +6 -4
  2. package/dist/development/run.cjs.map +1 -1
  3. package/dist/development/run.js +6 -4
  4. package/dist/development/run.js.map +1 -1
  5. package/dist/development/src/commands/WorkspaceCreateCommand.cjs +37 -23
  6. package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  7. package/dist/development/src/commands/WorkspaceCreateCommand.js +37 -23
  8. package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
  9. package/dist/development/src/lib/FileSystem.cjs +1 -0
  10. package/dist/development/src/lib/FileSystem.cjs.map +1 -1
  11. package/dist/development/src/lib/FileSystem.js +1 -0
  12. package/dist/development/src/lib/FileSystem.js.map +1 -1
  13. package/dist/development/src/lib/TemplateInstaller.cjs +28 -12
  14. package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
  15. package/dist/development/src/lib/TemplateInstaller.js +28 -12
  16. package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
  17. package/dist/development/src/lib/packageManagerDetector.cjs +22 -0
  18. package/dist/development/src/lib/packageManagerDetector.cjs.map +1 -0
  19. package/dist/development/src/lib/packageManagerDetector.js +22 -0
  20. package/dist/development/src/lib/packageManagerDetector.js.map +1 -0
  21. package/dist/development/src/lib/version.cjs.map +1 -1
  22. package/dist/development/src/lib/version.js.map +1 -1
  23. package/dist/development/src/paths.cjs.map +1 -1
  24. package/dist/development/src/paths.js.map +1 -1
  25. package/dist/production/run.cjs +6 -4
  26. package/dist/production/run.cjs.map +1 -1
  27. package/dist/production/run.js +6 -4
  28. package/dist/production/run.js.map +1 -1
  29. package/dist/production/src/commands/WorkspaceCreateCommand.cjs +37 -23
  30. package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  31. package/dist/production/src/commands/WorkspaceCreateCommand.js +37 -23
  32. package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
  33. package/dist/production/src/lib/FileSystem.cjs +1 -0
  34. package/dist/production/src/lib/FileSystem.cjs.map +1 -1
  35. package/dist/production/src/lib/FileSystem.js +1 -0
  36. package/dist/production/src/lib/FileSystem.js.map +1 -1
  37. package/dist/production/src/lib/TemplateInstaller.cjs +28 -12
  38. package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
  39. package/dist/production/src/lib/TemplateInstaller.js +28 -12
  40. package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
  41. package/dist/production/src/lib/packageManagerDetector.cjs +22 -0
  42. package/dist/production/src/lib/packageManagerDetector.cjs.map +1 -0
  43. package/dist/production/src/lib/packageManagerDetector.js +22 -0
  44. package/dist/production/src/lib/packageManagerDetector.js.map +1 -0
  45. package/dist/production/src/lib/version.cjs.map +1 -1
  46. package/dist/production/src/lib/version.js.map +1 -1
  47. package/dist/production/src/paths.cjs.map +1 -1
  48. package/dist/production/src/paths.js.map +1 -1
  49. package/dist/types/commands/WorkspaceCreateCommand.d.ts +4 -2
  50. package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -1
  51. package/dist/types/lib/FileSystem.d.ts +1 -0
  52. package/dist/types/lib/FileSystem.d.ts.map +1 -1
  53. package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
  54. package/dist/types/lib/packageManagerDetector.d.ts +3 -0
  55. package/dist/types/lib/packageManagerDetector.d.ts.map +1 -0
  56. package/package.json +15 -6
  57. package/resources/templates/{template-workspace → default}/.github/workflows/deploy.yaml +1 -1
  58. package/resources/templates/default/.gitignore.dist +154 -0
  59. package/resources/templates/default/README.md +98 -0
  60. package/resources/templates/{template-workspace → default}/admin/.env.development +1 -0
  61. package/resources/templates/default/admin/.env.production +6 -0
  62. package/resources/templates/{template-workspace → default}/admin/app/components/layout.tsx +7 -3
  63. package/resources/templates/default/admin/app/components/navigation.tsx +85 -0
  64. package/resources/templates/{template-workspace → default}/admin/app/index.tsx +4 -4
  65. package/resources/templates/default/admin/app/pages/tenant.tsx +160 -0
  66. package/resources/templates/default/admin/entrypoint/components/layout.tsx +14 -0
  67. package/resources/templates/default/admin/entrypoint/components/logged-in.tsx +47 -0
  68. package/resources/templates/default/admin/entrypoint/components/login.tsx +103 -0
  69. package/resources/templates/default/admin/entrypoint/config.ts +35 -0
  70. package/resources/templates/default/admin/entrypoint/contexts/login.tsx +18 -0
  71. package/resources/templates/default/admin/entrypoint/index.tsx +12 -0
  72. package/resources/templates/default/admin/entrypoint/login-entrypoint.tsx +24 -0
  73. package/resources/templates/default/admin/entrypoint/pages/index.tsx +48 -0
  74. package/resources/templates/default/admin/entrypoint/pages/magicLink.tsx +56 -0
  75. package/resources/templates/default/admin/entrypoint/pages/magicLinkSent.tsx +63 -0
  76. package/resources/templates/default/admin/entrypoint/pages/passwordReset.tsx +44 -0
  77. package/resources/templates/default/admin/entrypoint/pages/resetRequest.tsx +35 -0
  78. package/resources/templates/default/admin/entrypoint/pages/resetRequestSuccess.tsx +34 -0
  79. package/resources/templates/default/admin/index.css +94 -0
  80. package/resources/templates/{template-workspace → default}/admin/index.html +1 -1
  81. package/resources/templates/{template-workspace → default}/admin/lib/binding/binding.tsx +0 -2
  82. package/resources/templates/{template-workspace → default}/admin/lib/binding/hooks.tsx +14 -8
  83. package/resources/templates/default/admin/lib/binding/identity.tsx +51 -0
  84. package/resources/templates/{template-workspace → default}/admin/lib/binding/navigation-guard-dialog.tsx +12 -8
  85. package/resources/templates/{template-workspace → default}/admin/lib/binding/persist.tsx +7 -5
  86. package/resources/templates/{template-workspace → default}/admin/lib/block-repeater/block-repeater.tsx +14 -16
  87. package/resources/templates/{template-workspace → default}/admin/lib/board/board.tsx +61 -47
  88. package/resources/templates/{template-workspace → default}/admin/lib/buttons/back-button.tsx +1 -1
  89. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/cells.tsx +49 -35
  90. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/column-header.tsx +47 -38
  91. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/columns.tsx +128 -105
  92. package/resources/templates/default/admin/lib/datagrid/elements.tsx +63 -0
  93. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/empty.tsx +1 -1
  94. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/boolean.tsx +1 -4
  95. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/common.tsx +14 -14
  96. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/date.tsx +35 -21
  97. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/defined.tsx +0 -1
  98. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/enum.tsx +24 -30
  99. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/mobile.tsx +2 -3
  100. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/number.tsx +0 -3
  101. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/relation.tsx +36 -30
  102. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/labels.tsx +0 -1
  103. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/loader.tsx +2 -7
  104. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/pagination.tsx +33 -38
  105. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/table.tsx +8 -6
  106. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/tiles.tsx +10 -5
  107. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/toolbar.tsx +10 -7
  108. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/ui.tsx +12 -15
  109. package/resources/templates/{template-workspace → default}/admin/lib/dev/login-panel.tsx +23 -16
  110. package/resources/templates/{template-workspace → default}/admin/lib/dict.ts +17 -5
  111. package/resources/templates/default/admin/lib/dimensions/dimensions.tsx +159 -0
  112. package/resources/templates/{template-workspace → default}/admin/lib/editor/block-editor.tsx +22 -10
  113. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/baseEditorPlugins.tsx +0 -2
  114. package/resources/templates/default/admin/lib/editor/common/buttons.tsx +205 -0
  115. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-block-toolbar.tsx +3 -1
  116. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-canvas.tsx +6 -4
  117. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-editable-canvas.tsx +0 -1
  118. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-inline-toolbar.tsx +5 -2
  119. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/AnchorRenderer.tsx +18 -16
  120. package/resources/templates/default/admin/lib/editor/common/elements/BlockElement.tsx +60 -0
  121. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/HeadingRenderer.tsx +1 -1
  122. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableCellElementRenderer.tsx +1 -1
  123. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableElementRenderer.tsx +2 -7
  124. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableRowElementRenderer.tsx +1 -5
  125. package/resources/templates/{template-workspace → default}/admin/lib/editor/editor-block.tsx +17 -10
  126. package/resources/templates/{template-workspace → default}/admin/lib/editor/rich-text-view.tsx +11 -6
  127. package/resources/templates/{template-workspace → default}/admin/lib/editor/rich-text.tsx +6 -7
  128. package/resources/templates/default/admin/lib/editor/sortable-block.tsx +57 -0
  129. package/resources/templates/default/admin/lib/form/container.tsx +72 -0
  130. package/resources/templates/{template-workspace → default}/admin/lib/form/inputs.tsx +14 -12
  131. package/resources/templates/{template-workspace → default}/admin/lib/form/select.tsx +93 -51
  132. package/resources/templates/{template-workspace → default}/admin/lib/form/ui.tsx +1 -1
  133. package/resources/templates/default/admin/lib/form/upload-repeaters.tsx +221 -0
  134. package/resources/templates/{template-workspace → default}/admin/lib/form/upload.tsx +61 -62
  135. package/resources/templates/{template-workspace → default}/admin/lib/labels/enum-labels.ts +6 -3
  136. package/resources/templates/{template-workspace → default}/admin/lib/labels/field-labels.ts +4 -2
  137. package/resources/templates/{template-workspace → default}/admin/lib/layout/layout-boxed.tsx +39 -29
  138. package/resources/templates/{template-workspace → default}/admin/lib/layout/slots.tsx +1 -4
  139. package/resources/templates/{template-workspace → default}/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +10 -4
  140. package/resources/templates/{template-workspace → default}/admin/lib/repeater/repeater.tsx +24 -15
  141. package/resources/templates/{template-workspace → default}/admin/lib/select/create-new.tsx +0 -3
  142. package/resources/templates/{template-workspace → default}/admin/lib/select/filter.tsx +0 -1
  143. package/resources/templates/{template-workspace → default}/admin/lib/select/list.tsx +33 -28
  144. package/resources/templates/default/admin/lib/select/multi-select.tsx +92 -0
  145. package/resources/templates/default/admin/lib/select/select.tsx +109 -0
  146. package/resources/templates/default/admin/lib/select/sortable-select.tsx +138 -0
  147. package/resources/templates/{template-workspace → default}/admin/lib/select/ui.tsx +13 -11
  148. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/change-my-password.tsx +21 -8
  149. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/common.tsx +21 -12
  150. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/create-api-key.tsx +9 -5
  151. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/invite.tsx +12 -7
  152. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/login.tsx +26 -7
  153. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/memberships-control.tsx +32 -20
  154. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/password-reset-request.tsx +9 -5
  155. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/password-reset.tsx +21 -8
  156. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/passwordless-signin-init.tsx +9 -5
  157. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/passwordless-signin.tsx +25 -12
  158. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/update-project-member.tsx +3 -4
  159. package/resources/templates/{template-workspace → default}/admin/lib/tenant/hooks/useInviteUser.tsx +2 -3
  160. package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/api-key-list.tsx +5 -3
  161. package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/member-delete-dialog.tsx +13 -2
  162. package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/member-list.tsx +17 -11
  163. package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/person-list.tsx +6 -4
  164. package/resources/templates/{template-workspace → default}/admin/lib/tenant/otp/otp-setup.tsx +86 -59
  165. package/resources/templates/default/admin/lib/toast/toast.tsx +113 -0
  166. package/resources/templates/{template-workspace → default}/admin/lib/toast/toaster.tsx +0 -1
  167. package/resources/templates/{template-workspace → default}/admin/lib/ui/alert-dialog.tsx +4 -3
  168. package/resources/templates/default/admin/lib/ui/button.tsx +30 -0
  169. package/resources/templates/{template-workspace → default}/admin/lib/ui/card.tsx +1 -1
  170. package/resources/templates/{template-workspace → default}/admin/lib/ui/dialog.tsx +12 -8
  171. package/resources/templates/default/admin/lib/ui/dimension.tsx +9 -0
  172. package/resources/templates/{template-workspace → default}/admin/lib/ui/dropdown.tsx +18 -15
  173. package/resources/templates/default/admin/lib/ui/input.tsx +68 -0
  174. package/resources/templates/{template-workspace → default}/admin/lib/ui/loader.tsx +1 -1
  175. package/resources/templates/{template-workspace → default}/admin/lib/ui/menu.tsx +3 -11
  176. package/resources/templates/{template-workspace → default}/admin/lib/ui/overlay.tsx +11 -9
  177. package/resources/templates/{template-workspace → default}/admin/lib/ui/popover.tsx +2 -2
  178. package/resources/templates/{template-workspace → default}/admin/lib/ui/property-list.tsx +5 -5
  179. package/resources/templates/{template-workspace → default}/admin/lib/ui/scroll-area.tsx +11 -11
  180. package/resources/templates/{template-workspace → default}/admin/lib/ui/select.tsx +4 -5
  181. package/resources/templates/{template-workspace → default}/admin/lib/ui/sheet.tsx +9 -8
  182. package/resources/templates/{template-workspace → default}/admin/lib/ui/sidebar.tsx +53 -42
  183. package/resources/templates/{template-workspace → default}/admin/lib/ui/sortable.tsx +1 -1
  184. package/resources/templates/default/admin/lib/ui/switch.tsx +11 -0
  185. package/resources/templates/{template-workspace → default}/admin/lib/ui/table.tsx +3 -3
  186. package/resources/templates/{template-workspace → default}/admin/lib/ui/textarea.tsx +10 -7
  187. package/resources/templates/{template-workspace → default}/admin/lib/ui/toggle-group.tsx +9 -5
  188. package/resources/templates/{template-workspace → default}/admin/lib/ui/toggle.tsx +3 -5
  189. package/resources/templates/{template-workspace → default}/admin/lib/ui/tooltip.tsx +4 -3
  190. package/resources/templates/{template-workspace → default}/admin/lib/upload/dropzone.tsx +14 -10
  191. package/resources/templates/{template-workspace → default}/admin/lib/upload/repeater.tsx +0 -1
  192. package/resources/templates/{template-workspace → default}/admin/lib/upload/ui.tsx +4 -8
  193. package/resources/templates/{template-workspace → default}/admin/lib/upload/upload-progress.tsx +28 -12
  194. package/resources/templates/{template-workspace → default}/admin/lib/upload/view.tsx +130 -68
  195. package/resources/templates/{template-workspace → default}/admin/lib/utils/createComponentOpenHooks.tsx +10 -6
  196. package/resources/templates/{template-workspace → default}/admin/lib/utils/uic.tsx +24 -14
  197. package/resources/templates/{template-workspace → default}/admin/lib/utils/use-mobile.ts +1 -3
  198. package/resources/templates/{template-workspace → default}/admin/package.json +6 -4
  199. package/resources/templates/default/admin/sentry.ts +26 -0
  200. package/resources/templates/{template-workspace → default}/admin/tsconfig.json +1 -9
  201. package/resources/templates/default/admin/vite-env.d.ts +12 -0
  202. package/resources/templates/default/admin/vite.config.ts +11 -0
  203. package/resources/templates/default/api/README.md +87 -0
  204. package/resources/templates/{template-workspace → default}/biome.json +1 -1
  205. package/resources/templates/default/client/README.md +285 -0
  206. package/resources/templates/{template-workspace → default}/contember.template.yaml +5 -0
  207. package/resources/templates/{template-workspace → default}/package.json +1 -1
  208. package/resources/templates/default/scripts/generate-client.sh +7 -0
  209. package/resources/templates/default/scripts/update-ui-lib.sh +344 -0
  210. package/src/commands/WorkspaceCreateCommand.ts +41 -25
  211. package/src/lib/FileSystem.ts +1 -0
  212. package/src/lib/TemplateInstaller.ts +32 -12
  213. package/src/lib/packageManagerDetector.ts +24 -0
  214. package/src/run.ts +8 -7
  215. package/dist/types/tsconfig.tsbuildinfo +0 -1
  216. package/resources/templates/template-workspace/.gitignore.dist +0 -3
  217. package/resources/templates/template-workspace/admin/app/components/navigation.tsx +0 -1
  218. package/resources/templates/template-workspace/admin/index.css +0 -53
  219. package/resources/templates/template-workspace/admin/index.tsx +0 -268
  220. package/resources/templates/template-workspace/admin/lib/binding/identity.tsx +0 -50
  221. package/resources/templates/template-workspace/admin/lib/datagrid/elements.tsx +0 -48
  222. package/resources/templates/template-workspace/admin/lib/dimensions/dimensions.tsx +0 -135
  223. package/resources/templates/template-workspace/admin/lib/editor/common/buttons.tsx +0 -83
  224. package/resources/templates/template-workspace/admin/lib/editor/common/elements/BlockElement.tsx +0 -48
  225. package/resources/templates/template-workspace/admin/lib/editor/sortable-block.tsx +0 -51
  226. package/resources/templates/template-workspace/admin/lib/form/container.tsx +0 -59
  227. package/resources/templates/template-workspace/admin/lib/form/upload-repeaters.tsx +0 -188
  228. package/resources/templates/template-workspace/admin/lib/select/multi-select.tsx +0 -96
  229. package/resources/templates/template-workspace/admin/lib/select/select.tsx +0 -104
  230. package/resources/templates/template-workspace/admin/lib/select/sortable-select.tsx +0 -136
  231. package/resources/templates/template-workspace/admin/lib/toast/toast.tsx +0 -112
  232. package/resources/templates/template-workspace/admin/lib/ui/button.tsx +0 -29
  233. package/resources/templates/template-workspace/admin/lib/ui/input.tsx +0 -69
  234. package/resources/templates/template-workspace/admin/lib/ui/switch.tsx +0 -9
  235. package/resources/templates/template-workspace/admin/postcss.config.js +0 -6
  236. package/resources/templates/template-workspace/admin/tailwind.config.js +0 -73
  237. package/resources/templates/template-workspace/admin/vite-env.d.ts +0 -7
  238. package/resources/templates/template-workspace/scripts/generate-client.sh +0 -8
  239. package/resources/templates/{template-workspace → default}/.github/scripts/setup-actions-variables.sh +0 -0
  240. package/resources/templates/{template-workspace → default}/admin/app/components/logo.tsx +0 -0
  241. package/resources/templates/{template-workspace → default}/admin/app/config.ts +0 -0
  242. package/resources/templates/{template-workspace → default}/admin/app/index.html +0 -0
  243. package/resources/templates/{template-workspace → default}/admin/app/pages/index.tsx +0 -0
  244. package/resources/templates/{template-workspace → default}/admin/lib/binding/delete.tsx +0 -0
  245. package/resources/templates/{template-workspace → default}/admin/lib/binding/index.ts +0 -0
  246. package/resources/templates/{template-workspace → default}/admin/lib/block-repeater/index.ts +0 -0
  247. package/resources/templates/{template-workspace → default}/admin/lib/board/index.ts +0 -0
  248. package/resources/templates/{template-workspace → default}/admin/lib/buttons/index.ts +0 -0
  249. package/resources/templates/{template-workspace → default}/admin/lib/buttons/link-back-button.tsx +0 -0
  250. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/column-leaf.tsx +0 -0
  251. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/export.tsx +0 -0
  252. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/index.ts +0 -0
  253. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/text.tsx +0 -0
  254. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/grid.tsx +0 -0
  255. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/index.ts +21 -21
  256. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/layout-switcher.tsx +0 -0
  257. /package/resources/templates/{template-workspace → default}/admin/lib/dev/index.ts +0 -0
  258. /package/resources/templates/{template-workspace → default}/admin/lib/dev/todo.tsx +0 -0
  259. /package/resources/templates/{template-workspace → default}/admin/lib/dimensions/index.ts +0 -0
  260. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/HorizontalRuleRenderer.tsx +0 -0
  261. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ListItemRenderer.tsx +0 -0
  262. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/OrderedListRenderer.tsx +0 -0
  263. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ParagraphRenderer.tsx +0 -0
  264. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ScrollTargetRenderer.tsx +0 -0
  265. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/UnorderedListRenderer.tsx +0 -0
  266. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/index.ts +0 -0
  267. /package/resources/templates/{template-workspace → default}/admin/lib/editor/index.ts +0 -0
  268. /package/resources/templates/{template-workspace → default}/admin/lib/editor/plugins.tsx +0 -0
  269. /package/resources/templates/{template-workspace → default}/admin/lib/errors/error-boundary.tsx +0 -0
  270. /package/resources/templates/{template-workspace → default}/admin/lib/errors/index.ts +0 -0
  271. /package/resources/templates/{template-workspace → default}/admin/lib/errors/use-error-formatter.ts +0 -0
  272. /package/resources/templates/{template-workspace → default}/admin/lib/field/formatted-field.tsx +0 -0
  273. /package/resources/templates/{template-workspace → default}/admin/lib/field/index.ts +0 -0
  274. /package/resources/templates/{template-workspace → default}/admin/lib/form/index.ts +0 -0
  275. /package/resources/templates/{template-workspace → default}/admin/lib/form/labels.tsx +0 -0
  276. /package/resources/templates/{template-workspace → default}/admin/lib/formatting/formatting.ts +0 -0
  277. /package/resources/templates/{template-workspace → default}/admin/lib/formatting/index.ts +0 -0
  278. /package/resources/templates/{template-workspace → default}/admin/lib/images/formatImageResizeUrl.ts +0 -0
  279. /package/resources/templates/{template-workspace → default}/admin/lib/images/index.ts +0 -0
  280. /package/resources/templates/{template-workspace → default}/admin/lib/labels/index.ts +0 -0
  281. /package/resources/templates/{template-workspace → default}/admin/lib/layout/index.ts +0 -0
  282. /package/resources/templates/{template-workspace → default}/admin/lib/layout/layout.tsx +0 -0
  283. /package/resources/templates/{template-workspace → default}/admin/lib/outdated-application-dialog/index.ts +0 -0
  284. /package/resources/templates/{template-workspace → default}/admin/lib/repeater/index.ts +0 -0
  285. /package/resources/templates/{template-workspace → default}/admin/lib/select/highlight.tsx +0 -0
  286. /package/resources/templates/{template-workspace → default}/admin/lib/select/index.ts +0 -0
  287. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/index.ts +0 -0
  288. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/hooks/useInvite.ts +0 -0
  289. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/index.ts +0 -0
  290. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/index.ts +0 -0
  291. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/otp/index.ts +0 -0
  292. /package/resources/templates/{template-workspace → default}/admin/lib/toast/index.ts +0 -0
  293. /package/resources/templates/{template-workspace → default}/admin/lib/ui/avatar.tsx +0 -0
  294. /package/resources/templates/{template-workspace → default}/admin/lib/ui/collapsible.tsx +0 -0
  295. /package/resources/templates/{template-workspace → default}/admin/lib/ui/divider.tsx +0 -0
  296. /package/resources/templates/{template-workspace → default}/admin/lib/ui/label.tsx +0 -0
  297. /package/resources/templates/{template-workspace → default}/admin/lib/ui/progress.tsx +0 -0
  298. /package/resources/templates/{template-workspace → default}/admin/lib/ui/separator.tsx +0 -0
  299. /package/resources/templates/{template-workspace → default}/admin/lib/ui/skeleton.tsx +0 -0
  300. /package/resources/templates/{template-workspace → default}/admin/lib/upload/index.ts +0 -0
  301. /package/resources/templates/{template-workspace → default}/admin/lib/utils/cn.ts +0 -0
  302. /package/resources/templates/{template-workspace → default}/admin/lib/utils/index.ts +0 -0
  303. /package/resources/templates/{template-workspace → default}/admin/public/favicon.png +0 -0
  304. /package/resources/templates/{template-workspace → default}/api/index.ts +0 -0
  305. /package/resources/templates/{template-workspace → default}/api/migrations/.gitkeep +0 -0
  306. /package/resources/templates/{template-workspace → default}/api/model/index.ts +0 -0
  307. /package/resources/templates/{template-workspace → default}/api/package.json +0 -0
  308. /package/resources/templates/{template-workspace → default}/api/tsconfig.json +0 -0
  309. /package/resources/templates/{template-workspace → default}/client/package.json +0 -0
  310. /package/resources/templates/{template-workspace → default}/client/src/index.ts +0 -0
  311. /package/resources/templates/{template-workspace → default}/client/tsconfig.json +0 -0
  312. /package/resources/templates/{template-workspace → default}/docker-compose.yaml +0 -0
  313. /package/resources/templates/{template-workspace → default}/tsconfig.json +0 -0
  314. /package/resources/templates/{template-workspace → default}/tsconfig.settings.json +0 -0
@@ -5,7 +5,6 @@ import { TenantFormError, TenantFormField } from './common'
5
5
  import { dict } from '../../dict'
6
6
  import { useEffect, useRef, useState } from 'react'
7
7
 
8
-
9
8
  export const PasswordlessSignInFormFields = ({ type, email }: { type: 'token' | 'otp'; email?: string }) => {
10
9
  const form = usePasswordlessSignInForm()
11
10
  const fieldErrors = form.errors.map(it => it.field)
@@ -19,6 +18,7 @@ export const PasswordlessSignInFormFields = ({ type, email }: { type: 'token' |
19
18
  }, [hasToken])
20
19
  const setValues = form.setValues
21
20
 
21
+ // biome-ignore lint/correctness/useExhaustiveDependencies: intentional
22
22
  useEffect(() => {
23
23
  if (type === 'otp') {
24
24
  setValues(it => ({ ...it, token: it.token.toUpperCase() }))
@@ -30,21 +30,35 @@ export const PasswordlessSignInFormFields = ({ type, email }: { type: 'token' |
30
30
  {form.state === 'success' || form.state === 'submitting' ? <Loader position="absolute" /> : null}
31
31
 
32
32
  <TenantFormError
33
- form={form} messages={dict.tenant.passwordlessSignIn.errorMessages}
33
+ form={form}
34
+ messages={dict.tenant.passwordlessSignIn.errorMessages}
34
35
  />
35
36
 
36
- {(!hasToken || fieldErrors.includes('token')) && <TenantFormField
37
- form={form} messages={dict.tenant.passwordlessSignIn.errorMessages} field="token"
38
- type="text" required autoComplete="off" autoFocus
39
- className={type === 'otp' ? 'text-2xl font-bold font-mono' : ''}
40
- >
41
- {dict.tenant.passwordlessSignIn.token}
42
- </TenantFormField>}
37
+ {(!hasToken || fieldErrors.includes('token')) && (
38
+ <TenantFormField
39
+ form={form}
40
+ messages={dict.tenant.passwordlessSignIn.errorMessages}
41
+ field="token"
42
+ type="text"
43
+ required
44
+ autoComplete="off"
45
+ autoFocus
46
+ className={type === 'otp' ? 'text-2xl font-bold font-mono' : ''}
47
+ >
48
+ {dict.tenant.passwordlessSignIn.token}
49
+ </TenantFormField>
50
+ )}
43
51
 
44
52
  {(form.state === 'otp-required' || fieldErrors.includes('otpToken')) && (
45
53
  <TenantFormField
46
- form={form} messages={dict.tenant.passwordlessSignIn.errorMessages} field="otpToken" autoComplete="one-time-code"
47
- type="text" required autoFocus maxLength={6}
54
+ form={form}
55
+ messages={dict.tenant.passwordlessSignIn.errorMessages}
56
+ field="otpToken"
57
+ autoComplete="one-time-code"
58
+ type="text"
59
+ required
60
+ autoFocus
61
+ maxLength={6}
48
62
  >
49
63
  {dict.tenant.passwordlessSignIn.otpToken}
50
64
  </TenantFormField>
@@ -56,4 +70,3 @@ export const PasswordlessSignInFormFields = ({ type, email }: { type: 'token' |
56
70
  </div>
57
71
  )
58
72
  }
59
-
@@ -5,17 +5,16 @@ import { TenantFormError, TenantFormLabel } from './common'
5
5
  import { MembershipsControl, RolesConfig, useIntrospectionRolesConfig } from './memberships-control'
6
6
  import { dict } from '../../dict'
7
7
 
8
-
9
- export const UpdateProjectMemberFormFields = ({ projectSlug, roles }: {projectSlug: string; roles?: RolesConfig}) => {
8
+ export const UpdateProjectMemberFormFields = ({ projectSlug, roles }: { projectSlug: string; roles?: RolesConfig }) => {
10
9
  const form = useUpdateProjectMemberForm()
11
- // eslint-disable-next-line react-hooks/rules-of-hooks
12
10
  const rolesResolved = roles ?? useIntrospectionRolesConfig(projectSlug)
13
11
  return (
14
12
  <div className="relative flex flex-col gap-2">
15
13
  {form.state === 'submitting' || form.state === 'loading' ? <Loader position="absolute" /> : null}
16
14
 
17
15
  <TenantFormError
18
- form={form} messages={dict.tenant.updateProjectMember.errorMessages}
16
+ form={form}
17
+ messages={dict.tenant.updateProjectMember.errorMessages}
19
18
  />
20
19
 
21
20
  <TenantFormLabel form={form} field="memberships">{dict.tenant.updateProjectMember.roles}</TenantFormLabel>
@@ -34,12 +34,11 @@ export const useInviteUser = ({ emailField, personIdField, memberships }: {
34
34
 
35
35
  return () => {
36
36
  if (!result?.ok || !result?.result) {
37
- return toast(<ToastContent title={dict.inviteErrors[result?.error?.code ?? 'fallback']} />, {
37
+ return toast(<ToastContent title={(dict.inviteErrors as Record<string, string>)[result?.error?.code ?? 'fallback']} />, {
38
38
  type: 'error',
39
39
  })
40
40
  }
41
41
  personId.updateValue(result.result.person.id)
42
42
  }
43
- },
44
- )
43
+ })
45
44
  }
@@ -18,8 +18,10 @@ export const ApiKeyList = (props: { controller?: { current?: MemberListControlle
18
18
  deleteFailed: dict.tenant.apiKeyList.deleteFailed,
19
19
  }}
20
20
  tableHeaders={[dict.tenant.apiKeyList.description]}
21
- tableColumns={it => <>
22
- <TableCell key="description">{it.identity.description ?? dict.tenant.apiKeyList.unnamed}</TableCell>
23
- </>}
21
+ tableColumns={it => (
22
+ <>
23
+ <TableCell key="description">{it.identity.description ?? dict.tenant.apiKeyList.unnamed}</TableCell>
24
+ </>
25
+ )}
24
26
  />
25
27
  )
@@ -1,4 +1,13 @@
1
- import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from '../../ui/alert-dialog'
1
+ import {
2
+ AlertDialog,
3
+ AlertDialogAction,
4
+ AlertDialogCancel,
5
+ AlertDialogContent,
6
+ AlertDialogFooter,
7
+ AlertDialogHeader,
8
+ AlertDialogTitle,
9
+ AlertDialogTrigger,
10
+ } from '../../ui/alert-dialog'
2
11
  import { Button } from '../../ui/button'
3
12
  import { TrashIcon } from 'lucide-react'
4
13
  import { dict } from '../../dict'
@@ -18,7 +27,9 @@ export const MemberDeleteDialog = ({ onError, title, identityId, onSuccess, proj
18
27
  return (
19
28
  <AlertDialog>
20
29
  <AlertDialogTrigger asChild>
21
- <Button variant="destructive"><TrashIcon className="w-3 h-3" /></Button>
30
+ <Button variant="destructive">
31
+ <TrashIcon className="w-3 h-3" />
32
+ </Button>
22
33
  </AlertDialogTrigger>
23
34
  <AlertDialogContent>
24
35
  <AlertDialogHeader>
@@ -75,17 +75,21 @@ export const MemberList = ({ filter, labels, tableColumns, controller, tableHead
75
75
  <span>
76
76
  {dict.tenant.memberList.action}
77
77
  </span>
78
- <Button variant="outline" onClick={refresh} className="ml-auto" size="sm"><RefreshCwIcon className="w-3 h-3" /></Button>
78
+ <Button variant="outline" onClick={refresh} className="ml-auto" size="sm">
79
+ <RefreshCwIcon className="w-3 h-3" />
80
+ </Button>
79
81
  </div>
80
82
  </TableHead>
81
83
  </TableRow>
82
84
  </TableHeader>
83
- {'data' in query && query.data.length === 0 &&
84
- <TableRow>
85
- <TableCell colSpan={tableHeaders.length + 2}>
86
- {dict.tenant.memberList.noResults}
87
- </TableCell>
88
- </TableRow>}
85
+ {'data' in query && query.data.length === 0
86
+ && (
87
+ <TableRow>
88
+ <TableCell colSpan={tableHeaders.length + 2}>
89
+ {dict.tenant.memberList.noResults}
90
+ </TableCell>
91
+ </TableRow>
92
+ )}
89
93
  {'data' in query && query.data.slice(0, perPage).map(it => (
90
94
  <TableRow key={it.identity.id}>
91
95
  {tableColumns(it)}
@@ -99,7 +103,6 @@ export const MemberList = ({ filter, labels, tableColumns, controller, tableHead
99
103
  title={labels.deleteConfirmation}
100
104
  />
101
105
  <EditMembershipDialog projectSlug={projectSlug} identityId={it.identity.id} onSuccess={refresh} roles={roles} />
102
-
103
106
  </TableCell>
104
107
  </TableRow>
105
108
  ))}
@@ -119,14 +122,17 @@ export const MemberList = ({ filter, labels, tableColumns, controller, tableHead
119
122
  }
120
123
  }
121
124
 
122
- const EditMembershipDialog = ({ projectSlug, identityId, onSuccess, roles }: { projectSlug: string; identityId: string; onSuccess: () => void; roles?: RolesConfig }) => {
123
-
125
+ const EditMembershipDialog = (
126
+ { projectSlug, identityId, onSuccess, roles }: { projectSlug: string; identityId: string; onSuccess: () => void; roles?: RolesConfig },
127
+ ) => {
124
128
  const showToast = useShowToast()
125
129
  const [open, setOpen] = useState(false)
126
130
  return (
127
131
  <Dialog open={open} onOpenChange={setOpen}>
128
132
  <DialogTrigger asChild>
129
- <Button variant="outline"><PencilIcon className="w-3 h-3" /></Button>
133
+ <Button variant="outline">
134
+ <PencilIcon className="w-3 h-3" />
135
+ </Button>
130
136
  </DialogTrigger>
131
137
  <DialogContent>
132
138
  <UpdateProjectMemberForm
@@ -18,9 +18,11 @@ export const PersonList = (props: { controller?: { current?: MemberListControlle
18
18
  deleteFailed: dict.tenant.personList.deleteFailed,
19
19
  }}
20
20
  tableHeaders={[dict.tenant.personList.email, dict.tenant.personList.name]}
21
- tableColumns={it => <>
22
- <TableCell key="email">{it.identity.person?.email ?? dict.tenant.personList.noEmail}</TableCell>
23
- <TableCell key="name">{it.identity.person?.name ?? dict.tenant.personList.noName}</TableCell>
24
- </>}
21
+ tableColumns={it => (
22
+ <>
23
+ <TableCell key="email">{it.identity.person?.email ?? dict.tenant.personList.noEmail}</TableCell>
24
+ <TableCell key="name">{it.identity.person?.name ?? dict.tenant.personList.noName}</TableCell>
25
+ </>
26
+ )}
25
27
  />
26
28
  )
@@ -3,7 +3,17 @@ import qrcode from 'qrcode-generator'
3
3
  import { DisableOtpTrigger, OtpConfirmForm, OtpPrepareForm, useIdentity, useOtpConfirmForm, useOtpPrepareForm } from '@contember/interface'
4
4
  import { Loader } from '../../ui/loader'
5
5
  import { Button } from '../../ui/button'
6
- import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from '../../ui/alert-dialog'
6
+ import {
7
+ AlertDialog,
8
+ AlertDialogAction,
9
+ AlertDialogCancel,
10
+ AlertDialogContent,
11
+ AlertDialogDescription,
12
+ AlertDialogFooter,
13
+ AlertDialogHeader,
14
+ AlertDialogTitle,
15
+ AlertDialogTrigger,
16
+ } from '../../ui/alert-dialog'
7
17
  import { TenantFormError, TenantFormField } from '../forms/common'
8
18
  import { ToastContent, useShowToast } from '../../toast'
9
19
  import { dict } from '../../dict'
@@ -29,73 +39,85 @@ export const OtpSetup = () => {
29
39
  }}
30
40
  >
31
41
  <form>
32
- {person.otpEnabled && <>
33
- <div className="border-destructive border p-4 mb-4 rounded">
34
- {dict.tenant.otpSetup.alreadyHaveOtp}
35
- </div>
36
- </>}
42
+ {person.otpEnabled && (
43
+ <>
44
+ <div className="border border-destructive p-4 mb-4 rounded-sm">
45
+ {dict.tenant.otpSetup.alreadyHaveOtp}
46
+ </div>
47
+ </>
48
+ )}
37
49
  <OtpPrepareFormFields />
38
50
  </form>
39
51
  </OtpPrepareForm>
40
52
  )
41
53
  }
42
54
  if (otpUri) {
43
- return <>
44
- <p>
45
- {dict.tenant.otpSetup.nowScanQrCode}
46
- </p>
47
- <QrCode data={otpUri} />
48
- <p>
49
- {dict.tenant.otpSetup.writeDownCode}
50
- </p>
51
- <OtpConfirmForm onSuccess={() => {
52
- showToast(<ToastContent>{dict.tenant.otpSetup.enabledSuccess}</ToastContent>, { type: 'success' })
53
- }}>
54
- <form>
55
- <OtpConfirmFormFields />
56
- </form>
57
- </OtpConfirmForm>
58
- </>
55
+ return (
56
+ <>
57
+ <p>
58
+ {dict.tenant.otpSetup.nowScanQrCode}
59
+ </p>
60
+ <QrCode data={otpUri} />
61
+ <p>
62
+ {dict.tenant.otpSetup.writeDownCode}
63
+ </p>
64
+ <OtpConfirmForm
65
+ onSuccess={() => {
66
+ showToast(<ToastContent>{dict.tenant.otpSetup.enabledSuccess}</ToastContent>, { type: 'success' })
67
+ }}
68
+ >
69
+ <form>
70
+ <OtpConfirmFormFields />
71
+ </form>
72
+ </OtpConfirmForm>
73
+ </>
74
+ )
59
75
  }
60
76
 
61
77
  if (person.otpEnabled) {
62
- return <>
78
+ return (
79
+ <>
80
+ <p>
81
+ {dict.tenant.otpSetup.twoFactorEnabled}
82
+ </p>
83
+ <AlertDialog>
84
+ <AlertDialogTrigger asChild>
85
+ <Button variant="destructive">{dict.tenant.otpSetup.disableTwoFactor}</Button>
86
+ </AlertDialogTrigger>
87
+ <AlertDialogContent>
88
+ <AlertDialogHeader>
89
+ <AlertDialogTitle>{dict.tenant.otpSetup.disableTwoFactor}</AlertDialogTitle>
90
+ <AlertDialogDescription>{dict.tenant.otpSetup.disableTwoFactorConfirm}</AlertDialogDescription>
91
+ </AlertDialogHeader>
92
+ <AlertDialogFooter>
93
+ <AlertDialogCancel>
94
+ {dict.tenant.otpSetup.cancel}
95
+ </AlertDialogCancel>
96
+ <DisableOtpTrigger
97
+ onSuccess={() => {
98
+ showToast(<ToastContent>{dict.tenant.otpSetup.disabledSuccess}</ToastContent>, { type: 'success' })
99
+ }}
100
+ >
101
+ <AlertDialogAction variant="destructive">
102
+ {dict.tenant.otpSetup.disable}
103
+ </AlertDialogAction>
104
+ </DisableOtpTrigger>
105
+ </AlertDialogFooter>
106
+ </AlertDialogContent>
107
+ </AlertDialog>
108
+ <p>{dict.tenant.otpSetup.alreadyHaveOtp}</p>
109
+ <Button onClick={() => setInitializingOtp(true)}>{dict.tenant.otpSetup.setupAgain}</Button>
110
+ </>
111
+ )
112
+ }
113
+ return (
114
+ <>
63
115
  <p>
64
- {dict.tenant.otpSetup.twoFactorEnabled}
116
+ {dict.tenant.otpSetup.description}
65
117
  </p>
66
- <AlertDialog>
67
- <AlertDialogTrigger asChild>
68
- <Button variant="destructive">{dict.tenant.otpSetup.disableTwoFactor}</Button>
69
- </AlertDialogTrigger>
70
- <AlertDialogContent>
71
- <AlertDialogHeader>
72
- <AlertDialogTitle>{dict.tenant.otpSetup.disableTwoFactor}</AlertDialogTitle>
73
- <AlertDialogDescription>{dict.tenant.otpSetup.disableTwoFactorConfirm}</AlertDialogDescription>
74
- </AlertDialogHeader>
75
- <AlertDialogFooter>
76
- <AlertDialogCancel>
77
- {dict.tenant.otpSetup.cancel}
78
- </AlertDialogCancel>
79
- <DisableOtpTrigger onSuccess={() => {
80
- showToast(<ToastContent>{dict.tenant.otpSetup.disabledSuccess}</ToastContent>, { type: 'success' })
81
- }}>
82
- <AlertDialogAction variant="destructive">
83
- {dict.tenant.otpSetup.disable}
84
- </AlertDialogAction>
85
- </DisableOtpTrigger>
86
- </AlertDialogFooter>
87
- </AlertDialogContent>
88
- </AlertDialog>
89
- <p>{dict.tenant.otpSetup.alreadyHaveOtp}</p>
90
- <Button onClick={() => setInitializingOtp(true)}>{dict.tenant.otpSetup.setupAgain}</Button>
118
+ <Button onClick={() => setInitializingOtp(true)}>{dict.tenant.otpSetup.setupTwoFactor}</Button>
91
119
  </>
92
- }
93
- return <>
94
- <p>
95
- {dict.tenant.otpSetup.description}
96
- </p>
97
- <Button onClick={() => setInitializingOtp(true)}>{dict.tenant.otpSetup.setupTwoFactor}</Button>
98
- </>
120
+ )
99
121
  }
100
122
 
101
123
  const QrCode = ({ data }: { data: string }) => {
@@ -115,8 +137,11 @@ export const OtpConfirmFormFields = () => {
115
137
  {form.state === 'success' || form.state === 'submitting' ? <Loader position="absolute" /> : null}
116
138
  <TenantFormError form={form} messages={dict.tenant.otpSetup.otpConfirmFormErrorMessages} />
117
139
  <TenantFormField
118
- form={form} messages={dict.tenant.otpSetup.otpConfirmFormErrorMessages} field="otpToken"
119
- type="text" required
140
+ form={form}
141
+ messages={dict.tenant.otpSetup.otpConfirmFormErrorMessages}
142
+ field="otpToken"
143
+ type="text"
144
+ required
120
145
  >
121
146
  {dict.tenant.otpSetup.otpToken}
122
147
  </TenantFormField>
@@ -133,7 +158,9 @@ export const OtpPrepareFormFields = () => {
133
158
  {form.state === 'success' || form.state === 'submitting' ? <Loader position="absolute" /> : null}
134
159
  <TenantFormError form={form} messages={dict.tenant.otpSetup.otpPrepareFormErrorMessages} />
135
160
  <TenantFormField
136
- form={form} messages={dict.tenant.otpSetup.otpPrepareFormErrorMessages} field="label"
161
+ form={form}
162
+ messages={dict.tenant.otpSetup.otpPrepareFormErrorMessages}
163
+ field="label"
137
164
  type="text"
138
165
  >
139
166
  {dict.tenant.otpSetup.label}
@@ -0,0 +1,113 @@
1
+ import * as React from 'react'
2
+ import { ReactNode } from 'react'
3
+ import * as ToastPrimitives from '@radix-ui/react-toast'
4
+ import { X } from 'lucide-react'
5
+ import { uic } from '../utils'
6
+ import { ToasterProvider, useToasts } from './toaster'
7
+ import { dict } from '../dict'
8
+
9
+ export const ToastContent = ({ title, children, action, details }: {
10
+ title?: ReactNode
11
+ children?: ReactNode
12
+ action?: ReactNode
13
+ details?: ReactNode
14
+ }) => {
15
+ const [open, setOpen] = React.useState(false)
16
+
17
+ return (
18
+ <>
19
+ <div className="flex flex-col gap-1 flex-1 p-6 pr-8">
20
+ {title && <ToastTitle>{title}</ToastTitle>}
21
+ {children && <ToastDescription>{children}</ToastDescription>}
22
+ {details
23
+ ? (
24
+ open ? <code className="p-1 bg-gray-50 border border-gray-200 rounded-sm font-mono text-xs">{details}</code> : (
25
+ <div>
26
+ <button onClick={() => setOpen(true)} className="text-sm text-gray-400 underline">{dict.toast.showDetails}</button>
27
+ </div>
28
+ )
29
+ )
30
+ : null}
31
+ </div>
32
+ {action}
33
+ </>
34
+ )
35
+ }
36
+ export const ToastAction = uic(ToastPrimitives.Action, {
37
+ baseClass:
38
+ 'inline-flex h-8 shrink-0 items-center justify-center rounded-md border border-gray-200 bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive',
39
+ displayName: 'ToastAction',
40
+ })
41
+
42
+ export const ToastTitle = uic(ToastPrimitives.Title, {
43
+ baseClass: 'text-sm font-semibold',
44
+ displayName: 'ToastTitle',
45
+ })
46
+
47
+ export const ToastDescription = uic(ToastPrimitives.Description, {
48
+ baseClass: 'text-sm opacity-90',
49
+ displayName: 'ToastDescription',
50
+ })
51
+
52
+ export const Toast = uic(ToastPrimitives.Root, {
53
+ baseClass:
54
+ 'group mt-2 pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-r-md border border-l-4 border-gray-200 bg-background text-foreground shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full',
55
+ variants: {
56
+ variant: {
57
+ info: 'border-l-blue-500',
58
+ error: 'border-l-destructive',
59
+ warning: 'border-l-orange-500',
60
+ success: 'border-l-green-500',
61
+ },
62
+ },
63
+ defaultVariants: {
64
+ variant: 'info',
65
+ },
66
+ displayName: 'Toast',
67
+ defaultProps: {
68
+ style: {
69
+ userSelect: 'auto',
70
+ },
71
+ },
72
+ })
73
+
74
+ const ToastClose = uic(ToastPrimitives.Close, {
75
+ baseClass:
76
+ 'absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-hidden focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600',
77
+ displayName: 'ToastClose',
78
+ beforeChildren: <X className="h-4 w-4" />,
79
+ })
80
+
81
+ const ToastViewport = uic(ToastPrimitives.Viewport, {
82
+ baseClass: 'fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]',
83
+ displayName: 'ToastViewport',
84
+ })
85
+
86
+ export function Toaster({ children }: {
87
+ children: ReactNode
88
+ }) {
89
+ return (
90
+ <ToasterProvider>
91
+ <ToastPrimitives.Provider duration={Infinity}>
92
+ {children}
93
+ <ToastList />
94
+ <ToastViewport />
95
+ </ToastPrimitives.Provider>
96
+ </ToasterProvider>
97
+ )
98
+ }
99
+
100
+ const ToastList = () => {
101
+ const toasts = useToasts()
102
+
103
+ return (
104
+ <>
105
+ {toasts.map(({ id, content, type }) => (
106
+ <Toast key={id} variant={type}>
107
+ {content}
108
+ <ToastClose />
109
+ </Toast>
110
+ ))}
111
+ </>
112
+ )
113
+ }
@@ -78,7 +78,6 @@ export const ToasterProvider = ({ children }: {
78
78
  setTimeout(dismiss, dismissMs)
79
79
  }
80
80
 
81
-
82
81
  return {
83
82
  dismiss,
84
83
  updateContent: content => {
@@ -14,12 +14,14 @@ export const AlertDialogTrigger = AlertDialogPrimitive.Trigger
14
14
  export const AlertDialogPortal = AlertDialogPrimitive.Portal
15
15
 
16
16
  export const AlertDialogOverlay = uic(AlertDialogPrimitive.Overlay, {
17
- baseClass: 'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
17
+ baseClass:
18
+ 'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
18
19
  displayName: 'AlertDialogOverlay',
19
20
  })
20
21
 
21
22
  export const AlertDialogContent = uic(AlertDialogPrimitive.Content, {
22
- baseClass: 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
23
+ baseClass:
24
+ 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
23
25
  wrapOuter: props => {
24
26
  return (
25
27
  <AlertDialogPortal>
@@ -46,7 +48,6 @@ export const AlertDialogTitle = uic(AlertDialogPrimitive.Title, {
46
48
  displayName: 'AlertDialogTitle',
47
49
  })
48
50
 
49
-
50
51
  export const AlertDialogDescription = uic(AlertDialogPrimitive.Description, {
51
52
  baseClass: 'text-sm text-muted-foreground',
52
53
  displayName: 'AlertDialogDescription',
@@ -0,0 +1,30 @@
1
+ import { uic, uiconfig } from '../utils'
2
+
3
+ export const buttonConfig = uiconfig({
4
+ baseClass:
5
+ 'inline-flex items-center justify-center rounded-md text-sm font-medium whitespace-nowrap transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 transition-all',
6
+ variants: {
7
+ variant: {
8
+ default: 'bg-primary text-primary-foreground shadow-sm hover:bg-primary/90',
9
+ destructive: 'bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90',
10
+ outline: 'border border-input bg-background-upper shadow-xs hover:bg-accent hover:text-accent-foreground',
11
+ secondary: 'bg-secondary border border-input text-secondary-foreground shadow-xs hover:bg-secondary/80',
12
+ ghost: 'hover:bg-accent hover:text-accent-foreground',
13
+ link: 'text-primary underline-offset-4 hover:underline',
14
+ },
15
+ size: {
16
+ default: 'h-9 px-4 py-2',
17
+ xs: 'h-6 rounded-sm px-2 text-xs',
18
+ sm: 'h-8 rounded-md px-3 text-xs',
19
+ lg: 'h-10 rounded-md px-8',
20
+ icon: 'h-9 w-9',
21
+ },
22
+ },
23
+ defaultVariants: {
24
+ variant: 'default',
25
+ size: 'default',
26
+ },
27
+ })
28
+
29
+ export const Button = uic('button', buttonConfig)
30
+ export const AnchorButton = uic('a', buttonConfig)
@@ -1,7 +1,7 @@
1
1
  import { uic } from '../utils'
2
2
 
3
3
  export const Card = uic('div', {
4
- baseClass: 'rounded-xl border bg-card text-card-foreground shadow',
4
+ baseClass: 'rounded-xl border border-gray-200 bg-card text-card-foreground shadow-sm',
5
5
  })
6
6
 
7
7
  export const CardHeader = uic('div', {
@@ -13,24 +13,28 @@ export const DialogPortal = DialogPrimitive.Portal
13
13
  export const DialogClose = DialogPrimitive.Close
14
14
 
15
15
  export const DialogOverlay = uic(DialogPrimitive.DialogOverlay, {
16
- baseClass: 'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
16
+ baseClass:
17
+ 'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
17
18
  displayName: 'DialogOverlay',
18
19
  })
19
20
 
20
21
  export const DialogContent = uic(DialogPrimitive.Content, {
21
- baseClass: 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
22
+ baseClass:
23
+ 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200 bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
22
24
  wrapOuter: props => (
23
25
  <DialogPortal>
24
26
  <DialogOverlay />
25
27
  {props.children}
26
28
  </DialogPortal>
27
29
  ),
28
- afterChildren: <>
29
- <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
30
- <XIcon className="h-4 w-4" />
31
- <span className="sr-only">Close</span>
32
- </DialogPrimitive.Close>
33
- </>,
30
+ afterChildren: (
31
+ <>
32
+ <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
33
+ <XIcon className="h-4 w-4" />
34
+ <span className="sr-only">Close</span>
35
+ </DialogPrimitive.Close>
36
+ </>
37
+ ),
34
38
  })
35
39
 
36
40
  export const DialogHeader = uic('div', {
@@ -0,0 +1,9 @@
1
+ import { uic } from '../utils'
2
+
3
+ export const DimensionLabelWrapperUI = uic('div', {
4
+ baseClass: 'flex justify-between items-center',
5
+ })
6
+
7
+ export const DimensionLabelUI = uic('span', {
8
+ baseClass: 'ml-1 bg-gray-100 border border-gray-300 px-1 rounded text-xs pointer-events-none',
9
+ })