@wix/interact 2.0.0-rc.8 → 2.0.1

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.
@@ -25,16 +25,14 @@ const controller = Interact.getController('my-element');
25
25
 
26
26
  ```typescript
27
27
  interface IInteractionController {
28
- // Properties
29
28
  element: HTMLElement;
30
29
  key: string | undefined;
31
30
  connected: boolean;
32
31
  sheet: CSSStyleSheet | null;
33
- _observers: WeakMap<HTMLElement, MutationObserver>;
32
+ useFirstChild: boolean;
34
33
 
35
- // Methods
36
34
  connect(key?: string): void;
37
- disconnect(): void;
35
+ disconnect(options?: { removeFromCache?: boolean }): void;
38
36
  update(): void;
39
37
  toggleEffect(
40
38
  effectId: string,
@@ -45,7 +43,6 @@ interface IInteractionController {
45
43
  getActiveEffects(): string[];
46
44
  renderStyle(cssRules: string[]): void;
47
45
  watchChildList(listContainer: string): void;
48
- _childListChangeHandler(listContainer: string, entries: MutationRecord[]): void;
49
46
  }
50
47
  ```
51
48
 
@@ -106,9 +103,9 @@ if (controller?.sheet) {
106
103
  }
107
104
  ```
108
105
 
109
- ### `_observers: WeakMap<HTMLElement, MutationObserver>`
106
+ ### `useFirstChild: boolean`
110
107
 
111
- Internal storage for mutation observers watching list containers.
108
+ When `true`, the interaction target is the first child (e.g. with `<interact-element>`). Set via constructor options.
112
109
 
113
110
  ## Methods
114
111
 
@@ -143,32 +140,28 @@ if (controller && !controller.connected) {
143
140
  4. Calls internal `add()` function to set up interactions
144
141
  5. Sets `connected = true` on success
145
142
 
146
- ### `disconnect()`
143
+ ### `disconnect(options?)`
147
144
 
148
- Disconnects the controller from the interaction system, cleaning up all resources.
145
+ Disconnects the controller and cleans up resources.
149
146
 
150
147
  **Signature:**
151
148
 
152
149
  ```typescript
153
- disconnect(): void
150
+ disconnect(options?: { removeFromCache?: boolean }): void
154
151
  ```
155
152
 
153
+ **Parameters:** `options.removeFromCache` - When `true`, removes the controller from `Interact.controllerCache` (e.g. when calling `remove(key)`).
154
+
156
155
  **Example:**
157
156
 
158
157
  ```typescript
159
158
  const controller = Interact.getController('my-element');
160
159
  if (controller?.connected) {
161
- controller.disconnect();
162
- console.log('Controller disconnected');
160
+ controller.disconnect({ removeFromCache: true });
163
161
  }
164
162
  ```
165
163
 
166
- **Behavior:**
167
-
168
- 1. Calls internal `remove()` to clean up interactions
169
- 2. Removes adopted stylesheet from document
170
- 3. Clears all mutation observers
171
- 4. Sets `connected = false`
164
+ **Behavior:** Calls internal `remove()`, removes adopted stylesheet, clears observers, sets `connected = false`.
172
165
 
173
166
  ### `update()`
174
167
 
@@ -351,16 +344,6 @@ if (controller) {
351
344
  4. Automatically calls `addListItems` for added nodes
352
345
  5. Automatically calls `removeListItems` for removed nodes
353
346
 
354
- ### `_childListChangeHandler(listContainer, entries)`
355
-
356
- Internal handler for mutation observer callbacks. You typically don't call this directly.
357
-
358
- **Signature:**
359
-
360
- ```typescript
361
- _childListChangeHandler(listContainer: string, entries: MutationRecord[]): void
362
- ```
363
-
364
347
  ## Usage Patterns
365
348
 
366
349
  ### Accessing Controllers
@@ -377,34 +360,15 @@ Interact.controllerCache.forEach((controller, key) => {
377
360
  });
378
361
  ```
379
362
 
380
- ### Programmatic State Management
363
+ ### State and lists
381
364
 
