@contember/create 1.4.0-rc.4 → 1.4.0-rc.6

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/src/commands/WorkspaceCreateCommand.d.ts +4 -3
  2. package/dist/src/commands/WorkspaceCreateCommand.d.ts.map +1 -1
  3. package/dist/src/commands/WorkspaceCreateCommand.js +10 -4
  4. package/dist/src/commands/WorkspaceCreateCommand.js.map +1 -1
  5. package/dist/src/lib/FileSystem.d.ts +14 -0
  6. package/dist/src/lib/FileSystem.d.ts.map +1 -0
  7. package/dist/src/lib/FileSystem.js +54 -0
  8. package/dist/src/lib/FileSystem.js.map +1 -0
  9. package/dist/src/lib/PackageDownloader.d.ts +7 -0
  10. package/dist/src/lib/PackageDownloader.d.ts.map +1 -0
  11. package/dist/src/lib/PackageDownloader.js +32 -0
  12. package/dist/src/lib/PackageDownloader.js.map +1 -0
  13. package/dist/src/lib/TemplateInstaller.d.ts +13 -0
  14. package/dist/src/lib/TemplateInstaller.d.ts.map +1 -0
  15. package/dist/src/lib/TemplateInstaller.js +75 -0
  16. package/dist/src/lib/TemplateInstaller.js.map +1 -0
  17. package/dist/src/lib/pathUtils.d.ts +3 -0
  18. package/dist/src/lib/pathUtils.d.ts.map +1 -0
  19. package/dist/src/lib/pathUtils.js +7 -0
  20. package/dist/src/lib/pathUtils.js.map +1 -0
  21. package/dist/src/run.js +7 -3
  22. package/dist/src/run.js.map +1 -1
  23. package/dist/src/tsconfig.tsbuildinfo +1 -1
  24. package/package.json +9 -3
  25. package/resources/templates/template-workspace/.gitignore.dist +3 -0
  26. package/resources/templates/template-workspace/admin/.env.development +3 -0
  27. package/resources/templates/template-workspace/admin/.env.production +3 -0
  28. package/resources/templates/template-workspace/admin/app/components/layout.tsx +32 -0
  29. package/resources/templates/template-workspace/admin/app/components/logo.tsx +16 -0
  30. package/resources/templates/template-workspace/admin/app/components/navigation.tsx +1 -0
  31. package/resources/templates/template-workspace/admin/app/config.ts +27 -0
  32. package/resources/templates/template-workspace/admin/app/index.html +15 -0
  33. package/resources/templates/template-workspace/admin/app/index.tsx +40 -0
  34. package/resources/templates/template-workspace/admin/app/pages/index.tsx +5 -0
  35. package/resources/templates/template-workspace/admin/index.css +53 -0
  36. package/resources/templates/template-workspace/admin/index.html +13 -0
  37. package/resources/templates/template-workspace/admin/index.tsx +268 -0
  38. package/resources/templates/template-workspace/admin/lib/binding/binding.tsx +45 -0
  39. package/resources/templates/template-workspace/admin/lib/binding/delete.tsx +43 -0
  40. package/resources/templates/template-workspace/admin/lib/binding/hooks.tsx +71 -0
  41. package/resources/templates/template-workspace/admin/lib/binding/identity.tsx +19 -0
  42. package/resources/templates/template-workspace/admin/lib/binding/index.ts +5 -0
  43. package/resources/templates/template-workspace/admin/lib/binding/persist.tsx +70 -0
  44. package/resources/templates/template-workspace/admin/lib/block-repeater/block-repeater.tsx +224 -0
  45. package/resources/templates/template-workspace/admin/lib/block-repeater/index.ts +1 -0
  46. package/resources/templates/template-workspace/admin/lib/board/board.tsx +240 -0
  47. package/resources/templates/template-workspace/admin/lib/board/index.ts +1 -0
  48. package/resources/templates/template-workspace/admin/lib/buttons/back-button.tsx +20 -0
  49. package/resources/templates/template-workspace/admin/lib/buttons/index.ts +2 -0
  50. package/resources/templates/template-workspace/admin/lib/buttons/link-back-button.tsx +21 -0
  51. package/resources/templates/template-workspace/admin/lib/datagrid/cells.tsx +64 -0
  52. package/resources/templates/template-workspace/admin/lib/datagrid/column-header.tsx +65 -0
  53. package/resources/templates/template-workspace/admin/lib/datagrid/columns.tsx +166 -0
  54. package/resources/templates/template-workspace/admin/lib/datagrid/elements.tsx +42 -0
  55. package/resources/templates/template-workspace/admin/lib/datagrid/empty.tsx +8 -0
  56. package/resources/templates/template-workspace/admin/lib/datagrid/export.tsx +17 -0
  57. package/resources/templates/template-workspace/admin/lib/datagrid/filters/boolean.tsx +76 -0
  58. package/resources/templates/template-workspace/admin/lib/datagrid/filters/common.tsx +29 -0
  59. package/resources/templates/template-workspace/admin/lib/datagrid/filters/date.tsx +153 -0
  60. package/resources/templates/template-workspace/admin/lib/datagrid/filters/enum.tsx +115 -0
  61. package/resources/templates/template-workspace/admin/lib/datagrid/filters/index.ts +7 -0
  62. package/resources/templates/template-workspace/admin/lib/datagrid/filters/mobile.tsx +19 -0
  63. package/resources/templates/template-workspace/admin/lib/datagrid/filters/number.tsx +100 -0
  64. package/resources/templates/template-workspace/admin/lib/datagrid/filters/relation.tsx +180 -0
  65. package/resources/templates/template-workspace/admin/lib/datagrid/filters/text.tsx +121 -0
  66. package/resources/templates/template-workspace/admin/lib/datagrid/grid.tsx +61 -0
  67. package/resources/templates/template-workspace/admin/lib/datagrid/index.ts +16 -0
  68. package/resources/templates/template-workspace/admin/lib/datagrid/layout-switcher.tsx +32 -0
  69. package/resources/templates/template-workspace/admin/lib/datagrid/loader.tsx +10 -0
  70. package/resources/templates/template-workspace/admin/lib/datagrid/pagination.tsx +103 -0
  71. package/resources/templates/template-workspace/admin/lib/datagrid/table.tsx +69 -0
  72. package/resources/templates/template-workspace/admin/lib/datagrid/tiles.tsx +24 -0
  73. package/resources/templates/template-workspace/admin/lib/datagrid/toolbar.tsx +66 -0
  74. package/resources/templates/template-workspace/admin/lib/datagrid/ui.tsx +153 -0
  75. package/resources/templates/template-workspace/admin/lib/dev/index.ts +2 -0
  76. package/resources/templates/template-workspace/admin/lib/dev/login-panel.tsx +56 -0
  77. package/resources/templates/template-workspace/admin/lib/dev/todo.tsx +14 -0
  78. package/resources/templates/template-workspace/admin/lib/dict.ts +324 -0
  79. package/resources/templates/template-workspace/admin/lib/dimensions/dimensions.tsx +135 -0
  80. package/resources/templates/template-workspace/admin/lib/dimensions/index.ts +1 -0
  81. package/resources/templates/template-workspace/admin/lib/editor/block-editor.tsx +111 -0
  82. package/resources/templates/template-workspace/admin/lib/editor/common/baseEditorPlugins.tsx +66 -0
  83. package/resources/templates/template-workspace/admin/lib/editor/common/buttons.tsx +83 -0
  84. package/resources/templates/template-workspace/admin/lib/editor/common/editor-block-toolbar.tsx +17 -0
  85. package/resources/templates/template-workspace/admin/lib/editor/common/editor-canvas.tsx +30 -0
  86. package/resources/templates/template-workspace/admin/lib/editor/common/editor-editable-canvas.tsx +50 -0
  87. package/resources/templates/template-workspace/admin/lib/editor/common/editor-inline-toolbar.tsx +63 -0
  88. package/resources/templates/template-workspace/admin/lib/editor/common/elements/AnchorRenderer.tsx +36 -0
  89. package/resources/templates/template-workspace/admin/lib/editor/common/elements/BlockElement.tsx +48 -0
  90. package/resources/templates/template-workspace/admin/lib/editor/common/elements/HeadingRenderer.tsx +48 -0
  91. package/resources/templates/template-workspace/admin/lib/editor/common/elements/HorizontalRuleRenderer.tsx +28 -0
  92. package/resources/templates/template-workspace/admin/lib/editor/common/elements/ListItemRenderer.tsx +13 -0
  93. package/resources/templates/template-workspace/admin/lib/editor/common/elements/OrderedListRenderer.tsx +13 -0
  94. package/resources/templates/template-workspace/admin/lib/editor/common/elements/ParagraphRenderer.tsx +15 -0
  95. package/resources/templates/template-workspace/admin/lib/editor/common/elements/ScrollTargetRenderer.tsx +30 -0
  96. package/resources/templates/template-workspace/admin/lib/editor/common/elements/TableCellElementRenderer.tsx +20 -0
  97. package/resources/templates/template-workspace/admin/lib/editor/common/elements/TableElementRenderer.tsx +96 -0
  98. package/resources/templates/template-workspace/admin/lib/editor/common/elements/TableRowElementRenderer.tsx +15 -0
  99. package/resources/templates/template-workspace/admin/lib/editor/common/elements/UnorderedListRenderer.tsx +13 -0
  100. package/resources/templates/template-workspace/admin/lib/editor/common/index.ts +6 -0
  101. package/resources/templates/template-workspace/admin/lib/editor/editor-block.tsx +96 -0
  102. package/resources/templates/template-workspace/admin/lib/editor/index.ts +5 -0
  103. package/resources/templates/template-workspace/admin/lib/editor/plugins.tsx +36 -0
  104. package/resources/templates/template-workspace/admin/lib/editor/rich-text.tsx +54 -0
  105. package/resources/templates/template-workspace/admin/lib/editor/sortable-block.tsx +51 -0
  106. package/resources/templates/template-workspace/admin/lib/errors/index.ts +1 -0
  107. package/resources/templates/template-workspace/admin/lib/errors/use-error-formatter.ts +26 -0
  108. package/resources/templates/template-workspace/admin/lib/form/container.tsx +63 -0
  109. package/resources/templates/template-workspace/admin/lib/form/index.ts +5 -0
  110. package/resources/templates/template-workspace/admin/lib/form/inputs.tsx +99 -0
  111. package/resources/templates/template-workspace/admin/lib/form/select.tsx +123 -0
  112. package/resources/templates/template-workspace/admin/lib/form/ui.tsx +29 -0
  113. package/resources/templates/template-workspace/admin/lib/form/upload.tsx +243 -0
  114. package/resources/templates/template-workspace/admin/lib/formatting/formatting.ts +62 -0
  115. package/resources/templates/template-workspace/admin/lib/formatting/index.ts +1 -0
  116. package/resources/templates/template-workspace/admin/lib/images/formatImageResizeUrl.ts +23 -0
  117. package/resources/templates/template-workspace/admin/lib/images/index.ts +1 -0
  118. package/resources/templates/template-workspace/admin/lib/layout/index.ts +2 -0
  119. package/resources/templates/template-workspace/admin/lib/layout/layout.tsx +167 -0
  120. package/resources/templates/template-workspace/admin/lib/layout/slots.tsx +24 -0
  121. package/resources/templates/template-workspace/admin/lib/outdated-application-dialog/index.ts +1 -0
  122. package/resources/templates/template-workspace/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +41 -0
  123. package/resources/templates/template-workspace/admin/lib/repeater/index.ts +1 -0
  124. package/resources/templates/template-workspace/admin/lib/repeater/repeater.tsx +142 -0
  125. package/resources/templates/template-workspace/admin/lib/select/create-new.tsx +34 -0
  126. package/resources/templates/template-workspace/admin/lib/select/filter.tsx +13 -0
  127. package/resources/templates/template-workspace/admin/lib/select/highlight.tsx +16 -0
  128. package/resources/templates/template-workspace/admin/lib/select/index.ts +7 -0
  129. package/resources/templates/template-workspace/admin/lib/select/list.tsx +49 -0
  130. package/resources/templates/template-workspace/admin/lib/select/multi-select.tsx +95 -0
  131. package/resources/templates/template-workspace/admin/lib/select/pagination.tsx +48 -0
  132. package/resources/templates/template-workspace/admin/lib/select/select.tsx +87 -0
  133. package/resources/templates/template-workspace/admin/lib/select/sortable-select.tsx +129 -0
  134. package/resources/templates/template-workspace/admin/lib/select/ui.tsx +80 -0
  135. package/resources/templates/template-workspace/admin/lib/tenant/forms/change-my-password.tsx +40 -0
  136. package/resources/templates/template-workspace/admin/lib/tenant/forms/common.tsx +94 -0
  137. package/resources/templates/template-workspace/admin/lib/tenant/forms/create-api-key.tsx +39 -0
  138. package/resources/templates/template-workspace/admin/lib/tenant/forms/index.ts +8 -0
  139. package/resources/templates/template-workspace/admin/lib/tenant/forms/invite.tsx +46 -0
  140. package/resources/templates/template-workspace/admin/lib/tenant/forms/login.tsx +52 -0
  141. package/resources/templates/template-workspace/admin/lib/tenant/forms/memberships-control.tsx +128 -0
  142. package/resources/templates/template-workspace/admin/lib/tenant/forms/password-reset-request.tsx +31 -0
  143. package/resources/templates/template-workspace/admin/lib/tenant/forms/password-reset.tsx +44 -0
  144. package/resources/templates/template-workspace/admin/lib/tenant/forms/update-project-member.tsx +32 -0
  145. package/resources/templates/template-workspace/admin/lib/tenant/hooks/useInvite.ts +28 -0
  146. package/resources/templates/template-workspace/admin/lib/tenant/hooks/useInviteUser.tsx +45 -0
  147. package/resources/templates/template-workspace/admin/lib/tenant/index.ts +3 -0
  148. package/resources/templates/template-workspace/admin/lib/tenant/listing/api-key-list.tsx +25 -0
  149. package/resources/templates/template-workspace/admin/lib/tenant/listing/index.ts +4 -0
  150. package/resources/templates/template-workspace/admin/lib/tenant/listing/member-delete-dialog.tsx +38 -0
  151. package/resources/templates/template-workspace/admin/lib/tenant/listing/member-list.tsx +147 -0
  152. package/resources/templates/template-workspace/admin/lib/tenant/listing/person-list.tsx +25 -0
  153. package/resources/templates/template-workspace/admin/lib/tenant/otp/index.ts +1 -0
  154. package/resources/templates/template-workspace/admin/lib/tenant/otp/otp-setup.tsx +146 -0
  155. package/resources/templates/template-workspace/admin/lib/toast/index.ts +2 -0
  156. package/resources/templates/template-workspace/admin/lib/toast/toast.tsx +112 -0
  157. package/resources/templates/template-workspace/admin/lib/toast/toaster.tsx +104 -0
  158. package/resources/templates/template-workspace/admin/lib/ui/alert-dialog.tsx +59 -0
  159. package/resources/templates/template-workspace/admin/lib/ui/button.tsx +29 -0
  160. package/resources/templates/template-workspace/admin/lib/ui/card.tsx +25 -0
  161. package/resources/templates/template-workspace/admin/lib/ui/dialog.tsx +51 -0
  162. package/resources/templates/template-workspace/admin/lib/ui/divider.tsx +11 -0
  163. package/resources/templates/template-workspace/admin/lib/ui/dropdown.tsx +108 -0
  164. package/resources/templates/template-workspace/admin/lib/ui/input.tsx +62 -0
  165. package/resources/templates/template-workspace/admin/lib/ui/label.tsx +7 -0
  166. package/resources/templates/template-workspace/admin/lib/ui/loader.tsx +30 -0
  167. package/resources/templates/template-workspace/admin/lib/ui/menu.tsx +103 -0
  168. package/resources/templates/template-workspace/admin/lib/ui/overlay.tsx +33 -0
  169. package/resources/templates/template-workspace/admin/lib/ui/popover.tsx +31 -0
  170. package/resources/templates/template-workspace/admin/lib/ui/progress.tsx +25 -0
  171. package/resources/templates/template-workspace/admin/lib/ui/scroll-area.tsx +45 -0
  172. package/resources/templates/template-workspace/admin/lib/ui/sheet.tsx +67 -0
  173. package/resources/templates/template-workspace/admin/lib/ui/sortable.tsx +13 -0
  174. package/resources/templates/template-workspace/admin/lib/ui/switch.tsx +10 -0
  175. package/resources/templates/template-workspace/admin/lib/ui/table.tsx +46 -0
  176. package/resources/templates/template-workspace/admin/lib/ui/textarea.tsx +18 -0
  177. package/resources/templates/template-workspace/admin/lib/ui/toggle-group.tsx +44 -0
  178. package/resources/templates/template-workspace/admin/lib/ui/toggle.tsx +29 -0
  179. package/resources/templates/template-workspace/admin/lib/ui/tooltip.tsx +24 -0
  180. package/resources/templates/template-workspace/admin/lib/upload/dropzone.tsx +21 -0
  181. package/resources/templates/template-workspace/admin/lib/upload/index.ts +3 -0
  182. package/resources/templates/template-workspace/admin/lib/upload/repeater.tsx +12 -0
  183. package/resources/templates/template-workspace/admin/lib/upload/ui.tsx +57 -0
  184. package/resources/templates/template-workspace/admin/lib/upload/upload-progress.tsx +130 -0
  185. package/resources/templates/template-workspace/admin/lib/upload/view.tsx +219 -0
  186. package/resources/templates/template-workspace/admin/lib/utils/cn.ts +4 -0
  187. package/resources/templates/template-workspace/admin/lib/utils/dict-format.tsx +3 -0
  188. package/resources/templates/template-workspace/admin/lib/utils/format-image-resize-url.ts +17 -0
  189. package/resources/templates/template-workspace/admin/lib/utils/formatting.ts +60 -0
  190. package/resources/templates/template-workspace/admin/lib/utils/index.ts +2 -0
  191. package/resources/templates/template-workspace/admin/lib/utils/uic.tsx +79 -0
  192. package/resources/templates/template-workspace/admin/package.json +63 -0
  193. package/resources/templates/template-workspace/admin/postcss.config.js +6 -0
  194. package/resources/templates/template-workspace/admin/public/favicon.png +0 -0
  195. package/resources/templates/template-workspace/admin/tailwind.config.js +73 -0
  196. package/resources/templates/template-workspace/admin/tsconfig.json +23 -0
  197. package/resources/templates/template-workspace/admin/vite-env.d.ts +7 -0
  198. package/resources/templates/template-workspace/admin/vite.config.ts +39 -0
  199. package/resources/templates/template-workspace/api/index.ts +7 -0
  200. package/resources/templates/template-workspace/api/migrations/.gitkeep +1 -0
  201. package/resources/templates/template-workspace/api/model/index.ts +1 -0
  202. package/resources/templates/template-workspace/api/package.json +16 -0
  203. package/resources/templates/template-workspace/api/tsconfig.json +10 -0
  204. package/resources/templates/template-workspace/biome.json +45 -0
  205. package/resources/templates/template-workspace/client/package.json +16 -0
  206. package/resources/templates/template-workspace/client/src/index.ts +1 -0
  207. package/resources/templates/template-workspace/client/tsconfig.json +9 -0
  208. package/resources/templates/template-workspace/contember.template.yaml +7 -0
  209. package/resources/templates/template-workspace/docker-compose.yaml +124 -0
  210. package/resources/templates/template-workspace/package.json +32 -0
  211. package/resources/templates/template-workspace/scripts/generate-client.sh +8 -0
  212. package/resources/templates/template-workspace/tsconfig.json +9 -0
  213. package/resources/templates/template-workspace/tsconfig.settings.json +15 -0
  214. package/src/commands/WorkspaceCreateCommand.ts +15 -6
  215. package/src/lib/FileSystem.ts +24 -0
  216. package/src/lib/PackageDownloader.ts +33 -0
  217. package/src/lib/TemplateInstaller.ts +102 -0
  218. package/src/lib/pathUtils.ts +4 -0
  219. package/src/run.ts +14 -5
  220. package/tsconfig.settings.json +5 -1
  221. package/types/download-tarball/index.d.ts +7 -0
  222. package/types/get-package-json-from-registry/index.d.ts +3 -0
  223. package/types/registry-info/index.d.ts +7 -0
