bits-ui 1.0.0-next.94 → 1.0.0-next.95

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.
@@ -66,6 +66,8 @@ export type AccordionRootMultiplePropsWithoutHTML = BaseAccordionRootPropsWithou
66
66
  };
67
67
  export type AccordionRootPropsWithoutHTML = WithChild<AccordionRootSinglePropsWithoutHTML> | WithChild<AccordionRootMultiplePropsWithoutHTML>;
68
68
  export type AccordionRootProps = AccordionRootPropsWithoutHTML & Without<BitsPrimitiveDivAttributes, AccordionRootPropsWithoutHTML>;
69
+ export type AccordionRootSingleProps = AccordionRootSinglePropsWithoutHTML & Without<BitsPrimitiveDivAttributes, AccordionRootSinglePropsWithoutHTML>;
70
+ export type AccordionMultipleProps = AccordionRootMultiplePropsWithoutHTML & Without<BitsPrimitiveDivAttributes, AccordionRootMultiplePropsWithoutHTML>;
69
71
  export type AccordionTriggerPropsWithoutHTML = WithChild;
70
72
  export type AccordionTriggerProps = AccordionTriggerPropsWithoutHTML & Without<BitsPrimitiveButtonAttributes, AccordionTriggerPropsWithoutHTML>;
71
73
  export type AccordionContentSnippetProps = {
@@ -1,10 +1,11 @@
1
1
  import type { HTMLButtonAttributes } from "svelte/elements";
2
2
  import type { ReadableBoxedValues, WritableBoxedValues } from "../../internal/box.svelte.js";
3
- import type { BitsKeyboardEvent, BitsMouseEvent, WithRefProps } from "../../internal/types.js";
3
+ import type { BitsKeyboardEvent, BitsMouseEvent, OnChangeFn, WithRefProps } from "../../internal/types.js";
4
4
  type CheckboxGroupStateProps = WithRefProps<ReadableBoxedValues<{
5
5
  name: string | undefined;
6
6
  disabled: boolean;
7
7
  required: boolean;
8
+ onValueChange: OnChangeFn<string[]>;
8
9
  }> & WritableBoxedValues<{
9
10
  value: string[];
10
11
  }>>;
@@ -17,6 +17,7 @@ class CheckboxGroupState {
17
17
  return;
18
18
  if (!this.opts.value.current.includes(checkboxValue)) {
19
19
  this.opts.value.current.push(checkboxValue);
20
+ this.opts.onValueChange.current(this.opts.value.current);
20
21
  }
21
22
  }
22
23
  removeValue(checkboxValue) {
@@ -26,6 +27,7 @@ class CheckboxGroupState {
26
27
  if (index === -1)
27
28
  return;
28
29
  this.opts.value.current.splice(index, 1);
30
+ this.opts.onValueChange.current(this.opts.value.current);
29
31
  }
30
32
  props = $derived.by(() => ({
31
33
  id: this.opts.id.current,
@@ -29,8 +29,12 @@
29
29
  name: box.with(() => name),
30
30
  value: box.with(
31
31
  () => value,
32
- (v) => onValueChange(v)
32
+ (v) => {
33
+ value = v;
34
+ onValueChange(v);
35
+ }
33
36
  ),
37
+ onValueChange: box.with(() => onValueChange),
34
38
  });
35
39
 
36
40
  const mergedProps = $derived(mergeProps(restProps, groupState.props));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bits-ui",
3
- "version": "1.0.0-next.94",
3
+ "version": "1.0.0-next.95",
4
4
  "license": "MIT",
5
5
  "repository": "github:huntabyte/bits-ui",
6
6
  "funding": "https://github.com/sponsors/huntabyte",