@questpie/admin 3.2.3 → 3.2.5

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 (244) hide show
  1. package/dist/client/blocks/block-renderer.d.mts +2 -2
  2. package/dist/client/blocks/block-renderer.mjs +164 -339
  3. package/dist/client/components/actions/action-button.mjs +9 -9
  4. package/dist/client/components/actions/action-dialog.mjs +195 -493
  5. package/dist/client/components/actions/confirmation-dialog.mjs +44 -159
  6. package/dist/client/components/actions/header-actions.mjs +73 -165
  7. package/dist/client/components/admin-link.d.mts +2 -2
  8. package/dist/client/components/admin-link.mjs +40 -126
  9. package/dist/client/components/auth/auth-loading.mjs +9 -44
  10. package/dist/client/components/blocks/block-canvas.mjs +31 -95
  11. package/dist/client/components/blocks/block-editor-context.mjs +13 -57
  12. package/dist/client/components/blocks/block-editor-layout.mjs +72 -166
  13. package/dist/client/components/blocks/block-editor-provider.mjs +184 -245
  14. package/dist/client/components/blocks/block-fields-renderer.mjs +54 -229
  15. package/dist/client/components/blocks/block-insert-button.mjs +49 -165
  16. package/dist/client/components/blocks/block-item-menu.mjs +102 -301
  17. package/dist/client/components/blocks/block-item.mjs +136 -370
  18. package/dist/client/components/blocks/block-library-sidebar.mjs +106 -220
  19. package/dist/client/components/blocks/block-tree.mjs +12 -68
  20. package/dist/client/components/blocks/block-type-icon.mjs +14 -56
  21. package/dist/client/components/brand-logo.mjs +35 -149
  22. package/dist/client/components/component-renderer.mjs +42 -118
  23. package/dist/client/components/error-boundary.mjs +14 -58
  24. package/dist/client/components/fields/array-field.mjs +209 -521
  25. package/dist/client/components/fields/asset-preview-field.mjs +41 -141
  26. package/dist/client/components/fields/blocks-field/blocks-field.mjs +60 -156
  27. package/dist/client/components/fields/boolean-field.mjs +29 -59
  28. package/dist/client/components/fields/date-field.mjs +7 -37
  29. package/dist/client/components/fields/datetime-field.mjs +7 -38
  30. package/dist/client/components/fields/email-field.mjs +25 -54
  31. package/dist/client/components/fields/field-wrapper.mjs +30 -105
  32. package/dist/client/components/fields/json-field.mjs +107 -313
  33. package/dist/client/components/fields/locale-badge.mjs +6 -15
  34. package/dist/client/components/fields/number-field.mjs +27 -60
  35. package/dist/client/components/fields/object-array-field.mjs +283 -659
  36. package/dist/client/components/fields/object-field.mjs +165 -633
  37. package/dist/client/components/fields/relation/displays/cards-display.mjs +106 -220
  38. package/dist/client/components/fields/relation/displays/chips-display.mjs +78 -150
  39. package/dist/client/components/fields/relation/displays/grid-display.mjs +92 -186
  40. package/dist/client/components/fields/relation/displays/list-display.mjs +122 -239
  41. package/dist/client/components/fields/relation/displays/table-display.mjs +70 -244
  42. package/dist/client/components/fields/relation/relation-items-display.mjs +30 -126
  43. package/dist/client/components/fields/relation-field.mjs +10 -66
  44. package/dist/client/components/fields/relation-picker.mjs +18 -18
  45. package/dist/client/components/fields/relation-select.mjs +12 -12
  46. package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +80 -182
  47. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +8 -19
  48. package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
  49. package/dist/client/components/fields/rich-text-editor/index.mjs +196 -530
  50. package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +61 -111
  51. package/dist/client/components/fields/rich-text-editor/table-controls.mjs +105 -415
  52. package/dist/client/components/fields/rich-text-editor/toolbar.mjs +256 -511
  53. package/dist/client/components/fields/rich-text-field.mjs +14 -53
  54. package/dist/client/components/fields/select-field.mjs +39 -74
  55. package/dist/client/components/fields/text-field.mjs +26 -59
  56. package/dist/client/components/fields/textarea-field.mjs +26 -58
  57. package/dist/client/components/fields/time-field.mjs +7 -35
  58. package/dist/client/components/fields/upload-field.mjs +47 -165
  59. package/dist/client/components/filter-builder/columns-tab.mjs +80 -280
  60. package/dist/client/components/filter-builder/filter-builder-sheet.mjs +197 -540
  61. package/dist/client/components/filter-builder/filters-tab.mjs +96 -386
  62. package/dist/client/components/filter-builder/saved-views-tab.mjs +133 -351
  63. package/dist/client/components/history-sidebar.mjs +306 -611
  64. package/dist/client/components/layout/field-layout-renderer.mjs +106 -254
  65. package/dist/client/components/locale-switcher.mjs +106 -228
  66. package/dist/client/components/media/media-grid.mjs +84 -273
  67. package/dist/client/components/media/media-picker-dialog.mjs +177 -494
  68. package/dist/client/components/preview/live-preview-mode.mjs +240 -438
  69. package/dist/client/components/preview/preview-pane.mjs +22 -22
  70. package/dist/client/components/primitives/asset-preview.mjs +290 -666
  71. package/dist/client/components/primitives/checkbox-input.mjs +9 -35
  72. package/dist/client/components/primitives/date-input.mjs +109 -327
  73. package/dist/client/components/primitives/dropzone.mjs +209 -336
  74. package/dist/client/components/primitives/field-select-control.mjs +12 -80
  75. package/dist/client/components/primitives/number-input.mjs +4 -4
  76. package/dist/client/components/primitives/select-multi.mjs +200 -559
  77. package/dist/client/components/primitives/select-single.mjs +165 -499
  78. package/dist/client/components/primitives/time-input.mjs +43 -117
  79. package/dist/client/components/primitives/toggle-input.mjs +9 -29
  80. package/dist/client/components/sheets/resource-sheet.mjs +61 -70
  81. package/dist/client/components/ui/accordion.mjs +35 -155
  82. package/dist/client/components/ui/alert.mjs +13 -68
  83. package/dist/client/components/ui/badge.mjs +9 -51
  84. package/dist/client/components/ui/button.mjs +8 -54
  85. package/dist/client/components/ui/card.mjs +37 -193
  86. package/dist/client/components/ui/checkbox.mjs +12 -68
  87. package/dist/client/components/ui/command.mjs +48 -219
  88. package/dist/client/components/ui/dialog.mjs +50 -262
  89. package/dist/client/components/ui/drawer.mjs +55 -259
  90. package/dist/client/components/ui/dropdown-menu.mjs +86 -427
  91. package/dist/client/components/ui/empty-state.mjs +28 -98
  92. package/dist/client/components/ui/field.mjs +73 -309
  93. package/dist/client/components/ui/input-group.mjs +42 -167
  94. package/dist/client/components/ui/input.mjs +7 -37
  95. package/dist/client/components/ui/kbd.mjs +6 -36
  96. package/dist/client/components/ui/label.mjs +7 -37
  97. package/dist/client/components/ui/popover.mjs +34 -169
  98. package/dist/client/components/ui/responsive-dialog.mjs +67 -273
  99. package/dist/client/components/ui/scroll-fade.mjs +63 -158
  100. package/dist/client/components/ui/search-input.mjs +33 -100
  101. package/dist/client/components/ui/select.mjs +72 -393
  102. package/dist/client/components/ui/separator.mjs +7 -38
  103. package/dist/client/components/ui/sheet.mjs +49 -269
  104. package/dist/client/components/ui/sidebar.mjs +171 -690
  105. package/dist/client/components/ui/skeleton.mjs +7 -38
  106. package/dist/client/components/ui/sonner.mjs +11 -42
  107. package/dist/client/components/ui/switch.mjs +9 -45
  108. package/dist/client/components/ui/table.mjs +48 -266
  109. package/dist/client/components/ui/tabs.mjs +26 -139
  110. package/dist/client/components/ui/textarea.mjs +6 -32
  111. package/dist/client/components/ui/tooltip.mjs +27 -129
  112. package/dist/client/components/widgets/chart-widget.mjs +174 -522
  113. package/dist/client/components/widgets/progress-widget.mjs +66 -172
  114. package/dist/client/components/widgets/quick-actions-widget.mjs +102 -261
  115. package/dist/client/components/widgets/recent-items-widget.mjs +69 -195
  116. package/dist/client/components/widgets/stats-widget.mjs +41 -175
  117. package/dist/client/components/widgets/table-widget.mjs +9 -9
  118. package/dist/client/components/widgets/timeline-widget.mjs +86 -226
  119. package/dist/client/components/widgets/value-widget.mjs +74 -381
  120. package/dist/client/components/widgets/widget-empty-state.mjs +26 -76
  121. package/dist/client/components/widgets/widget-skeletons.mjs +138 -421
  122. package/dist/client/contexts/focus-context.d.mts +4 -0
  123. package/dist/client/contexts/focus-context.mjs +87 -150
  124. package/dist/client/hooks/typed-hooks.mjs +241 -701
  125. package/dist/client/hooks/use-action.mjs +62 -198
  126. package/dist/client/hooks/use-admin-config.mjs +5 -35
  127. package/dist/client/hooks/use-admin-preferences.mjs +16 -88
  128. package/dist/client/hooks/use-admin-routes.mjs +22 -56
  129. package/dist/client/hooks/use-audit-history.mjs +21 -69
  130. package/dist/client/hooks/use-brand.mjs +1 -9
  131. package/dist/client/hooks/use-collection-fields.mjs +17 -57
  132. package/dist/client/hooks/use-collection-meta.mjs +12 -44
  133. package/dist/client/hooks/use-collection-schema.mjs +10 -33
  134. package/dist/client/hooks/use-collection-validation.mjs +23 -53
  135. package/dist/client/hooks/use-collection.mjs +194 -614
  136. package/dist/client/hooks/use-current-user.mjs +0 -1
  137. package/dist/client/hooks/use-field-hooks.mjs +10 -10
  138. package/dist/client/hooks/use-field-options.mjs +61 -202
  139. package/dist/client/hooks/use-global-fields.mjs +14 -46
  140. package/dist/client/hooks/use-global-meta.mjs +9 -30
  141. package/dist/client/hooks/use-global-schema.mjs +9 -30
  142. package/dist/client/hooks/use-global.mjs +63 -219
  143. package/dist/client/hooks/use-locks.mjs +117 -325
  144. package/dist/client/hooks/use-media-query.mjs +16 -36
  145. package/dist/client/hooks/use-prefill-params.mjs +0 -1
  146. package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
  147. package/dist/client/hooks/use-reactive-fields.mjs +1 -1
  148. package/dist/client/hooks/use-reactive-prop.mjs +65 -223
  149. package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
  150. package/dist/client/hooks/use-saved-views.mjs +22 -103
  151. package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
  152. package/dist/client/hooks/use-search.mjs +31 -143
  153. package/dist/client/hooks/use-server-actions.mjs +18 -50
  154. package/dist/client/hooks/use-server-validation.mjs +72 -166
  155. package/dist/client/hooks/use-server-widget-data.mjs +7 -33
  156. package/dist/client/hooks/use-setup-status.mjs +12 -25
  157. package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
  158. package/dist/client/hooks/use-transition-stage.mjs +8 -38
  159. package/dist/client/hooks/use-upload.mjs +54 -152
  160. package/dist/client/hooks/use-validation-error-map.mjs +6 -26
  161. package/dist/client/hooks/use-view-state.mjs +187 -437
  162. package/dist/client/i18n/hooks.mjs +65 -197
  163. package/dist/client/lib/render-profiler.mjs +14 -41
  164. package/dist/client/preview/block-scope-context.d.mts +2 -2
  165. package/dist/client/preview/block-scope-context.mjs +14 -36
  166. package/dist/client/preview/diff.mjs +110 -0
  167. package/dist/client/preview/preview-banner.mjs +42 -108
  168. package/dist/client/preview/preview-field.d.mts +4 -4
  169. package/dist/client/preview/preview-field.mjs +166 -409
  170. package/dist/client/preview/use-collection-preview.mjs +135 -201
  171. package/dist/client/runtime/content-locales-provider.mjs +31 -83
  172. package/dist/client/runtime/locale-scope.mjs +22 -63
  173. package/dist/client/runtime/provider.mjs +100 -255
  174. package/dist/client/runtime/translations-provider.mjs +41 -107
  175. package/dist/client/scope/picker.d.mts +2 -2
  176. package/dist/client/scope/picker.mjs +86 -321
  177. package/dist/client/scope/provider.d.mts +2 -2
  178. package/dist/client/scope/provider.mjs +8 -17
  179. package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
  180. package/dist/client/views/auth/accept-invite-form.mjs +121 -412
  181. package/dist/client/views/auth/auth-layout.d.mts +3 -3
  182. package/dist/client/views/auth/auth-layout.mjs +104 -284
  183. package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
  184. package/dist/client/views/auth/forgot-password-form.mjs +94 -325
  185. package/dist/client/views/auth/invite-form.mjs +107 -442
  186. package/dist/client/views/auth/login-form.d.mts +2 -2
  187. package/dist/client/views/auth/login-form.mjs +116 -337
  188. package/dist/client/views/auth/reset-password-form.mjs +128 -453
  189. package/dist/client/views/auth/setup-form.mjs +140 -478
  190. package/dist/client/views/collection/auto-form-fields.mjs +243 -615
  191. package/dist/client/views/collection/bulk-action-toolbar.mjs +212 -400
  192. package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
  193. package/dist/client/views/collection/cells/primitive-cells.mjs +109 -363
  194. package/dist/client/views/collection/cells/relation-cells.mjs +86 -233
  195. package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +142 -371
  196. package/dist/client/views/collection/cells/shared/relation-chip.mjs +35 -131
  197. package/dist/client/views/collection/cells/upload-cells.mjs +60 -177
  198. package/dist/client/views/collection/columns/build-columns.mjs +8 -48
  199. package/dist/client/views/collection/field-renderer.mjs +11 -24
  200. package/dist/client/views/collection/form-view.mjs +288 -560
  201. package/dist/client/views/collection/table-view.mjs +239 -469
  202. package/dist/client/views/collection/view-skeletons.mjs +112 -237
  203. package/dist/client/views/common/global-search.mjs +241 -543
  204. package/dist/client/views/dashboard/dashboard-grid.mjs +256 -775
  205. package/dist/client/views/dashboard/dashboard-widget.mjs +38 -126
  206. package/dist/client/views/dashboard/widget-card.mjs +61 -269
  207. package/dist/client/views/globals/global-form-view.mjs +478 -1298
  208. package/dist/client/views/layout/admin-layout-provider.mjs +28 -88
  209. package/dist/client/views/layout/admin-layout.mjs +83 -246
  210. package/dist/client/views/layout/admin-router.mjs +457 -1289
  211. package/dist/client/views/layout/admin-sidebar.mjs +510 -1292
  212. package/dist/client/views/layout/admin-theme.mjs +30 -64
  213. package/dist/client/views/layout/admin-view-layout.mjs +40 -144
  214. package/dist/client/views/pages/accept-invite-page.mjs +95 -290
  215. package/dist/client/views/pages/dashboard-page.mjs +11 -57
  216. package/dist/client/views/pages/forgot-password-page.mjs +31 -83
  217. package/dist/client/views/pages/invite-page.mjs +35 -90
  218. package/dist/client/views/pages/login-page.mjs +41 -121
  219. package/dist/client/views/pages/reset-password-page.d.mts +2 -2
  220. package/dist/client/views/pages/reset-password-page.mjs +46 -173
  221. package/dist/client/views/pages/setup-page.d.mts +2 -2
  222. package/dist/client/views/pages/setup-page.mjs +33 -95
  223. package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
  224. package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
  225. package/dist/server/modules/admin/collections/account.d.mts +50 -50
  226. package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
  227. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  228. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  229. package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
  230. package/dist/server/modules/admin/collections/assets.d.mts +34 -34
  231. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  232. package/dist/server/modules/admin/collections/user.d.mts +53 -53
  233. package/dist/server/modules/admin/collections/verification.d.mts +36 -36
  234. package/dist/server/modules/admin/index.d.mts +21 -20
  235. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  236. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  237. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  238. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  239. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  240. package/dist/server/modules/admin/routes/setup.d.mts +7 -7
  241. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  242. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  243. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +27 -27
  244. package/package.json +3 -5
