@zag-js/popper 0.1.9 → 0.1.10

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.js CHANGED
@@ -209,10 +209,12 @@ function getPlacement(reference, floating, opts = {}) {
209
209
  const arrowEl = floating.querySelector("[data-part=arrow]");
210
210
  const middleware = [];
211
211
  if (options.flip) {
212
- middleware.push((0, import_dom2.flip)({
213
- boundary: options.boundary,
214
- padding: options.overflowPadding
215
- }));
212
+ middleware.push(
213
+ (0, import_dom2.flip)({
214
+ boundary: options.boundary,
215
+ padding: options.overflowPadding
216
+ })
217
+ );
216
218
  }
217
219
  if (options.gutter || options.offset) {
218
220
  const arrowOffset = arrowEl ? arrowEl.offsetHeight / 2 : 0;
@@ -221,36 +223,43 @@ function getPlacement(reference, floating, opts = {}) {
221
223
  data.mainAxis += arrowOffset;
222
224
  middleware.push((0, import_dom2.offset)(data));
223
225
  }
224
- middleware.push((0, import_dom2.shift)({
225
- boundary: options.boundary,
226
- crossAxis: options.overlap,
227
- padding: options.overflowPadding
228
- }));
226
+ middleware.push(
227
+ (0, import_dom2.shift)({
228
+ boundary: options.boundary,
229
+ crossAxis: options.overlap,
230
+ padding: options.overflowPadding
231
+ })
232
+ );
229
233
  if (arrowEl) {
230
- middleware.push((0, import_dom2.arrow)({ element: arrowEl, padding: 8 }), shiftArrow({ element: arrowEl }));
234
+ middleware.push(
235
+ (0, import_dom2.arrow)({ element: arrowEl, padding: 8 }),
236
+ shiftArrow({ element: arrowEl })
237
+ );
231
238
  }
232
239
  middleware.push(transformOrigin);
233
- middleware.push((0, import_dom2.size)({
234
- padding: options.overflowPadding,
235
- apply({ rects, availableHeight, availableWidth }) {
236
- const referenceWidth = Math.round(rects.reference.width);
237
- floating.style.setProperty("--reference-width", `${referenceWidth}px`);
238
- floating.style.setProperty("--available-width", `${availableWidth}px`);
239
- floating.style.setProperty("--available-height", `${availableHeight}px`);
240
- if (options.sameWidth) {
241
- Object.assign(floating.style, {
242
- width: `${referenceWidth}px`,
243
- minWidth: "unset"
244
- });
245
- }
246
- if (options.fitViewport) {
247
- Object.assign(floating.style, {
248
- maxWidth: `${availableWidth}px`,
249
- maxHeight: `${availableHeight}px`
250
- });
240
+ middleware.push(
241
+ (0, import_dom2.size)({
242
+ padding: options.overflowPadding,
243
+ apply({ rects, availableHeight, availableWidth }) {
244
+ const referenceWidth = Math.round(rects.reference.width);
245
+ floating.style.setProperty("--reference-width", `${referenceWidth}px`);
246
+ floating.style.setProperty("--available-width", `${availableWidth}px`);
247
+ floating.style.setProperty("--available-height", `${availableHeight}px`);
248
+ if (options.sameWidth) {
249
+ Object.assign(floating.style, {
250
+ width: `${referenceWidth}px`,
251
+ minWidth: "unset"
252
+ });
253
+ }
254
+ if (options.fitViewport) {
255
+ Object.assign(floating.style, {
256
+ maxWidth: `${availableWidth}px`,
257
+ maxHeight: `${availableHeight}px`
258
+ });
259
+ }
251
260
  }
252
- }
253
- }));
261
+ })
262
+ );
254
263
  function compute(config = {}) {
255
264
  if (!reference || !floating)
256
265
  return;
@@ -274,7 +283,10 @@ function getPlacement(reference, floating, opts = {}) {
274
283
  });
275
284
  }
276
285
  compute();
277
- return callAll(options.listeners ? autoUpdate(reference, floating, compute, options.listeners) : void 0, options.onCleanup);
286
+ return callAll(
287
+ options.listeners ? autoUpdate(reference, floating, compute, options.listeners) : void 0,
288
+ options.onCleanup
289
+ );
278
290
  }
279
291
  function getBasePlacement(placement) {
280
292
  return placement.split("-")[0];
package/dist/index.mjs CHANGED
@@ -181,10 +181,12 @@ function getPlacement(reference, floating, opts = {}) {
181
181
  const arrowEl = floating.querySelector("[data-part=arrow]");
182
182
  const middleware = [];
183
183
  if (options.flip) {
184
- middleware.push(flip({
185
- boundary: options.boundary,
186
- padding: options.overflowPadding
187
- }));
184
+ middleware.push(
185
+ flip({
186
+ boundary: options.boundary,
187
+ padding: options.overflowPadding
188
+ })
189
+ );
188
190
  }
189
191
  if (options.gutter || options.offset) {
190
192
  const arrowOffset = arrowEl ? arrowEl.offsetHeight / 2 : 0;
@@ -193,36 +195,43 @@ function getPlacement(reference, floating, opts = {}) {
193
195
  data.mainAxis += arrowOffset;
194
196
  middleware.push(offset(data));
195
197
  }
196
- middleware.push(shift({
197
- boundary: options.boundary,
198
- crossAxis: options.overlap,
199
- padding: options.overflowPadding
200
- }));
198
+ middleware.push(
199
+ shift({
200
+ boundary: options.boundary,
201
+ crossAxis: options.overlap,
202
+ padding: options.overflowPadding
203
+ })
204
+ );
201
205
  if (arrowEl) {
202
- middleware.push(arrow({ element: arrowEl, padding: 8 }), shiftArrow({ element: arrowEl }));
206
+ middleware.push(
207
+ arrow({ element: arrowEl, padding: 8 }),
208
+ shiftArrow({ element: arrowEl })
209
+ );
203
210
  }
204
211
  middleware.push(transformOrigin);
205
- middleware.push(size({
206
- padding: options.overflowPadding,
207
- apply({ rects, availableHeight, availableWidth }) {
208
- const referenceWidth = Math.round(rects.reference.width);
209
- floating.style.setProperty("--reference-width", `${referenceWidth}px`);
210
- floating.style.setProperty("--available-width", `${availableWidth}px`);
211
- floating.style.setProperty("--available-height", `${availableHeight}px`);
212
- if (options.sameWidth) {
213
- Object.assign(floating.style, {
214
- width: `${referenceWidth}px`,
215
- minWidth: "unset"
216
- });
217
- }
218
- if (options.fitViewport) {
219
- Object.assign(floating.style, {
220
- maxWidth: `${availableWidth}px`,
221
- maxHeight: `${availableHeight}px`
222
- });
212
+ middleware.push(
213
+ size({
214
+ padding: options.overflowPadding,
215
+ apply({ rects, availableHeight, availableWidth }) {
216
+ const referenceWidth = Math.round(rects.reference.width);
217
+ floating.style.setProperty("--reference-width", `${referenceWidth}px`);
218
+ floating.style.setProperty("--available-width", `${availableWidth}px`);
219
+ floating.style.setProperty("--available-height", `${availableHeight}px`);
220
+ if (options.sameWidth) {
221
+ Object.assign(floating.style, {
222
+ width: `${referenceWidth}px`,
223
+ minWidth: "unset"
224
+ });
225
+ }
226
+ if (options.fitViewport) {
227
+ Object.assign(floating.style, {
228
+ maxWidth: `${availableWidth}px`,
229
+ maxHeight: `${availableHeight}px`
230
+ });
231
+ }
223
232
  }
224
- }
225
- }));
233
+ })
234
+ );
226
235
  function compute(config = {}) {
227
236
  if (!reference || !floating)
228
237
  return;
@@ -246,7 +255,10 @@ function getPlacement(reference, floating, opts = {}) {
246
255
  });
247
256
  }
248
257
  compute();
249
- return callAll(options.listeners ? autoUpdate(reference, floating, compute, options.listeners) : void 0, options.onCleanup);
258
+ return callAll(
259
+ options.listeners ? autoUpdate(reference, floating, compute, options.listeners) : void 0,
260
+ options.onCleanup
261
+ );
250
262
  }
251
263
  function getBasePlacement(placement) {
252
264
  return placement.split("-")[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/popper",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Dynamic positioning logic for ui machines",
5
5
  "keywords": [
6
6
  "js",
@@ -25,10 +25,10 @@
25
25
  "url": "https://github.com/chakra-ui/zag/issues"
26
26
  },
27
27
  "dependencies": {
28
- "@floating-ui/dom": "0.5.4"
28
+ "@floating-ui/dom": "1.0.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@zag-js/dom-utils": "0.1.8",
31
+ "@zag-js/dom-utils": "0.1.9",
32
32
  "@zag-js/utils": "0.1.3"
33
33
  },
34
34
  "scripts": {