@serendie/ui 2.0.0 → 2.1.0

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.
Files changed (118) hide show
  1. package/dist/components/CheckBox/CheckBox.js +36 -35
  2. package/dist/components/ChoiceBox/ChoiceBox.js +41 -41
  3. package/dist/components/DataTable/DataTableComponent.d.ts +3 -20
  4. package/dist/components/DataTable/DataTableComponent.js +38 -36
  5. package/dist/components/DataTable/table/HeaderCheckbox.js +29 -19
  6. package/dist/components/Search/Search.d.ts +3 -1
  7. package/dist/components/Search/Search.js +34 -33
  8. package/dist/components/Select/Select.d.ts +2 -1
  9. package/dist/components/Select/Select.js +47 -41
  10. package/dist/components/Tooltip/Tooltip.d.ts +14 -0
  11. package/dist/components/Tooltip/Tooltip.js +70 -0
  12. package/dist/components/Tooltip/index.d.ts +1 -0
  13. package/dist/components/Tooltip/index.js +4 -0
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.js +12 -10
  16. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-content.js +4 -6
  17. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-indicator.js +4 -6
  18. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-trigger.js +10 -12
  19. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item.js +16 -16
  20. package/dist/node_modules/@ark-ui/react/dist/components/accordion/use-accordion.js +13 -20
  21. package/dist/node_modules/@ark-ui/react/dist/components/avatar/avatar-root.js +1 -5
  22. package/dist/node_modules/@ark-ui/react/dist/components/avatar/use-avatar.js +14 -18
  23. package/dist/node_modules/@ark-ui/react/dist/components/checkbox/checkbox-hidden-input.js +4 -6
  24. package/dist/node_modules/@ark-ui/react/dist/components/checkbox/use-checkbox.js +22 -28
  25. package/dist/node_modules/@ark-ui/react/dist/components/collapsible/collapsible-content.js +7 -9
  26. package/dist/node_modules/@ark-ui/react/dist/components/collapsible/use-collapsible.js +14 -21
  27. package/dist/node_modules/@ark-ui/react/dist/components/collection/list-collection.js +5 -0
  28. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-content.js +9 -8
  29. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-item-group.js +4 -6
  30. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-positioner.js +4 -6
  31. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-root.js +17 -18
  32. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-trigger.js +10 -9
  33. package/dist/node_modules/@ark-ui/react/dist/components/combobox/use-combobox-item-context.js +5 -7
  34. package/dist/node_modules/@ark-ui/react/dist/components/combobox/use-combobox.js +21 -45
  35. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-backdrop.js +10 -9
  36. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-close-trigger.js +4 -6
  37. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-content.js +6 -5
  38. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-description.js +4 -6
  39. package/dist/node_modules/@ark-ui/react/dist/components/dialog/use-dialog.js +13 -22
  40. package/dist/node_modules/@ark-ui/react/dist/components/factory.js +26 -24
  41. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-content.js +9 -8
  42. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-item-group.js +1 -3
  43. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-item.js +15 -13
  44. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-root.js +13 -14
  45. package/dist/node_modules/@ark-ui/react/dist/components/menu/use-menu-option-item-props-context.js +10 -0
  46. package/dist/node_modules/@ark-ui/react/dist/components/menu/use-menu.js +14 -21
  47. package/dist/node_modules/@ark-ui/react/dist/components/pagination/pagination-ellipsis.js +4 -6
  48. package/dist/node_modules/@ark-ui/react/dist/components/pagination/pagination-next-trigger.js +4 -6
  49. package/dist/node_modules/@ark-ui/react/dist/components/pagination/pagination-prev-trigger.js +4 -6
  50. package/dist/node_modules/@ark-ui/react/dist/components/pagination/pagination-root.js +5 -4
  51. package/dist/node_modules/@ark-ui/react/dist/components/pagination/use-pagination.js +13 -19
  52. package/dist/node_modules/@ark-ui/react/dist/components/portal/portal.js +25 -16
  53. package/dist/node_modules/@ark-ui/react/dist/components/presence/split-presence-props.js +3 -2
  54. package/dist/node_modules/@ark-ui/react/dist/components/presence/use-presence.js +18 -18
  55. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-control.js +4 -6
  56. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-text.js +4 -6
  57. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item.js +1 -5
  58. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/use-radio-group.js +14 -22
  59. package/dist/node_modules/@ark-ui/react/dist/components/select/select-content.js +9 -8
  60. package/dist/node_modules/@ark-ui/react/dist/components/select/select-root.js +11 -12
  61. package/dist/node_modules/@ark-ui/react/dist/components/select/use-select.js +20 -47
  62. package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-hidden-input.js +4 -6
  63. package/dist/node_modules/@ark-ui/react/dist/components/switch/use-switch.js +20 -26
  64. package/dist/node_modules/@ark-ui/react/dist/components/tabs/tabs-root.js +9 -8
  65. package/dist/node_modules/@ark-ui/react/dist/components/tabs/use-tabs.js +14 -21
  66. package/dist/node_modules/@ark-ui/react/dist/components/toast/create-toaster.js +3 -7
  67. package/dist/node_modules/@ark-ui/react/dist/components/toast/toaster.js +28 -15
  68. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-arrow-tip.js +13 -0
  69. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-arrow.js +13 -0
  70. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-content.js +15 -0
  71. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-positioner.js +14 -0
  72. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-root.js +14 -0
  73. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-trigger.js +13 -0
  74. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/use-tooltip-context.js +10 -0
  75. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/use-tooltip.js +17 -0
  76. package/dist/node_modules/@ark-ui/react/dist/utils/compose-refs.js +13 -7
  77. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +92 -90
  78. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +230 -216
  79. package/dist/node_modules/@zag-js/accordion/dist/index.js +210 -227
  80. package/dist/node_modules/@zag-js/aria-hidden/dist/index.js +49 -12
  81. package/dist/node_modules/@zag-js/avatar/dist/index.js +119 -134
  82. package/dist/node_modules/@zag-js/checkbox/dist/index.js +196 -197
  83. package/dist/node_modules/@zag-js/collapsible/dist/index.js +250 -198
  84. package/dist/node_modules/@zag-js/collection/dist/index.js +172 -179
  85. package/dist/node_modules/@zag-js/combobox/dist/index.js +1176 -1082
  86. package/dist/node_modules/@zag-js/core/dist/index.js +77 -496
  87. package/dist/node_modules/@zag-js/dialog/dist/index.js +243 -270
  88. package/dist/node_modules/@zag-js/dismissable/dist/index.js +62 -60
  89. package/dist/node_modules/@zag-js/dom-query/dist/index.js +465 -253
  90. package/dist/node_modules/@zag-js/focus-trap/dist/index.js +307 -0
  91. package/dist/node_modules/@zag-js/focus-visible/dist/index.js +48 -47
  92. package/dist/node_modules/@zag-js/interact-outside/dist/index.js +112 -80
  93. package/dist/node_modules/@zag-js/menu/dist/index.js +998 -884
  94. package/dist/node_modules/@zag-js/pagination/dist/index.js +207 -213
  95. package/dist/node_modules/@zag-js/popper/dist/index.js +130 -129
  96. package/dist/node_modules/@zag-js/presence/dist/index.js +139 -122
  97. package/dist/node_modules/@zag-js/radio-group/dist/index.js +297 -302
  98. package/dist/node_modules/@zag-js/react/dist/index.js +255 -103
  99. package/dist/node_modules/@zag-js/remove-scroll/dist/index.js +18 -31
  100. package/dist/node_modules/@zag-js/select/dist/index.js +889 -885
  101. package/dist/node_modules/@zag-js/store/dist/index.js +98 -137
  102. package/dist/node_modules/@zag-js/switch/dist/index.js +199 -191
  103. package/dist/node_modules/@zag-js/tabs/dist/index.js +383 -386
  104. package/dist/node_modules/@zag-js/toast/dist/index.js +646 -633
  105. package/dist/node_modules/@zag-js/tooltip/dist/index.js +459 -0
  106. package/dist/node_modules/@zag-js/types/dist/index.js +6 -6
  107. package/dist/node_modules/@zag-js/utils/dist/index.js +112 -99
  108. package/dist/node_modules/proxy-compare/dist/index.js +4 -106
  109. package/dist/styles.css +1 -1
  110. package/package.json +5 -5
  111. package/dist/node_modules/@ark-ui/react/dist/utils/use-is-server.js +0 -10
  112. package/dist/node_modules/@zag-js/dom-event/dist/index.js +0 -130
  113. package/dist/node_modules/@zag-js/element-rect/dist/index.js +0 -32
  114. package/dist/node_modules/@zag-js/form-utils/dist/index.js +0 -51
  115. package/dist/node_modules/aria-hidden/dist/es2015/index.js +0 -52
  116. package/dist/node_modules/focus-trap/dist/focus-trap.esm.js +0 -431
  117. package/dist/node_modules/klona/full/index.js +0 -21
  118. package/dist/node_modules/tabbable/dist/index.esm.js +0 -202
