@pdfme/ui 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/.eslintrc.js +2 -2
  2. package/dist/index.js +3 -0
  3. package/dist/index.js.LICENSE.txt +95 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/types/{src/Designer.d.ts → Designer.d.ts} +1 -1
  6. package/dist/types/{src/Form.d.ts → Form.d.ts} +1 -1
  7. package/dist/types/{src/Viewer.d.ts → Viewer.d.ts} +1 -1
  8. package/dist/types/{src/class.d.ts → class.d.ts} +2 -4
  9. package/dist/types/{src/components → components}/CtlBar/Pager.d.ts +0 -1
  10. package/dist/types/{src/components → components}/CtlBar/Zoom.d.ts +0 -1
  11. package/dist/types/{src/components → components}/CtlBar/index.d.ts +0 -1
  12. package/dist/types/{src/components → components}/Designer/Main/Mask.d.ts +0 -1
  13. package/dist/types/components/Designer/Main/Moveable.d.ts +32 -0
  14. package/dist/types/{src/components → components}/Designer/Main/Selecto.d.ts +0 -1
  15. package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/ExampleInputEditor.d.ts +0 -1
  16. package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/PositionAndSizeEditor.d.ts +1 -2
  17. package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/TextPropEditor.d.ts +0 -1
  18. package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/TypeAndKeyEditor.d.ts +1 -2
  19. package/dist/types/{src/components → components}/Designer/Sidebar/DetailView/index.d.ts +1 -2
  20. package/dist/types/{src/components → components}/Designer/Sidebar/ListView/SelectableSortableContainer.d.ts +1 -2
  21. package/dist/types/{src/components → components}/Designer/Sidebar/ListView/index.d.ts +1 -2
  22. package/dist/types/{src/components → components}/Designer/Sidebar/index.d.ts +0 -1
  23. package/dist/types/{src/components → components}/Designer/index.d.ts +1 -2
  24. package/dist/types/{src/components → components}/Divider.d.ts +0 -1
  25. package/dist/types/{src/components → components}/Error.d.ts +0 -1
  26. package/dist/types/{src/components → components}/Preview.d.ts +0 -1
  27. package/dist/types/{src/components → components}/Schemas/BarcodeSchema.d.ts +1 -1
  28. package/dist/types/{src/components → components}/Schemas/ImageSchema.d.ts +1 -1
  29. package/dist/types/{src/components → components}/Schemas/SchemaUI.d.ts +1 -1
  30. package/dist/types/{src/components → components}/Schemas/TextSchema.d.ts +1 -1
  31. package/dist/types/{src/components → components}/Spinner.d.ts +0 -1
  32. package/dist/types/{src/components → components}/UnitPager.d.ts +0 -1
  33. package/dist/types/{src/contexts.d.ts → contexts.d.ts} +2 -2
  34. package/dist/types/{src/helper.d.ts → helper.d.ts} +0 -1
  35. package/dist/types/index.d.ts +7 -0
  36. package/package.json +16 -23
  37. package/src/Designer.tsx +10 -8
  38. package/src/Form.tsx +9 -7
  39. package/src/Viewer.tsx +9 -7
  40. package/src/class.ts +6 -10
  41. package/src/components/CtlBar/Pager.tsx +1 -1
  42. package/src/components/CtlBar/index.tsx +2 -2
  43. package/src/components/Designer/Main/Guides.tsx +1 -1
  44. package/src/components/Designer/Main/Mask.tsx +1 -1
  45. package/src/components/Designer/Main/Moveable.tsx +27 -15
  46. package/src/components/Designer/Main/Selecto.tsx +1 -1
  47. package/src/components/Designer/Main/index.tsx +55 -38
  48. package/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.tsx +5 -5
  49. package/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.tsx +15 -2
  50. package/src/components/Designer/Sidebar/DetailView/TextPropEditor.tsx +3 -2
  51. package/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.tsx +2 -2
  52. package/src/components/Designer/Sidebar/DetailView/index.tsx +7 -7
  53. package/src/components/Designer/Sidebar/ListView/Item.tsx +1 -1
  54. package/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.tsx +55 -51
  55. package/src/components/Designer/Sidebar/ListView/SelectableSortableItem.tsx +3 -3
  56. package/src/components/Designer/Sidebar/ListView/index.tsx +5 -5
  57. package/src/components/Designer/Sidebar/index.tsx +4 -4
  58. package/src/components/Designer/index.tsx +9 -9
  59. package/src/components/Error.tsx +1 -1
  60. package/src/components/Paper.tsx +2 -2
  61. package/src/components/Preview.tsx +9 -9
  62. package/src/components/Root.tsx +14 -12
  63. package/src/components/Schemas/BarcodeSchema.tsx +2 -2
  64. package/src/components/Schemas/ImageSchema.tsx +5 -5
  65. package/src/components/Schemas/SchemaUI.tsx +5 -4
  66. package/src/components/Schemas/TextSchema.tsx +2 -2
  67. package/src/contexts.ts +2 -2
  68. package/src/helper.ts +1 -8
  69. package/src/hooks.ts +2 -2
  70. package/src/i18n.ts +1 -1
  71. package/src/index.ts +45 -6
  72. package/tsconfig.json +22 -0
  73. package/webpack.config.js +35 -0
  74. package/dist/cjs/__tests__/assets/helper.js +0 -79
  75. package/dist/cjs/__tests__/assets/helper.js.map +0 -1
  76. package/dist/cjs/__tests__/components/Designer.test.js +0 -39
  77. package/dist/cjs/__tests__/components/Designer.test.js.map +0 -1
  78. package/dist/cjs/__tests__/components/Preview.test.js +0 -51
  79. package/dist/cjs/__tests__/components/Preview.test.js.map +0 -1
  80. package/dist/cjs/__tests__/helper.test.js +0 -94
  81. package/dist/cjs/__tests__/helper.test.js.map +0 -1
  82. package/dist/cjs/src/Designer.js +0 -61
  83. package/dist/cjs/src/Designer.js.map +0 -1
  84. package/dist/cjs/src/Form.js +0 -35
  85. package/dist/cjs/src/Form.js.map +0 -1
  86. package/dist/cjs/src/Viewer.js +0 -25
  87. package/dist/cjs/src/Viewer.js.map +0 -1
  88. package/dist/cjs/src/class.js +0 -119
  89. package/dist/cjs/src/class.js.map +0 -1
  90. package/dist/cjs/src/components/CtlBar/Pager.js +0 -49
  91. package/dist/cjs/src/components/CtlBar/Pager.js.map +0 -1
  92. package/dist/cjs/src/components/CtlBar/Zoom.js +0 -31
  93. package/dist/cjs/src/components/CtlBar/Zoom.js.map +0 -1
  94. package/dist/cjs/src/components/CtlBar/index.js +0 -33
  95. package/dist/cjs/src/components/CtlBar/index.js.map +0 -1
  96. package/dist/cjs/src/components/Designer/Main/Guides.js +0 -33
  97. package/dist/cjs/src/components/Designer/Main/Guides.js.map +0 -1
  98. package/dist/cjs/src/components/Designer/Main/Mask.js +0 -18
  99. package/dist/cjs/src/components/Designer/Main/Mask.js.map +0 -1
  100. package/dist/cjs/src/components/Designer/Main/Moveable.js +0 -37
  101. package/dist/cjs/src/components/Designer/Main/Moveable.js.map +0 -1
  102. package/dist/cjs/src/components/Designer/Main/Selecto.js +0 -11
  103. package/dist/cjs/src/components/Designer/Main/Selecto.js.map +0 -1
  104. package/dist/cjs/src/components/Designer/Main/index.js +0 -224
  105. package/dist/cjs/src/components/Designer/Main/index.js.map +0 -1
  106. package/dist/cjs/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.js +0 -69
  107. package/dist/cjs/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.js.map +0 -1
  108. package/dist/cjs/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.js +0 -184
  109. package/dist/cjs/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.js.map +0 -1
  110. package/dist/cjs/src/components/Designer/Sidebar/DetailView/TextPropEditor.js +0 -116
  111. package/dist/cjs/src/components/Designer/Sidebar/DetailView/TextPropEditor.js.map +0 -1
  112. package/dist/cjs/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.js +0 -72
  113. package/dist/cjs/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.js.map +0 -1
  114. package/dist/cjs/src/components/Designer/Sidebar/DetailView/index.js +0 -54
  115. package/dist/cjs/src/components/Designer/Sidebar/DetailView/index.js.map +0 -1
  116. package/dist/cjs/src/components/Designer/Sidebar/ListView/Item.js +0 -76
  117. package/dist/cjs/src/components/Designer/Sidebar/ListView/Item.js.map +0 -1
  118. package/dist/cjs/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.js +0 -108
  119. package/dist/cjs/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.js.map +0 -1
  120. package/dist/cjs/src/components/Designer/Sidebar/ListView/SelectableSortableItem.js +0 -62
  121. package/dist/cjs/src/components/Designer/Sidebar/ListView/SelectableSortableItem.js.map +0 -1
  122. package/dist/cjs/src/components/Designer/Sidebar/ListView/index.js +0 -84
  123. package/dist/cjs/src/components/Designer/Sidebar/ListView/index.js.map +0 -1
  124. package/dist/cjs/src/components/Designer/Sidebar/index.js +0 -105
  125. package/dist/cjs/src/components/Designer/Sidebar/index.js.map +0 -1
  126. package/dist/cjs/src/components/Designer/index.js +0 -235
  127. package/dist/cjs/src/components/Designer/index.js.map +0 -1
  128. package/dist/cjs/src/components/Divider.js +0 -9
  129. package/dist/cjs/src/components/Divider.js.map +0 -1
  130. package/dist/cjs/src/components/Error.js +0 -41
  131. package/dist/cjs/src/components/Error.js.map +0 -1
  132. package/dist/cjs/src/components/Paper.js +0 -63
  133. package/dist/cjs/src/components/Paper.js.map +0 -1
  134. package/dist/cjs/src/components/Preview.js +0 -102
  135. package/dist/cjs/src/components/Preview.js.map +0 -1
  136. package/dist/cjs/src/components/Root.js +0 -52
  137. package/dist/cjs/src/components/Root.js.map +0 -1
  138. package/dist/cjs/src/components/Schemas/BarcodeSchema.js +0 -94
  139. package/dist/cjs/src/components/Schemas/BarcodeSchema.js.map +0 -1
  140. package/dist/cjs/src/components/Schemas/ImageSchema.js +0 -72
  141. package/dist/cjs/src/components/Schemas/ImageSchema.js.map +0 -1
  142. package/dist/cjs/src/components/Schemas/SchemaUI.js +0 -55
  143. package/dist/cjs/src/components/Schemas/SchemaUI.js.map +0 -1
  144. package/dist/cjs/src/components/Schemas/TextSchema.js +0 -54
  145. package/dist/cjs/src/components/Schemas/TextSchema.js.map +0 -1
  146. package/dist/cjs/src/components/Spinner.js +0 -31
  147. package/dist/cjs/src/components/Spinner.js.map +0 -1
  148. package/dist/cjs/src/components/UnitPager.js +0 -63
  149. package/dist/cjs/src/components/UnitPager.js.map +0 -1
  150. package/dist/cjs/src/constants.js +0 -10
  151. package/dist/cjs/src/constants.js.map +0 -1
  152. package/dist/cjs/src/contexts.js +0 -10
  153. package/dist/cjs/src/contexts.js.map +0 -1
  154. package/dist/cjs/src/helper.js +0 -466
  155. package/dist/cjs/src/helper.js.map +0 -1
  156. package/dist/cjs/src/hooks.js +0 -100
  157. package/dist/cjs/src/hooks.js.map +0 -1
  158. package/dist/cjs/src/i18n.js +0 -50
  159. package/dist/cjs/src/i18n.js.map +0 -1
  160. package/dist/cjs/src/index.js +0 -24
  161. package/dist/cjs/src/index.js.map +0 -1
  162. package/dist/esm/__tests__/assets/helper.js +0 -51
  163. package/dist/esm/__tests__/assets/helper.js.map +0 -1
  164. package/dist/esm/__tests__/components/Designer.test.js +0 -34
  165. package/dist/esm/__tests__/components/Designer.test.js.map +0 -1
  166. package/dist/esm/__tests__/components/Preview.test.js +0 -46
  167. package/dist/esm/__tests__/components/Preview.test.js.map +0 -1
  168. package/dist/esm/__tests__/helper.test.js +0 -92
  169. package/dist/esm/__tests__/helper.test.js.map +0 -1
  170. package/dist/esm/src/Designer.js +0 -56
  171. package/dist/esm/src/Designer.js.map +0 -1
  172. package/dist/esm/src/Form.js +0 -30
  173. package/dist/esm/src/Form.js.map +0 -1
  174. package/dist/esm/src/Viewer.js +0 -20
  175. package/dist/esm/src/Viewer.js.map +0 -1
  176. package/dist/esm/src/class.js +0 -114
  177. package/dist/esm/src/class.js.map +0 -1
  178. package/dist/esm/src/components/CtlBar/Pager.js +0 -24
  179. package/dist/esm/src/components/CtlBar/Pager.js.map +0 -1
  180. package/dist/esm/src/components/CtlBar/Zoom.js +0 -26
  181. package/dist/esm/src/components/CtlBar/Zoom.js.map +0 -1
  182. package/dist/esm/src/components/CtlBar/index.js +0 -28
  183. package/dist/esm/src/components/CtlBar/index.js.map +0 -1
  184. package/dist/esm/src/components/Designer/Main/Guides.js +0 -28
  185. package/dist/esm/src/components/Designer/Main/Guides.js.map +0 -1
  186. package/dist/esm/src/components/Designer/Main/Mask.js +0 -13
  187. package/dist/esm/src/components/Designer/Main/Mask.js.map +0 -1
  188. package/dist/esm/src/components/Designer/Main/Moveable.js +0 -9
  189. package/dist/esm/src/components/Designer/Main/Moveable.js.map +0 -1
  190. package/dist/esm/src/components/Designer/Main/Selecto.js +0 -6
  191. package/dist/esm/src/components/Designer/Main/Selecto.js.map +0 -1
  192. package/dist/esm/src/components/Designer/Main/index.js +0 -196
  193. package/dist/esm/src/components/Designer/Main/index.js.map +0 -1
  194. package/dist/esm/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.js +0 -44
  195. package/dist/esm/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.js.map +0 -1
  196. package/dist/esm/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.js +0 -179
  197. package/dist/esm/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.js.map +0 -1
  198. package/dist/esm/src/components/Designer/Sidebar/DetailView/TextPropEditor.js +0 -91
  199. package/dist/esm/src/components/Designer/Sidebar/DetailView/TextPropEditor.js.map +0 -1
  200. package/dist/esm/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.js +0 -47
  201. package/dist/esm/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.js.map +0 -1
  202. package/dist/esm/src/components/Designer/Sidebar/DetailView/index.js +0 -26
  203. package/dist/esm/src/components/Designer/Sidebar/DetailView/index.js.map +0 -1
  204. package/dist/esm/src/components/Designer/Sidebar/ListView/Item.js +0 -51
  205. package/dist/esm/src/components/Designer/Sidebar/ListView/Item.js.map +0 -1
  206. package/dist/esm/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.js +0 -80
  207. package/dist/esm/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.js.map +0 -1
  208. package/dist/esm/src/components/Designer/Sidebar/ListView/SelectableSortableItem.js +0 -34
  209. package/dist/esm/src/components/Designer/Sidebar/ListView/SelectableSortableItem.js.map +0 -1
  210. package/dist/esm/src/components/Designer/Sidebar/ListView/index.js +0 -56
  211. package/dist/esm/src/components/Designer/Sidebar/ListView/index.js.map +0 -1
  212. package/dist/esm/src/components/Designer/Sidebar/index.js +0 -77
  213. package/dist/esm/src/components/Designer/Sidebar/index.js.map +0 -1
  214. package/dist/esm/src/components/Designer/index.js +0 -207
  215. package/dist/esm/src/components/Designer/index.js.map +0 -1
  216. package/dist/esm/src/components/Divider.js +0 -4
  217. package/dist/esm/src/components/Divider.js.map +0 -1
  218. package/dist/esm/src/components/Error.js +0 -16
  219. package/dist/esm/src/components/Error.js.map +0 -1
  220. package/dist/esm/src/components/Paper.js +0 -38
  221. package/dist/esm/src/components/Paper.js.map +0 -1
  222. package/dist/esm/src/components/Preview.js +0 -74
  223. package/dist/esm/src/components/Preview.js.map +0 -1
  224. package/dist/esm/src/components/Root.js +0 -24
  225. package/dist/esm/src/components/Root.js.map +0 -1
  226. package/dist/esm/src/components/Schemas/BarcodeSchema.js +0 -69
  227. package/dist/esm/src/components/Schemas/BarcodeSchema.js.map +0 -1
  228. package/dist/esm/src/components/Schemas/ImageSchema.js +0 -47
  229. package/dist/esm/src/components/Schemas/ImageSchema.js.map +0 -1
  230. package/dist/esm/src/components/Schemas/SchemaUI.js +0 -27
  231. package/dist/esm/src/components/Schemas/SchemaUI.js.map +0 -1
  232. package/dist/esm/src/components/Schemas/TextSchema.js +0 -29
  233. package/dist/esm/src/components/Schemas/TextSchema.js.map +0 -1
  234. package/dist/esm/src/components/Spinner.js +0 -26
  235. package/dist/esm/src/components/Spinner.js.map +0 -1
  236. package/dist/esm/src/components/UnitPager.js +0 -58
  237. package/dist/esm/src/components/UnitPager.js.map +0 -1
  238. package/dist/esm/src/constants.js +0 -7
  239. package/dist/esm/src/constants.js.map +0 -1
  240. package/dist/esm/src/contexts.js +0 -7
  241. package/dist/esm/src/contexts.js.map +0 -1
  242. package/dist/esm/src/helper.js +0 -439
  243. package/dist/esm/src/helper.js.map +0 -1
  244. package/dist/esm/src/hooks.js +0 -93
  245. package/dist/esm/src/hooks.js.map +0 -1
  246. package/dist/esm/src/i18n.js +0 -46
  247. package/dist/esm/src/i18n.js.map +0 -1
  248. package/dist/esm/src/index.js +0 -6
  249. package/dist/esm/src/index.js.map +0 -1
  250. package/dist/types/__tests__/assets/helper.d.ts +0 -3
  251. package/dist/types/__tests__/components/Designer.test.d.ts +0 -1
  252. package/dist/types/__tests__/components/Preview.test.d.ts +0 -1
  253. package/dist/types/__tests__/helper.test.d.ts +0 -1
  254. package/dist/types/src/components/Designer/Main/Moveable.d.ts +0 -31
  255. package/dist/types/src/index.d.ts +0 -6
  256. package/tsconfig.cjs.json +0 -10
  257. package/tsconfig.esm.json +0 -10
  258. /package/dist/types/{src/components → components}/Designer/Main/Guides.d.ts +0 -0
  259. /package/dist/types/{src/components → components}/Designer/Main/index.d.ts +0 -0
  260. /package/dist/types/{src/components → components}/Designer/Sidebar/ListView/Item.d.ts +0 -0
  261. /package/dist/types/{src/components → components}/Designer/Sidebar/ListView/SelectableSortableItem.d.ts +0 -0
  262. /package/dist/types/{src/components → components}/Paper.d.ts +0 -0
  263. /package/dist/types/{src/components → components}/Root.d.ts +0 -0
  264. /package/dist/types/{src/constants.d.ts → constants.d.ts} +0 -0
  265. /package/dist/types/{src/hooks.d.ts → hooks.d.ts} +0 -0
  266. /package/dist/types/{src/i18n.d.ts → i18n.d.ts} +0 -0
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import Selecto, { OnDragStart as _OnDragStart, OnSelect as _OnSelect } from 'react-selecto';
3
- import { SELECTABLE_CLASSNAME } from '../../../constants.js';
3
+ import { SELECTABLE_CLASSNAME } from '../../../constants';
4
4
 
