bits-ui 2.8.2 → 2.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.
@@ -56,7 +56,11 @@ export class CheckboxGroupLabelState {
56
56
  constructor(opts, group) {
57
57
  this.opts = opts;
58
58
  this.group = group;
59
- this.attachment = attachRef(this.opts.ref, (v) => (this.group.labelId = v?.id));
59
+ this.group.labelId = this.opts.id.current;
60
+ this.attachment = attachRef(this.opts.ref);
61
+ watch.pre(() => this.opts.id.current, (id) => {
62
+ this.group.labelId = id;
63
+ });
60
64
  }
61
65
  props = $derived.by(() => ({
62
66
  id: this.opts.id.current,
@@ -12,6 +12,7 @@ export declare class CollapsibleRootState {
12
12
  readonly opts: CollapsibleRootStateOpts;
13
13
  readonly attachment: RefAttachment;
14
14
  contentNode: HTMLElement | null;
15
+ contentId: string | undefined;
15
16
  constructor(opts: CollapsibleRootStateOpts);
16
17
  toggleOpen(): void;
17
18
  readonly props: {
@@ -15,6 +15,7 @@ export class CollapsibleRootState {
15
15
  opts;
16
16
  attachment;
17
17
  contentNode = $state(null);
18
+ contentId = $state(undefined);
18
19
  constructor(opts) {
19
20
  this.opts = opts;
20
21
  this.toggleOpen = this.toggleOpen.bind(this);
@@ -54,7 +55,11 @@ export class CollapsibleContentState {
54
55
  this.opts = opts;
55
56
  this.root = root;
56
57
  this.#isMountAnimationPrevented = root.opts.open.current;
58
+ this.root.contentId = this.opts.id.current;
57
59
  this.attachment = attachRef(this.opts.ref, (v) => (this.root.contentNode = v));
60
+ watch.pre(() => this.opts.id.current, (id) => {
61
+ this.root.contentId = id;
62
+ });
58
63
  $effect.pre(() => {
59
64
  const rAF = requestAnimationFrame(() => {
60
65
  this.#isMountAnimationPrevented = false;
@@ -142,7 +147,7 @@ export class CollapsibleTriggerState {
142
147
  id: this.opts.id.current,
143
148
  type: "button",
144
149
  disabled: this.#isDisabled,
145
- "aria-controls": this.root.contentNode?.id,
150
+ "aria-controls": this.root.contentId,
146
151
  "aria-expanded": getAriaExpanded(this.root.opts.open.current),
147
152
  "data-state": getDataOpenClosed(this.root.opts.open.current),
148
153
  "data-disabled": getDataDisabled(this.#isDisabled),
@@ -1,5 +1,5 @@
1
1
  import { attachRef, box, } from "svelte-toolbelt";
2
- import { Context } from "runed";
2
+ import { Context, watch } from "runed";
3
3
  import { createBitsAttrs, getAriaExpanded, getDataOpenClosed } from "../../internal/attrs.js";
4
4
  import { kbd } from "../../internal/kbd.js";
5
5
  import { OpenChangeComplete } from "../../internal/open-change-complete.js";
@@ -165,7 +165,11 @@ export class DialogTitleState {
165
165
  constructor(opts, root) {
166
166
  this.opts = opts;
167
167
  this.root = root;
168
- this.attachment = attachRef(this.opts.ref, (v) => (this.root.titleId = v?.id));
168
+ this.root.titleId = this.opts.id.current;
169
+ this.attachment = attachRef(this.opts.ref);
170
+ watch.pre(() => this.opts.id.current, (id) => {
171
+ this.root.titleId = id;
172
+ });
169
173
  }
170
174
  props = $derived.by(() => ({
171
175
  id: this.opts.id.current,
@@ -186,9 +190,12 @@ export class DialogDescriptionState {
186
190
  constructor(opts, root) {
187
191
  this.opts = opts;
188
192
  this.root = root;
193
+ this.root.descriptionId = this.opts.id.current;
189
194
  this.attachment = attachRef(this.opts.ref, (v) => {
190
195
  this.root.descriptionNode = v;
191
- this.root.descriptionId = v?.id;
196
+ });
197
+ watch.pre(() => this.opts.id.current, (id) => {
198
+ this.root.descriptionId = id;
192
199
  });
193
200
  }
194
201
  props = $derived.by(() => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bits-ui",
3
- "version": "2.8.2",
3
+ "version": "2.8.3",
4
4
  "license": "MIT",
5
5
  "repository": "github:huntabyte/bits-ui",
6
6
  "funding": "https://github.com/sponsors/huntabyte",
@@ -19,30 +19,28 @@
19
19
  "!dist/**/*.spec.*"
20
20
  ],
21
21
  "devDependencies": {
22
- "@internationalized/date": "^3.8.1",
23
- "@sveltejs/kit": "^2.21.1",
22
+ "@internationalized/date": "^3.8.2",
23
+ "@sveltejs/kit": "^2.21.5",
24
24
  "@sveltejs/package": "^2.3.11",
25
- "@sveltejs/vite-plugin-svelte": "5.0.3",
25
+ "@sveltejs/vite-plugin-svelte": "^5.1.0",
26
26
  "@types/css.escape": "^1.5.2",
27
27
  "@types/node": "^20.17.6",
28
28
  "@types/resize-observer-browser": "^0.1.11",
29
29
  "csstype": "^3.1.3",
30
- "jest-axe": "^9.0.0",
31
30
  "jsdom": "^24.1.3",
32
31
  "publint": "^0.2.12",
33
- "svelte": "^5.33.2",
34
- "svelte-check": "^4.2.1",
35
- "tslib": "^2.8.1",
32
+ "svelte": "5.33.2",
33
+ "svelte-check": "^4.2.2",
36
34
  "typescript": "^5.8.3",
37
35
  "vite": "^6.3.5",
38
- "vitest": "^3.1.4"
36
+ "vitest": "3.2.3"
39
37
  },
40
38
  "svelte": "./dist/index.js",
41
39
  "types": "./dist/index.d.ts",
42
40
  "type": "module",
43
41
  "dependencies": {
44
- "@floating-ui/core": "^1.7.0",
45
- "@floating-ui/dom": "^1.7.0",
42
+ "@floating-ui/core": "^1.7.1",
43
+ "@floating-ui/dom": "^1.7.1",
46
44
  "css.escape": "^1.5.1",
47
45
  "esm-env": "^1.1.2",
48
46
  "runed": "^0.28.0",
@@ -54,7 +52,6 @@
54
52
  "svelte": "^5.33.0"
55
53
  },
56
54
  "engines": {
57
- "pnpm": ">=8.7.0",
58
55
  "node": ">=20"
59
56
  },
60
57
  "sideEffects": false,