@juspay/svelte-ui-components 1.19.0 → 1.20.0

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.
@@ -1,11 +1,19 @@
1
- <script>export let value = false;
1
+ <script>import { createEventDispatcher } from "svelte";
2
+ export let checked = false;
2
3
  export let text = "";
4
+ const dispatch = createEventDispatcher();
5
+ function handleCheckboxClick(e) {
6
+ if (e.target instanceof HTMLInputElement && typeof e.target.checked === "boolean") {
7
+ checked = e.target.checked;
8
+ }
9
+ dispatch("click", checked);
10
+ }
3
11
  </script>
4
12
 
5
13
  <div class="container">
6
14
  <div class="text" hidden={text.length === 0}>{text}</div>
7
15
  <label class="switch">
8
- <input class="input-checkbox" type="checkbox" bind:checked={value} />
16
+ <input class="input-checkbox" type="checkbox" bind:checked={checked} on:click={handleCheckboxClick} />
9
17
  <span class="slider round" />
10
18
  </label>
11
19
  </div>
@@ -1,10 +1,12 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
- value?: boolean | undefined;
4
+ checked?: boolean | undefined;
5
5
  text?: string | undefined;
6
6
  };
7
7
  events: {
8
+ click: CustomEvent<any>;
9
+ } & {
8
10
  [evt: string]: CustomEvent<any>;
9
11
  };
10
12
  slots: {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "1.19.0",
3
+ "version": "1.20.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev --host",
6
6
  "build": "vite build && npm run package",