@eightshift/ui-components 6.0.9 → 6.0.11

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.
@@ -244,7 +244,8 @@ const $28f4fd908f0de97f$export$feabaa331e1d464c = /* @__PURE__ */ forwardRef(fun
244
244
  * @param {string} props.label - Label to display.
245
245
  * @param {string} [props.subtitle] - Subtitle to display.
246
246
  * @param {string} [props.className] - Classes to pass to the container.
247
- * @param {string} [props.contentClassName] - Classes to pass to the inner content wrapper.
247
+ * @param {string} [props.contentClassName] - Classes to pass to the inner content outer wrapper.
248
+ * @param {string} [props.contentWrapClassName] - Classes to pass to the inner content wrapper.
248
249
  * @param {string} [props.labelClassName] - Classes to pass to the label.
249
250
  * @param {string} [props.headerClassName] - Classes to pass to the header (label + trigger).
250
251
  * @param {JSX.Element|JSX.Element[]} [props.actions] - Actions to display in the panel header, left of the expand button.
@@ -275,6 +276,7 @@ const Expandable = (props) => {
275
276
  className,
276
277
  labelClassName,
277
278
  contentClassName,
279
+ contentWrapClassName,
278
280
  headerClassName,
279
281
  actions,
280
282
  keepActionsOnExpand = false,
@@ -396,7 +398,7 @@ const Expandable = (props) => {
396
398
  "es:transition-plus-h",
397
399
  contentClassName
398
400
  ),
399
- children: /* @__PURE__ */ jsx("div", { className: "es:space-y-1 es:px-3 es:py-3.5", children })
401
+ children: /* @__PURE__ */ jsx("div", { className: clsx("es:flex es:flex-col es:gap-2.5 es:px-3 es:py-3.5", contentWrapClassName), children })
400
402
  }
401
403
  )
402
404
  ]
@@ -7,7 +7,7 @@ import { BaseControl } from "../base-control/base-control.js";
7
7
  import { icons } from "../../icons/icons.js";
8
8
  import { getColumnConfigOutputText } from "./utils.js";
9
9
  import { c as clsx } from "../../clsx-DgYk2OaC.js";
