@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
@@ -4,7 +4,6 @@ import { Button } from "../../ui/button.mjs";
4
4
  import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue } from "../../ui/select.mjs";
5
5
  import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger } from "../../ui/dropdown-menu.mjs";
6
6
  import { TableControls } from "./table-controls.mjs";
7
- import { c } from "react/compiler-runtime";
8
7
  import { Icon } from "@iconify/react";
9
8
  import "react";
10
9
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -109,550 +108,296 @@ function getCurrentAlignment(editor) {
109
108
  /**
110
109
  * Icon-based toolbar button with tooltip showing keyboard shortcuts
111
110
  */
112
- function ToolbarButton(t0) {
113
- const $ = c(30);
114
- let active;
115
- let children;
116
- let className;
117
- let disabled;
118
- let iconName;
119
- let onClick;
120
- let rest;
121
- let shortcut;
122
- let title;
123
- if ($[0] !== t0) {
124
- ({active, disabled, title, onClick, icon: iconName, children, shortcut, className, ...rest} = t0);
125
- $[0] = t0;
126
- $[1] = active;
127
- $[2] = children;
128
- $[3] = className;
129
- $[4] = disabled;
130
- $[5] = iconName;
131
- $[6] = onClick;
132
- $[7] = rest;
133
- $[8] = shortcut;
134
- $[9] = title;
135
- } else {
136
- active = $[1];
137
- children = $[2];
138
- className = $[3];
139
- disabled = $[4];
140
- iconName = $[5];
141
- onClick = $[6];
142
- rest = $[7];
143
- shortcut = $[8];
144
- title = $[9];
145
- }
146
- let t1;
147
- if ($[10] !== shortcut || $[11] !== title) {
148
- t1 = !title && !shortcut ? void 0 : shortcut ? `${title || ""} (${shortcut})`.trim() : title;
149
- $[10] = shortcut;
150
- $[11] = title;
151
- $[12] = t1;
152
- } else t1 = $[12];
153
- const tooltipText = t1;
111
+ function ToolbarButton({ active, disabled, title, onClick, icon: iconName, children, shortcut, className, ...rest }) {
112
+ const tooltipText = !title && !shortcut ? void 0 : shortcut ? `${title || ""} (${shortcut})`.trim() : title;
154
113
  const iconSuffix = active ? "-fill" : "";
155
- const buttonSize = iconName ? "icon-sm" : "xs";
156
- const t2 = typeof active === "boolean" ? active : void 0;
157
- let t3;
158
- if ($[13] !== 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);
160
- $[13] = className;
161
- $[14] = t3;
162
- } else t3 = $[14];
163
- let t4;
164
- if ($[15] !== children || $[16] !== iconName || $[17] !== iconSuffix) {
165
- t4 = iconName ? /* @__PURE__ */ jsx(Icon, {
114
+ return /* @__PURE__ */ jsx(Button, {
115
+ type: "button",
116
+ variant: "ghost",
117
+ size: iconName ? "icon-sm" : "xs",
118
+ "aria-label": title,
119
+ "aria-pressed": typeof active === "boolean" ? active : void 0,
120
+ "data-active": active,
121
+ "data-rich-text-toolbar-button": "",
122
+ title: tooltipText,
123
+ disabled,
124
+ onClick,
125
+ className: 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),
126
+ ...rest,
127
+ children: iconName ? /* @__PURE__ */ jsx(Icon, {
166
128
  "aria-hidden": "true",
167
129
  icon: `${iconName}${iconSuffix}`,
168
130
  width: 16,
169
131
  height: 16
170
- }) : children;
171
- $[15] = children;
172
- $[16] = iconName;
173
- $[17] = iconSuffix;
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, {
179
- type: "button",
180
- variant: "ghost",
181
- size: buttonSize,
182
- "aria-label": title,
183
- "aria-pressed": t2,
184
- "data-active": active,
185
- "data-rich-text-toolbar-button": "",
186
- title: tooltipText,
187
- disabled,
188
- onClick,
189
- className: t3,
190
- ...rest,
191
- children: t4
192
- });
193
- $[19] = active;
194
- $[20] = buttonSize;
195
- $[21] = disabled;
196
- $[22] = onClick;
197
- $[23] = rest;
198
- $[24] = t2;
199
- $[25] = t3;
200
- $[26] = t4;
201
- $[27] = title;
202
- $[28] = tooltipText;
203
- $[29] = t5;
204
- } else t5 = $[29];
205
- return t5;
132
+ }) : children
133
+ });
206
134
  }