@@ -6,7 +6,6 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from ".
6
6
  import { Textarea } from "../../components/ui/textarea.mjs";
7
7
  import { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel } from "../../components/ui/field.mjs";
8
8
  import { Alert, AlertDescription } from "../../components/ui/alert.mjs";
9
- import { c } from "react/compiler-runtime";
10
9
  import { Icon } from "@iconify/react";
11
10
  import "react";
12
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -48,449 +47,115 @@ import { useForm, useWatch } from "react-hook-form";
48
47
  * }
49
48
  * ```
50
49
  */
51
- function InviteForm(t0) {
52
- const $ = c(136);
53
- const { onSubmit, roles: rolesProp, defaultRole: t1, showMessage: t2, className, error, success } = t0;
54
- const defaultRole = t1 === void 0 ? "user" : t1;
55
- const showMessage = t2 === void 0 ? true : t2;
56
- let t3;
57
- if ($[0] !== defaultRole) {
58
- t3 = { defaultValues: {
59
- email: "",
60
- role: defaultRole,
61
- message: ""
62
- } };
63
- $[0] = defaultRole;
64
- $[1] = t3;
65
- } else t3 = $[1];
66
- const { register, handleSubmit, setValue, control, reset, formState: t4 } = useForm(t3);
67
- const { errors, isSubmitting } = t4;
68
- let t5;
69
- if ($[2] !== control) {
70
- t5 = {
71
- control,
72
- name: "role"
73
- };
74
- $[2] = control;
75
- $[3] = t5;
76
- } else t5 = $[3];
77
- const selectedRole = useWatch(t5);
50
+ function InviteForm({ onSubmit, roles: rolesProp, defaultRole = "user", showMessage = true, className, error, success }) {
51
+ const { register, handleSubmit, setValue, control, reset, formState: { errors, isSubmitting } } = useForm({ defaultValues: {
52
+ email: "",
53
+ role: defaultRole,
54
+ message: ""
55
+ } });
56
+ const selectedRole = useWatch({
57
+ control,
58
+ name: "role"
59
+ });
78
60
  const resolveText = useResolveText();
79
61
  const { t } = useTranslation();
80
- let T0;
81
- let T1;
82
- let T2;
83
- let T3;
84
- let T4;
85
- let T5;
86
- let roles;
87
- let t10;
88
- let t11;
89
- let t12;
90
- let t13;
91
- let t14;
92
- let t6;
93
- let t7;
94
- let t8;
95
- let t9;
96
- if ($[4] !== className || $[5] !== error || $[6] !== errors.email || $[7] !== errors.role || $[8] !== handleSubmit || $[9] !== onSubmit || $[10] !== register || $[11] !== reset || $[12] !== resolveText || $[13] !== rolesProp || $[14] !== selectedRole || $[15] !== setValue || $[16] !== t) {
97
- roles = rolesProp ?? [{
98
- value: "admin",
99
- label: t("defaults.users.fields.role.options.admin")
100
- }, {
101
- value: "user",
102
- label: t("defaults.users.fields.role.options.user")
103
- }];
104
- let t15$1;
105
- if ($[33] !== error || $[34] !== onSubmit || $[35] !== reset) {
106
- t15$1 = async (values) => {
107
- await onSubmit(values);
108
- if (!error) reset();
109
- };
110
- $[33] = error;
111
- $[34] = onSubmit;
112
- $[35] = reset;
113
- $[36] = t15$1;
114
- } else t15$1 = $[36];
115
- let t16$1;
116
- if ($[37] !== handleSubmit || $[38] !== t15$1) {
117
- t16$1 = handleSubmit(t15$1);
118
- $[37] = handleSubmit;
119
- $[38] = t15$1;
120
- $[39] = t16$1;
121
- } else t16$1 = $[39];
122
- t13 = t16$1;
123
- if ($[40] !== className) {
124
- t14 = cn("qa-invite-form space-y-4", className);
125
- $[40] = className;
126
- $[41] = t14;
127
- } else t14 = $[41];
128
- T5 = FieldGroup;
129
- const t17$1 = !!errors.email;
130
- let t18$1;
131
- if ($[42] !== t) {
132
- t18$1 = t("auth.inviteEmailLabel");
133
- $[42] = t;
134
- $[43] = t18$1;
135
- } else t18$1 = $[43];
136
- let t19$1;
137
- if ($[44] !== t18$1) {
138
- t19$1 = /* @__PURE__ */ jsx(FieldLabel, {
139
- htmlFor: "invite-email",
140
- children: t18$1
141
- });
142
- $[44] = t18$1;
143
- $[45] = t19$1;
144
- } else t19$1 = $[45];
145
- let t20$1;
146
- if ($[46] === Symbol.for("react.memo_cache_sentinel")) {
147
- t20$1 = /* @__PURE__ */ jsx(Icon, {
148
- icon: "ph:envelope-duotone",
149
- className: "text-muted-foreground absolute top-1/2 left-2 size-4 -translate-y-1/2"
150
- });
151
- $[46] = t20$1;
152
- } else t20$1 = $[46];
153
- const t21$1 = !!errors.email;
154
- let t22$1;
155
- if ($[47] !== register || $[48] !== t) {
156
- let t23$2;
157
- if ($[50] === Symbol.for("react.memo_cache_sentinel")) {
158
- t23$2 = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
159
- $[50] = t23$2;
160
- } else t23$2 = $[50];
161
- t22$1 = register("email", {
162
- required: t("auth.emailRequired"),
163
- pattern: {
164
- value: t23$2,
165
- message: t("auth.invalidEmail")
166
- }
167
- });
168
- $[47] = register;
169
- $[48] = t;
170
- $[49] = t22$1;
171
- } else t22$1 = $[49];
172
- let t23$1;
173
- if ($[51] !== t21$1 || $[52] !== t22$1) {
174
- t23$1 = /* @__PURE__ */ jsxs("div", {
175
- className: "relative",
176
- children: [t20$1, /* @__PURE__ */ jsx(Input, {
177
- id: "invite-email",
178
- type: "email",
179
- placeholder: "user@example.com",
180
- className: "pl-8",
181
- autoComplete: "email",
182
- "aria-invalid": t21$1,
183
- ...t22$1
184
- })]
185
- });
186
- $[51] = t21$1;
187
- $[52] = t22$1;
188
- $[53] = t23$1;
189
- } else t23$1 = $[53];
190
- let t24$1;
191
- if ($[54] !== t) {
192
- t24$1 = t("auth.inviteEmailDescription");
193
- $[54] = t;
194
- $[55] = t24$1;
195
- } else t24$1 = $[55];
196
- let t25$1;
197
- if ($[56] !== t24$1) {
198
- t25$1 = /* @__PURE__ */ jsx(FieldDescription, { children: t24$1 });
199
- $[56] = t24$1;
200
- $[57] = t25$1;
201
- } else t25$1 = $[57];
202
- const t26$1 = errors.email?.message;
203
- let t27$1;
204
- if ($[58] !== t26$1) {
205
- t27$1 = /* @__PURE__ */ jsx(FieldError, { children: t26$1 });
206
- $[58] = t26$1;
207
- $[59] = t27$1;
208
- } else t27$1 = $[59];
209
- let t28$1;
210
- if ($[60] !== t23$1 || $[61] !== t25$1 || $[62] !== t27$1) {
211
- t28$1 = /* @__PURE__ */ jsxs(FieldContent, { children: [
212
- t23$1,
213
- t25$1,
214
- t27$1
215
- ] });
216
- $[60] = t23$1;
217
- $[61] = t25$1;
218
- $[62] = t27$1;
219
- $[63] = t28$1;
220
- } else t28$1 = $[63];
221
- if ($[64] !== t17$1 || $[65] !== t19$1 || $[66] !== t28$1) {
222
- t12 = /* @__PURE__ */ jsxs(Field, {
223
- "data-invalid": t17$1,
224
- children: [t19$1, t28$1]
225
- });
226
- $[64] = t17$1;
227
- $[65] = t19$1;
228
- $[66] = t28$1;
229
- $[67] = t12;
230
- } else t12 = $[67];
231
- T4 = Field;
232
- t10 = !!errors.role;
233
- let t29$1;
234
- if ($[68] !== t) {
235
- t29$1 = t("auth.inviteRole");
236
- $[68] = t;
237
- $[69] = t29$1;
238
- } else t29$1 = $[69];
239
- if ($[70] !== t29$1) {
240
- t11 = /* @__PURE__ */ jsx(FieldLabel, {
241
- htmlFor: "invite-role",
242
- children: t29$1
243
- });
244
- $[70] = t29$1;
245
- $[71] = t11;
246
- } else t11 = $[71];
247
- T3 = FieldContent;
248
- T2 = Select;
249
- t8 = selectedRole;
250
- if ($[72] !== setValue) {
251
- t9 = (value) => value && setValue("role", value);
252
- $[72] = setValue;
253
- $[73] = t9;
254
- } else t9 = $[73];
255
- T1 = SelectTrigger;
256
- t7 = "invite-role";
257
- T0 = SelectValue;
258
- const selectedRoleLabel = roles.find((r) => r.value === selectedRole)?.label;
259
- t6 = selectedRoleLabel ? resolveText(selectedRoleLabel) : t("auth.inviteSelectRole");
260
- $[4] = className;
261
- $[5] = error;
262
- $[6] = errors.email;
263
- $[7] = errors.role;
264
- $[8] = handleSubmit;
265
- $[9] = onSubmit;
266
- $[10] = register;
267
- $[11] = reset;
268
- $[12] = resolveText;
269
- $[13] = rolesProp;
270
- $[14] = selectedRole;
271
- $[15] = setValue;
272
- $[16] = t;
273
- $[17] = T0;
274
- $[18] = T1;
275
- $[19] = T2;
276
- $[20] = T3;
277
- $[21] = T4;
278
- $[22] = T5;
279
- $[23] = roles;
280
- $[24] = t10;
281
- $[25] = t11;
282
- $[26] = t12;
283
- $[27] = t13;
284
- $[28] = t14;
285
- $[29] = t6;
286
- $[30] = t7;
287
- $[31] = t8;
288
- $[32] = t9;
289
- } else {
290
- T0 = $[17];
291
- T1 = $[18];
292
- T2 = $[19];
293
- T3 = $[20];
294
- T4 = $[21];
295
- T5 = $[22];
296
- roles = $[23];
297
- t10 = $[24];
298
- t11 = $[25];
299
- t12 = $[26];
300
- t13 = $[27];
301
- t14 = $[28];
302
- t6 = $[29];
303
- t7 = $[30];
304
- t8 = $[31];
305
- t9 = $[32];
306
- }
307
- const t15 = t6;
308
- let t16;
309
- if ($[74] !== T0 || $[75] !== t15) {
310
- t16 = /* @__PURE__ */ jsx(T0, { children: t15 });
311
- $[74] = T0;
312
- $[75] = t15;
313
- $[76] = t16;
314
- } else t16 = $[76];
315
- let t17;
316
- if ($[77] !== T1 || $[78] !== t16 || $[79] !== t7) {
317
- t17 = /* @__PURE__ */ jsx(T1, {
318
- id: t7,
319
- children: t16
320
- });
321
- $[77] = T1;
322
- $[78] = t16;
323
- $[79] = t7;
324
- $[80] = t17;
325
- } else t17 = $[80];
326
- let t18;
327
- if ($[81] !== resolveText || $[82] !== roles) {
328
- let t19$1;
329
- if ($[84] !== resolveText) {
330
- t19$1 = (role) => /* @__PURE__ */ jsx(SelectItem, {
331
- value: role.value,
332
- children: resolveText(role.label)
333
- }, role.value);
334
- $[84] = resolveText;
335
- $[85] = t19$1;
336
- } else t19$1 = $[85];
337
- t18 = roles.map(t19$1);
338
- $[81] = resolveText;
339
- $[82] = roles;
340
- $[83] = t18;
341
- } else t18 = $[83];
342
- let t19;
343
- if ($[86] !== t18) {
344
- t19 = /* @__PURE__ */ jsx(SelectContent, { children: t18 });
345
- $[86] = t18;
346
- $[87] = t19;
347
- } else t19 = $[87];
348
- let t20;
349
- if ($[88] !== T2 || $[89] !== t17 || $[90] !== t19 || $[91] !== t8 || $[92] !== t9) {
350
- t20 = /* @__PURE__ */ jsxs(T2, {
351
- value: t8,
352
- onValueChange: t9,
353
- children: [t17, t19]
354
- });
355
- $[88] = T2;
356
- $[89] = t17;
357
- $[90] = t19;
358
- $[91] = t8;
359
- $[92] = t9;
360
- $[93] = t20;
361
- } else t20 = $[93];
362
- let t21;
363
- if ($[94] !== t) {
364
- t21 = t("auth.inviteRoleDescription");
365
- $[94] = t;
366
- $[95] = t21;
367
- } else t21 = $[95];
368
- let t22;
369
- if ($[96] !== t21) {
370
- t22 = /* @__PURE__ */ jsx(FieldDescription, { children: t21 });
371
- $[96] = t21;
372
- $[97] = t22;
373
- } else t22 = $[97];
374
- const t23 = errors.role?.message;
375
- let t24;
376
- if ($[98] !== t23) {
377
- t24 = /* @__PURE__ */ jsx(FieldError, { children: t23 });
378
- $[98] = t23;
379
- $[99] = t24;
380
- } else t24 = $[99];
381
- let t25;
382
- if ($[100] !== T3 || $[101] !== t20 || $[102] !== t22 || $[103] !== t24) {
383
- t25 = /* @__PURE__ */ jsxs(T3, { children: [
384
- t20,
385
- t22,
386
- t24
387
- ] });
388
- $[100] = T3;
389
- $[101] = t20;
390
- $[102] = t22;
391
- $[103] = t24;
392
- $[104] = t25;
393
- } else t25 = $[104];
394
- let t26;
395
- if ($[105] !== T4 || $[106] !== t10 || $[107] !== t11 || $[108] !== t25) {
396
- t26 = /* @__PURE__ */ jsxs(T4, {
397
- "data-invalid": t10,
398
- children: [t11, t25]
399
- });
400
- $[105] = T4;
401
- $[106] = t10;
402
- $[107] = t11;
403
- $[108] = t25;
404
- $[109] = t26;
405
- } else t26 = $[109];
406
- let t27;
407
- if ($[110] !== register || $[111] !== showMessage || $[112] !== t) {
408
- t27 = showMessage && /* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, {
409
- htmlFor: "invite-message",
410
- children: t("auth.inviteMessage")
411
- }), /* @__PURE__ */ jsxs(FieldContent, { children: [/* @__PURE__ */ jsx(Textarea, {
412
- id: "invite-message",
413
- placeholder: t("auth.inviteMessagePlaceholder"),
414
- rows: 3,
415
- ...register("message")
416
- }), /* @__PURE__ */ jsx(FieldDescription, { children: t("auth.inviteMessageDescription") })] })] });
417
- $[110] = register;
418
- $[111] = showMessage;
419
- $[112] = t;
420
- $[113] = t27;
421
- } else t27 = $[113];
422
- let t28;
423
- if ($[114] !== T5 || $[115] !== t12 || $[116] !== t26 || $[117] !== t27) {
424
- t28 = /* @__PURE__ */ jsxs(T5, { children: [
425
- t12,
426
- t26,
427
- t27
428
- ] });
429
- $[114] = T5;
430
- $[115] = t12;
431
- $[116] = t26;
432
- $[117] = t27;
433
- $[118] = t28;
434
- } else t28 = $[118];
435
- let t29;
436
- if ($[119] !== error) {
437
- t29 = error && /* @__PURE__ */ jsxs(Alert, {
438
- variant: "destructive",
439
- children: [/* @__PURE__ */ jsx(Icon, { icon: "ph:warning-circle" }), /* @__PURE__ */ jsx(AlertDescription, { children: error })]
440
- });
441
- $[119] = error;
442
- $[120] = t29;
443
- } else t29 = $[120];
444
- let t30;
445
- if ($[121] !== success) {
446
- t30 = success && /* @__PURE__ */ jsxs(Alert, { children: [/* @__PURE__ */ jsx(Icon, { icon: "ph:user-plus" }), /* @__PURE__ */ jsx(AlertDescription, { children: success })] });
447
- $[121] = success;
448
- $[122] = t30;
449
- } else t30 = $[122];
450
- let t31;
451
- if ($[123] !== isSubmitting || $[124] !== t) {
452
- t31 = isSubmitting ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Icon, {
453
- icon: "ph:spinner-gap-bold",
454
- className: "animate-spin"
455
- }), t("auth.sendingInvitation")] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Icon, { icon: "ph:user-plus-bold" }), t("auth.sendInvitation")] });
456
- $[123] = isSubmitting;
457
- $[124] = t;
458
- $[125] = t31;
459
- } else t31 = $[125];
460
- let t32;
461
- if ($[126] !== isSubmitting || $[127] !== t31) {
462
- t32 = /* @__PURE__ */ jsx(Button, {
463
- type: "submit",
464
- className: "w-full",
465
- size: "lg",
466
- disabled: isSubmitting,
467
- children: t31
468
- });
469
- $[126] = isSubmitting;
470
- $[127] = t31;
471
- $[128] = t32;
472
- } else t32 = $[128];
473
- let t33;
474
- if ($[129] !== t13 || $[130] !== t14 || $[131] !== t28 || $[132] !== t29 || $[133] !== t30 || $[134] !== t32) {
475
- t33 = /* @__PURE__ */ jsxs("form", {
476
- onSubmit: t13,
477
- className: t14,
478
- children: [
479
- t28,
480
- t29,
481
- t30,
482
- t32
483
- ]
484
- });
485
- $[129] = t13;
486
- $[130] = t14;
487
- $[131] = t28;
488
- $[132] = t29;
489
- $[133] = t30;
490
- $[134] = t32;
491
- $[135] = t33;
492
- } else t33 = $[135];
493
- return t33;
62
+ const roles = rolesProp ?? [{
63
+ value: "admin",
64
+ label: t("defaults.users.fields.role.options.admin")
65
+ }, {
66
+ value: "user",
67
+ label: t("defaults.users.fields.role.options.user")
68
+ }];
69
+ return /* @__PURE__ */ jsxs("form", {
70
+ onSubmit: handleSubmit(async (values) => {
71
+ await onSubmit(values);
72
+ if (!error) reset();
73
+ }),
74
+ className: cn("qa-invite-form space-y-4", className),
75
+ children: [
76
+ /* @__PURE__ */ jsxs(FieldGroup, { children: [
77
+ /* @__PURE__ */ jsxs(Field, {
78
+ "data-invalid": !!errors.email,
79
+ children: [/* @__PURE__ */ jsx(FieldLabel, {
80
+ htmlFor: "invite-email",
81
+ children: t("auth.inviteEmailLabel")
82
+ }), /* @__PURE__ */ jsxs(FieldContent, { children: [
83
+ /* @__PURE__ */ jsxs("div", {
84
+ className: "relative",
85
+ children: [/* @__PURE__ */ jsx(Icon, {
86
+ icon: "ph:envelope-duotone",
87
+ className: "text-muted-foreground absolute top-1/2 left-2 size-4 -translate-y-1/2"
88
+ }), /* @__PURE__ */ jsx(Input, {
89
+ id: "invite-email",
90
+ type: "email",
91
+ placeholder: "user@example.com",
92
+ className: "pl-8",
93
+ autoComplete: "email",
94
+ "aria-invalid": !!errors.email,
95
+ ...register("email", {
96
+ required: t("auth.emailRequired"),
97
+ pattern: {
98
+ value: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
99
+ message: t("auth.invalidEmail")
100
+ }
101
+ })
102
+ })]
103
+ }),
104
+ /* @__PURE__ */ jsx(FieldDescription, { children: t("auth.inviteEmailDescription") }),
105
+ /* @__PURE__ */ jsx(FieldError, { children: errors.email?.message })
106
+ ] })]
107
+ }),
108
+ /* @__PURE__ */ jsxs(Field, {
109
+ "data-invalid": !!errors.role,
110
+ children: [/* @__PURE__ */ jsx(FieldLabel, {
111
+ htmlFor: "invite-role",
112
+ children: t("auth.inviteRole")
113
+ }), /* @__PURE__ */ jsxs(FieldContent, { children: [
114
+ /* @__PURE__ */ jsxs(Select, {
115
+ value: selectedRole,
116
+ onValueChange: (value) => value && setValue("role", value),
117
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
118
+ id: "invite-role",
119
+ children: /* @__PURE__ */ jsx(SelectValue, { children: (() => {
120
+ const selectedRoleLabel = roles.find((r) => r.value === selectedRole)?.label;
121
+ return selectedRoleLabel ? resolveText(selectedRoleLabel) : t("auth.inviteSelectRole");
122
+ })() })
123
+ }), /* @__PURE__ */ jsx(SelectContent, { children: roles.map((role) => /* @__PURE__ */ jsx(SelectItem, {
124
+ value: role.value,
125
+ children: resolveText(role.label)
126
+ }, role.value)) })]
127
+ }),
128
+ /* @__PURE__ */ jsx(FieldDescription, { children: t("auth.inviteRoleDescription") }),
129
+ /* @__PURE__ */ jsx(FieldError, { children: errors.role?.message })
130
+ ] })]
131
+ }),
132
+ showMessage && /* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, {
133
+ htmlFor: "invite-message",
134
+ children: t("auth.inviteMessage")
135
+ }), /* @__PURE__ */ jsxs(FieldContent, { children: [/* @__PURE__ */ jsx(Textarea, {
136
+ id: "invite-message",
137
+ placeholder: t("auth.inviteMessagePlaceholder"),
138
+ rows: 3,
139
+ ...register("message")
140
+ }), /* @__PURE__ */ jsx(FieldDescription, { children: t("auth.inviteMessageDescription") })] })] })
141
+ ] }),
142
+ error && /* @__PURE__ */ jsxs(Alert, {
143
+ variant: "destructive",
144
+ children: [/* @__PURE__ */ jsx(Icon, { icon: "ph:warning-circle" }), /* @__PURE__ */ jsx(AlertDescription, { children: error })]
145
+ }),
146
+ success && /* @__PURE__ */ jsxs(Alert, { children: [/* @__PURE__ */ jsx(Icon, { icon: "ph:user-plus" }), /* @__PURE__ */ jsx(AlertDescription, { children: success })] }),
147
+ /* @__PURE__ */ jsx(Button, {
148
+ type: "submit",
149
+ className: "w-full",
150
+ size: "lg",
151
+ disabled: isSubmitting,
152
+ children: isSubmitting ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Icon, {
153
+ icon: "ph:spinner-gap-bold",
154
+ className: "animate-spin"
155
+ }), t("auth.sendingInvitation")] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Icon, { icon: "ph:user-plus-bold" }), t("auth.sendInvitation")] })
156
+ })
157
+ ]
158
+ });
494
159
  }
495
160
 
496
161
  //#endregion
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime4 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime3 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/client/views/auth/login-form.d.ts
4
4
  /**
@@ -70,6 +70,6 @@ declare function LoginForm({
70
70
  className,
71
71
  error,
72
72
  minPasswordLength
73
- }: LoginFormProps): react_jsx_runtime4.JSX.Element;
73
+ }: LoginFormProps): react_jsx_runtime3.JSX.Element;
74
74
  //#endregion
75
75
  export { LoginForm };