@contember/create 2.1.0-rc.3 → 2.2.0-alpha.10

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 (279) hide show
  1. package/CLAUDE.md +22 -0
  2. package/dist/development/run.cjs +7 -7
  3. package/dist/development/run.cjs.map +1 -1
  4. package/dist/development/run.js +8 -8
  5. package/dist/development/run.js.map +1 -1
  6. package/dist/development/src/commands/WorkspaceCreateCommand.cjs +28 -14
  7. package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  8. package/dist/development/src/commands/WorkspaceCreateCommand.js +28 -14
  9. package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
  10. package/dist/development/src/lib/FileSystem.cjs +1 -2
  11. package/dist/development/src/lib/FileSystem.cjs.map +1 -1
  12. package/dist/development/src/lib/FileSystem.js +1 -2
  13. package/dist/development/src/lib/FileSystem.js.map +1 -1
  14. package/dist/development/src/lib/TemplateInstaller.cjs +79 -67
  15. package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
  16. package/dist/development/src/lib/TemplateInstaller.js +72 -60
  17. package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
  18. package/dist/development/src/lib/packageManagerDetector.cjs +6 -6
  19. package/dist/development/src/lib/packageManagerDetector.cjs.map +1 -1
  20. package/dist/development/src/lib/version.cjs +2 -2
  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 +3 -3
  24. package/dist/development/src/paths.cjs.map +1 -1
  25. package/dist/production/run.cjs +7 -7
  26. package/dist/production/run.cjs.map +1 -1
  27. package/dist/production/run.js +8 -8
  28. package/dist/production/run.js.map +1 -1
  29. package/dist/production/src/commands/WorkspaceCreateCommand.cjs +28 -14
  30. package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  31. package/dist/production/src/commands/WorkspaceCreateCommand.js +28 -14
  32. package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
  33. package/dist/production/src/lib/FileSystem.cjs +1 -2
  34. package/dist/production/src/lib/FileSystem.cjs.map +1 -1
  35. package/dist/production/src/lib/FileSystem.js +1 -2
  36. package/dist/production/src/lib/FileSystem.js.map +1 -1
  37. package/dist/production/src/lib/TemplateInstaller.cjs +79 -67
  38. package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
  39. package/dist/production/src/lib/TemplateInstaller.js +72 -60
  40. package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
  41. package/dist/production/src/lib/packageManagerDetector.cjs +6 -6
  42. package/dist/production/src/lib/packageManagerDetector.cjs.map +1 -1
  43. package/dist/production/src/lib/version.cjs +2 -2
  44. package/dist/production/src/lib/version.cjs.map +1 -1
  45. package/dist/production/src/lib/version.js.map +1 -1
  46. package/dist/production/src/paths.cjs +3 -3
  47. package/dist/production/src/paths.cjs.map +1 -1
  48. package/dist/types/commands/WorkspaceCreateCommand.d.ts +16 -4
  49. package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -1
  50. package/dist/types/commands/index.d.ts +1 -1
  51. package/dist/types/commands/index.d.ts.map +1 -1
  52. package/dist/types/lib/FileSystem.d.ts +3 -2
  53. package/dist/types/lib/FileSystem.d.ts.map +1 -1
  54. package/dist/types/lib/TemplateInstaller.d.ts +10 -2
  55. package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
  56. package/dist/types/tsconfig.tsbuildinfo +1 -1
  57. package/package.json +3 -4
  58. package/resources/templates/default/README.md +3 -1
  59. package/resources/templates/default/admin/app/components/navigation.tsx +95 -8
  60. package/resources/templates/default/admin/app/pages/tenant.tsx +328 -77
  61. package/resources/templates/default/admin/entrypoint/components/login.tsx +1 -1
  62. package/resources/templates/default/admin/entrypoint/pages/magicLink.tsx +1 -1
  63. package/resources/templates/default/admin/entrypoint/pages/magicLinkSent.tsx +1 -1
  64. package/resources/templates/default/admin/entrypoint/pages/passwordReset.tsx +1 -1
  65. package/resources/templates/default/admin/entrypoint/pages/resetRequest.tsx +1 -1
  66. package/resources/templates/default/admin/entrypoint/pages/resetRequestSuccess.tsx +1 -1
  67. package/resources/templates/default/admin/lib/binding/binding.tsx +19 -4
  68. package/resources/templates/default/admin/lib/binding/delete.tsx +37 -3
  69. package/resources/templates/default/admin/lib/binding/hooks.tsx +65 -3
  70. package/resources/templates/default/admin/lib/binding/identity.tsx +17 -4
  71. package/resources/templates/default/admin/lib/binding/index.ts +5 -5
  72. package/resources/templates/default/admin/lib/binding/navigation-guard-dialog.tsx +15 -3
  73. package/resources/templates/default/admin/lib/binding/persist.tsx +27 -5
  74. package/resources/templates/default/admin/lib/block-repeater/block-repeater.tsx +15 -11
  75. package/resources/templates/default/admin/lib/block-repeater/index.ts +1 -1
  76. package/resources/templates/default/admin/lib/board/board.tsx +2 -2
  77. package/resources/templates/default/admin/lib/board/index.ts +1 -1
  78. package/resources/templates/default/admin/lib/buttons/back-button.tsx +22 -2
  79. package/resources/templates/default/admin/lib/buttons/index.ts +2 -2
  80. package/resources/templates/default/admin/lib/buttons/link-back-button.tsx +11 -2
  81. package/resources/templates/default/admin/lib/datagrid/cells.tsx +3 -3
  82. package/resources/templates/default/admin/lib/datagrid/column-header.tsx +4 -4
  83. package/resources/templates/default/admin/lib/datagrid/columns.tsx +28 -14
  84. package/resources/templates/default/admin/lib/datagrid/elements.tsx +2 -2
  85. package/resources/templates/default/admin/lib/datagrid/empty.tsx +1 -1
  86. package/resources/templates/default/admin/lib/datagrid/export.tsx +2 -2
  87. package/resources/templates/default/admin/lib/datagrid/filters/boolean.tsx +13 -13
  88. package/resources/templates/default/admin/lib/datagrid/filters/common.tsx +2 -2
  89. package/resources/templates/default/admin/lib/datagrid/filters/date.tsx +37 -16
  90. package/resources/templates/default/admin/lib/datagrid/filters/defined.tsx +13 -12
  91. package/resources/templates/default/admin/lib/datagrid/filters/enum.tsx +56 -22
  92. package/resources/templates/default/admin/lib/datagrid/filters/index.ts +7 -7
  93. package/resources/templates/default/admin/lib/datagrid/filters/mobile.tsx +18 -0
  94. package/resources/templates/default/admin/lib/datagrid/filters/number.tsx +10 -13
  95. package/resources/templates/default/admin/lib/datagrid/filters/relation.tsx +8 -8
  96. package/resources/templates/default/admin/lib/datagrid/filters/text.tsx +9 -9
  97. package/resources/templates/default/admin/lib/datagrid/grid.tsx +31 -23
  98. package/resources/templates/default/admin/lib/datagrid/index.ts +12 -12
  99. package/resources/templates/default/admin/lib/datagrid/labels.tsx +22 -4
  100. package/resources/templates/default/admin/lib/datagrid/layout-switcher.tsx +10 -4
  101. package/resources/templates/default/admin/lib/datagrid/loader.tsx +4 -4
  102. package/resources/templates/default/admin/lib/datagrid/pagination.tsx +16 -6
  103. package/resources/templates/default/admin/lib/datagrid/table.tsx +8 -6
  104. package/resources/templates/default/admin/lib/datagrid/tiles.tsx +6 -5
  105. package/resources/templates/default/admin/lib/datagrid/toolbar.tsx +15 -19
  106. package/resources/templates/default/admin/lib/datagrid/ui.tsx +3 -3
  107. package/resources/templates/default/admin/lib/dev/index.ts +2 -2
  108. package/resources/templates/default/admin/lib/dev/login-panel.tsx +12 -3
  109. package/resources/templates/default/admin/lib/dev/todo.tsx +12 -0
  110. package/resources/templates/default/admin/lib/dict.ts +0 -261
  111. package/resources/templates/default/admin/lib/dimensions/dimensions.tsx +85 -4
  112. package/resources/templates/default/admin/lib/dimensions/index.ts +1 -1
  113. package/resources/templates/default/admin/lib/editor/block-editor.tsx +72 -3
  114. package/resources/templates/default/admin/lib/editor/common/baseEditorPlugins.tsx +54 -11
  115. package/resources/templates/default/admin/lib/editor/common/buttons.tsx +1 -1
  116. package/resources/templates/default/admin/lib/editor/common/editor-block-toolbar.tsx +1 -1
  117. package/resources/templates/default/admin/lib/editor/common/elements/HeadingRenderer.tsx +1 -1
  118. package/resources/templates/default/admin/lib/editor/common/elements/HorizontalRuleRenderer.tsx +1 -1
  119. package/resources/templates/default/admin/lib/editor/common/elements/ListItemRenderer.tsx +1 -1
  120. package/resources/templates/default/admin/lib/editor/common/elements/OrderedListRenderer.tsx +1 -1
  121. package/resources/templates/default/admin/lib/editor/common/elements/TableElementRenderer.tsx +1 -1
  122. package/resources/templates/default/admin/lib/editor/common/elements/UnorderedListRenderer.tsx +1 -1
  123. package/resources/templates/default/admin/lib/editor/common/index.ts +6 -6
  124. package/resources/templates/default/admin/lib/editor/editor-block.tsx +54 -3
  125. package/resources/templates/default/admin/lib/editor/index.ts +6 -6
  126. package/resources/templates/default/admin/lib/editor/plugins.tsx +46 -2
  127. package/resources/templates/default/admin/lib/editor/rich-text-view.tsx +44 -0
  128. package/resources/templates/default/admin/lib/editor/rich-text.tsx +31 -3
  129. package/resources/templates/default/admin/lib/editor/sortable-block.tsx +34 -2
  130. package/resources/templates/default/admin/lib/errors/index.ts +1 -1
  131. package/resources/templates/default/admin/lib/errors/use-error-formatter.ts +22 -1
  132. package/resources/templates/default/admin/lib/field/formatted-field.tsx +16 -1
  133. package/resources/templates/default/admin/lib/field/index.ts +2 -1
  134. package/resources/templates/default/admin/lib/field/list-field.tsx +56 -0
  135. package/resources/templates/default/admin/lib/form/container.tsx +33 -3
  136. package/resources/templates/default/admin/lib/form/index.ts +6 -5
  137. package/resources/templates/default/admin/lib/form/inputs.tsx +105 -6
  138. package/resources/templates/default/admin/lib/form/labels.tsx +1 -1
  139. package/resources/templates/default/admin/lib/form/select.tsx +162 -5
  140. package/resources/templates/default/admin/lib/form/ui.tsx +2 -2
  141. package/resources/templates/default/admin/lib/form/upload-repeaters.tsx +159 -5
  142. package/resources/templates/default/admin/lib/form/upload.tsx +116 -3
  143. package/resources/templates/default/admin/lib/formatting/formatting.ts +106 -1
  144. package/resources/templates/default/admin/lib/formatting/index.ts +1 -1
  145. package/resources/templates/default/admin/lib/images/formatImageResizeUrl.ts +19 -0
  146. package/resources/templates/default/admin/lib/images/index.ts +1 -1
  147. package/resources/templates/default/admin/lib/index.ts +54 -0
  148. package/resources/templates/default/admin/lib/labels/index.ts +2 -2
  149. package/resources/templates/default/admin/lib/layout/index.ts +3 -3
  150. package/resources/templates/default/admin/lib/layout/layout-boxed.tsx +5 -5
  151. package/resources/templates/default/admin/lib/layout/layout.tsx +3 -3
  152. package/resources/templates/default/admin/lib/outdated-application-dialog/index.ts +1 -1
  153. package/resources/templates/default/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +2 -2
  154. package/resources/templates/default/admin/lib/repeater/index.ts +1 -1
  155. package/resources/templates/default/admin/lib/repeater/repeater.tsx +26 -9
  156. package/resources/templates/default/admin/lib/select/create-new.tsx +19 -3
  157. package/resources/templates/default/admin/lib/select/filter.tsx +8 -2
  158. package/resources/templates/default/admin/lib/select/highlight.tsx +16 -0
  159. package/resources/templates/default/admin/lib/select/index.ts +6 -6
  160. package/resources/templates/default/admin/lib/select/list.tsx +30 -6
  161. package/resources/templates/default/admin/lib/select/multi-select.tsx +41 -4
  162. package/resources/templates/default/admin/lib/select/select.tsx +44 -6
  163. package/resources/templates/default/admin/lib/select/sortable-select.tsx +15 -6
  164. package/resources/templates/default/admin/lib/select/ui.tsx +100 -4
  165. package/resources/templates/default/admin/lib/tenant/config/auth-policy-list.tsx +86 -0
  166. package/resources/templates/default/admin/lib/tenant/config/common.tsx +71 -0
  167. package/resources/templates/default/admin/lib/tenant/config/identity-provider-list.tsx +113 -0
  168. package/resources/templates/default/admin/lib/tenant/config/index.ts +5 -0
  169. package/resources/templates/default/admin/lib/tenant/config/mail-template-list.tsx +108 -0
  170. package/resources/templates/default/admin/lib/tenant/config/tenant-config-view.tsx +182 -0
  171. package/resources/templates/default/admin/lib/tenant/dict.ts +770 -0
  172. package/resources/templates/default/admin/lib/tenant/errors.ts +10 -0
  173. package/resources/templates/default/admin/lib/tenant/forms/add-project-member.tsx +57 -0
  174. package/resources/templates/default/admin/lib/tenant/forms/change-my-password.tsx +4 -4
  175. package/resources/templates/default/admin/lib/tenant/forms/change-my-profile.tsx +40 -0
  176. package/resources/templates/default/admin/lib/tenant/forms/change-profile.tsx +55 -0
  177. package/resources/templates/default/admin/lib/tenant/forms/common.tsx +12 -5
  178. package/resources/templates/default/admin/lib/tenant/forms/confirm-email-change.tsx +38 -0
  179. package/resources/templates/default/admin/lib/tenant/forms/create-api-key.tsx +5 -5
  180. package/resources/templates/default/admin/lib/tenant/forms/create-global-api-key.tsx +69 -0
  181. package/resources/templates/default/admin/lib/tenant/forms/global-roles-control.tsx +113 -0
  182. package/resources/templates/default/admin/lib/tenant/forms/index.ts +23 -8
  183. package/resources/templates/default/admin/lib/tenant/forms/invite.tsx +46 -8
  184. package/resources/templates/default/admin/lib/tenant/forms/login.tsx +8 -14
  185. package/resources/templates/default/admin/lib/tenant/forms/memberships-control.tsx +7 -5
  186. package/resources/templates/default/admin/lib/tenant/forms/mfa-code-fields.tsx +81 -0
  187. package/resources/templates/default/admin/lib/tenant/forms/password-reset-request.tsx +4 -4
  188. package/resources/templates/default/admin/lib/tenant/forms/password-reset.tsx +4 -4
  189. package/resources/templates/default/admin/lib/tenant/forms/passwordless-signin-init.tsx +4 -4
  190. package/resources/templates/default/admin/lib/tenant/forms/passwordless-signin.tsx +8 -14
  191. package/resources/templates/default/admin/lib/tenant/forms/request-email-verification.tsx +35 -0
  192. package/resources/templates/default/admin/lib/tenant/forms/set-person-password.tsx +58 -0
  193. package/resources/templates/default/admin/lib/tenant/forms/set-project-secret.tsx +59 -0
  194. package/resources/templates/default/admin/lib/tenant/forms/sign-up.tsx +73 -0
  195. package/resources/templates/default/admin/lib/tenant/forms/update-project-member.tsx +14 -5
  196. package/resources/templates/default/admin/lib/tenant/forms/verify-email.tsx +38 -0
  197. package/resources/templates/default/admin/lib/tenant/hooks/index.ts +2 -0
  198. package/resources/templates/default/admin/lib/tenant/hooks/useInvite.ts +41 -0
  199. package/resources/templates/default/admin/lib/tenant/hooks/useInviteUser.tsx +32 -3
  200. package/resources/templates/default/admin/lib/tenant/idp/identity-provider-connections.tsx +124 -0
  201. package/resources/templates/default/admin/lib/tenant/idp/index.ts +1 -0
  202. package/resources/templates/default/admin/lib/tenant/index.ts +10 -3
  203. package/resources/templates/default/admin/lib/tenant/listing/api-key-list.tsx +161 -23
  204. package/resources/templates/default/admin/lib/tenant/listing/auth-log-list.tsx +179 -0
  205. package/resources/templates/default/admin/lib/tenant/listing/global-api-key-list.tsx +149 -0
  206. package/resources/templates/default/admin/lib/tenant/listing/index.ts +11 -4
  207. package/resources/templates/default/admin/lib/tenant/listing/member-delete-dialog.tsx +4 -4
  208. package/resources/templates/default/admin/lib/tenant/listing/member-list.tsx +28 -19
  209. package/resources/templates/default/admin/lib/tenant/listing/mfa.tsx +29 -0
  210. package/resources/templates/default/admin/lib/tenant/listing/person-actions.tsx +179 -0
  211. package/resources/templates/default/admin/lib/tenant/listing/person-detail.tsx +141 -0
  212. package/resources/templates/default/admin/lib/tenant/listing/person-list.tsx +17 -6
  213. package/resources/templates/default/admin/lib/tenant/listing/persons-list.tsx +128 -0
  214. package/resources/templates/default/admin/lib/tenant/listing/project-secret-list.tsx +82 -0
  215. package/resources/templates/default/admin/lib/tenant/otp/backup-codes.tsx +81 -0
  216. package/resources/templates/default/admin/lib/tenant/otp/email-otp-setup.tsx +133 -0
  217. package/resources/templates/default/admin/lib/tenant/otp/index.ts +3 -1
  218. package/resources/templates/default/admin/lib/tenant/otp/otp-setup.tsx +6 -6
  219. package/resources/templates/default/admin/lib/tenant/security/index.ts +2 -0
  220. package/resources/templates/default/admin/lib/tenant/security/passwordless-toggle.tsx +63 -0
  221. package/resources/templates/default/admin/lib/tenant/security/session-list.tsx +143 -0
  222. package/resources/templates/default/admin/lib/toast/index.ts +2 -2
  223. package/resources/templates/default/admin/lib/toast/toast.tsx +3 -3
  224. package/resources/templates/default/admin/lib/ui/alert-dialog.tsx +114 -3
  225. package/resources/templates/default/admin/lib/ui/avatar.tsx +1 -1
  226. package/resources/templates/default/admin/lib/ui/button.tsx +1 -1
  227. package/resources/templates/default/admin/lib/ui/card.tsx +1 -1
  228. package/resources/templates/default/admin/lib/ui/collapsible.tsx +1 -1
  229. package/resources/templates/default/admin/lib/ui/dialog.tsx +2 -2
  230. package/resources/templates/default/admin/lib/ui/dimension.tsx +1 -1
  231. package/resources/templates/default/admin/lib/ui/divider.tsx +1 -1
  232. package/resources/templates/default/admin/lib/ui/dropdown.tsx +3 -3
  233. package/resources/templates/default/admin/lib/ui/input.tsx +1 -1
  234. package/resources/templates/default/admin/lib/ui/label.tsx +1 -1
  235. package/resources/templates/default/admin/lib/ui/loader.tsx +2 -2
  236. package/resources/templates/default/admin/lib/ui/menu.tsx +2 -2
  237. package/resources/templates/default/admin/lib/ui/overlay.tsx +1 -1
  238. package/resources/templates/default/admin/lib/ui/popover.tsx +2 -2
  239. package/resources/templates/default/admin/lib/ui/progress.tsx +1 -1
  240. package/resources/templates/default/admin/lib/ui/property-list.tsx +1 -1
  241. package/resources/templates/default/admin/lib/ui/scroll-area.tsx +1 -1
  242. package/resources/templates/default/admin/lib/ui/select.tsx +44 -2
  243. package/resources/templates/default/admin/lib/ui/separator.tsx +1 -1
  244. package/resources/templates/default/admin/lib/ui/sheet.tsx +2 -2
  245. package/resources/templates/default/admin/lib/ui/sidebar.tsx +8 -8
  246. package/resources/templates/default/admin/lib/ui/skeleton.tsx +1 -1
  247. package/resources/templates/default/admin/lib/ui/sortable.tsx +1 -1
  248. package/resources/templates/default/admin/lib/ui/switch.tsx +1 -1
  249. package/resources/templates/default/admin/lib/ui/table.tsx +1 -1
  250. package/resources/templates/default/admin/lib/ui/textarea.tsx +1 -1
  251. package/resources/templates/default/admin/lib/ui/toggle-group.tsx +2 -2
  252. package/resources/templates/default/admin/lib/ui/toggle.tsx +1 -1
  253. package/resources/templates/default/admin/lib/ui/tooltip.tsx +2 -2
  254. package/resources/templates/default/admin/lib/upload/dropzone.tsx +20 -3
  255. package/resources/templates/default/admin/lib/upload/index.ts +3 -3
  256. package/resources/templates/default/admin/lib/upload/repeater.tsx +5 -1
  257. package/resources/templates/default/admin/lib/upload/ui.tsx +2 -2
  258. package/resources/templates/default/admin/lib/upload/upload-progress.tsx +6 -6
  259. package/resources/templates/default/admin/lib/upload/view.tsx +4 -4
  260. package/resources/templates/default/admin/lib/utils/cn.ts +18 -0
  261. package/resources/templates/default/admin/lib/utils/createComponentOpenHooks.tsx +33 -0
  262. package/resources/templates/default/admin/lib/utils/index.ts +2 -2
  263. package/resources/templates/default/admin/lib/utils/uic.tsx +59 -0
  264. package/resources/templates/default/admin/lib/utils/use-mobile.ts +19 -0
  265. package/resources/templates/default/admin/package.json +1 -0
  266. package/resources/templates/default/docker/object-storage/README.md +13 -0
  267. package/resources/templates/default/docker/object-storage/identities.json +13 -0
  268. package/resources/templates/default/docker-compose.yaml +29 -7
  269. package/resources/templates/default/scripts/assemble-ui-lib.mjs +132 -0
  270. package/resources/templates/default/scripts/update-ui-lib.sh +101 -185
  271. package/src/commands/WorkspaceCreateCommand.ts +45 -17
  272. package/src/commands/index.ts +1 -1
  273. package/src/lib/FileSystem.ts +2 -2
  274. package/src/lib/TemplateInstaller.ts +87 -69
  275. package/src/lib/version.ts +1 -1
  276. package/src/run.ts +11 -10
  277. package/tests/cases/unit/create-process.test.ts +66 -0
  278. package/tests/cases/unit/template-installer-cleanup.test.ts +150 -0
  279. package/tests/cases/unit/workspace-create.test.ts +81 -0
