@zag-js/tooltip 1.0.0 → 1.0.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.
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _zag_js_anatomy from '@zag-js/anatomy';
2
2
  import * as _zag_js_core from '@zag-js/core';
3
- import { Service, EventObject } from '@zag-js/core';
3
+ import { Service, Machine, EventObject } from '@zag-js/core';
4
4
  import { DirectionProperty, CommonProperties, PropTypes, RequiredBy, NormalizeProps } from '@zag-js/types';
5
5
  import { PositioningOptions, Placement } from '@zag-js/popper';
6
6
  export { Placement, PositioningOptions } from '@zag-js/popper';
@@ -85,7 +85,7 @@ interface TooltipProps extends DirectionProperty, CommonProperties {
85
85
  */
86
86
  defaultOpen?: boolean | undefined;
87
87
  }
88
- type PropsWithDefault = "openDelay" | "closeDelay" | "closeOnPointerDown" | "closeOnEscape" | "closeOnScroll" | "closeOnClick" | "interactive" | "id";
88
+ type PropsWithDefault = "openDelay" | "closeDelay" | "closeOnPointerDown" | "closeOnEscape" | "closeOnScroll" | "closeOnClick" | "interactive" | "id" | "positioning";
89
89
  interface TooltipSchema {
90
90
  state: "open" | "closed" | "opening" | "closing";
91
91
  props: RequiredBy<TooltipProps, PropsWithDefault>;
@@ -99,6 +99,7 @@ interface TooltipSchema {
99
99
  guard: string;
100
100
  }
101
101
  type TooltipService = Service<TooltipSchema>;
102
+ type TooltipMachine = Machine<TooltipSchema>;
102
103
  interface TooltipApi<T extends PropTypes = PropTypes> {
103
104
  /**
104
105
  * Whether the tooltip is open.
@@ -121,9 +122,9 @@ interface TooltipApi<T extends PropTypes = PropTypes> {
121
122
 
122
123
  declare function connect<P extends PropTypes>(service: Service<TooltipSchema>, normalize: NormalizeProps<P>): TooltipApi<P>;
123
124
 
124
- declare const machine: _zag_js_core.MachineConfig<TooltipSchema>;
125
+ declare const machine: _zag_js_core.Machine<TooltipSchema>;
125
126
 
126
127
  declare const props: (keyof TooltipProps)[];
127
128
  declare const splitProps: <Props extends Partial<TooltipProps>>(props: Props) => [Partial<TooltipProps>, Omit<Props, keyof TooltipProps>];
128
129
 
129
- export { type TooltipApi as Api, type ElementIds, type OpenChangeDetails, type TooltipProps as Props, type TooltipService as Service, anatomy, connect, machine, props, splitProps };
130
+ export { type TooltipApi as Api, type ElementIds, type TooltipMachine as Machine, type OpenChangeDetails, type TooltipProps as Props, type TooltipService as Service, anatomy, connect, machine, props, splitProps };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _zag_js_anatomy from '@zag-js/anatomy';
2
2
  import * as _zag_js_core from '@zag-js/core';
3
- import { Service, EventObject } from '@zag-js/core';
3
+ import { Service, Machine, EventObject } from '@zag-js/core';
4
4
  import { DirectionProperty, CommonProperties, PropTypes, RequiredBy, NormalizeProps } from '@zag-js/types';
5
5
  import { PositioningOptions, Placement } from '@zag-js/popper';
6
6
  export { Placement, PositioningOptions } from '@zag-js/popper';
@@ -85,7 +85,7 @@ interface TooltipProps extends DirectionProperty, CommonProperties {
85
85
  */
86
86
  defaultOpen?: boolean | undefined;
87
87
  }
88
- type PropsWithDefault = "openDelay" | "closeDelay" | "closeOnPointerDown" | "closeOnEscape" | "closeOnScroll" | "closeOnClick" | "interactive" | "id";
88
+ type PropsWithDefault = "openDelay" | "closeDelay" | "closeOnPointerDown" | "closeOnEscape" | "closeOnScroll" | "closeOnClick" | "interactive" | "id" | "positioning";
89
89
  interface TooltipSchema {
90
90
  state: "open" | "closed" | "opening" | "closing";
91
91
  props: RequiredBy<TooltipProps, PropsWithDefault>;
@@ -99,6 +99,7 @@ interface TooltipSchema {
99
99
  guard: string;
100
100
  }
101
101
  type TooltipService = Service<TooltipSchema>;
102
+ type TooltipMachine = Machine<TooltipSchema>;
102
103
  interface TooltipApi<T extends PropTypes = PropTypes> {
103
104
  /**
104
105
  * Whether the tooltip is open.
@@ -121,9 +122,9 @@ interface TooltipApi<T extends PropTypes = PropTypes> {
121
122
 
122
123
  declare function connect<P extends PropTypes>(service: Service<TooltipSchema>, normalize: NormalizeProps<P>): TooltipApi<P>;
123
124
 
124
- declare const machine: _zag_js_core.MachineConfig<TooltipSchema>;
125
+ declare const machine: _zag_js_core.Machine<TooltipSchema>;
125
126
 
126
127
  declare const props: (keyof TooltipProps)[];
127
128
  declare const splitProps: <Props extends Partial<TooltipProps>>(props: Props) => [Partial<TooltipProps>, Omit<Props, keyof TooltipProps>];
128
129
 
129
- export { type TooltipApi as Api, type ElementIds, type OpenChangeDetails, type TooltipProps as Props, type TooltipService as Service, anatomy, connect, machine, props, splitProps };
130
+ export { type TooltipApi as Api, type ElementIds, type TooltipMachine as Machine, type OpenChangeDetails, type TooltipProps as Props, type TooltipService as Service, anatomy, connect, machine, props, splitProps };
package/dist/index.js CHANGED
@@ -417,19 +417,16 @@ var machine = core.createMachine({
417
417
  trackFocusVisible: ({ scope }) => {
418
418
  return focusVisible.trackFocusVisible({ root: scope.getRootNode?.() });
419
419
  },
420
- trackPositioning: ({ flush, context, prop, scope }) => {
420
+ trackPositioning: ({ context, prop, scope }) => {
421
421
  if (!context.get("currentPlacement")) {
422
- const positioning = prop("positioning");
423
- context.set("currentPlacement", positioning.placement);
422
+ context.set("currentPlacement", prop("positioning").placement);
424
423
  }
425
424
  const getPositionerEl2 = () => getPositionerEl(scope);
426
425
  return popper.getPlacement(getTriggerEl(scope), getPositionerEl2, {
427
426
  ...prop("positioning"),
428
427
  defer: true,
429
428
  onComplete(data) {
430
- flush(() => {
431
- context.set("currentPlacement", data.placement);
432
- });
429
+ context.set("currentPlacement", data.placement);
433
430
  }
434
431
  });
435
432
  },
package/dist/index.mjs CHANGED
@@ -415,19 +415,16 @@ var machine = createMachine({
415
415
  trackFocusVisible: ({ scope }) => {
416
416
  return trackFocusVisible({ root: scope.getRootNode?.() });
417
417
  },
418
- trackPositioning: ({ flush, context, prop, scope }) => {
418
+ trackPositioning: ({ context, prop, scope }) => {
419
419
  if (!context.get("currentPlacement")) {
420
- const positioning = prop("positioning");
421
- context.set("currentPlacement", positioning.placement);
420
+ context.set("currentPlacement", prop("positioning").placement);
422
421
  }
423
422
  const getPositionerEl2 = () => getPositionerEl(scope);
424
423
  return getPlacement(getTriggerEl(scope), getPositionerEl2, {
425
424
  ...prop("positioning"),
426
425
  defer: true,
427
426
  onComplete(data) {
428
- flush(() => {
429
- context.set("currentPlacement", data.placement);
430
- });
427
+ context.set("currentPlacement", data.placement);
431
428
  }
432
429
  });
433
430
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/tooltip",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Core logic for the tooltip widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -26,14 +26,14 @@
26
26
  "url": "https://github.com/chakra-ui/zag/issues"
27
27
  },
28
28
  "dependencies": {
29
- "@zag-js/anatomy": "1.0.0",
30
- "@zag-js/core": "1.0.0",
31
- "@zag-js/store": "1.0.0",
32
- "@zag-js/popper": "1.0.0",
33
- "@zag-js/focus-visible": "1.0.0",
34
- "@zag-js/dom-query": "1.0.0",
35
- "@zag-js/utils": "1.0.0",
36
- "@zag-js/types": "1.0.0"
29
+ "@zag-js/anatomy": "1.0.2",
30
+ "@zag-js/store": "1.0.2",
31
+ "@zag-js/popper": "1.0.2",
32
+ "@zag-js/focus-visible": "1.0.2",
33
+ "@zag-js/utils": "1.0.2",
34
+ "@zag-js/dom-query": "1.0.2",
35
+ "@zag-js/core": "1.0.2",
36
+ "@zag-js/types": "1.0.2"
37
37
  },
38
38
  "devDependencies": {
39
39
  "clean-package": "2.2.0"