@questpie/admin 3.0.2 → 3.0.4

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 (249) hide show
  1. package/README.md +34 -5
  2. package/dist/client/blocks/block-renderer.d.mts +2 -2
  3. package/dist/client/blocks/block-renderer.mjs +4 -1
  4. package/dist/client/builder/types/action-types.d.mts +31 -3
  5. package/dist/client/builder/types/collection-types.d.mts +140 -0
  6. package/dist/client/builder/types/ui-config.d.mts +16 -2
  7. package/dist/client/builder/types/views.d.mts +57 -0
  8. package/dist/client/builder/types/widget-types.d.mts +5 -0
  9. package/dist/client/components/actions/action-button.mjs +137 -199
  10. package/dist/client/components/actions/action-dialog.mjs +198 -156
  11. package/dist/client/components/actions/confirmation-dialog.mjs +2 -2
  12. package/dist/client/components/actions/header-actions.mjs +52 -53
  13. package/dist/client/components/admin-link.d.mts +2 -2
  14. package/dist/client/components/auth/auth-loading.mjs +41 -18
  15. package/dist/client/components/blocks/block-fields-renderer.mjs +64 -28
  16. package/dist/client/components/blocks/block-insert-button.mjs +4 -4
  17. package/dist/client/components/blocks/block-item.mjs +2 -2
  18. package/dist/client/components/blocks/block-library-sidebar.mjs +2 -2
  19. package/dist/client/components/component-renderer.mjs +1 -1
  20. package/dist/client/components/fields/array-field.mjs +14 -14
  21. package/dist/client/components/fields/asset-preview-field.mjs +1 -1
  22. package/dist/client/components/fields/blocks-field/blocks-field.mjs +84 -104
  23. package/dist/client/components/fields/json-field.mjs +2 -2
  24. package/dist/client/components/fields/object-array-field.mjs +22 -22
  25. package/dist/client/components/fields/object-field.mjs +5 -5
  26. package/dist/client/components/fields/relation/displays/cards-display.mjs +16 -9
  27. package/dist/client/components/fields/relation/displays/chips-display.mjs +15 -12
  28. package/dist/client/components/fields/relation/displays/grid-display.mjs +15 -11
  29. package/dist/client/components/fields/relation/displays/list-display.mjs +33 -20
  30. package/dist/client/components/fields/relation/displays/table-display.mjs +62 -93
  31. package/dist/client/components/fields/relation/relation-items-display.mjs +1 -1
  32. package/dist/client/components/fields/relation-picker.mjs +7 -6
  33. package/dist/client/components/fields/relation-select.mjs +71 -47
  34. package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +392 -82
  35. package/dist/client/components/fields/rich-text-editor/extensions.mjs +54 -23
  36. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +24 -50
  37. package/dist/client/components/fields/rich-text-editor/image-upload.mjs +66 -0
  38. package/dist/client/components/fields/rich-text-editor/index.d.mts +38 -0
  39. package/dist/client/components/fields/rich-text-editor/index.mjs +637 -376
  40. package/dist/client/components/fields/rich-text-editor/link-utils.mjs +26 -0
  41. package/dist/client/components/fields/rich-text-editor/presets.d.mts +10 -0
  42. package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +27 -6
  43. package/dist/client/components/fields/rich-text-editor/toolbar.mjs +464 -346
  44. package/dist/client/components/fields/rich-text-editor/types.d.mts +77 -0
  45. package/dist/client/components/fields/upload-field.mjs +45 -49
  46. package/dist/client/components/filter-builder/columns-tab.mjs +69 -62
  47. package/dist/client/components/filter-builder/filter-builder-sheet.mjs +473 -308
  48. package/dist/client/components/filter-builder/filters-tab.mjs +109 -82
  49. package/dist/client/components/filter-builder/saved-views-tab.mjs +300 -198
  50. package/dist/client/components/history-sidebar.mjs +850 -340
  51. package/dist/client/components/layout/field-layout-renderer.mjs +6 -5
  52. package/dist/client/components/locale-switcher.mjs +8 -8
  53. package/dist/client/components/media/media-grid.mjs +12 -9
  54. package/dist/client/components/media/media-picker-dialog.mjs +242 -230
  55. package/dist/client/components/preview/live-preview-mode.mjs +1 -1
  56. package/dist/client/components/primitives/asset-preview.mjs +37 -22
  57. package/dist/client/components/primitives/date-input.mjs +212 -249
  58. package/dist/client/components/primitives/dropzone.mjs +192 -159
  59. package/dist/client/components/primitives/field-select-control.mjs +93 -0
  60. package/dist/client/components/primitives/select-multi.mjs +251 -230
  61. package/dist/client/components/primitives/select-single.mjs +345 -290
  62. package/dist/client/components/primitives/time-input.mjs +2 -2
  63. package/dist/client/components/sheets/resource-sheet.mjs +2 -0
  64. package/dist/client/components/ui/accordion.mjs +4 -4
  65. package/dist/client/components/ui/alert.mjs +3 -3
  66. package/dist/client/components/ui/badge.mjs +4 -4
  67. package/dist/client/components/ui/button.mjs +47 -37
  68. package/dist/client/components/ui/card.mjs +2 -2
  69. package/dist/client/components/ui/checkbox.mjs +1 -1
  70. package/dist/client/components/ui/command.mjs +5 -5
  71. package/dist/client/components/ui/dialog.mjs +3 -3
  72. package/dist/client/components/ui/drawer.mjs +1 -1
  73. package/dist/client/components/ui/dropdown-menu.mjs +157 -15
  74. package/dist/client/components/ui/empty-state.mjs +88 -59
  75. package/dist/client/components/ui/field.mjs +2 -2
  76. package/dist/client/components/ui/input-group.mjs +3 -3
  77. package/dist/client/components/ui/input.mjs +1 -1
  78. package/dist/client/components/ui/kbd.mjs +1 -1
  79. package/dist/client/components/ui/label.mjs +1 -1
  80. package/dist/client/components/ui/popover.mjs +19 -11
  81. package/dist/client/components/ui/scroll-fade.mjs +170 -0
  82. package/dist/client/components/ui/search-input.mjs +1 -1
  83. package/dist/client/components/ui/select.mjs +129 -27
  84. package/dist/client/components/ui/sheet.mjs +54 -34
  85. package/dist/client/components/ui/sidebar.mjs +15 -14
  86. package/dist/client/components/ui/skeleton.mjs +28 -12
  87. package/dist/client/components/ui/switch.mjs +2 -2
  88. package/dist/client/components/ui/table.mjs +82 -74
  89. package/dist/client/components/ui/tabs.mjs +26 -31
  90. package/dist/client/components/ui/textarea.mjs +1 -1
  91. package/dist/client/components/ui/tooltip.mjs +1 -1
  92. package/dist/client/components/widgets/chart-widget.mjs +134 -96
  93. package/dist/client/components/widgets/progress-widget.mjs +59 -34
  94. package/dist/client/components/widgets/quick-actions-widget.mjs +184 -113
  95. package/dist/client/components/widgets/recent-items-widget.mjs +144 -102
  96. package/dist/client/components/widgets/stats-widget.mjs +91 -72
  97. package/dist/client/components/widgets/table-widget.mjs +159 -246
  98. package/dist/client/components/widgets/timeline-widget.mjs +66 -43
  99. package/dist/client/components/widgets/value-widget.mjs +261 -152
  100. package/dist/client/components/widgets/widget-empty-state.mjs +88 -0
  101. package/dist/client/components/widgets/widget-skeletons.mjs +53 -20
  102. package/dist/client/contexts/focus-context.d.mts +2 -2
  103. package/dist/client/hooks/use-action.mjs +63 -55
  104. package/dist/client/hooks/use-audit-history.mjs +1 -65
  105. package/dist/client/hooks/use-collection-validation.mjs +36 -23
  106. package/dist/client/hooks/use-collection.mjs +96 -1
  107. package/dist/client/hooks/use-saved-views.mjs +70 -49
  108. package/dist/client/hooks/use-server-actions.mjs +59 -40
  109. package/dist/client/hooks/use-server-validation.mjs +156 -41
  110. package/dist/client/hooks/use-server-widget-data.mjs +1 -1
  111. package/dist/client/hooks/use-setup-status.d.mts +3 -3
  112. package/dist/client/hooks/use-setup-status.mjs +2 -2
  113. package/dist/client/hooks/use-transition-stage.mjs +2 -10
  114. package/dist/client/hooks/use-validation-error-map.mjs +31 -13
  115. package/dist/client/hooks/use-view-state.mjs +238 -174
  116. package/dist/client/i18n/date-locale.mjs +33 -0
  117. package/dist/client/i18n/hooks.mjs +17 -1
  118. package/dist/client/lib/utils.mjs +3 -2
  119. package/dist/client/preview/block-scope-context.d.mts +2 -2
  120. package/dist/client/preview/preview-banner.d.mts +2 -2
  121. package/dist/client/preview/preview-field.d.mts +4 -4
  122. package/dist/client/preview/preview-field.mjs +2 -2
  123. package/dist/client/runtime/provider.mjs +8 -1
  124. package/dist/client/runtime/translations-provider.mjs +1 -1
  125. package/dist/client/scope/picker.d.mts +2 -2
  126. package/dist/client/scope/provider.d.mts +2 -2
  127. package/dist/client/styles/base.css +1022 -0
  128. package/dist/client/styles/index.css +3 -589
  129. package/dist/client/utils/auto-expand-fields.mjs +4 -2
  130. package/dist/client/utils/keyboard-shortcuts.mjs +26 -0
  131. package/dist/client/utils/use-lazy-component.mjs +80 -0
  132. package/dist/client/views/auth/auth-layout.d.mts +18 -11
  133. package/dist/client/views/auth/auth-layout.mjs +291 -80
  134. package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
  135. package/dist/client/views/auth/forgot-password-form.mjs +2 -2
  136. package/dist/client/views/auth/login-form.d.mts +2 -2
  137. package/dist/client/views/auth/login-form.mjs +1 -1
  138. package/dist/client/views/auth/reset-password-form.d.mts +2 -2
  139. package/dist/client/views/auth/reset-password-form.mjs +2 -2
  140. package/dist/client/views/auth/setup-form.d.mts +2 -2
  141. package/dist/client/views/collection/auto-form-fields.mjs +11 -9
  142. package/dist/client/views/collection/bulk-action-toolbar.mjs +173 -138
  143. package/dist/client/views/collection/cells/complex-cells.mjs +22 -22
  144. package/dist/client/views/collection/cells/primitive-cells.mjs +1 -1
  145. package/dist/client/views/collection/cells/relation-cells.mjs +147 -129
  146. package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +224 -278
  147. package/dist/client/views/collection/cells/shared/relation-chip.mjs +64 -36
  148. package/dist/client/views/collection/cells/upload-cells.mjs +199 -9
  149. package/dist/client/views/collection/columns/build-columns.mjs +29 -9
  150. package/dist/client/views/collection/columns/column-defaults.mjs +2 -2
  151. package/dist/client/views/collection/field-renderer.mjs +50 -89
  152. package/dist/client/views/collection/form-view.mjs +237 -227
  153. package/dist/client/views/collection/table-view.mjs +1162 -229
  154. package/dist/client/views/collection/view-skeletons.mjs +222 -79
  155. package/dist/client/views/common/global-search.mjs +29 -18
  156. package/dist/client/views/dashboard/dashboard-grid.mjs +678 -501
  157. package/dist/client/views/dashboard/dashboard-widget.mjs +6 -3
  158. package/dist/client/views/dashboard/widget-card.mjs +23 -14
  159. package/dist/client/views/globals/global-form-view.mjs +634 -589
  160. package/dist/client/views/layout/admin-layout-provider.mjs +67 -70
  161. package/dist/client/views/layout/admin-layout.d.mts +3 -6
  162. package/dist/client/views/layout/admin-layout.mjs +149 -172
  163. package/dist/client/views/layout/admin-router.mjs +747 -544
  164. package/dist/client/views/layout/admin-sidebar.d.mts +38 -1
  165. package/dist/client/views/layout/admin-sidebar.mjs +751 -591
  166. package/dist/client/views/layout/admin-theme.d.mts +10 -0
  167. package/dist/client/views/layout/admin-theme.mjs +84 -0
  168. package/dist/client/views/layout/admin-view-layout.mjs +161 -0
  169. package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
  170. package/dist/client/views/pages/accept-invite-page.mjs +49 -26
  171. package/dist/client/views/pages/dashboard-page.d.mts +2 -2
  172. package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
  173. package/dist/client/views/pages/forgot-password-page.mjs +2 -19
  174. package/dist/client/views/pages/invite-page.d.mts +2 -2
  175. package/dist/client/views/pages/invite-page.mjs +2 -19
  176. package/dist/client/views/pages/login-page.d.mts +3 -3
  177. package/dist/client/views/pages/login-page.mjs +4 -21
  178. package/dist/client/views/pages/reset-password-page.d.mts +2 -2
  179. package/dist/client/views/pages/reset-password-page.mjs +3 -20
  180. package/dist/client/views/pages/setup-page.d.mts +2 -2
  181. package/dist/client/views/pages/setup-page.mjs +3 -20
  182. package/dist/client.d.mts +6 -2
  183. package/dist/client.mjs +2 -1
  184. package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
  185. package/dist/index.d.mts +6 -2
  186. package/dist/index.mjs +2 -1
  187. package/dist/server/augmentation/dashboard.d.mts +67 -3
  188. package/dist/server/augmentation/form-layout.d.mts +21 -0
  189. package/dist/server/augmentation/index.d.mts +1 -1
  190. package/dist/server/codegen/admin-client-template.mjs +4 -0
  191. package/dist/server/fields/blocks.d.mts +1 -1
  192. package/dist/server/fields/blocks.mjs +12 -0
  193. package/dist/server/fields/rich-text.d.mts +1 -1
  194. package/dist/server/fields/rich-text.mjs +8 -0
  195. package/dist/server/i18n/index.mjs +17 -1
  196. package/dist/server/i18n/messages/cs.mjs +23 -0
  197. package/dist/server/i18n/messages/de.mjs +23 -0
  198. package/dist/server/i18n/messages/en.mjs +64 -1
  199. package/dist/server/i18n/messages/es.mjs +23 -0
  200. package/dist/server/i18n/messages/fr.mjs +23 -0
  201. package/dist/server/i18n/messages/pl.mjs +23 -0
  202. package/dist/server/i18n/messages/pt.mjs +23 -0
  203. package/dist/server/i18n/messages/sk.mjs +83 -1
  204. package/dist/server/modules/admin/block/introspection.mjs +4 -1
  205. package/dist/server/modules/admin/block/prefetch.mjs +12 -2
  206. package/dist/server/modules/admin/collections/account.d.mts +50 -50
  207. package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
  208. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  209. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  210. package/dist/server/modules/admin/collections/apikey.d.mts +64 -64
  211. package/dist/server/modules/admin/collections/assets.d.mts +20 -20
  212. package/dist/server/modules/admin/collections/assets.mjs +0 -1
  213. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  214. package/dist/server/modules/admin/collections/user.d.mts +40 -28
  215. package/dist/server/modules/admin/collections/user.mjs +40 -9
  216. package/dist/server/modules/admin/collections/verification.d.mts +36 -36
  217. package/dist/server/modules/admin/dto/admin-config.dto.mjs +2 -0
  218. package/dist/server/modules/admin/factories.mjs +7 -18
  219. package/dist/server/modules/admin/index.d.mts +1 -1
  220. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  221. package/dist/server/modules/admin/routes/admin-config.mjs +34 -16
  222. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  223. package/dist/server/modules/admin/routes/execute-action.mjs +33 -0
  224. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  225. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  226. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  227. package/dist/server/modules/admin/routes/setup.d.mts +10 -10
  228. package/dist/server/modules/admin/routes/setup.mjs +7 -7
  229. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  230. package/dist/server/modules/admin/routes/translations.mjs +5 -1
  231. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  232. package/dist/server/modules/admin-preferences/collections/admin-preferences.mjs +1 -1
  233. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +25 -25
  234. package/dist/server/modules/audit/.generated/module.d.mts +7 -7
  235. package/dist/server/modules/audit/.generated/module.mjs +1 -1
  236. package/dist/server/modules/audit/collections/audit-log.d.mts +39 -39
  237. package/dist/server/modules/audit/collections/audit-log.mjs +1 -1
  238. package/dist/server/modules/audit/config/app.mjs +99 -42
  239. package/dist/server/modules/audit/jobs/audit-cleanup.mjs +1 -1
  240. package/dist/server/plugin.mjs +4 -2
  241. package/dist/server/proxy-factories.d.mts +4 -3
  242. package/dist/server/proxy-factories.mjs +34 -8
  243. package/dist/shared/types/saved-views.types.d.mts +2 -0
  244. package/package.json +6 -4
  245. package/dist/client/components/fields/rich-text-editor/link-popover.mjs +0 -85
  246. package/dist/client/components/ui/spinner.mjs +0 -52
  247. package/dist/client/components/ui/toolbar.mjs +0 -136
  248. package/dist/client/contexts/breadcrumb-context.mjs +0 -60
  249. package/dist/client/views/layout/admin-topbar.mjs +0 -236
