@pdfme/ui 1.0.15 → 1.0.17

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/ui",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "author": "hand-dot",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -33,17 +33,32 @@ const DeleteButton = ({ activeElements: aes }: { activeElements: HTMLElement[] }
33
33
  id={DELETE_BTN_ID}
34
34
  style={{
35
35
  position: 'absolute',
36
+ zIndex: 1,
36
37
  top,
37
38
  left,
39
+ height: 24,
40
+ width: 24,
38
41
  cursor: 'pointer',
39
42
  color: 'white',
40
43
  border: 'none',
41
44
  fontWeight: 'bold',
42
45
  borderRadius: 2,
43
46
  background: 'rgb(68, 170, 255)',
47
+ display: 'flex',
48
+ alignItems: 'center',
49
+ justifyContent: 'center',
44
50
  }}
45
51
  >
46
- x
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>
47
62
  </button>
48
63
  );
49
64
  };
@@ -218,7 +233,7 @@ const Main = (props: Props, ref: Ref<HTMLDivElement>) => {
218
233
  e.stopPropagation();
219
234
  setEditing(false);
220
235
  }}
221
- style={{ overflowX: 'auto' }}
236
+ style={{ overflow: 'overlay' }}
222
237
  >
223
238
  <Selecto
224
239
  container={paperRefs.current[pageCursor]}
@@ -29,7 +29,7 @@ const ListView = (
29
29
  const i18n = useContext(I18nContext);
30
30
  const [isBulkUpdateFieldNamesMode, setIsBulkUpdateFieldNamesMode] = useState(false);
31
31
  const [fieldNamesValue, setFieldNamesValue] = useState('');
32
- const height = size.height - RULER_HEIGHT * ZOOM - 135;
32
+ const height = size.height - RULER_HEIGHT - RULER_HEIGHT / 2 - 145;
33
33
  return (
34
34
  <div>
35
35
  <div style={{ height: 40, display: 'flex', alignItems: 'center' }}>
@@ -69,7 +69,7 @@ const Sidebar = (props: SidebarProps) => {
69
69
  <div
70
70
  style={{
71
71
  width: SIDEBAR_WIDTH,
72
- height: size.height - RULER_HEIGHT * ZOOM,
72
+ height: size.height - RULER_HEIGHT - RULER_HEIGHT / 2,
73
73
  display: open ? 'block' : 'none',
74
74
  top: RULER_HEIGHT / 2,
75
75
  right: 0,
@@ -29,16 +29,9 @@ const Root = ({ size, scale, children }: Props, ref: Ref<HTMLDivElement>) => {
29
29
  return (
30
30
  <div
31
31
  ref={ref}
32
- style={{ position: 'relative', background: 'rgb(74, 74, 74)', overflow: 'auto', ...size }}
32
+ style={{ position: 'relative', background: 'rgb(74, 74, 74)', overflow: 'overlay', ...size }}
33
33
  >
34
- <div
35
- style={{
36
- margin: '0 auto',
37
- height: size.height - RULER_HEIGHT * scale,
38
- }}
39
- >
40
- {scale === 0 ? <Spinner /> : children}
41
- </div>
34
+ <div style={{ margin: '0 auto', ...size }}>{scale === 0 ? <Spinner /> : children}</div>
42
35
  </div>
43
36
  );
44
37
  };
package/src/hooks.ts CHANGED
@@ -12,7 +12,8 @@ export const usePrevious = <T>(value: T) => {
12
12
  return ref.current;
13
13
  };
14
14
 
15
- const getScale = (n: number, paper: number) => (n / paper > 1 ? 1 : n / paper);
15
+ const getScale = (n: number, paper: number) =>
16
+ Math.floor((n / paper > 1 ? 1 : n / paper) * 100) / 100;
16
17
 
17
18
  type UIPreProcessorProps = { template: Template; size: Size; zoomLevel: number };
18
19