@bexis2/bexis2-core-ui 0.3.9 → 0.3.11

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.
package/README.md CHANGED
@@ -1,4 +1,12 @@
1
1
  # bexis-core-ui
2
+ ## 0.3.11
3
+ - add on:change passthrough to TextInput, TextArea, DateInput, NumberInput, CheckBox
4
+
5
+ ## 0.3.10
6
+ - multi select
7
+ - update svelte-select libary
8
+ - refactor filterFn (new order - > exact, start, includes)
9
+ - fix issues with clearable
2
10
 
3
11
  ## 0.3.9
4
12
 
@@ -17,5 +17,6 @@ export let feedback;
17
17
  class:input-error={invalid}
18
18
  bind:checked
19
19
  on:input
20
+ on:change
20
21
  />
21
22
  </InputContainer>
@@ -11,6 +11,7 @@ declare const __propDef: {
11
11
  };
12
12
  events: {
13
13
  input: Event;
14
+ change: Event;
14
15
  } & {
15
16
  [evt: string]: CustomEvent<any>;
16
17
  };
@@ -19,6 +19,7 @@ export let disabled = false;
19
19
  class:input-error={invalid}
20
20
  bind:value
21
21
  on:input
22
+ on:change
22
23
  {disabled}
23
24
  />
24
25
  </InputContainer>
@@ -13,6 +13,7 @@ declare const __propDef: {
13
13
  };
14
14
  events: {
15
15
  input: Event;
16
+ change: Event;
16
17
  } & {
17
18
  [evt: string]: CustomEvent<any>;
18
19
  };
@@ -4,6 +4,8 @@
4
4
  import Select from 'svelte-select';
5
5
  import { onMount } from 'svelte';
6
6
 
7
+
8
+
7
9
  export let source;
8
10
  export let target;
9
11
  export let id;
@@ -33,7 +35,16 @@
33
35
  $: groupBy;
34
36
 