207
135
  /**
208
136
  * Toolbar button group with divider
209
137
  */
210
- function ToolbarGroup(t0) {
211
- const $ = c(2);
212
- const { children } = t0;
213
- let t1;
214
- if ($[0] !== children) {
215
- t1 = /* @__PURE__ */ jsx("div", {
216
- className: "flex items-center gap-1",
217
- role: "group",
218
- children
219
- });
220
- $[0] = children;
221
- $[1] = t1;
222
- } else t1 = $[1];
223
- return t1;
138
+ function ToolbarGroup({ children }) {
139
+ return /* @__PURE__ */ jsx("div", {
140
+ className: "flex items-center gap-1",
141
+ role: "group",
142
+ children
143
+ });
224
144
  }
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;
145
+ function ToolbarMenuItem({ active, disabled, icon, label, onClick, shortcut }) {
146
+ return /* @__PURE__ */ jsxs(DropdownMenuItem, {
147
+ "aria-current": active ? "true" : void 0,
148
+ disabled,
149
+ onClick,
150
+ className: cn("min-w-44", active ? "bg-accent text-accent-foreground" : ""),
151
+ children: [
152
+ /* @__PURE__ */ jsx(Icon, {
153
+ "aria-hidden": "true",
154
+ icon
155
+ }),
156
+ /* @__PURE__ */ jsx("span", { children: label }),
157
+ shortcut ? /* @__PURE__ */ jsx(DropdownMenuShortcut, { children: shortcut }) : active ? /* @__PURE__ */ jsx(Icon, {
158
+ "aria-hidden": "true",
159
+ icon: "ph:check",
160
+ className: "ml-auto size-3.5"
161
+ }) : null
162
+ ]
163
+ });
285
164
  }
286
165
  /**
287
166
  * Main toolbar component with icon-based buttons
288
167
  */
289
- function RichTextToolbar(t0) {
290
- const $ = c(77);
291
- const { editor, features, disabled, headingValue, onHeadingChange, onLinkClick, onImageClick, onTableClick, inTable } = t0;
168
+ function RichTextToolbar({ editor, features, disabled, headingValue, onHeadingChange, onLinkClick, onImageClick, onTableClick, inTable }) {
292
169
  const { t } = useTranslation();
293
170
  const isEditable = !disabled;
294
- let t1;
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;
171
+ const currentAlignment = getCurrentAlignment(editor);
172
+ const currentAlignmentOption = ALIGNMENT_OPTIONS.find((option) => option.value === currentAlignment) ?? ALIGNMENT_OPTIONS[0];
308
173
  const hasMoreFormatting = features.underline || features.strike || features.code;
309
174
  const hasBlockMenu = features.bulletList || features.orderedList || features.blockquote || features.codeBlock || features.horizontalRule;
310
175
  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, {
320
- icon: EDITOR_ICONS.undo,
321
- disabled: !isEditable || !editor.can().undo(),
322
- title: t("editor.undo"),
323
- shortcut: "⌘Z",
324
- onClick: () => editor.chain().focus().undo().run()
325
- }), /* @__PURE__ */ jsx(ToolbarButton, {
326
- icon: EDITOR_ICONS.redo,
327
- disabled: !isEditable || !editor.can().redo(),
328
- title: t("editor.redo"),
329
- shortcut: "⌘⇧Z",
330
- onClick: () => editor.chain().focus().redo().run()
331
- })] });
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, {
341
- value: headingValue,
342
- disabled: !isEditable,
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
- })]
366
- }) });
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, {
377
- icon: EDITOR_ICONS.bold,
378
- active: editor.isActive("bold"),
379
- disabled: !isEditable,
380
- title: t("editor.bold"),
381
- shortcut: "⌘B",
382
- onClick: () => editor.chain().focus().toggleBold().run()
383
- });
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, {
393
- icon: EDITOR_ICONS.italic,
394
- active: editor.isActive("italic"),
395
- disabled: !isEditable,
396
- title: t("editor.italic"),
397
- shortcut: "⌘I",
398
- onClick: () => editor.chain().focus().toggleItalic().run()
399
- });
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"),
176
+ return /* @__PURE__ */ jsxs("div", {
177
+ "aria-label": t("editor.richTextToolbar"),
178
+ 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",
179
+ role: "toolbar",
180
+ children: [
181
+ features.history && /* @__PURE__ */ jsxs(ToolbarGroup, { children: [/* @__PURE__ */ jsx(ToolbarButton, {
182
+ icon: EDITOR_ICONS.undo,
183
+ disabled: !isEditable || !editor.can().undo(),
184
+ title: t("editor.undo"),
185
+ shortcut: "⌘Z",
186
+ onClick: () => editor.chain().focus().undo().run()
187
+ }), /* @__PURE__ */ jsx(ToolbarButton, {
188
+ icon: EDITOR_ICONS.redo,
189
+ disabled: !isEditable || !editor.can().redo(),
190
+ title: t("editor.redo"),
191
+ shortcut: "⌘⇧Z",
192
+ onClick: () => editor.chain().focus().redo().run()
193
+ })] }),
194
+ features.heading && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxs(Select, {
195
+ value: headingValue,
413
196
  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"),
197
+ onValueChange: (value) => {
198
+ if (typeof value === "string") onHeadingChange(value);
199
+ },
200
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
201
+ "aria-label": t("editor.blockType"),
202
+ className: "h-8 min-w-[136px] px-2.5 text-sm",
203
+ size: "sm",
204
+ children: /* @__PURE__ */ jsx(SelectValue, { children: HEADING_OPTIONS.find((option) => option.value === headingValue)?.value ? getHeadingOptionLabel(HEADING_OPTIONS.find((option) => option.value === headingValue)?.value ?? "paragraph", t) : t("editor.paragraph") })
205
+ }), /* @__PURE__ */ jsxs(SelectContent, {
206
+ align: "start",
207
+ className: "min-w-[136px]",
208
+ children: [
209
+ /* @__PURE__ */ jsxs(SelectGroup, { children: [/* @__PURE__ */ jsx(SelectLabel, { children: t("editor.textBlocks") }), /* @__PURE__ */ jsx(SelectItem, {
210
+ value: "paragraph",
211
+ children: t("editor.paragraph")
212
+ })] }),
213
+ /* @__PURE__ */ jsx(SelectSeparator, {}),
214
+ /* @__PURE__ */ jsxs(SelectGroup, { children: [/* @__PURE__ */ jsx(SelectLabel, { children: t("editor.headings") }), HEADING_OPTIONS.filter((option) => option.group === "heading").map((option) => /* @__PURE__ */ jsx(SelectItem, {
215
+ value: option.value,
216
+ children: getHeadingOptionLabel(option.value, t)
217
+ }, option.value))] })
218
+ ]
219
+ })]
220
+ }) }),
221
+ /* @__PURE__ */ jsxs(ToolbarGroup, { children: [
222
+ features.bold && /* @__PURE__ */ jsx(ToolbarButton, {
223
+ icon: EDITOR_ICONS.bold,
224
+ active: editor.isActive("bold"),
424
225
  disabled: !isEditable,
425
- label: t("editor.underline"),
426
- shortcut: "⌘U",
427
- onClick: () => editor.chain().focus().toggleUnderline().run()
226
+ title: t("editor.bold"),
227
+ shortcut: "⌘B",
228
+ onClick: () => editor.chain().focus().toggleBold().run()
428
229
  }),
429
- features.strike && /* @__PURE__ */ jsx(ToolbarMenuItem, {
430
- icon: EDITOR_ICONS.strikethrough,
431
- active: editor.isActive("strike"),
230
+ features.italic && /* @__PURE__ */ jsx(ToolbarButton, {
231
+ icon: EDITOR_ICONS.italic,
232
+ active: editor.isActive("italic"),
432
233
  disabled: !isEditable,
433
- label: t("editor.strikethrough"),
434
- onClick: () => editor.chain().focus().toggleStrike().run()
234
+ title: t("editor.italic"),
235
+ shortcut: "⌘I",
236
+ onClick: () => editor.chain().focus().toggleItalic().run()
435
237
  }),
436
- features.code && /* @__PURE__ */ jsx(ToolbarMenuItem, {
437
- icon: EDITOR_ICONS.code,
438
- active: editor.isActive("code"),
238
+ hasMoreFormatting && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
239
+ nativeButton: false,
240
+ render: /* @__PURE__ */ jsx(ToolbarButton, {
241
+ icon: EDITOR_ICONS.formatting,
242
+ active: editor.isActive("underline") || editor.isActive("strike") || editor.isActive("code"),
243
+ disabled: !isEditable,
244
+ title: t("editor.moreFormatting")
245
+ })
246
+ }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
247
+ align: "start",
248
+ className: "w-56",
249
+ children: [
250
+ /* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("editor.formatting") }),
251
+ features.underline && /* @__PURE__ */ jsx(ToolbarMenuItem, {
252
+ icon: EDITOR_ICONS.underline,
253
+ active: editor.isActive("underline"),
254
+ disabled: !isEditable,
255
+ label: t("editor.underline"),
256
+ shortcut: "⌘U",
257
+ onClick: () => editor.chain().focus().toggleUnderline().run()
258
+ }),
259
+ features.strike && /* @__PURE__ */ jsx(ToolbarMenuItem, {
260
+ icon: EDITOR_ICONS.strikethrough,
261
+ active: editor.isActive("strike"),
262
+ disabled: !isEditable,
263
+ label: t("editor.strikethrough"),
264
+ onClick: () => editor.chain().focus().toggleStrike().run()
265
+ }),
266
+ features.code && /* @__PURE__ */ jsx(ToolbarMenuItem, {
267
+ icon: EDITOR_ICONS.code,
268
+ active: editor.isActive("code"),
269
+ disabled: !isEditable,
270
+ label: t("editor.code"),
271
+ shortcut: "⌘E",
272
+ onClick: () => editor.chain().focus().toggleCode().run()
273
+ })
274
+ ]
275
+ })] })
276
+ ] }),
277
+ hasBlockMenu && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
278
+ nativeButton: false,
279
+ render: /* @__PURE__ */ jsx(ToolbarButton, {
280
+ icon: EDITOR_ICONS.blocks,
281
+ active: editor.isActive("bulletList") || editor.isActive("orderedList") || editor.isActive("blockquote") || editor.isActive("codeBlock"),
439
282
  disabled: !isEditable,
440
- label: t("editor.code"),
441
- shortcut: "⌘E",
442
- onClick: () => editor.chain().focus().toggleCode().run()
283
+ title: t("editor.blocks")
443
284
  })
