@marianmeres/stuic 1.94.0 → 1.96.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.
@@ -1,4 +1,4 @@
1
- interface FocusTrapOptions {
1
+ export interface FocusTrapOptions {
2
2
  enabled?: boolean;
3
3
  autoFocusFirst?: boolean;
4
4
  }
@@ -6,4 +6,3 @@ export declare function focusTrap(node: HTMLElement, options?: FocusTrapOptions)
6
6
  update(options?: FocusTrapOptions): void;
7
7
  destroy(): void;
8
8
  };
9
- export {};
@@ -12,6 +12,7 @@ import { focusTrap } from "../../actions/focus-trap.js";
12
12
  import { prefersReducedMotionStore } from "../../utils/prefers-reduced-motion.js";
13
13
  const dispatch = createEventDispatcher();
14
14
  export let useFocusTrap = true;
15
+ export let focusTrapOptions = {};
15
16
  let _class = "";
16
17
  export { _class as class };
17
18
  export let fadeInDuration = BackdropConfig.fadeInDuration;
@@ -38,12 +39,13 @@ $:
38
39
  `.trim())}
39
40
  on:click
40
41
  on:mousedown
42
+ on:mouseup
41
43
  on:touchstart|passive
42
44
  on:touchend|passive
43
45
  on:keydown={(e) => e.code === 'Escape' && dispatch('escape')}
44
46
  in:fade={{ duration: fadeInDuration }}
45
47
  out:fade={{ duration: fadeOutDuration }}
46
- use:focusTrap={{ enabled: useFocusTrap }}
48
+ use:focusTrap={{ ...focusTrapOptions, enabled: useFocusTrap }}
47
49
  role="presentation"
48
50
  tabindex="-1"
49
51
  >
@@ -4,9 +4,11 @@ export declare class BackdropConfig {
4
4
  static fadeInDuration: number;
5
5
  static fadeOutDuration: number;
6
6
  }
7
+ import { type FocusTrapOptions } from '../../actions/focus-trap.js';
7
8
  declare const __propDef: {
8
9
  props: {
9
10
  useFocusTrap?: boolean | undefined;
11
+ focusTrapOptions?: Partial<FocusTrapOptions> | undefined;
10
12
  class?: string | undefined;
11
13
  fadeInDuration?: number | undefined;
12
14
  fadeOutDuration?: number | undefined;
@@ -15,6 +17,7 @@ declare const __propDef: {
15
17
  events: {
16
18
  click: MouseEvent;
17
19
  mousedown: MouseEvent;
20
+ mouseup: MouseEvent;
18
21
  touchstart: TouchEvent;
19
22
  touchend: TouchEvent;
20
23
  escape: CustomEvent<any>;
@@ -56,7 +56,7 @@ $:
56
56
  <Backdrop
57
57
  class={twMerge(`${_presetsClsBackdrop[position] || ''} ${backdropClass}`)}
58
58
  on:escape
59
- on:click={(e) => dispatch('click_backdrop')}
59
+ on:mousedown={(e) => dispatch('click_backdrop')}
60
60
  {fadeInDuration}
61
61
  fadeOutDuration={transitionEnabled ? transitionDuration : 0}
62
62
  on:element
@@ -68,7 +68,7 @@ $:
68
68
  -->
69
69
  <div
70
70
  bind:this={el}
71
- on:click|stopPropagation
71
+ on:mousedown|stopPropagation
72
72
  aria-modal="true"
73
73
  role="dialog"
74
74
  aria-labelledby={labelledby}
@@ -16,7 +16,7 @@ declare const __propDef: {
16
16
  events: {
17
17
  escape: CustomEvent<any>;
18
18
  element: CustomEvent<any>;
19
- click: MouseEvent;
19
+ mousedown: MouseEvent;
20
20
  } & {
21
21
  [evt: string]: CustomEvent<any>;
22
22
  };
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ export { default as Thc, type THC, isTHCNotEmpty } from './components/Thc/Thc.sv
23
23
  export { default as X } from './components/X/X.svelte';
24
24
  export { autogrow } from './actions/autogrow.js';
25
25
  export { draggable, droppable, type DraggableOptions, type DroppableOptions, } from './actions/drag-drop.js';
26
- export { focusTrap } from './actions/focus-trap.js';
26
+ export { focusTrap, type FocusTrapOptions } from './actions/focus-trap.js';
27
27
  export { onOutside } from './actions/on-outside.js';
28
28
  export { preSubmitValidityCheck } from './actions/pre-submit-validity-check.js';
29
29
  export { tooltip, TooltipConfig, type TooltipOptions, } from './actions/tooltip/tooltip.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "1.94.0",
3
+ "version": "1.96.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package && node ./scripts/date.js",