@iris-ui-kit/vue 0.2.24 → 0.2.25

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/dist/index.cjs CHANGED
@@ -19064,13 +19064,11 @@ var IrisLongPress = vue.defineComponent({
19064
19064
  longpress: () => true
19065
19065
  },
19066
19066
  setup(props, { slots, emit }) {
19067
- const ctrl = core.createLongPress({
19068
- holdDelay: props.holdDelay,
19069
- onLongPress: () => {
19070
- props.onLongPress?.();
19071
- emit("longpress");
19072
- }
19073
- });
19067
+ const fire = () => {
19068
+ props.onLongPress?.();
19069
+ emit("longpress");
19070
+ };
19071
+ let ctrl = core.createLongPress({ holdDelay: props.holdDelay, onLongPress: fire });
19074
19072
  const onPointerDown = () => {
19075
19073
  if (props.disabled) return;
19076
19074
  ctrl.press();
@@ -19081,6 +19079,24 @@ var IrisLongPress = vue.defineComponent({
19081
19079
  const onPointerLeave = () => {
19082
19080
  ctrl.cancel();
19083
19081
  };
19082
+ const onPointerCancel = () => {
19083
+ ctrl.cancel();
19084
+ };
19085
+ vue.watch(
19086
+ () => props.holdDelay,
19087
+ (holdDelay) => {
19088
+ const wasPressing = ctrl.state() === "pressing";
19089
+ ctrl.cancel();
19090
+ ctrl = core.createLongPress({ holdDelay, onLongPress: fire });
19091
+ if (wasPressing) ctrl.press();
19092
+ }
19093
+ );
19094
+ vue.watch(
19095
+ () => props.disabled,
19096
+ (disabled) => {
19097
+ if (disabled) ctrl.cancel();
19098
+ }
19099
+ );
19084
19100
  vue.onBeforeUnmount(() => ctrl.cancel());
19085
19101
  return () => vue.h(
19086
19102
  "span",
@@ -19089,7 +19105,8 @@ var IrisLongPress = vue.defineComponent({
19089
19105
  style: { display: "contents" },
19090
19106
  onPointerdown: onPointerDown,
19091
19107
  onPointerup: onPointerUp,
19092
- onPointerleave: onPointerLeave
19108
+ onPointerleave: onPointerLeave,
19109
+ onPointercancel: onPointerCancel
19093
19110
  },
19094
19111
  slots.default?.()
19095
19112
  );