382
365
  ```typescript
383
- const controller = Interact.getController('accordion');
384
- if (controller) {
385
- // Check current state
386
- const isExpanded = controller.getActiveEffects().includes('expanded');
387
-
388
- // Toggle based on current state
389
- controller.toggleEffect('expanded', isExpanded ? 'remove' : 'add');
390
- }
391
- ```
366
+ // Toggle effect by current state
367
+ const c = Interact.getController('accordion');
368
+ c?.toggleEffect('expanded', c.getActiveEffects().includes('expanded') ? 'remove' : 'add');
392
369
 
393
- ### Dynamic List Management
394
-
395
- ```typescript
396
- const controller = Interact.getController('todo-list');
397
- if (controller) {
398
- // Watch for list changes
399
- controller.watchChildList('.todo-items');
400
-
401
- // Add new item - interactions apply automatically
402
- const todoItems = controller.element.querySelector('.todo-items');
403
- const newTodo = document.createElement('div');
404
- newTodo.className = 'todo-item';
405
- newTodo.textContent = 'New task';
406
- todoItems?.appendChild(newTodo);
407
- }
370
+ // Watch list container; new children get interactions automatically
371
+ Interact.getController('list-key')?.watchChildList('.items');
408
372
  ```
409
373
 
410
374
  ### Refreshing Interactions
@@ -449,7 +413,7 @@ const controller = Interact.getController('my-element');
449
413
  // Safe operations - won't throw
450
414
  controller?.toggleEffect('effect', 'add');
451
415
  controller?.connect(); // Safe if already connected
452
- controller?.disconnect(); // Safe if already disconnected
416
+ controller?.disconnect({}); // Safe if already disconnected
453
417
 
454
418
  // Check connection status
