@erxes/ui 3.4.2-next.4 → 3.4.16-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/README.md +8 -2
  2. package/chunks/{chunk-ZF6XCB7I.js → chunk-4CCLUOX6.js} +17 -13
  3. package/chunks/chunk-5Z3GGJHV.js +228 -0
  4. package/chunks/chunk-7O4K7V5O.js +72 -0
  5. package/chunks/chunk-AJCSQFCK.js +11 -0
  6. package/chunks/{chunk-5AYIRXXG.js → chunk-D6HNEGMV.js} +47 -19
  7. package/chunks/{chunk-PHBECHTA.js → chunk-GEVRIBPF.js} +58 -33
  8. package/chunks/{chunk-XJGTFZFD.js → chunk-GF3RIWOX.js} +2675 -2395
  9. package/chunks/{chunk-TMUQ5KOJ.js → chunk-GZ7VO7KA.js} +2 -2
  10. package/chunks/{chunk-7JKJSTQ6.js → chunk-HHT5SPZG.js} +1 -1
  11. package/chunks/{chunk-JKXVRU5D.js → chunk-I7XARNX4.js} +6 -0
  12. package/chunks/chunk-INFZPSGC.js +44 -0
  13. package/chunks/{chunk-67XHII4F.js → chunk-JKEWLTH7.js} +1 -1
  14. package/chunks/{chunk-KK6WMCQJ.js → chunk-JMDEHBWJ.js} +2 -0
  15. package/chunks/chunk-NCKIHIJR.js +9 -0
  16. package/chunks/{chunk-3GQN7K6A.js → chunk-OMGBQTKQ.js} +1 -1
  17. package/chunks/{chunk-NMKI4CJI.js → chunk-R7LWDDDY.js} +1 -1
  18. package/chunks/{chunk-ZRETEI5F.js → chunk-RRL4XQSY.js} +1 -1
  19. package/chunks/chunk-U46BZAPJ.js +134 -0
  20. package/chunks/chunk-UC7SM7BM.js +55 -0
  21. package/chunks/{chunk-Y5IJGIV3.js → chunk-V42CIN6H.js} +13 -11
  22. package/chunks/chunk-WOOM5JC4.js +82 -0
  23. package/chunks/{chunk-ZOTE5P5Q.js → chunk-X2W2IRYX.js} +10 -8
  24. package/chunks/{chunk-HXTLWTQH.js → chunk-XGRCG2DK.js} +45 -30
  25. package/chunks/chunk-Z37GI372.js +34 -0
  26. package/chunks/{chunk-O365JEFR.js → chunk-ZGLCEJEN.js} +12 -5
  27. package/components/choicebox-group.js +75 -66
  28. package/components/collapsible.js +75 -66
  29. package/components/color-picker.js +75 -66
  30. package/components/combobox.js +3 -3
  31. package/components/command.js +2 -2
  32. package/components/dialog.js +1 -1
  33. package/components/index.d.ts +1 -0
  34. package/components/index.js +84 -72
  35. package/components/input-otp.d.ts +36 -0
  36. package/components/input-otp.js +9 -0
  37. package/components/multiselect.js +75 -66
  38. package/components/sheet.d.ts +4 -2
  39. package/components/sheet.js +1 -1
  40. package/components/sidebar/context.js +2 -2
  41. package/components/sidebar/menu-sub.js +2 -2
  42. package/components/sidebar/menu.js +2 -2
  43. package/components/sidebar/root.js +4 -4
  44. package/components/sidebar/trigger.js +2 -2
  45. package/components/sidebar.js +7 -7
  46. package/components/upload.js +75 -66
  47. package/constants/SexCodes.js +3 -3
  48. package/constants/index.js +3 -3
  49. package/fonts.css +5 -0
  50. package/hooks/index.js +76 -67
  51. package/hooks/use-confirm.js +75 -66
  52. package/hooks/use-cursor-pagination.js +11 -11
  53. package/hooks/use-query-state.d.ts +14 -2
  54. package/hooks/use-query-state.js +1 -1
  55. package/hooks/use-upload-chunked.js +11 -11
  56. package/hooks/use-upload-new.js +12 -12
  57. package/hooks/use-upload.js +75 -66
  58. package/index.js +138 -118
  59. package/modules/attachments/attachments.js +75 -66
  60. package/modules/attachments/index.js +75 -66
  61. package/modules/blocks/components/BarcodeAttribute.d.ts +3 -5
  62. package/modules/blocks/components/BarcodeAttribute.js +3 -250
  63. package/modules/blocks/components/BlockEditor.d.ts +2 -41
  64. package/modules/blocks/components/BlockEditor.js +79 -69
  65. package/modules/blocks/components/BlockEditorComments.d.ts +6 -0
  66. package/modules/blocks/components/BlockEditorComments.js +274 -0
  67. package/modules/blocks/components/BlockEditorInlineContent.d.ts +40 -0
  68. package/modules/blocks/components/BlockEditorInlineContent.js +21 -0
  69. package/modules/blocks/components/BlockEditorReadOnly.js +75 -66
  70. package/modules/blocks/components/{Toolbar.js → BlockToolbar.js} +75 -66
  71. package/modules/blocks/components/CustomFileBlock.js +75 -66
  72. package/modules/blocks/components/CustomImageBlock.js +75 -66
  73. package/modules/blocks/components/CustomVideoBlock.js +11 -11
  74. package/modules/blocks/components/Editor.js +75 -66
  75. package/modules/blocks/components/FontSizeButton.d.ts +1 -0
  76. package/modules/blocks/components/FontSizeButton.js +9 -0
  77. package/modules/blocks/components/GalleryBlock.js +75 -66
  78. package/modules/blocks/components/ImageStyleButton.js +75 -66
  79. package/modules/blocks/components/SlashMenu.js +75 -66
  80. package/modules/blocks/components/SuggestionMenu.js +75 -66
  81. package/modules/blocks/components/index.d.ts +1 -1
  82. package/modules/blocks/components/index.js +78 -68
  83. package/modules/blocks/components/toolbar/ToolbarContents.js +75 -66
  84. package/modules/blocks/components/toolbar/buttons/ToolbarButton.js +75 -66
  85. package/modules/blocks/components/toolbar/buttons/ToolbarFormattingButton.js +2 -2
  86. package/modules/blocks/components/toolbar/buttons/ToolbarToggle.js +75 -66
  87. package/modules/blocks/components/toolbar/menus/ToolbarMenuItem.js +75 -66
  88. package/modules/blocks/components/toolbar/menus/ToolbarSelect.js +75 -66
  89. package/modules/blocks/constant/blockEditorSchema.d.ts +18 -0
  90. package/modules/blocks/constant/blockEditorSchema.js +79 -68
  91. package/modules/blocks/constant/index.js +79 -68
  92. package/modules/blocks/constant/toolbar/editorUIComponents.d.ts +3 -0
  93. package/modules/blocks/constant/toolbar/editorUIComponents.js +75 -66
  94. package/modules/blocks/hooks/toolbar/useFontSize.d.ts +2 -0
  95. package/modules/blocks/hooks/toolbar/useFontSize.js +7 -0
  96. package/modules/blocks/hooks/toolbar/useToolbarComponents.js +75 -66
  97. package/modules/blocks/hooks/useBarcodeAttribute.d.ts +35 -0
  98. package/modules/blocks/hooks/useBarcodeAttribute.js +11 -0
  99. package/modules/blocks/hooks/useBlockEditor.d.ts +5 -0
  100. package/modules/blocks/hooks/useBlockEditor.js +75 -66
  101. package/modules/blocks/hooks/useBlockEditorCommentComposer.d.ts +6 -0
  102. package/modules/blocks/hooks/useBlockEditorCommentComposer.js +273 -0
  103. package/modules/blocks/hooks/useBlockEditorEditable.d.ts +2 -0
  104. package/modules/blocks/hooks/useBlockEditorEditable.js +9 -0
  105. package/modules/blocks/index.js +80 -68
  106. package/modules/blocks/types/TextEditor.d.ts +1 -0
  107. package/modules/blocks/types/toolbar/FontSize.d.ts +5 -0
  108. package/modules/blocks/types/toolbar/FontSize.js +0 -0
  109. package/modules/board/components/Board.js +75 -66
  110. package/modules/board/index.js +75 -66
  111. package/modules/chat-viz/index.js +3 -3
  112. package/modules/display/components/CurrencyDisplay.js +11 -11
  113. package/modules/display/components/EmailDisplay.d.ts +1 -1
  114. package/modules/display/components/EmailDisplay.js +75 -66
  115. package/modules/display/components/PhoneDisplay.d.ts +3 -1
  116. package/modules/display/components/PhoneDisplay.js +75 -66
  117. package/modules/display/components/RelativeDateDisplay.js +75 -66
  118. package/modules/display/components/SexDisplay.js +3 -3
  119. package/modules/display/index.js +75 -66
  120. package/modules/display/types/emailDisplay.d.ts +1 -0
  121. package/modules/display/utils/formatPhones.js +3 -3
  122. package/modules/email-editor/components/EmailEditor.js +75 -66
  123. package/modules/email-editor/components/EmailPreviewDeviceToggle.js +75 -66
  124. package/modules/email-editor/components/EmailTableBackground.js +75 -66
  125. package/modules/email-editor/components/EmailTableToolbar.js +75 -66
  126. package/modules/email-editor/components/index.js +75 -66
  127. package/modules/email-editor/index.js +75 -66
  128. package/modules/filter/components/Filter.js +75 -66
  129. package/modules/filter/date-filter/components/DateFilterCommand.js +75 -66
  130. package/modules/filter/date-filter/components/DialogDateView.js +75 -66
  131. package/modules/filter/date-filter/constants/dateTypes.d.ts +1 -0
  132. package/modules/filter/date-filter/constants/dateTypes.js +5 -3
  133. package/modules/filter/date-filter/index.js +75 -66
  134. package/modules/filter/date-filter/utils/dateTokens.d.ts +1 -0
  135. package/modules/filter/date-filter/utils/dateTokens.js +4 -1
  136. package/modules/filter/date-filter/utils/getActiveTab.js +2 -2
  137. package/modules/filter/date-filter/utils/getDisplayValue.d.ts +1 -1
  138. package/modules/filter/date-filter/utils/getDisplayValue.js +3 -3
  139. package/modules/filter/date-filter/utils/parseDateRangeFromString.js +14 -14
  140. package/modules/filter/hooks/useFilterQueryState.js +2 -2
  141. package/modules/filter/index.js +75 -66
  142. package/modules/focus-sheet/components/focus-sheet.js +75 -66
  143. package/modules/hotkey/components/PopoverScoped.js +75 -66
  144. package/modules/hotkey/index.js +77 -68
  145. package/modules/icons/components/IconPicker.js +75 -66
  146. package/modules/icons/index.js +75 -66
  147. package/modules/index.js +102 -85
  148. package/modules/inputs/components/CurrencyField.js +75 -66
  149. package/modules/inputs/components/EmailField.js +75 -66
  150. package/modules/inputs/components/FullNameField.js +75 -66
  151. package/modules/inputs/components/LanguageSelect.js +75 -66
  152. package/modules/inputs/components/PhoneField.js +75 -66
  153. package/modules/inputs/components/SexField.js +75 -66
  154. package/modules/inputs/components/TimezoneSelect.js +75 -66
  155. package/modules/inputs/index.js +77 -68
  156. package/modules/layout/components/AppLayout.d.ts +6 -6
  157. package/modules/layout/components/AppLayout.js +10 -8
  158. package/modules/layout/components/AppLayoutPageSlot.d.ts +2 -0
  159. package/modules/layout/components/AppLayoutPageSlot.js +9 -0
  160. package/modules/layout/index.d.ts +1 -0
  161. package/modules/layout/index.js +20 -13
  162. package/modules/layout/states/appLayoutPageState.d.ts +4 -0
  163. package/modules/layout/states/appLayoutPageState.js +8 -0
  164. package/modules/navigation-menu/components/NavigationMenu.js +75 -66
  165. package/modules/navigation-menu/index.js +77 -68
  166. package/modules/preview/components/Preview.js +75 -66
  167. package/modules/record-field/components/NumberField.js +75 -66
  168. package/modules/record-field/components/TextField.js +75 -66
  169. package/modules/record-field/index.js +75 -66
  170. package/modules/record-field/meta-inputs/components/EmailVerificationInput.js +75 -66
  171. package/modules/record-field/meta-inputs/components/PhoneInput.js +75 -66
  172. package/modules/record-field/meta-inputs/components/PhoneVerificationInput.js +75 -66
  173. package/modules/record-field/meta-inputs/components/TextFieldInput.js +75 -66
  174. package/modules/record-table/components/MoreColumn.js +75 -66
  175. package/modules/record-table/components/RecordTableArrowEffect.js +75 -66
  176. package/modules/record-table/components/RecordTableCell.js +75 -66
  177. package/modules/record-table/components/RecordTableCellInline.js +75 -66
  178. package/modules/record-table/components/RecordTableColumnSelector.js +75 -66
  179. package/modules/record-table/components/RecordTableCursor.js +75 -66
  180. package/modules/record-table/components/RecordTableHead.js +75 -66
  181. package/modules/record-table/components/RecordTableHeader.js +75 -66
  182. package/modules/record-table/components/RecordTableHotkeyCell.js +75 -66
  183. package/modules/record-table/components/RecordTableProvider.js +2 -2
  184. package/modules/record-table/components/RecordTableRoot.js +75 -66
  185. package/modules/record-table/components/RecordTableRow.js +75 -66
  186. package/modules/record-table/components/RecordTableRowList.js +75 -66
  187. package/modules/record-table/components/RecordTableRowSkeleton.js +75 -66
  188. package/modules/record-table/components/RecordTableScroll.js +75 -66
  189. package/modules/record-table/components/RecordTableTree.js +75 -66
  190. package/modules/record-table/contexts/RecordTableHotkeyContext.js +75 -66
  191. package/modules/record-table/hooks/usePopoverOnEnter.js +75 -66
  192. package/modules/record-table/index.js +75 -66
  193. package/modules/report/components/report-page-container.js +75 -66
  194. package/modules/report/index.js +75 -66
  195. package/modules/select-operation/components/SelectOperation.js +75 -66
  196. package/modules/select-operation/index.js +75 -66
  197. package/modules/select-tree/components/SelectTree.js +75 -66
  198. package/modules/select-tree/hooks/useSelectTreeHide.js +2 -2
  199. package/modules/select-tree/index.js +75 -66
  200. package/modules/side-menu/components/SideMenu.js +75 -66
  201. package/package.json +9 -2
  202. package/styles.css +1 -1
  203. package/theme.css +3 -2
  204. package/types/UIConfig.d.ts +32 -0
  205. package/types/index.js +5 -5
  206. package/utils/core.js +11 -11
  207. package/utils/index.js +33 -33
  208. package/chunks/{chunk-F2R6ZFEK.js → chunk-CHDXXCMI.js} +3 -3
  209. package/chunks/{chunk-QTFBJ6EE.js → chunk-HT6R7GVC.js} +3 -3
  210. package/chunks/{chunk-AQEBKBOC.js → chunk-UQJA4TBO.js} +3 -3
  211. package/chunks/{chunk-RRQDMDYQ.js → chunk-WKCCSZLB.js} +0 -0
  212. package/chunks/{chunk-MBEYRZZN.js → chunk-XREHNAPK.js} +3 -3
  213. /package/modules/blocks/components/{Toolbar.d.ts → BlockToolbar.d.ts} +0 -0