@@ -2,10 +2,10 @@ import { DataViewChangePageTrigger, DataViewPagingStateView, DataViewSetItemsPer
2
2
  import { DropdownMenu } from '@radix-ui/react-dropdown-menu'
3
3
  import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronsLeftIcon, ChevronsRightIcon, Loader2Icon } from 'lucide-react'
4
4
  import { FC } from 'react'
5
- import { dict, dictFormat } from '../dict'
6
- import { Button } from '../ui/button'
7
- import { DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '../ui/dropdown'
8
- import { uic } from '../utils'
5
+ import { dict, dictFormat } from '~/lib'
6
+ import { Button } from '~/lib'
7
+ import { DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '~/lib'
8
+ import { uic } from '~/lib'
9
9
 
10
10
  const PaginationWrapper = uic('div', {
11
11
  baseClass: 'flex gap-6 lg:gap-8 items-center justify-between mt-4 pb-4',
@@ -21,9 +21,10 @@ interface DataGridPaginationProps {
21
21
  }
22
22
 
23
23
  /**
24
- * Pagination controls UI for DataView.
24
+ * `DataGridPagination` provides pagination controls for navigating through pages in a `DataView`.
25
+ * It includes buttons for navigating to the first, previous, next, and last pages.
25
26
  *
26
- * ## Example
27
+ * ## Example: Basic Usage
27
28
  * ```tsx
28
29
  * <DataGridPagination />
29
30
  * ```
@@ -102,6 +103,15 @@ export const DataGridPagination: FC<DataGridPaginationProps> = ({ sticky }) => (
102
103
  </PaginationWrapper>
103
104
  )
104
105
 
106
+ /**
107
+ * `DataGridPerPageSelector` allows users to set the number of items displayed per page
108
+ * in a `DataView`. It provides a dropdown menu with preset options.
109
+ *
110
+ * ## Example: Basic Usage
111
+ * ```tsx
112
+ * <DataGridPerPageSelector />
113
+ * ```
114
+ */
105
115
  export const DataGridPerPageSelector = () => (
106
116
  <div>
107
117
  <p className="text-gray-400 text-xs font-semibold mb-1">{dict.datagrid.paginationRowsPerPage}</p>
@@ -4,10 +4,10 @@ import { ChildrenAnalyzer, Leaf } from '@contember/react-multipass-rendering'
4
4
  import { SheetIcon } from 'lucide-react'
5
5
  import * as React from 'react'
6
6
  import { Fragment, ReactNode, useMemo } from 'react'
7
- import { dict } from '../dict'
8
- import { Table, TableBody, TableHeader, TableRow } from '../ui/table'
7
+ import { dict } from '~/lib'
8
+ import { Table, TableBody, TableHeader, TableRow } from '~/lib'
9
9
 
10
- import { DataGridColumnLeaf, DataGridColumnLeafProps } from './column-leaf'
10
+ import { DataGridColumnLeaf, DataGridColumnLeafProps } from './column-leaf.js'
11
11
 
12
12
  /**
13
13
  * Props for the {@link DataGridTable} component.
@@ -17,12 +17,14 @@ export interface DataViewTableProps {
17
17
  }
18
18
 
19
19
  /**
20
- * Table layout for DataView.
20
+ * `DataGridTable` provides a table layout for `DataView`, allowing structured data representation.
21
+ * It must be used within a `DataView` context to function correctly.
21
22
  *
22
- * ## Example
23
+ * ## Example: Basic usage
23
24
  * ```tsx
24
25
  * <DataGridTable>
25
- * <DataGridTextColumn header="Title" field="title" />
26
+ * <DataGridTextColumn header="Title" field="title" />
27
+ * <DataGridTextColumn header="Author" field="author" />
26
28
  * </DataGridTable>
27
29
  * ```
28
30
  */
@@ -1,9 +1,9 @@
1
1
  import { Component } from '@contember/interface'
2
2
  import { DataViewEachRow, DataViewLayout } from '@contember/react-dataview'
3
3
  import * as React from 'react'
4
- import { dict } from '../dict'
4
+ import { dict } from '~/lib'
5
5
  import { LayoutGridIcon } from 'lucide-react'
6
- import { cn } from '../utils'
6
+ import { cn } from '~/lib'
7
7
 
8
8
  /**
9
9
  * Props for the {@link DataGridTiles} component.
@@ -14,12 +14,13 @@ export interface DataGridTilesProps {
14
14
  }
15
15
 
16
16
  /**
17
- * Simple grid layout for DataView.
17
+ * `DataGridTiles` provides a simple grid layout for `DataView`, enabling a tile-based display.
18
+ * It must be used within a `DataView` context.
18
19
  *
19
- * ## Example
20
+ * ## Example: Basic usage
20
21
  * ```tsx
21
22
  * <DataGridTiles>
22
- * <MyCustomTile />
23
+ * <MyCustomTile />
23
24
  * </DataGridTiles>
24
25
  * ```
25
26
  */
@@ -4,16 +4,16 @@ import { dataAttribute } from '@contember/utilities'
4
4
  import { FilterIcon, RefreshCcwIcon, SettingsIcon } from 'lucide-react'
5
5
  import * as React from 'react'
6
6
  import { ReactNode } from 'react'
7
- import { dict } from '../dict'
8
- import { Button } from '../ui/button'
9
- import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover'
10
- import { DataGridToolbarVisibleElements } from './elements'
11
- import { DataGridAutoExport } from './export'
12
- import { DataGridQueryFilter } from './filters'
13
- import { DataGridShowFiltersContext } from './filters/mobile'
14
- import { DataGridLayoutSwitcher } from './layout-switcher'
15
- import { DataGridPerPageSelector } from './pagination'
16
- import { DataGridToolbarUI } from './ui'
7
+ import { dict } from '~/lib'
8
+ import { Button } from '~/lib'
9
+ import { Popover, PopoverContent, PopoverTrigger } from '~/lib'
10
+ import { DataGridToolbarVisibleElements } from './elements.js'
11
+ import { DataGridAutoExport } from './export.js'
12
+ import { DataGridQueryFilter } from './filters/index.js'
13
+ import { DataGridShowFiltersContext } from './filters/mobile.js'
14
+ import { DataGridLayoutSwitcher } from './layout-switcher.js'
15
+ import { DataGridPerPageSelector } from './pagination.js'
16
+ import { DataGridToolbarUI } from './ui.js'
17
17
 
18
18
  /**
19
19
  * Props for the {@link DataGridToolbar} component.
@@ -26,18 +26,14 @@ export interface DataGridToolbarProps {
26
26
  }
27
27
 
28
28
  /**
29
- * Toolbar for DataGrid with default UI.
30
- * It contains
31
- * - filters (with default DataGridQueryFilter, which can be replaced by custom filters in children)
32
- * - settings (layout switcher, visible elements, per page selector)
33
- * - export button
34
- * - reload button
29
+ * `DataGridToolbar` provides a toolbar for `DataGrid` with default UI components.
30
+ * It includes filtering, layout settings, export functionality, and a reload button.
35
31
  *
36
- * ## Example
32
+ * ## Example: Basic usage with custom filters
37
33
  * ```tsx
38
34
  * <DataGridToolbar>
39
- * <DataGridQueryFilter />
40
- * <DataGridTextFilter field={'name'} label="Name" />
35
+ * <DataGridQueryFilter />
36
+ * <DataGridTextFilter field="name" label="Name" />
41
37
  * </DataGridToolbar>
42
38
  * ```
43
39
  */
@@ -1,8 +1,8 @@
1
1
  import { CheckSquareIcon, FilterIcon, FilterXIcon, PlusIcon, SquareIcon, XIcon } from 'lucide-react'
2
2
  import { forwardRef, ReactEventHandler, ReactNode, useCallback } from 'react'
3
- import { dict } from '../dict'
4
- import { Button } from '../ui/button'
5
- import { cn, uic } from '../utils'
3
+ import { dict } from '~/lib'
4
+ import { Button } from '~/lib'
5
+ import { cn, uic } from '~/lib'
6
6
 
7
7
  export const DataGridTooltipLabel = uic('span', {
8
8
  baseClass: 'cursor-pointer border-dashed border-b border-b-gray-400 hover:border-gray-800',
@@ -1,2 +1,2 @@
1
- export * from './login-panel'
2
- export * from './todo'
1
+ export * from './login-panel.js'
2
+ export * from './todo.js'
@@ -1,9 +1,18 @@
1
- import { Button } from '../ui/button'
1
+ import { Button } from '~/lib'
2
2
  import { useSessionTokenWithMeta, useSetSessionToken } from '@contember/react-client'
3
3
  import { CreateSessionTokenForm, useCreateSessionTokenForm } from '@contember/react-client-tenant'
4
- import { Loader } from '../ui/loader'
5
- import { TenantFormError, TenantFormField } from '../tenant/forms/common'
4
+ import { Loader } from '~/lib'
5
+ import { TenantFormError, TenantFormField } from '~/lib/tenant'
6
6
 
7
+ /**
8
+ * `LoginWithEmail` component handles user authentication using email.
9
+ * It integrates with session token management to facilitate authentication.
10
+ *
11
+ * ## Example: Basic Usage
12
+ * ```tsx
13
+ * <LoginWithEmail />
14
+ * ```
15
+ */
7
16
  export const LoginWithEmail = () => {
8
17
  const sessionToken = useSessionTokenWithMeta()
9
18
  const setSessionToken = useSetSessionToken()
@@ -1,8 +1,20 @@
1
1
  import { PropsWithChildren } from 'react'
2
2
 
3
+ /**
4
+ * Props for the {@link Todo} component.
5
+ */
3
6
  export interface CommentProps extends PropsWithChildren {
4
7
  }
5
8
 
9
+ /**
10
+ * `Todo` is a development-only helper component for marking TODOs in the UI.
11
+ * It displays a highlighted message when in development mode (`import.meta.env.DEV`).
12
+ *
13
+ * ## Example: Basic Usage
14
+ * ```tsx
15
+ * <Todo>Implement authentication logic</Todo>
16
+ * ```
17
+ */
6
18
  export const Todo = ({ children }: CommentProps) => {
7
19
  if (!import.meta.env.DEV) return null
8
20
 
@@ -1,19 +1,5 @@
1
1
  import { TextFilterArtifactsMatchMode } from '@contember/react-dataview'
2
- import { InviteErrorCodes } from './tenant/hooks/useInvite'
3
2
  import { UploaderErrorType } from '@contember/react-uploader'
4
- import { ChangeMyPasswordFormErrorCode, CreateApiKeyFormErrorCode } from '@contember/interface'
5
- import {
6
- InviteFormErrorCode,
7
- LoginFormErrorCode,
8
- OtpConfirmFormErrorCode,
9
- OtpPrepareFormErrorCode,
10
- PasswordlessSignInFormErrorCode,
11
- PasswordlessSignInInitFormErrorCode,
12
- PasswordResetFormErrorCode,
13
- PasswordResetRequestFormErrorCode,
14
- UpdateProjectMemberFormErrorCode,
15
- } from '@contember/react-identity'
16
- import { ActivatePasswordlessOtpErrorCode, WeakPasswordReason } from '@contember/graphql-client-tenant'
17
3
 
18
4
  export const dict = {
19
5
  deleteEntityDialog: {
@@ -99,16 +85,6 @@ export const dict = {
99
85
  false: 'No',
100
86
  },
101
87
  logout: 'Log out',
102
- inviteErrors: {
103
- ALREADY_MEMBER: 'This user is already a member of the project',
104
- INVALID_EMAIL_FORMAT: 'Invalid email format',
105
- INVALID_MEMBERSHIP: 'Invalid membership',
106
- PROJECT_NOT_FOUND: 'Project not found',
107
- ROLE_NOT_FOUND: 'Role not found',
108
- VARIABLE_EMPTY: 'Variable is empty',
109
- VARIABLE_NOT_FOUND: 'Variable not found',
110
- fallback: 'Failed to invite user',
111
- } satisfies Record<InviteErrorCodes | 'fallback', string>,
112
88
  uploader: {
113
89
  uploadErrors: {
114
90
  httpError: 'HTTP error',
@@ -134,243 +110,6 @@ export const dict = {
134
110
  snooze: 'Snooze',
135
111
  refreshNow: 'Refresh now',
136
112
  },
137
- tenant: {
138
- memberList: {
139
- failedToLoadData: 'Failed to load data',
140
- noResults: 'No results',
141
- previous: 'Previous',
142
- next: 'Next',
143
- roles: 'Roles',
144
- action: 'Action',
145
- },
146
- apiKeyList: {
147
- deleted: 'API key deleted',
148
- deleteFailed: 'Failed to delete API key',
149
- unnamed: 'Unnamed API key',
150
- noResults: 'No API keys',
151
- description: 'Description',
152
- role: 'Role',
153
- action: 'Action',
154
- deleteConfirmation: 'Are you sure you want to delete this API key?',
155
- deleteCancelAction: 'Cancel',
156
- deleteConfirmAction: 'Delete',
157
- },
158
- createApiKey: {
159
- description: 'Description',
160
- roles: 'Roles',
161
- submit: 'Create API key',
162
- errorMessages: {
163
- 'FIELD_REQUIRED': 'This field is required',
164
- 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
165
- 'INVALID_MEMBERSHIP': 'Invalid membership',
166
- 'PROJECT_NOT_FOUND': 'Project not found',
167
- 'ROLE_NOT_FOUND': 'Role not found',
168
- 'VARIABLE_EMPTY': 'Variable empty',
169
- 'VARIABLE_NOT_FOUND': 'Variable not found',
170
- } satisfies Record<CreateApiKeyFormErrorCode, string>,
171
- },
172
- invite: {
173
- email: 'Email',
174
- name: 'Name',
175
- roles: 'Roles',
176
- submit: 'Invite',
177
- addRole: 'Add new role',
178
- errorMessages: {
179
- 'FIELD_REQUIRED': 'This field is required',
180
- 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
181
- 'ALREADY_MEMBER': 'This person is already a member',
182
- 'INVALID_EMAIL_FORMAT': 'Invalid email format',
183
- 'INVALID_MEMBERSHIP': 'Invalid membership',
184
- 'PROJECT_NOT_FOUND': 'Project not found',
185
- 'ROLE_NOT_FOUND': 'Role not found',
186
- 'VARIABLE_EMPTY': 'Variable empty',
187
- 'VARIABLE_NOT_FOUND': 'Variable not found',
188
- } satisfies Record<InviteFormErrorCode, string>,
189
- },
190
- changePassword: {
191
- currentPassword: 'Current password',
192
- newPassword: 'New password',
193
- confirmPassword: 'Confirm password',
194
- submit: 'Change password',
195
- errorMessages: {
196
- 'FIELD_REQUIRED': 'This field is required',
197
- 'INVALID_VALUE': 'Invalid value',
198
- 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
199
- 'PASSWORD_MISMATCH': 'Passwords do not match',
200
- 'TOO_WEAK': 'Password is too weak',
201
- 'NO_PASSWORD_SET': 'Your account has no password set',
202
- 'INVALID_PASSWORD': 'Invalid password',
203
- 'NOT_A_PERSON': 'Invalid user',
204
- } satisfies Record<ChangeMyPasswordFormErrorCode, string>,
205
- },
206
- login: {
207
- email: 'Email',
208
- password: 'Password',
209
- otpToken: '2FA OTP token',
210
- forgotPassword: 'Forgot password?',
211
- login: 'Login',
212
- errorMessages: {
213
- 'FIELD_REQUIRED': 'This field is required',
214
- 'INVALID_VALUE': 'Invalid value',
215
- 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
216
- 'INVALID_PASSWORD': 'Invalid password',
217
- 'INVALID_OTP_TOKEN': 'Invalid OTP token',
218
- 'NO_PASSWORD_SET': 'No password set',
219
- 'PERSON_DISABLED': 'Person disabled',
220
- 'UNKNOWN_EMAIL': 'Unknown email',
221
- 'INVALID_CREDENTIALS': 'Invalid credentials',
222
- 'RATE_LIMIT_EXCEEDED': 'Too many failed attempts, please try again later',
223
- 'OTP_REQUIRED': undefined,
224
- } satisfies Record<LoginFormErrorCode, string | undefined>,
225
- idpInitError: 'Failed to initialize IdP login:',
226
- idpResponseError: 'Failed to process IdP response:',
227
- title: 'Login',
228
- description: 'Enter your email below to login to your account',
229
- backToLogin: 'Back to login',
230
- },
231
- personList: {
232
- email: 'Email',
233
- name: 'Name',
234
- deleted: 'Member deleted',
235
- deleteFailed: 'Failed to delete member',
236
- noEmail: 'User has no email',
237
- noName: 'User has no name',
238
- role: 'Role',
239
- action: 'Action',
240
- noResults: 'No members',
241
- deleteConfirmation: 'Are you sure you want to delete this member?',
242
- deleteCancelAction: 'Cancel',
243
- deleteConfirmAction: 'Delete',
244
- },
245
- memberDelete: {
246
- cancel: 'Cancel',
247
- confirm: 'Confirm',
248
- },
249
- otpSetup: {
250
- prepareContinue: 'Continue',
251
- otpConfirmFormErrorMessages: {
252
- UNKNOWN_ERROR: 'Something went wrong. Please try again later',
253
- INVALID_OTP_TOKEN: 'Invalid OTP token',
254
- FIELD_REQUIRED: 'This field is required',
255
- NOT_PREPARED: 'OTP setup was not initialized',
256
- } satisfies Record<OtpConfirmFormErrorCode, string>,
257
- otpPrepareFormErrorMessages: {
258
- UNKNOWN_ERROR: 'Something went wrong. Please try again later',
259
- } satisfies Record<OtpPrepareFormErrorCode, string>,
260
- alreadyHaveOtp: 'You already have two-factor authentication active. By clicking "Continue", the old one will no longer work.',
261
- nowScanQrCode: 'Now scan the following QR code in your application:',
262
- writeDownCode: 'After registering to your application, write down a code from the application.',
263
- twoFactorEnabled: 'Two factor authentication is ENABLED.',
264
- disableTwoFactor: 'Disable two-factor authentication',
265
- disableTwoFactorConfirm: 'Are you sure you want to disable two-factor authentication?',
266
- cancel: 'Cancel',
267
- disable: 'Disable',
268
- disabledSuccess: 'Two-factor authentication was disabled.',
269
- setupAgain: 'Setup again',
270
- description:
271
- '2-Step Verification provides stronger security for your account by requiring a second step of verification when you sign in. In addition to your password, you’ll also need a code generated by an application on your phone.',
272
- setupTwoFactor: 'Setup two-factor authentication',
273
- enabledSuccess: 'Two-factor authentication was enabled.',
274
- otpToken: 'OTP token',
275
- label: 'Label',
276
- confirm: 'Confirm',
277
- },
278
-
279
- passwordReset: {
280
- token: 'Reset code',
281
- password: 'Password',
282
- passwordConfirmation: 'Confirm password',
283
- submit: 'Reset password',
284
- errorMessages: {
285
- 'FIELD_REQUIRED': 'This field is required',
286
- 'INVALID_VALUE': 'Invalid value',
287
- 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
288
- 'PASSWORD_MISMATCH': 'Passwords do not match',
289
- 'PASSWORD_TOO_WEAK': 'Password is too weak',
290
- 'TOKEN_EXPIRED': 'Token expired',
291
- 'TOKEN_NOT_FOUND': 'Token not found',
292
- 'TOKEN_USED': 'Token already used',
293
- 'TOKEN_INVALID': 'Invalid token',
294
- } satisfies Record<PasswordResetFormErrorCode, string>,
295
- title: 'Reset password',
296
- description: 'Enter new password below',
297
- success: 'Password has been reset',
298
- },
299
- passwordResetRequest: {
300
- email: 'E-mail',
301
- submit: 'Request reset code',
302
- errorMessages: {
303
- 'FIELD_REQUIRED': 'This field is required',
304
- 'INVALID_VALUE': 'Invalid value',
305
- 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
306
- 'PERSON_NOT_FOUND': 'Unknown email',
307
- } satisfies Record<PasswordResetRequestFormErrorCode, string>,
308
- title: 'Reset password',
309
- description: 'Enter your email below to reset your password',
310
- success: 'Password reset link has been sent',
311
- checkMail: 'Please check your mailbox for instructions on how to reset your password.',
312
- entryCode: 'Or enter the reset code directly.',
313
- },
314
- passwordlessSignInInit: {
315
- email: 'E-mail',
316
- submit: 'Send magic link',
317
- errorMessages: {
318
- 'FIELD_REQUIRED': 'This field is required',
319
- 'INVALID_VALUE': 'Invalid value',
320
- 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
321
- 'PERSON_NOT_FOUND': 'Unknown email',
322
- 'PASSWORDLESS_DISABLED': 'Passwordless sign-in is not available',
323
- } satisfies Record<PasswordlessSignInInitFormErrorCode, string>,
324
- title: 'Sign in',
325
- description: 'Enter your email below to sign in to your account',
326
- success: 'Magic link has been sent',
327
- checkMail: 'Please check your mailbox for instructions on how to sign in.',
328
- entryCode: 'Or enter the reset code directly.',
329
- },
330
- passwordlessSignIn: {
331
- token: 'Verification code',
332
- otpToken: '2FA OTP token',
333
- submit: 'Sign in',
334
- errorMessages: {
335
- 'FIELD_REQUIRED': 'This field is required',
336
- 'INVALID_VALUE': 'Invalid value',
337
- 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
338
- 'INVALID_OTP_TOKEN': 'Invalid OTP token',
339
- 'OTP_REQUIRED': undefined,
340
- 'PERSON_DISABLED': 'Person disabled',
341
- 'TOKEN_EXPIRED': 'Token expired',
342
- 'TOKEN_NOT_FOUND': 'Token not found',
343
- 'TOKEN_USED': 'Token already used',
344
- 'TOKEN_INVALID': 'Invalid token',
345
- } satisfies Record<PasswordlessSignInFormErrorCode, string | undefined>,
346
- title: 'Sign in',
347
- },
348
- otpActivation: {
349
- errorMessages: {
350
- 'TOKEN_INVALID': 'This token is not valid. Please try again.',
351
- 'TOKEN_USED': 'Token already used',
352
- 'TOKEN_NOT_FOUND': 'Token not found',
353
- 'TOKEN_EXPIRED': 'Token expired',
354
- 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
355
- } satisfies Record<ActivatePasswordlessOtpErrorCode | 'UNKNOWN_ERROR', string>,
356
- },
357
-
358
- updateProjectMember: {
359
- updateSuccess: 'Roles updated',
360
- roles: 'Roles',
361
- submit: 'Update role',
362
- errorMessages: {
363
- 'FIELD_REQUIRED': 'This field is required',
364
- 'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
365
- 'INVALID_MEMBERSHIP': 'Invalid membership',
366
- 'PROJECT_NOT_FOUND': 'Project not found',
367
- 'ROLE_NOT_FOUND': 'Role not found',
368
- 'VARIABLE_EMPTY': 'Variable empty',
369
- 'VARIABLE_NOT_FOUND': 'Variable not found',
370
- 'NOT_MEMBER': 'Not a member',
371
- } satisfies Record<UpdateProjectMemberFormErrorCode, string>,
372
- },
373
- },
374
113
  }
375
114
  export const dictFormat = (value: string, replacements: Record<string, string>) => {
376
115
  return value.replace(/\${([^}]+)}/g, (_, key) => replacements[key] || '')
@@ -17,20 +17,68 @@ import {
17
17
  import { DataView, DataViewEachRow, DataViewLoaderState, DataViewSortingDirections, useDataViewEntityListAccessor } from '@contember/react-dataview'
18
18
  import { ReactNode, useMemo } from 'react'
19
19
  import { CheckIcon } from 'lucide-react'
20
- import { Loader } from '../ui/loader'
21
- import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover'
22
- import { Button } from '../ui/button'
23
- import { DimensionLabelUI, DimensionLabelWrapperUI } from '../ui/dimension'
20
+ import { Loader } from '~/lib'
21
+ import { Popover, PopoverContent, PopoverTrigger } from '~/lib'
22
+ import { Button } from '~/lib'
23
+ import { DimensionLabelUI, DimensionLabelWrapperUI } from '~/lib'
24
24
 
25
+ /**
26
+ * Props for the {@link DimensionsSwitcher} component.
27
+ */
25
28
  export type DimensionsSwitcherProps = {
29
+ /**
30
+ * Entity list for dimension options.
31
+ */
26
32
  options: SugaredQualifiedEntityList['entities']
33
+ /**
34
+ * Specifies initial sorting of the options (e.g., `{ label: 'desc' }`).
35
+ */
27
36
  orderBy?: DataViewSortingDirections
37
+ /**
38
+ * The name of the dimension to switch.
39
+ */
28
40
  dimension: string
41
+ /**
42
+ * Child components or fields to render within the dimension selector.
43
+ */
29
44
  children: ReactNode
45
+ /**
46
+ * Field containing unique dimension identifiers.
47
+ */
30
48
  slugField: SugaredRelativeSingleField['field']
49
+ /**
50
+ * Enables multi-selection mode.
51
+ */
31
52
  isMulti?: boolean
32
53
  }
33
54
 
55
+ /**
56
+ * `DimensionsSwitcher` is a UI component for switching between different dimensions of data.
57
+ *
58
+ * ## Example: Basic usage
59
+ * ```tsx
60
+ * <DimensionsSwitcher
61
+ * dimension="locale"
62
+ * slugField="code"
63
+ * options="DimensionsLocale"
64
+ * >
65
+ * <Field field="label" />
66
+ * </DimensionsSwitcher>
67
+ * ```
68
+ *
69
+ * ## Example: With initial sorting and multi-selection
70
+ * ```tsx
71
+ * <DimensionsSwitcher
72
+ * dimension="locale"
73
+ * slugField="code"
74
+ * options="DimensionsLocale"
75
+ * orderBy={{ label: 'desc' }}
76
+ * isMulti
77
+ * >
78
+ * <Field field="label" />
79
+ * </DimensionsSwitcher>
80
+ * ```
81
+ */
34
82
  export const DimensionsSwitcher = Component(({ options, dimension, children, slugField, orderBy, isMulti }: DimensionsSwitcherProps) => (
35
83
  <DataView entities={options} initialSorting={orderBy}>
36
84
  <DataViewLoaderState initial refreshing>
@@ -122,14 +170,47 @@ export type RenderLabelProps = {
122
170
  dimensionValue: string | null
123
171
  }
124
172
 
173
+ /**
174
+ * Props for the {@link SideDimensions} component.
175
+ */
125
176
  export type SideDimensionsProps = {
177
+ /**
178
+ * The name of the dimension to render.
179
+ */
126
180
  dimension: string
181
+ /**
182
+ * The name of the dimension variable to expose in the context.
183
+ */
127
184
  as: string
185
+ /**
186
+ * The field to traverse via `HasOne` relationship.
187
+ */
128
188
  field: SugaredRelativeSingleEntity['field']
189
+ /**
190
+ * Child components or fields to render within the dimension selector.
191
+ */
129
192
  children: ReactNode
193
+ /**
194
+ * Optional custom label renderer. Receives the label and the current dimension value.
195
+ */
130
196
  renderLabel?: ({ label, dimensionValue }: RenderLabelProps) => ReactNode
131
197
  }
132
198
 
199
+ /**
200
+ * `SideDimensions` is a layout component that renders content for a specific dimension
201
+ * within a flexible side panel. It wraps its content inside a `DimensionRenderer` and `HasOne` field relationship.
202
+ *
203
+ * ## Example: Basic Usage
204
+ * ```tsx
205
+ * <SideDimensions
206
+ * dimension="locale"
207
+ * as="currentLocale"
208
+ * field="locales(locale.code = $currentLocale)"
209
+ * >
210
+ * <InputField field="title" />
211
+ * </SideDimensions>
212
+ * ```
213
+ */
133
214
  export const SideDimensions = Component<SideDimensionsProps>(({ dimension, children, as, field, renderLabel }) => (
134
215
  <div className="flex mt-4 gap-4">
135
216
  <DimensionRenderer dimension={dimension} as={as}>
@@ -1 +1 @@
1
- export * from './dimensions'
1
+ export * from './dimensions.js'