bits-ui 0.8.2 → 0.8.3

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.
@@ -8,7 +8,8 @@ export let asChild = false;
8
8
  const {
9
9
  elements: { root },
10
10
  states: { value: localValue },
11
- updateOption
11
+ updateOption,
12
+ ids
12
13
  } = setCtx({
13
14
  multiple,
14
15
  disabled,
@@ -33,9 +34,9 @@ const attrs = getAttrs("root");
33
34
  </script>
34
35
 
35
36
  {#if asChild}
36
- <slot {builder} {attrs} />
37
+ <slot {builder} {attrs} {ids} />
37
38
  {:else}
38
39
  <div {...builder} use:builder.action {...$$restProps} {...attrs}>
39
- <slot {builder} {attrs} />
40
+ <slot {builder} {attrs} {ids} />
40
41
  </div>
41
42
  {/if}
@@ -229,6 +229,9 @@ declare class __sveltets_Render<Multiple extends boolean> {
229
229
  action: import("svelte/action").Action<any, any, Record<never, any>>;
230
230
  };
231
231
  attrs: Record<string, string>;
232
+ ids: {
233
+ root: string;
234
+ };
232
235
  };
233
236
  };
234
237
  }
@@ -14,7 +14,8 @@ const tOpen = writable(open);
14
14
  let timeout = 0;
