@cloudparker/moldex.js 0.0.64 → 0.0.66

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.
Files changed (93) hide show
  1. package/dist/services/dialog/dialog-service.d.ts +11 -11
  2. package/dist/services/dialog/dialog-service.js +0 -1
  3. package/dist/services/navigation/navigation-service.d.ts +17 -0
  4. package/dist/services/navigation/navigation-service.js +38 -0
  5. package/dist/services/utils/melody-service.d.ts +5 -0
  6. package/dist/services/utils/melody-service.js +41 -0
  7. package/dist/tailwind.css +1 -1
  8. package/dist/views/core/button/components/button/button.svelte +84 -133
  9. package/dist/views/core/button/components/button/button.svelte.d.ts +8 -7
  10. package/dist/views/core/button/components/button-back/button-back.svelte +16 -29
  11. package/dist/views/core/button/components/button-close/button-close.svelte +2 -4
  12. package/dist/views/core/button/components/button-close/button-close.svelte.d.ts +2 -2
  13. package/dist/views/core/button/components/button-close-icon/button-close-icon.svelte +16 -30
  14. package/dist/views/core/button/components/button-dropdown/button-dropdown.svelte +80 -0
  15. package/dist/views/core/button/components/button-dropdown/button-dropdown.svelte.d.ts +38 -0
  16. package/dist/views/core/button/components/button-list-item/button-list-item.svelte +65 -132
  17. package/dist/views/core/button/components/button-list-item/button-list-item.svelte.d.ts +22 -31
  18. package/dist/views/core/button/components/button-menu/button-menu.svelte +72 -235
  19. package/dist/views/core/button/components/button-menu/button-menu.svelte.d.ts +23 -43
  20. package/dist/views/core/button/components/button-ok/button-ok.svelte +2 -4
  21. package/dist/views/core/button/components/button-ok/button-ok.svelte.d.ts +2 -2
  22. package/dist/views/core/button/components/button-search/button-search.svelte +39 -0
  23. package/dist/views/core/button/components/button-search/button-search.svelte.d.ts +31 -0
  24. package/dist/views/core/button/index.d.ts +8 -5
  25. package/dist/views/core/button/index.js +4 -2
  26. package/dist/views/core/content-area/components/content-area.svelte +27 -40
  27. package/dist/views/core/dialog/components/cropper-dialog/cropper-dialog.svelte +33 -49
  28. package/dist/views/core/dialog/components/dialog/dialog.svelte +164 -263
  29. package/dist/views/core/dialog/components/dialog/dialog.svelte.d.ts +12 -12
  30. package/dist/views/core/dialog/components/list-dialog/list-picker-dialog.svelte +112 -158
  31. package/dist/views/core/dialog/components/loading-dialog/loading-dialog.svelte +18 -30
  32. package/dist/views/core/dialog/components/msg-dialog/msg-dialog.svelte +13 -22
  33. package/dist/views/core/dialog/components/text-field-dialog/text-field-dialog.svelte +35 -41
  34. package/dist/views/core/dialog/components/text-field-dialog/text-field-dialog.svelte.d.ts +2 -2
  35. package/dist/views/core/dialog/components/textarea-field-dialog/textarea-field-dialog.svelte +25 -40
  36. package/dist/views/core/dialog/components/textarea-field-dialog/textarea-field-dialog.svelte.d.ts +2 -2
  37. package/dist/views/core/dialog/index.d.ts +2 -2
  38. package/dist/views/core/drawer/components/drawer/drawer.svelte +35 -57
  39. package/dist/views/core/icon/components/icon/icon.svelte +14 -26
  40. package/dist/views/core/input/components/checkbox-field/checkbox-field.svelte +25 -44
  41. package/dist/views/core/input/components/color-field/color-field.svelte +69 -81
  42. package/dist/views/core/input/components/color-field/color-field.svelte.d.ts +2 -2
  43. package/dist/views/core/input/components/combobox-field/combobox-field.svelte +256 -331
  44. package/dist/views/core/input/components/combobox-field/combobox-field.svelte.d.ts +18 -17
  45. package/dist/views/core/input/components/date-field/date-field.svelte +30 -39
  46. package/dist/views/core/input/components/date-field/date-field.svelte.d.ts +2 -2
  47. package/dist/views/core/input/components/datetime-field/datetime-field.svelte +12 -18
  48. package/dist/views/core/input/components/datetime-field/datetime-field.svelte.d.ts +2 -2
  49. package/dist/views/core/input/components/email-field/email-field.svelte +12 -17
  50. package/dist/views/core/input/components/email-field/email-field.svelte.d.ts +2 -2
  51. package/dist/views/core/input/components/file-field/file-field.svelte +64 -78
  52. package/dist/views/core/input/components/file-field/file-field.svelte.d.ts +2 -2
  53. package/dist/views/core/input/components/input-field/input-field.svelte +159 -261
  54. package/dist/views/core/input/components/input-field/input-field.svelte.d.ts +8 -8
  55. package/dist/views/core/input/components/label/label.svelte +10 -24
  56. package/dist/views/core/input/components/number-field/number-field.svelte +12 -18
  57. package/dist/views/core/input/components/number-field/number-field.svelte.d.ts +2 -2
  58. package/dist/views/core/input/components/password-field/password-field.svelte +57 -70
  59. package/dist/views/core/input/components/password-field/password-field.svelte.d.ts +2 -2
  60. package/dist/views/core/input/components/phone-field/phone-field.svelte +118 -172
  61. package/dist/views/core/input/components/phone-field/phone-field.svelte.d.ts +2 -2
  62. package/dist/views/core/input/components/radio-field/radio-field.svelte +53 -84
  63. package/dist/views/core/input/components/radio-field/radio-field.svelte.d.ts +7 -7
  64. package/dist/views/core/input/components/range-field/range-field.svelte +42 -66
  65. package/dist/views/core/input/components/range-field/range-field.svelte.d.ts +2 -2
  66. package/dist/views/core/input/components/search-field/search-field.svelte +45 -62
  67. package/dist/views/core/input/components/search-field/search-field.svelte.d.ts +2 -2
  68. package/dist/views/core/input/components/text-field/text-field.svelte +16 -21
  69. package/dist/views/core/input/components/text-field/text-field.svelte.d.ts +2 -2
  70. package/dist/views/core/input/components/textarea-field/textarea-field.svelte +12 -17
  71. package/dist/views/core/input/components/textarea-field/textarea-field.svelte.d.ts +2 -2
  72. package/dist/views/core/input/components/time-field/time-field.svelte +12 -17
  73. package/dist/views/core/input/components/time-field/time-field.svelte.d.ts +2 -2
  74. package/dist/views/core/input/index.d.ts +4 -3
  75. package/dist/views/core/navbar/components/navbar/navbar.svelte +39 -77
  76. package/dist/views/core/no-data/components/no-data/no-data.svelte +20 -37
  77. package/dist/views/core/pagination/components/pagination/pagination.svelte +73 -102
  78. package/dist/views/core/progressbar/components/progressbar/progressbar.svelte +23 -37
  79. package/dist/views/core/ruler/components/vertical-ruler/verticcal-ruler.svelte +2 -6
  80. package/dist/views/core/screen-detector/components/screen-detector.svelte +9 -13
  81. package/dist/views/core/sidebar/components/sidebar.svelte +23 -36
  82. package/dist/views/core/spinner/components/spinner/spinner.svelte +2 -7
  83. package/dist/views/core/text/components/text-await/text-await.svelte +2 -8
  84. package/dist/views/core/text/components/text-copy/text-copy.svelte +17 -28
  85. package/dist/views/core/text/components/text-country/text-country.svelte +29 -41
  86. package/dist/views/core/text/components/text-country-state/text-country-state.svelte +29 -37
  87. package/dist/views/core/text/components/text-currency/text-currency.svelte +10 -21
  88. package/dist/views/core/text/components/text-date/text-date.svelte +21 -33
  89. package/dist/views/core/text/components/text-email/text-email.svelte +4 -13
  90. package/dist/views/core/text/components/text-html/text-html.svelte +2 -3
  91. package/dist/views/core/text/components/text-phone/text-phone.svelte +4 -13
  92. package/dist/views/core/toast/components/toast/toast.svelte +21 -44
  93. package/package.json +1 -1