10
- import { A as AnimatePresence, m as motion } from "../../proxy-Bj4KTTJt.js";
10
+ import { A as AnimatePresence, m as motion } from "../../proxy-CcjltLEW.js";
11
11
  /**
12
12
  * A two-thumb slider for selecting a range of columns.
13
13
  *
@@ -6,7 +6,7 @@ import { c as clsx } from "../../clsx-DgYk2OaC.js";
6
6
  import { NumberPicker } from "../number-picker/number-picker.js";
7
7
  import { generateMarkers, generateGridTemplate } from "./utils.js";
8
8
  import { HStack } from "../layout/hstack.js";
9
- import { A as AnimatePresence, m as motion } from "../../proxy-Bj4KTTJt.js";
9
+ import { A as AnimatePresence, m as motion } from "../../proxy-CcjltLEW.js";
10
10
  /**
11
11
  * A single/multi-thumb slider component.
12
12
  *
@@ -5187,13 +5187,22 @@ function distance2D(a, b) {
5187
5187
  const yDelta = distance(a.y, b.y);
5188
5188
  return Math.sqrt(xDelta ** 2 + yDelta ** 2);
5189
5189
  }
5190
+ const overflowStyles = /* @__PURE__ */ new Set(["auto", "scroll"]);
5190
5191
  class PanSession {
5191
- constructor(event, handlers, { transformPagePoint, contextWindow = window, dragSnapToOrigin = false, distanceThreshold = 3 } = {}) {
5192
+ constructor(event, handlers, { transformPagePoint, contextWindow = window, dragSnapToOrigin = false, distanceThreshold = 3, element } = {}) {
5192
5193
  this.startEvent = null;
5193
5194
  this.lastMoveEvent = null;
5194
5195
  this.lastMoveEventInfo = null;
5195
5196
  this.handlers = {};
5196
5197
  this.contextWindow = window;
5198
+ this.scrollPositions = /* @__PURE__ */ new Map();
5199
+ this.removeScrollListeners = null;
5200
+ this.onElementScroll = (event2) => {
5201
+ this.handleScroll(event2.target);
5202
+ };
5203
+ this.onWindowScroll = () => {
5204
+ this.handleScroll(window);
5205
+ };
5197
5206
  this.updatePoint = () => {
5198
5207
  if (!(this.lastMoveEvent && this.lastMoveEventInfo))
5199
5208
  return;
@@ -5246,12 +5255,82 @@ class PanSession {
5246
5255
  const { onSessionStart } = handlers;
5247
5256
  onSessionStart && onSessionStart(event, getPanInfo(initialInfo, this.history));
5248
5257
  this.removeListeners = pipe(addPointerEvent(this.contextWindow, "pointermove", this.handlePointerMove), addPointerEvent(this.contextWindow, "pointerup", this.handlePointerUp), addPointerEvent(this.contextWindow, "pointercancel", this.handlePointerUp));
5258
+ if (element) {
5259
+ this.startScrollTracking(element);
5260
+ }
5261
+ }
5262
+ /**
5263
+ * Start tracking scroll on ancestors and window.
5264
+ */
5265
+ startScrollTracking(element) {
5266
+ let current = element.parentElement;
5267
+ while (current) {
5268
+ const style = getComputedStyle(current);
5269
+ if (overflowStyles.has(style.overflowX) || overflowStyles.has(style.overflowY)) {
5270
+ this.scrollPositions.set(current, {
5271
+ x: current.scrollLeft,
5272
+ y: current.scrollTop
5273
+ });
5274
+ }
5275
+ current = current.parentElement;
5276
+ }
5277
+ this.scrollPositions.set(window, {
5278
+ x: window.scrollX,
5279
+ y: window.scrollY
5280
+ });
5281
+ window.addEventListener("scroll", this.onElementScroll, {
5282
+ capture: true,
5283
+ passive: true
5284
+ });
5285
+ window.addEventListener("scroll", this.onWindowScroll, {
5286
+ passive: true
5287
+ });
5288
+ this.removeScrollListeners = () => {
5289
+ window.removeEventListener("scroll", this.onElementScroll, {
5290
+ capture: true
5291
+ });
5292
+ window.removeEventListener("scroll", this.onWindowScroll);
5293
+ };
5294
+ }
5295
+ /**
5296
+ * Handle scroll compensation during drag.
5297
+ *
5298
+ * For element scroll: adjusts history origin since pageX/pageY doesn't change.
5299
+ * For window scroll: adjusts lastMoveEventInfo since pageX/pageY would change.
5300
+ */
5301
+ handleScroll(target) {
5302
+ const initial = this.scrollPositions.get(target);
5303
+ if (!initial)
5304
+ return;
5305
+ const isWindow = target === window;
5306
+ const current = isWindow ? { x: window.scrollX, y: window.scrollY } : {
5307
+ x: target.scrollLeft,
5308
+ y: target.scrollTop
5309
+ };
5310
+ const delta = { x: current.x - initial.x, y: current.y - initial.y };
5311
+ if (delta.x === 0 && delta.y === 0)
5312
+ return;
5313
+ if (isWindow) {
5314
+ if (this.lastMoveEventInfo) {
5315
+ this.lastMoveEventInfo.point.x += delta.x;
5316
+ this.lastMoveEventInfo.point.y += delta.y;
5317
+ }
5318
+ } else {
5319
+ if (this.history.length > 0) {
5320
+ this.history[0].x -= delta.x;
5321
+ this.history[0].y -= delta.y;
5322
+ }
5323
+ }
5324
+ this.scrollPositions.set(target, current);
5325
+ frame.update(this.updatePoint, true);
5249
5326
  }
5250
5327
  updateHandlers(handlers) {
5251
5328
  this.handlers = handlers;
5252
5329
  }
5253
5330
  end() {
5254
5331
  this.removeListeners && this.removeListeners();
5332
+ this.removeScrollListeners && this.removeScrollListeners();
5333
+ this.scrollPositions.clear();
5255
5334
  cancelFrame(this.updatePoint);
5256
5335
  }
5257
5336
  }
@@ -5488,7 +5567,8 @@ class VisualElementDragControls {
5488
5567
  transformPagePoint: this.visualElement.getTransformPagePoint(),
5489
5568
  dragSnapToOrigin,
5490
5569
  distanceThreshold,
5491
- contextWindow: getContextWindow(this.visualElement)
5570
+ contextWindow: getContextWindow(this.visualElement),
5571
+ element: this.visualElement.current
5492
5572
  });
5493
5573
  }
5494
5574
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eightshift/ui-components",
3
- "version": "6.0.9",
3
+ "version": "6.0.11",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -50,15 +50,11 @@
50
50
  "devDependencies": {
51
51
  "@adobe/react-spectrum": "^3.46.0",
52
52
  "@atom-universe/use-web-worker": "^2.2.1",
53
- "@dnd-kit/abstract": "^0.1.21",
54
- "@dnd-kit/core": "^6.3.1",
55
- "@dnd-kit/dom": "^0.1.21",
56
- "@dnd-kit/helpers": "^0.1.21",
57
- "@dnd-kit/modifiers": "^9.0.0",
58
- "@dnd-kit/react": "^0.1.21",
59
- "@dnd-kit/sortable": "^10.0.0",
60
- "@dnd-kit/utilities": "^3.2.2",
61
- "@eslint/compat": "^2.0.0",
53
+ "@dnd-kit/abstract": "^0.2.1",
54
+ "@dnd-kit/dom": "^0.2.1",
55
+ "@dnd-kit/helpers": "^0.2.1",
56
+ "@dnd-kit/react": "^0.2.1",
57
+ "@eslint/compat": "^2.0.1",
62
58
  "@react-stately/collections": "^3.12.8",
63
59
  "@stylistic/eslint-plugin-js": "^4.4.1",
64
60
  "@tailwindcss/vite": "^4.1.18",
@@ -76,7 +72,7 @@
76
72
  "css-gradient-parser": "^0.0.18",
77
73
  "eslint": "^9.39.2",
78
74
  "eslint-config-prettier": "^10.1.8",
79
- "eslint-plugin-jsdoc": "^61.5.0",
75
+ "eslint-plugin-jsdoc": "^61.7.1",
80
76
  "eslint-plugin-prettier": "^5.5.4",
81
77
  "glob": "^13.0.0",
82
78
  "globals": "^16.5.0",
@@ -107,6 +103,6 @@
107
103
  "dependencies": {
108
104
  "@fontsource-variable/geist-mono": "^5.2.7",
109
105
  "@fontsource-variable/roboto-flex": "^5.2.8",
110
- "motion": "^12.24.11"
106
+ "motion": "^12.25.0"
111
107
  }
112
108
  }