444
- ]
445
- })] });
446
- $[27] = editor;
447
- $[28] = features.code;
448
- $[29] = features.strike;
449
- $[30] = features.underline;
450
- $[31] = hasMoreFormatting;
451
- $[32] = isEditable;
452
- $[33] = t;
453
- $[34] = t8;
454
- } else t8 = $[34];
455
- let t9;
456
- if ($[35] !== t6 || $[36] !== t7 || $[37] !== t8) {
457
- t9 = /* @__PURE__ */ jsxs(ToolbarGroup, { children: [
458
- t6,
459
- t7,
460
- t8
461
- ] });
462
- $[35] = t6;
463
- $[36] = t7;
464
- $[37] = t8;
465
- $[38] = t9;
466
- } else t9 = $[38];
467
- let t10;
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"),
474
- disabled: !isEditable,
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,
285
+ }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
286
+ align: "start",
287
+ className: "w-56",
288
+ children: [
289
+ /* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("editor.list") }),
290
+ features.bulletList && /* @__PURE__ */ jsx(ToolbarMenuItem, {
291
+ icon: EDITOR_ICONS.bulletList,
292
+ active: editor.isActive("bulletList"),
293
+ disabled: !isEditable,
294
+ label: t("editor.unorderedList"),
295
+ onClick: () => editor.chain().focus().toggleBulletList().run()
296
+ }),
297
+ features.orderedList && /* @__PURE__ */ jsx(ToolbarMenuItem, {
298
+ icon: EDITOR_ICONS.orderedList,
299
+ active: editor.isActive("orderedList"),
300
+ disabled: !isEditable,
301
+ label: t("editor.orderedList"),
302
+ onClick: () => editor.chain().focus().toggleOrderedList().run()
303
+ }),
304
+ (features.blockquote || features.codeBlock || features.horizontalRule) && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
305
+ features.blockquote && /* @__PURE__ */ jsx(ToolbarMenuItem, {
306
+ icon: EDITOR_ICONS.blockquote,
307
+ active: editor.isActive("blockquote"),
308
+ disabled: !isEditable,
309
+ label: t("editor.quote"),
310
+ onClick: () => editor.chain().focus().toggleBlockquote().run()
311
+ }),
312
+ features.codeBlock && /* @__PURE__ */ jsx(ToolbarMenuItem, {
313
+ icon: EDITOR_ICONS.codeBlock,
314
+ active: editor.isActive("codeBlock"),
315
+ disabled: !isEditable,
316
+ label: t("editor.codeBlock"),
317
+ onClick: () => editor.chain().focus().toggleCodeBlock().run()
318
+ }),
319
+ features.horizontalRule && /* @__PURE__ */ jsx(ToolbarMenuItem, {
320
+ icon: EDITOR_ICONS.horizontalRule,
321
+ disabled: !isEditable,
322
+ label: t("editor.horizontalRule"),
323
+ onClick: () => editor.chain().focus().setHorizontalRule().run()
324
+ })
325
+ ]
326
+ })] }) }),
327
+ features.align && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
328
+ nativeButton: false,
329
+ render: /* @__PURE__ */ jsx(ToolbarButton, {
330
+ icon: currentAlignmentOption.icon,
331
+ active: currentAlignment !== "left",
513
332
  disabled: !isEditable,
514
- label: t("editor.horizontalRule"),
515
- onClick: () => editor.chain().focus().setHorizontalRule().run()
333
+ title: t("editor.alignment")
516
334
  })
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",
537
- disabled: !isEditable,
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"),
573
- disabled: !isEditable,
574
- title: t("editor.insert")
575
- })
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,
335
+ }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
336
+ align: "start",
337
+ className: "w-56",
338
+ children: [/* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("editor.alignment") }), /* @__PURE__ */ jsx(DropdownMenuRadioGroup, {
339
+ value: currentAlignment,
340
+ onValueChange: (value) => {
341
+ editor.chain().focus().setTextAlign(value).run();
342
+ },
343
+ children: ALIGNMENT_OPTIONS.map((option) => /* @__PURE__ */ jsxs(DropdownMenuRadioItem, {
344
+ value: option.value,
345
+ disabled: !isEditable,
346
+ children: [/* @__PURE__ */ jsx(Icon, {
347
+ "aria-hidden": "true",
348
+ icon: option.icon
349
+ }), /* @__PURE__ */ jsx("span", { children: t(option.labelKey) })]
350
+ }, option.value))
351
+ })]
352
+ })] }) }),
353
+ hasInsertMenu && /* @__PURE__ */ jsxs(ToolbarGroup, { children: [/* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
354
+ nativeButton: false,
355
+ render: /* @__PURE__ */ jsx(ToolbarButton, {
356
+ icon: EDITOR_ICONS.insert,
583
357
  active: editor.isActive("link"),
584
358
  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, {
359
+ title: t("editor.insert")
360
+ })
361
+ }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
362
+ align: "start",
363
+ className: "w-56",
364
+ children: [
365
+ /* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("editor.insert") }),
366
+ features.link && /* @__PURE__ */ jsx(ToolbarMenuItem, {
367
+ icon: EDITOR_ICONS.link,
368
+ active: editor.isActive("link"),
369
+ disabled: !isEditable,
370
+ label: t("editor.link"),
371
+ shortcut: "⌘K",
372
+ onClick: onLinkClick
373
+ }),
374
+ features.image && /* @__PURE__ */ jsx(ToolbarMenuItem, {
375
+ icon: EDITOR_ICONS.image,
376
+ disabled: !isEditable,
377
+ label: t("editor.image"),
378
+ onClick: onImageClick
379
+ }),
380
+ features.table && /* @__PURE__ */ jsx(ToolbarMenuItem, {
381
+ icon: EDITOR_ICONS.table,
382
+ active: inTable,
383
+ disabled: !isEditable,
384
+ label: t("editor.table"),
385
+ onClick: onTableClick
386
+ })
387
+ ]
388
+ })] }), features.table && features.tableControls && inTable && /* @__PURE__ */ jsx(TableControls, {
389
+ editor,
390
+ disabled: !isEditable,
391
+ inTable,
392
+ triggerButton: /* @__PURE__ */ jsx(ToolbarButton, {
596
393
  icon: EDITOR_ICONS.table,
597
394
  active: inTable,
598
395
  disabled: !isEditable,
599
- label: t("editor.table"),
600
- onClick: onTableClick
396
+ title: t("editor.table")
601
397
  })
602
- ]
603
- })] }), features.table && features.tableControls && inTable && /* @__PURE__ */ jsx(TableControls, {
604
- editor,
605
- disabled: !isEditable,
606
- inTable,
607
- triggerButton: /* @__PURE__ */ jsx(ToolbarButton, {
608
- icon: EDITOR_ICONS.table,
609
- active: inTable,
610
- disabled: !isEditable,
611
- title: t("editor.table")
612
- })
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",
634
- children: [
635
- t4,
636
- t5,
637
- t9,
638
- t10,
639
- t11,
640
- t12
641
- ]
642
- });
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";
398
+ })] })
399
+ ]
400
+ });
656
401
  }
657
402
 
658
403
  //#endregion