455
419
  if (!controller?.connected) {
package/docs/api/types.md CHANGED
@@ -161,16 +161,14 @@ Interface for the controller that manages interactions on an element. This is th
161
161
 
162
162
  ```typescript
163
163
  interface IInteractionController {
164
- // Properties
165
164
  element: HTMLElement;
166
165
  key: string | undefined;
167
166
  connected: boolean;
168
167
  sheet: CSSStyleSheet | null;
169
- _observers: WeakMap<HTMLElement, MutationObserver>;
168
+ useFirstChild: boolean;
170
169
 
171
- // Methods
172
170
  connect(key?: string): void;
173
- disconnect(): void;
171
+ disconnect(options?: { removeFromCache?: boolean }): void;
174
172
  update(): void;
175
173
  toggleEffect(
176
174
  effectId: string,
@@ -181,7 +179,6 @@ interface IInteractionController {
181
179
  getActiveEffects(): string[];
182
180
  renderStyle(cssRules: string[]): void;
183
181
  watchChildList(listContainer: string): void;
184
- _childListChangeHandler(listContainer: string, entries: MutationRecord[]): void;
185
182
  }
186
183
  ```
187
184
 
@@ -189,14 +186,14 @@ interface IInteractionController {
189
186
 
190
187
  - `element` - The DOM element this controller manages
191
188
  - `key` - The unique identifier for this element's interactions
192
- - `connected` - Whether the controller is currently connected to the interaction system
189
+ - `connected` - Whether the controller is currently connected
193
190
  - `sheet` - The adopted stylesheet for dynamic CSS rules
194
- - `_observers` - Internal storage for mutation observers
191
+ - `useFirstChild` - When true, interaction target is the first child (e.g. custom elements)
195
192
 
196
193
  **Methods:**
197
194
 
198
195
  - `connect(key?)` - Connects the controller to the interaction system
199
- - `disconnect()` - Disconnects and cleans up all resources
196
+ - `disconnect(options?)` - Disconnects and cleans up; `removeFromCache: true` removes from `Interact.controllerCache`
200
197
  - `update()` - Disconnects and reconnects (refreshes interactions)
201
198
  - `toggleEffect()` - Toggles a CSS state effect on the element
202
199
  - `getActiveEffects()` - Returns array of currently active effect IDs
@@ -232,7 +229,7 @@ interface IInteractElement extends HTMLElement {
232
229
  connectedCallback(): void;
233
230
  disconnectedCallback(): void;
234
231
  connect(key?: string): void;
235
- disconnect(): void;
232
+ disconnect(options?: { removeFromCache?: boolean }): void;
236
233
  toggleEffect(effectId: string, method: StateParams['method'], item?: HTMLElement | null): void;
237
234
  getActiveEffects(): string[];
238
235
  }
@@ -362,19 +359,18 @@ type ViewEnterParams = {
362
359
  type?: ViewEnterType;
363
360
  threshold?: number;
364
361
  inset?: string;
362
+ useSafeViewEnter?: boolean;
365
363
  };
366
364
 
367
- type ViewEnterType = 'once' | 'repeat' | 'alternate';
365
+ type ViewEnterType = 'once' | 'repeat' | 'alternate' | 'state';
368
366
  ```
369
367
 
370
368
  **Properties:**
371
369
 
372
- - `type` - How the trigger behaves on repeated intersections
373
- - `'once'` - Trigger only the first time (default)
374
- - `'repeat'` - Trigger every time element enters viewport
375
- - `'alternate'` - Alternate between enter/exit effects
370
+ - `type` - How the trigger behaves: `'once'` (default), `'repeat'`, `'alternate'`, `'state'` (play on enter, pause on exit)
376
371
  - `threshold` - Percentage of element that must be visible (0-1)
377
372
  - `inset` - CSS-style inset to shrink the root intersection area
373
+ - `useSafeViewEnter` - When true, handles elements taller than viewport
378
374
 
379
375
  **Examples:**
380
376
 
@@ -438,22 +434,25 @@ const hoverState: StateParams = {
438
434
  Parameters for pointer/mouse movement triggers.
439
435
 
440
436
  ```typescript
437
+ type PointerMoveAxis = 'x' | 'y';
438
+
441
439
  type PointerMoveParams = {
442
440
  hitArea?: 'root' | 'self';
441
+ axis?: PointerMoveAxis;
443
442
  };
444
443
  ```
445
444
 
446
445
  **Properties:**
447
446
 
448
- - `hitArea` - Defines the area that responds to pointer movement
449
- - `'self'` - Only the source element (default)
450
- - `'root'` - The entire viewport/root container
447
+ - `hitArea` - `'self'` (default) or `'root'` (viewport)
448
+ - `axis` - `'x'` or `'y'` (default `'y'`) for scrub direction
451
449
 
452
450
  **Example:**
453
451
 
454
452
  ```typescript
455
453
  const pointerParams: PointerMoveParams = {
456
- hitArea: 'root', // Track mouse across entire page
454
+ hitArea: 'self',
455
+ axis: 'y',
457
456
  };
458
457
  ```
459
458
 
@@ -605,8 +604,8 @@ type ScrubEffect = {
605
604
  // Parallax background
606
605
  const parallaxEffect: ScrubEffect = {
607
606
  easing: 'linear',
608
- rangeStart: { name: 'contain', offset: { value: 0, type: 'percentage' } },
609
- rangeEnd: { name: 'contain', offset: { value: 100, type: 'percentage' } },
607
+ rangeStart: { name: 'contain', offset: { value: 0, unit: 'percentage' } },
608
+ rangeEnd: { name: 'contain', offset: { value: 100, unit: 'percentage' } },
610
609
  keyframeEffect: {
611
610
  name: 'parallax',
612
611
  keyframes: [{ transform: 'translateY(0)' }, { transform: 'translateY(-50px)' }],
@@ -750,8 +749,8 @@ type EffectProperty =
750
749
  **Types:**
751
750
 
752
751
  - `keyframeEffect` - Raw keyframe animation definition
753
- - `namedEffect` - Pre-built animation from `@wix/motion`
754
- - `customEffect` - Custom animation function
752
+ - `namedEffect` - Pre-built animations from `@wix/motion-presets`
753
+ - `customEffect` - Function `(element: Element, progress: number) => void` for custom scrub/behavior
755
754
 
756
755
  **Examples:**
757
756
 
@@ -769,18 +768,13 @@ const keyframeEffect = {
769
768
 
770
769
  // Named effect
771
770
  const namedEffect = {
772
- namedEffect: {
773
- type: 'SlideIn',
774
- }, // Pre-built animation
771
+ namedEffect: { type: 'SlideIn' },
775
772
  };
776
773
 
777
- // Custom effect
774
+ // Custom effect (signature: element, progress)
778
775
  const customEffect = {
779
- customEffect: (element: HTMLElement) => {
780
- // Custom animation logic
781
- return element.animate([{ transform: 'rotate(0deg)' }, { transform: 'rotate(360deg)' }], {
782
- duration: 1000,
783
- });
776
+ customEffect: (element: Element, progress: number) => {
777
+ (element as HTMLElement).style.opacity = String(progress);
784
778
  },
785
779
  };
786
780
  ```
@@ -793,17 +787,15 @@ Defines conditional logic for interactions.
793
787
 
794
788
  ```typescript
795
789
  type Condition = {
796
- type: 'media' | 'container';
790
+ type: 'media' | 'container' | 'selector';
797
791
  predicate?: string;
798
792
  };
799
793
  ```
800
794
 
801
795
  **Properties:**
802
796
 
803
- - `type` - Type of condition check
804
- - `'media'` - Media query condition
805
- - `'container'` - Container query condition
806
- - `predicate` - The query string to evaluate
797
+ - `type` - `'media'` (media query), `'container'` (container query), or `'selector'`
798
+ - `predicate` - The query string or selector to evaluate
807
799
 
808
800
  **Examples:**
809
801
 
@@ -831,31 +823,7 @@ const wideContainer: Condition = {
831
823
  };
832
824
  ```
833
825
 
834
- ## Handler Types
835
-
836
- ### `InteractionHandlerModule`
837
-
838
- Interface for trigger handler modules.
839
-
840
- ```typescript
841
- type InteractionHandlerModule<T extends TriggerType> = {
842
- registerOptionsGetter?: (getter: () => any) => void;
843
- add: (
844
- source: HTMLElement,
845
- target: HTMLElement,
846
- effect: Effect,
847
- options: InteractionParamsTypes[T],
848
- interactOptions: InteractOptions,
849
- ) => void;
850
- remove: (element: HTMLElement) => void;
851
- };
852
- ```
853
-
854
- **Properties:**
855
-
856
- - `registerOptionsGetter` - Optional function to register global options getter
857
- - `add` - Function to add a handler for this trigger type
858
- - `remove` - Function to remove all handlers from an element
826
+ ## Trigger parameter types
859
827
 
860
828
  ### `InteractionParamsTypes`
861
829
 
@@ -865,6 +833,8 @@ Map of trigger types to their parameter types.
865
833
  type InteractionParamsTypes = {
866
834
  hover: StateParams | PointerTriggerParams;
867
835
  click: StateParams | PointerTriggerParams;
836
+ interest: StateParams | PointerTriggerParams;
837
+ activate: StateParams | PointerTriggerParams;
868
838
  viewEnter: ViewEnterParams;
869
839
  pageVisible: ViewEnterParams;
870
840
  animationEnd: AnimationEndParams;
@@ -873,27 +843,6 @@ type InteractionParamsTypes = {
873
843
  };
874
844
  ```
875
845
 
876
- ## Cache and Internal Types
877
-
878
- ### `InteractCache`
879
-
880
- Internal cache structure for parsed configuration.
881
-
882
- ```typescript
883
- type InteractCache = {
884
- effects: { [effectId: string]: Effect };
885
- conditions: { [conditionId: string]: Condition };
886
- interactions: {
887
- [key: string]: {
888
- triggers: Interaction[];
889
- effects: Record<string, (InteractionTrigger & { effect: Effect | EffectRef })[]>;
890
- interactionIds: Set<string>;
891
- selectors: Set<string>;
892
- };
893
- };
894
- };
895
- ```
896
-
897
846
  ### `TriggerParams`
898
847
 
899
848
  Union type of all trigger parameter types.
@@ -907,68 +856,6 @@ type TriggerParams =
907
856
  | AnimationEndParams;
908
857
  ```
909
858
 
910
- ## Utility Types
911
-
912
- ### `HandlerObject`
913
-
914
- Internal type for event handler management.
915
-
916
- ```typescript
917
- type HandlerObject = {
918
- source: HTMLElement;
919
- target: HTMLElement;
920
- cleanup: () => void;
921
- handler?: () => void;
922
- };
923
-
924
- type HandlerObjectMap = WeakMap<HTMLElement, Set<HandlerObject>>;
925
- ```
926
-
927
- ### Configuration Builders
928
-
929
- ```typescript
930
- // Type-safe configuration builder
931
- class InteractConfigBuilder {
932
- private config: Partial<InteractConfig> = { interactions: [], effects: {} };
933
-
934
- addInteraction(interaction: Interaction): this {
935
- this.config.interactions!.push(interaction);
936
- return this;
937
- }
938
-
939
- addEffect(id: string, effect: Effect): this {
940
- this.config.effects![id] = effect;
941
- return this;
942
- }
943
-
944
- addCondition(id: string, condition: Condition): this {
945
- if (!this.config.conditions) this.config.conditions = {};
946
- this.config.conditions[id] = condition;
947
- return this;
948
- }
949
-
950
- build(): InteractConfig {
951
- return this.config as InteractConfig;
952
- }
953
- }
954
-
955
- // Usage
956
- const config = new InteractConfigBuilder()
957
- .addEffect('fade', {
958
- duration: 1000,
959
- keyframeEffect: {
960
- name: 'fade',
961
- keyframes: [{ opacity: 0 }, { opacity: 1 }],
962
- },
963
- })
964
- .addInteraction({
965
- trigger: 'viewEnter',
966
- key: 'hero',
967
- effects: [{ effectId: 'fade' }],
968
- })
969
- .build();
970
- ```
971
-
972
859
  ## See Also
973
860
 
974
861
  - [Interact Class](interact-class.md) - Main API class
@@ -108,8 +108,8 @@ Scrub effects are progress-based animations that respond to scroll position or p
108
108
  },
109
109
  // No duration - controlled by scroll/pointer progress
110
110
  easing: 'linear',
111
- rangeStart: { name: 'cover', offset: { type: 'percentage', value: 0 } },
112
- rangeEnd: { name: 'cover', offset: { type: 'percentage', value: 100 } }
111
+ rangeStart: { name: 'cover', offset: { unit: 'percentage', value: 0 } },
112
+ rangeEnd: { name: 'cover', offset: { unit: 'percentage', value: 100 } }
113
113
  }
114
114
  ```
115
115
 
@@ -127,8 +127,8 @@ Control when the animation starts and stops:
127
127
  { opacity: '0' }
128
128
  ]
129
129
  },
