@contember/create 2.1.0-beta.1 → 2.2.0-alpha.1

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 (223) hide show
  1. package/dist/development/run.cjs.map +1 -1
  2. package/dist/development/run.js.map +1 -1
  3. package/dist/development/src/commands/WorkspaceCreateCommand.cjs +2 -2
  4. package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  5. package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
  6. package/dist/development/src/lib/FileSystem.cjs +1 -2
  7. package/dist/development/src/lib/FileSystem.cjs.map +1 -1
  8. package/dist/development/src/lib/FileSystem.js +1 -2
  9. package/dist/development/src/lib/FileSystem.js.map +1 -1
  10. package/dist/development/src/lib/TemplateInstaller.cjs +16 -16
  11. package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
  12. package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
  13. package/dist/development/src/lib/packageManagerDetector.cjs +6 -6
  14. package/dist/development/src/lib/packageManagerDetector.cjs.map +1 -1
  15. package/dist/development/src/lib/version.cjs +2 -2
  16. package/dist/development/src/lib/version.cjs.map +1 -1
  17. package/dist/development/src/lib/version.js.map +1 -1
  18. package/dist/development/src/paths.cjs +3 -3
  19. package/dist/development/src/paths.cjs.map +1 -1
  20. package/dist/production/run.cjs.map +1 -1
  21. package/dist/production/run.js.map +1 -1
  22. package/dist/production/src/commands/WorkspaceCreateCommand.cjs +2 -2
  23. package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  24. package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
  25. package/dist/production/src/lib/FileSystem.cjs +1 -2
  26. package/dist/production/src/lib/FileSystem.cjs.map +1 -1
  27. package/dist/production/src/lib/FileSystem.js +1 -2
  28. package/dist/production/src/lib/FileSystem.js.map +1 -1
  29. package/dist/production/src/lib/TemplateInstaller.cjs +16 -16
  30. package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
  31. package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
  32. package/dist/production/src/lib/packageManagerDetector.cjs +6 -6
  33. package/dist/production/src/lib/packageManagerDetector.cjs.map +1 -1
  34. package/dist/production/src/lib/version.cjs +2 -2
  35. package/dist/production/src/lib/version.cjs.map +1 -1
  36. package/dist/production/src/lib/version.js.map +1 -1
  37. package/dist/production/src/paths.cjs +3 -3
  38. package/dist/production/src/paths.cjs.map +1 -1
  39. package/dist/types/commands/WorkspaceCreateCommand.d.ts +1 -1
  40. package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -1
  41. package/dist/types/commands/index.d.ts +1 -1
  42. package/dist/types/commands/index.d.ts.map +1 -1
  43. package/dist/types/lib/FileSystem.d.ts +3 -2
  44. package/dist/types/lib/FileSystem.d.ts.map +1 -1
  45. package/dist/types/lib/TemplateInstaller.d.ts +1 -1
  46. package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
  47. package/dist/types/tsconfig.tsbuildinfo +1 -1
  48. package/package.json +3 -4
  49. package/resources/templates/default/admin/lib/binding/binding.tsx +19 -4
  50. package/resources/templates/default/admin/lib/binding/delete.tsx +37 -3
  51. package/resources/templates/default/admin/lib/binding/hooks.tsx +65 -3
  52. package/resources/templates/default/admin/lib/binding/identity.tsx +17 -4
  53. package/resources/templates/default/admin/lib/binding/index.ts +5 -5
  54. package/resources/templates/default/admin/lib/binding/navigation-guard-dialog.tsx +15 -3
  55. package/resources/templates/default/admin/lib/binding/persist.tsx +27 -5
  56. package/resources/templates/default/admin/lib/block-repeater/block-repeater.tsx +15 -11
  57. package/resources/templates/default/admin/lib/block-repeater/index.ts +1 -1
  58. package/resources/templates/default/admin/lib/board/board.tsx +2 -2
  59. package/resources/templates/default/admin/lib/board/index.ts +1 -1
  60. package/resources/templates/default/admin/lib/buttons/back-button.tsx +22 -2
  61. package/resources/templates/default/admin/lib/buttons/index.ts +2 -2
  62. package/resources/templates/default/admin/lib/buttons/link-back-button.tsx +11 -2
  63. package/resources/templates/default/admin/lib/datagrid/cells.tsx +3 -3
  64. package/resources/templates/default/admin/lib/datagrid/column-header.tsx +4 -4
  65. package/resources/templates/default/admin/lib/datagrid/columns.tsx +28 -14
  66. package/resources/templates/default/admin/lib/datagrid/elements.tsx +2 -2
  67. package/resources/templates/default/admin/lib/datagrid/empty.tsx +1 -1
  68. package/resources/templates/default/admin/lib/datagrid/export.tsx +2 -2
  69. package/resources/templates/default/admin/lib/datagrid/filters/boolean.tsx +13 -13
  70. package/resources/templates/default/admin/lib/datagrid/filters/common.tsx +2 -2
  71. package/resources/templates/default/admin/lib/datagrid/filters/date.tsx +37 -16
  72. package/resources/templates/default/admin/lib/datagrid/filters/defined.tsx +13 -12
  73. package/resources/templates/default/admin/lib/datagrid/filters/enum.tsx +56 -22
  74. package/resources/templates/default/admin/lib/datagrid/filters/index.ts +7 -7
  75. package/resources/templates/default/admin/lib/datagrid/filters/mobile.tsx +18 -0
  76. package/resources/templates/default/admin/lib/datagrid/filters/number.tsx +10 -13
  77. package/resources/templates/default/admin/lib/datagrid/filters/relation.tsx +8 -8
  78. package/resources/templates/default/admin/lib/datagrid/filters/text.tsx +9 -9
  79. package/resources/templates/default/admin/lib/datagrid/grid.tsx +31 -23
  80. package/resources/templates/default/admin/lib/datagrid/index.ts +12 -12
  81. package/resources/templates/default/admin/lib/datagrid/labels.tsx +22 -4
  82. package/resources/templates/default/admin/lib/datagrid/layout-switcher.tsx +10 -4
  83. package/resources/templates/default/admin/lib/datagrid/loader.tsx +4 -4
  84. package/resources/templates/default/admin/lib/datagrid/pagination.tsx +16 -6
  85. package/resources/templates/default/admin/lib/datagrid/table.tsx +8 -6
  86. package/resources/templates/default/admin/lib/datagrid/tiles.tsx +6 -5
  87. package/resources/templates/default/admin/lib/datagrid/toolbar.tsx +15 -19
  88. package/resources/templates/default/admin/lib/datagrid/ui.tsx +3 -3
  89. package/resources/templates/default/admin/lib/dev/index.ts +2 -2
  90. package/resources/templates/default/admin/lib/dev/login-panel.tsx +12 -3
  91. package/resources/templates/default/admin/lib/dev/todo.tsx +12 -0
  92. package/resources/templates/default/admin/lib/dict.ts +0 -261
  93. package/resources/templates/default/admin/lib/dimensions/dimensions.tsx +85 -4
  94. package/resources/templates/default/admin/lib/dimensions/index.ts +1 -1
  95. package/resources/templates/default/admin/lib/editor/block-editor.tsx +72 -3
  96. package/resources/templates/default/admin/lib/editor/common/baseEditorPlugins.tsx +54 -11
  97. package/resources/templates/default/admin/lib/editor/common/buttons.tsx +1 -1
  98. package/resources/templates/default/admin/lib/editor/common/editor-block-toolbar.tsx +1 -1
  99. package/resources/templates/default/admin/lib/editor/common/elements/HeadingRenderer.tsx +1 -1
  100. package/resources/templates/default/admin/lib/editor/common/elements/HorizontalRuleRenderer.tsx +1 -1
  101. package/resources/templates/default/admin/lib/editor/common/elements/ListItemRenderer.tsx +1 -1
  102. package/resources/templates/default/admin/lib/editor/common/elements/OrderedListRenderer.tsx +1 -1
  103. package/resources/templates/default/admin/lib/editor/common/elements/TableElementRenderer.tsx +1 -1
  104. package/resources/templates/default/admin/lib/editor/common/elements/UnorderedListRenderer.tsx +1 -1
  105. package/resources/templates/default/admin/lib/editor/common/index.ts +6 -6
  106. package/resources/templates/default/admin/lib/editor/editor-block.tsx +54 -3
  107. package/resources/templates/default/admin/lib/editor/index.ts +6 -6
  108. package/resources/templates/default/admin/lib/editor/plugins.tsx +46 -2
  109. package/resources/templates/default/admin/lib/editor/rich-text-view.tsx +44 -0
  110. package/resources/templates/default/admin/lib/editor/rich-text.tsx +31 -3
  111. package/resources/templates/default/admin/lib/editor/sortable-block.tsx +34 -2
  112. package/resources/templates/default/admin/lib/errors/index.ts +1 -1
  113. package/resources/templates/default/admin/lib/errors/use-error-formatter.ts +22 -1
  114. package/resources/templates/default/admin/lib/field/formatted-field.tsx +16 -1
  115. package/resources/templates/default/admin/lib/field/index.ts +2 -1
  116. package/resources/templates/default/admin/lib/field/list-field.tsx +56 -0
  117. package/resources/templates/default/admin/lib/form/container.tsx +33 -3
  118. package/resources/templates/default/admin/lib/form/index.ts +6 -5
  119. package/resources/templates/default/admin/lib/form/inputs.tsx +105 -6
  120. package/resources/templates/default/admin/lib/form/labels.tsx +1 -1
  121. package/resources/templates/default/admin/lib/form/select.tsx +162 -5
  122. package/resources/templates/default/admin/lib/form/ui.tsx +2 -2
  123. package/resources/templates/default/admin/lib/form/upload-repeaters.tsx +159 -5
  124. package/resources/templates/default/admin/lib/form/upload.tsx +116 -3
  125. package/resources/templates/default/admin/lib/formatting/formatting.ts +106 -1
  126. package/resources/templates/default/admin/lib/formatting/index.ts +1 -1
  127. package/resources/templates/default/admin/lib/images/formatImageResizeUrl.ts +19 -0
  128. package/resources/templates/default/admin/lib/images/index.ts +1 -1
  129. package/resources/templates/default/admin/lib/index.ts +54 -0
  130. package/resources/templates/default/admin/lib/labels/index.ts +2 -2
  131. package/resources/templates/default/admin/lib/layout/index.ts +3 -3
  132. package/resources/templates/default/admin/lib/layout/layout-boxed.tsx +5 -5
  133. package/resources/templates/default/admin/lib/layout/layout.tsx +3 -3
  134. package/resources/templates/default/admin/lib/outdated-application-dialog/index.ts +1 -1
  135. package/resources/templates/default/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +2 -2
  136. package/resources/templates/default/admin/lib/repeater/index.ts +1 -1
  137. package/resources/templates/default/admin/lib/repeater/repeater.tsx +26 -9
  138. package/resources/templates/default/admin/lib/select/create-new.tsx +19 -3
  139. package/resources/templates/default/admin/lib/select/filter.tsx +8 -2
  140. package/resources/templates/default/admin/lib/select/highlight.tsx +16 -0
  141. package/resources/templates/default/admin/lib/select/index.ts +6 -6
  142. package/resources/templates/default/admin/lib/select/list.tsx +30 -6
  143. package/resources/templates/default/admin/lib/select/multi-select.tsx +41 -4
  144. package/resources/templates/default/admin/lib/select/select.tsx +44 -6
  145. package/resources/templates/default/admin/lib/select/sortable-select.tsx +15 -6
  146. package/resources/templates/default/admin/lib/select/ui.tsx +100 -4
  147. package/resources/templates/default/admin/lib/tenant/dict.ts +324 -0
  148. package/resources/templates/default/admin/lib/tenant/forms/change-my-password.tsx +4 -4
  149. package/resources/templates/default/admin/lib/tenant/forms/common.tsx +3 -3
  150. package/resources/templates/default/admin/lib/tenant/forms/confirm-email-change.tsx +38 -0
  151. package/resources/templates/default/admin/lib/tenant/forms/create-api-key.tsx +5 -5
  152. package/resources/templates/default/admin/lib/tenant/forms/index.ts +12 -8
  153. package/resources/templates/default/admin/lib/tenant/forms/invite.tsx +5 -5
  154. package/resources/templates/default/admin/lib/tenant/forms/login.tsx +4 -4
  155. package/resources/templates/default/admin/lib/tenant/forms/memberships-control.tsx +4 -4
  156. package/resources/templates/default/admin/lib/tenant/forms/password-reset-request.tsx +4 -4
  157. package/resources/templates/default/admin/lib/tenant/forms/password-reset.tsx +4 -4
  158. package/resources/templates/default/admin/lib/tenant/forms/passwordless-signin-init.tsx +4 -4
  159. package/resources/templates/default/admin/lib/tenant/forms/passwordless-signin.tsx +4 -4
  160. package/resources/templates/default/admin/lib/tenant/forms/request-email-verification.tsx +35 -0
  161. package/resources/templates/default/admin/lib/tenant/forms/update-project-member.tsx +14 -5
  162. package/resources/templates/default/admin/lib/tenant/forms/verify-email.tsx +38 -0
  163. package/resources/templates/default/admin/lib/tenant/hooks/useInvite.ts +41 -0
  164. package/resources/templates/default/admin/lib/tenant/hooks/useInviteUser.tsx +32 -3
  165. package/resources/templates/default/admin/lib/tenant/index.ts +3 -3
  166. package/resources/templates/default/admin/lib/tenant/listing/api-key-list.tsx +3 -3
  167. package/resources/templates/default/admin/lib/tenant/listing/index.ts +4 -4
  168. package/resources/templates/default/admin/lib/tenant/listing/member-delete-dialog.tsx +3 -3
  169. package/resources/templates/default/admin/lib/tenant/listing/member-list.tsx +8 -8
  170. package/resources/templates/default/admin/lib/tenant/listing/person-list.tsx +4 -4
  171. package/resources/templates/default/admin/lib/tenant/otp/index.ts +1 -1
  172. package/resources/templates/default/admin/lib/tenant/otp/otp-setup.tsx +6 -6
  173. package/resources/templates/default/admin/lib/toast/index.ts +2 -2
  174. package/resources/templates/default/admin/lib/toast/toast.tsx +3 -3
  175. package/resources/templates/default/admin/lib/ui/alert-dialog.tsx +114 -3
  176. package/resources/templates/default/admin/lib/ui/avatar.tsx +1 -1
  177. package/resources/templates/default/admin/lib/ui/button.tsx +1 -1
  178. package/resources/templates/default/admin/lib/ui/card.tsx +1 -1
  179. package/resources/templates/default/admin/lib/ui/collapsible.tsx +1 -1
  180. package/resources/templates/default/admin/lib/ui/dialog.tsx +2 -2
  181. package/resources/templates/default/admin/lib/ui/dimension.tsx +1 -1
  182. package/resources/templates/default/admin/lib/ui/divider.tsx +1 -1
  183. package/resources/templates/default/admin/lib/ui/dropdown.tsx +3 -3
  184. package/resources/templates/default/admin/lib/ui/input.tsx +1 -1
  185. package/resources/templates/default/admin/lib/ui/label.tsx +1 -1
  186. package/resources/templates/default/admin/lib/ui/loader.tsx +2 -2
  187. package/resources/templates/default/admin/lib/ui/menu.tsx +2 -2
  188. package/resources/templates/default/admin/lib/ui/overlay.tsx +1 -1
  189. package/resources/templates/default/admin/lib/ui/popover.tsx +2 -2
  190. package/resources/templates/default/admin/lib/ui/progress.tsx +1 -1
  191. package/resources/templates/default/admin/lib/ui/property-list.tsx +1 -1
  192. package/resources/templates/default/admin/lib/ui/scroll-area.tsx +1 -1
  193. package/resources/templates/default/admin/lib/ui/select.tsx +44 -2
  194. package/resources/templates/default/admin/lib/ui/separator.tsx +1 -1
  195. package/resources/templates/default/admin/lib/ui/sheet.tsx +2 -2
  196. package/resources/templates/default/admin/lib/ui/sidebar.tsx +8 -8
  197. package/resources/templates/default/admin/lib/ui/skeleton.tsx +1 -1
  198. package/resources/templates/default/admin/lib/ui/sortable.tsx +1 -1
  199. package/resources/templates/default/admin/lib/ui/switch.tsx +1 -1
  200. package/resources/templates/default/admin/lib/ui/table.tsx +1 -1
  201. package/resources/templates/default/admin/lib/ui/textarea.tsx +1 -1
  202. package/resources/templates/default/admin/lib/ui/toggle-group.tsx +2 -2
  203. package/resources/templates/default/admin/lib/ui/toggle.tsx +1 -1
  204. package/resources/templates/default/admin/lib/ui/tooltip.tsx +2 -2
  205. package/resources/templates/default/admin/lib/upload/dropzone.tsx +20 -3
  206. package/resources/templates/default/admin/lib/upload/index.ts +3 -3
  207. package/resources/templates/default/admin/lib/upload/repeater.tsx +5 -1
  208. package/resources/templates/default/admin/lib/upload/ui.tsx +2 -2
  209. package/resources/templates/default/admin/lib/upload/upload-progress.tsx +6 -6
  210. package/resources/templates/default/admin/lib/upload/view.tsx +4 -4
  211. package/resources/templates/default/admin/lib/utils/cn.ts +18 -0
  212. package/resources/templates/default/admin/lib/utils/createComponentOpenHooks.tsx +33 -0
  213. package/resources/templates/default/admin/lib/utils/index.ts +2 -2
  214. package/resources/templates/default/admin/lib/utils/uic.tsx +59 -0
  215. package/resources/templates/default/admin/lib/utils/use-mobile.ts +19 -0
  216. package/resources/templates/default/scripts/assemble-ui-lib.mjs +132 -0
  217. package/resources/templates/default/scripts/update-ui-lib.sh +101 -185
  218. package/src/commands/WorkspaceCreateCommand.ts +3 -3
  219. package/src/commands/index.ts +1 -1
  220. package/src/lib/FileSystem.ts +2 -2
  221. package/src/lib/TemplateInstaller.ts +1 -1
  222. package/src/lib/version.ts +1 -1
  223. package/src/run.ts +4 -4
