@sierra-95/svelte-scaffold 1.2.12 → 1.2.14
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/Core/components/Form/Input/TextArea/textarea.svelte +18 -15
- package/dist/Core/components/Form/Input/TextArea/textarea.svelte.d.ts +1 -0
- package/dist/Core/components/Form/Input/input/input.svelte +21 -18
- package/dist/Core/components/Form/Input/input/input.svelte.d.ts +1 -0
- package/dist/Core/components/Form/Input/password/password.svelte +25 -22
- package/dist/Core/components/Form/Input/password/password.svelte.d.ts +1 -0
- package/dist/Core/components/Form/Input/select/select.svelte +26 -23
- package/dist/Core/components/Form/Input/select/select.svelte.d.ts +1 -0
- package/dist/Core/components/others/WhatsappShare/whatsapp.svelte +56 -0
- package/dist/Core/components/others/WhatsappShare/whatsapp.svelte.d.ts +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -12,22 +12,25 @@
|
|
|
12
12
|
width = '100%',
|
|
13
13
|
maxWidth = '',
|
|
14
14
|
textColor = 'inherit',
|
|
15
|
+
showInput = true,
|
|
15
16
|
...rest
|
|
16
17
|
} = $props();
|
|
17
18
|
</script>
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
{#if showInput}
|
|
21
|
+
<label class="sierra-input" style="width: {width}; max-width: {maxWidth}; color: {textColor}" for={id}>{label}
|
|
22
|
+
<textarea
|
|
23
|
+
{...rest}
|
|
24
|
+
id={id}
|
|
25
|
+
name={id}
|
|
26
|
+
rows={rows}
|
|
27
|
+
bind:value={value}
|
|
28
|
+
placeholder={placeholder}
|
|
29
|
+
required={rest.required}
|
|
30
|
+
readonly={rest.readonly}
|
|
31
|
+
style="background-color: {background}; border: {borderSize} solid {borderColor}; border-radius: {borderRadius};"
|
|
32
|
+
onclick={(e: MouseEvent) => {
|
|
33
|
+
rest.onclick?.(e);
|
|
34
|
+
}}></textarea>
|
|
35
|
+
</label>
|
|
36
|
+
{/if}
|
|
@@ -13,26 +13,29 @@
|
|
|
13
13
|
width = '100%',
|
|
14
14
|
maxWidth = '',
|
|
15
15
|
textColor = 'inherit',
|
|
16
|
+
showInput = true,
|
|
16
17
|
autocomplete = undefined as _autocomplete,
|
|
17
18
|
...rest
|
|
18
19
|
} = $props();
|
|
19
20
|
</script>
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
<input
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
22
|
+
{#if showInput}
|
|
23
|
+
<label class="sierra-input" style="width: {width}; max-width: {maxWidth}; color: {textColor}" for={id}>{label}
|
|
24
|
+
<input
|
|
25
|
+
{...rest}
|
|
26
|
+
id={id}
|
|
27
|
+
name={id}
|
|
28
|
+
type={type}
|
|
29
|
+
bind:value={value}
|
|
30
|
+
placeholder={placeholder}
|
|
31
|
+
autocomplete={autocomplete ?? undefined}
|
|
32
|
+
required={rest.required}
|
|
33
|
+
readonly={rest.readonly}
|
|
34
|
+
class="{underline? 'underline-input':''}"
|
|
35
|
+
style="background-color: {background}; border: {borderSize} solid {borderColor};"
|
|
36
|
+
onclick={(e: MouseEvent) => {
|
|
37
|
+
rest.onclick?.(e);
|
|
38
|
+
}}
|
|
39
|
+
/>
|
|
40
|
+
</label>
|
|
41
|
+
{/if}
|
|
@@ -11,6 +11,7 @@ declare const Input: import("svelte").Component<{
|
|
|
11
11
|
width?: string;
|
|
12
12
|
maxWidth?: string;
|
|
13
13
|
textColor?: string;
|
|
14
|
+
showInput?: boolean;
|
|
14
15
|
autocomplete?: AutoFill | null | undefined;
|
|
15
16
|
} & Record<string, any>, {}, "value">;
|
|
16
17
|
type Input = ReturnType<typeof Input>;
|
|
@@ -12,31 +12,34 @@
|
|
|
12
12
|
export let width: string = '100%';
|
|
13
13
|
export let maxWidth: string = '';
|
|
14
14
|
export let textColor: string = 'inherit';
|
|
15
|
+
export let showInput = true;
|
|
15
16
|
export let autocomplete = undefined as _autocomplete;
|
|
16
17
|
export let required = false;
|
|
17
18
|
|
|
18
19
|
let show: boolean = false;
|
|
19
20
|
</script>
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
</
|
|
22
|
+
{#if showInput}
|
|
23
|
+
<label class="sierra-input" style="width: {width}; max-width: {maxWidth}; color: {textColor}" for={id}>{label}
|
|
24
|
+
<div style="position: relative;">
|
|
25
|
+
<input
|
|
26
|
+
type={show ? "text" : "password"}
|
|
27
|
+
id={id}
|
|
28
|
+
name={id}
|
|
29
|
+
bind:value={value}
|
|
30
|
+
placeholder={placeholder}
|
|
31
|
+
autocomplete={autocomplete ?? undefined}
|
|
32
|
+
required={required}
|
|
33
|
+
class="{underline? 'underline-input':''}"
|
|
34
|
+
style="width: 100%; background-color: {background}; border: {borderSize} solid {borderColor}; border-radius: 4px;"
|
|
35
|
+
/>
|
|
36
|
+
<button on:click|preventDefault={() => show = !show}>
|
|
37
|
+
{#if show}
|
|
38
|
+
<i class="fa fa-eye"></i>
|
|
39
|
+
{:else}
|
|
40
|
+
<i class="fa fa-eye-slash"></i>
|
|
41
|
+
{/if}
|
|
42
|
+
</button>
|
|
43
|
+
</div>
|
|
44
|
+
</label>
|
|
45
|
+
{/if}
|
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
export let id: string = '';
|
|
3
|
+
export let label: string = '';
|
|
4
|
+
export let value: string | number = '';
|
|
5
|
+
export let options: { value: string | number; label: string; disabled?: boolean }[] = [];
|
|
6
|
+
export let background: string ='transparent';
|
|
7
|
+
export let width: string = '100%';
|
|
8
|
+
export let maxWidth: string = '';
|
|
9
|
+
export let height: string = '100%';
|
|
10
|
+
export let textColor: string = 'inherit';
|
|
11
|
+
export let optionsColor: string = 'inherit';
|
|
12
|
+
export let optionsBackground: string = 'white';
|
|
13
|
+
export let showInput = true;
|
|
13
14
|
</script>
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</
|
|
16
|
+
{#if showInput}
|
|
17
|
+
<label class="sierra-input" style="width: {width}; max-width: {maxWidth}; color: {textColor}" for={id}>{label}
|
|
18
|
+
<select bind:value={value} id={id} name={id} required style="background-color: {background}; height: {height}">
|
|
19
|
+
{#each options as option}
|
|
20
|
+
<option
|
|
21
|
+
value={option.value}
|
|
22
|
+
disabled={option.disabled}
|
|
23
|
+
style="color: {optionsColor}; background-color: {optionsBackground};"
|
|
24
|
+
>{option.label}
|
|
25
|
+
</option>
|
|
26
|
+
{/each}
|
|
27
|
+
</select>
|
|
28
|
+
</label>
|
|
29
|
+
{/if}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Button, addToast } from "../../../../index.js";
|
|
3
|
+
const {
|
|
4
|
+
shareURL,
|
|
5
|
+
shareTitle = '',
|
|
6
|
+
shareText = '',
|
|
7
|
+
limitShareText = 30,
|
|
8
|
+
label = "Share on WhatsApp",
|
|
9
|
+
} = $props();
|
|
10
|
+
|
|
11
|
+
let copyLink = $state(false);
|
|
12
|
+
|
|
13
|
+
const limitWords = (text:string, maxWords:number) => {
|
|
14
|
+
const words = text.split(/\s+/);
|
|
15
|
+
const trimmed = words.slice(0, maxWords).join(' ');
|
|
16
|
+
return words.length > maxWords ? trimmed + ' ...' : trimmed;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const handleShare = async () => {
|
|
20
|
+
if (navigator.share) {
|
|
21
|
+
try {
|
|
22
|
+
await navigator.share({
|
|
23
|
+
title: shareTitle,
|
|
24
|
+
text: limitWords(shareText, limitShareText),
|
|
25
|
+
url: shareURL,
|
|
26
|
+
});
|
|
27
|
+
} catch (err) {
|
|
28
|
+
console.error('Error sharing:', err);
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
const isMobile = /Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
|
|
32
|
+
const message = `${limitWords(shareText, limitShareText)}\n\n${shareURL}`;
|
|
33
|
+
const encoded = encodeURIComponent(message);
|
|
34
|
+
|
|
35
|
+
const url = isMobile
|
|
36
|
+
? `https://wa.me/?text=${encoded}`
|
|
37
|
+
: `https://web.whatsapp.com/send?text=${encoded}`;
|
|
38
|
+
|
|
39
|
+
window.open(url, "_blank");
|
|
40
|
+
copyLink = true;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const copyToClipboard = () => {
|
|
44
|
+
navigator.clipboard.writeText(shareURL);
|
|
45
|
+
copyLink = false;
|
|
46
|
+
addToast({
|
|
47
|
+
status: 'success',
|
|
48
|
+
message: 'Link copied to clipboard!'
|
|
49
|
+
})
|
|
50
|
+
};
|
|
51
|
+
</script>
|
|
52
|
+
{#if copyLink}
|
|
53
|
+
<Button variant="outlined" startIcon="fa-solid fa-copy" onclick={copyToClipboard}>Copy Link</Button>
|
|
54
|
+
{:else}
|
|
55
|
+
<Button onclick={handleShare} variant="outlined" startIcon="fa-brands fa-whatsapp" iconSize="1.2rem" color="none" style="text-[#25D366]">{label}</Button>
|
|
56
|
+
{/if}
|
package/dist/index.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export { default as Form } from './Core/components/Form/Form/form.svelte';
|
|
|
41
41
|
export { default as Carousel } from './Core/components/others/Carousel/carousel.svelte';
|
|
42
42
|
export { default as Avatar } from './Core/components/others/Avatar/avatar.svelte';
|
|
43
43
|
export { default as ColorPicker } from './Core/components/others/ColorPicker/main.svelte';
|
|
44
|
+
export { default as WhatsappShare } from './Core/components/others/WhatsappShare/whatsapp.svelte';
|
|
44
45
|
export { default as GlobalSearch } from './Core/features/GlobalSearch/main.svelte';
|
|
45
46
|
export { default as ToastManager } from './Core/features/ToastManager/toastManager.svelte';
|
|
46
47
|
export { default as Editor } from './Modules/Editor/main.svelte';
|
package/dist/index.js
CHANGED
|
@@ -48,6 +48,7 @@ export { default as Form } from './Core/components/Form/Form/form.svelte';
|
|
|
48
48
|
export { default as Carousel } from './Core/components/others/Carousel/carousel.svelte';
|
|
49
49
|
export { default as Avatar } from './Core/components/others/Avatar/avatar.svelte';
|
|
50
50
|
export { default as ColorPicker } from './Core/components/others/ColorPicker/main.svelte';
|
|
51
|
+
export { default as WhatsappShare } from './Core/components/others/WhatsappShare/whatsapp.svelte';
|
|
51
52
|
//####################Features##################################
|
|
52
53
|
export { default as GlobalSearch } from './Core/features/GlobalSearch/main.svelte';
|
|
53
54
|
export { default as ToastManager } from './Core/features/ToastManager/toastManager.svelte';
|