130
- rangeStart: { name: 'cover', offset: { type: 'percentage', value: 30 } }, // Start at 30% scroll
131
- rangeEnd: { name: 'cover', offset: { type: 'percentage', value: 80 } } // End at 80% scroll
130
+ rangeStart: { name: 'cover', offset: { unit: 'percentage', value: 30 } }, // Start at 30% scroll
131
+ rangeEnd: { name: 'cover', offset: { unit: 'percentage', value: 80 } } // End at 80% scroll
132
132
  }
133
133
  ```
134
134
 
@@ -153,8 +153,8 @@ TBD
153
153
  { transform: 'translateY(-150px)' }
154
154
  ]
155
155
  },
156
- rangeStart: { name: 'cover', offset: { type: 'percentage', value: 0 } },
157
- rangeEnd: { name: 'cover', offset: { type: 'percentage', value: 100 } }
156
+ rangeStart: { name: 'cover', offset: { unit: 'percentage', value: 0 } },
157
+ rangeEnd: { name: 'cover', offset: { unit: 'percentage', value: 100 } }
158
158
  },
159
159
  // Text fades out faster
160
160
  {
@@ -166,8 +166,8 @@ TBD
166
166
  { opacity: '0', transform: 'translateY(-50px)' }
167
167
  ]
168
168
  },
169
- rangeStart: { name: 'cover', offset: { type: 'percentage', value: 20 } },
170
- rangeEnd: { name: 'cover', offset: { type: 'percentage', value: 60 } }
169
+ rangeStart: { name: 'cover', offset: { unit: 'percentage', value: 20 } },
170
+ rangeEnd: { name: 'cover', offset: { unit: 'percentage', value: 60 } }
171
171
  }
172
172
  ]
173
173
  }
@@ -450,7 +450,7 @@ Avoid animating:
450
450
  ### Named Effects vs Keyframes
451
451
 
452
452
  ```typescript