@@ -8,6 +8,47 @@ const InviteFetcher = TenantApi.inviteResponse$$
8
8
 
9
9
  export type InviteErrorCodes = TenantApi.InviteErrorCode
10
10
 
11
+ /**
12
+ * `useInvite` is a React hook for managing user invitations in a Contember project.
13
+ * It interacts with the tenant API to send an invitation with specific memberships and project details.
14
+ *
15
+ * ## Features
16
+ * - Sends invitations to users via the tenant API.
17
+ * - Supports specifying project membership details.
18
+ * - Automatically includes options for password reset during the invitation process.
19
+ *
20
+ * ## Returns
21
+ * A callback function that accepts an object with the following properties:
22
+ * - `email` (string): The email address of the invitee.
23
+ * - `projectSlug` (string): The slug of the project the user is being invited to.
24
+ * - `memberships` (TenantApi.MembershipInput[]): An array defining the memberships to be assigned.
25
+ *
26
+ * ## Example: Sending an Invitation
27
+ * ```tsx
28
+ * import { useInvite } from './useInvite'
29
+ *
30
+ * const InviteUser = () => {
31
+ * const invite = useInvite()
32
+ *
33
+ * const handleInvite = async () => {
34
+ * try {
35
+ * const response = await invite({
36
+ * email: 'user@example.com',
37
+ * projectSlug: 'my-project',
38
+ * memberships: [
39
+ * { role: 'editor', variables: {} },
40
+ * ],
41
+ * });
42
+ * console.log('Invitation sent:', response)
43
+ * } catch (error) {
44
+ * console.error('Failed to send invitation:', error)
45
+ * }
46
+ * };
47
+ *
48
+ * return <button onClick={handleInvite}>Send Invite</button>
49
+ * };
50
+ * ```
51
+ */
11
52
  export const useInvite = () => {
12
53
  const api = useTenantApi()
13
54
 
@@ -1,13 +1,42 @@
1
1
  import * as React from 'react'
2
2
 
3
- import { useInvite } from './useInvite'
4
- import { ToastContent, useShowToast } from '../../toast'
3
+ import { useInvite } from './useInvite.js'
4
+ import { ToastContent, useShowToast } from '~/lib'
5
5
  import { useProjectSlug } from '@contember/react-client'
6
6
  import { EntityAccessor } from '@contember/interface'
7
7
  import * as TenantApi from '@contember/graphql-client-tenant'
8
8
  import { useReferentiallyStableCallback } from '@contember/react-utils'
9
- import { dict } from '../../dict'
9
+ import { dict } from '../dict.js'
10
10
 
11
+ /**
12
+ * `useInviteUser` is a React hook for managing user invitations within a Contember project.
13
+ * It integrates with the tenant API and project-specific configurations to invite users dynamically
14
+ * based on entity accessor fields.
15
+ *
16
+ * ## Example: Inviting a User
17
+ * ```tsx
18
+ * import { useInviteUser } from './useInviteUser'
19
+ *
20
+ * const InviteUserButton = ({ entityAccessor }: { entityAccessor: EntityAccessor }) => {
21
+ * const inviteUser = useInviteUser({
22
+ * emailField: 'email',
23
+ * personIdField: 'personId',
24
+ * memberships: [{ role: 'admin', variables: {} }],
25
+ * })
26
+ *
27
+ * const handleInvite = async () => {
28
+ * try {
29
+ * await inviteUser(() => entityAccessor)
30
+ * console.log('Invitation sent successfully')
31
+ * } catch (error) {
32
+ * console.error('Failed to send invitation:', error)
33
+ * }
34
+ * }
35
+ *
36
+ * return <button onClick={handleInvite}>Invite User</button>
37
+ * };
38
+ * ```
39
+ */
11
40
  export const useInviteUser = ({ emailField, personIdField, memberships }: {
12
41
  personIdField: string
13
42
  emailField: string
@@ -1,3 +1,3 @@
1
- export * from './forms'
2
- export * from './listing'
3
- export * from './otp'
1
+ export * from './forms/index.js'
2
+ export * from './listing/index.js'
3
+ export * from './otp/index.js'
@@ -1,8 +1,8 @@
1
1
  import { ProjectMembersFilter } from '@contember/graphql-client-tenant'
2
2
  import * as React from 'react'
3
- import { TableCell } from '../../ui/table'
4
- import { dict } from '../../dict'
5
- import { MemberList, MemberListController } from './member-list'
3
+ import { TableCell } from '~/lib'
4
+ import { dict } from '../dict.js'
5
+ import { MemberList, MemberListController } from './member-list.js'
6
6
 
7
7
  const filter: ProjectMembersFilter = {
8
8
  memberType: 'API_KEY',
@@ -1,4 +1,4 @@
1
- export * from './api-key-list'
2
- export * from './member-delete-dialog'
3
- export * from './member-list'
4
- export * from './person-list'
1
+ export * from './api-key-list.js'
2
+ export * from './member-delete-dialog.js'
3
+ export * from './member-list.js'
4
+ export * from './person-list.js'
@@ -7,10 +7,10 @@ import {
7
7
  AlertDialogHeader,
8
8
  AlertDialogTitle,
9
9
  AlertDialogTrigger,
10
- } from '../../ui/alert-dialog'
11
- import { Button } from '../../ui/button'
10
+ } from '~/lib'
11
+ import { Button } from '~/lib'
12
12
  import { TrashIcon } from 'lucide-react'
13
- import { dict } from '../../dict'
13
+ import { dict } from '../dict.js'
14
14
  import * as React from 'react'
15
15
  import { ReactNode } from 'react'
16
16
  import { RemoveProjectMemberTrigger } from '@contember/interface'
@@ -1,18 +1,18 @@
1
1
  import { ProjectMembersFilter } from '@contember/graphql-client-tenant'
2
2
  import * as React from 'react'
3
3
  import { ReactNode, useState } from 'react'
4
- import { Loader } from '../../ui/loader'
5
- import { Table, TableCell, TableHead, TableHeader, TableRow } from '../../ui/table'
6
- import { Button } from '../../ui/button'
4
+ import { Loader } from '~/lib'
5
+ import { Table, TableCell, TableHead, TableHeader, TableRow } from '~/lib'
6
+ import { Button } from '~/lib'
7
7
  import { ChevronLeftIcon, ChevronRightIcon, PencilIcon, RefreshCwIcon } from 'lucide-react'
8
8
  import { ProjectMembersQueryResult, useProjectMembersQuery, useTenantQueryLoader } from '@contember/react-client-tenant'
9
9
  import { useProjectSlug } from '@contember/react-client'
10
10
  import { UpdateProjectMemberForm } from '@contember/interface'
11
- import { ToastContent, useShowToast } from '../../toast'
12
- import { dict } from '../../dict'
13
- import { MemberDeleteDialog } from './member-delete-dialog'
14
- import { Dialog, DialogContent, DialogTrigger } from '../../ui/dialog'
15
- import { RolesConfig, UpdateProjectMemberFormFields } from '../forms'
11
+ import { ToastContent, useShowToast } from '~/lib'
12
+ import { dict } from '../dict.js'
13
+ import { MemberDeleteDialog } from './member-delete-dialog.js'
14
+ import { Dialog, DialogContent, DialogTrigger } from '~/lib'
15
+ import { RolesConfig, UpdateProjectMemberFormFields } from '../forms/index.js'
16
16
 
17
17
  const perPage = 20
18
18
 
@@ -1,9 +1,9 @@
1
1
  import { ProjectMembersFilter } from '@contember/graphql-client-tenant'
2
2
  import * as React from 'react'
3
- import { TableCell } from '../../ui/table'
4
- import { dict } from '../../dict'
5
- import { MemberList, MemberListController } from './member-list'
6
- import { RolesConfig } from '../forms'
3
+ import { TableCell } from '~/lib'
4
+ import { dict } from '../dict.js'
5
+ import { MemberList, MemberListController } from './member-list.js'
6
+ import { RolesConfig } from '../forms/index.js'
7
7
 
8
8
  const filter: ProjectMembersFilter = {
9
9
  memberType: 'PERSON',
@@ -1 +1 @@
1
- export * from './otp-setup'
1
+ export * from './otp-setup.js'
@@ -1,8 +1,8 @@
1
1
  import { useMemo, useState } from 'react'
2
2
  import qrcode from 'qrcode-generator'
3
3
  import { DisableOtpTrigger, OtpConfirmForm, OtpPrepareForm, useIdentity, useOtpConfirmForm, useOtpPrepareForm } from '@contember/interface'
4
- import { Loader } from '../../ui/loader'
5
- import { Button } from '../../ui/button'
4
+ import { Loader } from '~/lib'
5
+ import { Button } from '~/lib'
6
6
  import {
7
7
  AlertDialog,
8
8
  AlertDialogAction,
@@ -13,10 +13,10 @@ import {
13
13
  AlertDialogHeader,
14
14
  AlertDialogTitle,
15
15
  AlertDialogTrigger,
16
- } from '../../ui/alert-dialog'
17
- import { TenantFormError, TenantFormField } from '../forms/common'
18
- import { ToastContent, useShowToast } from '../../toast'
19
- import { dict } from '../../dict'
16
+ } from '~/lib'
17
+ import { TenantFormError, TenantFormField } from '../forms/common.js'
18
+ import { ToastContent, useShowToast } from '~/lib'
19
+ import { dict } from '../dict.js'
20
20
 
21
21
  export const OtpSetup = () => {
22
22
  const identity = useIdentity()
@@ -1,2 +1,2 @@
1
- export * from './toaster'
2
- export * from './toast'
1
+ export * from './toaster.js'
2
+ export * from './toast.js'
@@ -2,9 +2,9 @@ import * as React from 'react'
2
2
  import { ReactNode } from 'react'
3
3
  import * as ToastPrimitives from '@radix-ui/react-toast'
4
4
  import { X } from 'lucide-react'
5
- import { uic } from '../utils'
6
- import { ToasterProvider, useToasts } from './toaster'
7
- import { dict } from '../dict'
5
+ import { uic } from '../utils/index.js'
6
+ import { ToasterProvider, useToasts } from './toaster.js'
7
+ import { dict } from '../dict.js'
8
8
 
9
9
  export const ToastContent = ({ title, children, action, details }: {
10
10
  title?: ReactNode
@@ -1,24 +1,93 @@
1
1
  import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog'
2
2
  import * as React from 'react'
3
- import { uic } from '../utils'
4
- import { createComponentOpenHooks } from '../utils/createComponentOpenHooks'
5
- import { buttonConfig } from './button'
3
+ import { uic } from '../utils/index.js'
4
+ import { createComponentOpenHooks } from '../utils/createComponentOpenHooks.js'
5
+ import { buttonConfig } from './button.js'
6
6
 
7
+ /**
8
+ * `AlertDialog` component - an interruptive modal dialog that requires a user interaction
9
+ * to be dismissed. It is used to confirm user actions or to inform the user
10
+ * about important information that requires attention.
11
+ *
12
+ * ## Example
13
+ * ```tsx
14
+ * <AlertDialog>
15
+ * <AlertDialogTrigger>Open Dialog</AlertDialogTrigger>
16
+ * <AlertDialogContent>
17
+ * <AlertDialogHeader>
18
+ * <AlertDialogTitle>Are you sure?</AlertDialogTitle>
19
+ * <AlertDialogDescription>
20
+ * This action cannot be undone.
21
+ * </AlertDialogDescription>
22
+ * </AlertDialogHeader>
23
+ * <AlertDialogFooter>
24
+ * <AlertDialogCancel>Cancel</AlertDialogCancel>
25
+ * <AlertDialogAction>Continue</AlertDialogAction>
26
+ * </AlertDialogFooter>
27
+ * </AlertDialogContent>
28
+ * </AlertDialog>
29
+ * ```
30
+ *
31
+ * ## Sub-components
32
+ * - {@link AlertDialogPortal}
33
+ * - {@link AlertDialogContent}
34
+ * - {@link AlertDialogHeader}
35
+ * - {@link AlertDialogFooter}
36
+ * - {@link AlertDialogTitle}
37
+ * - {@link AlertDialogDescription}
38
+ * - {@link AlertDialogAction}
39
+ * - {@link AlertDialogCancel}
40
+ *
41
+ * ## Hooks
42
+ * - {@link useAlertDialogOpenState}
43
+ */
7
44
  export const {
8
45
  Component: AlertDialog,
9
46
  useOpen: useAlertDialogOpenState,
10
47
  } = createComponentOpenHooks(AlertDialogPrimitive.Root)
11
48
 
49
+ /**
50
+ * `AlertDialogTrigger` is the trigger button to open the dialog.
51
+ * Must be used within `AlertDialog`.
52
+ *
53
+ * See more {@link AlertDialog}
54
+ *
55
+ * @group AlertDialog
56
+ */
12
57
  export const AlertDialogTrigger = AlertDialogPrimitive.Trigger
13
58
 
59
+ /**
60
+ * `AlertDialogPortal` is the portal to render the dialog.
61
+ * Must be used within `AlertDialog`.
62
+ *
63
+ * See more {@link AlertDialog}
64
+ *
65
+ * @group AlertDialog
66
+ */
14
67
  export const AlertDialogPortal = AlertDialogPrimitive.Portal
15
68
 
69
+ /**
70
+ * `AlertDialogOverlay` is the overlay to render the dialog.
71
+ * Must be used within `AlertDialog`.
72
+ *
73
+ * See more {@link AlertDialog}
74
+ *
75
+ * @group AlertDialog
76
+ */
16
77
  export const AlertDialogOverlay = uic(AlertDialogPrimitive.Overlay, {
17
78
  baseClass:
18
79
  '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',
19
80
  displayName: 'AlertDialogOverlay',
20
81
  })
21
82
 
83
+ /**
84
+ * `AlertDialogContent` is the content of the alert dialog.
85
+ * Must be used within `AlertDialog`.
86
+ *
87
+ * For documentation see {@link AlertDialog}
88
+ *
89
+ * @group AlertDialog
90
+ */
22
91
  export const AlertDialogContent = uic(AlertDialogPrimitive.Content, {
23
92
  baseClass:
24
93
  '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',
@@ -33,27 +102,69 @@ export const AlertDialogContent = uic(AlertDialogPrimitive.Content, {
33
102
  displayName: 'AlertDialogContent',
34
103
  })
35
104
 
105
+ /**
106
+ * `AlertDialogHeader` is the header of the alert dialog. Must be used within `AlertDialog`. Usually contains the title and description of the alert dialog.
107
+ *
108
+ * See more {@link AlertDialog}
109
+ *
110
+ * @group AlertDialog
111
+ */
36
112
  export const AlertDialogHeader = uic('div', {
37
113
  baseClass: 'flex flex-col space-y-2 text-center sm:text-left',
38
114
  displayName: 'AlertDialogHeader',
39
115
  })
40
116
 
117
+ /**
118
+ * `AlertDialogFooter` is the footer of the alert dialog. Must be used within `AlertDialog`. Usually contains the buttons of the alert dialog.
119
+ *
120
+ * See more {@link AlertDialog}
121
+ *
122
+ * @group AlertDialog
123
+ */
41
124
  export const AlertDialogFooter = uic('div', {
42
125
  baseClass: 'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
43
126
  displayName: 'AlertDialogFooter',
44
127
  })
45
128
 
129
+ /**
130
+ * `AlertDialogTitle` is the title of the alert dialog. Must be used within `AlertDialogHeader`. Usually contains the title of the alert dialog.
131
+ *
132
+ * See more {@link AlertDialog}
133
+ *
134
+ * @group AlertDialog
135
+ */
46
136
  export const AlertDialogTitle = uic(AlertDialogPrimitive.Title, {
47
137
  baseClass: 'text-lg font-semibold',
48
138
  displayName: 'AlertDialogTitle',
49
139
  })
50
140
 
141
+ /**
142
+ * `AlertDialogDescription` is the description of the alert dialog. Must be used within `AlertDialogHeader`. Usually contains the description of the alert dialog.
143
+ *
144
+ * See more {@link AlertDialog}
145
+ *
146
+ * @group AlertDialog
147
+ */
51
148
  export const AlertDialogDescription = uic(AlertDialogPrimitive.Description, {
52
149
  baseClass: 'text-sm text-muted-foreground',
53
150
  displayName: 'AlertDialogDescription',
54
151
  })
55
152
 
153
+ /**
154
+ * `AlertDialogAction` is the action button of the alert dialog. Must be used within `AlertDialogFooter`. Usually contains the action button of the alert dialog.
155
+ *
156
+ * See more {@link AlertDialog}
157
+ *
158
+ * @group AlertDialog
159
+ */
56
160
  export const AlertDialogAction = uic(AlertDialogPrimitive.Action, buttonConfig)
161
+ /**
162
+ * `AlertDialogCancel` is the cancel button of the alert dialog. Must be used within `AlertDialogFooter`. Usually contains the cancel button of the alert dialog.
163
+ *
164
+ * See more {@link AlertDialog}
165
+ *
166
+ * @group AlertDialog
167
+ */
57
168
  export const AlertDialogCancel = uic(AlertDialogPrimitive.Cancel, {
58
169
  ...buttonConfig,
59
170
  defaultVariants: {
@@ -1,6 +1,6 @@
1
1
  import * as AvatarPrimitive from '@radix-ui/react-avatar'
2
2
  import { ComponentPropsWithoutRef, ElementRef, forwardRef } from 'react'
3
- import { cn, uic } from '../utils'
3
+ import { cn, uic } from '../utils/index.js'
4
4
 
5
5
  export const Avatar = uic(AvatarPrimitive.Root, {
6
6
  baseClass: 'relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full',
@@ -1,4 +1,4 @@
1
- import { uic, uiconfig } from '../utils'
1
+ import { uic, uiconfig } from '../utils/index.js'
2
2
 
3
3
  export const buttonConfig = uiconfig({
4
4
  baseClass:
@@ -1,4 +1,4 @@
1
- import { uic } from '../utils'
1
+ import { uic } from '../utils/index.js'
2
2
 
3
3
  export const Card = uic('div', {
4
4
  baseClass: 'rounded-xl border border-gray-200 bg-card text-card-foreground shadow-sm',
@@ -1,5 +1,5 @@
1
1
  import * as CollapsiblePrimitive from '@radix-ui/react-collapsible'
2
- import { createComponentOpenHooks } from '../utils/createComponentOpenHooks'
2
+ import { createComponentOpenHooks } from '../utils/createComponentOpenHooks.js'
3
3
 
4
4
  export const {
5
5
  Component: Collapsible,
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react'
2
2
  import * as DialogPrimitive from '@radix-ui/react-dialog'
3
- import { uic } from '../utils/uic'
3
+ import { uic } from '../utils/uic.js'
4
4
  import { XIcon } from 'lucide-react'
5
- import { createComponentOpenHooks } from '../utils/createComponentOpenHooks'
5
+ import { createComponentOpenHooks } from '../utils/createComponentOpenHooks.js'
6
6
 
7
7
  export const { Component: Dialog, useOpen: useDialogOpenState } = createComponentOpenHooks(DialogPrimitive.Root)
8
8
 
@@ -1,4 +1,4 @@
1
- import { uic } from '../utils'
1
+ import { uic } from '../utils/index.js'
2
2
 
3
3
  export const DimensionLabelWrapperUI = uic('div', {
4
4
  baseClass: 'flex justify-between items-center',
@@ -1,4 +1,4 @@
1
- import { uic } from '../utils'
1
+ import { uic } from '../utils/index.js'
2
2
 
3
3
  export const Divider = uic('hr', {
4
4
  baseClass: 'border-t border-divider',
@@ -2,9 +2,9 @@ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'
2
2
  import { Check, ChevronRight, Circle, MoreHorizontalIcon } from 'lucide-react'
3
3
  import * as React from 'react'
4
4
  import { ReactNode } from 'react'
5
- import { uic } from '../utils'
6
- import { createComponentOpenHooks } from '../utils/createComponentOpenHooks'
7
- import { buttonConfig } from './button'
5
+ import { uic } from '../utils/index.js'
6
+ import { createComponentOpenHooks } from '../utils/createComponentOpenHooks.js'
7
+ import { buttonConfig } from './button.js'
8
8
 
9
9
  export const {
10
10
  Component: DropdownMenu,
@@ -1,4 +1,4 @@
1
- import { uic, uiconfig } from '../utils'
1
+ import { uic, uiconfig } from '../utils/index.js'
2
2
 
3
3
  export const inputConfig = uiconfig({
4
4
  baseClass: [
@@ -1,5 +1,5 @@
1
1
  import * as LabelPrimitive from '@radix-ui/react-label'
2
- import { uic } from '../utils'
2
+ import { uic } from '../utils/index.js'
3
3
 
4
4
  export const Label = uic(LabelPrimitive.Root, {
5
5
  baseClass: 'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 data-[invalid]:text-destructive',
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react'
2
- import { uic } from '../utils'
2
+ import { uic } from '../utils/index.js'
3
3
  import { Loader2Icon } from 'lucide-react'
4
- import { Overlay, OverlayProps } from './overlay'
4
+ import { Overlay, OverlayProps } from './overlay.js'
5
5
 
6
6
  export interface LoaderProps extends Omit<OverlayProps, 'children'> {
7
7
  size?: 'sm' | 'md' | 'lg'
@@ -3,8 +3,8 @@ import { createContext } from '@contember/react-utils'
3
3
  import { VariantProps } from 'class-variance-authority'
4
4
  import { ChevronRight } from 'lucide-react'
5
5
  import { Children, isValidElement, ReactNode, useMemo } from 'react'
6
- import { Collapsible, CollapsibleContent, CollapsibleTrigger } from './collapsible'
7
- import { SidebarMenu, SidebarMenuButton, sidebarMenuButtonVariants, SidebarMenuItem, SidebarMenuSub } from './sidebar'
6
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from './collapsible.js'
7
+ import { SidebarMenu, SidebarMenuButton, sidebarMenuButtonVariants, SidebarMenuItem, SidebarMenuSub } from './sidebar.js'
8
8
 
9
9
  export type MenuItemProps = {
10
10
  icon?: ReactNode
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react'
2
- import { cn } from '../utils'
2
+ import { cn } from '../utils/index.js'
3
3
 
4
4
  export interface OverlayProps {
5
5
  position?: 'fixed' | 'absolute' | 'static'
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react'
2
2
  import * as PopoverPrimitive from '@radix-ui/react-popover'
3
- import { cn, uic } from '../utils'
4
- import { createComponentOpenHooks } from '../utils/createComponentOpenHooks'
3
+ import { cn, uic } from '../utils/index.js'
4
+ import { createComponentOpenHooks } from '../utils/createComponentOpenHooks.js'
5
5
 
6
6
  const { Component: Popover, useOpen: usePopoverOpenState } = createComponentOpenHooks(PopoverPrimitive.Root)
7
7
 
@@ -1,6 +1,6 @@
1
1
  import * as ProgressPrimitive from '@radix-ui/react-progress'
2
2
  import * as React from 'react'
3
- import { uic } from '../utils'
3
+ import { uic } from '../utils/index.js'
4
4
 
5
5
  const ProgressRoot = uic(ProgressPrimitive.Root, {
6
6
  baseClass: 'relative h-1.5 w-full overflow-hidden rounded-full bg-primary/20',
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react'
2
- import { uic } from '../utils'
2
+ import { uic } from '../utils/index.js'
3
3
 
4
4
  export const PropertyList = uic('div', {
5
5
  baseClass: 'relative overflow-auto bg-gray-50/50 max-w-lg border border-gray-200 rounded-md grid grid-cols-[max-content_1fr]',
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react'
2
2
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area'
3
- import { cn } from '../utils'
3
+ import { cn } from '../utils/index.js'
4
4
 
5
5
  const ScrollArea = React.forwardRef<
6
6
  React.ElementRef<typeof ScrollAreaPrimitive.Root>,
@@ -1,8 +1,50 @@
1
1
  import * as SelectPrimitive from '@radix-ui/react-select'
2
2
  import { Check, ChevronDown, ChevronUp } from 'lucide-react'
3
- import { uic } from '../utils'
4
- import { createComponentOpenHooks } from '../utils/createComponentOpenHooks'
3
+ import { uic } from '../utils/index.js'
4
+ import { createComponentOpenHooks } from '../utils/createComponentOpenHooks.js'
5
5
 
6
+ /**
7
+ * Select Component
8
+ *
9
+ * ### Example: Basic
10
+ * ```tsx
11
+ * <Select>
12
+ * <SelectTrigger>Choose</SelectTrigger>
13
+ * <SelectContent>
14
+ * <SelectItem value="apple">Apple</SelectItem>
15
+ * <SelectItem value="banana">Banana</SelectItem>
16
+ * </SelectContent>
17
+ * </Select>
18
+ * ```
19
+ *
20
+ * ### Example: With Group
21
+ * ```tsx
22
+ * <Select>
23
+ * <SelectTrigger>Choose country</SelectTrigger>
24
+ * <SelectContent>
25
+ * <SelectGroup>
26
+ * <SelectItem value="apple">Apple</SelectItem>
27
+ * <SelectItem value="banana">Banana</SelectItem>
28
+ * </SelectGroup>
29
+ * <SelectGroup>
30
+ * <SelectItem value="cucumber">Cucumber</SelectItem>
31
+ * <SelectItem value="paprika">Paprika</SelectItem>
32
+ * </SelectGroup>
33
+ * </SelectContent>
34
+ * </Select>
35
+ * ```
36
+ *
37
+ * ### Sub-components
38
+ * - {@link SelectTrigger}
39
+ * - {@link SelectContent}
40
+ * - {@link SelectItem}
41
+ * - {@link SelectGroup}
42
+ * - {@link SelectValue}
43
+ * - {@link SelectLabel}
44
+ *
45
+ * ## Hooks
46
+ * - {@link useSelectOpenState}
47
+ */
6
48
  export const { Component: Select, useOpen: useSelectOpenState } = createComponentOpenHooks(SelectPrimitive.Root)
7
49
 
8
50
  export const SelectGroup = SelectPrimitive.Group
@@ -1,5 +1,5 @@
1
1
  import * as SeparatorPrimitive from '@radix-ui/react-separator'
2
- import { uic } from '../utils'
2
+ import { uic } from '../utils/index.js'
3
3
 
4
4
  export const Separator = uic(SeparatorPrimitive.Root, {
5
5
  baseClass: 'shrink-0 bg-border',
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react'
2
2
  import * as SheetPrimitive from '@radix-ui/react-dialog'
3
- import { uic } from '../utils/uic'
3
+ import { uic } from '../utils/uic.js'
4
4
  import { XIcon } from 'lucide-react'
5
- import { createComponentOpenHooks } from '../utils/createComponentOpenHooks'
5
+ import { createComponentOpenHooks } from '../utils/createComponentOpenHooks.js'
6
6
 
7
7
  export const { Component: Sheet, useOpen: useSheetOpenState } = createComponentOpenHooks(SheetPrimitive.Root)
8
8