5
5
  const _Selecto = ({
6
6
  container,
@@ -7,26 +7,30 @@ import React, {
7
7
  forwardRef,
8
8
  useCallback,
9
9
  } from 'react';
10
- import { OnDrag, OnResize, OnClick } from 'react-moveable';
10
+ import { OnDrag, OnResize, OnRotate, OnClick } from 'react-moveable';
11
11
  import { SchemaForUI, Size } from '@pdfme/common';
12
- import { ZOOM, RULER_HEIGHT } from '../../../constants.js';
13
- import { usePrevious } from '../../../hooks.js';
14
- import { uuid, round, flatten } from '../../../helper.js';
15
- import Paper from '../../Paper.js';
16
- import SchemaUI from '../../Schemas/SchemaUI.js';
17
- import Selecto from './Selecto.js';
18
- import Moveable from './Moveable.js';
19
- import Guides from './Guides.js';
20
- import Mask from './Mask.js';
12
+ import { XMarkIcon } from '@heroicons/react/24/outline';
13
+ import { ZOOM, RULER_HEIGHT } from '../../../constants';
14
+ import { usePrevious } from '../../../hooks';
15
+ import { uuid, round, flatten } from '../../../helper';
16
+ import Paper from '../../Paper';
17
+ import SchemaUI from '../../Schemas/SchemaUI';
18
+ import Selecto from './Selecto';
19
+ import Moveable from './Moveable';
20
+ import Guides from './Guides';
21
+ import Mask from './Mask';
21
22
 
22
23
  const DELETE_BTN_ID = uuid();
23
- const fmt4Num = (prop: string) => Number(prop.replace('px', ''));
24
- const fmt = (prop: string) => round(fmt4Num(prop) / ZOOM, 2);
24
+ const px2Num = (prop: string) => Number(prop.replace('px', ''));
25
+ const transformRotate2Num = (transform: string) =>
26
+ Number(transform.match(/rotate\(([^deg)]*)deg\)/)?.[1]) || 0;
27
+ const fmtPx = (prop: string) => round(px2Num(prop) / ZOOM, 2);
28
+ const fmtDeg = (prop: string) => round(transformRotate2Num(prop), 2);
25
29
  const isTopLeftResize = (d: string) => d === '-1,-1' || d === '-1,0' || d === '0,-1';
26
30
 
27
31
  const DeleteButton = ({ activeElements: aes }: { activeElements: HTMLElement[] }) => {
28
- const top = Math.min(...aes.map(({ style }) => fmt4Num(style.top)));
29
- const left = Math.max(...aes.map(({ style }) => fmt4Num(style.left) + fmt4Num(style.width))) + 10;
32
+ const top = Math.min(...aes.map(({ style }) => px2Num(style.top)));
33
+ const left = Math.max(...aes.map(({ style }) => px2Num(style.left) + px2Num(style.width))) + 10;
30
34
 
31
35
  return (
32
36
  <button
@@ -49,16 +53,7 @@ const DeleteButton = ({ activeElements: aes }: { activeElements: HTMLElement[] }
49
53
  justifyContent: 'center',
50
54
  }}
51
55
  >
52
- <svg
53
- style={{ pointerEvents: 'none' }}
54
- xmlns="http://www.w3.org/2000/svg"
55
- fill="none"
56
- viewBox="0 0 24 24"
57
- strokeWidth="1.5"
58
- stroke="currentColor"
59
- >
60
- <path strokeLinecap="round" strokeLinejoin="round" d="M6 18L18 6M6 6l12 12" />
61
- </svg>
56
+ <XMarkIcon width={10} height={10} />
62
57
  </button>
63
58
  );
64
59
  };