453
- // Preferred - optimized by @wix/motion
453
+ // Preferred - optimized; from @wix/motion-presets
454
454
  {
455
455
  namedEffect: {
456
456
  type: 'FadeIn'
@@ -302,6 +302,7 @@ The `viewEnter` trigger uses Intersection Observer to detect when elements enter
302
302
  - **`once`** (recommended): Triggers only when element first enters viewport
303
303
  - **`repeat`**: Triggers every time element enters viewport
304
304
  - **`alternate`**: Plays forward on enter, reverses on exit
305
+ - **`state`**: Plays on enter, pauses on exit
305
306
 
306
307
  ### Real-World Example: Staggered Card Animation
307
308
 
@@ -393,8 +394,8 @@ The `viewProgress` trigger creates scroll-driven animations as elements move thr
393
394
  { filter: 'grayscale(100%)' }
394
395
  ]
395
396
  },
396
- rangeStart: { name: 'exit', offset: { type: 'percentage', value: 0 } },
397
- rangeEnd: { name: 'exit', offset: { type: 'percentage', value: 100 } }
397
+ rangeStart: { name: 'exit', offset: { unit: 'percentage', value: 0 } },
398
+ rangeEnd: { name: 'exit', offset: { unit: 'percentage', value: 100 } }
398
399
  },