35
37
  function updateTarget(selection) {
36
- //console.log("UPDATE target",selection);
38
+
39
+ console.log("updateTarget", target, selection, isMulti);
40
+ if(selection == undefined)
41
+ {
42
+ console.log("no update");
43
+
44
+ return;
45
+ }
46
+
47
+ console.log("update");
37
48
  //different cases
38
49
  //a) source is complex model is simple return array
39
50
  if (complexSource && !complexTarget && isLoaded && isMulti) {
@@ -64,7 +75,10 @@
64
75
  }
65
76
 
66
77
  if (!complexSource && !complexTarget && isLoaded && !isMulti) {
67
- target = selection.value;
78
+ console.log("🚀 ~ updateTarget ~ selection:", selection)
79
+ if(selection){
80
+ target = selection.value;
81
+ }
68
82
  }
69
83
 
70
84
  if (complexSource && !complexTarget && isLoaded && !isMulti) {
@@ -86,6 +100,7 @@
86
100
 
87
101
  function setValue(t) {
88
102
  //console.log("Set Value",t);
103
+
89
104
  //a) source is complex model is simple
90
105
  if (complexSource && !complexTarget && isMulti) {
91
106
  let items = [];
@@ -151,6 +166,119 @@
151
166
 
152
167
  //console.log(t,value)
153
168
  }
169
+
170
+ function filterItemStartFn(label, filterText, option) {
171
+ // console.log(label, filterText, option);
172
+ let itemFilter = label.toLowerCase().startsWith(filterText.toLowerCase());
173
+
174
+ return itemFilter;
175
+ }
176
+
177
+ function filterItemExactFn(label, filterText, option) {
178
+ // console.log(label, filterText, option);
179
+ let itemFilter = label.toLowerCase() == filterText.toLowerCase();
180
+
181
+ return itemFilter;
182
+ }
183
+
184
+ function filterItemIncludesFn(label, filterText, option) {
185
+ // console.log(label, filterText, option);
186
+ let itemFilter = label.toLowerCase().includes(filterText.toLowerCase());
187
+
188
+ return itemFilter;
189
+ }
190
+
191
+ function filterFn({
192
+ loadOptions,
193
+ filterText,
194
+ items,
195
+ multiple,
196
+ value,
197
+ itemId,
198
+ groupBy,
199
+ filterSelectedItems,
200
+ itemFilter,
201
+ convertStringItemsToObjects,
202
+ filterGroupedItems,
203
+ label,
204
+ }) {
205
+ if (items && loadOptions) return items;
206
+ if (!items) return [];
207
+
208
+ if (items && items.length > 0 && typeof items[0] !== 'object') {
209
+ items = convertStringItemsToObjects(items);
210
+ }
211
+
212
+ let filterResults = filterListFn(items, label, filterText,multiple,value,filterSelectedItems, itemId)
213
+
214
+ if (groupBy) {
215
+ filterResults = filterGroupedItems(filterResults, label, filterText);
216
+ }
217
+
218
+ return filterResults;
219
+ }
220
+
221
+ // filter checks 3 types, exact, starts, includes
222
+ function filterListFn(items ,label , filterText, multiple, value, filterSelectedItems, itemId)
223
+ {
224
+
225
+ if (!items) return [];
226
+
227
+ let exact = items.filter((item) => {
228
+ let matchesFilter = filterItemExactFn(item[label], filterText, item);
229
+ if (matchesFilter && multiple && value?.length) {
230
+ matchesFilter = !value.some((x) => {
231
+ return filterSelectedItems ? x[itemId] === item[itemId] : false;
232
+ });
233
+ }
234
+
235
+ return matchesFilter;
236
+ });
237
+
238
+ let starts = items.filter((item) => {
239
+ let matchesFilter = filterItemStartFn(item[label], filterText, item);
240
+ if (matchesFilter && multiple && value?.length) {
241
+ matchesFilter = !value.some((x) => {
242
+ return filterSelectedItems ? x[itemId] === item[itemId] : false;
243
+ });
244
+ }
245
+
246
+ return matchesFilter;
247
+
248
+ });
249
+
250
+ let includes = items.filter((item) => {
251
+ let matchesFilter = filterItemIncludesFn(item[label], filterText, item);
252
+ if (matchesFilter && multiple && value?.length) {
253
+ matchesFilter = !value.some((x) => {
254
+ return filterSelectedItems ? x[itemId] === item[itemId] : false;
255
+ });
256
+ }
257
+
258
+ return matchesFilter;
259
+ });
260
+
261
+
262
+ let result = [...exact,...starts,...includes];
263
+ return [...new Set(result)];
264
+ }
265
+
266
+ function clearFn(e)
267
+ {
268
+ console.log("clear", target, e);
269
+ if(isMulti)
270
+ {
271
+ target = [];
272
+ }
273
+ else
274
+ {
275
+ target="";
276
+ }
277
+
278
+ console.log("after clear", target);
279
+ }
280
+
281
+
154
282
  </script>
155
283
 
156
284
  <InputContainer {id} label={title} {feedback} {required} {help}>
@@ -167,14 +295,15 @@
167
295
  {loading}
168
296
  {clearable}
169
297
  {disabled}
298
+ filter={filterFn}
170
299
  on:change
171
300
  on:input
172
301
  on:focus
173
302
  on:blur
174
- on:clear
175
303
  on:loaded
176
- on:error
177
304
  on:filter
305
+ on:error
178
306
  on:hoverItem
307
+ on:clear={clearFn}
179
308
  />
180
309
  </InputContainer>
@@ -25,10 +25,9 @@ export default class MultiSelect extends SvelteComponentTyped<{
25
25
  input: CustomEvent<any>;
26
26
  focus: CustomEvent<any>;
27
27
  blur: CustomEvent<any>;
28
- clear: CustomEvent<any>;
29
28
  loaded: CustomEvent<any>;
30
- error: CustomEvent<any>;
31
29
  filter: CustomEvent<any>;
30
+ error: CustomEvent<any>;
32
31
  hoverItem: CustomEvent<any>;
33
32
  } & {
34
33
  [evt: string]: CustomEvent<any>;
@@ -64,10 +63,9 @@ declare const __propDef: {
64
63
  input: CustomEvent<any>;
65
64
  focus: CustomEvent<any>;
66
65
  blur: CustomEvent<any>;
67
- clear: CustomEvent<any>;
68
66
  loaded: CustomEvent<any>;
69
- error: CustomEvent<any>;
70
67
  filter: CustomEvent<any>;
68
+ error: CustomEvent<any>;
71
69
  hoverItem: CustomEvent<any>;
72
70
  } & {
73
71
  [evt: string]: CustomEvent<any>;
@@ -21,6 +21,7 @@ export let disabled = false;
21
21
  class:input-error={invalid}
22
22
  bind:value
23
23
  on:input
24
+ on:change
24
25
  {placeholder}
25
26
  {disabled}
26
27
  />
@@ -14,6 +14,7 @@ declare const __propDef: {
14
14
  };
15
15
  events: {
16
16
  input: Event;
17
+ change: Event;
17
18
  } & {
18
19
  [evt: string]: CustomEvent<any>;
19
20
  };
@@ -19,6 +19,7 @@ export let disabled = false;
19
19
  class:input-error={invalid}
20
20
  bind:value
21
21
  on:input
22
+ on:change
22
23
  {placeholder}
23
24
  {disabled}
24
25
  />
@@ -14,6 +14,7 @@ declare const __propDef: {
14
14
  };
15
15
  events: {
16
16
  input: Event;
17
+ change: Event;
17
18
  } & {
18
19
  [evt: string]: CustomEvent<any>;
19
20
  };
@@ -20,6 +20,7 @@ export let disabled = false;
20
20
  class:input-error={invalid}
21
21
  bind:value
22
22
  on:input
23
+ on:change
23
24
  {placeholder}
24
25
  {disabled}
25
26
  />
@@ -14,6 +14,7 @@ declare const __propDef: {
14
14
  };
15
15
  events: {
16
16
  input: Event;
17
+ change: Event;
17
18
  } & {
18
19
  [evt: string]: CustomEvent<any>;
19
20
  };
@@ -26,7 +26,7 @@ onMount(async () => {
26
26
  <div class="px-5 py-2">
27
27
  <ol class="breadcrumb -p50">
28
28
  <!--default home-->
29
- <li class="crumb"><a class="anchor" href={'/'}>{applicationName} (Home)</a></li>
29
+ <li class="crumb"><a class="anchor" href={'/'}>{applicationName}</a></li>
30
30
  <li class="crumb-separator" aria-hidden>&rsaquo;</li>
31
31
 
32
32
  {#each list as crumb, i}
@@ -0,0 +1,57 @@
1
+ <script>import Fa from "svelte-fa/src/fa.svelte";
2
+ import { faPen } from "@fortawesome/free-solid-svg-icons";
3
+ import { faTrash } from "@fortawesome/free-solid-svg-icons";
4
+ export let title = "Toggle light or dark mode.";
5
+ export let bgLight = "bg-surface-50";
6
+ export let bgDark = "bg-surface-900";
7
+ export let fillLight = "fill-surface-50";
8
+ export let fillDark = "fill-surface-900";
9
+ export let width = "w-12";
10
+ export let height = "h-6";
11
+ export let ring = "ring-[1px] ring-surface-500/30";
12
+ export let rounded = "rounded-token";
13
+ const cTransition = `transition-all duration-[200ms]`;
14
+ const cTrack = "cursor-pointer";
15
+ const cThumb = "aspect-square scale-[0.8] flex justify-center items-center";
16
+ const cIcon = "w-[70%] aspect-square";
17
+ $:
18
+ trackBg = mode === true ? bgLight : bgDark;
19
+ $:
20
+ thumbBg = mode === true ? bgDark : bgLight;
21
+ $:
22
+ thumbPosition = mode === true ? "translate-x-[100%]" : "";
23
+ $:
24
+ iconFill = mode === true ? fillLight : fillDark;
25
+ $:
26
+ classesTrack = `${cTrack} ${cTransition} ${width} ${height} ${ring} ${rounded} ${trackBg} ${$$props.class ?? ""}`;
27
+ $:
28
+ classesThumb = `${cThumb} ${cTransition} ${height} ${rounded} ${thumbBg} ${thumbPosition}`;
29
+ let mode = true;
30
+ $:
31
+ mode;
32
+ </script>
33
+
34
+ <div
35
+ class="lightswitch-track {classesTrack}"
36
+ on:click={()=>mode=!mode}
37
+ on:click
38
+ on:keydown={()=>mode=!mode}
39
+ on:keydown
40
+ on:keyup
41
+ on:keypress
42
+ role="switch"
43
+ aria-label="Light Switch"
44
+ aria-checked={mode}
45
+ title="xyz"
46
+ tabindex="0"
47
+ >
48
+ <!-- Thumb -->
49
+ <div class="lightswitch-thumb {classesThumb}">
50
+ <!-- SVG -->
51
+ {#if mode}
52
+ <Fa icon={faPen} color="white" />
53
+ {:else}
54
+ <Fa icon={faTrash} />
55
+ {/if}
56
+ </div>
57
+ </div>
@@ -0,0 +1,30 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ [x: string]: any;
5
+ title?: string | undefined;
6
+ bgLight?: string | undefined;
7
+ bgDark?: string | undefined;
8
+ fillLight?: string | undefined;
9
+ fillDark?: string | undefined;
10
+ width?: string | undefined;
11
+ height?: string | undefined;
12
+ ring?: string | undefined;
13
+ rounded?: string | undefined;
14
+ };
15
+ events: {
16
+ click: MouseEvent;
17
+ keydown: KeyboardEvent;
18
+ keyup: KeyboardEvent;
19
+ keypress: KeyboardEvent;
20
+ } & {
21
+ [evt: string]: CustomEvent<any>;
22
+ };
23
+ slots: {};
24
+ };
25
+ export type ToggleProps = typeof __propDef.props;
26
+ export type ToggleEvents = typeof __propDef.events;
27
+ export type ToggleSlots = typeof __propDef.slots;
28
+ export default class Toggle extends SvelteComponentTyped<ToggleProps, ToggleEvents, ToggleSlots> {
29
+ }
30
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bexis2/bexis2-core-ui",
3
- "version": "0.3.9",
3
+ "version": "0.3.11",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -81,7 +81,7 @@
81
81
  "svelte-fa": "^3.0.4",
82
82
  "svelte-file-dropzone": "^2.0.1",
83
83
  "svelte-headless-table": "^0.17.3",
84
- "svelte-select": "^5.6.1",
84
+ "svelte-select": "5.8.3",
85
85
  "vest": "^4.6.11"
86
86
  },
87
87
  "author": "David Schöne",
@@ -20,5 +20,6 @@
20
20
  class:input-error={invalid}
21
21
  bind:checked
22
22
  on:input
23
+ on:change
23
24
  />
24
25
  </InputContainer>
@@ -4,7 +4,6 @@
4
4
  export let id: string = '';
5
5
  export let label: string = '';
6
6
  export let value: string = '';
7
-
8
7
  export let valid: boolean = false;
9
8
  export let invalid: boolean = false;
10
9
  export let required: boolean = false;
@@ -22,6 +21,7 @@
22
21
  class:input-error={invalid}
23
22
  bind:value
24
23
  on:input
24
+ on:change
25
25
  {disabled}
26
26
  />
27
27
  </InputContainer>
@@ -4,6 +4,8 @@
4
4
  import Select from 'svelte-select';
5
5
  import { onMount } from 'svelte';
6
6
 
7
+
8
+
7
9
  export let source;
8
10
  export let target;
9
11
  export let id;
@@ -33,7 +35,16 @@
33
35
  $: groupBy;
34
36
 
35
37
  function updateTarget(selection) {
36
- //console.log("UPDATE target",selection);
38
+
39
+ console.log("updateTarget", target, selection, isMulti);
40
+ if(selection == undefined)
41
+ {
42
+ console.log("no update");
43
+
44
+ return;
45
+ }
46
+
47
+ console.log("update");
37
48
  //different cases
38
49
  //a) source is complex model is simple return array
39
50
  if (complexSource && !complexTarget && isLoaded && isMulti) {
@@ -64,7 +75,10 @@
64
75
  }
65
76
 
66
77
  if (!complexSource && !complexTarget && isLoaded && !isMulti) {
67
- target = selection.value;
78
+ console.log("🚀 ~ updateTarget ~ selection:", selection)
79
+ if(selection){
80
+ target = selection.value;
81
+ }
68
82
  }
69
83
 
70
84
  if (complexSource && !complexTarget && isLoaded && !isMulti) {
@@ -86,6 +100,7 @@
86
100
 
87
101
  function setValue(t) {
88
102
  //console.log("Set Value",t);
103
+
89
104
  //a) source is complex model is simple
90
105
  if (complexSource && !complexTarget && isMulti) {
91
106
  let items = [];
@@ -151,6 +166,119 @@
151
166
 
152
167
  //console.log(t,value)
153
168
  }
169
+
170
+ function filterItemStartFn(label, filterText, option) {
171
+ // console.log(label, filterText, option);
172
+ let itemFilter = label.toLowerCase().startsWith(filterText.toLowerCase());
173
+
174
+ return itemFilter;
175
+ }
176
+
177
+ function filterItemExactFn(label, filterText, option) {
178
+ // console.log(label, filterText, option);
179
+ let itemFilter = label.toLowerCase() == filterText.toLowerCase();
180
+
181
+ return itemFilter;
182
+ }
183
+
184
+ function filterItemIncludesFn(label, filterText, option) {
185
+ // console.log(label, filterText, option);
186
+ let itemFilter = label.toLowerCase().includes(filterText.toLowerCase());
187
+
188
+ return itemFilter;
189
+ }
190
+
191
+ function filterFn({
192
+ loadOptions,
193
+ filterText,
194
+ items,
195
+ multiple,
196
+ value,
197
+ itemId,
198
+ groupBy,
199
+ filterSelectedItems,
200
+ itemFilter,
201
+ convertStringItemsToObjects,
202
+ filterGroupedItems,
203
+ label,
204
+ }) {
205
+ if (items && loadOptions) return items;
206
+ if (!items) return [];
207
+
208
+ if (items && items.length > 0 && typeof items[0] !== 'object') {
209
+ items = convertStringItemsToObjects(items);
210
+ }
211
+
212
+ let filterResults = filterListFn(items, label, filterText,multiple,value,filterSelectedItems, itemId)
213
+
214
+ if (groupBy) {
215
+ filterResults = filterGroupedItems(filterResults, label, filterText);
216
+ }
217
+
218
+ return filterResults;
219
+ }
220
+
221
+ // filter checks 3 types, exact, starts, includes
222
+ function filterListFn(items ,label , filterText, multiple, value, filterSelectedItems, itemId)
223
+ {
224
+
225
+ if (!items) return [];
226
+
227
+ let exact = items.filter((item) => {
228
+ let matchesFilter = filterItemExactFn(item[label], filterText, item);
229
+ if (matchesFilter && multiple && value?.length) {
230
+ matchesFilter = !value.some((x) => {
231
+ return filterSelectedItems ? x[itemId] === item[itemId] : false;
232
+ });
233
+ }
234
+
235
+ return matchesFilter;
236
+ });
237
+
238
+ let starts = items.filter((item) => {
239
+ let matchesFilter = filterItemStartFn(item[label], filterText, item);
240
+ if (matchesFilter && multiple && value?.length) {
241
+ matchesFilter = !value.some((x) => {
242
+ return filterSelectedItems ? x[itemId] === item[itemId] : false;
243
+ });
244
+ }
245
+
246
+ return matchesFilter;
247
+
248
+ });
249
+
250
+ let includes = items.filter((item) => {
251
+ let matchesFilter = filterItemIncludesFn(item[label], filterText, item);
252
+ if (matchesFilter && multiple && value?.length) {
253
+ matchesFilter = !value.some((x) => {
254
+ return filterSelectedItems ? x[itemId] === item[itemId] : false;
255
+ });
256
+ }
257
+
258
+ return matchesFilter;
259
+ });
260
+
261
+
262
+ let result = [...exact,...starts,...includes];
263
+ return [...new Set(result)];
264
+ }
265
+
266
+ function clearFn(e)
267
+ {
268
+ console.log("clear", target, e);
269
+ if(isMulti)
270
+ {
271
+ target = [];
272
+ }
273
+ else
274
+ {
275
+ target="";
276
+ }
277
+
278
+ console.log("after clear", target);
279
+ }
280
+
281
+
154
282
  </script>
155
283
 
156
284
  <InputContainer {id} label={title} {feedback} {required} {help}>
@@ -167,14 +295,15 @@
167
295
  {loading}
168
296
  {clearable}
169
297
  {disabled}
298
+ filter={filterFn}
170
299
  on:change
171
300
  on:input
172
301
  on:focus
173
302
  on:blur
174
- on:clear
175
303
  on:loaded
176
- on:error
177
304
  on:filter
305
+ on:error
178
306
  on:hoverItem
307
+ on:clear={clearFn}
179
308
  />
180
309
  </InputContainer>
@@ -24,6 +24,7 @@
24
24
  class:input-error={invalid}
25
25
  bind:value
26
26
  on:input
27
+ on:change
27
28
  {placeholder}
28
29
  {disabled}
29
30
  />
@@ -22,6 +22,7 @@
22
22
  class:input-error={invalid}
23
23
  bind:value
24
24
  on:input
25
+ on:change
25
26
  {placeholder}
26
27
  {disabled}
27
28
  />
@@ -22,6 +22,7 @@
22
22
  class:input-error={invalid}
23
23
  bind:value
24
24
  on:input
25
+ on:change
25
26
  {placeholder}
26
27
  {disabled}
27
28
  />
@@ -33,7 +33,7 @@
33
33
  <div class="px-5 py-2">
34
34
  <ol class="breadcrumb -p50">
35
35
  <!--default home-->
36
- <li class="crumb"><a class="anchor" href={'/'}>{applicationName} (Home)</a></li>
36
+ <li class="crumb"><a class="anchor" href={'/'}>{applicationName}</a></li>
37
37
  <li class="crumb-separator" aria-hidden>&rsaquo;</li>
38
38
 
39
39
  {#each list as crumb, i}
@@ -0,0 +1,73 @@
1
+ <script lang="ts">
2
+ import Fa from 'svelte-fa/src/fa.svelte';
3
+
4
+ import { faPen } from '@fortawesome/free-solid-svg-icons';
5
+ import { faTrash } from '@fortawesome/free-solid-svg-icons';
6
+ import type{ CssClasses } from '@skeletonlabs/skeleton';
7
+
8
+ // Props
9
+ /** Customize the `title` attribute for the component. */
10
+ export let title = 'Toggle light or dark mode.';
11
+ // Props (styles)
12
+ /** Provide classes to set the light background color. */
13
+ export let bgLight: CssClasses = 'bg-surface-50';
14
+ /** Provide classes to set the dark background color. */
15
+ export let bgDark: CssClasses = 'bg-surface-900';
16
+ /** Provide classes to set the light SVG fill color. */
17
+ export let fillLight: CssClasses = 'fill-surface-50';
18
+ /** Provide classes to set the dark SVG fill color. */
19
+ export let fillDark: CssClasses = 'fill-surface-900';
20
+ /** Provide classes to set width styles. */
21
+ export let width: CssClasses = 'w-12';
22
+ /** Provide classes to set height styles. Should be half of width. */
23
+ export let height: CssClasses = 'h-6';
24
+ /** Provide classes to set ring styles. */
25
+ export let ring: CssClasses = 'ring-[1px] ring-surface-500/30';
26
+ /** Provide classes to set border radius styles. */
27
+ export let rounded: CssClasses = 'rounded-token';
28
+
29
+ // Classes
30
+ const cTransition = `transition-all duration-[200ms]`;
31
+ const cTrack = 'cursor-pointer';
32
+ const cThumb = 'aspect-square scale-[0.8] flex justify-center items-center';
33
+ const cIcon = 'w-[70%] aspect-square';
34
+
35
+ // State
36
+ $: trackBg = mode === true ? bgLight : bgDark;
37
+ $: thumbBg = mode === true ? bgDark : bgLight;
38
+ $: thumbPosition = mode === true ? 'translate-x-[100%]' : '';
39
+ $: iconFill = mode === true ? fillLight : fillDark;
40
+
41
+ $: classesTrack = `${cTrack} ${cTransition} ${width} ${height} ${ring} ${rounded} ${trackBg} ${$$props.class ?? ''}`;
42
+ $: classesThumb = `${cThumb} ${cTransition} ${height} ${rounded} ${thumbBg} ${thumbPosition}`;
43
+
44
+
45
+ let mode = true;
46
+ $:mode;
47
+
48
+ </script>
49
+
50
+ <div
51
+ class="lightswitch-track {classesTrack}"
52
+ on:click={()=>mode=!mode}
53
+ on:click
54
+ on:keydown={()=>mode=!mode}
55
+ on:keydown
56
+ on:keyup
57
+ on:keypress
58
+ role="switch"
59
+ aria-label="Light Switch"
60
+ aria-checked={mode}
61
+ title="xyz"
62
+ tabindex="0"
63
+ >
64
+ <!-- Thumb -->
65
+ <div class="lightswitch-thumb {classesThumb}">
66
+ <!-- SVG -->
67
+ {#if mode}
68
+ <Fa icon={faPen} color="white" />
69
+ {:else}
70
+ <Fa icon={faTrash} />
71
+ {/if}
72
+ </div>
73
+ </div>