@cmdniels/uikit 1.5.1 → 1.5.2

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.
@@ -37,7 +37,11 @@ export default function Sortable(props) {
37
37
  const { value, onValueChange, collisionDetection, modifiers, strategy, onMove, orientation = "vertical", flatCursor = false, disabled = false, getItemValue: getItemValueProp, accessibility, onDragStart: onDragStartProp, onDragEnd: onDragEndProp, onDragCancel: onDragCancelProp } = props, sortableProps = __rest(props, ["value", "onValueChange", "collisionDetection", "modifiers", "strategy", "onMove", "orientation", "flatCursor", "disabled", "getItemValue", "accessibility", "onDragStart", "onDragEnd", "onDragCancel"]);
38
38
  const id = useId();
39
39
  const [activeId, setActiveId] = useState(null);
40
- const sensors = useSensors(useSensor(MouseSensor), useSensor(TouchSensor), useSensor(KeyboardSensor, {
40
+ const sensors = useSensors(useSensor(MouseSensor, {
41
+ activationConstraint: disabled ? { distance: Number.MAX_SAFE_INTEGER } : undefined,
42
+ }), useSensor(TouchSensor, {
43
+ activationConstraint: disabled ? { distance: Number.MAX_SAFE_INTEGER } : undefined,
44
+ }), useSensor(KeyboardSensor, {
41
45
  coordinateGetter: sortableKeyboardCoordinates,
42
46
  }));
43
47
  const config = useMemo(() => orientationConfig[orientation], [orientation]);
@@ -153,9 +157,6 @@ export default function Sortable(props) {
153
157
  flatCursor,
154
158
  disabled,
155
159
  ]);
156
- if (disabled) {
157
- return (_jsx(SortableRootContext.Provider, { value: contextValue, children: sortableProps.children }));
158
- }
159
160
  return (_jsx(SortableRootContext.Provider, { value: contextValue, children: _jsx(DndContext, Object.assign({ collisionDetection: collisionDetection !== null && collisionDetection !== void 0 ? collisionDetection : config.collisionDetection, modifiers: modifiers !== null && modifiers !== void 0 ? modifiers : config.modifiers, sensors: sensors }, sortableProps, { id: id, onDragStart: onDragStart, onDragEnd: onDragEnd, onDragCancel: onDragCancel, accessibility: Object.assign({ announcements,
160
161
  screenReaderInstructions }, accessibility) })) }));
161
162
  }
@@ -27,6 +27,6 @@ export default function SortableItemHandle(props) {
27
27
  }
28
28
  itemContext.setActivatorNodeRef(node);
29
29
  });
30
- const mergedProps = Object.assign(Object.assign(Object.assign(Object.assign({ type: "button", "aria-controls": itemContext.id, "data-disabled": isDisabled, "data-dragging": itemContext.isDragging ? "" : undefined, "data-slot": "sortable-item-handle" }, itemHandleProps), (isDisabled ? {} : itemContext.attributes)), (isDisabled ? {} : itemContext.listeners)), { ref: composedRef, className: cn("select-none disabled:pointer-events-none disabled:opacity-50", context.flatCursor ? "cursor-default" : "cursor-grab data-dragging:cursor-grabbing", className), disabled: isDisabled });
30
+ const mergedProps = Object.assign(Object.assign(Object.assign(Object.assign({ type: "button", "aria-controls": itemContext.id, "data-disabled": isDisabled, "data-dragging": itemContext.isDragging ? "" : undefined, "data-slot": "sortable-item-handle" }, itemHandleProps), (isDisabled ? {} : itemContext.attributes)), (isDisabled ? {} : itemContext.listeners)), { ref: composedRef, className: cn("select-none disabled:pointer-events-none", context.flatCursor ? "cursor-default" : "cursor-grab data-dragging:cursor-grabbing", className), disabled: isDisabled });
31
31
  return render ? cloneElement(render, mergedProps) : _jsx("button", Object.assign({}, mergedProps));
32
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmdniels/uikit",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",