@@ -1,6 +1,8 @@
1
1
  import { useTranslation } from "../../../i18n/hooks.mjs";
2
2
  import { cn } from "../../../lib/utils.mjs";
3
3
  import { Button } from "../../ui/button.mjs";
4
+ import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue } from "../../ui/select.mjs";
5
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger } from "../../ui/dropdown-menu.mjs";
4
6
  import { TableControls } from "./table-controls.mjs";
5
7
  import { c } from "react/compiler-runtime";
6
8
  import { Icon } from "@iconify/react";
@@ -36,13 +38,79 @@ const EDITOR_ICONS = {
36
38
  alignLeft: "ph:text-align-left",
37
39
  alignCenter: "ph:text-align-center",
38
40
  alignRight: "ph:text-align-right",
39
- alignJustify: "ph:text-align-justify"
41
+ alignJustify: "ph:text-align-justify",
42
+ blocks: "ph:list-plus",
43
+ formatting: "ph:text-aa",
44
+ insert: "ph:plus",
45
+ more: "ph:dots-three-vertical"
40
46
  };
47
+ const HEADING_OPTIONS = [
48
+ {
49
+ value: "paragraph",
50
+ group: "text"
51
+ },
52
+ {
53
+ value: "1",
54
+ group: "heading"
55
+ },
56
+ {
57
+ value: "2",
58
+ group: "heading"
59
+ },
60
+ {
61
+ value: "3",
62
+ group: "heading"
63
+ },
64
+ {
65
+ value: "4",
66
+ group: "heading"
67
+ },
68
+ {
69
+ value: "5",
70
+ group: "heading"
71
+ },
72
+ {
73
+ value: "6",
74
+ group: "heading"
75
+ }
76
+ ];
77
+ const ALIGNMENT_OPTIONS = [
78
+ {
79
+ value: "left",
80
+ icon: EDITOR_ICONS.alignLeft,
81
+ labelKey: "editor.alignLeft"
82
+ },
83
+ {
84
+ value: "center",
85
+ icon: EDITOR_ICONS.alignCenter,
86
+ labelKey: "editor.alignCenter"
87
+ },
88
+ {
89
+ value: "right",
90
+ icon: EDITOR_ICONS.alignRight,
91
+ labelKey: "editor.alignRight"
92
+ },
93
+ {
94
+ value: "justify",
95
+ icon: EDITOR_ICONS.alignJustify,
96
+ labelKey: "editor.alignJustify"
97
+ }
98
+ ];
99
+ function getHeadingOptionLabel(value, t) {
100
+ if (value === "paragraph") return t("editor.paragraph");
101
+ return t("editor.heading", { level: value });
102
+ }
103
+ function getCurrentAlignment(editor) {
104
+ if (editor.isActive({ textAlign: "center" })) return "center";
105
+ if (editor.isActive({ textAlign: "right" })) return "right";
106
+ if (editor.isActive({ textAlign: "justify" })) return "justify";
107
+ return "left";
108
+ }
41
109
  /**
42
110
  * Icon-based toolbar button with tooltip showing keyboard shortcuts
43
111
  */