15
15
  const {
16
16
  states: { open: localOpen },
17
- updateOption
17
+ updateOption,
18
+ ids
18
19
  } = setCtx({
19
20
  closeOnEscape,
20
21
  preventScroll,
@@ -68,4 +69,4 @@ $:
68
69
  updateOption("forceVisible", forceVisible);
69
70
  </script>
70
71
 
71
- <slot />
72
+ <slot {ids} />
@@ -15,7 +15,14 @@ declare const __propDef: {
15
15
  [evt: string]: CustomEvent<any>;
16
16
  };
17
17
  slots: {
18
- default: {};
18
+ default: {
19
+ ids: {
20
+ content: string;
21
+ title: string;
22
+ description: string;
23
+ trigger: string;
24
+ };
25
+ };
19
26
  };
20
27
  };
21
28
  export type AlertDialogProps = typeof __propDef.props;
@@ -16,7 +16,8 @@ const tOpen = writable(open);
16
16
  let timeout = 0;
17
17
  const {
18
18
  states: { open: localOpen },
19
- updateOption
19
+ updateOption,
20
+ ids
20
21
  } = setCtx({
21
22
  closeOnEscape,
22
23
  preventScroll,
@@ -79,4 +80,4 @@ $:
79
80
  updateOption("closeFocus", closeFocus);
80
81
  </script>
81
82
 
82
- <slot />
83
+ <slot {ids} />
@@ -15,7 +15,14 @@ declare const __propDef: {
15
15
  [evt: string]: CustomEvent<any>;
16
16
  };
17
17
  slots: {
18
- default: {};
18
+ default: {
19
+ ids: {
20
+ content: string;
21
+ title: string;
22
+ description: string;
23
+ trigger: string;
24
+ };
25
+ };
19
26
  };
20
27
  };
21
28
  export type DialogProps = typeof __propDef.props;
@@ -10,7 +10,8 @@ export let arrowSize = void 0;
10
10
  export let portal = void 0;
11
11
  const {
12
12
  states: { open: localOpen },
13
- updateOption
13
+ updateOption,
14
+ ids
14
15
  } = setCtx({
15
16
  defaultOpen: open,
16
17
  positioning,
@@ -46,4 +47,4 @@ $:
46
47
  updateOption("portal", portal);
47
48
  </script>
48
49
 
49
- <slot />
50
+ <slot {ids} />
@@ -16,7 +16,12 @@ declare const __propDef: {
16
16
  [evt: string]: CustomEvent<any>;
17
17
  };
18
18
  slots: {
19
- default: {};
19
+ default: {
20
+ ids: {
21
+ content: string;
22
+ trigger: string;
23
+ };
24
+ };
20
25
  };
21
26
  };
22
27
  export type LinkPreviewProps = typeof __propDef.props;
@@ -1,6 +1,4 @@
1
1
  <script>import { setCtx } from "../ctx.js";
2
- import { isBrowser } from "../../../internal/is.js";
3
- import { tick } from "svelte";
4
2
  export let positioning = void 0;
5
3
  export let arrowSize = void 0;
6
4
  export let disableFocusTrap = void 0;
@@ -10,13 +8,12 @@ export let preventScroll = void 0;
10
8
  export let portal = void 0;
11
9
  export let open = void 0;
12
10
  export let onOpenChange = void 0;
13
- export let focusTriggerOnClose = false;
14
11
  export let openFocus = void 0;
15
12
  export let closeFocus = void 0;
16
13
  const {
17
14
  updateOption,
18
15
  states: { open: localOpen },
19
- ids: { trigger }
16
+ ids
20
17
  } = setCtx({
21
18
  positioning,
22
19
  arrowSize,
@@ -28,25 +25,14 @@ const {
28
25
  defaultOpen: open,
29
26
  openFocus,
30
27
  closeFocus,
31
- onOpenChange: ({ next, curr }) => {
32
- return customOnOpenChange({ next, curr });
33
- }
34
- });
35
- const customOnOpenChange = ({ next }) => {
36
- if (open === next)
28
+ onOpenChange: ({ next }) => {
29
+ if (open !== next) {
30
+ onOpenChange?.(next);
31
+ open = next;
32
+ }
37
33
  return next;
38
- if (next === false && focusTriggerOnClose && isBrowser) {
39
- tick().then(() => {
40
- const triggerEl = document.getElementById(trigger);
41
- if (triggerEl) {
42
- triggerEl.focus();
43
- }
44
- });
45
34
  }
46
- onOpenChange?.(next);
47
- open = next;
48
- return next;
49
- };
35
+ });
50
36
  $:
51
37
  open !== void 0 && localOpen.set(open);
52
38
  $:
@@ -69,4 +55,4 @@ $:
69
55
  updateOption("closeFocus", closeFocus);
70
56
  </script>
71
57
 
72
- <slot />
58
+ <slot {ids} />
@@ -13,13 +13,17 @@ declare const __propDef: {
13
13
  closeFocus?: import("@melt-ui/svelte/index.js").FocusProp | undefined;
14
14
  open?: boolean | undefined;
15
15
  onOpenChange?: import("../../../internal/types.js").OnChangeFn<boolean> | undefined;
16
- focusTriggerOnClose?: boolean | undefined;
17
16
  };
18
17
  events: {
19
18
  [evt: string]: CustomEvent<any>;
20
19
  };
21
20
  slots: {
22
- default: {};
21
+ default: {
22
+ ids: {
23
+ content: string;
24
+ trigger: string;
25
+ };
26
+ };
23
27
  };
24
28
  };
25
29
  export type PopoverProps = typeof __propDef.props;
@@ -5,14 +5,6 @@ import type { HTMLButtonAttributes } from "svelte/elements";
5
5
  type Props = Expand<OmitOpen<CreatePopoverProps> & {
6
6
  open?: boolean;
7
7
  onOpenChange?: OnChangeFn<boolean>;
8
- /**
9
- * Focus the trigger when `open` is programmatically set to false.
10
- * This is in addition to the automatic focus that occurs when you
11
- * don't programmatically set `open` to false.
12
- *
13
- * @default false;
14
- */
15
- focusTriggerOnClose?: boolean;
16
8
  }>;
17
9
  type ContentProps<T extends Transition = Transition, In extends Transition = Transition, Out extends Transition = Transition> = Expand<TransitionProps<T, In, Out> & AsChild> & HTMLDivAttributes;
18
10
  type TriggerProps = AsChild & HTMLButtonAttributes;
@@ -17,7 +17,8 @@ export let onOpenChange = void 0;
17
17
  export let forceVisible = true;
18
18
  const {
19
19
  states: { open: localOpen, selected: localSelected },
20
- updateOption
20
+ updateOption,
21
+ ids
21
22
  } = setCtx({
22
23
  required,
23
24
  disabled,
@@ -78,4 +79,4 @@ $:
78
79
  updateOption("forceVisible", forceVisible);
79
80
  </script>
80
81
 
81
- <slot />
82
+ <slot {ids} />
@@ -26,7 +26,13 @@ declare const __propDef: {
26
26
  [evt: string]: CustomEvent<any>;
27
27
  };
28
28
  slots: {
29
- default: {};
29
+ default: {
30
+ ids: {
31
+ trigger: string;
32
+ menu: string;
33
+ label: string;
34
+ };
35
+ };
30
36
  };
31
37
  };
32
38
  type SelectProps_ = typeof __propDef.props;
@@ -11,7 +11,8 @@ export let asChild = false;
11
11
  const {
12
12
  elements: { root },
13
13
  states: { value: localValue },
14
- updateOption
14
+ updateOption,
15
+ ids
15
16
  } = setCtx({
16
17
  disabled,
17
18
  min,
@@ -45,9 +46,9 @@ const attrs = getAttrs("root");
45
46
  </script>
46
47
 
47
48
  {#if asChild}
48
- <slot {builder} {attrs} />
49
+ <slot {builder} {attrs} {ids} />
49
50
  {:else}
50
51
  <span {...builder} use:builder.action {...$$restProps} {...attrs}>
51
- <slot {builder} {attrs} />
52
+ <slot {builder} {attrs} {ids} />
52
53
  </span>
53
54
  {/if}
@@ -235,6 +235,9 @@ declare const __propDef: {
235
235
  action: import("svelte/action").Action<any, any, Record<never, any>>;
236
236
  };
237
237
  attrs: Record<string, string>;
238
+ ids: {
239
+ root: string;
240
+ };
238
241
  };
239
242
  };
240
243
  };
@@ -13,7 +13,8 @@ export let disableHoverableContent = void 0;
13
13
  export let group = void 0;
14
14
  const {
15
15
  states: { open: localOpen },
16
- updateOption
16
+ updateOption,
17
+ ids
17
18
  } = setCtx({
18
19
  positioning,
19
20
  arrowSize,
@@ -58,4 +59,4 @@ $:
58
59
  updateOption("disableHoverableContent", disableHoverableContent);
59
60
  </script>
60
61
 
61
- <slot />
62
+ <slot {ids} />
@@ -18,7 +18,12 @@ declare const __propDef: {
18
18
  [evt: string]: CustomEvent<any>;
19
19
  };
20
20
  slots: {
21
- default: {};
21
+ default: {
22
+ ids: {
23
+ readonly content: string;
24
+ readonly trigger: string;
25
+ };
26
+ };
22
27
  };
23
28
  };
24
29
  export type TooltipProps = typeof __propDef.props;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bits-ui",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "dev": "concurrently \"pnpm:dev:content\" \"pnpm:dev:svelte\"",