399
400
  {
400
401
  key: 'foreground-text',
@@ -405,8 +406,8 @@ The `viewProgress` trigger creates scroll-driven animations as elements move thr
405
406
  { opacity: '0', transform: 'scale(0.8)' }
406
407
  ]
407
408
  },
408
- rangeStart: { name: 'exit', offset: { type: 'percentage', value: 0 } },
409
- rangeEnd: { name: 'exit', offset: { type: 'percentage', value: 100 } }
409
+ rangeStart: { name: 'exit', offset: { unit: 'percentage', value: 0 } },
410
+ rangeEnd: { name: 'exit', offset: { unit: 'percentage', value: 100 } }
410
411
  }
411
412
  ]
412
413
  }
@@ -428,14 +429,14 @@ The `viewProgress` trigger creates scroll-driven animations as elements move thr
428
429
  { transform: 'scaleX(1)' }
429
430
  ]
430
431
  },
431
- rangeStart: { name: 'cover', offset: { type: 'percentage', value: 0 } },
432
- rangeEnd: { name: 'cover', offset: { type: 'percentage', value: 100 } }
432
+ rangeStart: { name: 'cover', offset: { unit: 'percentage', value: 0 } },
433
+ rangeEnd: { name: 'cover', offset: { unit: 'percentage', value: 100 } }
433
434
  }
434
435
  ]
435
436
  }
436
437
  ```
437
438
 
438
- ## 8. PointerMove Trigger
439
+ ## 7. PointerMove Trigger
439
440
 
440
441
  The `pointerMove` trigger creates mouse-following effects and 3D interactions.
441
442
 
@@ -467,7 +468,8 @@ The `pointerMove` trigger creates mouse-following effects and 3D interactions.
467
468
  key: 'card-section',
468
469
  trigger: 'pointerMove',
469
470
  params: {
470
- hitArea: 'self' // 'self' | 'root'
471
+ hitArea: 'self', // 'self' | 'root'
472
+ axis: 'y' // 'x' | 'y' – scrub axis (default 'y')
471
473
  },
472
474
  effects: [
473
475
  {
@@ -508,7 +510,7 @@ The `pointerMove` trigger creates mouse-following effects and 3D interactions.
508
510
  }
509
511
  ```