@@ -1,103 +1,74 @@
1
- <script lang="ts">
2
- import '../../../../../tailwind.css';
3
- import { ripple } from '../../../../../actions';
4
- import ButtonMenu from '../../../button/components/button-menu/button-menu.svelte';
5
- import Button from '../../../button/components/button/button.svelte';
6
- import { BROWSER } from 'esm-env';
7
- import { mdiChevronLeft, mdiChevronRight, mdiPageFirst, mdiPageLast } from '../../../icon';
8
-
9
- type PropsType = {
10
- length?: number;
11
- pageIndex?: number;
12
- pageSize?: number;
13
- pageSizeOptions?: number[];
14
- itemsText?: string;
15
- pageSizeText?: string;
16
- pageText?: string;
17
- onPageSizeChange?: (size: number) => void;
18
- onPageIndexChange?: (index: number) => void;
19
- };
20
-
21
- let {
22
- length = 0,
23
- pageIndex = 0,
24
- pageSize = 10,
25
- pageSizeOptions = [5, 10, 25, 50, 100, 200],
26
- itemsText = 'Items',
27
- pageSizeText = 'Page Size',
28
- pageText = 'Page',
29
- onPageSizeChange,
30
- onPageIndexChange
31
- }: PropsType = $props();
32
-
33
- let pageCount: number = $state(0);
34
-
35
- let hasFirst: boolean = $state(true);
36
- let hasLast: boolean = $state(true);
37
- let hasNext: boolean = $state(true);
38
- let hasPrev: boolean = $state(true);
39
-
40
- const handlePageSize = (size: any) => {
41
- // console.log('handlePageSize', size);
42
- pageSize = size;
43
- };
44
-
45
- const handlePage = (type?: string) => {
46
- // console.log('handlePage');
47
- let index = 0;
48
- switch (type) {
49
- case 'first':
50
- index = 0;
51
- break;
52
- case 'last':
53
- index = pageCount - 1;
54
- break;
55
- case 'next':
56
- index = pageIndex;
57
- index++;
58
- break;
59
- case 'prev':
60
- index = pageIndex;
61
- index--;
62
- break;
63
- }
64
- if (index <= 0) index = 0;
65
- if (index >= pageCount) index = pageCount - 1;
66
-
67
- pageIndex = index;
68
- };
69
-
70
- function preparePage(..._: any) {
71
- // console.log('preparePage');
72
- hasFirst = true;
73
- hasPrev = true;
74
-
75
- hasNext = true;
76
- hasLast = true;
77
-
78
- length = length || 0;
79
- pageSize = pageSize || 10;
80
- pageCount = Math.ceil(length / pageSize);
81
-
82
- if (pageIndex <= 0) {
83
- pageIndex = 0;
84
- hasPrev = false;
85
- hasFirst = false;
86
- }
87
-
88
- if (pageCount && pageIndex >= pageCount - 1) {
89
- pageIndex = pageCount - 1;
90
- hasNext = false;
91
- hasLast = false;
92
- }
93
-
94
- onPageSizeChange && onPageSizeChange(pageSize);
95
- onPageIndexChange && onPageIndexChange(pageIndex);
96
- }
97
-
98
- $effect(() => {
99
- BROWSER && preparePage(length, pageSize, pageIndex, pageCount);
100
- });
1
+ <script lang="ts">import "../../../../../tailwind.css";
2
+ import { ripple } from "../../../../../actions";
3
+ import ButtonDropdown from "../../../button/components/button-dropdown/button-dropdown.svelte";
4
+ import Button from "../../../button/components/button/button.svelte";
5
+ import { BROWSER } from "esm-env";
6
+ import { mdiChevronLeft, mdiChevronRight, mdiPageFirst, mdiPageLast } from "../../../icon";
7
+ let {
8
+ length = 0,
9
+ pageIndex = 0,
10
+ pageSize = 10,
11
+ pageSizeOptions = [5, 10, 25, 50, 100, 200],
12
+ itemsText = "Items",
13
+ pageSizeText = "Page Size",
14
+ pageText = "Page",
15
+ onPageSizeChange,
16
+ onPageIndexChange
17
+ } = $props();
18
+ let pageCount = $state(0);
19
+ let hasFirst = $state(true);
20
+ let hasLast = $state(true);
21
+ let hasNext = $state(true);
22
+ let hasPrev = $state(true);
23
+ const handlePageSize = (size) => {
24
+ pageSize = size;
25
+ };
26
+ const handlePage = (type) => {
27
+ let index = 0;
28
+ switch (type) {
29
+ case "first":
30
+ index = 0;
31
+ break;
32
+ case "last":
33
+ index = pageCount - 1;
34
+ break;
35
+ case "next":
36
+ index = pageIndex;
37
+ index++;
38
+ break;
39
+ case "prev":
40
+ index = pageIndex;
41
+ index--;
42
+ break;
43
+ }
44
+ if (index <= 0) index = 0;
45
+ if (index >= pageCount) index = pageCount - 1;
46
+ pageIndex = index;
47
+ };
48
+ function preparePage(..._) {
49
+ hasFirst = true;
50
+ hasPrev = true;
51
+ hasNext = true;
52
+ hasLast = true;
53
+ length = length || 0;
54
+ pageSize = pageSize || 10;
55
+ pageCount = Math.ceil(length / pageSize);
56
+ if (pageIndex <= 0) {
57
+ pageIndex = 0;
58
+ hasPrev = false;
59
+ hasFirst = false;
60
+ }
61
+ if (pageCount && pageIndex >= pageCount - 1) {
62
+ pageIndex = pageCount - 1;
63
+ hasNext = false;
64
+ hasLast = false;
65
+ }
66
+ onPageSizeChange && onPageSizeChange(pageSize);
67
+ onPageIndexChange && onPageIndexChange(pageIndex);
68
+ }
69
+ $effect(() => {
70
+ BROWSER && preparePage(length, pageSize, pageIndex, pageCount);
71
+ });
101
72
  </script>
