@cloudparker/moldex.js 0.0.123 → 4.1.0
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/types.d.ts +6 -0
- package/dist/types.js +7 -0
- package/dist/views/core/button/components/button/button.svelte +135 -83
- package/dist/views/core/button/components/button-back/button-back.svelte +28 -15
- package/dist/views/core/button/components/button-close/button-close.svelte +4 -2
- package/dist/views/core/button/components/button-close-icon/button-close-icon.svelte +29 -15
- package/dist/views/core/button/components/button-dropdown/button-dropdown.svelte +96 -72
- package/dist/views/core/button/components/button-dropdown/button-dropdown.svelte.d.ts +1 -1
- package/dist/views/core/button/components/button-list-item/button-list-item.svelte +98 -52
- package/dist/views/core/button/components/button-menu/button-menu.svelte +79 -43
- package/dist/views/core/button/components/button-ok/button-ok.svelte +4 -2
- package/dist/views/core/button/components/button-search/button-search.svelte +45 -21
- package/dist/views/core/button/components/switch/switch.svelte +70 -0
- package/dist/views/core/button/components/switch/switch.svelte.d.ts +11 -0
- package/dist/views/core/button/index.d.ts +4 -2
- package/dist/views/core/button/index.js +2 -1
- package/dist/views/core/common/components/content-area/content-area.svelte +40 -27
- package/dist/views/core/common/components/loading/loading.svelte +9 -2
- package/dist/views/core/common/components/virtual-scrolling/virtual-scrolling-list.svelte +37 -20
- package/dist/views/core/dialog/components/cropper-dialog/cropper-dialog.svelte +52 -36
- package/dist/views/core/dialog/components/dialog/dialog.svelte +298 -177
- package/dist/views/core/dialog/components/loading-dialog/loading-dialog.svelte +30 -18
- package/dist/views/core/dialog/components/msg-dialog/msg-dialog.svelte +17 -7
- package/dist/views/core/dialog/components/number-field-dialog/number-field-dialog.svelte +41 -26
- package/dist/views/core/dialog/components/picker-dialog/picker-dialog.svelte +150 -105
- package/dist/views/core/dialog/components/text-field-dialog/text-field-dialog.svelte +40 -25
- package/dist/views/core/dialog/components/textarea-field-dialog/textarea-field-dialog.svelte +40 -25
- package/dist/views/core/drawer/components/drawer/drawer.svelte +58 -36
- package/dist/views/core/icon/components/icon/icon.svelte +24 -12
- package/dist/views/core/icon/components/icon-circle/icon-circle.svelte +10 -2
- package/dist/views/core/input/components/checkbox-field/checkbox-field.svelte +44 -25
- package/dist/views/core/input/components/color-field/color-field.svelte +81 -69
- package/dist/views/core/input/components/combobox-field/combobox-field.svelte +359 -269
- package/dist/views/core/input/components/date-field/date-field.svelte +39 -30
- package/dist/views/core/input/components/datetime-field/datetime-field.svelte +18 -12
- package/dist/views/core/input/components/email-field/email-field.svelte +17 -12
- package/dist/views/core/input/components/file-field/file-field.svelte +78 -64
- package/dist/views/core/input/components/input-field/input-field.svelte +267 -164
- package/dist/views/core/input/components/label/label.svelte +24 -10
- package/dist/views/core/input/components/number-field/number-field.svelte +18 -12
- package/dist/views/core/input/components/password-field/password-field.svelte +70 -57
- package/dist/views/core/input/components/phone-field/phone-field.svelte +155 -104
- package/dist/views/core/input/components/radio-field/radio-field.svelte +83 -52
- package/dist/views/core/input/components/range-field/range-field.svelte +67 -44
- package/dist/views/core/input/components/search-field/search-field.svelte +62 -45
- package/dist/views/core/input/components/text-field/text-field.svelte +21 -16
- package/dist/views/core/input/components/textarea-field/textarea-field.svelte +17 -12
- package/dist/views/core/input/components/time-field/time-field.svelte +17 -12
- package/dist/views/core/navbar/components/navbar/navbar.svelte +76 -38
- package/dist/views/core/no-data/components/no-data/no-data.svelte +36 -19
- package/dist/views/core/pagination/components/pagination/pagination.svelte +90 -66
- package/dist/views/core/progressbar/components/progressbar/progressbar.svelte +36 -22
- package/dist/views/core/ruler/components/vertical-ruler/verticcal-ruler.svelte +5 -1
- package/dist/views/core/screen-detector/components/screen-detector.svelte +13 -9
- package/dist/views/core/sidebar/components/sidebar.svelte +36 -23
- package/dist/views/core/spinner/components/spinner/spinner.svelte +6 -1
- package/dist/views/core/text/components/text-await/text-await.svelte +9 -1
- package/dist/views/core/text/components/text-copy/text-copy.svelte +27 -16
- package/dist/views/core/text/components/text-currency/text-currency.svelte +13 -2
- package/dist/views/core/text/components/text-date/text-date.svelte +32 -20
- package/dist/views/core/text/components/text-email/text-email.svelte +12 -3
- package/dist/views/core/text/components/text-html/text-html.svelte +2 -1
- package/dist/views/core/text/components/text-phone/text-phone.svelte +12 -3
- package/dist/views/core/toast/components/toast/toast.svelte +43 -20
- package/dist/views/extra/fields/country-combobox-field.svelte +23 -15
- package/dist/views/extra/loaders/country-loader.svelte +33 -15
- package/dist/views/extra/texts/text-country-state.svelte +36 -28
- package/dist/views/extra/texts/text-country.svelte +16 -8
- package/package.json +3 -12
- package/readme.md +57 -2
- package/dist/tailwind.css +0 -1
- package/dist/theme.css +0 -27
|
@@ -1,168 +1,271 @@
|
|
|
1
|
-
<script module lang="ts"
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export type InputFieldSize = 'lg' | 'md' | 'sm' | 'xs';
|
|
3
|
+
export type InputFieldAppearance =
|
|
4
|
+
| 'normal'
|
|
5
|
+
| 'box'
|
|
6
|
+
| 'fill'
|
|
7
|
+
| 'underline'
|
|
8
|
+
| 'fill-underline'
|
|
9
|
+
| 'none';
|
|
2
10
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
$
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
11
|
+
export type InputValue =
|
|
12
|
+
| any
|
|
13
|
+
| string
|
|
14
|
+
| string[]
|
|
15
|
+
| number
|
|
16
|
+
| number[]
|
|
17
|
+
| Date
|
|
18
|
+
| Date[]
|
|
19
|
+
| File
|
|
20
|
+
| File[]
|
|
21
|
+
| null
|
|
22
|
+
| undefined;
|
|
23
|
+
|
|
24
|
+
export type InputFieldProps = {
|
|
25
|
+
appearance?: InputFieldAppearance;
|
|
26
|
+
ariaControls?: string;
|
|
27
|
+
ariaExpanded?: boolean;
|
|
28
|
+
autofocus?: boolean;
|
|
29
|
+
className?: string;
|
|
30
|
+
cols?: number;
|
|
31
|
+
containerClassName?: string;
|
|
32
|
+
contentSnippet?: Snippet;
|
|
33
|
+
contentSnippetClassName?: string;
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
floatingLabel?: boolean;
|
|
36
|
+
hasRequiredSymbol?: boolean;
|
|
37
|
+
iconClassName?: string;
|
|
38
|
+
iconPath?: string;
|
|
39
|
+
id?: string;
|
|
40
|
+
label?: string;
|
|
41
|
+
labelClassName?: string;
|
|
42
|
+
leftSnippet?: Snippet;
|
|
43
|
+
leftSnippetContainerClassName?: string;
|
|
44
|
+
max?: number | string;
|
|
45
|
+
maxlength?: number;
|
|
46
|
+
min?: number | string;
|
|
47
|
+
minlength?: number;
|
|
48
|
+
multiple?: boolean;
|
|
49
|
+
name?: string;
|
|
50
|
+
title?: string;
|
|
51
|
+
onBlur?: (ev: any) => void;
|
|
52
|
+
onChange?: (ev: any) => void;
|
|
53
|
+
onClick?: (ev: MouseEvent) => void;
|
|
54
|
+
onDblClick?: (ev: MouseEvent) => void;
|
|
55
|
+
onDrag?: (ev: DragEvent) => void;
|
|
56
|
+
onDragOver?: (ev: DragEvent) => void;
|
|
57
|
+
onDrop?: (ev: DragEvent) => void;
|
|
58
|
+
onFocus?: (ev: any) => void;
|
|
59
|
+
onInput?: (ev: any) => void;
|
|
60
|
+
onKeyDown?: (ev: KeyboardEvent) => void;
|
|
61
|
+
onKeyPress?: (ev: KeyboardEvent) => void;
|
|
62
|
+
onKeyUp?: (ev: KeyboardEvent) => void;
|
|
63
|
+
onMouseDown?: (ev: MouseEvent) => void;
|
|
64
|
+
onMouseUp?: (ev: MouseEvent) => void;
|
|
65
|
+
pattern?: string;
|
|
66
|
+
placeholder?: string;
|
|
67
|
+
readonly?: boolean;
|
|
68
|
+
required?: boolean;
|
|
69
|
+
requiredSymbol?: string;
|
|
70
|
+
requiredSymbolColor?: string;
|
|
71
|
+
rightSnippet?: Snippet;
|
|
72
|
+
rightSnippetContainerClassName?: string;
|
|
73
|
+
role?: AriaRole;
|
|
74
|
+
rows?: number;
|
|
75
|
+
size?: InputFieldSize;
|
|
76
|
+
step?: number;
|
|
77
|
+
type?: HTMLInputTypeAttribute | 'textarea';
|
|
78
|
+
value?: InputValue;
|
|
79
|
+
};
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<script lang="ts">
|
|
83
|
+
import type { Snippet } from 'svelte';
|
|
84
|
+
import type { HTMLInputTypeAttribute, AriaRole } from 'svelte/elements';
|
|
85
|
+
import Label from '../label/label.svelte';
|
|
86
|
+
|
|
87
|
+
let {
|
|
88
|
+
appearance = 'normal',
|
|
89
|
+
ariaControls,
|
|
90
|
+
ariaExpanded,
|
|
91
|
+
autofocus = false,
|
|
92
|
+
className = '',
|
|
93
|
+
cols,
|
|
94
|
+
containerClassName = '',
|
|
95
|
+
contentSnippet,
|
|
96
|
+
contentSnippetClassName,
|
|
97
|
+
disabled = false,
|
|
98
|
+
floatingLabel = false,
|
|
99
|
+
hasRequiredSymbol = true,
|
|
100
|
+
id = '',
|
|
101
|
+
label = '',
|
|
102
|
+
labelClassName = '',
|
|
103
|
+
leftSnippet,
|
|
104
|
+
leftSnippetContainerClassName = '',
|
|
105
|
+
max,
|
|
106
|
+
maxlength,
|
|
107
|
+
min,
|
|
108
|
+
minlength,
|
|
109
|
+
multiple = false,
|
|
110
|
+
name = '',
|
|
111
|
+
title,
|
|
112
|
+
onBlur,
|
|
113
|
+
onChange,
|
|
114
|
+
onClick,
|
|
115
|
+
onDblClick,
|
|
116
|
+
onDrag,
|
|
117
|
+
onDragOver,
|
|
118
|
+
onDrop,
|
|
119
|
+
onFocus,
|
|
120
|
+
onInput,
|
|
121
|
+
onKeyDown,
|
|
122
|
+
onKeyPress,
|
|
123
|
+
onKeyUp,
|
|
124
|
+
onMouseDown,
|
|
125
|
+
onMouseUp,
|
|
126
|
+
pattern,
|
|
127
|
+
placeholder = '',
|
|
128
|
+
readonly = false,
|
|
129
|
+
required = false,
|
|
130
|
+
requiredSymbol = '*',
|
|
131
|
+
requiredSymbolColor = 'red',
|
|
132
|
+
rightSnippet,
|
|
133
|
+
rightSnippetContainerClassName = '',
|
|
134
|
+
role,
|
|
135
|
+
rows = 5,
|
|
136
|
+
size = 'md',
|
|
137
|
+
step,
|
|
138
|
+
type = 'text',
|
|
139
|
+
value = $bindable()
|
|
140
|
+
}: InputFieldProps = $props();
|
|
141
|
+
|
|
142
|
+
let inputRef: HTMLInputElement | HTMLTextAreaElement | null = $state(null);
|
|
143
|
+
|
|
144
|
+
let sizeClassName = $state('');
|
|
145
|
+
let appearanceClassName = $state('');
|
|
146
|
+
let floatingLabelClassName = $state('');
|
|
147
|
+
let floatingLabelPaddingClassName = $state('');
|
|
148
|
+
let floatingLabelTextClassName = $state('');
|
|
149
|
+
|
|
150
|
+
export function focus() {
|
|
151
|
+
inputRef && inputRef.focus();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function getElement() {
|
|
155
|
+
return inputRef;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function select() {
|
|
159
|
+
return inputRef && (inputRef as HTMLInputElement).select();
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function getBoundingClientRect() {
|
|
163
|
+
if (inputRef) {
|
|
164
|
+
return inputRef.getBoundingClientRect();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
$effect(() => {
|
|
169
|
+
if (floatingLabel || leftSnippet != null || rightSnippet != null) {
|
|
170
|
+
containerClassName = (containerClassName || '') + ' relative';
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
$effect(() => {
|
|
175
|
+
if (floatingLabel) {
|
|
176
|
+
if (size) {
|
|
177
|
+
let flpcn = '';
|
|
178
|
+
switch (size) {
|
|
179
|
+
case 'lg':
|
|
180
|
+
flpcn = ` px-1 peer-focus:px-1 peer-placeholder-shown:px-4 `;
|
|
181
|
+
floatingLabelTextClassName = 'text-base';
|
|
182
|
+
break;
|
|
183
|
+
case 'md':
|
|
184
|
+
flpcn = ' px-1 peer-focus:px-1 peer-placeholder-shown:px-2.5 ';
|
|
185
|
+
floatingLabelTextClassName = 'text-sm';
|
|
186
|
+
|
|
187
|
+
break;
|
|
188
|
+
case 'sm':
|
|
189
|
+
flpcn = ' px-1 peer-focus:px-1 peer-placeholder-shown:px-2';
|
|
190
|
+
floatingLabelTextClassName = 'text-xs';
|
|
191
|
+
break;
|
|
192
|
+
case 'xs':
|
|
193
|
+
flpcn = ' px-0 peer-focus:px-0 peer-placeholder-shown:px-1 ';
|
|
194
|
+
floatingLabelTextClassName = 'text-xs';
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
floatingLabelPaddingClassName = flpcn;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
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-focus:bg-white dark:bg-base-700 peer-focus:bg-base-800 peer-placeholder-shown:bg-transparent start-1 ${floatingLabelPaddingClassName} ${floatingLabelTextClassName}`;
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
$effect(() => {
|
|
205
|
+
if (appearance) {
|
|
206
|
+
switch (appearance) {
|
|
207
|
+
case 'normal':
|
|
208
|
+
appearanceClassName =
|
|
209
|
+
'border rounded-lg bg-base-100 dark:bg-base-700 border-base-300 dark:border-base-500 text-base-950 dark:text-base-50 focus:ring-primary-500 focus:border-primary-500 dark:focus:ring-primary-500 dark:focus:border-primary-500 focus:bg-base-50 dark:focus:bg-base-800 ';
|
|
210
|
+
break;
|
|
211
|
+
case 'box':
|
|
212
|
+
appearanceClassName =
|
|
213
|
+
'border bg-base-100 dark:bg-base-700 border-base-300 dark:border-base-500 text-base-950 dark:text-base-50 focus:ring-primary-500 focus:border-primary-500 dark:focus:ring-primary-500 dark:focus:border-primary-500 focus:bg-base-50 dark:focus:bg-base-800 ';
|
|
214
|
+
break;
|
|
215
|
+
case 'fill':
|
|
216
|
+
appearanceClassName =
|
|
217
|
+
' border-0 appearance-none focus:ring-0 bg-base-100 dark:bg-base-700 text-base-950 dark:text-base-50 focus:bg-base-50 dark:focus:bg-base-800 ';
|
|
218
|
+
break;
|
|
219
|
+
case 'underline':
|
|
220
|
+
appearanceClassName =
|
|
221
|
+
'bg-transparent border-0 border-b-2 appearance-none focus:ring-0 text-base-950 dark:text-base-50 border-base-300 dark:border-base-700 focus:border-primary-500 dark:focus:border-primary-500';
|
|
222
|
+
break;
|
|
223
|
+
case 'fill-underline':
|
|
224
|
+
appearanceClassName =
|
|
225
|
+
'border-0 border-b-2 appearance-none ring-0 text-base-950 dark:text-base-50 bg-base-100 dark:bg-base-700 border-base-300 dark:border-base-500 focus:border-primary-500 dark:focus:border-primary-500 ';
|
|
226
|
+
break;
|
|
227
|
+
case 'none':
|
|
228
|
+
appearanceClassName =
|
|
229
|
+
'border-0 focus:ring-0 appearance-none text-base-950 dark:text-base-50 bg-transparent dark:bg-transparent focus:bg-base-100 dark:focus:bg-base-800 hover:bg-base-100 dark:hover:bg-base-800';
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
$effect(() => {
|
|
236
|
+
if (size) {
|
|
237
|
+
switch (size) {
|
|
238
|
+
case 'lg':
|
|
239
|
+
sizeClassName = 'p-4 text-base';
|
|
240
|
+
break;
|
|
241
|
+
case 'md':
|
|
242
|
+
sizeClassName = 'p-2.5 text-sm';
|
|
243
|
+
break;
|
|
244
|
+
case 'sm':
|
|
245
|
+
sizeClassName = 'p-2 text-xs';
|
|
246
|
+
break;
|
|
247
|
+
case 'xs':
|
|
248
|
+
sizeClassName = 'p-1 text-xs';
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
$effect(() => {
|
|
255
|
+
if (name && !id) {
|
|
256
|
+
id = name;
|
|
257
|
+
} else if (id && !name) {
|
|
258
|
+
name = id;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
$effect(() => {
|
|
263
|
+
setTimeout(() => {
|
|
264
|
+
if (inputRef && autofocus) {
|
|
265
|
+
inputRef.focus();
|
|
266
|
+
}
|
|
267
|
+
}, 10);
|
|
268
|
+
});
|
|
166
269
|
</script>
|
|
167
270
|
|
|
168
271
|
{#snippet labelSnippet()}
|
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
type PropsType = {
|
|
5
|
+
forName?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
children?: Snippet;
|
|
10
|
+
requiredSymbolColor?: string;
|
|
11
|
+
requiredSymbol?: string;
|
|
12
|
+
hasRequiredSymbol?: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
forName,
|
|
17
|
+
label = '',
|
|
18
|
+
className = '',
|
|
19
|
+
required = false,
|
|
20
|
+
requiredSymbolColor = 'red',
|
|
21
|
+
requiredSymbol = '*',
|
|
22
|
+
hasRequiredSymbol = true,
|
|
23
|
+
children
|
|
24
|
+
}: PropsType = $props();
|
|
11
25
|
</script>
|
|
12
26
|
|
|
13
27
|
<label
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import InputField, { type InputFieldProps } from '../input-field/input-field.svelte';
|
|
3
|
+
|
|
4
|
+
let { value = $bindable(), ...props }: InputFieldProps = $props();
|
|
5
|
+
|
|
6
|
+
let inputFieldRef: any | null = $state(null);
|
|
7
|
+
|
|
8
|
+
export function focus() {
|
|
9
|
+
inputFieldRef?.focus();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function getElement() {
|
|
13
|
+
return inputFieldRef;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function select() {
|
|
17
|
+
inputFieldRef && inputFieldRef.select();
|
|
18
|
+
}
|
|
13
19
|
</script>
|
|
14
20
|
|
|
15
21
|
<InputField bind:this={inputFieldRef} {...props} type="number" bind:value />
|
|
@@ -1,60 +1,73 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ripple } from '../../../../../actions';
|
|
3
|
+
import { mdiEyeOffOutline, mdiEyeOutline } from '../../../icon';
|
|
4
|
+
import Icon from '../../../icon/components/icon/icon.svelte';
|
|
5
|
+
import InputField, { type InputFieldProps } from '../input-field/input-field.svelte';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
type = 'password',
|
|
9
|
+
size,
|
|
10
|
+
appearance,
|
|
11
|
+
buttonClassName,
|
|
12
|
+
iconClassName,
|
|
13
|
+
name,
|
|
14
|
+
id,
|
|
15
|
+
value = $bindable(),
|
|
16
|
+
...props
|
|
17
|
+
}: InputFieldProps & {
|
|
18
|
+
buttonClassName?: string;
|
|
19
|
+
iconClassName?: string;
|
|
20
|
+
} = $props();
|
|
21
|
+
|
|
22
|
+
let btnRoundedClassName = $state('');
|
|
23
|
+
let btnIconSizeClassName = $state('');
|
|
24
|
+
|
|
25
|
+
let inputFieldRef: any | null = $state(null);
|
|
26
|
+
|
|
27
|
+
export function focus() {
|
|
28
|
+
inputFieldRef?.focus();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function getElement() {
|
|
32
|
+
return inputFieldRef;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function select() {
|
|
36
|
+
inputFieldRef && inputFieldRef.select();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function handleTogglePassword() {
|
|
40
|
+
if (type == 'password') {
|
|
41
|
+
type = 'text';
|
|
42
|
+
} else {
|
|
43
|
+
type = 'password';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
$effect(() => {
|
|
48
|
+
if (size) {
|
|
49
|
+
switch (size) {
|
|
50
|
+
case 'lg':
|
|
51
|
+
btnIconSizeClassName = '!h-7 !w-7';
|
|
52
|
+
break;
|
|
53
|
+
case 'md':
|
|
54
|
+
btnIconSizeClassName = '!h-6 !w-6';
|
|
55
|
+
break;
|
|
56
|
+
case 'sm':
|
|
57
|
+
btnIconSizeClassName = '!h-5 !w-5';
|
|
58
|
+
break;
|
|
59
|
+
case 'xs':
|
|
60
|
+
btnIconSizeClassName = '!h-4 !w-4';
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
$effect(() => {
|
|
67
|
+
if (!appearance || appearance == 'normal') {
|
|
68
|
+
btnRoundedClassName = 'rounded-tr-lg rounded-br-lg';
|
|
69
|
+
}
|
|
70
|
+
});
|
|
58
71
|
</script>
|
|
59
72
|
|
|
60
73
|
{#snippet showPasswordButton()}
|