44
112
  function ToolbarButton(t0) {
45
- const $ = c(28);
113
+ const $ = c(30);
46
114
  let active;
47
115
  let children;
48
116
  let className;
@@ -84,16 +152,18 @@ function ToolbarButton(t0) {
84
152
  } else t1 = $[12];
85
153
  const tooltipText = t1;
86
154
  const iconSuffix = active ? "-fill" : "";
87
- const buttonSize = iconName ? "icon-xs" : "xs";
88
- let t2;
155
+ const buttonSize = iconName ? "icon-sm" : "xs";
156
+ const t2 = typeof active === "boolean" ? active : void 0;
157
+ let t3;
89
158
  if ($[13] !== className) {
90
- t2 = cn("text-muted-foreground hover:text-foreground hover:bg-transparent", "data-[active=true]:text-foreground data-[active=true]:bg-transparent", "aria-expanded:bg-transparent", className);
159
+ t3 = cn("item-surface text-muted-foreground hover:bg-surface-high hover:text-foreground motion-reduce:transition-none", "data-[active=true]:bg-surface-high data-[active=true]:text-foreground", "aria-expanded:bg-surface-high", className);
91
160
  $[13] = className;
92
- $[14] = t2;
93
- } else t2 = $[14];
94
- let t3;
161
+ $[14] = t3;
162
+ } else t3 = $[14];
163
+ let t4;
95
164
  if ($[15] !== children || $[16] !== iconName || $[17] !== iconSuffix) {
96
- t3 = iconName ? /* @__PURE__ */ jsx(Icon, {
165
+ t4 = iconName ? /* @__PURE__ */ jsx(Icon, {
166
+ "aria-hidden": "true",
97
167
  icon: `${iconName}${iconSuffix}`,
98
168
  width: 16,
99
169
  height: 16
@@ -101,21 +171,24 @@ function ToolbarButton(t0) {
101
171
  $[15] = children;
102
172
  $[16] = iconName;
103
173
  $[17] = iconSuffix;
104
- $[18] = t3;
105
- } else t3 = $[18];
106
- let t4;
107
- if ($[19] !== active || $[20] !== buttonSize || $[21] !== disabled || $[22] !== onClick || $[23] !== rest || $[24] !== t2 || $[25] !== t3 || $[26] !== tooltipText) {
108
- t4 = /* @__PURE__ */ jsx(Button, {
174
+ $[18] = t4;
175
+ } else t4 = $[18];
176
+ let t5;
177
+ if ($[19] !== active || $[20] !== buttonSize || $[21] !== disabled || $[22] !== onClick || $[23] !== rest || $[24] !== t2 || $[25] !== t3 || $[26] !== t4 || $[27] !== title || $[28] !== tooltipText) {
178
+ t5 = /* @__PURE__ */ jsx(Button, {
109
179
  type: "button",
110
180
  variant: "ghost",
111
181
  size: buttonSize,
182
+ "aria-label": title,
183
+ "aria-pressed": t2,
112
184
  "data-active": active,
185
+ "data-rich-text-toolbar-button": "",
113
186
  title: tooltipText,
114
187
  disabled,
115
188
  onClick,
116
- className: t2,
189
+ className: t3,
117
190
  ...rest,
118
- children: t3
191
+ children: t4
119
192
  });
120
193
  $[19] = active;
121
194
  $[20] = buttonSize;
@@ -124,10 +197,12 @@ function ToolbarButton(t0) {
124
197
  $[23] = rest;
125
198
  $[24] = t2;
126
199
  $[25] = t3;
127
- $[26] = tooltipText;
128
- $[27] = t4;
129
- } else t4 = $[27];
130
- return t4;
200
+ $[26] = t4;
201
+ $[27] = title;
202
+ $[28] = tooltipText;
203
+ $[29] = t5;
204
+ } else t5 = $[29];
205
+ return t5;
131
206
  }
132
207
  /**
133
208
  * Toolbar button group with divider
@@ -139,6 +214,7 @@ function ToolbarGroup(t0) {
139
214
  if ($[0] !== children) {
140
215
  t1 = /* @__PURE__ */ jsx("div", {
141
216
  className: "flex items-center gap-1",
217
+ role: "group",
142
218
  children
143
219
  });
144
220
  $[0] = children;
@@ -146,17 +222,101 @@ function ToolbarGroup(t0) {
146
222
  } else t1 = $[1];
147
223
  return t1;
148
224
  }
225
+ function ToolbarMenuItem(t0) {
226
+ const $ = c(17);
227
+ const { active, disabled, icon, label, onClick, shortcut } = t0;
228
+ const t1 = active ? "true" : void 0;
229
+ const t2 = active ? "bg-accent text-accent-foreground" : "";
230
+ let t3;
231
+ if ($[0] !== t2) {
232
+ t3 = cn("min-w-44", t2);
233
+ $[0] = t2;
234
+ $[1] = t3;
235
+ } else t3 = $[1];
236
+ let t4;
237
+ if ($[2] !== icon) {
238
+ t4 = /* @__PURE__ */ jsx(Icon, {
239
+ "aria-hidden": "true",
240
+ icon
241
+ });
242
+ $[2] = icon;
243
+ $[3] = t4;
244
+ } else t4 = $[3];
245
+ let t5;
246
+ if ($[4] !== label) {
247
+ t5 = /* @__PURE__ */ jsx("span", { children: label });
248
+ $[4] = label;
249
+ $[5] = t5;
250
+ } else t5 = $[5];
251
+ let t6;
252
+ if ($[6] !== active || $[7] !== shortcut) {
253
+ t6 = shortcut ? /* @__PURE__ */ jsx(DropdownMenuShortcut, { children: shortcut }) : active ? /* @__PURE__ */ jsx(Icon, {
254
+ "aria-hidden": "true",
255
+ icon: "ph:check",
256
+ className: "ml-auto size-3.5"
257
+ }) : null;
258
+ $[6] = active;
259
+ $[7] = shortcut;
260
+ $[8] = t6;
261
+ } else t6 = $[8];
262
+ let t7;
263
+ if ($[9] !== disabled || $[10] !== onClick || $[11] !== t1 || $[12] !== t3 || $[13] !== t4 || $[14] !== t5 || $[15] !== t6) {
264
+ t7 = /* @__PURE__ */ jsxs(DropdownMenuItem, {
265
+ "aria-current": t1,
266
+ disabled,
267
+ onClick,
268
+ className: t3,
269
+ children: [
270
+ t4,
271
+ t5,
272
+ t6
273
+ ]
274
+ });
275
+ $[9] = disabled;
276
+ $[10] = onClick;
277
+ $[11] = t1;
278
+ $[12] = t3;
279
+ $[13] = t4;
280
+ $[14] = t5;
281
+ $[15] = t6;
282
+ $[16] = t7;
283
+ } else t7 = $[16];
284
+ return t7;
285
+ }
149
286
  /**
150
287
  * Main toolbar component with icon-based buttons
151
288
  */
152
289
  function RichTextToolbar(t0) {
153
- const $ = c(107);
290
+ const $ = c(77);
154
291
  const { editor, features, disabled, headingValue, onHeadingChange, onLinkClick, onImageClick, onTableClick, inTable } = t0;
155
292
  const { t } = useTranslation();
156
293
  const isEditable = !disabled;
157
294
  let t1;
158
- if ($[0] !== editor || $[1] !== features.history || $[2] !== isEditable || $[3] !== t) {
159
- t1 = features.history && /* @__PURE__ */ jsxs(ToolbarGroup, { children: [/* @__PURE__ */ jsx(ToolbarButton, {
295
+ if ($[0] !== editor) {
296
+ t1 = getCurrentAlignment(editor);
297
+ $[0] = editor;
298
+ $[1] = t1;
299
+ } else t1 = $[1];
300
+ const currentAlignment = t1;
301
+ let t2;
302
+ if ($[2] !== currentAlignment) {
303
+ t2 = ALIGNMENT_OPTIONS.find((option) => option.value === currentAlignment) ?? ALIGNMENT_OPTIONS[0];
304
+ $[2] = currentAlignment;
305
+ $[3] = t2;
306
+ } else t2 = $[3];
307
+ const currentAlignmentOption = t2;
308
+ const hasMoreFormatting = features.underline || features.strike || features.code;
309
+ const hasBlockMenu = features.bulletList || features.orderedList || features.blockquote || features.codeBlock || features.horizontalRule;
310
+ const hasInsertMenu = features.link || features.image || features.table;
311
+ let t3;
312
+ if ($[4] !== t) {
313
+ t3 = t("editor.richTextToolbar");
314
+ $[4] = t;
315
+ $[5] = t3;
316
+ } else t3 = $[5];
317
+ let t4;
318
+ if ($[6] !== editor || $[7] !== features.history || $[8] !== isEditable || $[9] !== t) {
319
+ t4 = features.history && /* @__PURE__ */ jsxs(ToolbarGroup, { children: [/* @__PURE__ */ jsx(ToolbarButton, {
160
320
  icon: EDITOR_ICONS.undo,
161
321
  disabled: !isEditable || !editor.can().undo(),
162
322
  title: t("editor.undo"),
@@ -169,59 +329,51 @@ function RichTextToolbar(t0) {
169
329
  shortcut: "⌘⇧Z",
170
330
  onClick: () => editor.chain().focus().redo().run()
171
331
  })] });
172
- $[0] = editor;
173
- $[1] = features.history;
174
- $[2] = isEditable;
175
- $[3] = t;
176
- $[4] = t1;
177
- } else t1 = $[4];
178
- let t2;
179
- if ($[5] !== features.heading || $[6] !== headingValue || $[7] !== isEditable || $[8] !== onHeadingChange) {
180
- t2 = features.heading && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxs("select", {
181
- className: "border-input bg-transparent h-6 border px-2 text-xs",
332
+ $[6] = editor;
333
+ $[7] = features.history;
334
+ $[8] = isEditable;
335
+ $[9] = t;
336
+ $[10] = t4;
337
+ } else t4 = $[10];
338
+ let t5;
339
+ if ($[11] !== features.heading || $[12] !== headingValue || $[13] !== isEditable || $[14] !== onHeadingChange || $[15] !== t) {
340
+ t5 = features.heading && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxs(Select, {
182
341
  value: headingValue,
183
- onChange: (event) => onHeadingChange(event.target.value),
184
342
  disabled: !isEditable,
185
- children: [
186
- /* @__PURE__ */ jsx("option", {
187
- value: "paragraph",
188
- children: "Paragraph"
189
- }),
190
- /* @__PURE__ */ jsx("option", {
191
- value: "1",
192
- children: "Heading 1"
193
- }),
194
- /* @__PURE__ */ jsx("option", {
195
- value: "2",
196
- children: "Heading 2"
197
- }),
198
- /* @__PURE__ */ jsx("option", {
199
- value: "3",
200
- children: "Heading 3"
201
- }),
202
- /* @__PURE__ */ jsx("option", {
203
- value: "4",
204
- children: "Heading 4"
205
- }),
206
- /* @__PURE__ */ jsx("option", {
207
- value: "5",
208
- children: "Heading 5"
209
- }),
210
- /* @__PURE__ */ jsx("option", {
211
- value: "6",
212
- children: "Heading 6"
213
- })
214
- ]
343
+ onValueChange: (value) => {
344
+ if (typeof value === "string") onHeadingChange(value);
345
+ },
346
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
347
+ "aria-label": t("editor.blockType"),
348
+ className: "h-8 min-w-[136px] px-2.5 text-sm",
349
+ size: "sm",
350
+ children: /* @__PURE__ */ jsx(SelectValue, { children: HEADING_OPTIONS.find((option_1) => option_1.value === headingValue)?.value ? getHeadingOptionLabel(HEADING_OPTIONS.find((option_0) => option_0.value === headingValue)?.value ?? "paragraph", t) : t("editor.paragraph") })
351
+ }), /* @__PURE__ */ jsxs(SelectContent, {
352
+ align: "start",
353
+ className: "min-w-[136px]",
354
+ children: [
355
+ /* @__PURE__ */ jsxs(SelectGroup, { children: [/* @__PURE__ */ jsx(SelectLabel, { children: t("editor.textBlocks") }), /* @__PURE__ */ jsx(SelectItem, {
356
+ value: "paragraph",
357
+ children: t("editor.paragraph")
358
+ })] }),
359
+ /* @__PURE__ */ jsx(SelectSeparator, {}),
360
+ /* @__PURE__ */ jsxs(SelectGroup, { children: [/* @__PURE__ */ jsx(SelectLabel, { children: t("editor.headings") }), HEADING_OPTIONS.filter(_temp).map((option_3) => /* @__PURE__ */ jsx(SelectItem, {
361
+ value: option_3.value,
362
+ children: getHeadingOptionLabel(option_3.value, t)
363
+ }, option_3.value))] })
364
+ ]
365
+ })]
215
366
  }) });
216
- $[5] = features.heading;
217
- $[6] = headingValue;
218
- $[7] = isEditable;
219
- $[8] = onHeadingChange;
220
- $[9] = t2;
221
- } else t2 = $[9];
222
- let t3;
223
- if ($[10] !== editor || $[11] !== features.bold || $[12] !== isEditable || $[13] !== t) {
224
- t3 = features.bold && /* @__PURE__ */ jsx(ToolbarButton, {
367
+ $[11] = features.heading;
368
+ $[12] = headingValue;
369
+ $[13] = isEditable;
370
+ $[14] = onHeadingChange;
371
+ $[15] = t;
372
+ $[16] = t5;
373
+ } else t5 = $[16];
374
+ let t6;
375
+ if ($[17] !== editor || $[18] !== features.bold || $[19] !== isEditable || $[20] !== t) {
376
+ t6 = features.bold && /* @__PURE__ */ jsx(ToolbarButton, {
225
377
  icon: EDITOR_ICONS.bold,
226
378
  active: editor.isActive("bold"),
227
379
  disabled: !isEditable,
@@ -229,15 +381,15 @@ function RichTextToolbar(t0) {
229
381
  shortcut: "⌘B",
230
382
  onClick: () => editor.chain().focus().toggleBold().run()
231
383
  });
232
- $[10] = editor;
233
- $[11] = features.bold;
234
- $[12] = isEditable;
235
- $[13] = t;
236
- $[14] = t3;
237
- } else t3 = $[14];
238
- let t4;
239
- if ($[15] !== editor || $[16] !== features.italic || $[17] !== isEditable || $[18] !== t) {
240
- t4 = features.italic && /* @__PURE__ */ jsx(ToolbarButton, {
384
+ $[17] = editor;
385
+ $[18] = features.bold;
386
+ $[19] = isEditable;
387
+ $[20] = t;
388
+ $[21] = t6;
389
+ } else t6 = $[21];
390
+ let t7;
391
+ if ($[22] !== editor || $[23] !== features.italic || $[24] !== isEditable || $[25] !== t) {
392
+ t7 = features.italic && /* @__PURE__ */ jsx(ToolbarButton, {
241
393
  icon: EDITOR_ICONS.italic,
242
394
  active: editor.isActive("italic"),
243
395
  disabled: !isEditable,
@@ -245,237 +397,210 @@ function RichTextToolbar(t0) {
245
397
  shortcut: "⌘I",
246
398
  onClick: () => editor.chain().focus().toggleItalic().run()
247
399
  });
248
- $[15] = editor;
249
- $[16] = features.italic;
250
- $[17] = isEditable;
251
- $[18] = t;
252
- $[19] = t4;
253
- } else t4 = $[19];
254
- let t5;
255
- if ($[20] !== editor || $[21] !== features.underline || $[22] !== isEditable || $[23] !== t) {
256
- t5 = features.underline && /* @__PURE__ */ jsx(ToolbarButton, {
257
- icon: EDITOR_ICONS.underline,
258
- active: editor.isActive("underline"),
259
- disabled: !isEditable,
260
- title: t("editor.underline"),
261
- shortcut: "⌘U",
262
- onClick: () => editor.chain().focus().toggleUnderline().run()
263
- });
264
- $[20] = editor;
265
- $[21] = features.underline;
266
- $[22] = isEditable;
267
- $[23] = t;
268
- $[24] = t5;
269
- } else t5 = $[24];
270
- let t6;
271
- if ($[25] !== editor || $[26] !== features.strike || $[27] !== isEditable || $[28] !== t) {
272
- t6 = features.strike && /* @__PURE__ */ jsx(ToolbarButton, {
273
- icon: EDITOR_ICONS.strikethrough,
274
- active: editor.isActive("strike"),
275
- disabled: !isEditable,
276
- title: t("editor.strikethrough"),
277
- onClick: () => editor.chain().focus().toggleStrike().run()
278
- });
279
- $[25] = editor;
280
- $[26] = features.strike;
281
- $[27] = isEditable;
282
- $[28] = t;
283
- $[29] = t6;
284
- } else t6 = $[29];
285
- let t7;
286
- if ($[30] !== editor || $[31] !== features.code || $[32] !== isEditable || $[33] !== t) {
287
- t7 = features.code && /* @__PURE__ */ jsx(ToolbarButton, {
288
- icon: EDITOR_ICONS.code,
289
- active: editor.isActive("code"),
290
- disabled: !isEditable,
291
- title: t("editor.code"),
292
- shortcut: "⌘E",
293
- onClick: () => editor.chain().focus().toggleCode().run()
294
- });
295
- $[30] = editor;
296
- $[31] = features.code;
400
+ $[22] = editor;
401
+ $[23] = features.italic;
402
+ $[24] = isEditable;
403
+ $[25] = t;
404
+ $[26] = t7;
405
+ } else t7 = $[26];
406
+ let t8;
407
+ if ($[27] !== editor || $[28] !== features.code || $[29] !== features.strike || $[30] !== features.underline || $[31] !== hasMoreFormatting || $[32] !== isEditable || $[33] !== t) {
408
+ t8 = hasMoreFormatting && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
409
+ nativeButton: false,
410
+ render: /* @__PURE__ */ jsx(ToolbarButton, {
411
+ icon: EDITOR_ICONS.formatting,
412
+ active: editor.isActive("underline") || editor.isActive("strike") || editor.isActive("code"),
413
+ disabled: !isEditable,
414
+ title: t("editor.moreFormatting")
415
+ })
416
+ }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
417
+ align: "start",
418
+ className: "w-56",
419
+ children: [
420
+ /* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("editor.formatting") }),
421
+ features.underline && /* @__PURE__ */ jsx(ToolbarMenuItem, {
422
+ icon: EDITOR_ICONS.underline,
423
+ active: editor.isActive("underline"),
424
+ disabled: !isEditable,
425
+ label: t("editor.underline"),
426
+ shortcut: "⌘U",
427
+ onClick: () => editor.chain().focus().toggleUnderline().run()
428
+ }),
429
+ features.strike && /* @__PURE__ */ jsx(ToolbarMenuItem, {
430
+ icon: EDITOR_ICONS.strikethrough,
431
+ active: editor.isActive("strike"),
432
+ disabled: !isEditable,
433
+ label: t("editor.strikethrough"),
434
+ onClick: () => editor.chain().focus().toggleStrike().run()
435
+ }),
436
+ features.code && /* @__PURE__ */ jsx(ToolbarMenuItem, {
437
+ icon: EDITOR_ICONS.code,
438
+ active: editor.isActive("code"),
439
+ disabled: !isEditable,
440
+ label: t("editor.code"),
441
+ shortcut: "⌘E",
442
+ onClick: () => editor.chain().focus().toggleCode().run()
443
+ })
444
+ ]
445
+ })] });
446
+ $[27] = editor;
447
+ $[28] = features.code;
448
+ $[29] = features.strike;
449
+ $[30] = features.underline;
450
+ $[31] = hasMoreFormatting;
297
451
  $[32] = isEditable;
298
452
  $[33] = t;
299
- $[34] = t7;
300
- } else t7 = $[34];
301
- let t8;
302
- if ($[35] !== editor || $[36] !== features.codeBlock || $[37] !== isEditable || $[38] !== t) {
303
- t8 = features.codeBlock && /* @__PURE__ */ jsx(ToolbarButton, {
304
- icon: EDITOR_ICONS.codeBlock,
305
- active: editor.isActive("codeBlock"),
306
- disabled: !isEditable,
307
- title: t("editor.codeBlock"),
308
- onClick: () => editor.chain().focus().toggleCodeBlock().run()
309
- });
310
- $[35] = editor;
311
- $[36] = features.codeBlock;
312
- $[37] = isEditable;
313
- $[38] = t;
314
- $[39] = t8;
315
- } else t8 = $[39];
453
+ $[34] = t8;
454
+ } else t8 = $[34];
316
455
  let t9;
317
- if ($[40] !== t3 || $[41] !== t4 || $[42] !== t5 || $[43] !== t6 || $[44] !== t7 || $[45] !== t8) {
456
+ if ($[35] !== t6 || $[36] !== t7 || $[37] !== t8) {
318
457
  t9 = /* @__PURE__ */ jsxs(ToolbarGroup, { children: [
319
- t3,
320
- t4,
321
- t5,
322
458
  t6,
323
459
  t7,
324
460
  t8
325
461
  ] });
326
- $[40] = t3;
327
- $[41] = t4;
328
- $[42] = t5;
329
- $[43] = t6;
330
- $[44] = t7;
331
- $[45] = t8;
332
- $[46] = t9;
333
- } else t9 = $[46];
462
+ $[35] = t6;
463
+ $[36] = t7;
464
+ $[37] = t8;
465
+ $[38] = t9;
466
+ } else t9 = $[38];
334
467
  let t10;
335
- if ($[47] !== editor || $[48] !== features.bulletList || $[49] !== isEditable || $[50] !== t) {
336
- t10 = features.bulletList && /* @__PURE__ */ jsx(ToolbarButton, {
337
- icon: EDITOR_ICONS.bulletList,
338
- active: editor.isActive("bulletList"),
339
- disabled: !isEditable,
340
- title: t("editor.unorderedList"),
341
- onClick: () => editor.chain().focus().toggleBulletList().run()
342
- });
343
- $[47] = editor;
344
- $[48] = features.bulletList;
345
- $[49] = isEditable;
346
- $[50] = t;
347
- $[51] = t10;
348
- } else t10 = $[51];
349
- let t11;
350
- if ($[52] !== editor || $[53] !== features.orderedList || $[54] !== isEditable || $[55] !== t) {
351
- t11 = features.orderedList && /* @__PURE__ */ jsx(ToolbarButton, {
352
- icon: EDITOR_ICONS.orderedList,
353
- active: editor.isActive("orderedList"),
354
- disabled: !isEditable,
355
- title: t("editor.orderedList"),
356
- onClick: () => editor.chain().focus().toggleOrderedList().run()
357
- });
358
- $[52] = editor;
359
- $[53] = features.orderedList;
360
- $[54] = isEditable;
361
- $[55] = t;
362
- $[56] = t11;
363
- } else t11 = $[56];
364
- let t12;
365
- if ($[57] !== editor || $[58] !== features.blockquote || $[59] !== isEditable || $[60] !== t) {
366
- t12 = features.blockquote && /* @__PURE__ */ jsx(ToolbarButton, {
367
- icon: EDITOR_ICONS.blockquote,
368
- active: editor.isActive("blockquote"),
369
- disabled: !isEditable,
370
- title: t("editor.quote"),
371
- onClick: () => editor.chain().focus().toggleBlockquote().run()
372
- });
373
- $[57] = editor;
374
- $[58] = features.blockquote;
375
- $[59] = isEditable;
376
- $[60] = t;
377
- $[61] = t12;
378
- } else t12 = $[61];
379
- let t13;
380
- if ($[62] !== editor || $[63] !== features.horizontalRule || $[64] !== isEditable || $[65] !== t) {
381
- t13 = features.horizontalRule && /* @__PURE__ */ jsx(ToolbarButton, {
382
- icon: EDITOR_ICONS.horizontalRule,
383
- disabled: !isEditable,
384
- title: t("editor.horizontalRule"),
385
- onClick: () => editor.chain().focus().setHorizontalRule().run()
386
- });
387
- $[62] = editor;
388
- $[63] = features.horizontalRule;
389
- $[64] = isEditable;
390
- $[65] = t;
391
- $[66] = t13;
392
- } else t13 = $[66];
393
- let t14;
394
- if ($[67] !== t10 || $[68] !== t11 || $[69] !== t12 || $[70] !== t13) {
395
- t14 = /* @__PURE__ */ jsxs(ToolbarGroup, { children: [
396
- t10,
397
- t11,
398
- t12,
399
- t13
400
- ] });
401
- $[67] = t10;
402
- $[68] = t11;
403
- $[69] = t12;
404
- $[70] = t13;
405
- $[71] = t14;
406
- } else t14 = $[71];
407
- let t15;
408
- if ($[72] !== editor || $[73] !== features.align || $[74] !== isEditable || $[75] !== t) {
409
- t15 = features.align && /* @__PURE__ */ jsxs(ToolbarGroup, { children: [
410
- /* @__PURE__ */ jsx(ToolbarButton, {
411
- icon: EDITOR_ICONS.alignLeft,
412
- active: editor.isActive({ textAlign: "left" }),
468
+ if ($[39] !== editor || $[40] !== features.blockquote || $[41] !== features.bulletList || $[42] !== features.codeBlock || $[43] !== features.horizontalRule || $[44] !== features.orderedList || $[45] !== hasBlockMenu || $[46] !== isEditable || $[47] !== t) {
469
+ t10 = hasBlockMenu && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
470
+ nativeButton: false,
471
+ render: /* @__PURE__ */ jsx(ToolbarButton, {
472
+ icon: EDITOR_ICONS.blocks,
473
+ active: editor.isActive("bulletList") || editor.isActive("orderedList") || editor.isActive("blockquote") || editor.isActive("codeBlock"),
413
474
  disabled: !isEditable,
414
- title: t("editor.alignLeft"),
415
- onClick: () => editor.chain().focus().setTextAlign("left").run()
416
- }),
417
- /* @__PURE__ */ jsx(ToolbarButton, {
418
- icon: EDITOR_ICONS.alignCenter,
419
- active: editor.isActive({ textAlign: "center" }),
420
- disabled: !isEditable,
421
- title: t("editor.alignCenter"),
422
- onClick: () => editor.chain().focus().setTextAlign("center").run()
423
- }),
424
- /* @__PURE__ */ jsx(ToolbarButton, {
425
- icon: EDITOR_ICONS.alignRight,
426
- active: editor.isActive({ textAlign: "right" }),
475
+ title: t("editor.blocks")
476
+ })
477
+ }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
478
+ align: "start",
479
+ className: "w-56",
480
+ children: [
481
+ /* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("editor.list") }),
482
+ features.bulletList && /* @__PURE__ */ jsx(ToolbarMenuItem, {
483
+ icon: EDITOR_ICONS.bulletList,
484
+ active: editor.isActive("bulletList"),
485
+ disabled: !isEditable,
486
+ label: t("editor.unorderedList"),
487
+ onClick: () => editor.chain().focus().toggleBulletList().run()
488
+ }),
489
+ features.orderedList && /* @__PURE__ */ jsx(ToolbarMenuItem, {
490
+ icon: EDITOR_ICONS.orderedList,
491
+ active: editor.isActive("orderedList"),
492
+ disabled: !isEditable,
493
+ label: t("editor.orderedList"),
494
+ onClick: () => editor.chain().focus().toggleOrderedList().run()
495
+ }),
496
+ (features.blockquote || features.codeBlock || features.horizontalRule) && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
497
+ features.blockquote && /* @__PURE__ */ jsx(ToolbarMenuItem, {
498
+ icon: EDITOR_ICONS.blockquote,
499
+ active: editor.isActive("blockquote"),
500
+ disabled: !isEditable,
501
+ label: t("editor.quote"),
502
+ onClick: () => editor.chain().focus().toggleBlockquote().run()
503
+ }),
504
+ features.codeBlock && /* @__PURE__ */ jsx(ToolbarMenuItem, {
505
+ icon: EDITOR_ICONS.codeBlock,
506
+ active: editor.isActive("codeBlock"),
507
+ disabled: !isEditable,
508
+ label: t("editor.codeBlock"),
509
+ onClick: () => editor.chain().focus().toggleCodeBlock().run()
510
+ }),
511
+ features.horizontalRule && /* @__PURE__ */ jsx(ToolbarMenuItem, {
512
+ icon: EDITOR_ICONS.horizontalRule,
513
+ disabled: !isEditable,
514
+ label: t("editor.horizontalRule"),
515
+ onClick: () => editor.chain().focus().setHorizontalRule().run()
516
+ })
517
+ ]
518
+ })] }) });
519
+ $[39] = editor;
520
+ $[40] = features.blockquote;
521
+ $[41] = features.bulletList;
522
+ $[42] = features.codeBlock;
523
+ $[43] = features.horizontalRule;
524
+ $[44] = features.orderedList;
525
+ $[45] = hasBlockMenu;
526
+ $[46] = isEditable;
527
+ $[47] = t;
528
+ $[48] = t10;
529
+ } else t10 = $[48];
530
+ let t11;
531
+ if ($[49] !== currentAlignment || $[50] !== currentAlignmentOption || $[51] !== editor || $[52] !== features.align || $[53] !== isEditable || $[54] !== t) {
532
+ t11 = features.align && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
533
+ nativeButton: false,
534
+ render: /* @__PURE__ */ jsx(ToolbarButton, {
535
+ icon: currentAlignmentOption.icon,
536
+ active: currentAlignment !== "left",
427
537
  disabled: !isEditable,
428
- title: t("editor.alignRight"),
429
- onClick: () => editor.chain().focus().setTextAlign("right").run()
430
- }),
431
- /* @__PURE__ */ jsx(ToolbarButton, {
432
- icon: EDITOR_ICONS.alignJustify,
433
- active: editor.isActive({ textAlign: "justify" }),
538
+ title: t("editor.alignment")
539
+ })
540
+ }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
541
+ align: "start",
542
+ className: "w-56",
543
+ children: [/* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("editor.alignment") }), /* @__PURE__ */ jsx(DropdownMenuRadioGroup, {
544
+ value: currentAlignment,
545
+ onValueChange: (value_0) => {
546
+ editor.chain().focus().setTextAlign(value_0).run();
547
+ },
548
+ children: ALIGNMENT_OPTIONS.map((option_4) => /* @__PURE__ */ jsxs(DropdownMenuRadioItem, {
549
+ value: option_4.value,
550
+ disabled: !isEditable,
551
+ children: [/* @__PURE__ */ jsx(Icon, {
552
+ "aria-hidden": "true",
553
+ icon: option_4.icon
554
+ }), /* @__PURE__ */ jsx("span", { children: t(option_4.labelKey) })]
555
+ }, option_4.value))
556
+ })]
557
+ })] }) });
558
+ $[49] = currentAlignment;
559
+ $[50] = currentAlignmentOption;
560
+ $[51] = editor;
561
+ $[52] = features.align;
562
+ $[53] = isEditable;
563
+ $[54] = t;
564
+ $[55] = t11;
565
+ } else t11 = $[55];
566
+ let t12;
567
+ if ($[56] !== editor || $[57] !== features.image || $[58] !== features.link || $[59] !== features.table || $[60] !== features.tableControls || $[61] !== hasInsertMenu || $[62] !== inTable || $[63] !== isEditable || $[64] !== onImageClick || $[65] !== onLinkClick || $[66] !== onTableClick || $[67] !== t) {
568
+ t12 = hasInsertMenu && /* @__PURE__ */ jsxs(ToolbarGroup, { children: [/* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
569
+ nativeButton: false,
570
+ render: /* @__PURE__ */ jsx(ToolbarButton, {
571
+ icon: EDITOR_ICONS.insert,
572
+ active: editor.isActive("link"),
434
573
  disabled: !isEditable,
435
- title: t("editor.alignJustify"),
436
- onClick: () => editor.chain().focus().setTextAlign("justify").run()
574
+ title: t("editor.insert")
437
575
  })
438
- ] });
439
- $[72] = editor;
440
- $[73] = features.align;
441
- $[74] = isEditable;
442
- $[75] = t;
443
- $[76] = t15;
444
- } else t15 = $[76];
445
- let t16;
446
- if ($[77] !== editor || $[78] !== features.link || $[79] !== isEditable || $[80] !== onLinkClick || $[81] !== t) {
447
- t16 = features.link && /* @__PURE__ */ jsx(ToolbarButton, {
448
- icon: EDITOR_ICONS.link,
449
- active: editor.isActive("link"),
450
- disabled: !isEditable,
451
- title: t("editor.link"),
452
- shortcut: "⌘K",
453
- onClick: onLinkClick
454
- });
455
- $[77] = editor;
456
- $[78] = features.link;
457
- $[79] = isEditable;
458
- $[80] = onLinkClick;
459
- $[81] = t;
460
- $[82] = t16;
461
- } else t16 = $[82];
462
- let t17;
463
- if ($[83] !== features.image || $[84] !== isEditable || $[85] !== onImageClick || $[86] !== t) {
464
- t17 = features.image && /* @__PURE__ */ jsx(ToolbarButton, {
465
- icon: EDITOR_ICONS.image,
466
- disabled: !isEditable,
467
- title: t("editor.image"),
468
- onClick: onImageClick
469
- });
470
- $[83] = features.image;
471
- $[84] = isEditable;
472
- $[85] = onImageClick;
473
- $[86] = t;
474
- $[87] = t17;
475
- } else t17 = $[87];
476
- let t18;
477
- if ($[88] !== editor || $[89] !== features.table || $[90] !== features.tableControls || $[91] !== inTable || $[92] !== isEditable || $[93] !== onTableClick || $[94] !== t) {
478
- t18 = features.table && (features.tableControls ? /* @__PURE__ */ jsx(TableControls, {
576
+ }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
577
+ align: "start",
578
+ className: "w-56",
579
+ children: [
580
+ /* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("editor.insert") }),
581
+ features.link && /* @__PURE__ */ jsx(ToolbarMenuItem, {
582
+ icon: EDITOR_ICONS.link,
583
+ active: editor.isActive("link"),
584
+ disabled: !isEditable,
585
+ label: t("editor.link"),
586
+ shortcut: "⌘K",
587
+ onClick: onLinkClick
588
+ }),
589
+ features.image && /* @__PURE__ */ jsx(ToolbarMenuItem, {
590
+ icon: EDITOR_ICONS.image,
591
+ disabled: !isEditable,
592
+ label: t("editor.image"),
593
+ onClick: onImageClick
594
+ }),
595
+ features.table && /* @__PURE__ */ jsx(ToolbarMenuItem, {
596
+ icon: EDITOR_ICONS.table,
597
+ active: inTable,
598
+ disabled: !isEditable,
599
+ label: t("editor.table"),
600
+ onClick: onTableClick
601
+ })
602
+ ]
603
+ })] }), features.table && features.tableControls && inTable && /* @__PURE__ */ jsx(TableControls, {
479
604
  editor,
480
605
  disabled: !isEditable,
481
606
  inTable,
@@ -485,56 +610,49 @@ function RichTextToolbar(t0) {
485
610
  disabled: !isEditable,
486
611
  title: t("editor.table")
487
612
  })
488
- }) : /* @__PURE__ */ jsx(ToolbarButton, {
489
- icon: EDITOR_ICONS.table,
490
- active: inTable,
491
- disabled: !isEditable,
492
- title: t("editor.table"),
493
- onClick: onTableClick
494
- }));
495
- $[88] = editor;
496
- $[89] = features.table;
497
- $[90] = features.tableControls;
498
- $[91] = inTable;
499
- $[92] = isEditable;
500
- $[93] = onTableClick;
501
- $[94] = t;
502
- $[95] = t18;
503
- } else t18 = $[95];
504
- let t19;
505
- if ($[96] !== t16 || $[97] !== t17 || $[98] !== t18) {
506
- t19 = /* @__PURE__ */ jsxs(ToolbarGroup, { children: [
507
- t16,
508
- t17,
509
- t18
510
- ] });
511
- $[96] = t16;
512
- $[97] = t17;
513
- $[98] = t18;
514
- $[99] = t19;
515
- } else t19 = $[99];
516
- let t20;
517
- if ($[100] !== t1 || $[101] !== t14 || $[102] !== t15 || $[103] !== t19 || $[104] !== t2 || $[105] !== t9) {
518
- t20 = /* @__PURE__ */ jsxs("div", {
519
- className: "bg-muted flex flex-wrap items-center gap-1.5 border-b p-1.5",
613
+ })] });
614
+ $[56] = editor;
615
+ $[57] = features.image;
616
+ $[58] = features.link;
617
+ $[59] = features.table;
618
+ $[60] = features.tableControls;
619
+ $[61] = hasInsertMenu;
620
+ $[62] = inTable;
621
+ $[63] = isEditable;
622
+ $[64] = onImageClick;
623
+ $[65] = onLinkClick;
624
+ $[66] = onTableClick;
625
+ $[67] = t;
626
+ $[68] = t12;
627
+ } else t12 = $[68];
628
+ let t13;
629
+ if ($[69] !== t10 || $[70] !== t11 || $[71] !== t12 || $[72] !== t3 || $[73] !== t4 || $[74] !== t5 || $[75] !== t9) {
630
+ t13 = /* @__PURE__ */ jsxs("div", {
631
+ "aria-label": t3,
632
+ className: "qp-rich-text-editor__toolbar border-border-subtle bg-surface-low flex flex-nowrap items-center gap-1.5 overflow-x-auto border-b p-1.5",
633
+ role: "toolbar",
520
634
  children: [
521
- t1,
522
- t2,
635
+ t4,
636
+ t5,
523
637
  t9,
524
- t14,
525
- t15,
526
- t19
638
+ t10,
639
+ t11,
640
+ t12
527
641
  ]
528
642
  });
529
- $[100] = t1;
530
- $[101] = t14;
531
- $[102] = t15;
532
- $[103] = t19;
533
- $[104] = t2;
534
- $[105] = t9;
535
- $[106] = t20;
536
- } else t20 = $[106];
537
- return t20;
643
+ $[69] = t10;
644
+ $[70] = t11;
645
+ $[71] = t12;
646
+ $[72] = t3;
647
+ $[73] = t4;
648
+ $[74] = t5;
649
+ $[75] = t9;
650
+ $[76] = t13;
651
+ } else t13 = $[76];
652
+ return t13;
653
+ }
654
+ function _temp(option_2) {
655
+ return option_2.group === "heading";
538
656
  }
539
657
 
540
658
  //#endregion