510
512
 
511
- ## 9. AnimationEnd Trigger
513
+ ## 8. AnimationEnd Trigger
512
514
 
513
515
  The `animationEnd` trigger allows you to chain animations by waiting for a previous animation to complete.
514
516
 
@@ -64,13 +64,14 @@ The `Interaction` component is a wrapper that automatically manages interaction
64
64
 
65
65
  ### Props
66
66
 
67
- | Prop | Type | Required | Description |
68
- | ------------- | ----------------------------- | -------- | ---------------------------------------------------------------- |
69
- | `tagName` | `keyof JSX.IntrinsicElements` | Yes | The HTML element to render (e.g., `'div'`, `'button'`, `'span'`) |
70
- | `interactKey` | `string` | Yes | Unique identifier matching the interaction configuration |
71
- | `children` | `React.ReactNode` | No | Child elements to render |
72
- | `ref` | `React.Ref<any>` | No | Forwarded ref to the underlying DOM element |
73
- | `...rest` | `JSX.IntrinsicElements[T]` | No | Any valid props for the specified `tagName` |
67
+ | Prop | Type | Required | Description |
68
+ | ------------- | ----------------------------- | -------- | --------------------------------------------------------------------------------------------- |
69
+ | `tagName` | `keyof JSX.IntrinsicElements` | Yes | The HTML element to render (e.g., `'div'`, `'button'`, `'span'`) |
70
+ | `interactKey` | `string` | Yes | Unique identifier matching the interaction configuration |
71
+ | `initial` | `boolean` | No | When `true`, sets `data-interact-initial="true"` for FOUC prevention with entrance animations |
72
+ | `children` | `React.ReactNode` | No | Child elements to render |
73
+ | `ref` | `React.Ref<any>` | No | Forwarded ref to the underlying DOM element |
74
+ | `...rest` | `JSX.IntrinsicElements[T]` | No | Any valid props for the specified `tagName` |
74
75
 
75
76
  ### Basic Usage
76
77
 
@@ -385,12 +386,14 @@ import { Interact, Interaction, InteractConfig } from '@wix/interact/react';
385
386
  const config: InteractConfig = {
386
387
  effects: {
387
388
  expanded: {
388
- transitionEffect: {
389
- properties: ['max-height', 'padding'],
390
- from: { maxHeight: '0px', padding: '0' },
391
- to: { maxHeight: '200px', padding: '16px' },
389
+ transition: {
390
+ duration: 300,
391
+ easing: 'ease-out',
392
+ styleProperties: [
393
+ { name: 'max-height', value: '200px' },
394
+ { name: 'padding', value: '16px' },
395
+ ],
392
396
  },
393
- duration: 300,
394
397
  },
395
398
  },
396
399
  interactions: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/interact",
3
- "version": "2.0.0-rc.8",
3
+ "version": "2.0.1",
4
4
  "description": "A powerful, declarative interaction library for creating engaging web apps.",
5
5
  "license": "MIT",
6
6
  "main": "dist/cjs/index.js",
@@ -55,7 +55,7 @@
55
55
  "url": "https://github.com/wix-incubator/interact/issues"
56
56
  },
57
57
  "dependencies": {
58
- "@wix/motion": "^2.0.0-rc.6",
58
+ "@wix/motion": "^2.0.0",
59
59
  "fastdom": "^1.0.12",
60
60
  "fizban": "^0.7.2",
61
61
  "kuliso": "^0.4.13"
@@ -86,6 +86,5 @@
86
86
  "typescript": "^5.9.3",
87
87
  "vite": "^7.2.2",
88
88
  "vitest": "^4.0.14"
89
- },
90
- "stableVersion": "2.0.0-rc.6"
89
+ }
91
90
  }