package/README.md CHANGED
@@ -32,6 +32,12 @@ application if you want to generate additional utility classes of your own.
32
32
  Override CSS variables such as `--primary` to customize the default theme. Add
33
33
  the `dark` class to a parent element to select the dark theme.
34
34
 
35
+ The stylesheet also sets the page defaults erxes apps share (`src/base.css`):
36
+ the default light and dark theme, theme border colour on every element, page
37
+ background and text colour, and heading sizes. A standalone app that is not
38
+ hosted by core-ui only needs this stylesheet, plus `@erxes/ui/fonts.css` to load
39
+ Inter and Roboto Mono (core-ui loads them from its `index.html`).
40
+
35
41
  `@erxes/ui/theme.css` remains available for applications that already compile
36
42
  Tailwind and supply their own design tokens. The compiled stylesheet is also
37
43
  exported as `@erxes/ui/styles.css` and `@erxes/ui/style.css`.
@@ -49,8 +55,8 @@ pnpm --dir frontend/libs/erxes-ui/dist pack
49
55
  ```
50
56
 
51
57
  The build writes a standalone `dist/package.json`, JavaScript entries, type
52
- declarations, and compiled CSS. The existing `theme.css` contract and the host's
53
- default tokens are reused when compiling styles. The publish workflow packs this
58
+ declarations, and compiled CSS. The existing `theme.css` contract and the default
59
+ tokens in `src/base.css` (also imported by core-ui) are compiled into it. The publish workflow packs this
54
60
  directory and applies the shared platform version. Workspace consumers continue
55
61
  to resolve the original source exports.
56
62
 
@@ -9,6 +9,7 @@ import {
9
9
  import * as React from "react";
10
10
  import { Dialog as DialogPrimitive } from "radix-ui";
11
11
  import { IconX } from "@tabler/icons-react";
12
+ import { useTranslation } from "react-i18next";
12
13
  import { jsx, jsxs } from "react/jsx-runtime";
13
14
  var DialogTrigger = DialogPrimitive.Trigger;
14
15
  var DialogPortal = DialogPrimitive.Portal;
@@ -47,19 +48,22 @@ var DialogCombinedHeader = ({
47
48
  title,
48
49
  description,
49
50
  hideClose
50
- }) => /* @__PURE__ */ jsxs(Dialog.Header, { children: [
51
- /* @__PURE__ */ jsx(Dialog.Title, { children: title }),
52
- /* @__PURE__ */ jsx(Dialog.Description, { className: "sr-only", children: description }),
53
- !hideClose && /* @__PURE__ */ jsx(Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsx(
54
- Button,
55
- {
56
- variant: "secondary",
57
- size: "icon",
58
- className: "absolute right-4 top-3",
59
- children: /* @__PURE__ */ jsx(IconX, {})
60
- }
61
- ) })
62
- ] });
51
+ }) => {
52
+ const { t } = useTranslation();
53
+ return /* @__PURE__ */ jsxs(Dialog.Header, { children: [
54
+ /* @__PURE__ */ jsx(Dialog.Title, { children: title }),
55
+ /* @__PURE__ */ jsx(Dialog.Description, { className: "sr-only", children: description }),
56
+ !hideClose && /* @__PURE__ */ jsx(Dialog.Close, { asChild: true, "aria-label": t("close", "Close"), children: /* @__PURE__ */ jsx(
57
+ Button,
58
+ {
59
+ variant: "secondary",
60
+ size: "icon",
61
+ className: "absolute right-4 top-3",
62
+ children: /* @__PURE__ */ jsx(IconX, {})
63
+ }
64
+ ) })
65
+ ] });
66
+ };
63
67
  var DialogContentCombined = React.forwardRef(({ className, children, title, description, hideClose, ...props }, ref) => /* @__PURE__ */ jsxs(DialogContent, { ref, className: cn(className), ...props, children: [
64
68
  /* @__PURE__ */ jsx(
65
69
  DialogCombinedHeader,
@@ -0,0 +1,228 @@
1
+ import {
2
+ BARCODE_DIMENSION_LIMITS,
3
+ BARCODE_SIZE_PRESETS,
4
+ useBarcodeAttribute
5
+ } from "./chunk-U46BZAPJ.js";
6
+ import {
7
+ useBlockEditorEditable
8
+ } from "./chunk-AJCSQFCK.js";
9
+ import {
10
+ Form
11
+ } from "./chunk-2R3JGXIB.js";
12
+ import {
13
+ Input
14
+ } from "./chunk-5V3DI2JS.js";
15
+ import {
16
+ Select
17
+ } from "./chunk-RZM4UL7J.js";
18
+ import {
19
+ Popover
20
+ } from "./chunk-F2VATUUS.js";
21
+ import {
22
+ Button
23
+ } from "./chunk-DCCZEG7Z.js";
24
+
25
+ // src/modules/blocks/components/BarcodeAttribute.tsx
26
+ import { useRef } from "react";
27
+ import {
28
+ IconArrowsDiagonal,
29
+ IconCheck,
30
+ IconSettings,
31
+ IconTrash
32
+ } from "@tabler/icons-react";
33
+ import { jsx, jsxs } from "react/jsx-runtime";
34
+ var BarcodeAttribute = ({
35
+ editable,
36
+ height,
37
+ onResize,
38
+ onRemove,
39
+ width
40
+ }) => {
41
+ const canEdit = useBlockEditorEditable(editable);
42
+ const barcodeRef = useRef(null);
43
+ const {
44
+ form,
45
+ size,
46
+ preset,
47
+ settingsOpen,
48
+ applySize,
49
+ handleSettingsOpenChange,
50
+ handlePresetChange,
51
+ handleInputKeyDown,
52
+ handleResizeStart,
53
+ handleResize,
54
+ handleResizeEnd,
55
+ handleResizeCancel
56
+ } = useBarcodeAttribute({ width, height, onResize });
57
+ return /* @__PURE__ */ jsxs(
58
+ "span",
59
+ {
60
+ ref: barcodeRef,
61
+ className: "inline-flex flex-col items-start align-middle",
62
+ contentEditable: false,
63
+ title: "Barcode preview \u2014 prints the selected product\u2019s barcode",
64
+ children: [
65
+ /* @__PURE__ */ jsxs(
66
+ "svg",
67
+ {
68
+ width: "100%",
69
+ height: "100%",
70
+ viewBox: "0 0 202 69",
71
+ preserveAspectRatio: "none",
72
+ role: "img",
73
+ "aria-label": "Product barcode preview",
74
+ className: "block bg-white",
75
+ style: size,
76
+ children: [
77
+ /* @__PURE__ */ jsx(
78
+ "path",
79
+ {
80
+ stroke: "#000",
81
+ strokeWidth: "4",
82
+ d: "M2 69L2 0M28 69L28 0M58 69L58 0M84 69L84 0M90 69L90 0M112 69L112 0M128 69L128 0M138 69L138 0M168 69L168 0M178 69L178 0M200 69L200 0"
83
+ }
84
+ ),
85
+ /* @__PURE__ */ jsx(
86
+ "path",
87
+ {
88
+ stroke: "#000",
89
+ strokeWidth: "2",
90
+ d: "M7 69L7 0M23 69L23 0M45 69L45 0M53 69L53 0M79 69L79 0M101 69L101 0M105 69L105 0M133 69L133 0M163 69L163 0M195 69L195 0"
91
+ }
92
+ ),
93
+ /* @__PURE__ */ jsx(
94
+ "path",
95
+ {
96
+ stroke: "#000",
97
+ strokeWidth: "6",
98
+ d: "M15 69L15 0M37 69L37 0M69 69L69 0M147 69L147 0M157 69L157 0M189 69L189 0"
99
+ }
100
+ ),
101
+ /* @__PURE__ */ jsx("path", { stroke: "#000", strokeWidth: "8", d: "M120 69L120 0" })
102
+ ]
103
+ }
104
+ ),
105
+ canEdit && /* @__PURE__ */ jsxs("span", { className: "erxes-block-controls order-first mb-1 flex gap-1 rounded bg-background p-1 text-foreground shadow-sm print:hidden", children: [
106
+ /* @__PURE__ */ jsx(
107
+ Button,
108
+ {
109
+ type: "button",
110
+ variant: "outline",
111
+ size: "icon",
112
+ "aria-label": "Resize barcode",
113
+ title: "Drag up to increase height; drag right to increase width",
114
+ className: "touch-none cursor-nesw-resize",
115
+ onPointerDown: handleResizeStart,
116
+ onPointerMove: handleResize,
117
+ onPointerUp: handleResizeEnd,
118
+ onPointerCancel: handleResizeCancel,
119
+ children: /* @__PURE__ */ jsx(IconArrowsDiagonal, {})
120
+ }
121
+ ),
122
+ /* @__PURE__ */ jsxs(Popover, { open: settingsOpen, onOpenChange: handleSettingsOpenChange, children: [
123
+ /* @__PURE__ */ jsx(Popover.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
124
+ Button,
125
+ {
126
+ type: "button",
127
+ variant: "outline",
128
+ size: "icon",
129
+ "aria-label": "Barcode settings",
130
+ title: "Barcode settings",
131
+ children: /* @__PURE__ */ jsx(IconSettings, {})
132
+ }
133
+ ) }),
134
+ /* @__PURE__ */ jsx(
135
+ Popover.Content,
136
+ {
137
+ className: "w-64 text-foreground",
138
+ onClick: (event) => event.stopPropagation(),
139
+ children: /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
140
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: "Barcode size" }),
141
+ /* @__PURE__ */ jsxs(
142
+ Select,
143
+ {
144
+ value: preset ? String(preset.width) : "",
145
+ onValueChange: handlePresetChange,
146
+ children: [
147
+ /* @__PURE__ */ jsx(Select.Trigger, { "aria-label": "Barcode size preset", children: /* @__PURE__ */ jsx(Select.Value, { placeholder: "Custom size" }) }),
148
+ /* @__PURE__ */ jsx(Select.Content, { children: BARCODE_SIZE_PRESETS.map((size2) => /* @__PURE__ */ jsxs(
149
+ Select.Item,
150
+ {
151
+ value: String(size2.width),
152
+ children: [
153
+ size2.width,
154
+ " \xD7 ",
155
+ size2.height,
156
+ " px"
157
+ ]
158
+ },
159
+ size2.width
160
+ )) })
161
+ ]
162
+ }
163
+ ),
164
+ ["width", "height"].map((dimension) => /* @__PURE__ */ jsx(
165
+ Form.Field,
166
+ {
167
+ control: form.control,
168
+ name: dimension,
169
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
170
+ /* @__PURE__ */ jsx(Form.Label, { children: dimension === "width" ? "Width (px)" : "Height (px)" }),
171
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
172
+ Input,
173
+ {
174
+ ...field,
175
+ onKeyDown: handleInputKeyDown,
176
+ type: "number",
177
+ step: 1,
178
+ min: BARCODE_DIMENSION_LIMITS[dimension].min,
179
+ max: BARCODE_DIMENSION_LIMITS[dimension].max
180
+ }
181
+ ) }),
182
+ /* @__PURE__ */ jsx(Form.Message, {})
183
+ ] })
184
+ },
185
+ dimension
186
+ )),
187
+ /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(
188
+ Button,
189
+ {
190
+ type: "button",
191
+ size: "icon",
192
+ "aria-label": "Apply barcode size",
193
+ title: "Apply barcode size",
194
+ onClick: () => void applySize(),
195
+ children: /* @__PURE__ */ jsx(IconCheck, {})
196
+ }
197
+ ) })
198
+ ] }) })
199
+ }
200
+ )
201
+ ] }),
202
+ /* @__PURE__ */ jsx(
203
+ Button,
204
+ {
205
+ type: "button",
206
+ variant: "outline",
207
+ size: "icon",
208
+ "aria-label": "Delete barcode",
209
+ title: "Delete barcode",
210
+ className: "text-destructive",
211
+ onClick: (event) => {
212
+ event.preventDefault();
213
+ event.stopPropagation();
214
+ if (barcodeRef.current)
215
+ onRemove(barcodeRef.current);
216
+ },
217
+ children: /* @__PURE__ */ jsx(IconTrash, {})
218
+ }
219
+ )
220
+ ] })
221
+ ]
222
+ }
223
+ );
224
+ };
225
+
226
+ export {
227
+ BarcodeAttribute
228
+ };
@@ -0,0 +1,72 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-KTBDECJI.js";
4
+
5
+ // src/components/input-otp.tsx
6
+ import * as React from "react";
7
+ import { IconMinus } from "@tabler/icons-react";
8
+ import { OTPInput, OTPInputContext } from "input-otp";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ var InputOTPRoot = React.forwardRef(({ className, containerClassName, ...props }, ref) => /* @__PURE__ */ jsx(
11
+ OTPInput,
12
+ {
13
+ ref,
14
+ containerClassName: cn(
15
+ "flex items-center gap-2 has-[:disabled]:opacity-50",
16
+ containerClassName
17
+ ),
18
+ className: cn("disabled:cursor-not-allowed", className),
19
+ ...props
20
+ }
21
+ ));
22
+ InputOTPRoot.displayName = "InputOTP";
23
+ var InputOTPGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
24
+ "div",
25
+ {
26
+ ref,
27
+ className: cn("flex items-center gap-1", className),
28
+ ...props
29
+ }
30
+ ));
31
+ InputOTPGroup.displayName = "InputOTPGroup";
32
+ var InputOTPSlot = React.forwardRef(({ index, className, ...props }, ref) => {
33
+ const context = React.useContext(OTPInputContext);
34
+ const { char, hasFakeCaret, isActive } = context.slots[index];
35
+ return /* @__PURE__ */ jsxs(
36
+ "div",
37
+ {
38
+ ref,
39
+ className: cn(
40
+ "relative flex h-9 w-8 items-center justify-center rounded-sm bg-background font-mono text-base text-foreground shadow-xs transition-[box-shadow]",
41
+ isActive && "z-10 shadow-focus",
42
+ className
43
+ ),
44
+ ...props,
45
+ children: [
46
+ char,
47
+ hasFakeCaret && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "h-4 w-px animate-pulse bg-foreground" }) })
48
+ ]
49
+ }
50
+ );
51
+ });
52
+ InputOTPSlot.displayName = "InputOTPSlot";
53
+ var InputOTPSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
54
+ "div",
55
+ {
56
+ ref,
57
+ role: "separator",
58
+ className: cn("text-muted-foreground", className),
59
+ ...props,
60
+ children: /* @__PURE__ */ jsx(IconMinus, { size: 14 })
61
+ }
62
+ ));
63
+ InputOTPSeparator.displayName = "InputOTPSeparator";
64
+ var InputOTP = Object.assign(InputOTPRoot, {
65
+ Group: InputOTPGroup,
66
+ Slot: InputOTPSlot,
67
+ Separator: InputOTPSeparator
68
+ });
69
+
70
+ export {
71
+ InputOTP
72
+ };
@@ -0,0 +1,11 @@
1
+ // src/modules/blocks/hooks/useBlockEditorEditable.ts
2
+ import { createContext, useContext } from "react";
3
+ var BlockEditorEditableContext = createContext(
4
+ void 0
5
+ );
6
+ var useBlockEditorEditable = (fallback) => useContext(BlockEditorEditableContext) ?? fallback;
7
+
8
+ export {
9
+ BlockEditorEditableContext,
10
+ useBlockEditorEditable
11
+ };
@@ -9,13 +9,16 @@ import {
9
9
  import * as React from "react";
10
10
  import { Dialog as SheetPrimitive } from "radix-ui";
11
11
  import { IconX } from "@tabler/icons-react";
12
+ import { useTranslation } from "react-i18next";
12
13
  import { cva } from "class-variance-authority";
13
- import { jsx } from "react/jsx-runtime";
14
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
15
  var SheetTrigger = React.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx(SheetPrimitive.Trigger, { ref, ...props }));
15
16
  SheetTrigger.displayName = SheetPrimitive.Trigger.displayName;
17
+ var SheetHeaderActionsContext = React.createContext(null);
16
18
  var SheetRoot = ({
19
+ headerActions = null,
17
20
  ...props
18
- }) => /* @__PURE__ */ jsx(SheetPrimitive.Root, { ...props });
21
+ }) => /* @__PURE__ */ jsx(SheetHeaderActionsContext.Provider, { value: headerActions, children: /* @__PURE__ */ jsx(SheetPrimitive.Root, { ...props }) });
19
22
  SheetRoot.displayName = SheetPrimitive.Root.displayName;
20
23
  var SheetOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
21
24
  SheetPrimitive.Overlay,
@@ -60,33 +63,58 @@ var SheetView = React.forwardRef(({ side = "right", className, children, ...prop
60
63
  ) }) }));
61
64
  SheetView.displayName = SheetPrimitive.Content.displayName;
62
65
  var SheetClose = React.forwardRef(({ asChild, ...props }, ref) => {
66
+ const { t } = useTranslation();
63
67
  if (asChild) {
64
68
  return /* @__PURE__ */ jsx(SheetPrimitive.Close, { ref, ...props, asChild: true });
65
69
  }
66
- return /* @__PURE__ */ jsx(SheetPrimitive.Close, { ref, ...props, asChild: true, children: /* @__PURE__ */ jsx(
67
- Button,
70
+ return /* @__PURE__ */ jsx(
71
+ SheetPrimitive.Close,
68
72
  {
69
- variant: "secondary",
70
- size: "icon",
71
- className: cn("ml-auto", props.className),
72
- children: /* @__PURE__ */ jsx(IconX, {})
73
+ ref,
74
+ "aria-label": t("close", "Close"),
75
+ ...props,
76
+ asChild: true,
77
+ children: /* @__PURE__ */ jsx(
78
+ Button,
79
+ {
80
+ variant: "secondary",
81
+ size: "icon",
82
+ className: cn("ml-auto", props.className),
83
+ children: /* @__PURE__ */ jsx(IconX, {})
84
+ }
85
+ )
73
86
  }
74
- ) });
87
+ );
75
88
  });
76
89
  SheetClose.displayName = SheetPrimitive.Close.displayName;
77
90
  var SheetHeader = ({
78
91
  className,
92
+ children,
79
93
  ...props
80
- }) => /* @__PURE__ */ jsx(
81
- "div",
82
- {
83
- className: cn(
84
- "flex px-5 h-10 items-center bg-background border-b flex-none",
85
- className
86
- ),
87
- ...props
88
- }
89
- );
94
+ }) => {
95
+ const actions = React.useContext(SheetHeaderActionsContext);
96
+ const items = React.Children.toArray(children);
97
+ const close = actions ? items.find(
98
+ (child) => React.isValidElement(child) && child.type === SheetClose
99
+ ) : void 0;
100
+ return /* @__PURE__ */ jsx(
101
+ "div",
102
+ {
103
+ className: cn(
104
+ "flex px-5 h-10 items-center bg-background border-b flex-none",
105
+ className
106
+ ),
107
+ ...props,
108
+ children: actions ? /* @__PURE__ */ jsxs(Fragment, { children: [
109
+ items.filter((child) => child !== close),
110
+ /* @__PURE__ */ jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-1 [&>button]:ml-0", children: [
111
+ actions,
112
+ close
113
+ ] })
114
+ ] }) : children
115
+ }
116
+ );
117
+ };
90
118
  SheetHeader.displayName = "SheetHeader";
91
119
  var SheetContent = ({
92
120
  className,
@@ -1,26 +1,40 @@
1
1
  // src/hooks/use-query-state.tsx
2
- import { useSearchParams } from "react-router-dom";
2
+ import { useRef } from "react";
3
+ import {
4
+ useLocation,
5
+ useSearchParams
6
+ } from "react-router-dom";
3
7
  var searchParamsDraft = null;
4
- var draftSourceSearch = "";
5
- var getSearchParamsDraft = () => {
6
- const currentSearch = window.location.search;
7
- const draftSearch = searchParamsDraft?.toString();
8
- const draftTargetSearch = draftSearch ? `?${draftSearch}` : "";
9
- if (!searchParamsDraft || draftSourceSearch !== currentSearch && draftTargetSearch !== currentSearch) {
10
- draftSourceSearch = currentSearch;
11
- searchParamsDraft = new URLSearchParams(currentSearch);
8
+ var getSearchParamsDraft = (location) => {
9
+ if (!searchParamsDraft || searchParamsDraft.location !== location) {
10
+ const draft = {
11
+ location,
12
+ params: new URLSearchParams(location.search),
13
+ state: location.state
14
+ };
15
+ searchParamsDraft = draft;
12
16
  queueMicrotask(() => {
13
- searchParamsDraft = null;
14
- draftSourceSearch = "";
17
+ if (searchParamsDraft === draft)
18
+ searchParamsDraft = null;
15
19
  });
16
20
  }
17
- return new URLSearchParams(searchParamsDraft);
21
+ return searchParamsDraft;
18
22
  };
19
- var updateSearchParamsDraft = (nextParams) => {
20
- searchParamsDraft = new URLSearchParams(nextParams);
23
+ var useSearchParamsDraft = () => {
24
+ const location = useLocation();
25
+ const latestLocation = useRef(location);
26
+ latestLocation.current = location;
27
+ return () => getSearchParamsDraft(latestLocation.current);
28
+ };
29
+ var updateSearchParamsDraft = (draft, nextParams, navigationOptions) => {
30
+ draft.params = new URLSearchParams(nextParams);
31
+ if (navigationOptions && "state" in navigationOptions) {
32
+ draft.state = navigationOptions.state;
33
+ }
21
34
  };
22
35
  function useQueryState(queryKey, options) {
23
36
  const [searchParams, setSearchParams] = useSearchParams();
37
+ const getDraft = useSearchParamsDraft();
24
38
  const parseQueryValue = (value) => {
25
39
  if (!value) {
26
40
  if (options?.defaultValue !== void 0) {
@@ -43,27 +57,29 @@ function useQueryState(queryKey, options) {
43
57
  }
44
58
  };
45
59
  const query = parseQueryValue(searchParams.get(queryKey));
46
- const setQuery = (value) => {
47
- const nextParams = getSearchParamsDraft();
60
+ const setQuery = (value, navigationOptions) => {
61
+ const draft = getDraft();
62
+ const nextParams = new URLSearchParams(draft.params);
48
63
  if (value !== null) {
49
64
  const stringValue = typeof value === "object" ? JSON.stringify(value) : String(value);
50
- if (nextParams.get(queryKey) === stringValue)
65
+ if (nextParams.get(queryKey) === stringValue && !navigationOptions)
51
66
  return;
52
- if (!nextParams.has(queryKey) && value === query)
67
+ if (!nextParams.has(queryKey) && value === query && !navigationOptions)
53
68
  return;
54
69
  nextParams.set(queryKey, stringValue);
55
70
  } else if (nextParams.has(queryKey)) {
56
71
  nextParams.delete(queryKey);
57
- } else {
72
+ } else if (!navigationOptions) {
58
73
  return;
59
74
  }
60
- updateSearchParamsDraft(nextParams);
61
- setSearchParams(nextParams);
75
+ updateSearchParamsDraft(draft, nextParams, navigationOptions);
76
+ setSearchParams(nextParams, { ...navigationOptions, state: draft.state });
62
77
  };
63
78
  return [query, setQuery];
64
79
  }
65
80
  function useMultiQueryState(queryKeys) {
66
81
  const [searchParams, setSearchParams] = useSearchParams();
82
+ const getDraft = useSearchParamsDraft();
67
83
  const parseQueryValue = (value, key) => {
68
84
  if (!value)
69
85
  return null;
@@ -85,8 +101,9 @@ function useMultiQueryState(queryKeys) {
85
101
  acc[key] = parseQueryValue(searchParams.get(String(key)), key);
86
102
  return acc;
87
103
  }, {});
88
- const setQueries = (values) => {
89
- const nextParams = getSearchParamsDraft();
104
+ const setQueries = (values, navigationOptions) => {
105
+ const draft = getDraft();
106
+ const nextParams = new URLSearchParams(draft.params);
90
107
  let hasChanges = false;
91
108
  Object.entries(values).forEach(([key, value]) => {
92
109
  if (value !== null) {
@@ -100,41 +117,49 @@ function useMultiQueryState(queryKeys) {
100
117
  hasChanges = true;
101
118
  }
102
119
  });
103
- if (!hasChanges)
120
+ if (!hasChanges && !navigationOptions)
104
121
  return;
105
- updateSearchParamsDraft(nextParams);
106
- setSearchParams(nextParams, { replace: true });
122
+ updateSearchParamsDraft(draft, nextParams, navigationOptions);
123
+ setSearchParams(nextParams, {
124
+ replace: true,
125
+ ...navigationOptions,
126
+ state: draft.state
127
+ });
107
128
  };
108
129
  return [queries, setQueries];
109
130
  }
110
131
  var useNonNullMultiQueryState = (queryKeys) => {
111
132
  const [queries] = useMultiQueryState(queryKeys);
112
133
  const nonNullQueries = Object.fromEntries(
113
- Object.entries(queries).filter(([_, value]) => value !== null)
134
+ Object.entries(queries).filter(([, value]) => value !== null)
114
135
  );
115
136
  return nonNullQueries;
116
137
  };
117
138
  function useSetQueryStateByKey() {
118
139
  const [, setSearchParams] = useSearchParams();
140
+ const getDraft = useSearchParamsDraft();
119
141
  const setQuery = (key, value) => {
120
- const nextParams = getSearchParamsDraft();
142
+ const draft = getDraft();
143
+ const nextParams = new URLSearchParams(draft.params);
121
144
  if (nextParams.get(key) === value)
122
145
  return;
123
146
  nextParams.set(key, value);
124
- updateSearchParamsDraft(nextParams);
125
- setSearchParams(nextParams);
147
+ updateSearchParamsDraft(draft, nextParams);
148
+ setSearchParams(nextParams, { state: draft.state });
126
149
  };
127
150
  return setQuery;
128
151
  }
129
152
  function useRemoveQueryStateByKey() {
130
153
  const [, setSearchParams] = useSearchParams();
154
+ const getDraft = useSearchParamsDraft();
131
155
  const removeQuery = (key) => {
132
- const nextParams = getSearchParamsDraft();
156
+ const draft = getDraft();
157
+ const nextParams = new URLSearchParams(draft.params);
133
158
  if (!nextParams.has(key))
134
159
  return;
135
160
  nextParams.delete(key);
136
- updateSearchParamsDraft(nextParams);
137
- setSearchParams(nextParams);
161
+ updateSearchParamsDraft(draft, nextParams);
162
+ setSearchParams(nextParams, { state: draft.state });
138
163
  };
139
164
  return removeQuery;
140
165
  }