@onehat/ui 0.4.65 → 0.4.67

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.
@@ -1,4 +1,4 @@
1
- import { forwardRef, useState, } from 'react';
1
+ import { forwardRef, useState, useRef, } from 'react';
2
2
  import {
3
3
  HORIZONTAL,
4
4
  VERTICAL,
@@ -50,6 +50,7 @@ export default function withDraggable(WrappedComponent) {
50
50
  [isDragging, setIsDraggingRaw] = useState(false),
51
51
  [node, setNode] = useState(false),
52
52
  [bounds, setBounds] = useState(null),
53
+ nodeRef = useRef(null), // to get around React Draggable bug // https://stackoverflow.com/a/63603903
53
54
  { block } = useBlocking(),
54
55
  setIsDragging = (value) => {
55
56
  setIsDraggingRaw(value);
@@ -231,10 +232,11 @@ export default function withDraggable(WrappedComponent) {
231
232
  onDrag={handleDrag}
232
233
  onStop={handleStop}
233
234
  position={{ x: 0, y: 0, /* reset to dropped position */ }}
235
+ nodeRef={nodeRef}
234
236
  // bounds={bounds}
235
237
  {...draggableProps}
236
238
  >
237
- <div className="nsResize">
239
+ <div ref={nodeRef} className="nsResize">
238
240
  <WrappedComponent {...propsToPass} ref={ref} />
239
241
  </div>
240
242
  </Draggable>;
@@ -246,9 +248,10 @@ export default function withDraggable(WrappedComponent) {
246
248
  onStop={handleStop}
247
249
  position={{ x: 0, y: 0, /* reset to dropped position */ }}
248
250
  // bounds={bounds}
251
+ nodeRef={nodeRef}
249
252
  {...draggableProps}
250
253
  >
251
- <div className="ewResize" style={{ height: '100%', }}>
254
+ <div ref={nodeRef} className="ewResize" style={{ height: '100%', }}>
252
255
  <WrappedComponent {...propsToPass} ref={ref} />
253
256
  </div>
254
257
  </Draggable>;
@@ -262,9 +265,10 @@ export default function withDraggable(WrappedComponent) {
262
265
  onStop={handleStop}
263
266
  position={{ x: 0, y: 0, /* reset to dropped position */ }}
264
267
  handle={handle}
268
+ nodeRef={nodeRef}
265
269
  {...draggableProps}
266
270
  >
267
- <WrappedComponent {...propsToPass} ref={ref} />
271
+ <WrappedComponent {...propsToPass} ref={nodeRef} />
268
272
  </Draggable>;
269
273
  } else if (CURRENT_MODE === UI_MODE_NATIVE) {
270
274
 
@@ -670,8 +670,14 @@ export default function withEditor(WrappedComponent, isTree = false) {
670
670
  useEffect(() => {
671
671
  setEditorMode(calculateEditorMode());
672
672
 
673
- setIsIgnoreNextSelectionChange(false);
674
673
  setLastSelection(selection);
674
+
675
+ // Push isIgnoreNextSelectionChange until after a microtask to ensure all
676
+ // synchronous operations (including listener callbacks) are complete
677
+ // (this is to prevent the editor from immediately switching modes on doAdd in Tree)
678
+ Promise.resolve().then(() => {
679
+ setIsIgnoreNextSelectionChange(false);
680
+ });
675
681
  }, [selection]);
676
682
 
677
683
  if (self) {
@@ -0,0 +1,10 @@
1
+ import { createIcon } from "../Gluestack/icon";
2
+ import { Path, Svg } from 'react-native-svg';
3
+
4
+ const SvgComponent = createIcon({
5
+ Root: Svg,
6
+ viewBox: '0 0 53.98 53.98',
7
+ path: <Path d="M14.59 0c1.1 1.66 1.74 3.65 1.74 5.79 0 5.82-4.72 10.54-10.54 10.54-2.14 0-4.13-.64-5.79-1.74 1.89 2.86 5.12 4.75 8.8 4.75 5.82 0 10.54-4.72 10.54-10.54 0-3.68-1.89-6.92-4.75-8.8zM49.23 0c1.1 1.66 1.74 3.65 1.74 5.79 0 5.82-4.72 10.54-10.54 10.54-2.14 0-4.13-.64-5.79-1.74 1.89 2.86 5.12 4.75 8.8 4.75 5.82 0 10.54-4.72 10.54-10.54 0-3.68-1.89-6.92-4.75-8.8zM14.59 34.64c1.1 1.66 1.74 3.65 1.74 5.79 0 5.82-4.72 10.54-10.54 10.54-2.14 0-4.13-.64-5.79-1.74 1.89 2.86 5.12 4.75 8.8 4.75 5.82 0 10.54-4.72 10.54-10.54 0-3.68-1.89-6.92-4.75-8.8zM49.23 34.64c1.1 1.66 1.74 3.65 1.74 5.79 0 5.82-4.72 10.54-10.54 10.54-2.14 0-4.13-.64-5.79-1.74 1.89 2.86 5.12 4.75 8.8 4.75 5.82 0 10.54-4.72 10.54-10.54 0-3.68-1.89-6.92-4.75-8.8z" />,
8
+ });
9
+
10
+ export default SvgComponent