@cloudparker/moldex.js 0.0.28 → 0.0.29
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/services/dialog/dialog-service.d.ts +16 -0
- package/dist/services/dialog/dialog-service.js +23 -1
- package/dist/services/utils/utils-service.d.ts +3 -0
- package/dist/services/utils/utils-service.js +26 -0
- package/dist/tailwind.css +1 -1
- package/dist/views/core/button/components/button/button.svelte +5 -3
- package/dist/views/core/button/components/button/button.svelte.d.ts +19 -18
- package/dist/views/core/button/components/button-back/button-back.svelte +32 -0
- package/dist/views/core/button/components/button-back/button-back.svelte.d.ts +24 -0
- package/dist/views/core/button/components/button-close/button-close.svelte +5 -0
- package/dist/views/core/button/components/button-close/button-close.svelte.d.ts +19 -0
- package/dist/views/core/button/components/button-close-icon/button-close-icon.svelte +33 -0
- package/dist/views/core/button/components/button-close-icon/button-close-icon.svelte.d.ts +25 -0
- package/dist/views/core/button/components/button-list-item/button-list-item.svelte +28 -24
- package/dist/views/core/button/components/button-list-item/button-list-item.svelte.d.ts +11 -11
- package/dist/views/core/button/components/button-menu/button-menu.svelte +19 -20
- package/dist/views/core/button/components/button-menu/button-menu.svelte.d.ts +7 -7
- package/dist/views/core/button/components/button-ok/button-ok.svelte +5 -0
- package/dist/views/core/button/components/button-ok/button-ok.svelte.d.ts +19 -0
- package/dist/views/core/button/index.d.ts +5 -1
- package/dist/views/core/button/index.js +10 -1
- package/dist/views/core/dialog/components/dialog/dialog.svelte +94 -84
- package/dist/views/core/dialog/components/dialog/dialog.svelte.d.ts +4 -3
- package/dist/views/core/dialog/components/list-dialog/list-picker-dialog.svelte +145 -0
- package/dist/views/core/dialog/components/list-dialog/list-picker-dialog.svelte.d.ts +41 -0
- package/dist/views/core/icon/components/icon/icon.svelte +5 -3
- package/dist/views/core/icon/components/icon/icon.svelte.d.ts +1 -0
- package/dist/views/core/icon/services/icon-path-service.d.ts +6 -0
- package/dist/views/core/icon/services/icon-path-service.js +6 -0
- package/dist/views/core/index.d.ts +2 -0
- package/dist/views/core/index.js +2 -0
- package/dist/views/core/input/components/color-field/color-field.svelte +104 -0
- package/dist/views/core/input/components/color-field/color-field.svelte.d.ts +23 -0
- package/dist/views/core/input/components/combobox-field/combobox-field.svelte +385 -0
- package/dist/views/core/input/components/combobox-field/combobox-field.svelte.d.ts +63 -0
- package/dist/views/core/input/components/date-field/date-field.svelte +9 -0
- package/dist/views/core/input/components/date-field/date-field.svelte.d.ts +21 -0
- package/dist/views/core/input/components/datetime-field/datetime-field.svelte +9 -0
- package/dist/views/core/input/components/datetime-field/datetime-field.svelte.d.ts +21 -0
- package/dist/views/core/input/components/email-field/email-field.svelte +9 -0
- package/dist/views/core/input/components/email-field/email-field.svelte.d.ts +21 -0
- package/dist/views/core/input/components/file-field/file-field.svelte +80 -0
- package/dist/views/core/input/components/file-field/file-field.svelte.d.ts +25 -0
- package/dist/views/core/{form → input}/components/input-field/input-field.svelte +162 -113
- package/dist/views/core/{form → input}/components/input-field/input-field.svelte.d.ts +51 -35
- package/dist/views/core/input/components/number-field/number-field.svelte +9 -0
- package/dist/views/core/input/components/number-field/number-field.svelte.d.ts +21 -0
- package/dist/views/core/input/components/password-field/password-field.svelte +72 -0
- package/dist/views/core/input/components/password-field/password-field.svelte.d.ts +24 -0
- package/dist/views/core/input/components/phone-field/phone-field.svelte +76 -0
- package/dist/views/core/input/components/phone-field/phone-field.svelte.d.ts +24 -0
- package/dist/views/core/input/components/range-field/range-field.svelte +53 -0
- package/dist/views/core/input/components/range-field/range-field.svelte.d.ts +31 -0
- package/dist/views/core/input/components/search-field/search-field.svelte +53 -0
- package/dist/views/core/input/components/search-field/search-field.svelte.d.ts +24 -0
- package/dist/views/core/input/components/text-field/text-field.svelte +9 -0
- package/dist/views/core/input/components/text-field/text-field.svelte.d.ts +21 -0
- package/dist/views/core/input/components/textarea-field/textarea-field.svelte +9 -0
- package/dist/views/core/input/components/textarea-field/textarea-field.svelte.d.ts +21 -0
- package/dist/views/core/input/components/time-field/time-field.svelte +9 -0
- package/dist/views/core/input/components/time-field/time-field.svelte.d.ts +21 -0
- package/dist/views/core/input/index.d.ts +19 -0
- package/dist/views/core/input/index.js +19 -0
- package/dist/views/core/navbar/components/navbar/navbar.svelte +11 -11
- package/dist/views/core/navbar/components/navbar/navbar.svelte.d.ts +3 -3
- package/dist/views/core/no-data/components/no-data/no-data.svelte +34 -0
- package/dist/views/core/no-data/components/no-data/no-data.svelte.d.ts +27 -0
- package/dist/views/core/no-data/index.d.ts +2 -0
- package/dist/views/core/no-data/index.js +2 -0
- package/dist/views/core/text/components/text-country/text-country.svelte +2 -1
- package/dist/views/core/text/components/text-country-state/text-country-state.svelte +1 -1
- package/dist/views/core/toast/components/toast/toast.svelte +1 -1
- package/package.json +2 -2
- package/dist/views/core/form/index.d.ts +0 -3
- package/dist/views/core/form/index.js +0 -3
- /package/dist/views/core/{form → input}/components/label/label.svelte +0 -0
- /package/dist/views/core/{form → input}/components/label/label.svelte.d.ts +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type InputFieldPropsType } from '../input-field/input-field.svelte';
|
|
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 EmailField: $$__sveltets_2_IsomorphicComponent<InputFieldPropsType, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {
|
|
18
|
+
focus: () => void;
|
|
19
|
+
}, "">;
|
|
20
|
+
type EmailField = InstanceType<typeof EmailField>;
|
|
21
|
+
export default EmailField;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<script lang="ts">import { ripple } from "../../../../../actions";
|
|
2
|
+
import { openFilePicker } from "../../../../../services";
|
|
3
|
+
import { mdiAttachment } from "../../../icon";
|
|
4
|
+
import Icon from "../../../icon/components/icon/icon.svelte";
|
|
5
|
+
import InputField, {} from "../input-field/input-field.svelte";
|
|
6
|
+
let {
|
|
7
|
+
appearance,
|
|
8
|
+
size,
|
|
9
|
+
className,
|
|
10
|
+
accept = "",
|
|
11
|
+
multiple = false,
|
|
12
|
+
value,
|
|
13
|
+
...props
|
|
14
|
+
} = $props();
|
|
15
|
+
let btnRoundedClassName = $state("");
|
|
16
|
+
let btnIconSizeClassName = $state("");
|
|
17
|
+
let fileNameDisplay = $state("");
|
|
18
|
+
let inputFieldRef = $state(null);
|
|
19
|
+
export function focus() {
|
|
20
|
+
inputFieldRef?.focus();
|
|
21
|
+
}
|
|
22
|
+
async function handleFileAttachment() {
|
|
23
|
+
let res = await openFilePicker({ accept, multiple });
|
|
24
|
+
if (res) {
|
|
25
|
+
value = res;
|
|
26
|
+
if (multiple) {
|
|
27
|
+
let files = value;
|
|
28
|
+
fileNameDisplay = files.map((file) => file.name).join(", ");
|
|
29
|
+
} else {
|
|
30
|
+
let file = value;
|
|
31
|
+
fileNameDisplay = file.name;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
$effect(() => {
|
|
36
|
+
if (size) {
|
|
37
|
+
switch (size) {
|
|
38
|
+
case "lg":
|
|
39
|
+
btnIconSizeClassName = "!h-7 !w-7";
|
|
40
|
+
break;
|
|
41
|
+
case "md":
|
|
42
|
+
btnIconSizeClassName = "!h-6 !w-6";
|
|
43
|
+
break;
|
|
44
|
+
case "sm":
|
|
45
|
+
btnIconSizeClassName = "!h-5 !w-5";
|
|
46
|
+
break;
|
|
47
|
+
case "xs":
|
|
48
|
+
btnIconSizeClassName = "!h-4 !w-4";
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
$effect(() => {
|
|
54
|
+
if (!appearance || appearance == "normal") {
|
|
55
|
+
btnRoundedClassName = "rounded-tr-lg rounded-br-lg";
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
{#snippet fileButton()}
|
|
61
|
+
<button
|
|
62
|
+
class="px-3 h-full hover:bg-gray-100 {btnRoundedClassName} "
|
|
63
|
+
use:ripple
|
|
64
|
+
onclick={handleFileAttachment}
|
|
65
|
+
>
|
|
66
|
+
<Icon path={mdiAttachment} className=" {btnIconSizeClassName}"></Icon>
|
|
67
|
+
</button>
|
|
68
|
+
{/snippet}
|
|
69
|
+
|
|
70
|
+
<InputField
|
|
71
|
+
bind:this={inputFieldRef}
|
|
72
|
+
{...props}
|
|
73
|
+
{appearance}
|
|
74
|
+
{size}
|
|
75
|
+
value={fileNameDisplay}
|
|
76
|
+
className="pr-14 {className}"
|
|
77
|
+
type="text"
|
|
78
|
+
readonly
|
|
79
|
+
rightSnippet={fileButton}
|
|
80
|
+
/>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type InputFieldPropsType } from '../input-field/input-field.svelte';
|
|
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 FileField: $$__sveltets_2_IsomorphicComponent<InputFieldPropsType & {
|
|
16
|
+
accept?: string;
|
|
17
|
+
multiple?: boolean;
|
|
18
|
+
value?: File | File[];
|
|
19
|
+
}, {
|
|
20
|
+
[evt: string]: CustomEvent<any>;
|
|
21
|
+
}, {}, {
|
|
22
|
+
focus: () => void;
|
|
23
|
+
}, "">;
|
|
24
|
+
type FileField = InstanceType<typeof FileField>;
|
|
25
|
+
export default FileField;
|
|
@@ -1,50 +1,59 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script module lang="ts"></script>
|
|
2
2
|
|
|
3
|
-
<script lang="ts">import
|
|
4
|
-
import Label from "../label/label.svelte";
|
|
3
|
+
<script lang="ts">import Label from "../label/label.svelte";
|
|
5
4
|
let {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
appearance = "normal",
|
|
6
|
+
ariaControls,
|
|
7
|
+
ariaExpanded,
|
|
8
|
+
autofocus = false,
|
|
9
9
|
className = "",
|
|
10
|
-
|
|
11
|
-
type = "text",
|
|
12
|
-
labelClassName = "",
|
|
10
|
+
cols,
|
|
13
11
|
containerClassName = "",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
requiredSymbolColor = "red",
|
|
17
|
-
requiredSymbol = "*",
|
|
18
|
-
hasRequiredSymbol = true,
|
|
12
|
+
contentSnippet,
|
|
13
|
+
contentSnippetClassName,
|
|
19
14
|
disabled = false,
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
floatingLabel = false,
|
|
16
|
+
hasRequiredSymbol = true,
|
|
17
|
+
id = "",
|
|
18
|
+
label = "",
|
|
19
|
+
labelClassName = "",
|
|
20
|
+
leftSnippet,
|
|
21
|
+
leftSnippetContainerClassName = "",
|
|
22
|
+
max,
|
|
22
23
|
maxlength,
|
|
23
|
-
minlength,
|
|
24
24
|
min,
|
|
25
|
-
|
|
26
|
-
step,
|
|
27
|
-
size = "md",
|
|
28
|
-
appearance = "normal",
|
|
29
|
-
floatingLabel = false,
|
|
30
|
-
pattern = "",
|
|
25
|
+
minlength,
|
|
31
26
|
multiple = false,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
onchange,
|
|
35
|
-
oninput,
|
|
36
|
-
onfocus,
|
|
27
|
+
name = "",
|
|
28
|
+
title,
|
|
37
29
|
onblur,
|
|
38
|
-
|
|
30
|
+
onchange,
|
|
39
31
|
onclick,
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
ondblclick,
|
|
33
|
+
ondrag,
|
|
34
|
+
ondragover,
|
|
35
|
+
ondrop,
|
|
36
|
+
onfocus,
|
|
37
|
+
oninput,
|
|
42
38
|
onkeydown,
|
|
43
|
-
onkeyup,
|
|
44
39
|
onkeypress,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
onkeyup,
|
|
41
|
+
onmousedown,
|
|
42
|
+
onmouseup,
|
|
43
|
+
pattern = "",
|
|
44
|
+
placeholder = "",
|
|
45
|
+
readonly = false,
|
|
46
|
+
required = false,
|
|
47
|
+
requiredSymbol = "*",
|
|
48
|
+
requiredSymbolColor = "red",
|
|
49
|
+
rightSnippet,
|
|
50
|
+
rightSnippetContainerClassName = "",
|
|
51
|
+
role,
|
|
52
|
+
rows = 5,
|
|
53
|
+
size = "md",
|
|
54
|
+
step,
|
|
55
|
+
type = "text",
|
|
56
|
+
value = $bindable("")
|
|
48
57
|
} = $props();
|
|
49
58
|
let inputRef = $state(null);
|
|
50
59
|
let sizeClassName = $state("");
|
|
@@ -52,42 +61,14 @@ let appearanceClassName = $state("");
|
|
|
52
61
|
let floatingLabelClassName = $state("");
|
|
53
62
|
let floatingLabelPaddingClassName = $state("");
|
|
54
63
|
let floatingLabelTextClassName = $state("");
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
export function focus() {
|
|
65
|
+
inputRef && inputRef.focus();
|
|
66
|
+
}
|
|
58
67
|
$effect(() => {
|
|
59
|
-
if (
|
|
68
|
+
if (floatingLabel || leftSnippet != null || rightSnippet != null) {
|
|
60
69
|
containerClassName = (containerClassName || "") + " relative";
|
|
61
70
|
}
|
|
62
71
|
});
|
|
63
|
-
$effect(() => {
|
|
64
|
-
if (iconPath) {
|
|
65
|
-
let flpcn;
|
|
66
|
-
switch (size) {
|
|
67
|
-
case "lg":
|
|
68
|
-
iconPaddingClassName = "ps-12";
|
|
69
|
-
flpcn = ` peer-placeholder-shown:ps-12 `;
|
|
70
|
-
iconSizeClassName = "!w-8 !h-8";
|
|
71
|
-
break;
|
|
72
|
-
case "md":
|
|
73
|
-
iconPaddingClassName = "ps-10";
|
|
74
|
-
flpcn = ` peer-placeholder-shown:ps-10 `;
|
|
75
|
-
iconSizeClassName = "!w-6 !h-6";
|
|
76
|
-
break;
|
|
77
|
-
case "sm":
|
|
78
|
-
iconPaddingClassName = "ps-9";
|
|
79
|
-
flpcn = ` peer-placeholder-shown:ps-9 `;
|
|
80
|
-
iconSizeClassName = "!w-5 !h-5";
|
|
81
|
-
break;
|
|
82
|
-
case "xs":
|
|
83
|
-
iconPaddingClassName = "ps-7";
|
|
84
|
-
flpcn = ` peer-placeholder-shown:ps-7 `;
|
|
85
|
-
iconSizeClassName = "!w-3 !h-3";
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
floatingLabelIconTextPaddingClassName = flpcn;
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
72
|
$effect(() => {
|
|
92
73
|
if (floatingLabel) {
|
|
93
74
|
if (size) {
|
|
@@ -110,9 +91,9 @@ $effect(() => {
|
|
|
110
91
|
floatingLabelTextClassName = "text-xs";
|
|
111
92
|
break;
|
|
112
93
|
}
|
|
113
|
-
floatingLabelPaddingClassName =
|
|
94
|
+
floatingLabelPaddingClassName = flpcn;
|
|
114
95
|
}
|
|
115
|
-
|
|
96
|
+
floatingLabelClassName = `absolute duration-300 transform top-0 rounded -translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-0 peer-placeholder-shown:start-0 peer-focus:start-1 bg-white peer-placeholder-shown:bg-transparent peer-focus:bg-white start-1 ${floatingLabelPaddingClassName} ${floatingLabelTextClassName}`;
|
|
116
97
|
}
|
|
117
98
|
});
|
|
118
99
|
$effect(() => {
|
|
@@ -133,6 +114,9 @@ $effect(() => {
|
|
|
133
114
|
case "fill-underline":
|
|
134
115
|
appearanceClassName = "bg-gray-100 border-0 border-b-2 border-gray-300 appearance-none focus:outline-none focus:ring-0 focus:border-blue-600";
|
|
135
116
|
break;
|
|
117
|
+
case "none":
|
|
118
|
+
appearanceClassName = "hover:bg-gray-100 focus:bg-gray-100 border-0 focus:outline-none focus:ring-0 appearance-none";
|
|
119
|
+
break;
|
|
136
120
|
}
|
|
137
121
|
}
|
|
138
122
|
});
|
|
@@ -157,6 +141,8 @@ $effect(() => {
|
|
|
157
141
|
$effect(() => {
|
|
158
142
|
if (name && !id) {
|
|
159
143
|
id = name;
|
|
144
|
+
} else if (id && !name) {
|
|
145
|
+
name = id;
|
|
160
146
|
}
|
|
161
147
|
});
|
|
162
148
|
$effect(() => {
|
|
@@ -170,59 +156,111 @@ $effect(() => {
|
|
|
170
156
|
<Label
|
|
171
157
|
forName={id}
|
|
172
158
|
{label}
|
|
173
|
-
className={labelClassName}
|
|
159
|
+
className="{floatingLabelClassName} {labelClassName}"
|
|
174
160
|
{required}
|
|
175
161
|
{requiredSymbolColor}
|
|
176
162
|
{requiredSymbol}
|
|
177
163
|
{hasRequiredSymbol}
|
|
178
|
-
|
|
179
|
-
{/snippet}
|
|
180
|
-
|
|
181
|
-
{#snippet createIcon()}
|
|
182
|
-
<div class="absolute inset-y-0 start-0 flex items-center ps-2.5 pointer-events-none {className}">
|
|
183
|
-
<Icon path={iconPath!} className="text-gray-500 {iconSizeClassName} {iconClassName}" />
|
|
184
|
-
</div>
|
|
164
|
+
/>
|
|
185
165
|
{/snippet}
|
|
186
166
|
|
|
187
|
-
{#if !floatingLabel &&
|
|
167
|
+
{#if !floatingLabel && label}
|
|
188
168
|
{@render labelSnippet()}
|
|
189
169
|
{/if}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
170
|
+
|
|
171
|
+
<div class="w-full {containerClassName}">
|
|
172
|
+
{#if leftSnippet}
|
|
173
|
+
<div
|
|
174
|
+
class="absolute flex items-center justify-center left-children {leftSnippetContainerClassName}"
|
|
175
|
+
>
|
|
176
|
+
{@render leftSnippet()}
|
|
177
|
+
</div>
|
|
178
|
+
{/if}
|
|
179
|
+
|
|
180
|
+
{#if type == 'textarea'}
|
|
181
|
+
<textarea
|
|
182
|
+
bind:this={inputRef}
|
|
183
|
+
bind:value
|
|
184
|
+
class="block w-full peer {appearanceClassName} {sizeClassName} {className}"
|
|
185
|
+
{title}
|
|
186
|
+
{id}
|
|
187
|
+
{name}
|
|
188
|
+
{placeholder}
|
|
189
|
+
{required}
|
|
190
|
+
{disabled}
|
|
191
|
+
{readonly}
|
|
192
|
+
{maxlength}
|
|
193
|
+
{minlength}
|
|
194
|
+
{rows}
|
|
195
|
+
{cols}
|
|
196
|
+
{onchange}
|
|
197
|
+
{oninput}
|
|
198
|
+
{onfocus}
|
|
199
|
+
{onblur}
|
|
200
|
+
{ondblclick}
|
|
201
|
+
{onclick}
|
|
202
|
+
{onmousedown}
|
|
203
|
+
{onmouseup}
|
|
204
|
+
{onkeydown}
|
|
205
|
+
{onkeyup}
|
|
206
|
+
{onkeypress}
|
|
207
|
+
{ondrop}
|
|
208
|
+
{ondrag}
|
|
209
|
+
{ondragover}
|
|
210
|
+
></textarea>
|
|
211
|
+
{:else}
|
|
212
|
+
<input
|
|
213
|
+
bind:this={inputRef}
|
|
214
|
+
bind:value
|
|
215
|
+
class="block w-full peer {appearanceClassName} {sizeClassName} {className}"
|
|
216
|
+
{title}
|
|
217
|
+
{type}
|
|
218
|
+
{id}
|
|
219
|
+
{name}
|
|
220
|
+
{placeholder}
|
|
221
|
+
{required}
|
|
222
|
+
{disabled}
|
|
223
|
+
{readonly}
|
|
224
|
+
{maxlength}
|
|
225
|
+
{minlength}
|
|
226
|
+
{min}
|
|
227
|
+
{max}
|
|
228
|
+
{step}
|
|
229
|
+
{pattern}
|
|
230
|
+
{multiple}
|
|
231
|
+
{role}
|
|
232
|
+
{onchange}
|
|
233
|
+
{oninput}
|
|
234
|
+
{onfocus}
|
|
235
|
+
{onblur}
|
|
236
|
+
{ondblclick}
|
|
237
|
+
{onclick}
|
|
238
|
+
{onmousedown}
|
|
239
|
+
{onmouseup}
|
|
240
|
+
{onkeydown}
|
|
241
|
+
{onkeyup}
|
|
242
|
+
{onkeypress}
|
|
243
|
+
{ondrop}
|
|
244
|
+
{ondrag}
|
|
245
|
+
{ondragover}
|
|
246
|
+
aria-controls={ariaControls}
|
|
247
|
+
aria-expanded={ariaExpanded}
|
|
248
|
+
/>
|
|
249
|
+
{/if}
|
|
250
|
+
{#if contentSnippet}
|
|
251
|
+
<div
|
|
252
|
+
class="absolute inset-0 pointer-events-none block w-full overflow-hidden {appearanceClassName} {sizeClassName} {contentSnippetClassName}"
|
|
253
|
+
>
|
|
254
|
+
{@render contentSnippet()}
|
|
255
|
+
</div>
|
|
256
|
+
{/if}
|
|
257
|
+
{#if rightSnippet}
|
|
258
|
+
<div
|
|
259
|
+
class="absolute flex items-center justify-center right-children {rightSnippetContainerClassName}"
|
|
260
|
+
>
|
|
261
|
+
{@render rightSnippet()}
|
|
262
|
+
</div>
|
|
193
263
|
{/if}
|
|
194
|
-
<input
|
|
195
|
-
bind:this={inputRef}
|
|
196
|
-
bind:value
|
|
197
|
-
{type}
|
|
198
|
-
{id}
|
|
199
|
-
{name}
|
|
200
|
-
class="block w-full peer ps- {iconPaddingClassName} {appearanceClassName} {floatingLabelClassName} {sizeClassName} {className}"
|
|
201
|
-
{placeholder}
|
|
202
|
-
{required}
|
|
203
|
-
{disabled}
|
|
204
|
-
{readonly}
|
|
205
|
-
{maxlength}
|
|
206
|
-
{minlength}
|
|
207
|
-
{min}
|
|
208
|
-
{max}
|
|
209
|
-
{step}
|
|
210
|
-
{pattern}
|
|
211
|
-
{onchange}
|
|
212
|
-
{oninput}
|
|
213
|
-
{onfocus}
|
|
214
|
-
{onblur}
|
|
215
|
-
{ondblclick}
|
|
216
|
-
{onclick}
|
|
217
|
-
{onmousedown}
|
|
218
|
-
{onmouseup}
|
|
219
|
-
{onkeydown}
|
|
220
|
-
{onkeyup}
|
|
221
|
-
{onkeypress}
|
|
222
|
-
{ondrop}
|
|
223
|
-
{ondrag}
|
|
224
|
-
{ondragover}
|
|
225
|
-
/>
|
|
226
264
|
|
|
227
265
|
{#if label && floatingLabel}
|
|
228
266
|
{@render labelSnippet()}
|
|
@@ -230,4 +268,15 @@ $effect(() => {
|
|
|
230
268
|
</div>
|
|
231
269
|
|
|
232
270
|
<style>
|
|
271
|
+
.left-children {
|
|
272
|
+
left: 2px;
|
|
273
|
+
top: 2px;
|
|
274
|
+
bottom: 2px;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.right-children {
|
|
278
|
+
right: 2px;
|
|
279
|
+
top: 2px;
|
|
280
|
+
bottom: 2px;
|
|
281
|
+
}
|
|
233
282
|
</style>
|
|
@@ -1,50 +1,64 @@
|
|
|
1
|
-
export type InputFieldTypesType = 'text' | 'number' | 'date';
|
|
2
1
|
export type InputFieldSizeType = 'lg' | 'md' | 'sm' | 'xs';
|
|
3
|
-
export type InputFieldAppearanceType = 'normal' | 'box' | 'fill' | 'underline' | 'fill-underline';
|
|
2
|
+
export type InputFieldAppearanceType = 'normal' | 'box' | 'fill' | 'underline' | 'fill-underline' | 'none';
|
|
3
|
+
export type InputValueType = string | string[] | number | number[] | Date | Date[] | File | File[] | null | undefined;
|
|
4
4
|
export type InputFieldPropsType = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
appearance?: InputFieldAppearanceType;
|
|
6
|
+
ariaControls?: string;
|
|
7
|
+
ariaExpanded?: boolean;
|
|
8
|
+
autofocus?: boolean;
|
|
8
9
|
className?: string;
|
|
9
|
-
|
|
10
|
-
type?: InputFieldTypesType;
|
|
11
|
-
labelClassName?: string;
|
|
10
|
+
cols?: number;
|
|
12
11
|
containerClassName?: string;
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
contentSnippet?: Snippet;
|
|
13
|
+
contentSnippetClassName?: string;
|
|
15
14
|
disabled?: boolean;
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
floatingLabel?: boolean;
|
|
16
|
+
hasRequiredSymbol?: boolean;
|
|
17
|
+
iconClassName?: string;
|
|
18
|
+
iconPath?: string;
|
|
19
|
+
id?: string;
|
|
20
|
+
label?: string;
|
|
21
|
+
labelClassName?: string;
|
|
22
|
+
leftSnippet?: Snippet;
|
|
23
|
+
leftSnippetContainerClassName?: string;
|
|
24
|
+
max?: number;
|
|
18
25
|
maxlength?: number;
|
|
19
|
-
minlength?: number;
|
|
20
26
|
min?: number;
|
|
21
|
-
|
|
22
|
-
step?: number;
|
|
23
|
-
requiredSymbolColor?: string;
|
|
24
|
-
requiredSymbol?: string;
|
|
25
|
-
hasRequiredSymbol?: boolean;
|
|
26
|
-
size?: InputFieldSizeType;
|
|
27
|
-
appearance?: InputFieldAppearanceType;
|
|
28
|
-
floatingLabel?: boolean;
|
|
29
|
-
pattern?: string;
|
|
27
|
+
minlength?: number;
|
|
30
28
|
multiple?: boolean;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
onchange?: (ev: any) => void;
|
|
34
|
-
oninput?: (ev: any) => void;
|
|
35
|
-
onfocus?: (ev: any) => void;
|
|
29
|
+
name?: string;
|
|
30
|
+
title?: string;
|
|
36
31
|
onblur?: (ev: any) => void;
|
|
37
|
-
|
|
32
|
+
onchange?: (ev: any) => void;
|
|
38
33
|
onclick?: (ev: MouseEvent) => void;
|
|
39
|
-
|
|
40
|
-
onmouseup?: (ev: MouseEvent) => void;
|
|
41
|
-
onkeydown?: (ev: KeyboardEvent) => void;
|
|
42
|
-
onkeyup?: (ev: KeyboardEvent) => void;
|
|
43
|
-
onkeypress?: (ev: KeyboardEvent) => void;
|
|
44
|
-
ondrop?: (ev: DragEvent) => void;
|
|
34
|
+
ondblclick?: (ev: MouseEvent) => void;
|
|
45
35
|
ondrag?: (ev: DragEvent) => void;
|
|
46
36
|
ondragover?: (ev: DragEvent) => void;
|
|
37
|
+
ondrop?: (ev: DragEvent) => void;
|
|
38
|
+
onfocus?: (ev: any) => void;
|
|
39
|
+
oninput?: (ev: any) => void;
|
|
40
|
+
onkeydown?: (ev: KeyboardEvent) => void;
|
|
41
|
+
onkeypress?: (ev: KeyboardEvent) => void;
|
|
42
|
+
onkeyup?: (ev: KeyboardEvent) => void;
|
|
43
|
+
onmousedown?: (ev: MouseEvent) => void;
|
|
44
|
+
onmouseup?: (ev: MouseEvent) => void;
|
|
45
|
+
pattern?: string;
|
|
46
|
+
placeholder?: string;
|
|
47
|
+
readonly?: boolean;
|
|
48
|
+
required?: boolean;
|
|
49
|
+
requiredSymbol?: string;
|
|
50
|
+
requiredSymbolColor?: string;
|
|
51
|
+
rightSnippet?: Snippet;
|
|
52
|
+
rightSnippetContainerClassName?: string;
|
|
53
|
+
role?: AriaRole;
|
|
54
|
+
rows?: number;
|
|
55
|
+
size?: InputFieldSizeType;
|
|
56
|
+
step?: number;
|
|
57
|
+
type?: HTMLInputTypeAttribute | 'textarea';
|
|
58
|
+
value?: InputValueType;
|
|
47
59
|
};
|
|
60
|
+
import type { Snippet } from 'svelte';
|
|
61
|
+
import type { HTMLInputTypeAttribute, AriaRole } from 'svelte/elements';
|
|
48
62
|
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> {
|
|
49
63
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
50
64
|
$$bindings?: Bindings;
|
|
@@ -60,6 +74,8 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
60
74
|
}
|
|
61
75
|
declare const InputField: $$__sveltets_2_IsomorphicComponent<InputFieldPropsType, {
|
|
62
76
|
[evt: string]: CustomEvent<any>;
|
|
63
|
-
}, {}, {
|
|
77
|
+
}, {}, {
|
|
78
|
+
focus: () => void;
|
|
79
|
+
}, "value">;
|
|
64
80
|
type InputField = InstanceType<typeof InputField>;
|
|
65
81
|
export default InputField;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script lang="ts">import InputField, {} from "../input-field/input-field.svelte";
|
|
2
|
+
let props = $props();
|
|
3
|
+
let inputFieldRef = $state(null);
|
|
4
|
+
export function focus() {
|
|
5
|
+
inputFieldRef?.focus();
|
|
6
|
+
}
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<InputField bind:this={inputFieldRef} {...props} type="number" />
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type InputFieldPropsType } from '../input-field/input-field.svelte';
|
|
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 NumberField: $$__sveltets_2_IsomorphicComponent<InputFieldPropsType, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {
|
|
18
|
+
focus: () => void;
|
|
19
|
+
}, "">;
|
|
20
|
+
type NumberField = InstanceType<typeof NumberField>;
|
|
21
|
+
export default NumberField;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script lang="ts">import { ripple } from "../../../../../actions";
|
|
2
|
+
import { mdiEyeOffOutline, mdiEyeOutline } from "../../../icon";
|
|
3
|
+
import Icon from "../../../icon/components/icon/icon.svelte";
|
|
4
|
+
import InputField, {} from "../input-field/input-field.svelte";
|
|
5
|
+
let {
|
|
6
|
+
type = "password",
|
|
7
|
+
size,
|
|
8
|
+
appearance,
|
|
9
|
+
buttonClassName,
|
|
10
|
+
iconClassName,
|
|
11
|
+
...props
|
|
12
|
+
} = $props();
|
|
13
|
+
let btnRoundedClassName = $state("");
|
|
14
|
+
let btnIconSizeClassName = $state("");
|
|
15
|
+
let inputFieldRef = $state(null);
|
|
16
|
+
export function focus() {
|
|
17
|
+
inputFieldRef?.focus();
|
|
18
|
+
}
|
|
19
|
+
function handleTogglePassword() {
|
|
20
|
+
if (type == "password") {
|
|
21
|
+
type = "text";
|
|
22
|
+
} else {
|
|
23
|
+
type = "password";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
$effect(() => {
|
|
27
|
+
if (size) {
|
|
28
|
+
switch (size) {
|
|
29
|
+
case "lg":
|
|
30
|
+
btnIconSizeClassName = "!h-7 !w-7";
|
|
31
|
+
break;
|
|
32
|
+
case "md":
|
|
33
|
+
btnIconSizeClassName = "!h-6 !w-6";
|
|
34
|
+
break;
|
|
35
|
+
case "sm":
|
|
36
|
+
btnIconSizeClassName = "!h-5 !w-5";
|
|
37
|
+
break;
|
|
38
|
+
case "xs":
|
|
39
|
+
btnIconSizeClassName = "!h-4 !w-4";
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
$effect(() => {
|
|
45
|
+
if (!appearance || appearance == "normal") {
|
|
46
|
+
btnRoundedClassName = "rounded-tr-lg rounded-br-lg";
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
{#snippet showPasswordButton()}
|
|
52
|
+
<button
|
|
53
|
+
class="px-3 h-full hover:bg-gray-100 {btnRoundedClassName} {buttonClassName}"
|
|
54
|
+
use:ripple
|
|
55
|
+
onclick={handleTogglePassword}
|
|
56
|
+
>
|
|
57
|
+
<Icon
|
|
58
|
+
path={type == 'password' ? mdiEyeOffOutline : mdiEyeOutline}
|
|
59
|
+
className=" {btnIconSizeClassName} {iconClassName}"
|
|
60
|
+
/>
|
|
61
|
+
</button>
|
|
62
|
+
{/snippet}
|
|
63
|
+
|
|
64
|
+
<InputField
|
|
65
|
+
bind:this={inputFieldRef}
|
|
66
|
+
{...props}
|
|
67
|
+
{type}
|
|
68
|
+
maxlength={props?.maxlength || 200}
|
|
69
|
+
rightSnippet={showPasswordButton}
|
|
70
|
+
{size}
|
|
71
|
+
{appearance}
|
|
72
|
+
/>
|