@marianmeres/stuic 1.95.0 → 1.97.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;
@@ -44,7 +45,7 @@ $:
44
45
  on:keydown={(e) => e.code === 'Escape' && dispatch('escape')}
45
46
  in:fade={{ duration: fadeInDuration }}
46
47
  out:fade={{ duration: fadeOutDuration }}
47
- use:focusTrap={{ enabled: useFocusTrap }}
48
+ use:focusTrap={{ enabled: useFocusTrap, ...(focusTrapOptions || {}) }}
48
49
  role="presentation"
49
50
  tabindex="-1"
50
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;
@@ -25,6 +25,7 @@ export let describedby = "";
25
25
  export let transitionDuration = 250;
26
26
  export let transitionEnabled = !$prefersReducedMotionStore;
27
27
  export let animOffset = "66vw";
28
+ export let backdropFocusTrapOptions = {};
28
29
  $:
29
30
  fadeInDuration = transitionEnabled ? Math.min(transitionDuration * 0.66, 200) : 0;
30
31
  const _presetsClsBackdrop = {
@@ -60,6 +61,7 @@ $:
60
61
  {fadeInDuration}
61
62
  fadeOutDuration={transitionEnabled ? transitionDuration : 0}
62
63
  on:element
64
+ focusTrapOptions={backdropFocusTrapOptions}
63
65
  >
64
66
  <!--
65
67
  svelte-ignore
@@ -1,4 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
+ import type { FocusTrapOptions } from '../../actions/focus-trap.js';
2
3
  export type DrawerStore = ReturnType<typeof createDrawerStore>;
3
4
  export declare const createDrawerStore: (open?: boolean) => import("@marianmeres/switch-store").SwitchStore<any>;
4
5
  declare const __propDef: {
@@ -12,6 +13,7 @@ declare const __propDef: {
12
13
  transitionDuration?: number | undefined;
13
14
  transitionEnabled?: boolean | undefined;
14
15
  animOffset?: string | number | undefined;
16
+ backdropFocusTrapOptions?: Partial<FocusTrapOptions> | undefined;
15
17
  };
16
18
  events: {
17
19
  escape: CustomEvent<any>;
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.95.0",
3
+ "version": "1.97.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package && node ./scripts/date.js",