y200subcontrols 0.0.334 → 0.0.3331

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,20 +1,15 @@
1
- <script>import { onMount } from "svelte";
2
- import Button from "./Button.svelte";
1
+ <script>import Button from "./Button.svelte";
3
2
  import ModalDialog from "./ModalDialog.svelte";
4
3
  export let message = "Message goes here";
5
4
  export let style = "warning";
6
5
  export let okButtonContent = "<span>Ok</span>";
7
- export let cancelButtonContent = "<span>Cancel</span>";
6
+ export let cancelButtonContent = "<span>Ok</span>";
8
7
  let dialog;
9
- let dialogId = "";
10
- let buttonsContainer;
11
8
  export async function showDialog() {
12
- const okButton = document.getElementById(`okButtonDialog-${dialogId}`);
13
- const cancelButton = document.getElementById(`cancelButtonDialog-${dialogId}`);
9
+ const okButton = document.getElementById("okButtonDialog");
10
+ const cancelButton = document.getElementById("cancelButtonDialog");
14
11
  const p = new Promise((resolve) => {
15
12
  function closeDialog(result) {
16
- console.log(okButton);
17
- console.log(cancelButton);
18
13
  okButton?.removeEventListener("click", acceptDialog);
19
14
  cancelButton?.removeEventListener("click", cancelDialog);
20
15
  dialog.dismissDialog();
@@ -32,14 +27,10 @@ export async function showDialog() {
32
27
  });
33
28
  return p;
34
29
  }
35
- onMount(() => {
36
- let r = (Math.random() + 1).toString(36).substring(2);
37
- dialogId = `dialog-${r}`;
38
- });
39
30
  </script>
40
31
 
41
32
  <ModalDialog bind:this={dialog} showCloseButton={false} allowSubmit={false}>
42
- <slot slot="title" name="title">Title goes here</slot>
33
+ <slot slot="title" >Title goes here</slot>
43
34
  <div
44
35
  class="flex
45
36
  {style === 'warning' ? 'text-amber-500' : ''}
@@ -107,11 +98,11 @@ onMount(() => {
107
98
  {@html message}
108
99
  </div>
109
100
  </slot>
110
- <div class="grid grid-cols-2 gap-2" slot="buttons" bind:this={buttonsContainer}>
111
- <Button type="button" id="okButtonDialog-{dialogId}">
101
+ <div class="grid grid-cols-2 gap-2" slot="buttons">
102
+ <Button type="button" id="okButtonDialog">
112
103
  {@html okButtonContent}
113
104
  </Button>
114
- <Button type="button" buttonStyle="dark" id="cancelButtonDialog-{dialogId}">
105
+ <Button type="button" buttonStyle="dark" id="cancelButtonDialog">
115
106
  {@html cancelButtonContent}
116
107
  </Button>
117
108
  </div>
@@ -11,9 +11,6 @@ declare const __propDef: {
11
11
  [evt: string]: CustomEvent<any>;
12
12
  };
13
13
  slots: {
14
- title: {
15
- slot: string;
16
- };
17
14
  default: {};
18
15
  };
19
16
  exports?: {} | undefined;
@@ -45,22 +45,7 @@ onMount(() => {
45
45
  class="px-3 py-1 rounded bg-emerald-500 text-emerald-50"
46
46
  on:click={openMenu}
47
47
  >
48
- <svg
49
- class="w-6 h-6 text-white"
50
- aria-hidden="true"
51
- xmlns="http://www.w3.org/2000/svg"
52
- width="24"
53
- height="24"
54
- fill="none"
55
- viewBox="0 0 24 24"
56
- >
57
- <path
58
- stroke="currentColor"
59
- stroke-linecap="round"
60
- stroke-width="3"
61
- d="M12 6h.01M12 12h.01M12 18h.01"
62
- />
63
- </svg>
48
+ <i class="bi bi-three-dots-vertical"></i>
64
49
  </button>
65
50
  {#if true}
66
51
  <!-- svelte-ignore a11y-click-events-have-key-events -->
@@ -121,11 +106,7 @@ onMount(() => {
121
106
  <ConfirmModalDialog
122
107
  bind:this={deleteDialog}
123
108
  style="danger"
124
- okButtonContent="Yes, delete"
125
- cancelButtonContent="Cancel"
109
+ message="Are you sure you want to delete this record"
126
110
  >
127
- <span slot="title"> Confirm Delete </span>
128
- <div class="text-center my-2">
129
- <span class="text-lg"> Are you sure you want to delete this record ?</span>
130
- </div>
111
+ <span> Confirm Delete </span>
131
112
  </ConfirmModalDialog>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "y200subcontrols",
3
- "version": "0.0.334",
3
+ "version": "0.0.3331",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",