@pzerelles/headlessui-svelte 2.1.2-next.4 → 2.1.2-next.5

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.
@@ -13,6 +13,7 @@
13
13
  import { useDisposables } from "../utils/disposables.js"
14
14
  import Hidden, { HiddenFeatures } from "../internal/Hidden.svelte"
15
15
  import ElementOrComponent from "../utils/ElementOrComponent.svelte"
16
+ import { FocusTrapFeatures } from "./FocusTrapFeatures.js"
16
17
 
17
18
  type Containers =
18
19
  // Lazy resolved containers
@@ -36,25 +37,7 @@
36
37
 
37
38
  let DEFAULT_FOCUS_TRAP_TAG = "div" as const
38
39
 
39
- export enum FocusTrapFeatures {
40
- /** No features enabled for the focus trap. */
41
- None = 0,
42
-
43
- /** Ensure that we move focus initially into the container. */
44
- InitialFocus = 1 << 0,
45
-
46
- /** Ensure that pressing `Tab` and `Shift+Tab` is trapped within the container. */
47
- TabLock = 1 << 1,
48
-
49
- /** Ensure that programmatically moving focus outside of the container is disallowed. */
50
- FocusLock = 1 << 2,
51
-
52
- /** Ensure that we restore the focus when unmounting the focus trap. */
53
- RestoreFocus = 1 << 3,
54
-
55
- /** Initial focus should look for the `data-autofocus` */
56
- AutoFocus = 1 << 4,
57
- }
40
+ export * from "./FocusTrapFeatures.js"
58
41
 
59
42
  type FocusTrapRenderPropArg = {}
60
43
  type FocusTrapPropsWeControl = never
@@ -1,20 +1,8 @@
1
1
  import type { ElementType, Props } from "../utils/types.js";
2
+ import { FocusTrapFeatures } from "./FocusTrapFeatures.js";
2
3
  type Containers = (() => Iterable<HTMLElement>) | Iterable<HTMLElement>;
3
4
  declare let DEFAULT_FOCUS_TRAP_TAG: "div";
4
- export declare enum FocusTrapFeatures {
5
- /** No features enabled for the focus trap. */
6
- None = 0,
7
- /** Ensure that we move focus initially into the container. */
8
- InitialFocus = 1,
9
- /** Ensure that pressing `Tab` and `Shift+Tab` is trapped within the container. */
10
- TabLock = 2,
11
- /** Ensure that programmatically moving focus outside of the container is disallowed. */
12
- FocusLock = 4,
13
- /** Ensure that we restore the focus when unmounting the focus trap. */
14
- RestoreFocus = 8,
15
- /** Initial focus should look for the `data-autofocus` */
16
- AutoFocus = 16
17
- }
5
+ export * from "./FocusTrapFeatures.js";
18
6
  type FocusTrapRenderPropArg = {};
19
7
  type FocusTrapPropsWeControl = never;