@@ -1,92 +1,92 @@
1
- import { autoUpdate as S, offset as A, flip as D, shift as R, arrow as W, size as I, hide as B, computePosition as H, limitShift as T } from "../../../@floating-ui/dom/dist/floating-ui.dom.js";
2
- import { raf as V, isHTMLElement as k, getWindow as C } from "../../dom-query/dist/index.js";
3
- import { noop as L, isNull as N, runIfFn as j, compact as U } from "../../utils/dist/index.js";
4
- function v(t = 0, e = 0, r = 0, i = 0) {
1
+ import { autoUpdate as S, offset as A, flip as D, shift as H, arrow as R, size as W, hide as B, computePosition as I, limitShift as T } from "../../../@floating-ui/dom/dist/floating-ui.dom.js";
2
+ import { raf as V, isHTMLElement as k, getWindow as C, getComputedStyle as L } from "../../dom-query/dist/index.js";
3
+ import { noop as N, isNull as j, runIfFn as U, compact as _ } from "../../utils/dist/index.js";
4
+ function b(e = 0, t = 0, r = 0, i = 0) {
5
5
  if (typeof DOMRect == "function")
6
- return new DOMRect(t, e, r, i);
6
+ return new DOMRect(e, t, r, i);
7
7
  const n = {
8
- x: t,
9
- y: e,
8
+ x: e,
9
+ y: t,
10
10
  width: r,
11
11
  height: i,
12
- top: e,
13
- right: t + r,
14
- bottom: e + i,
15
- left: t
12
+ top: t,
13
+ right: e + r,
14
+ bottom: t + i,
15
+ left: e
16
16
  };
17
17
  return { ...n, toJSON: () => n };
18
18
  }
19
- function _(t) {
20
- if (!t) return v();
21
- const { x: e, y: r, width: i, height: n } = t;
22
- return v(e, r, i, n);
19
+ function q(e) {
20
+ if (!e) return b();
21
+ const { x: t, y: r, width: i, height: n } = e;
22
+ return b(t, r, i, n);
23
23
  }
24
- function q(t, e) {
24
+ function E(e, t) {
25
25
  return {
26
- contextElement: k(t) ? t : void 0,
26
+ contextElement: k(e) ? e : void 0,
27
27
  getBoundingClientRect: () => {
28
- const r = t, i = e == null ? void 0 : e(r);
29
- return i || !r ? _(i) : r.getBoundingClientRect();
28
+ const r = e, i = t == null ? void 0 : t(r);
29
+ return i || !r ? q(i) : r.getBoundingClientRect();
30
30
  }
31
31
  };
32
32
  }
33
- var u = (t) => ({ variable: t, reference: `var(${t})` }), c = {
33
+ var u = (e) => ({ variable: e, reference: `var(${e})` }), f = {
34
34
  arrowSize: u("--arrow-size"),
35
35
  arrowSizeHalf: u("--arrow-size-half"),
36
36
  arrowBg: u("--arrow-background"),
37
37
  transformOrigin: u("--transform-origin"),
38
38
  arrowOffset: u("--arrow-offset")
39
- }, G = (t) => ({
39
+ }, G = (e) => ({
40
40
  top: "bottom center",
41
- "top-start": t ? `${t.x}px bottom` : "left bottom",
42
- "top-end": t ? `${t.x}px bottom` : "right bottom",
41
+ "top-start": e ? `${e.x}px bottom` : "left bottom",
42
+ "top-end": e ? `${e.x}px bottom` : "right bottom",
43
43
  bottom: "top center",
44
- "bottom-start": t ? `${t.x}px top` : "top left",
45
- "bottom-end": t ? `${t.x}px top` : "top right",
44
+ "bottom-start": e ? `${e.x}px top` : "top left",
45
+ "bottom-end": e ? `${e.x}px top` : "top right",
46
46
  left: "right center",
47
- "left-start": t ? `right ${t.y}px` : "right top",
48
- "left-end": t ? `right ${t.y}px` : "right bottom",
47
+ "left-start": e ? `right ${e.y}px` : "right top",
48
+ "left-end": e ? `right ${e.y}px` : "right bottom",
49
49
  right: "left center",
50
- "right-start": t ? `left ${t.y}px` : "left top",
51
- "right-end": t ? `left ${t.y}px` : "left bottom"
50
+ "right-start": e ? `left ${e.y}px` : "left top",
51
+ "right-end": e ? `left ${e.y}px` : "left bottom"
52
52
  }), J = {
53
53
  name: "transformOrigin",
54
- fn({ placement: t, elements: e, middlewareData: r }) {
55
- const { arrow: i } = r, n = G(i)[t], { floating: o } = e;
56
- return o.style.setProperty(c.transformOrigin.variable, n), {
54
+ fn({ placement: e, elements: t, middlewareData: r }) {
55
+ const { arrow: i } = r, n = G(i)[e], { floating: o } = t;
56
+ return o.style.setProperty(f.transformOrigin.variable, n), {
57
57
  data: { transformOrigin: n }
58
58
  };
59
59
  }
60
60
  }, Y = {
61
61
  name: "rects",
62
- fn({ rects: t }) {
62
+ fn({ rects: e }) {
63
63
  return {
64
- data: t
64
+ data: e
65
65
  };
66
66
  }
67
- }, E = (t) => {
68
- if (t)
67
+ }, K = (e) => {
68
+ if (e)
69
69
  return {
70
70
  name: "shiftArrow",
71
- fn({ placement: e, middlewareData: r }) {
71
+ fn({ placement: t, middlewareData: r }) {
72
72
  if (!r.arrow) return {};
73
- const { x: i, y: n } = r.arrow, o = e.split("-")[0];
74
- return Object.assign(t.style, {
73
+ const { x: i, y: n } = r.arrow, o = t.split("-")[0];
74
+ return Object.assign(e.style, {
75
75
  left: i != null ? `${i}px` : "",
76
76
  top: n != null ? `${n}px` : "",
77
- [o]: `calc(100% + ${c.arrowOffset.reference})`
77
+ [o]: `calc(100% + ${f.arrowOffset.reference})`
78
78
  }), {};
79
79
  }
80
80
  };
81
81
  };
82
- function K(t) {
83
- const [e, r] = t.split("-");
84
- return { side: e, align: r, hasAlign: r != null };
82
+ function Q(e) {
83
+ const [t, r] = e.split("-");
84
+ return { side: t, align: r, hasAlign: r != null };
85
85
  }
86
- function ct(t) {
87
- return t.split("-")[0];
86
+ function de(e) {
87
+ return e.split("-")[0];
88
88
  }
89
- var Q = {
89
+ var X = {
90
90
  strategy: "absolute",
91
91
  placement: "bottom",
92
92
  listeners: !0,
@@ -99,134 +99,134 @@ var Q = {
99
99
  overflowPadding: 8,
100
100
  arrowPadding: 4
101
101
  };
102
- function b(t, e) {
103
- const r = t.devicePixelRatio || 1;
104
- return Math.round(e * r) / r;
102
+ function P(e, t) {
103
+ const r = e.devicePixelRatio || 1;
104
+ return Math.round(t * r) / r;
105
105
  }
106
- function P(t) {
107
- return j(t.boundary);
106
+ function M(e) {
107
+ return U(e.boundary);
108
108
  }
109
- function X(t, e) {
110
- if (t)
111
- return W({
112
- element: t,
113
- padding: e.arrowPadding
109
+ function Z(e, t) {
110
+ if (e)
111
+ return R({
112
+ element: e,
113
+ padding: t.arrowPadding
114
114
  });
115
115
  }
116
- function Z(t, e) {
117
- if (!N(e.offset ?? e.gutter))
116
+ function F(e, t) {
117
+ if (!j(t.offset ?? t.gutter))
118
118
  return A(({ placement: r }) => {
119
119
  var d, a;
120
- const i = ((t == null ? void 0 : t.clientHeight) || 0) / 2, n = ((d = e.offset) == null ? void 0 : d.mainAxis) ?? e.gutter, o = typeof n == "number" ? n + i : n ?? i, { hasAlign: f } = K(r), s = f ? void 0 : e.shift, l = ((a = e.offset) == null ? void 0 : a.crossAxis) ?? s;
121
- return U({
120
+ const i = ((e == null ? void 0 : e.clientHeight) || 0) / 2, n = ((d = t.offset) == null ? void 0 : d.mainAxis) ?? t.gutter, o = typeof n == "number" ? n + i : n ?? i, { hasAlign: c } = Q(r), s = c ? void 0 : t.shift, l = ((a = t.offset) == null ? void 0 : a.crossAxis) ?? s;
121
+ return _({
122
122
  crossAxis: l,
123
123
  mainAxis: o,
124
- alignmentAxis: e.shift
124
+ alignmentAxis: t.shift
125
125
  });
126
126
  });
127
127
  }
128
- function F(t) {
129
- if (t.flip)
128
+ function ee(e) {
129
+ if (e.flip)
130
130
  return D({
131
- boundary: P(t),
132
- padding: t.overflowPadding,
133
- fallbackPlacements: t.flip === !0 ? void 0 : t.flip
131
+ boundary: M(e),
132
+ padding: e.overflowPadding,
133
+ fallbackPlacements: e.flip === !0 ? void 0 : e.flip
134
134
  });
135
135
  }
136
- function tt(t) {
137
- if (!(!t.slide && !t.overlap))
138
- return R({
139
- boundary: P(t),
140
- mainAxis: t.slide,
141
- crossAxis: t.overlap,
142
- padding: t.overflowPadding,
136
+ function te(e) {
137
+ if (!(!e.slide && !e.overlap))
138
+ return H({
139
+ boundary: M(e),
140
+ mainAxis: e.slide,
141
+ crossAxis: e.overlap,
142
+ padding: e.overflowPadding,
143
143
  limiter: T()
144
144
  });
145
145
  }
146
- function et(t) {
147
- return I({
148
- padding: t.overflowPadding,
149
- apply({ elements: e, rects: r, availableHeight: i, availableWidth: n }) {
150
- const o = e.floating, f = Math.round(r.reference.width);
151
- n = Math.floor(n), i = Math.floor(i), o.style.setProperty("--reference-width", `${f}px`), o.style.setProperty("--available-width", `${n}px`), o.style.setProperty("--available-height", `${i}px`);
146
+ function re(e) {
147
+ return W({
148
+ padding: e.overflowPadding,
149
+ apply({ elements: t, rects: r, availableHeight: i, availableWidth: n }) {
150
+ const o = t.floating, c = Math.round(r.reference.width);
151
+ n = Math.floor(n), i = Math.floor(i), o.style.setProperty("--reference-width", `${c}px`), o.style.setProperty("--available-width", `${n}px`), o.style.setProperty("--available-height", `${i}px`);
152
152
  }
153
153
  });
154
154
  }
155
- function rt(t) {
156
- var e;
157
- if (t.hideWhenDetached)
158
- return B({ strategy: "referenceHidden", boundary: ((e = t.boundary) == null ? void 0 : e.call(t)) ?? "clippingAncestors" });
155
+ function ne(e) {
156
+ var t;
157
+ if (e.hideWhenDetached)
158
+ return B({ strategy: "referenceHidden", boundary: ((t = e.boundary) == null ? void 0 : t.call(e)) ?? "clippingAncestors" });
159
159
  }
160
- function nt(t) {
161
- return t ? t === !0 ? { ancestorResize: !0, ancestorScroll: !0, elementResize: !0, layoutShift: !0 } : t : {};
160
+ function ie(e) {
161
+ return e ? e === !0 ? { ancestorResize: !0, ancestorScroll: !0, elementResize: !0, layoutShift: !0 } : e : {};
162
162
  }
163
- function it(t, e, r = {}) {
164
- const i = q(t, r.getAnchorRect);
165
- if (!e || !i) return;
166
- const n = Object.assign({}, Q, r), o = e.querySelector("[data-part=arrow]"), f = [
163
+ function oe(e, t, r = {}) {
164
+ const i = E(e, r.getAnchorRect);
165
+ if (!t || !i) return;
166
+ const n = Object.assign({}, X, r), o = t.querySelector("[data-part=arrow]"), c = [
167
+ F(o, n),
168
+ ee(n),
169
+ te(n),
167
170
  Z(o, n),
168
- F(n),
169
- tt(n),
170
- X(o, n),
171
- E(o),
171
+ K(o),
172
172
  J,
173
- et(n),
174
- rt(n),
173
+ re(n),
174
+ ne(n),
175
175
  Y
176
- ], { placement: s, strategy: l, onComplete: d, onPositioned: a } = n, m = async () => {
177
- var w;
178
- if (!i || !e) return;
179
- const p = await H(i, e, {
176
+ ], { placement: s, strategy: l, onComplete: d, onPositioned: a } = n, h = async () => {
177
+ var x;
178
+ if (!i || !t) return;
179
+ const p = await I(i, t, {
180
180
  placement: s,
181
- middleware: f,
181
+ middleware: c,
182
182
  strategy: l
183
183
  });
184
184
  d == null || d(p), a == null || a({ placed: !0 });
185
- const h = C(e), M = b(h, p.x), O = b(h, p.y);
186
- e.style.setProperty("--x", `${M}px`), e.style.setProperty("--y", `${O}px`), n.hideWhenDetached && ((w = p.middlewareData.hide) != null && w.referenceHidden) && e.style.setProperty("visibility", "hidden");
187
- const x = e.firstElementChild;
188
- if (x) {
189
- const $ = h.getComputedStyle(x).zIndex;
190
- e.style.setProperty("--z-index", $);
185
+ const y = C(t), $ = P(y, p.x), z = P(y, p.y);
186
+ t.style.setProperty("--x", `${$}px`), t.style.setProperty("--y", `${z}px`), n.hideWhenDetached && (((x = p.middlewareData.hide) == null ? void 0 : x.referenceHidden) ? (t.style.setProperty("visibility", "hidden"), t.style.setProperty("pointer-events", "none")) : (t.style.removeProperty("visibility"), t.style.removeProperty("pointer-events")));
187
+ const v = t.firstElementChild;
188
+ if (v) {
189
+ const w = L(v);
190
+ t.style.setProperty("--z-index", w.zIndex);
191
191
  }
192
- }, y = async () => {
193
- r.updatePosition ? (await r.updatePosition({ updatePosition: m }), a == null || a({ placed: !0 })) : await m();
194
- }, z = nt(n.listeners), g = n.listeners ? S(i, e, y, z) : L;
195
- return y(), () => {
192
+ }, m = async () => {
193
+ r.updatePosition ? (await r.updatePosition({ updatePosition: h }), a == null || a({ placed: !0 })) : await h();
194
+ }, O = ie(n.listeners), g = n.listeners ? S(i, t, m, O) : N;
195
+ return m(), () => {
196
196
  g == null || g(), a == null || a({ placed: !1 });
197
197
  };
198
198
  }
199
- function dt(t, e, r = {}) {
200
- const { defer: i, ...n } = r, o = i ? V : (s) => s(), f = [];
201
- return f.push(
199
+ function le(e, t, r = {}) {
200
+ const { defer: i, ...n } = r, o = i ? V : (s) => s(), c = [];
201
+ return c.push(
202
202
  o(() => {
203
- const s = typeof t == "function" ? t() : t, l = typeof e == "function" ? e() : e;
204
- f.push(it(s, l, n));
203
+ const s = typeof e == "function" ? e() : e, l = typeof t == "function" ? t() : t;
204
+ c.push(oe(s, l, n));
205
205
  })
206
206
  ), () => {
207
- f.forEach((s) => s == null ? void 0 : s());
207
+ c.forEach((s) => s == null ? void 0 : s());
208
208
  };
209
209
  }
210
- var ot = {
210
+ var ae = {
211
211
  bottom: "rotate(45deg)",
212
212
  left: "rotate(135deg)",
213
213
  top: "rotate(225deg)",
214
214
  right: "rotate(315deg)"
215
215
  };
216
- function lt(t = {}) {
217
- const { placement: e, sameWidth: r, fitViewport: i, strategy: n = "absolute" } = t;
216
+ function ue(e = {}) {
217
+ const { placement: t, sameWidth: r, fitViewport: i, strategy: n = "absolute" } = e;
218
218
  return {
219
219
  arrow: {
220
220
  position: "absolute",
221
- width: c.arrowSize.reference,
222
- height: c.arrowSize.reference,
223
- [c.arrowSizeHalf.variable]: `calc(${c.arrowSize.reference} / 2)`,
224
- [c.arrowOffset.variable]: `calc(${c.arrowSizeHalf.reference} * -1)`
221
+ width: f.arrowSize.reference,
222
+ height: f.arrowSize.reference,
223
+ [f.arrowSizeHalf.variable]: `calc(${f.arrowSize.reference} / 2)`,
224
+ [f.arrowOffset.variable]: `calc(${f.arrowSizeHalf.reference} * -1)`
225
225
  },
226
226
  arrowTip: {
227
227
  // @ts-expect-error - Fix this
228
- transform: e ? ot[e.split("-")[0]] : void 0,
229
- background: c.arrowBg.reference,
228
+ transform: t ? ae[t.split("-")[0]] : void 0,
229
+ background: f.arrowBg.reference,
230
230
  top: "0",
231
231
  left: "0",
232
232
  width: "100%",
@@ -241,16 +241,17 @@ function lt(t = {}) {
241
241
  width: r ? "var(--reference-width)" : void 0,
242
242
  maxWidth: i ? "var(--available-width)" : void 0,
243
243
  maxHeight: i ? "var(--available-height)" : void 0,
244
+ pointerEvents: t ? void 0 : "none",
244
245
  top: "0px",
245
246
  left: "0px",
246
247
  // move off-screen if placement is not defined
247
- transform: e ? "translate3d(var(--x), var(--y), 0)" : "translate3d(0, -100vh, 0)",
248
+ transform: t ? "translate3d(var(--x), var(--y), 0)" : "translate3d(0, -100vh, 0)",
248
249
  zIndex: "var(--z-index)"
249
250
  }
250
251
  };
251
252
  }
252
253
  export {
253
- dt as getPlacement,
254
- ct as getPlacementSide,
255
- lt as getPlacementStyles
254
+ le as getPlacement,
255
+ de as getPlacementSide,
256
+ ue as getPlacementStyles
256
257
  };
@@ -1,141 +1,158 @@
1
- import { createMachine as N } from "../../core/dist/index.js";
2
- import { createProps as c } from "../../types/dist/index.js";
3
- import { ref as u } from "../../store/dist/index.js";
4
- function E(a, e, t) {
5
- const i = a.matches("mounted", "unmountSuspended");
1
+ import { setStyle as N, nextTick as d, raf as p, getComputedStyle as g, getEventTarget as v } from "../../dom-query/dist/index.js";
2
+ import { createMachine as y } from "../../core/dist/index.js";
3
+ import { createProps as f } from "../../types/dist/index.js";
4
+ function S(e, t) {
5
+ const { state: i, send: n, context: s } = e, a = i.matches("mounted", "unmountSuspended");
6
6
  return {
7
- skip: !a.context.initial && i,
8
- present: i,
9
- setNode(n) {
10
- n && e({ type: "NODE.SET", node: n });
7
+ skip: !s.get("initial"),
8
+ present: a,
9
+ setNode(r) {
10
+ r && n({ type: "NODE.SET", node: r });
11
11
  },
12
12
  unmount() {
13
- e({ type: "UNMOUNT" });
13
+ n({ type: "UNMOUNT" });
14
14
  }
15
15
  };
16
16
  }
17
- function r(a) {
18
- return (a == null ? void 0 : a.animationName) || "none";
19
- }
20
- function A(a) {
21
- return N(
22
- {
23
- initial: a.present ? "mounted" : "unmounted",
24
- context: {
25
- node: null,
26
- styles: null,
27
- unmountAnimationName: null,
28
- prevAnimationName: null,
29
- present: !1,
30
- initial: !1,
31
- ...a
32
- },
33
- exit: ["clearInitial"],
34
- watch: {
35
- present: ["setInitial", "syncPresence"]
36
- },
17
+ var O = y({
18
+ props({ props: e }) {
19
+ return { ...e, present: !!e.present };
20
+ },
21
+ initialState({ prop: e }) {
22
+ return e("present") ? "mounted" : "unmounted";
23
+ },
24
+ refs() {
25
+ return {
26
+ node: null,
27
+ styles: null
28
+ };
29
+ },
30
+ context({ bindable: e }) {
31
+ return {
32
+ unmountAnimationName: e(() => ({ defaultValue: null })),
33
+ prevAnimationName: e(() => ({ defaultValue: null })),
34
+ present: e(() => ({ defaultValue: !1 })),
35
+ initial: e(() => ({
36
+ sync: !0,
37
+ defaultValue: !1
38
+ }))
39
+ };
40
+ },
41
+ exit: ["clearInitial", "cleanupNode"],
42
+ watch({ track: e, action: t, prop: i }) {
43
+ e([() => i("present")], () => {
44
+ t(["setInitial", "syncPresence"]);
45
+ });
46
+ },
47
+ on: {
48
+ "NODE.SET": {
49
+ actions: ["setNode", "setStyles"]
50
+ }
51
+ },
52
+ states: {
53
+ mounted: {
37
54
  on: {
38
- "NODE.SET": {
39
- actions: ["setNode", "setStyles"]
40
- }
41
- },
42
- states: {
43
- mounted: {
44
- on: {
45
- UNMOUNT: {
46
- target: "unmounted",
47
- actions: ["invokeOnExitComplete"]
48
- },
49
- "UNMOUNT.SUSPEND": "unmountSuspended"
50
- }
55
+ UNMOUNT: {
56
+ target: "unmounted",
57
+ actions: ["clearPrevAnimationName", "invokeOnExitComplete"]
51
58
  },
52
- unmountSuspended: {
53
- activities: ["trackAnimationEvents"],
54
- on: {
55
- MOUNT: {
56
- target: "mounted",
57
- actions: ["setPrevAnimationName"]
58
- },
59
- "ANIMATION.END": {
60
- target: "unmounted",
61
- actions: ["invokeOnExitComplete"]
62
- },
63
- UNMOUNT: {
64
- target: "unmounted",
65
- actions: ["invokeOnExitComplete"]
66
- }
67
- }
68
- },
69
- unmounted: {
70
- entry: ["clearPrevAnimationName"],
71
- on: {
72
- MOUNT: {
73
- target: "mounted",
74
- actions: ["setPrevAnimationName"]
75
- }
76
- }
59
+ "UNMOUNT.SUSPEND": {
60
+ target: "unmountSuspended"
77
61
  }
78
62
  }
79
63
  },
80
- {
81
- actions: {
82
- setInitial(e) {
83
- e.initial = !0;
84
- },
85
- clearInitial(e) {
86
- e.initial = !1;
87
- },
88
- invokeOnExitComplete(e) {
89
- var t;
90
- (t = e.onExitComplete) == null || t.call(e);
91
- },
92
- setNode(e, t) {
93
- e.node = u(t.node);
94
- },
95
- setStyles(e, t) {
96
- const i = t.node.ownerDocument.defaultView || window;
97
- e.styles = u(i.getComputedStyle(t.node));
98
- },
99
- syncPresence(e, t, { send: i }) {
100
- if (e.present) {
101
- i({ type: "MOUNT", src: "presence.changed" });
102
- return;
103
- }
104
- const n = r(e.styles);
105
- (e.immediate ? queueMicrotask : requestAnimationFrame)(() => {
106
- var o, m;
107
- e.unmountAnimationName = n, n === "none" || n === e.prevAnimationName || ((o = e.styles) == null ? void 0 : o.display) === "none" || ((m = e.styles) == null ? void 0 : m.animationDuration) === "0s" ? i({ type: "UNMOUNT", src: "presence.changed" }) : i({ type: "UNMOUNT.SUSPEND" });
108
- });
109
- },
110
- setPrevAnimationName(e) {
111
- (e.immediate ? queueMicrotask : requestAnimationFrame)(() => {
112
- e.prevAnimationName = r(e.styles);
113
- });
64
+ unmountSuspended: {
65
+ effects: ["trackAnimationEvents"],
66
+ on: {
67
+ MOUNT: {
68
+ target: "mounted",
69
+ actions: ["setPrevAnimationName"]
114
70
  },
115
- clearPrevAnimationName(e) {
116
- e.prevAnimationName = null;
71
+ UNMOUNT: {
72
+ target: "unmounted",
73
+ actions: ["clearPrevAnimationName", "invokeOnExitComplete"]
117
74
  }
118
- },
119
- activities: {
120
- trackAnimationEvents(e, t, { send: i }) {
121
- const n = e.node;
122
- if (!n) return;
123
- const s = (m) => {
124
- m.target === n && (e.prevAnimationName = r(e.styles));
125
- }, o = (m) => {
126
- const l = r(e.styles);
127
- m.target === n && l === e.unmountAnimationName && i({ type: "UNMOUNT", src: "animationend" });
128
- };
129
- return n.addEventListener("animationstart", s), n.addEventListener("animationcancel", o), n.addEventListener("animationend", o), () => {
130
- n.removeEventListener("animationstart", s), n.removeEventListener("animationcancel", o), n.removeEventListener("animationend", o);
131
- };
75
+ }
76
+ },
77
+ unmounted: {
78
+ on: {
79
+ MOUNT: {
80
+ target: "mounted",
81
+ actions: ["setPrevAnimationName"]
132
82
  }
133
83
  }
134
84
  }
135
- );
85
+ },
86
+ implementations: {
87
+ actions: {
88
+ setInitial: ({ context: e }) => {
89
+ e.get("initial") || queueMicrotask(() => {
90
+ e.set("initial", !0);
91
+ });
92
+ },
93
+ clearInitial: ({ context: e }) => {
94
+ e.set("initial", !1);
95
+ },
96
+ cleanupNode: ({ refs: e }) => {
97
+ e.set("node", null), e.set("styles", null);
98
+ },
99
+ invokeOnExitComplete: ({ prop: e }) => {
100
+ var t;
101
+ (t = e("onExitComplete")) == null || t();
102
+ },
103
+ setNode: ({ refs: e, event: t }) => {
104
+ e.set("node", t.node);
105
+ },
106
+ setStyles: ({ refs: e, event: t }) => {
107
+ e.set("styles", g(t.node));
108
+ },
109
+ syncPresence: ({ context: e, refs: t, send: i, prop: n }) => {
110
+ const s = n("present");
111
+ if (s)
112
+ return i({ type: "MOUNT", src: "presence.changed" });
113
+ const a = t.get("node");
114
+ if (!s && (a == null ? void 0 : a.ownerDocument.visibilityState) === "hidden")
115
+ return i({ type: "UNMOUNT", src: "visibilitychange" });
116
+ p(() => {
117
+ var o, m;
118
+ const r = u(t.get("styles"));
119
+ e.set("unmountAnimationName", r), r === "none" || r === e.get("prevAnimationName") || ((o = t.get("styles")) == null ? void 0 : o.display) === "none" || ((m = t.get("styles")) == null ? void 0 : m.animationDuration) === "0s" ? i({ type: "UNMOUNT", src: "presence.changed" }) : i({ type: "UNMOUNT.SUSPEND" });
120
+ });
121
+ },
122
+ setPrevAnimationName: ({ context: e, refs: t }) => {
123
+ p(() => {
124
+ e.set("prevAnimationName", u(t.get("styles")));
125
+ });
126
+ },
127
+ clearPrevAnimationName: ({ context: e }) => {
128
+ e.set("prevAnimationName", null);
129
+ }
130
+ },
131
+ effects: {
132
+ trackAnimationEvents: ({ context: e, refs: t, send: i }) => {
133
+ const n = t.get("node");
134
+ if (!n) return;
135
+ const s = (o) => {
136
+ var l, c;
137
+ (((c = (l = o.composedPath) == null ? void 0 : l.call(o)) == null ? void 0 : c[0]) ?? o.target) === n && e.set("prevAnimationName", u(t.get("styles")));
138
+ }, a = (o) => {
139
+ const m = u(t.get("styles"));
140
+ v(o) === n && m === e.get("unmountAnimationName") && i({ type: "UNMOUNT", src: "animationend" });
141
+ };
142
+ n.addEventListener("animationstart", s), n.addEventListener("animationcancel", a), n.addEventListener("animationend", a);
143
+ const r = N(n, { animationFillMode: "forwards" });
144
+ return () => {
145
+ n.removeEventListener("animationstart", s), n.removeEventListener("animationcancel", a), n.removeEventListener("animationend", a), d(() => r());
146
+ };
147
+ }
148
+ }
149
+ }
150
+ });
151
+ function u(e) {
152
+ return (e == null ? void 0 : e.animationName) || "none";
136
153
  }
137
- c()(["onExitComplete", "present", "immediate"]);
154
+ f()(["onExitComplete", "present", "immediate"]);
138
155
  export {
139
- E as connect,
140
- A as machine
156
+ S as connect,
157
+ O as machine
141
158
  };