@@ -0,0 +1,3 @@
1
+ export * from './forms'
2
+ export * from './listing'
3
+ export * from './otp'
@@ -0,0 +1,25 @@
1
+ import { ProjectMembersFilter } from '@contember/graphql-client-tenant'
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
+
7
+ const filter: ProjectMembersFilter = {
8
+ memberType: 'API_KEY',
9
+ }
10
+
11
+ export const ApiKeyList = (props: { controller?: { current?: MemberListController } }) => (
12
+ <MemberList
13
+ {...props}
14
+ filter={filter}
15
+ labels={{
16
+ deleteConfirmation: dict.tenant.apiKeyList.deleteConfirmation,
17
+ deleted: dict.tenant.apiKeyList.deleted,
18
+ deleteFailed: dict.tenant.apiKeyList.deleteFailed,
19
+ }}
20
+ tableHeaders={[dict.tenant.apiKeyList.description]}
21
+ tableColumns={it => <>
22
+ <TableCell key="description">{it.identity.description ?? dict.tenant.apiKeyList.unnamed}</TableCell>
23
+ </>}
24
+ />
25
+ )
@@ -0,0 +1,4 @@
1
+ export * from './api-key-list'
2
+ export * from './member-delete-dialog'
3
+ export * from './member-list'
4
+ export * from './person-list'
@@ -0,0 +1,38 @@
1
+ import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from '../../ui/alert-dialog'
2
+ import { Button } from '../../ui/button'
3
+ import { TrashIcon } from 'lucide-react'
4
+ import { dict } from '../../dict'
5
+ import * as React from 'react'
6
+ import { ReactNode } from 'react'
7
+ import { RemoveProjectMemberTrigger } from '@contember/interface'
8
+
9
+ export interface MemberDeleteProps {
10
+ title: ReactNode
11
+ identityId: string
12
+ projectSlug: string
13
+ onSuccess: () => void
14
+ onError: (e: unknown) => void
15
+ }
16
+
17
+ export const MemberDeleteDialog = ({ onError, title, identityId, onSuccess, projectSlug }: MemberDeleteProps) => {
18
+ return (
19
+ <AlertDialog>
20
+ <AlertDialogTrigger asChild>
21
+ <Button variant="destructive"><TrashIcon className="w-3 h-3" /></Button>
22
+ </AlertDialogTrigger>
23
+ <AlertDialogContent>
24
+ <AlertDialogHeader>
25
+ <AlertDialogTitle>{title}</AlertDialogTitle>
26
+ </AlertDialogHeader>
27
+ <AlertDialogFooter>
28
+ <AlertDialogCancel>{dict.tenant.memberDelete.cancel}</AlertDialogCancel>
29
+ <RemoveProjectMemberTrigger projectSlug={projectSlug} identityId={identityId} onSuccess={onSuccess} onError={onError}>
30
+ <AlertDialogAction asChild>
31
+ <Button variant={'destructive'}>{dict.tenant.memberDelete.confirm}</Button>
32
+ </AlertDialogAction>
33
+ </RemoveProjectMemberTrigger>
34
+ </AlertDialogFooter>
35
+ </AlertDialogContent>
36
+ </AlertDialog>
37
+ )
38
+ }
@@ -0,0 +1,147 @@
1
+ import { ProjectMembersFilter } from '@contember/graphql-client-tenant'
2
+ import * as React from 'react'
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'
7
+ import { ChevronLeftIcon, ChevronRightIcon, PencilIcon, RefreshCwIcon } from 'lucide-react'
8
+ import { ProjectMembersQueryResult, useProjectMembersQuery, useTenantQueryLoader } from '@contember/react-client-tenant'
9
+ import { useProjectSlug } from '@contember/react-client'
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 { UpdateProjectMemberFormFields } from '../forms'
16
+
17
+ const perPage = 20
18
+
19
+ export interface MemberListProps {
20
+ filter: ProjectMembersFilter
21
+ labels: {
22
+ deleteConfirmation: string
23
+ deleted: string
24
+ deleteFailed: string
25
+ }
26
+ tableColumns: (it: ProjectMembersQueryResult[number]) => ReactNode
27
+ tableHeaders: string[]
28
+ controller?: { current?: MemberListController }
29
+ }
30
+
31
+ export interface MemberListController {
32
+ refresh: () => void
33
+ }
34
+
35
+ export const MemberList = ({ filter, labels, tableColumns, controller, tableHeaders }: MemberListProps) => {
36
+ const projectSlug = useProjectSlug()!
37
+ const [page, setPage] = useState(0)
38
+
39
+ const [query, { refresh }] = useTenantQueryLoader(useProjectMembersQuery(), {
40
+ projectSlug: projectSlug,
41
+ filter: filter,
42
+ offset: page * perPage,
43
+ limit: perPage + 1,
44
+ })
45
+ if (controller) {
46
+ controller.current = { refresh }
47
+ }
48
+ const showToast = useShowToast()
49
+
50
+ const onDeleteMember = () => {
51
+ refresh()
52
+ showToast(<ToastContent>{labels.deleted}</ToastContent>, { type: 'success' })
53
+ }
54
+ const onDeleteError = () => {
55
+ showToast(<ToastContent>{labels.deleteFailed}</ToastContent>, { type: 'error' })
56
+ }
57
+
58
+ switch (query.state) {
59
+ case 'error':
60
+ return <div className="text-destructive italic">{dict.tenant.memberList.failedToLoadData}</div>
61
+ case 'loading':
62
+ case 'refreshing':
63
+ case 'success':
64
+ return (
65
+ <div className="relative">
66
+ {query.state !== 'success' && <Loader position="absolute" />}
67
+ <Table>
68
+ <TableHeader>
69
+ <TableRow>
70
+ {tableHeaders.map(it => <TableHead key={it}>{it}</TableHead>)}
71
+ <TableHead>{dict.tenant.memberList.roles}</TableHead>
72
+ <TableHead className="w-32">
73
+ <div className="flex gap-2 items-center">
74
+ <span>
75
+ {dict.tenant.memberList.action}
76
+ </span>
77
+ <Button variant="outline" onClick={refresh} className="ml-auto" size="sm"><RefreshCwIcon className="w-3 h-3" /></Button>
78
+ </div>
79
+ </TableHead>
80
+ </TableRow>
81
+ </TableHeader>
82
+ {'data' in query && query.data.length === 0 &&
83
+ <TableRow>
84
+ <TableCell colSpan={tableHeaders.length + 2}>
85
+ {dict.tenant.memberList.noResults}
86
+ </TableCell>
87
+ </TableRow>}
88
+ {'data' in query && query.data.slice(0, perPage).map(it => (
89
+ <TableRow key={it.identity.id}>
90
+ {tableColumns(it)}
91
+ <TableCell key="role">{it.memberships.map((m: any) => m.role).join(', ')}</TableCell>
92
+ <TableCell className="space-x-2 whitespace-nowrap">
93
+ <MemberDeleteDialog
94
+ identityId={it.identity.id}
95
+ projectSlug={projectSlug}
96
+ onSuccess={onDeleteMember}
97
+ onError={onDeleteError}
98
+ title={labels.deleteConfirmation}
99
+ />
100
+ <EditMembershipDialog projectSlug={projectSlug} identityId={it.identity.id} onSuccess={refresh} />
101
+
102
+ </TableCell>
103
+ </TableRow>
104
+ ))}
105
+ </Table>
106
+ <div className="flex gap-2 mt-4 justify-between">
107
+ <Button variant="outline" disabled={page === 0} onClick={() => setPage(page - 1)}>
108
+ <ChevronLeftIcon className="w-4 h-4" />
109
+ <span className="sr-only">{dict.tenant.memberList.previous}</span>
110
+ </Button>
111
+ <Button variant="outline" disabled={'data' in query && query.data.length <= perPage} onClick={() => setPage(page + 1)}>
112
+ <ChevronRightIcon className="w-4 h-4" />
113
+ <span className="sr-only">{dict.tenant.memberList.next}</span>
114
+ </Button>
115
+ </div>
116
+ </div>
117
+ )
118
+ }
119
+ }
120
+
121
+ const EditMembershipDialog = ({ projectSlug, identityId, onSuccess }: { projectSlug: string, identityId: string, onSuccess: () => void }) => {
122
+
123
+ const showToast = useShowToast()
124
+ const [open, setOpen] = useState(false)
125
+ return (
126
+ <Dialog open={open} onOpenChange={setOpen}>
127
+ <DialogTrigger asChild>
128
+ <Button variant="outline"><PencilIcon className="w-3 h-3" /></Button>
129
+ </DialogTrigger>
130
+ <DialogContent>
131
+ <UpdateProjectMemberForm
132
+ projectSlug={projectSlug}
133
+ identityId={identityId}
134
+ onSuccess={args => {
135
+ showToast(<ToastContent>{dict.tenant.updateProjectMember.updateSuccess}</ToastContent>)
136
+ setOpen(false)
137
+ onSuccess()
138
+ }}
139
+ >
140
+ <form className="grid gap-4">
141
+ <UpdateProjectMemberFormFields projectSlug={projectSlug} />
142
+ </form>
143
+ </UpdateProjectMemberForm>
144
+ </DialogContent>
145
+ </Dialog>
146
+ )
147
+ }
@@ -0,0 +1,25 @@
1
+ import { ProjectMembersFilter } from '@contember/graphql-client-tenant'
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
+
7
+ const filter: ProjectMembersFilter = {
8
+ memberType: 'PERSON',
9
+ }
10
+ export const PersonList = (props: { controller?: { current?: MemberListController } }) => (
11
+ <MemberList
12
+ {...props}
13
+ filter={filter}
14
+ labels={{
15
+ deleteConfirmation: dict.tenant.personList.deleteConfirmation,
16
+ deleted: dict.tenant.personList.deleted,
17
+ deleteFailed: dict.tenant.personList.deleteFailed,
18
+ }}
19
+ tableHeaders={[dict.tenant.personList.email, dict.tenant.personList.name]}
20
+ tableColumns={it => <>
21
+ <TableCell key="email">{it.identity.person?.email ?? dict.tenant.personList.noEmail}</TableCell>
22
+ <TableCell key="name">{it.identity.person?.name ?? dict.tenant.personList.noName}</TableCell>
23
+ </>}
24
+ />
25
+ )
@@ -0,0 +1 @@
1
+ export * from './otp-setup'
@@ -0,0 +1,146 @@
1
+ import { useMemo, useState } from 'react'
2
+ import qrcode from 'qrcode-generator'
3
+ import { DisableOtpTrigger, OtpConfirmForm, OtpPrepareForm, useIdentity, useOtpConfirmForm, useOtpPrepareForm } from '@contember/interface'
4
+ import { Loader } from '../../ui/loader'
5
+ import { Button } from '../../ui/button'
6
+ import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from '../../ui/alert-dialog'
7
+ import { TenantFormError, TenantFormField } from '../forms/common'
8
+ import { ToastContent, useShowToast } from '../../toast'
9
+ import { dict } from '../../dict'
10
+
11
+ export const OtpSetup = () => {
12
+ const identity = useIdentity()
13
+ const showToast = useShowToast()
14
+ const [initializingOtp, setInitializingOtp] = useState(false)
15
+ const [otpUri, setOtpUri] = useState<string>()
16
+
17
+ const person = identity?.person
18
+
19
+ if (!person) {
20
+ return null
21
+ }
22
+
23
+ if (initializingOtp) {
24
+ return (
25
+ <OtpPrepareForm
26
+ onSuccess={({ result: { otpUri } }) => {
27
+ setInitializingOtp(false)
28
+ setOtpUri(otpUri)
29
+ }}
30
+ >
31
+ <form>
32
+ {person.otpEnabled && <>
33
+ <div className="border-destructive border p-4 mb-4 rounded">
34
+ {dict.tenant.otpSetup.alreadyHaveOtp}
35
+ </div>
36
+ </>}
37
+ <OtpPrepareFormFields />
38
+ </form>
39
+ </OtpPrepareForm>
40
+ )
41
+ }
42
+ 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
+ </>
59
+ }
60
+
61
+ if (person.otpEnabled) {
62
+ return <>
63
+ <p>
64
+ {dict.tenant.otpSetup.twoFactorEnabled}
65
+ </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>
91
+ </>
92
+ }
93
+ return <>
94
+ <p>
95
+ {dict.tenant.otpSetup.description}
96
+ </p>
97
+ <Button onClick={() => setInitializingOtp(true)}>{dict.tenant.otpSetup.setupTwoFactor}</Button>
98
+ </>
99
+ }
100
+
101
+ const QrCode = ({ data }: { data: string }) => {
102
+ const code = useMemo(() => {
103
+ const qr = qrcode(0, 'L')
104
+ qr.addData(data)
105
+ qr.make()
106
+ return qr.createDataURL(4)
107
+ }, [data])
108
+ return <img src={code} />
109
+ }
110
+
111
+ export const OtpConfirmFormFields = () => {
112
+ const form = useOtpConfirmForm()
113
+ return (
114
+ <div className="relative flex flex-col gap-2">
115
+ {form.state === 'success' || form.state === 'submitting' ? <Loader position="absolute" /> : null}
116
+ <TenantFormError form={form} messages={dict.tenant.otpSetup.otpConfirmFormErrorMessages} />
117
+ <TenantFormField
118
+ form={form} messages={dict.tenant.otpSetup.otpConfirmFormErrorMessages} field="otpToken"
119
+ type="text" required
120
+ >
121
+ {dict.tenant.otpSetup.otpToken}
122
+ </TenantFormField>
123
+ <Button type="submit" className="w-full" disabled={form.state === 'submitting'}>
124
+ {dict.tenant.otpSetup.confirm}
125
+ </Button>
126
+ </div>
127
+ )
128
+ }
129
+ export const OtpPrepareFormFields = () => {
130
+ const form = useOtpPrepareForm()
131
+ return (
132
+ <div className="relative flex flex-col gap-2">
133
+ {form.state === 'success' || form.state === 'submitting' ? <Loader position="absolute" /> : null}
134
+ <TenantFormError form={form} messages={dict.tenant.otpSetup.otpPrepareFormErrorMessages} />
135
+ <TenantFormField
136
+ form={form} messages={dict.tenant.otpSetup.otpPrepareFormErrorMessages} field="label"
137
+ type="text"
138
+ >
139
+ {dict.tenant.otpSetup.label}
140
+ </TenantFormField>
141
+ <Button type="submit" className="w-full" disabled={form.state === 'submitting'}>
142
+ {dict.tenant.otpSetup.prepareContinue}
143
+ </Button>
144
+ </div>
145
+ )
146
+ }
@@ -0,0 +1,2 @@
1
+ export * from './toaster'
2
+ export * from './toast'
@@ -0,0 +1,112 @@
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
+ <div className="flex flex-col gap-1 flex-1 p-6 pr-8">
19
+ {title && <ToastTitle>{title}</ToastTitle>}
20
+ {children && <ToastDescription>{children}</ToastDescription>}
21
+ {details ? (
22
+ open ? (
23
+ <code className="p-1 bg-gray-50 border rounded font-mono text-xs">{details}</code>
24
+ ) : (
25
+ <div>
26
+ <button onClick={() => setOpen(true)} className="text-sm text-gray-400 underline">{dict.toast.showDetails}</button>
27
+ </div>
28
+ )
29
+ ) : null}
30
+ </div>
31
+ {action}
32
+ </>
33
+ }
34
+ export const ToastAction = uic(ToastPrimitives.Action, {
35
+ baseClass: 'inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none 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',
36
+ displayName: 'ToastAction',
37
+ })
38
+
39
+
40
+ export const ToastTitle = uic(ToastPrimitives.Title, {
41
+ baseClass: 'text-sm font-semibold',
42
+ displayName: 'ToastTitle',
43
+ })
44
+
45
+ export const ToastDescription = uic(ToastPrimitives.Description, {
46
+ baseClass: 'text-sm opacity-90',
47
+ displayName: 'ToastDescription',
48
+ })
49
+
50
+ export const Toast = uic(ToastPrimitives.Root, {
51
+ baseClass: '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 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',
52
+ variants: {
53
+ variant: {
54
+ info: 'border-l-blue-500',
55
+ error: 'border-l-destructive',
56
+ warning: 'border-l-orange-500',
57
+ success: 'border-l-green-500',
58
+ },
59
+ },
60
+ defaultVariants: {
61
+ variant: 'info',
62
+ },
63
+ displayName: 'Toast',
64
+ defaultProps: {
65
+ style: {
66
+ userSelect: 'auto',
67
+ },
68
+ },
69
+ })
70
+
71
+ const ToastClose = uic(ToastPrimitives.Close, {
72
+ baseClass: 'absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none 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',
73
+ displayName: 'ToastClose',
74
+ beforeChildren: <X className="h-4 w-4" />,
75
+ })
76
+
77
+
78
+ const ToastViewport = uic(ToastPrimitives.Viewport, {
79
+ 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]',
80
+ displayName: 'ToastViewport',
81
+ })
82
+
83
+
84
+ export function Toaster({ children }: {
85
+ children: ReactNode
86
+ }) {
87
+ return (
88
+ <ToasterProvider>
89
+ <ToastPrimitives.Provider duration={Infinity}>
90
+ {children}
91
+ <ToastList />
92
+ <ToastViewport />
93
+ </ToastPrimitives.Provider>
94
+ </ToasterProvider>
95
+ )
96
+ }
97
+
98
+ const ToastList = () => {
99
+ const toasts = useToasts()
100
+
101
+ return (
102
+ <>
103
+ {toasts.map(({ id, content, type }) => (
104
+ <Toast key={id} variant={type}>
105
+ {content}
106
+ <ToastClose />
107
+ </Toast>
108
+ ))}
109
+ </>
110
+ )
111
+ }
112
+
@@ -0,0 +1,104 @@
1
+ import { createRequiredContext } from '@contember/react-utils'
2
+ import { ReactNode, useCallback, useMemo, useState } from 'react'
3
+
4
+ export type ToastType = 'success' | 'error' | 'warning' | 'info'
5
+
6
+ const TIMEOUT_BY_TYPE: {
7
+ [K in ToastType]: number
8
+ } = {
9
+ error: 60000,
10
+ warning: 15000,
11
+ info: 6000,
12
+ success: 6000,
13
+ }
14
+
15
+ export interface ToastData {
16
+ id: number
17
+ type: ToastType
18
+ content: ReactNode
19
+ }
20
+
21
+ export interface ToasterState {
22
+ toasts: ToastData[]
23
+ }
24
+
25
+ export interface ToasterMethods {
26
+ showToast(content: ReactNode, options?: ToastOptions): ToastMethods
27
+ clear(): void
28
+ }
29
+
30
+ export interface ToastOptions {
31
+ dismiss?: number
32
+ type?: ToastType
33
+ }
34
+
35
+ export interface ToastMethods {
36
+ dismiss(): void
37
+ updateContent(content: ReactNode): void
38
+ }
39
+
40
+ export const [ToasterStateContext, useToasterState] = createRequiredContext<ToasterState>('ToasterStateContext')
41
+ export const [ToasterMethodsContext, useToasterMethods] = createRequiredContext<ToasterMethods>('ToasterMethodsContext')
42
+
43
+ export const useToasts = () => {
44
+ const state = useToasterState()
45
+ return state.toasts
46
+ }
47
+ export const useShowToast = () => {
48
+ const methods = useToasterMethods()
49
+ return methods.showToast
50
+ }
51
+
52
+ const genId = (() => {
53
+ let id = 0
54
+ return () => ++id
55
+ })()
56
+
57
+ export const ToasterProvider = ({ children }: {
58
+ children: ReactNode
59
+ }) => {
60
+ const [toasts, setToasts] = useState<ToastData[]>([])
61
+
62
+ const showToast = useCallback((content: ReactNode, options?: ToastOptions): ToastMethods => {
63
+ const id = genId()
64
+ const type = options?.type ?? 'info'
65
+ const toast: ToastData = {
66
+ id,
67
+ type,
68
+ content,
69
+ }
70
+ setToasts(toasts => [...toasts, toast])
71
+ const dismissMs = options?.dismiss ?? TIMEOUT_BY_TYPE[type]
72
+
73
+ const dismiss = () => {
74
+ setToasts(toasts => toasts.filter(t => t.id !== id))
75
+ }
76
+
77
+ if (dismissMs > 0) {
78
+ setTimeout(dismiss, dismissMs)
79
+ }
80
+
81
+
82
+ return {
83
+ dismiss,
84
+ updateContent: content => {
85
+ setToasts(toasts => toasts.map(t => (t.id === id ? { ...t, content } : t)))
86
+ },
87
+ }
88
+ }, [])
89
+
90
+ const clear = useCallback(() => {
91
+ setToasts([])
92
+ }, [])
93
+
94
+ const methods = useMemo<ToasterMethods>(() => ({ showToast, clear }), [showToast, clear])
95
+ const state = useMemo<ToasterState>(() => ({ toasts }), [toasts])
96
+
97
+ return (
98
+ <ToasterStateContext.Provider value={state}>
99
+ <ToasterMethodsContext.Provider value={methods}>
100
+ {children}
101
+ </ToasterMethodsContext.Provider>
102
+ </ToasterStateContext.Provider>
103
+ )
104
+ }
@@ -0,0 +1,59 @@
1
+ import * as React from 'react'
2
+ import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog'
3
+ import { buttonConfig } from './button'
4
+ import { uic } from '../utils'
5
+
6
+
7
+ export const AlertDialog = AlertDialogPrimitive.Root
8
+
9
+ export const AlertDialogTrigger = AlertDialogPrimitive.Trigger
10
+
11
+ export const AlertDialogPortal = AlertDialogPrimitive.Portal
12
+
13
+ export const AlertDialogOverlay = uic(AlertDialogPrimitive.Overlay, {
14
+ 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',
15
+ displayName: 'AlertDialogOverlay',
16
+ })
17
+
18
+ export const AlertDialogContent = uic(AlertDialogPrimitive.Content, {
19
+ 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',
20
+ wrapOuter: props => {
21
+ return (
22
+ <AlertDialogPortal>
23
+ <AlertDialogOverlay />
24
+ {props.children}
25
+ </AlertDialogPortal>
26
+ )
27
+ },
28
+ displayName: 'AlertDialogContent',
29
+ })
30
+
31
+ export const AlertDialogHeader = uic('div', {
32
+ baseClass: 'flex flex-col space-y-2 text-center sm:text-left',
33
+ displayName: 'AlertDialogHeader',
34
+ })
35
+
36
+ export const AlertDialogFooter = uic('div', {
37
+ baseClass: 'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
38
+ displayName: 'AlertDialogFooter',
39
+ })
40
+
41
+ export const AlertDialogTitle = uic(AlertDialogPrimitive.Title, {
42
+ baseClass: 'text-lg font-semibold',
43
+ displayName: 'AlertDialogTitle',
44
+ })
45
+
46
+
47
+ export const AlertDialogDescription = uic(AlertDialogPrimitive.Description, {
48
+ baseClass: 'text-sm text-muted-foreground',
49
+ displayName: 'AlertDialogDescription',
50
+ })
51
+
52
+ export const AlertDialogAction = uic(AlertDialogPrimitive.Action, buttonConfig)
53
+ export const AlertDialogCancel = uic(AlertDialogPrimitive.Cancel, {
54
+ ...buttonConfig,
55
+ defaultVariants: {
56
+ variant: 'outline',
57
+ size: 'default',
58
+ },
59
+ })