20
8
  export type FocusTrapProps<TTag extends ElementType = typeof DEFAULT_FOCUS_TRAP_TAG> = Props<TTag, FocusTrapRenderPropArg, FocusTrapPropsWeControl, {
@@ -0,0 +1,14 @@
1
+ export declare enum FocusTrapFeatures {
2
+ /** No features enabled for the focus trap. */
3
+ None = 0,
4
+ /** Ensure that we move focus initially into the container. */
5
+ InitialFocus = 1,
6
+ /** Ensure that pressing `Tab` and `Shift+Tab` is trapped within the container. */
7
+ TabLock = 2,
8
+ /** Ensure that programmatically moving focus outside of the container is disallowed. */
9
+ FocusLock = 4,
10
+ /** Ensure that we restore the focus when unmounting the focus trap. */
11
+ RestoreFocus = 8,
12
+ /** Initial focus should look for the `data-autofocus` */
13
+ AutoFocus = 16
14
+ }
@@ -0,0 +1,15 @@
1
+ export var FocusTrapFeatures;
2
+ (function (FocusTrapFeatures) {
3
+ /** No features enabled for the focus trap. */
4
+ FocusTrapFeatures[FocusTrapFeatures["None"] = 0] = "None";
5
+ /** Ensure that we move focus initially into the container. */
6
+ FocusTrapFeatures[FocusTrapFeatures["InitialFocus"] = 1] = "InitialFocus";
7
+ /** Ensure that pressing `Tab` and `Shift+Tab` is trapped within the container. */
8
+ FocusTrapFeatures[FocusTrapFeatures["TabLock"] = 2] = "TabLock";
9
+ /** Ensure that programmatically moving focus outside of the container is disallowed. */
10
+ FocusTrapFeatures[FocusTrapFeatures["FocusLock"] = 4] = "FocusLock";
11
+ /** Ensure that we restore the focus when unmounting the focus trap. */
12
+ FocusTrapFeatures[FocusTrapFeatures["RestoreFocus"] = 8] = "RestoreFocus";
13
+ /** Initial focus should look for the `data-autofocus` */
14
+ FocusTrapFeatures[FocusTrapFeatures["AutoFocus"] = 16] = "AutoFocus";
15
+ })(FocusTrapFeatures || (FocusTrapFeatures = {}));
@@ -8,6 +8,7 @@
8
8
  import { useRef, type MutableRefObject } from "../utils/ref.svelte.js"
9
9
  import type { ElementType, EnsureArray, Props } from "../utils/types.js"
10
10
  import { getContext, setContext, type Snippet } from "svelte"
11
+ import { ActivationTrigger, ListboxStates, ValueMode } from "./ListboxStates.js"
11
12
 
12
13
  let DEFAULT_LISTBOX_TAG = "svelte:fragment"
13
14
  type ListboxRenderPropArg<T> = {
@@ -43,20 +44,7 @@
43
44
 
44
45
  export type ListboxChildren<T> = Snippet<[ListboxRenderPropArg<T>]>
45
46
 
46
- export enum ListboxStates {
47
- Open,
48
- Closed,
49
- }
50
-
51
- export enum ValueMode {
52
- Single,
53
- Multi,
54
- }
55
-
56
- export enum ActivationTrigger {
57
- Pointer,
58
- Other,
59
- }
47
+ export * from "./ListboxStates.js"
60
48
 
61
49
  export type ListboxOptionDataRef<T> = MutableRefObject<{
62
50
  textValue?: string
@@ -3,6 +3,7 @@ import { Focus } from "../utils/calculate-active-index.js";
3
3
  import { type MutableRefObject } from "../utils/ref.svelte.js";
4
4
  import type { ElementType, Props } from "../utils/types.js";
5
5
  import { type Snippet } from "svelte";
6
+ import { ActivationTrigger, ListboxStates, ValueMode } from "./ListboxStates.js";
6
7
  declare let DEFAULT_LISTBOX_TAG: string;
7
8
  type ListboxRenderPropArg<T> = {
8
9
  open: boolean;
@@ -24,18 +25,7 @@ export type ListboxProps<TTag extends ElementType = typeof DEFAULT_LISTBOX_TAG,
24
25
  __demoMode?: boolean;
25
26
  }>;
26
27
  export type ListboxChildren<T> = Snippet<[ListboxRenderPropArg<T>]>;
27
- export declare enum ListboxStates {
28
- Open = 0,
29
- Closed = 1
30
- }
31
- export declare enum ValueMode {
32
- Single = 0,
33
- Multi = 1
34
- }
35
- export declare enum ActivationTrigger {
36
- Pointer = 0,
37
- Other = 1
38
- }
28
+ export * from "./ListboxStates.js";
39
29
  export type ListboxOptionDataRef<T> = MutableRefObject<{
40
30
  textValue?: string;
41
31
  disabled: boolean;
@@ -0,0 +1,12 @@
1
+ export declare enum ListboxStates {
2
+ Open = 0,
3
+ Closed = 1
4
+ }
5
+ export declare enum ValueMode {
6
+ Single = 0,
7
+ Multi = 1
8
+ }
9
+ export declare enum ActivationTrigger {
10
+ Pointer = 0,
11
+ Other = 1
12
+ }
@@ -0,0 +1,15 @@
1
+ export var ListboxStates;
2
+ (function (ListboxStates) {
3
+ ListboxStates[ListboxStates["Open"] = 0] = "Open";
4
+ ListboxStates[ListboxStates["Closed"] = 1] = "Closed";
5
+ })(ListboxStates || (ListboxStates = {}));
6
+ export var ValueMode;
7
+ (function (ValueMode) {
8
+ ValueMode[ValueMode["Single"] = 0] = "Single";
9
+ ValueMode[ValueMode["Multi"] = 1] = "Multi";
10
+ })(ValueMode || (ValueMode = {}));
11
+ export var ActivationTrigger;
12
+ (function (ActivationTrigger) {
13
+ ActivationTrigger[ActivationTrigger["Pointer"] = 0] = "Pointer";
14
+ ActivationTrigger[ActivationTrigger["Other"] = 1] = "Other";
15
+ })(ActivationTrigger || (ActivationTrigger = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pzerelles/headlessui-svelte",
3
- "version": "2.1.2-next.4",
3
+ "version": "2.1.2-next.5",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",