102
73
 
103
74
  {#snippet pageButton({ onClick, disabled, icon }: any)}
@@ -114,7 +85,7 @@
114
85
  <div class="flex items-center flex-nowrap gap-2">
115
86
  <div>{pageSizeText}</div>
116
87
  <div class="">
117
- <ButtonMenu
88
+ <ButtonDropdown
118
89
  className="px-3 py-2 rounded hover:bg-gray-100 outline-none focus:bg-gray-200"
119
90
  title={pageSize}
120
91
  dropdownClassName="w-20"
@@ -130,7 +101,7 @@
130
101
  </button>
131
102
  </div>
132
103
  {/each}
133
- </ButtonMenu>
104
+ </ButtonDropdown>
134
105
  </div>
135
106
  <div class="text-gray-500">
136
107
  <span>
@@ -1,40 +1,26 @@
1
- <script lang="ts">
2
- import '../../../../../tailwind.css';
3
- import type { Snippet } from 'svelte';
4
-
5
- type PropsType = {
6
- className?: string;
7
- backgroundClassName?: string;
8
- value?: number;
9
- showValue?: boolean;
10
- children?: Snippet;
11
- };
12
-
13
- let {
14
- backgroundClassName = '',
15
- className = 'h-4',
16
- value = 0,
17
- showValue = false,
18
- children
19
- }: PropsType = $props();
20
-
21
- let progressValue: number = $state(0);
22
-
23
- $effect(() => {
24
- if (!className) {
25
- className = 'h-4';
26
- }
27
- });
28
-
29
- $effect(() => {
30
- if (value < 0) {
31
- progressValue = 0;
32
- } else if (value >= 100) {
33
- progressValue = 100;
34
- } else {
35
- progressValue = value;
36
- }
37
- });
1
+ <script lang="ts">import "../../../../../tailwind.css";
2
+ let {
3
+ backgroundClassName = "",
4
+ className = "h-4",
5
+ value = 0,
6
+ showValue = false,
7
+ children
8
+ } = $props();
9
+ let progressValue = $state(0);
10
+ $effect(() => {
11
+ if (!className) {
12
+ className = "h-4";
13
+ }
14
+ });
15
+ $effect(() => {
16
+ if (value < 0) {
17
+ progressValue = 0;
18
+ } else if (value >= 100) {
19
+ progressValue = 100;
20
+ } else {
21
+ progressValue = value;
22
+ }
23
+ });
38
24
  </script>
39
25
 
40
26
  <div class="w-full bg-gray-200 rounded-full progressbar-container {backgroundClassName}" style="">
@@ -1,9 +1,5 @@
1
- <script lang="ts">
2
- import '../../../../../tailwind.css';
3
- type PropsType = {
4
- className?: string;
5
- };
6
- let { className = '' }: PropsType = $props();
1
+ <script lang="ts">import "../../../../../tailwind.css";
2
+ let { className = "" } = $props();
7
3
  </script>
8
4
 
9
5
  <div class="h-6 lg:w-px lg:bg-gray-200 {className}" aria-hidden="true"></div>
@@ -1,16 +1,12 @@
1
- <script lang="ts">
2
- import { handleScreenSizeUpdate } from '../../../../services';
3
- import { BROWSER } from 'esm-env';
4
-
5
- let innerWidth: number = $state(0);
6
-
7
- function screenSizeChanged(size: number) {
8
- handleScreenSizeUpdate(size);
9
- }
10
-
11
- $effect(() => {
12
- BROWSER && screenSizeChanged(innerWidth);
13
- });
1
+ <script lang="ts">import { handleScreenSizeUpdate } from "../../../../services";
2
+ import { BROWSER } from "esm-env";
3
+ let innerWidth = $state(0);
4
+ function screenSizeChanged(size) {
5
+ handleScreenSizeUpdate(size);
6
+ }
7
+ $effect(() => {
8
+ BROWSER && screenSizeChanged(innerWidth);
9
+ });
14
10
  </script>
15
11
 
16
12
  <svelte:window bind:innerWidth />
@@ -1,39 +1,26 @@
1
- <script lang="ts">
2
- import type { Snippet } from 'svelte';
3
-
4
- type BreakpointType = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
5
-
6
- type PropsType = {
7
- children?: Snippet;
8
- className?: string;
9
- id?: string;
10
- responsiveBreakpoint?: BreakpointType;
11
- position?: 'left' | 'right';
12
- };
13
- let {
14
- children,
15
- className,
16
- id,
17
- responsiveBreakpoint = 'md',
18
- position = 'left'
19
- }: PropsType = $props();
20
-
21
- let responsiveClassName = $derived.by(() => {
22
- switch (responsiveBreakpoint) {
23
- case 'xs':
24
- return 'xs:fixed xs:inset-y-0 xs:flex xs:w-72 xs:flex-col';
25
- case 'sm':
26
- return 'sm:fixed sm:inset-y-0 sm:flex sm:w-72 sm:flex-col';
27
- case 'md':
28
- return 'md:fixed md:inset-y-0 md:flex md:w-72 md:flex-col';
29
- case 'lg':
30
- return 'lg:fixed lg:inset-y-0 lg:flex lg:w-72 lg:flex-col';
31
- case 'xl':
32
- return 'xl:fixed xl:inset-y-0 xl:flex xl:w-72 xl:flex-col';
33
- case '2xl':
34
- return '2xl:fixed 2xl:inset-y-0 2xl:flex 2xl:w-72 2xl:flex-col';
35
- }
36
- });
1
+ <script lang="ts">let {
2
+ children,
3
+ className,
4
+ id,
5
+ responsiveBreakpoint = "md",
6
+ position = "left"
7
+ } = $props();
8
+ let responsiveClassName = $derived.by(() => {
9
+ switch (responsiveBreakpoint) {
10
+ case "xs":
11
+ return "xs:fixed xs:inset-y-0 xs:flex xs:w-72 xs:flex-col";
12
+ case "sm":
13
+ return "sm:fixed sm:inset-y-0 sm:flex sm:w-72 sm:flex-col";
14
+ case "md":
15
+ return "md:fixed md:inset-y-0 md:flex md:w-72 md:flex-col";
16
+ case "lg":
17
+ return "lg:fixed lg:inset-y-0 lg:flex lg:w-72 lg:flex-col";
18
+ case "xl":
19
+ return "xl:fixed xl:inset-y-0 xl:flex xl:w-72 xl:flex-col";
20
+ case "2xl":
21
+ return "2xl:fixed 2xl:inset-y-0 2xl:flex 2xl:w-72 2xl:flex-col";
22
+ }
23
+ });
37
24
  </script>
38
25
 
39
26
  <div
@@ -1,10 +1,5 @@
1
- <script lang="ts">
2
- import '../../../../../tailwind.css';
3
- type PropsType = {
4
- className?: string;
5
- };
6
-
7
- let { className = '' }: PropsType = $props();
1
+ <script lang="ts">import "../../../../../tailwind.css";
2
+ let { className = "" } = $props();
8
3
  </script>
9
4
 
10
5
  <svg
@@ -1,11 +1,5 @@
1
- <script lang="ts">
2
- import '../../../../../tailwind.css';
3
- type PropsType = {
4
- input?: Promise<any | null> | undefined;
5
- key?: string;
6
- hasTitle?: string;
7
- };
8
- let { input, key, hasTitle }: PropsType = $props();
1
+ <script lang="ts">import "../../../../../tailwind.css";
2
+ let { input, key, hasTitle } = $props();
9
3
  </script>
10
4
 
11
5
  {#if input}
@@ -1,31 +1,20 @@
1
- <script lang="ts">
2
- import '../../../../../tailwind.css';
3
- import Button from '../../../button/components/button/button.svelte';
4
- import { copyToClipboard, showToast } from '../../../../../services/index.js';
5
- import { mdiContentCopy } from '../../../icon';
6
-
7
- type PropsType = {
8
- input: string;
9
- containerClassName?: string;
10
- buttonClassName?: string;
11
- iconClassName?: string;
12
- iconPath?: string;
13
- };
14
-
15
- let {
16
- input,
17
- containerClassName = '',
18
- buttonClassName = '',
19
- iconClassName = '',
20
- iconPath = mdiContentCopy
21
- }: PropsType = $props();
22
-
23
- function handleCopy() {
24
- if (input) {
25
- copyToClipboard(input);
26
- showToast('Copied!');
27
- }
28
- }
1
+ <script lang="ts">import "../../../../../tailwind.css";
2
+ import Button from "../../../button/components/button/button.svelte";
3
+ import { copyToClipboard, showToast } from "../../../../../services/index.js";
4
+ import { mdiContentCopy } from "../../../icon";
5
+ let {
6
+ input,
7
+ containerClassName = "",
8
+ buttonClassName = "",
9
+ iconClassName = "",
10
+ iconPath = mdiContentCopy
11
+ } = $props();
12
+ function handleCopy() {
13
+ if (input) {
14
+ copyToClipboard(input);
15
+ showToast("Copied!");
16
+ }
17
+ }
29
18
  </script>
30
19
 
31
20
  <span class="flex items-center {containerClassName}">
@@ -1,44 +1,32 @@
1
- <script lang="ts">
2
- import '../../../../../tailwind.css';
3
- import EasyScriptLoader from '@cloudparker/easy-script-loader-svelte';
4
- import { BROWSER } from 'esm-env';
5
-
6
- type PropsType = {
7
- input?: string;
8
- };
9
-
10
- let { input }: PropsType = $props();
11
-
12
- let countries: any[] = $state([]);
13
- let country: any | null = $state(null);
14
-
15
- let EasyCountryData: any;
16
-
17
- async function init() {
18
- if (EasyCountryData) {
19
- countries = EasyCountryData.getCountries();
20
- }
21
- }
22
-
23
- function handleScriptLoad(lib: CustomEvent) {
24
- EasyCountryData = lib;
25
- console.log('EasyCountryData', EasyCountryData);
26
- init();
27
- }
28
-
29
- async function prepare(..._: any) {
30
- if (input) {
31
- if (countries?.length) {
32
- country = countries.find((o) => o.isoCode == input);
33
- }
34
- } else {
35
- country = null;
36
- }
37
- }
38
-
39
- $effect(() => {
40
- BROWSER && prepare(input, countries);
41
- });
1
+ <script lang="ts">import "../../../../../tailwind.css";
2
+ import EasyScriptLoader from "@cloudparker/easy-script-loader-svelte";
3
+ import { BROWSER } from "esm-env";
4
+ let { input } = $props();
5
+ let countries = $state([]);
6
+ let country = $state(null);
7
+ let EasyCountryData;
8
+ async function init() {
9
+ if (EasyCountryData) {
10
+ countries = EasyCountryData.getCountries();
11
+ }
12
+ }
13
+ function handleScriptLoad(lib) {
14
+ EasyCountryData = lib;
15
+ console.log("EasyCountryData", EasyCountryData);
16
+ init();
17
+ }
18
+ async function prepare(..._) {
19
+ if (input) {
20
+ if (countries?.length) {
21
+ country = countries.find((o) => o.isoCode == input);
22
+ }
23
+ } else {
24
+ country = null;
25
+ }
26
+ }
27
+ $effect(() => {
28
+ BROWSER && prepare(input, countries);
29
+ });
42
30
  </script>
43
31
 
44
32
  <EasyScriptLoader
@@ -1,40 +1,32 @@
1
- <script lang="ts">
2
- import '../../../../../tailwind.css';
3
- import EasyScriptLoader from '@cloudparker/easy-script-loader-svelte';
4
- import { BROWSER } from 'esm-env';
5
-
6
- let { input }: { input: string } = $props();
7
-
8
- let states: any[] = $state([]);
9
- let state: any | null = $state(null);
10
-
11
- let EasyCountryStateData: any;
12
-
13
- async function init() {
14
- if (EasyCountryStateData) {
15
- states = EasyCountryStateData.getStates() || [];
16
- }
17
- }
18
-
19
- async function prepare(..._: any) {
20
- if (input) {
21
- await init();
22
- if (states?.length) {
23
- state = states.find((o) => o._id == input);
24
- }
25
- } else {
26
- state = null;
27
- }
28
- }
29
-
30
- function handleScriptLoad(ev: CustomEvent) {
31
- EasyCountryStateData = ev.detail;
32
- init();
33
- }
34
-
35
- $effect(() => {
36
- BROWSER && prepare(input, states);
37
- });
1
+ <script lang="ts">import "../../../../../tailwind.css";
2
+ import EasyScriptLoader from "@cloudparker/easy-script-loader-svelte";
3
+ import { BROWSER } from "esm-env";
4
+ let { input } = $props();
5
+ let states = $state([]);
6
+ let state = $state(null);
7
+ let EasyCountryStateData;
8
+ async function init() {
9
+ if (EasyCountryStateData) {
10
+ states = EasyCountryStateData.getStates() || [];
11
+ }
12
+ }
13
+ async function prepare(..._) {
14
+ if (input) {
15
+ await init();
16
+ if (states?.length) {
17
+ state = states.find((o) => o._id == input);
18
+ }
19
+ } else {
20
+ state = null;
21
+ }
22
+ }
23
+ function handleScriptLoad(ev) {
24
+ EasyCountryStateData = ev.detail;
25
+ init();
26
+ }
27
+ $effect(() => {
28
+ BROWSER && prepare(input, states);
29
+ });
38
30
  </script>
39
31
 
40
32
  <EasyScriptLoader
@@ -1,24 +1,13 @@
1
- <script lang="ts">
2
- import '../../../../../tailwind.css';
3
- import { BROWSER } from 'esm-env';
4
-
5
- type PropsType = {
6
- input: number;
7
- symbol: string;
8
- hasSymbol: boolean;
9
- };
10
-
11
- let { input, symbol = '$', hasSymbol = true }: PropsType = $props();
12
-
13
- let value: string = $state('');
14
-
15
- function prepare(..._: any) {
16
- value = Math.abs(input || 0).toFixed(2);
17
- }
18
-
19
- $effect(() => {
20
- BROWSER && prepare(input);
21
- });
1
+ <script lang="ts">import "../../../../../tailwind.css";
2
+ import { BROWSER } from "esm-env";
3
+ let { input, symbol = "$", hasSymbol = true } = $props();
4
+ let value = $state("");
5
+ function prepare(..._) {
6
+ value = Math.abs(input || 0).toFixed(2);
7
+ }
8
+ $effect(() => {
9
+ BROWSER && prepare(input);
10
+ });
22
11
  </script>
23
12
 
24
13
  <span>