@@ -157,15 +152,15 @@ const Main = (props: Props, ref: Ref<HTMLDivElement>) => {
157
152
  const onDragEnd = ({ target }: { target: HTMLElement | SVGElement }) => {
158
153
  const { top, left } = target.style;
159
154
  changeSchemas([
160
- { key: 'position.y', value: fmt(top), schemaId: target.id },
161
- { key: 'position.x', value: fmt(left), schemaId: target.id },
155
+ { key: 'position.y', value: fmtPx(top), schemaId: target.id },
156
+ { key: 'position.x', value: fmtPx(left), schemaId: target.id },
162
157
  ]);
163
158
  };
164
159
 
165
160
  const onDragEnds = ({ targets }: { targets: (HTMLElement | SVGElement)[] }) => {
166
161
  const arg = targets.map(({ style: { top, left }, id }) => [
167
- { key: 'position.y', value: fmt(top), schemaId: id },
168
- { key: 'position.x', value: fmt(left), schemaId: id },
162
+ { key: 'position.y', value: fmtPx(top), schemaId: id },
163
+ { key: 'position.x', value: fmtPx(left), schemaId: id },
169
164
  ]);
170
165
  changeSchemas(flatten(arg));
171
166
  };
@@ -174,19 +169,19 @@ const Main = (props: Props, ref: Ref<HTMLDivElement>) => {
174
169
  const { id, style } = target;
175
170
  const { width, height, top, left } = style;
176
171
  changeSchemas([
177
- { key: 'width', value: fmt(width), schemaId: id },
178
- { key: 'height', value: fmt(height), schemaId: id },
179
- { key: 'position.y', value: fmt(top), schemaId: id },
180
- { key: 'position.x', value: fmt(left), schemaId: id },
172
+ { key: 'width', value: fmtPx(width), schemaId: id },
173
+ { key: 'height', value: fmtPx(height), schemaId: id },
174
+ { key: 'position.y', value: fmtPx(top), schemaId: id },
175
+ { key: 'position.x', value: fmtPx(left), schemaId: id },
181
176
  ]);
182
177
  };
183
178
 
184
179
  const onResizeEnds = ({ targets }: { targets: (HTMLElement | SVGElement)[] }) => {
185
180
  const arg = targets.map(({ style: { width, height, top, left }, id }) => [
186
- { key: 'width', value: fmt(width), schemaId: id },
187
- { key: 'height', value: fmt(height), schemaId: id },
188
- { key: 'position.y', value: fmt(top), schemaId: id },
189
- { key: 'position.x', value: fmt(left), schemaId: id },
181
+ { key: 'width', value: fmtPx(width), schemaId: id },
182
+ { key: 'height', value: fmtPx(height), schemaId: id },
183
+ { key: 'position.y', value: fmtPx(top), schemaId: id },
184
+ { key: 'position.x', value: fmtPx(left), schemaId: id },
190
185
  ]);
191
186
  changeSchemas(flatten(arg));
192
187
  };
@@ -194,8 +189,8 @@ const Main = (props: Props, ref: Ref<HTMLDivElement>) => {
194
189
  const onResize = ({ target, width, height, direction }: OnResize) => {
195
190
  if (!target) return;
196
191
  const s = target.style;
197
- const newLeft = fmt4Num(s.left) + (fmt4Num(s.width) - width);
198
- const newTop = fmt4Num(s.top) + (fmt4Num(s.height) - height);
192
+ const newLeft = px2Num(s.left) + (px2Num(s.width) - width);
193
+ const newTop = px2Num(s.top) + (px2Num(s.height) - height);
199
194
  const obj: { top?: string; left?: string; width: string; height: string } = {
200
195
  width: `${width}px`,
201
196
  height: `${height}px`,
@@ -212,6 +207,25 @@ const Main = (props: Props, ref: Ref<HTMLDivElement>) => {
212
207
  Object.assign(s, obj);
213
208
  };
214
209
 
210
+ const onRotate = ({ target, rotate }: OnRotate) => {
211
+ if (!target) return;
212
+ target.style.transform = `rotate(${rotate}deg)`;
213
+ };
214
+
215
+ const onRotateEnd = ({ target }: { target: HTMLElement | SVGElement }) => {
216
+ const { id, style } = target;
217
+ const { transform } = style;
218
+ changeSchemas([{ key: 'rotate', value: fmtDeg(transform), schemaId: id }]);
219
+ };
220
+
221
+ const onRotateEnds = ({ targets }: { targets: (HTMLElement | SVGElement)[] }) => {
222
+ const arg = targets.map(({ style: { transform }, id }) => [
223
+ { key: 'rotate', value: fmtDeg(transform), schemaId: id },
224
+ { key: 'rotate', value: fmtDeg(transform), schemaId: id },
225
+ ]);
226
+ changeSchemas(flatten(arg));
227
+ };
228
+
215
229
  const getGuideLines = (guides: GuidesInterface[], index: number) =>
216
230
  guides[index] && guides[index].getGuides().map((g) => g * ZOOM);
217
231
 
@@ -308,6 +322,9 @@ const Main = (props: Props, ref: Ref<HTMLDivElement>) => {
308
322
  onResize={onResize}
309
323
  onResizeEnd={onResizeEnd}
310
324
  onResizeGroupEnd={onResizeEnds}
325
+ onRotate={onRotate}
326
+ onRotateEnd={onRotateEnd}
327
+ onRotateGroupEnd={onRotateEnds}
311
328
  onClick={onClickMoveable}
312
329
  />
313
330
  )
@@ -1,7 +1,7 @@
1
1
  import React, { useContext } from 'react';
2
2
  import { SchemaForUI } from '@pdfme/common';
3
- import { readFiles } from '../../../../helper.js';
4
- import { I18nContext } from '../../../../contexts.js';
3
+ import { readFiles } from '../../../../helper';
4
+ import { I18nContext } from '../../../../contexts';
5
5
  import { SidebarProps } from '..';
6
6
  import { XMarkIcon } from '@heroicons/react/24/outline';
7
7
 
@@ -24,15 +24,15 @@ const ExampleInputEditor = (
24
24
  top: 0,
25
25
  left: 0,
26
26
  display: 'flex',
27
- justifyContent: 'center',
28
27
  alignItems: 'center',
28
+ justifyContent: 'center',
29
29
  color: '#333',
30
30
  background: '#f2f2f2',
31
31
  cursor: 'pointer',
32
32
  borderRadius: 2,
33
33
  border: '1px solid #767676',
34
- height: 20,
35
- width: 20,
34
+ height: 24,
35
+ width: 24,
36
36
  }}
37
37
  aria-label="close"
38
38
  onClick={() =>
@@ -1,7 +1,7 @@
1
1
  import React, { CSSProperties } from 'react';
2
2
  import { SchemaForUI } from '@pdfme/common';
3
- import { round } from '../../../../helper.js';
4
- import { SidebarProps } from '../index.js';
3
+ import { round } from '../../../../helper';
4
+ import { SidebarProps } from '../index';
5
5
 
6
6
  const inputSetStyle: CSSProperties = { marginRight: '1rem', display: 'flex', alignItems: 'center' };
7
7
 
@@ -258,6 +258,19 @@ const PositionAndSizeEditor = (
258
258
  <span style={{ fontSize: '0.6rem' }}>mm</span>
259
259
  </div>
260
260
  </div>
261
+ <div style={inputSetStyle}>
262
+ <label style={{ width: 44 }}>Rotate</label>
263
+ <input
264
+ style={inputStyle}
265
+ type="number"
266
+ onChange={(e) => {
267
+ const value = Number(e.target.value || 0);
268
+ changeSchemas([{ key: 'rotate', value, schemaId: activeSchema.id }]);
269
+ }}
270
+ value={activeSchema.rotate || 0}
271
+ />
272
+ <span style={{ fontSize: '0.6rem' }}>deg</span>
273
+ </div>
261
274
  </div>
262
275
  );
263
276
  };
@@ -7,7 +7,7 @@ import {
7
7
  DEFAULT_CHARACTER_SPACING,
8
8
  DEFAULT_FONT_COLOR,
9
9
  } from '@pdfme/common';
10
- import { FontContext } from '../../../../contexts.js';
10
+ import { FontContext } from '../../../../contexts';
11
11
  import { SidebarProps } from '..';
12
12
  import { XMarkIcon } from '@heroicons/react/24/outline';
13
13
 
@@ -53,8 +53,9 @@ const ColorInputSet = (props: {
53
53
  onClick={onClear}
54
54
  style={{
55
55
  display: 'flex',
56
- background: 'none',
57
56
  alignItems: 'center',
57
+ justifyContent: 'center',
58
+ background: 'none',
58
59
  borderRadius: 2,
59
60
  border: '1px solid #767676',
60
61
  cursor: 'pointer',
@@ -1,7 +1,7 @@
1
1
  import React, { useContext, useRef, useCallback } from 'react';
2
2
  import { schemaTypes, SchemaForUI } from '@pdfme/common';
3
- import { SidebarProps } from '../index.js';
4
- import { I18nContext } from '../../../../contexts.js';
3
+ import { SidebarProps } from '../index';
4
+ import { I18nContext } from '../../../../contexts';
5
5
 
6
6
  const ErrorLabel = ({ isError, msg }: { isError: boolean; msg: string }) => (
7
7
  <span
@@ -1,12 +1,12 @@
1
1
  import React, { useContext } from 'react';
2
2
  import { SchemaForUI } from '@pdfme/common';
3
- import { I18nContext } from '../../../../contexts.js';
4
- import Divider from '../../../Divider.js';
5
- import { SidebarProps } from '../index.js';
6
- import TextPropEditor from './TextPropEditor.js';
7
- import ExampleInputEditor from './ExampleInputEditor.js';
8
- import PositionAndSizeEditor from './PositionAndSizeEditor.js';
9
- import TypeAndKeyEditor from './TypeAndKeyEditor.js';
3
+ import { I18nContext } from '../../../../contexts';
4
+ import Divider from '../../../Divider';
5
+ import { SidebarProps } from '../index';
6
+ import TextPropEditor from './TextPropEditor';
7
+ import ExampleInputEditor from './ExampleInputEditor';
8
+ import PositionAndSizeEditor from './PositionAndSizeEditor';
9
+ import TypeAndKeyEditor from './TypeAndKeyEditor';
10
10
 
11
11
  const DetailView = (
12
12
  props: Pick<SidebarProps, 'schemas' | 'pageSize' | 'changeSchemas' | 'activeElements'> & {
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useContext } from 'react';
2
2
  import { DraggableSyntheticListeners } from '@dnd-kit/core';
3
- import { I18nContext } from '../../../../contexts.js';
3
+ import { I18nContext } from '../../../../contexts';
4
4
  import { ExclamationTriangleIcon } from '@heroicons/react/24/outline';
5
5
 
6
6
  interface Props {
@@ -16,9 +16,9 @@ import {
16
16
  verticalListSortingStrategy,
17
17
  } from '@dnd-kit/sortable';
18
18
  import { SchemaForUI } from '@pdfme/common';
19
- import Item from './Item.js';
20
- import SelectableSortableItem from './SelectableSortableItem.js';
21
- import { SidebarProps } from '../index.js';
19
+ import Item from './Item';
20
+ import SelectableSortableItem from './SelectableSortableItem';
21
+ import { SidebarProps } from '../index';
22
22
 
23
23
  const SelectableSortableContainer = (
24
24
  props: Pick<
@@ -106,55 +106,59 @@ const SelectableSortableContainer = (
106
106
  setClonedItems(null);
107
107
  }}
108
108
  >
109
- <div style={{ height, overflowY: 'auto' }}>
110
- <SortableContext items={schemas} strategy={verticalListSortingStrategy}>
111
- <ul style={{ margin: 0, padding: 0, listStyle: 'none', borderRadius: 5 }}>
112
- {schemas.map((schema) => (
113
- <SelectableSortableItem
114
- key={schema.id}
115
- style={{
116
- border: `1px solid ${schema.id === hoveringSchemaId ? '#18a0fb' : 'transparent'}`,
117
- }}
118
- schema={schema}
119
- schemas={schemas}
120
- isSelected={isItemSelected(schema.id) || activeId === schema.id}
121
- onEdit={onEdit}
122
- onSelect={onSelectionChanged}
123
- onMouseEnter={() => onChangeHoveringSchemaId(schema.id)}
124
- onMouseLeave={() => onChangeHoveringSchemaId(null)}
125
- />
126
- ))}
127
- </ul>
128
- </SortableContext>
129
- </div>
130
- {createPortal(
131
- <DragOverlay adjustScale>
132
- {activeId ? (
133
- <>
134
- <ul style={{ margin: 0, padding: 0, listStyle: 'none' }}>
135
- <Item
136
- value={schemas.find((schema) => schema.id === activeId)!.key}
137
- style={{ color: '#fff', background: '#18a0fb' }}
138
- dragOverlay
109
+ <>
110
+ <div style={{ height, overflowY: 'auto' }}>
111
+ <SortableContext items={schemas} strategy={verticalListSortingStrategy}>
112
+ <ul style={{ margin: 0, padding: 0, listStyle: 'none', borderRadius: 5 }}>
113
+ {schemas.map((schema) => (
114
+ <SelectableSortableItem
115
+ key={schema.id}
116
+ style={{
117
+ border: `1px solid ${
118
+ schema.id === hoveringSchemaId ? '#18a0fb' : 'transparent'
119
+ }`,
120
+ }}
121
+ schema={schema}
122
+ schemas={schemas}
123
+ isSelected={isItemSelected(schema.id) || activeId === schema.id}
124
+ onEdit={onEdit}
125
+ onSelect={onSelectionChanged}
126
+ onMouseEnter={() => onChangeHoveringSchemaId(schema.id)}
127
+ onMouseLeave={() => onChangeHoveringSchemaId(null)}
139
128
  />
140
- </ul>
141
- <ul style={{ margin: 0, padding: 0, listStyle: 'none' }}>
142
- {selectedSchemas
143
- .filter((item) => item.id !== activeId)
144
- .map((item) => (
145
- <Item
146
- key={item.id}
147
- value={item.key}
148
- style={{ color: '#fff', background: '#18a0fb' }}
149
- dragOverlay
150
- />
151
- ))}
152
- </ul>
153
- </>
154
- ) : null}
155
- </DragOverlay>,
156
- document.body
157
- )}
129
+ ))}
130
+ </ul>
131
+ </SortableContext>
132
+ </div>
133
+ {createPortal(
134
+ <DragOverlay adjustScale>
135
+ {activeId ? (
136
+ <>
137
+ <ul style={{ margin: 0, padding: 0, listStyle: 'none' }}>
138
+ <Item
139
+ value={schemas.find((schema) => schema.id === activeId)!.key}
140
+ style={{ color: '#fff', background: '#18a0fb' }}
141
+ dragOverlay
142
+ />
143
+ </ul>
144
+ <ul style={{ margin: 0, padding: 0, listStyle: 'none' }}>
145
+ {selectedSchemas
146
+ .filter((item) => item.id !== activeId)
147
+ .map((item) => (
148
+ <Item
149
+ key={item.id}
150
+ value={item.key}
151
+ style={{ color: '#fff', background: '#18a0fb' }}
152
+ dragOverlay
153
+ />
154
+ ))}
155
+ </ul>
156
+ </>
157
+ ) : null}
158
+ </DragOverlay>,
159
+ document.body
160
+ )}
161
+ </>
158
162
  </DndContext>
159
163
  );
160
164
  };
@@ -1,9 +1,9 @@
1
1
  import React, { useContext } from 'react';
2
2
  import { useSortable } from '@dnd-kit/sortable';
3
3
  import { SchemaForUI } from '@pdfme/common';
4
- import { I18nContext } from '../../../../contexts.js';
5
- import Item from './Item.js';
6
- import { useMountStatus } from '../../../../hooks.js';
4
+ import { I18nContext } from '../../../../contexts';
5
+ import Item from './Item';
6
+ import { useMountStatus } from '../../../../hooks';
7
7
 
8
8
  interface Props {
9
9
  isSelected: boolean;
@@ -1,9 +1,9 @@
1
1
  import React, { useContext, useState } from 'react';
2
- import { RULER_HEIGHT, SIDEBAR_WIDTH } from '../../../../constants.js';
3
- import { I18nContext } from '../../../../contexts.js';
4
- import Divider from '../../../Divider.js';
5
- import SelectableSortableContainer from './SelectableSortableContainer.js';
6
- import { SidebarProps } from '../index.js';
2
+ import { RULER_HEIGHT, SIDEBAR_WIDTH } from '../../../../constants';
3
+ import { I18nContext } from '../../../../contexts';
4
+ import Divider from '../../../Divider';
5
+ import SelectableSortableContainer from './SelectableSortableContainer';
6
+ import { SidebarProps } from '../index';
7
7
 
8
8
  const ListView = (
9
9
  props: Pick<
@@ -1,10 +1,10 @@
1
1
  import React, { useState, useContext } from 'react';
2
2
  import { SchemaForUI, Size } from '@pdfme/common';
3
- import { RULER_HEIGHT, SIDEBAR_WIDTH } from '../../../constants.js';
4
- import { I18nContext } from '../../../contexts.js';
3
+ import { RULER_HEIGHT, SIDEBAR_WIDTH } from '../../../constants';
4
+ import { I18nContext } from '../../../contexts';
5
5
  import { ArrowLeftIcon, ArrowRightIcon } from '@heroicons/react/24/outline';
6
- import ListView from './ListView/index.js';
7
- import DetailView from './DetailView/index.js';
6
+ import ListView from './ListView/index';
7
+ import DetailView from './DetailView/index';
8
8
 
9
9
  export type SidebarProps = {
10
10
  height: number;
@@ -1,9 +1,9 @@
1
1
  import React, { useRef, useState, useEffect, useContext, useCallback } from 'react';
2
2
  import { DesignerReactProps, Template, SchemaForUI } from '@pdfme/common';
3
- import Sidebar from './Sidebar/index.js';
4
- import Main from './Main/index.js';
5
- import { ZOOM, RULER_HEIGHT } from '../../constants.js';
6
- import { I18nContext } from '../../contexts.js';
3
+ import Sidebar from './Sidebar/index';
4
+ import Main from './Main/index';
5
+ import { ZOOM, RULER_HEIGHT } from '../../constants';
6
+ import { I18nContext } from '../../contexts';
7
7
  import {
8
8
  uuid,
9
9
  set,
@@ -18,11 +18,11 @@ import {
18
18
  getUniqSchemaKey,
19
19
  moveCommandToChangeSchemasArg,
20
20
  getPagesScrollTopByIndex,
21
- } from '../../helper.js';
22
- import { useUIPreProcessor, useScrollPageCursor } from '../../hooks.js';
23
- import Root from '../Root.js';
24
- import Error from '../Error.js';
25
- import CtlBar from '../CtlBar/index.js';
21
+ } from '../../helper';
22
+ import { useUIPreProcessor, useScrollPageCursor } from '../../hooks';
23
+ import Root from '../Root';
24
+ import Error from '../Error';
25
+ import CtlBar from '../CtlBar/index';
26
26
 
27
27
  const TemplateEditor = ({
28
28
  template,
@@ -1,6 +1,6 @@
1
1
  import React, { useContext } from 'react';
2
2
  import { Size } from '@pdfme/common';
3
- import { I18nContext } from '../contexts.js';
3
+ import { I18nContext } from '../contexts';
4
4
 
5
5
  const Error = ({ size, error }: { size: Size; error: Error }) => {
6
6
  const i18n = useContext(I18nContext);
@@ -1,7 +1,7 @@
1
1
  import React, { MutableRefObject, ReactNode, useContext } from 'react';
2
2
  import { SchemaForUI, Size, getFallbackFontName } from '@pdfme/common';
3
- import { FontContext } from '../contexts.js';
4
- import { ZOOM, RULER_HEIGHT } from '../constants.js';
3
+ import { FontContext } from '../contexts';
4
+ import { ZOOM, RULER_HEIGHT } from '../constants';
5
5
 
6
6
  const Paper = (porps: {
7
7
  paperRefs: MutableRefObject<HTMLDivElement[]>;
@@ -1,14 +1,14 @@
1
1
  import React, { useCallback, useRef, useState, useEffect } from 'react';
2
2
  import { PreviewReactProps, SchemaForUI } from '@pdfme/common';
3
- import { ZOOM, RULER_HEIGHT } from '../constants.js';
4
- import UnitPager from './UnitPager.js';
5
- import Root from './Root.js';
6
- import Error from './Error.js';
7
- import CtlBar from './CtlBar/index.js';
8
- import Paper from './Paper.js';
9
- import SchemaUI from './Schemas/SchemaUI.js';
10
- import { useUIPreProcessor, useScrollPageCursor } from '../hooks.js';
11
- import { templateSchemas2SchemasList, getPagesScrollTopByIndex } from '../helper.js';
3
+ import { ZOOM, RULER_HEIGHT } from '../constants';
4
+ import UnitPager from './UnitPager';
5
+ import Root from './Root';
6
+ import Error from './Error';
7
+ import CtlBar from './CtlBar/index';
8
+ import Paper from './Paper';
9
+ import SchemaUI from './Schemas/SchemaUI';
10
+ import { useUIPreProcessor, useScrollPageCursor } from '../hooks';
11
+ import { templateSchemas2SchemasList, getPagesScrollTopByIndex } from '../helper';
12
12
 
13
13
  const Preview = ({ template, inputs, size, onChangeInput }: PreviewReactProps) => {
14
14
  const rootRef = useRef<HTMLDivElement>(null);
@@ -1,8 +1,7 @@
1
- import type {} from 'css-font-loading-module';
2
1
  import React, { useContext, forwardRef, ReactNode, Ref, useEffect } from 'react';
3
2
  import { Size } from '@pdfme/common';
4
- import { FontContext } from '../contexts.js';
5
- import Spinner from './Spinner.js';
3
+ import { FontContext } from '../contexts';
4
+ import Spinner from './Spinner';
6
5
 
7
6
  type Props = { size: Size; scale: number; children: ReactNode };
8
7
 
@@ -10,17 +9,20 @@ const Root = ({ size, scale, children }: Props, ref: Ref<HTMLDivElement>) => {
10
9
  const font = useContext(FontContext);
11
10
 
12
11
  useEffect(() => {
13
- const fontFaces = Object.entries(font).map((entry) => {
14
- const [key, value] = entry;
15
- const fontFace = new FontFace(key, value.data);
12
+ if (!document || !document.fonts) return;
13
+ const fontFaces = Object.entries(font).map(
14
+ ([key, { data }]) =>
15
+ new FontFace(key, typeof data === 'string' ? `url(${data})` : data, {
16
+ display: 'swap',
17
+ })
18
+ );
19
+ // @ts-ignore
20
+ const newFontFaces = fontFaces.filter((fontFace) => !document.fonts.has(fontFace));
16
21
 
17
- return fontFace.load();
18
- });
19
- Promise.all(fontFaces).then((loadedFontFaces) => {
22
+ Promise.all(newFontFaces.map((f) => f.load())).then((loadedFontFaces) => {
20
23
  loadedFontFaces.forEach((loadedFontFace) => {
21
- if (document && document.fonts && document.fonts.add) {
22
- document.fonts.add(loadedFontFace);
23
- }
24
+ // @ts-ignore
25
+ document.fonts.add(loadedFontFace);
24
26
  });
25
27
  });
26
28
  }, [font]);
@@ -1,7 +1,7 @@
1
1
  import React, { forwardRef, Ref } from 'react';
2
2
  import { validateBarcodeInput, BarCodeType, BarcodeSchema } from '@pdfme/common';
3
- import { ZOOM } from '../../constants.js';
4
- import { SchemaUIProps } from './SchemaUI.js';
3
+ import { ZOOM } from '../../constants';
4
+ import { SchemaUIProps } from './SchemaUI';
5
5
 
6
6
  const barcodeExampleImageObj: { [key: string]: string } = {
7
7
  qrcode:
@@ -1,8 +1,8 @@
1
1
  import React, { useState, forwardRef, ChangeEvent, Ref } from 'react';
2
2
  import { ImageSchema } from '@pdfme/common';
3
- import { SchemaUIProps } from './SchemaUI.js';
4
- import { readFiles } from '../../helper.js';
5
- import { ZOOM } from '../../constants.js';
3
+ import { SchemaUIProps } from './SchemaUI';
4
+ import { readFiles } from '../../helper';
5
+ import { ZOOM } from '../../constants';
6
6
  import { XMarkIcon } from '@heroicons/react/24/outline';
7
7
 
8
8
  type Props = SchemaUIProps & { schema: ImageSchema };
@@ -46,8 +46,8 @@ const ImageSchemaUI = (props: Props, ref: Ref<HTMLInputElement>) => {
46
46
  borderRadius: 2,
47
47
  border: '1px solid #767676',
48
48
  cursor: 'pointer',
49
- height: 20,
50
- width: 20,
49
+ height: 24,
50
+ width: 24,
51
51
  }}
52
52
  aria-label="close"
53
53
  onClick={() => {
@@ -1,9 +1,9 @@
1
1
  import React, { forwardRef, RefObject, Ref, ReactNode } from 'react';
2
2
  import { SchemaForUI, isTextSchema, isImageSchema, isBarcodeSchema } from '@pdfme/common';
3
- import { ZOOM, SELECTABLE_CLASSNAME } from '../../constants.js';
4
- import TextSchema from './TextSchema.js';
5
- import ImageSchema from './ImageSchema.js';
6
- import BarcodeSchema from './BarcodeSchema.js';
3
+ import { ZOOM, SELECTABLE_CLASSNAME } from '../../constants';
4
+ import TextSchema from './TextSchema';
5
+ import ImageSchema from './ImageSchema';
6
+ import BarcodeSchema from './BarcodeSchema';
7
7
 
8
8
  export interface SchemaUIProps {
9
9
  schema: SchemaForUI;
@@ -37,6 +37,7 @@ const Wrapper = ({
37
37
  width: schema.width * ZOOM,
38
38
  top: schema.position.y * ZOOM,
39
39
  left: schema.position.x * ZOOM,
40
+ transform: `rotate(${schema.rotate || 0}deg)`,
40
41
  border,
41
42
  }}
42
43
  >
@@ -7,8 +7,8 @@ import {
7
7
  DEFAULT_FONT_COLOR,
8
8
  TextSchema,
9
9
  } from '@pdfme/common';
10
- import { SchemaUIProps } from './SchemaUI.js';
11
- import { ZOOM } from '../../constants.js';
10
+ import { SchemaUIProps } from './SchemaUI';
11
+ import { ZOOM } from '../../constants';
12
12
 
13
13
  type Props = SchemaUIProps & { schema: TextSchema };
14
14