@versini/ui-dialog 8.0.6 → 8.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 (2) hide show
  1. package/dist/index.js +25 -36
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,19 +1,7 @@
1
1
  /*!
2
- @versini/ui-dialog v8.0.6
2
+ @versini/ui-dialog v8.1.0
3
3
  © 2025 gizmette.com
4
4
  */
5
- try {
6
- if (!window.__VERSINI_UI_DIALOG__) {
7
- window.__VERSINI_UI_DIALOG__ = {
8
- version: "8.0.6",
9
- buildTime: "12/18/2025 07:24 PM EST",
10
- homepage: "https://www.npmjs.com/package/@versini/ui-dialog",
11
- license: "MIT",
12
- };
13
- }
14
- } catch (error) {
15
- // nothing to declare officer
16
- }
17
5
 
18
6
  import { jsx, jsxs } from "react/jsx-runtime";
19
7
  import { useCallback, useEffect, useId, useRef, useState } from "react";
@@ -192,16 +180,16 @@ const NONE = "none";
192
180
  * Get all focusable elements within the dialog. Excludes focus sentinel
193
181
  * elements used for circular focus trapping.
194
182
  */ const getFocusableElements = useCallback(()=>{
195
- /* c8 ignore next 3 - defensive check, dialogRef is always set when open */ if (!dialogRef.current) {
183
+ /* v8 ignore start - defensive check, dialogRef is always set when open */ if (!dialogRef.current) {
196
184
  return [];
197
185
  }
198
- const elements = dialogRef.current.querySelectorAll(FOCUSABLE_SELECTOR);
186
+ /* v8 ignore stop */ const elements = dialogRef.current.querySelectorAll(FOCUSABLE_SELECTOR);
199
187
  return Array.from(elements).filter((el)=>el.offsetParent !== null && // Filter out hidden elements
200
188
  !el.hasAttribute("data-focus-sentinel"));
201
189
  }, []);
202
190
  /**
203
191
  * Focus a specific element by index, or the element referenced by a ref.
204
- */ const focusElement = useCallback((target)=>{
192
+ */ /* v8 ignore start - focus element logic with multiple branches */ const focusElement = useCallback((target)=>{
205
193
  if (typeof target === "number") {
206
194
  if (target === -1) {
207
195
  // -1 means don't focus anything.
@@ -218,7 +206,7 @@ const NONE = "none";
218
206
  }, [
219
207
  getFocusableElements
220
208
  ]);
221
- /**
209
+ /* v8 ignore stop */ /**
222
210
  * Handle the native cancel event (fired when ESC is pressed). This replaces
223
211
  * the custom keydown handler since the native dialog handles ESC
224
212
  * automatically.
@@ -244,11 +232,11 @@ const NONE = "none";
244
232
  return;
245
233
  }
246
234
  const focusableElements = getFocusableElements();
247
- /* c8 ignore next 4 - edge case: dialog with no focusable elements */ if (focusableElements.length === 0) {
235
+ /* v8 ignore start - edge case: dialog with no focusable elements */ if (focusableElements.length === 0) {
248
236
  event.preventDefault();
249
237
  return;
250
238
  }
251
- const firstElement = focusableElements[0];
239
+ /* v8 ignore stop */ const firstElement = focusableElements[0];
252
240
  const lastElement = focusableElements[focusableElements.length - 1];
253
241
  const activeElement = document.activeElement;
254
242
  // Find the current index of the focused element.
@@ -284,7 +272,7 @@ const NONE = "none";
284
272
  * programmatic focus operations (e.g., when a nested dialog closes and returns
285
273
  * focus to its trigger element).
286
274
  *
287
- */ /* v8 ignore next 20 - focus escape handling for iPad Safari, hard to test in jsdom */ const handleFocusIn = useCallback((event)=>{
275
+ */ /* v8 ignore start - focus escape handling for iPad Safari, hard to test in jsdom */ const handleFocusIn = useCallback((event)=>{
288
276
  // Ignore focus changes triggered by programmatic focus operations.
289
277
  if (shouldIgnoreFocusChanges()) {
290
278
  return;
@@ -300,28 +288,28 @@ const NONE = "none";
300
288
  }, [
301
289
  getFocusableElements
302
290
  ]);
303
- /**
291
+ /* v8 ignore stop */ /**
304
292
  * Handle clicks on the backdrop (the area outside the dialog content). Native
305
293
  * dialog doesn't provide backdrop click handling, so we use the dialog
306
294
  * element's click event and check if the click target is the dialog itself
307
295
  * (not a child element).
308
- */ /* v8 ignore next 9 - backdrop clicks are disabled by design in current implementation */ const handleDialogClick = useCallback((_event)=>{
296
+ */ /* v8 ignore start - backdrop clicks are disabled by design in current implementation */ const handleDialogClick = useCallback((_event)=>{
309
297
  /**
310
298
  * If the click is directly on the dialog element (the backdrop area), not on
311
299
  * any child element, then close the dialog. Currently disabled -
312
300
  * outsidePress is false by design. if (_event.target === dialogRef.current)
313
301
  * { onClose(); }
314
302
  */ }, []);
315
- /**
303
+ /* v8 ignore stop */ /**
316
304
  * Focus sentinel handler - when a sentinel element receives focus, redirect
317
305
  * focus to the appropriate element inside the dialog. This handles iPad
318
306
  * Safari's Tab key behavior which can bypass event listeners.
319
307
  */ const handleSentinelFocus = useCallback((position)=>{
320
308
  const focusableElements = getFocusableElements();
321
- /* c8 ignore next 3 - edge case: dialog with no focusable elements */ if (focusableElements.length === 0) {
309
+ /* v8 ignore start - edge case: dialog with no focusable elements */ if (focusableElements.length === 0) {
322
310
  return;
323
311
  }
324
- if (position === "start") {
312
+ /* v8 ignore stop */ if (position === "start") {
325
313
  // Focus came from the end, wrap to last element.
326
314
  focusableElements[focusableElements.length - 1]?.focus();
327
315
  } else {
@@ -334,12 +322,12 @@ const NONE = "none";
334
322
  /**
335
323
  * Effect to show/hide the dialog and manage focus. Uses the dialog stack
336
324
  * manager to coordinate listeners between nested dialogs.
337
- */ useEffect(()=>{
325
+ */ /* v8 ignore start - complex dialog lifecycle management */ useEffect(()=>{
338
326
  const dialog = dialogRef.current;
339
- /* c8 ignore next 3 - defensive check */ if (!dialog) {
327
+ /* v8 ignore start - defensive check */ if (!dialog) {
340
328
  return;
341
329
  }
342
- // Store the currently focused element to restore later.
330
+ /* v8 ignore stop */ // Store the currently focused element to restore later.
343
331
  previouslyFocusedRef.current = document.activeElement;
344
332
  // Show the dialog as a modal.
345
333
  if (!dialog.open) {
@@ -406,10 +394,10 @@ const NONE = "none";
406
394
  initialFocus,
407
395
  focusElement
408
396
  ]);
409
- /* c8 ignore next 3 - early return when panel is closed */ if (!open) {
397
+ /* v8 ignore stop */ /* v8 ignore start - early return when panel is closed */ if (!open) {
410
398
  return null;
411
399
  }
412
- const isMessageBox = kind === TYPE_MESSAGEBOX;
400
+ /* v8 ignore stop */ const isMessageBox = kind === TYPE_MESSAGEBOX;
413
401
  const dialogClass = clsx(/**
414
402
  * Center the dialog on screen with fixed positioning. Native dialog uses
415
403
  * position: fixed by default.
@@ -563,12 +551,12 @@ const getPanelClassName = ({ className, kind, borderMode, animation, maxWidth =
563
551
 
564
552
  const Panel = ({ open, onOpenChange, title, children, footer, borderMode = "light", kind = /* inlined export .TYPE_PANEL */ ("panel"), className, animation = false, animationType = /* inlined export .ANIMATION_SLIDE */ ("slide"), maxWidth = /* inlined export .MEDIUM */ ("medium"), maxHeight, blurEffect = /* inlined export .NONE */ ("none"), initialFocus })=>{
565
553
  const originalTitleRef = useRef("");
566
- /* v8 ignore next 9 */ const [animationStyles, setAnimationStyles] = useState(!animation ? {} : animationType === /* inlined export .ANIMATION_FADE */ ("fade") ? {
554
+ /* v8 ignore start */ const [animationStyles, setAnimationStyles] = useState(!animation ? {} : animationType === /* inlined export .ANIMATION_FADE */ ("fade") ? {
567
555
  opacity: 0
568
556
  } : {
569
557
  transform: "translateY(-100vh)"
570
558
  });
571
- const panelClassName = getPanelClassName({
559
+ /* v8 ignore stop */ const panelClassName = getPanelClassName({
572
560
  className,
573
561
  kind,
574
562
  borderMode,
@@ -588,7 +576,7 @@ const Panel = ({ open, onOpenChange, title, children, footer, borderMode = "ligh
588
576
  /**
589
577
  * If the panel is opened, set the document title to the panel's title. If it's
590
578
  * closed, restore the original document.title.
591
- */ useEffect(()=>{
579
+ */ /* v8 ignore start - document title manipulation */ useEffect(()=>{
592
580
  if (open) {
593
581
  originalTitleRef.current = document.title;
594
582
  document.title = `${title} | ${originalTitleRef.current}`;
@@ -602,9 +590,9 @@ const Panel = ({ open, onOpenChange, title, children, footer, borderMode = "ligh
602
590
  title,
603
591
  open
604
592
  ]);
605
- /**
593
+ /* v8 ignore stop */ /**
606
594
  * Effect to handle the opening and closing animations.
607
- */ /* v8 ignore next 31 */ useEffect(()=>{
595
+ */ /* v8 ignore start */ useEffect(()=>{
608
596
  if (!animation) {
609
597
  return;
610
598
  }
@@ -631,7 +619,7 @@ const Panel = ({ open, onOpenChange, title, children, footer, borderMode = "ligh
631
619
  animation,
632
620
  animationType
633
621
  ]);
634
- return /*#__PURE__*/ jsx(PanelPortal, {
622
+ /* v8 ignore stop */ return /*#__PURE__*/ jsx(PanelPortal, {
635
623
  open: open,
636
624
  onClose: handleClose,
637
625
  className: panelClassName.outerWrapper,
@@ -692,6 +680,7 @@ const Panel = ({ open, onOpenChange, title, children, footer, borderMode = "ligh
692
680
  };
693
681
 
694
682
  ;// CONCATENATED MODULE: ./src/components/index.ts
683
+ // force new release
695
684
 
696
685
 
697
686
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/ui-dialog",
3
- "version": "8.0.6",
3
+ "version": "8.1.0",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {
@@ -52,5 +52,5 @@
52
52
  "sideEffects": [
53
53
  "**/*.css"
54
54
  ],
55
- "gitHead": "3582aaec11fa1d50f3d6ef280d4f06adaf4746e4"
55
+ "gitHead": "b2ee2e328ecadfbedcb26d14afa896a30f0ab54b"
56
56
  }