lithesome 0.13.3 → 0.13.4

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.
@@ -3,7 +3,7 @@ import { ModalContext } from "./context.svelte.js";
3
3
  export const { context, contextName } = setupContext();
4
4
  </script>
5
5
 
6
- <script lang="ts">import { createUID, useActions, KEYS, classProp } from "../../internal/index.js";
6
+ <script lang="ts">import { useActions, KEYS, classProp } from "../../internal/index.js";
7
7
  import { usePortal } from "../../index.js";
8
8
  import { setContext } from "svelte";
9
9
  let {
@@ -15,7 +15,6 @@ let {
15
15
  portalTarget = "body",
16
16
  ...props
17
17
  } = $props();
18
- const { uid } = createUID("modal");
19
18
  const ctx = new ModalContext({ visible });
20
19
  setContext(contextName, ctx);
21
20
  const handleKeys = (e) => {
@@ -38,7 +37,7 @@ $effect(() => {
38
37
  bind:this={self}
39
38
  use:usePortal={portalTarget}
40
39
  use:useActions={use}
41
- id={uid()}
40
+ id={ctx.uid()}
42
41
  class={classProp(klass)}
43
42
  data-modal=""
44
43
  {...props}
@@ -2,7 +2,7 @@ import { disableScroll, Context, effects } from '../../internal/index.js';
2
2
  export class ModalContext extends Context {
3
3
  visible = $state(false);
4
4
  constructor(init) {
5
- super('menu');
5
+ super('modal');
6
6
  this.visible = init.visible;
7
7
  }
8
8
  #effects = effects(() => {
@@ -11,7 +11,8 @@ let {
11
11
  class: klass,
12
12
  self = $bindable(),
13
13
  value = $bindable(),
14
- required,
14
+ required = $bindable(false),
15
+ onChange,
15
16
  ...props
16
17
  } = $props();
17
18
  const ctx = new RadiogroupContext(
@@ -19,6 +20,7 @@ const ctx = new RadiogroupContext(
19
20
  {
20
21
  onChange(val) {
21
22
  value = val;
23
+ onChange?.(val);
22
24
  }
23
25
  }
24
26
  );
@@ -4,6 +4,7 @@ export interface RadioGroupProps extends Props<HTMLDivElement> {
4
4
  value: JsonValue;
5
5
  /** Set aria attributes. */
6
6
  required?: boolean;
7
+ onChange?: (value: JsonValue) => void;
7
8
  }
8
9
  interface RadioGroupItemState {
9
10
  /** True if the item is selected. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lithesome",
3
- "version": "0.13.3",
3
+ "version": "0.13.4",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",