@cloudparker/moldex.js 0.0.79 → 0.0.80
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/dist/views/core/text/index.d.ts +1 -3
- package/dist/views/core/text/index.js +1 -3
- package/dist/views/extra/fields/country-combobox-field.svelte +34 -0
- package/dist/views/extra/fields/country-combobox-field.svelte.d.ts +21 -0
- package/dist/views/extra/index.d.ts +6 -0
- package/dist/views/extra/index.js +5 -0
- package/dist/views/extra/loaders/country-loader.svelte +26 -0
- package/dist/views/extra/loaders/country-loader.svelte.d.ts +30 -0
- package/dist/views/{core/text/components/text-country-state → extra/texts}/text-country-state.svelte +1 -2
- package/dist/views/{core/text/components/text-country-state → extra/texts}/text-country-state.svelte.d.ts +0 -1
- package/dist/views/extra/texts/text-country.svelte +13 -0
- package/dist/views/{core/text/components/text-country → extra/texts}/text-country.svelte.d.ts +0 -1
- package/dist/views/index.d.ts +1 -0
- package/dist/views/index.js +1 -0
- package/package.json +1 -1
- package/dist/views/core/text/components/text-country/text-country.svelte +0 -39
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import TextAwait from "./components/text-await/text-await.svelte";
|
|
2
2
|
import TextCopy from "./components/text-copy/text-copy.svelte";
|
|
3
|
-
import TextCountry from "./components/text-country/text-country.svelte";
|
|
4
|
-
import TextCountryState from "./components/text-country-state/text-country-state.svelte";
|
|
5
3
|
import TextCurrency from "./components/text-currency/text-currency.svelte";
|
|
6
4
|
import TextDate from "./components/text-date/text-date.svelte";
|
|
7
5
|
import TextEmail from "./components/text-email/text-email.svelte";
|
|
8
6
|
import TextHtml from "./components/text-html/text-html.svelte";
|
|
9
7
|
import TextPhone from "./components/text-phone/text-phone.svelte";
|
|
10
|
-
export { TextAwait, TextCopy,
|
|
8
|
+
export { TextAwait, TextCopy, TextCurrency, TextDate, TextEmail, TextHtml, TextPhone, };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import TextAwait from "./components/text-await/text-await.svelte";
|
|
2
2
|
import TextCopy from "./components/text-copy/text-copy.svelte";
|
|
3
|
-
import TextCountry from "./components/text-country/text-country.svelte";
|
|
4
|
-
import TextCountryState from "./components/text-country-state/text-country-state.svelte";
|
|
5
3
|
import TextCurrency from "./components/text-currency/text-currency.svelte";
|
|
6
4
|
import TextDate from "./components/text-date/text-date.svelte";
|
|
7
5
|
import TextEmail from "./components/text-email/text-email.svelte";
|
|
8
6
|
import TextHtml from "./components/text-html/text-html.svelte";
|
|
9
7
|
import TextPhone from "./components/text-phone/text-phone.svelte";
|
|
10
|
-
export { TextAwait, TextCopy,
|
|
8
|
+
export { TextAwait, TextCopy, TextCurrency, TextDate, TextEmail, TextHtml, TextPhone, };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts">import ComboboxField from "../../core/input/components/combobox-field/combobox-field.svelte";
|
|
2
|
+
import CountryLoader from "../loaders/country-loader.svelte";
|
|
3
|
+
let {
|
|
4
|
+
value = $bindable(null),
|
|
5
|
+
titleFieldName = "name",
|
|
6
|
+
displayFieldName = "name",
|
|
7
|
+
searchFieldName = "name",
|
|
8
|
+
identityFieldName = "isoCode",
|
|
9
|
+
hasDropdownHeader = true,
|
|
10
|
+
hasDropdownHeaderSearch = true,
|
|
11
|
+
hasDropdownFooter = true,
|
|
12
|
+
hasDropdownFooterCreateButton = true,
|
|
13
|
+
...props
|
|
14
|
+
} = $props();
|
|
15
|
+
let countries = $state([]);
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<CountryLoader bind:countries>
|
|
19
|
+
<ComboboxField
|
|
20
|
+
bind:value
|
|
21
|
+
items={countries}
|
|
22
|
+
{titleFieldName}
|
|
23
|
+
{displayFieldName}
|
|
24
|
+
{searchFieldName}
|
|
25
|
+
{identityFieldName}
|
|
26
|
+
{hasDropdownHeader}
|
|
27
|
+
{hasDropdownHeaderSearch}
|
|
28
|
+
{hasDropdownFooter}
|
|
29
|
+
{hasDropdownFooterCreateButton}
|
|
30
|
+
dropdownFooterClassName="border-t"
|
|
31
|
+
createButtonClassName="border-primary text-primary hover:text-primary"
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
</CountryLoader>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ComboboxFieldProps, InputFieldProps } from '../../core';
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const CountryComboboxField: $$__sveltets_2_IsomorphicComponent<ComboboxFieldProps & InputFieldProps & {
|
|
16
|
+
value?: any;
|
|
17
|
+
}, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, "value">;
|
|
20
|
+
type CountryComboboxField = InstanceType<typeof CountryComboboxField>;
|
|
21
|
+
export default CountryComboboxField;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import CountryComboboxField from "./fields/country-combobox-field.svelte";
|
|
2
|
+
import TextCountry from "./texts/text-country.svelte";
|
|
3
|
+
import TextCountryState from "./texts/text-country-state.svelte";
|
|
4
|
+
import CountryLoader, { type Country } from "./loaders/country-loader.svelte";
|
|
5
|
+
export type { Country };
|
|
6
|
+
export { CountryComboboxField, TextCountry, CountryLoader, TextCountryState };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import CountryComboboxField from "./fields/country-combobox-field.svelte";
|
|
2
|
+
import TextCountry from "./texts/text-country.svelte";
|
|
3
|
+
import TextCountryState from "./texts/text-country-state.svelte";
|
|
4
|
+
import CountryLoader, {} from "./loaders/country-loader.svelte";
|
|
5
|
+
export { CountryComboboxField, TextCountry, CountryLoader, TextCountryState };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script lang="ts" module></script>
|
|
2
|
+
|
|
3
|
+
<script lang="ts">import EasyScriptLoader from "@cloudparker/easy-script-loader-svelte";
|
|
4
|
+
let { countries = $bindable([]), onLoad, children } = $props();
|
|
5
|
+
let EasyCountryData;
|
|
6
|
+
export async function loadCountries() {
|
|
7
|
+
if (EasyCountryData) {
|
|
8
|
+
countries = EasyCountryData.getCountries();
|
|
9
|
+
onLoad && onLoad(countries);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function handleCountriesLoaded(lib) {
|
|
13
|
+
EasyCountryData = lib;
|
|
14
|
+
loadCountries();
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<EasyScriptLoader
|
|
19
|
+
scriptUrl="https://cdn.jsdelivr.net/gh/paramanandapradhan/easy-countrydata@main/dist/index.js"
|
|
20
|
+
scriptName="EasyCountryData"
|
|
21
|
+
onLoad={handleCountriesLoaded}
|
|
22
|
+
/>
|
|
23
|
+
|
|
24
|
+
{#if children}
|
|
25
|
+
{@render children()}
|
|
26
|
+
{/if}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type Country = {
|
|
2
|
+
isoCode: string;
|
|
3
|
+
dialCode: string;
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
6
|
+
import type { Snippet } from 'svelte';
|
|
7
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
8
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
9
|
+
$$bindings?: Bindings;
|
|
10
|
+
} & Exports;
|
|
11
|
+
(internal: unknown, props: Props & {
|
|
12
|
+
$$events?: Events;
|
|
13
|
+
$$slots?: Slots;
|
|
14
|
+
}): Exports & {
|
|
15
|
+
$set?: any;
|
|
16
|
+
$on?: any;
|
|
17
|
+
};
|
|
18
|
+
z_$$bindings?: Bindings;
|
|
19
|
+
}
|
|
20
|
+
declare const CountryLoader: $$__sveltets_2_IsomorphicComponent<{
|
|
21
|
+
countries?: Country[];
|
|
22
|
+
onLoad?: (countries?: Country[]) => void;
|
|
23
|
+
children?: Snippet;
|
|
24
|
+
}, {
|
|
25
|
+
[evt: string]: CustomEvent<any>;
|
|
26
|
+
}, {}, {
|
|
27
|
+
loadCountries: () => Promise<void>;
|
|
28
|
+
}, "countries">;
|
|
29
|
+
type CountryLoader = InstanceType<typeof CountryLoader>;
|
|
30
|
+
export default CountryLoader;
|
package/dist/views/{core/text/components/text-country-state → extra/texts}/text-country-state.svelte
RENAMED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
<script lang="ts">import "
|
|
2
|
-
import EasyScriptLoader from "@cloudparker/easy-script-loader-svelte";
|
|
1
|
+
<script lang="ts">import EasyScriptLoader from "@cloudparker/easy-script-loader-svelte";
|
|
3
2
|
import { BROWSER } from "esm-env";
|
|
4
3
|
let { input } = $props();
|
|
5
4
|
let states = $state([]);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '../../../../../tailwind.css';
|
|
2
1
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
2
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
3
|
$$bindings?: Bindings;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts">import CountryLoader, {} from "../loaders/country-loader.svelte";
|
|
2
|
+
let { input } = $props();
|
|
3
|
+
let countries = $state([]);
|
|
4
|
+
let country = $derived.by(() => {
|
|
5
|
+
if (input && countries?.length) {
|
|
6
|
+
return countries.find((c) => c.isoCode == input);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<CountryLoader bind:countries>
|
|
12
|
+
{country?.name || ''}
|
|
13
|
+
</CountryLoader>
|
package/dist/views/{core/text/components/text-country → extra/texts}/text-country.svelte.d.ts
RENAMED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '../../../../../tailwind.css';
|
|
2
1
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
2
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
3
|
$$bindings?: Bindings;
|
package/dist/views/index.d.ts
CHANGED
package/dist/views/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,39 +0,0 @@
|
|
|
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
|
-
});
|
|
30
|
-
</script>
|
|
31
|
-
|
|
32
|
-
<EasyScriptLoader
|
|
33
|
-
scriptName="EasyCountryData"
|
|
34
|
-
scriptUrl="https://cdn.jsdelivr.net/gh/paramanandapradhan/easy-countrydata@main/dist/index.js"
|
|
35
|
-
onLoad={handleScriptLoad}
|
|
36
|
-
/>
|
|
37
|
-
{#if country}
|
|
38
|
-
<span> {country?.name || ''} </span>
|
|
39
|
-
{/if}
|