@dnax/ui 0.0.60 → 0.0.61

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.
@@ -180,7 +180,10 @@ let isHorizontal = false
180
180
 
181
181
  const onPointerDown = (e: PointerEvent) => {
182
182
  if (isStatic.value || !open.value || props.disable) return
183
- ;(e.currentTarget as HTMLElement).setPointerCapture(e.pointerId)
183
+ // ⚠️ Ne **pas** `setPointerCapture` ici : capturer au `pointerdown` fait retarger le
184
+ // `click` qui suit vers l'`<aside>` → **aucun** handler interne ne se déclenche (ni le ×
185
+ // de fermeture, ni les items de menu). La capture est prise uniquement si le geste est
186
+ // **confirmé horizontal** (cf. `onPointerMove`), donc un vrai clic n'est jamais capturé.
184
187
  startX = e.clientX
185
188
  startY = e.clientY
186
189
  currentDx = 0
@@ -198,6 +201,10 @@ const onPointerMove = (e: PointerEvent) => {
198
201
  if (!isHorizontal) {
199
202
  if (Math.abs(dx) > 8 && Math.abs(dx) > Math.abs(dy)) {
200
203
  isHorizontal = true
204
+ // Capture **au moment du swipe confirmé** (et non au pointerdown) : c'est ce qui
205
+ // laisse le `click` d'un vrai clic atteindre les handlers internes, tout en gardant
206
+ // les événements du swipe même si le pointeur sort du panneau.
207
+ rootEl.value.setPointerCapture(e.pointerId)
201
208
  rootEl.value.style.transition = "none"
202
209
  }
203
210
  else return
@@ -210,11 +217,14 @@ const onPointerMove = (e: PointerEvent) => {
210
217
  rootEl.value.style.transform = `translateX(${dir === 1 ? travel : -travel}px)`
211
218
  }
212
219
 
213
- const onPointerUp = () => {
220
+ const onPointerUp = (e: PointerEvent) => {
214
221
  if (!dragging.value) return
215
222
  dragging.value = false
216
223
  const el = rootEl.value
217
224
  if (!el) return
225
+ // Relâche la capture prise au swipe confirmé (le navigateur le fait aussi en fin de geste ;
226
+ // on l'explicite pour rester cohérent).
227
+ if (el.hasPointerCapture?.(e.pointerId)) el.releasePointerCapture(e.pointerId)
218
228
  el.style.transition = "" // restaure la transition CSS
219
229
  const width = el.offsetWidth || parseInt(props.width, 10) || 260
220
230
  if (currentDx > Math.min(80, width * 0.3)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/ui",
3
- "version": "0.0.60",
3
+ "version": "0.0.61",
4
4
  "module": "index.ts",
5
5
  "description": "UI design System",
6
6
  "type": "module",