@cloudparker/moldex.js 4.1.2 → 4.1.4
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/button/components/button-back/button-back.svelte +4 -7
- package/dist/views/core/button/components/button-close-icon/button-close-icon.svelte +5 -6
- package/dist/views/core/icon/components/icon/icon.svelte +2 -4
- package/dist/views/core/input/components/color-field/color-field.svelte +41 -33
- package/dist/views/core/input/components/date-field/date-field.svelte +7 -6
- package/dist/views/core/input/components/file-field/file-field.svelte +33 -31
- package/dist/views/core/input/components/input-field/input-field.svelte +97 -79
- package/dist/views/core/input/components/password-field/password-field.svelte +33 -29
- package/dist/views/core/input/components/range-field/range-field.svelte +8 -8
- package/dist/views/core/input/components/search-field/search-field.svelte +2 -1
- package/dist/views/core/no-data/components/no-data/no-data.svelte +2 -5
- package/dist/views/core/progressbar/components/progressbar/progressbar.svelte +9 -14
- package/dist/views/core/screen-detector/components/screen-detector.svelte +5 -4
- package/dist/views/core/text/components/text-date/text-date.svelte +6 -3
- package/dist/views/extra/texts/text-country-state.svelte +3 -2
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { isSmallScreen } from '../../../../../services';
|
|
3
|
-
import { mdiArrowLeft } from '../../../icon';
|
|
2
|
+
import { isSmallScreen } from '../../../../../services/index.js';
|
|
3
|
+
import { mdiArrowLeft } from '../../../icon/index.js';
|
|
4
|
+
|
|
4
5
|
import Button from '../button/button.svelte';
|
|
5
6
|
|
|
6
7
|
type PropsType = {
|
|
@@ -21,11 +22,7 @@
|
|
|
21
22
|
onClick
|
|
22
23
|
}: PropsType = $props();
|
|
23
24
|
|
|
24
|
-
let isMobileScreen = $
|
|
25
|
-
|
|
26
|
-
$effect(() => {
|
|
27
|
-
isMobileScreen = isSmallScreen();
|
|
28
|
-
});
|
|
25
|
+
let isMobileScreen = $derived(isSmallScreen() || false);
|
|
29
26
|
</script>
|
|
30
27
|
|
|
31
28
|
{#snippet button()}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { isSmallScreen } from '../../../../../services';
|
|
3
|
-
import {
|
|
2
|
+
import { isSmallScreen } from '../../../../../services/index.js';
|
|
3
|
+
import { mdiClose } from '../../../icon/index.js';
|
|
4
|
+
|
|
5
|
+
|
|
4
6
|
import Button from '../button/button.svelte';
|
|
5
7
|
|
|
6
8
|
type PropsType = {
|
|
@@ -22,11 +24,8 @@
|
|
|
22
24
|
onClick
|
|
23
25
|
}: PropsType = $props();
|
|
24
26
|
|
|
25
|
-
let isMobileScreen = $state(false);
|
|
27
|
+
let isMobileScreen = $state(isSmallScreen() || false);
|
|
26
28
|
|
|
27
|
-
$effect(() => {
|
|
28
|
-
isMobileScreen = isSmallScreen();
|
|
29
|
-
});
|
|
30
29
|
</script>
|
|
31
30
|
|
|
32
31
|
{#snippet button()}
|
|
@@ -19,11 +19,9 @@
|
|
|
19
19
|
sizeClassName = 'w-6 h-6'
|
|
20
20
|
}: IconPropsType = $props();
|
|
21
21
|
|
|
22
|
-
$
|
|
23
|
-
viewBox = viewBox || `0 0 ${size} ${size}`;
|
|
24
|
-
});
|
|
22
|
+
let viewBoxDerived = $derived(viewBox || `0 0 ${size} ${size}`);
|
|
25
23
|
</script>
|
|
26
24
|
|
|
27
|
-
<svg class="align-middle {sizeClassName} {className}" {
|
|
25
|
+
<svg class="align-middle {sizeClassName} {className}" viewBox={viewBoxDerived} fill={color || fill}>
|
|
28
26
|
<path d={path} />
|
|
29
27
|
</svg>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { ripple } from '../../../../../actions';
|
|
3
|
-
import { colorToHex, isValidHexColor } from '../../../../../services';
|
|
4
|
-
|
|
2
|
+
import { ripple } from '../../../../../actions/ripple.js';
|
|
3
|
+
import { colorToHex, isValidHexColor } from '../../../../../services/index.js';
|
|
4
|
+
|
|
5
|
+
|
|
5
6
|
import Icon from '../../../icon/components/icon/icon.svelte';
|
|
7
|
+
import { mdiSquare } from '../../../icon/index.js';
|
|
6
8
|
import InputField, { type InputFieldProps } from '../input-field/input-field.svelte';
|
|
7
9
|
|
|
8
10
|
let {
|
|
@@ -15,9 +17,41 @@
|
|
|
15
17
|
}: InputFieldProps & { value?: string } = $props();
|
|
16
18
|
|
|
17
19
|
let colorRef: HTMLInputElement;
|
|
18
|
-
|
|
19
|
-
let
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
let btnIconSizeClassName: string = $derived.by(() => {
|
|
22
|
+
let className = '';
|
|
23
|
+
if (size) {
|
|
24
|
+
switch (size) {
|
|
25
|
+
case 'lg':
|
|
26
|
+
className = '!h-7 !w-7';
|
|
27
|
+
break;
|
|
28
|
+
case 'md':
|
|
29
|
+
className = '!h-6 !w-6';
|
|
30
|
+
break;
|
|
31
|
+
case 'sm':
|
|
32
|
+
className = '!h-5 !w-5';
|
|
33
|
+
break;
|
|
34
|
+
case 'xs':
|
|
35
|
+
className = '!h-4 !w-4';
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return className;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
let btnRoundedClassName: string = $derived.by(() => {
|
|
43
|
+
if (!appearance || appearance == 'normal') {
|
|
44
|
+
return 'rounded-tr-lg rounded-br-lg';
|
|
45
|
+
}
|
|
46
|
+
return '';
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
let colorValue: string = $derived.by(() => {
|
|
50
|
+
if (isValidHexColor(value)) {
|
|
51
|
+
colorValue = value;
|
|
52
|
+
}
|
|
53
|
+
return '#000000';
|
|
54
|
+
});
|
|
21
55
|
|
|
22
56
|
let inputRef: any | null = $state(null);
|
|
23
57
|
|
|
@@ -48,44 +82,18 @@
|
|
|
48
82
|
|
|
49
83
|
$effect(() => {
|
|
50
84
|
if (isValidHexColor(value)) {
|
|
51
|
-
colorValue = value;
|
|
52
85
|
if (colorRef) {
|
|
53
86
|
colorRef.value = colorToHex(value);
|
|
54
87
|
}
|
|
55
88
|
}
|
|
56
89
|
});
|
|
57
|
-
|
|
58
|
-
$effect(() => {
|
|
59
|
-
if (size) {
|
|
60
|
-
switch (size) {
|
|
61
|
-
case 'lg':
|
|
62
|
-
btnIconSizeClassName = '!h-7 !w-7';
|
|
63
|
-
break;
|
|
64
|
-
case 'md':
|
|
65
|
-
btnIconSizeClassName = '!h-6 !w-6';
|
|
66
|
-
break;
|
|
67
|
-
case 'sm':
|
|
68
|
-
btnIconSizeClassName = '!h-5 !w-5';
|
|
69
|
-
break;
|
|
70
|
-
case 'xs':
|
|
71
|
-
btnIconSizeClassName = '!h-4 !w-4';
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
$effect(() => {
|
|
78
|
-
if (!appearance || appearance == 'normal') {
|
|
79
|
-
btnRoundedClassName = 'rounded-tr-lg rounded-br-lg';
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
90
|
</script>
|
|
83
91
|
|
|
84
92
|
{#snippet colorButton()}
|
|
85
93
|
<button
|
|
86
94
|
id="btn-color-picker-{name || id}"
|
|
87
95
|
type="button"
|
|
88
|
-
class="px-2
|
|
96
|
+
class="h-full px-2 hover:bg-neutral-100 focus:outline-primary dark:hover:bg-neutral-900 {btnRoundedClassName}"
|
|
89
97
|
use:ripple
|
|
90
98
|
onclick={handleColorBtnClick}
|
|
91
99
|
>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { dateFormat, toDate } from '../../../../../services';
|
|
2
|
+
import { dateFormat, toDate } from '../../../../../services/index.js';
|
|
3
|
+
|
|
4
|
+
|
|
3
5
|
import InputField, { type InputFieldProps } from '../input-field/input-field.svelte';
|
|
4
6
|
|
|
5
7
|
let {
|
|
@@ -7,15 +9,14 @@
|
|
|
7
9
|
...props
|
|
8
10
|
}: InputFieldProps & { value?: Date | string | number | null | undefined } = $props();
|
|
9
11
|
|
|
10
|
-
let _value: string | undefined = $
|
|
11
|
-
|
|
12
|
-
$effect(() => {
|
|
12
|
+
let _value: string | undefined = $derived.by(() => {
|
|
13
13
|
if (value) {
|
|
14
|
-
|
|
15
|
-
console.log('_value', _value);
|
|
14
|
+
return dateFormat(toDate(value)!, 'YYYY-MM-DD') as string;
|
|
16
15
|
}
|
|
17
16
|
});
|
|
18
17
|
|
|
18
|
+
|
|
19
|
+
|
|
19
20
|
let inputFieldRef: any | null = $state(null);
|
|
20
21
|
|
|
21
22
|
export function focus() {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { ripple } from '../../../../../actions';
|
|
3
|
-
import { openFilePickerDialog } from '../../../../../services';
|
|
4
|
-
|
|
2
|
+
import { ripple } from '../../../../../actions/ripple.js';
|
|
3
|
+
import { openFilePickerDialog } from '../../../../../services/index.js';
|
|
4
|
+
|
|
5
|
+
|
|
5
6
|
import Icon from '../../../icon/components/icon/icon.svelte';
|
|
7
|
+
import { mdiAttachment } from '../../../icon/index.js';
|
|
6
8
|
import InputField, { type InputFieldProps } from '../input-field/input-field.svelte';
|
|
7
9
|
|
|
8
10
|
let {
|
|
@@ -19,8 +21,33 @@
|
|
|
19
21
|
value?: File | File[] | null;
|
|
20
22
|
} = $props();
|
|
21
23
|
|
|
22
|
-
let btnRoundedClassName = $
|
|
23
|
-
|
|
24
|
+
let btnRoundedClassName = $derived.by(() => {
|
|
25
|
+
if (!appearance || appearance == 'normal') {
|
|
26
|
+
return 'rounded-tr-lg rounded-br-lg';
|
|
27
|
+
}
|
|
28
|
+
return '';
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
let btnIconSizeClassName = $derived.by(() => {
|
|
32
|
+
let className = '';
|
|
33
|
+
if (size) {
|
|
34
|
+
switch (size) {
|
|
35
|
+
case 'lg':
|
|
36
|
+
className = '!h-7 !w-7';
|
|
37
|
+
break;
|
|
38
|
+
case 'md':
|
|
39
|
+
className = '!h-6 !w-6';
|
|
40
|
+
break;
|
|
41
|
+
case 'sm':
|
|
42
|
+
className = '!h-5 !w-5';
|
|
43
|
+
break;
|
|
44
|
+
case 'xs':
|
|
45
|
+
className = '!h-4 !w-4';
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return className;
|
|
50
|
+
});
|
|
24
51
|
let fileNameDisplay = $state('');
|
|
25
52
|
|
|
26
53
|
let inputFieldRef: any | null = $state(null);
|
|
@@ -51,38 +78,13 @@
|
|
|
51
78
|
}
|
|
52
79
|
}
|
|
53
80
|
}
|
|
54
|
-
|
|
55
|
-
$effect(() => {
|
|
56
|
-
if (size) {
|
|
57
|
-
switch (size) {
|
|
58
|
-
case 'lg':
|
|
59
|
-
btnIconSizeClassName = '!h-7 !w-7';
|
|
60
|
-
break;
|
|
61
|
-
case 'md':
|
|
62
|
-
btnIconSizeClassName = '!h-6 !w-6';
|
|
63
|
-
break;
|
|
64
|
-
case 'sm':
|
|
65
|
-
btnIconSizeClassName = '!h-5 !w-5';
|
|
66
|
-
break;
|
|
67
|
-
case 'xs':
|
|
68
|
-
btnIconSizeClassName = '!h-4 !w-4';
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
$effect(() => {
|
|
75
|
-
if (!appearance || appearance == 'normal') {
|
|
76
|
-
btnRoundedClassName = 'rounded-tr-lg rounded-br-lg';
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
81
|
</script>
|
|
80
82
|
|
|
81
83
|
{#snippet fileButton()}
|
|
82
84
|
<button
|
|
83
85
|
id="btn-file-picker"
|
|
84
86
|
type="button"
|
|
85
|
-
class="px-3
|
|
87
|
+
class="h-full px-3 hover:bg-gray-100 focus:outline-primary {btnRoundedClassName} "
|
|
86
88
|
use:ripple
|
|
87
89
|
onclick={handleFileAttachment}
|
|
88
90
|
>
|
|
@@ -141,123 +141,141 @@
|
|
|
141
141
|
|
|
142
142
|
let inputRef: HTMLInputElement | HTMLTextAreaElement | null = $state(null);
|
|
143
143
|
|
|
144
|
-
let
|
|
145
|
-
let
|
|
146
|
-
let floatingLabelClassName = $state('');
|
|
147
|
-
let floatingLabelPaddingClassName = $state('');
|
|
148
|
-
let floatingLabelTextClassName = $state('');
|
|
144
|
+
let nameDerived = $derived(name || id);
|
|
145
|
+
let idDerived = $derived(id || name);
|
|
149
146
|
|
|
150
|
-
|
|
151
|
-
|
|
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();
|
|
147
|
+
let containerClassNameDerived = $derived.by(() => {
|
|
148
|
+
if (floatingLabel || leftSnippet != null || rightSnippet != null) {
|
|
149
|
+
return (containerClassName || '') + ' relative';
|
|
165
150
|
}
|
|
166
|
-
|
|
151
|
+
return containerClassName;
|
|
152
|
+
});
|
|
167
153
|
|
|
168
|
-
$
|
|
169
|
-
|
|
170
|
-
|
|
154
|
+
let sizeClassName = $derived.by(() => {
|
|
155
|
+
let sizeClassName = '';
|
|
156
|
+
if (size) {
|
|
157
|
+
switch (size) {
|
|
158
|
+
case 'lg':
|
|
159
|
+
sizeClassName = 'p-4 text-base';
|
|
160
|
+
break;
|
|
161
|
+
case 'md':
|
|
162
|
+
sizeClassName = 'p-2.5 text-sm';
|
|
163
|
+
break;
|
|
164
|
+
case 'sm':
|
|
165
|
+
sizeClassName = 'p-2 text-xs';
|
|
166
|
+
break;
|
|
167
|
+
case 'xs':
|
|
168
|
+
sizeClassName = 'p-1 text-xs';
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
171
|
}
|
|
172
|
+
return sizeClassName;
|
|
172
173
|
});
|
|
173
174
|
|
|
174
|
-
$
|
|
175
|
+
let floatingLabelPaddingClassName = $derived.by(() => {
|
|
175
176
|
if (floatingLabel) {
|
|
176
177
|
if (size) {
|
|
177
|
-
let
|
|
178
|
+
let floatingClassName = '';
|
|
178
179
|
switch (size) {
|
|
179
180
|
case 'lg':
|
|
180
|
-
|
|
181
|
-
floatingLabelTextClassName = 'text-base';
|
|
181
|
+
floatingClassName = ` px-1 peer-focus:px-1 peer-placeholder-shown:px-4 `;
|
|
182
182
|
break;
|
|
183
183
|
case 'md':
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
floatingClassName = ' px-1 peer-focus:px-1 peer-placeholder-shown:px-2.5 ';
|
|
185
|
+
break;
|
|
186
|
+
case 'sm':
|
|
187
|
+
floatingClassName = ' px-1 peer-focus:px-1 peer-placeholder-shown:px-2';
|
|
188
|
+
break;
|
|
189
|
+
case 'xs':
|
|
190
|
+
floatingClassName = ' px-0 peer-focus:px-0 peer-placeholder-shown:px-1 ';
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
return floatingClassName;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return '';
|
|
197
|
+
});
|
|
186
198
|
|
|
199
|
+
let floatingLabelTextClassName = $derived.by(() => {
|
|
200
|
+
let className = '';
|
|
201
|
+
if (floatingLabel) {
|
|
202
|
+
if (size) {
|
|
203
|
+
switch (size) {
|
|
204
|
+
case 'lg':
|
|
205
|
+
className = 'text-base';
|
|
206
|
+
break;
|
|
207
|
+
case 'md':
|
|
208
|
+
className = 'text-sm';
|
|
187
209
|
break;
|
|
188
210
|
case 'sm':
|
|
189
|
-
|
|
190
|
-
floatingLabelTextClassName = 'text-xs';
|
|
211
|
+
className = 'text-xs';
|
|
191
212
|
break;
|
|
192
213
|
case 'xs':
|
|
193
|
-
|
|
194
|
-
floatingLabelTextClassName = 'text-xs';
|
|
214
|
+
className = 'text-xs';
|
|
195
215
|
break;
|
|
196
216
|
}
|
|
197
|
-
floatingLabelPaddingClassName = flpcn;
|
|
198
217
|
}
|
|
218
|
+
}
|
|
219
|
+
return className;
|
|
220
|
+
});
|
|
199
221
|
|
|
200
|
-
|
|
222
|
+
let floatingLabelClassName = $derived.by(() => {
|
|
223
|
+
if (floatingLabel) {
|
|
224
|
+
return `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-neutral-700 peer-focus:bg-neutral-800 peer-placeholder-shown:bg-transparent start-1 ${floatingLabelPaddingClassName} ${floatingLabelTextClassName}`;
|
|
201
225
|
}
|
|
226
|
+
return '';
|
|
202
227
|
});
|
|
203
228
|
|
|
204
|
-
$
|
|
229
|
+
let appearanceClassName = $derived.by(() => {
|
|
230
|
+
let className = '';
|
|
205
231
|
if (appearance) {
|
|
206
232
|
switch (appearance) {
|
|
207
233
|
case 'normal':
|
|
208
|
-
|
|
234
|
+
className =
|
|
209
235
|
'border rounded-lg bg-neutral-100 dark:bg-neutral-700 border-neutral-300 dark:border-neutral-500 text-neutral-950 dark:text-neutral-50 focus:ring-primary-500 focus:border-primary-500 dark:focus:ring-primary-500 dark:focus:border-primary-500 focus:bg-neutral-50 dark:focus:bg-neutral-800 ';
|
|
210
236
|
break;
|
|
211
237
|
case 'box':
|
|
212
|
-
|
|
238
|
+
className =
|
|
213
239
|
'border bg-neutral-100 dark:bg-neutral-700 border-neutral-300 dark:border-neutral-500 text-neutral-950 dark:text-neutral-50 focus:ring-primary-500 focus:border-primary-500 dark:focus:ring-primary-500 dark:focus:border-primary-500 focus:bg-neutral-50 dark:focus:bg-neutral-800 ';
|
|
214
240
|
break;
|
|
215
241
|
case 'fill':
|
|
216
|
-
|
|
242
|
+
className =
|
|
217
243
|
' border-0 appearance-none focus:ring-0 bg-neutral-100 dark:bg-neutral-700 text-neutral-950 dark:text-neutral-50 focus:bg-neutral-50 dark:focus:bg-neutral-800 ';
|
|
218
244
|
break;
|
|
219
245
|
case 'underline':
|
|
220
|
-
|
|
246
|
+
className =
|
|
221
247
|
'bg-transparent border-0 border-b-2 appearance-none focus:ring-0 text-neutral-950 dark:text-neutral-50 border-neutral-300 dark:border-neutral-700 focus:border-primary-500 dark:focus:border-primary-500';
|
|
222
248
|
break;
|
|
223
249
|
case 'fill-underline':
|
|
224
|
-
|
|
250
|
+
className =
|
|
225
251
|
'border-0 border-b-2 appearance-none ring-0 text-neutral-950 dark:text-neutral-50 bg-neutral-100 dark:bg-neutral-700 border-neutral-300 dark:border-neutral-500 focus:border-primary-500 dark:focus:border-primary-500 ';
|
|
226
252
|
break;
|
|
227
253
|
case 'none':
|
|
228
|
-
|
|
254
|
+
className =
|
|
229
255
|
'border-0 focus:ring-0 appearance-none text-neutral-950 dark:text-neutral-50 bg-transparent dark:bg-transparent focus:bg-neutral-100 dark:focus:bg-neutral-800 hover:bg-neutral-100 dark:hover:bg-neutral-800';
|
|
230
256
|
break;
|
|
231
257
|
}
|
|
232
258
|
}
|
|
259
|
+
return className;
|
|
233
260
|
});
|
|
234
261
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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
|
-
});
|
|
262
|
+
export function focus() {
|
|
263
|
+
inputRef && inputRef.focus();
|
|
264
|
+
}
|
|
253
265
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
266
|
+
export function getElement() {
|
|
267
|
+
return inputRef;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export function select() {
|
|
271
|
+
return inputRef && (inputRef as HTMLInputElement).select();
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export function getBoundingClientRect() {
|
|
275
|
+
if (inputRef) {
|
|
276
|
+
return inputRef.getBoundingClientRect();
|
|
259
277
|
}
|
|
260
|
-
}
|
|
278
|
+
}
|
|
261
279
|
|
|
262
280
|
$effect(() => {
|
|
263
281
|
setTimeout(() => {
|
|
@@ -270,9 +288,9 @@
|
|
|
270
288
|
|
|
271
289
|
{#snippet labelSnippet()}
|
|
272
290
|
<Label
|
|
273
|
-
forName={
|
|
291
|
+
forName={idDerived}
|
|
274
292
|
{label}
|
|
275
|
-
className=" {floatingLabel ? '' : 'mb-1 '} {floatingLabelClassName}
|
|
293
|
+
className=" {floatingLabel ? '' : 'mb-1 '} {floatingLabelClassName} {labelClassName}"
|
|
276
294
|
{required}
|
|
277
295
|
{requiredSymbolColor}
|
|
278
296
|
{requiredSymbol}
|
|
@@ -284,10 +302,10 @@
|
|
|
284
302
|
{@render labelSnippet()}
|
|
285
303
|
{/if}
|
|
286
304
|
|
|
287
|
-
<div class="w-full {
|
|
305
|
+
<div class="w-full {containerClassNameDerived}">
|
|
288
306
|
{#if leftSnippet}
|
|
289
307
|
<div
|
|
290
|
-
class="absolute flex items-center justify-center
|
|
308
|
+
class="left-children absolute flex items-center justify-center {leftSnippetContainerClassName}"
|
|
291
309
|
>
|
|
292
310
|
{@render leftSnippet()}
|
|
293
311
|
</div>
|
|
@@ -297,10 +315,10 @@
|
|
|
297
315
|
<textarea
|
|
298
316
|
bind:this={inputRef}
|
|
299
317
|
bind:value
|
|
300
|
-
class="block w-full
|
|
318
|
+
class="peer block w-full outline-none {appearanceClassName} {sizeClassName} {className}"
|
|
301
319
|
{title}
|
|
302
|
-
{
|
|
303
|
-
{
|
|
320
|
+
id={idDerived}
|
|
321
|
+
name={nameDerived}
|
|
304
322
|
{placeholder}
|
|
305
323
|
{required}
|
|
306
324
|
{disabled}
|
|
@@ -328,11 +346,11 @@
|
|
|
328
346
|
<input
|
|
329
347
|
bind:this={inputRef}
|
|
330
348
|
bind:value
|
|
331
|
-
class="block w-full
|
|
349
|
+
class="peer block w-full outline-none {appearanceClassName} {sizeClassName} {className}"
|
|
332
350
|
{title}
|
|
333
351
|
{type}
|
|
334
|
-
{
|
|
335
|
-
{
|
|
352
|
+
id={idDerived}
|
|
353
|
+
name={nameDerived}
|
|
336
354
|
{placeholder}
|
|
337
355
|
{required}
|
|
338
356
|
{disabled}
|
|
@@ -365,14 +383,14 @@
|
|
|
365
383
|
{/if}
|
|
366
384
|
{#if contentSnippet}
|
|
367
385
|
<div
|
|
368
|
-
class="absolute inset-0
|
|
386
|
+
class="pointer-events-none absolute inset-0 block w-full overflow-hidden {appearanceClassName} {sizeClassName} {contentSnippetClassName}"
|
|
369
387
|
>
|
|
370
388
|
{@render contentSnippet()}
|
|
371
389
|
</div>
|
|
372
390
|
{/if}
|
|
373
391
|
{#if rightSnippet}
|
|
374
392
|
<div
|
|
375
|
-
class="absolute flex items-center justify-center
|
|
393
|
+
class="right-children absolute flex items-center justify-center {rightSnippetContainerClassName}"
|
|
376
394
|
>
|
|
377
395
|
{@render rightSnippet()}
|
|
378
396
|
</div>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { ripple } from '../../../../../actions';
|
|
3
|
-
|
|
2
|
+
import { ripple } from '../../../../../actions/ripple.js';
|
|
3
|
+
|
|
4
|
+
|
|
4
5
|
import Icon from '../../../icon/components/icon/icon.svelte';
|
|
6
|
+
import { mdiEyeOffOutline, mdiEyeOutline } from '../../../icon/index.js';
|
|
5
7
|
import InputField, { type InputFieldProps } from '../input-field/input-field.svelte';
|
|
6
8
|
|
|
7
9
|
let {
|
|
@@ -19,8 +21,33 @@
|
|
|
19
21
|
iconClassName?: string;
|
|
20
22
|
} = $props();
|
|
21
23
|
|
|
22
|
-
let btnRoundedClassName = $
|
|
23
|
-
|
|
24
|
+
let btnRoundedClassName = $derived.by(() => {
|
|
25
|
+
if (!appearance || appearance == 'normal') {
|
|
26
|
+
return 'rounded-tr-lg rounded-br-lg';
|
|
27
|
+
}
|
|
28
|
+
return '';
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
let btnIconSizeClassName = $derived.by(() => {
|
|
32
|
+
let className = '';
|
|
33
|
+
if (size) {
|
|
34
|
+
switch (size) {
|
|
35
|
+
case 'lg':
|
|
36
|
+
className = '!h-7 !w-7';
|
|
37
|
+
break;
|
|
38
|
+
case 'md':
|
|
39
|
+
className = '!h-6 !w-6';
|
|
40
|
+
break;
|
|
41
|
+
case 'sm':
|
|
42
|
+
className = '!h-5 !w-5';
|
|
43
|
+
break;
|
|
44
|
+
case 'xs':
|
|
45
|
+
className = '!h-4 !w-4';
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return className;
|
|
50
|
+
});
|
|
24
51
|
|
|
25
52
|
let inputFieldRef: any | null = $state(null);
|
|
26
53
|
|
|
@@ -44,37 +71,14 @@
|
|
|
44
71
|
}
|
|
45
72
|
}
|
|
46
73
|
|
|
47
|
-
|
|
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
|
-
});
|
|
74
|
+
|
|
71
75
|
</script>
|
|
72
76
|
|
|
73
77
|
{#snippet showPasswordButton()}
|
|
74
78
|
<button
|
|
75
79
|
id="btn-eye-{name || id}"
|
|
76
80
|
type="button"
|
|
77
|
-
class="px-3
|
|
81
|
+
class="h-full px-3 hover:bg-neutral-100 focus:outline-primary {btnRoundedClassName} {buttonClassName}"
|
|
78
82
|
use:ripple
|
|
79
83
|
onclick={handleTogglePassword}
|
|
80
84
|
>
|
|
@@ -32,23 +32,23 @@
|
|
|
32
32
|
onfocus
|
|
33
33
|
}: RangeFieldPropsType = $props();
|
|
34
34
|
|
|
35
|
-
let rangeSizeClassName = $
|
|
36
|
-
|
|
37
|
-
$effect(() => {
|
|
35
|
+
let rangeSizeClassName = $derived.by(() => {
|
|
36
|
+
let className = '';
|
|
38
37
|
switch (size) {
|
|
39
38
|
case 'lg':
|
|
40
|
-
|
|
39
|
+
className = 'h-3 ';
|
|
41
40
|
break;
|
|
42
41
|
case 'md':
|
|
43
|
-
|
|
42
|
+
className = 'h-2 ';
|
|
44
43
|
break;
|
|
45
44
|
case 'sm':
|
|
46
|
-
|
|
45
|
+
className = 'h-1 ';
|
|
47
46
|
break;
|
|
48
47
|
case 'xs':
|
|
49
|
-
|
|
48
|
+
className = 'h-2-px ';
|
|
50
49
|
break;
|
|
51
50
|
}
|
|
51
|
+
return className;
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
let inputRef: HTMLInputElement | null = $state(null);
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
{id}
|
|
73
73
|
{name}
|
|
74
74
|
type="range"
|
|
75
|
-
class="range-slider w-full
|
|
75
|
+
class="range-slider range-lg w-full cursor-pointer appearance-none rounded-lg bg-gray-200 outline-none focus:outline-none dark:bg-gray-700 {rangeSizeClassName} {className}"
|
|
76
76
|
{min}
|
|
77
77
|
{max}
|
|
78
78
|
{step}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import Icon from '../../../icon/components/icon/icon.svelte';
|
|
4
|
+
import { mdiMagnify } from '../../../icon/index.js';
|
|
4
5
|
import InputField, { type InputFieldProps } from '../input-field/input-field.svelte';
|
|
5
6
|
|
|
6
7
|
let {
|
|
@@ -29,11 +29,8 @@
|
|
|
29
29
|
right: 'flex-row-reverse'
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
let iconPlacementClassName: string = $
|
|
33
|
-
|
|
34
|
-
$effect(() => {
|
|
35
|
-
iconPlacementClassName = iconPlacementClassNameMap[iconPlacement];
|
|
36
|
-
});
|
|
32
|
+
let iconPlacementClassName: string = $derived(iconPlacementClassNameMap[iconPlacement]);
|
|
33
|
+
|
|
37
34
|
</script>
|
|
38
35
|
|
|
39
36
|
<div
|
|
@@ -17,28 +17,23 @@
|
|
|
17
17
|
children
|
|
18
18
|
}: PropsType = $props();
|
|
19
19
|
|
|
20
|
-
let progressValue: number = $
|
|
21
|
-
|
|
22
|
-
$effect(() => {
|
|
23
|
-
if (!className) {
|
|
24
|
-
className = 'h-4';
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
$effect(() => {
|
|
20
|
+
let progressValue: number = $derived.by(() => {
|
|
21
|
+
let v = value;
|
|
29
22
|
if (value < 0) {
|
|
30
|
-
|
|
23
|
+
v = 0;
|
|
31
24
|
} else if (value >= 100) {
|
|
32
|
-
|
|
25
|
+
v = 100;
|
|
33
26
|
} else {
|
|
34
|
-
|
|
27
|
+
v = value;
|
|
35
28
|
}
|
|
29
|
+
return v;
|
|
36
30
|
});
|
|
31
|
+
|
|
37
32
|
</script>
|
|
38
33
|
|
|
39
|
-
<div class="w-full bg-gray-200
|
|
34
|
+
<div class="progressbar-container w-full rounded-full bg-gray-200 {backgroundClassName}" style="">
|
|
40
35
|
<div
|
|
41
|
-
class="
|
|
36
|
+
class="progressbar rounded-full bg-indigo-600 text-center text-xs text-white transition-all ease-in-out {className}"
|
|
42
37
|
style="--progressWidth:{progressValue}%;"
|
|
43
38
|
>
|
|
44
39
|
{#if children}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { handleScreenSizeUpdate } from '../../../../services';
|
|
3
|
-
|
|
2
|
+
import { handleScreenSizeUpdate } from '../../../../services/index.js';
|
|
3
|
+
|
|
4
|
+
import { onMount } from 'svelte';
|
|
4
5
|
|
|
5
6
|
let innerWidth: number = $state(0);
|
|
6
7
|
|
|
@@ -8,8 +9,8 @@
|
|
|
8
9
|
handleScreenSizeUpdate(size);
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
onMount(() => {
|
|
13
|
+
screenSizeChanged(innerWidth);
|
|
13
14
|
});
|
|
14
15
|
</script>
|
|
15
16
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { dateFormat, dateToAgo, toDate } from '../../../../../services';
|
|
2
|
+
import { dateFormat, dateToAgo, toDate } from '../../../../../services/index.js';
|
|
3
|
+
|
|
4
|
+
|
|
3
5
|
|
|
4
6
|
import { BROWSER } from 'esm-env';
|
|
7
|
+
import { onMount } from 'svelte';
|
|
5
8
|
|
|
6
9
|
type PropsType = {
|
|
7
10
|
input: Date | number | string | { seconds: number; nanoseconds: number };
|
|
@@ -27,8 +30,8 @@
|
|
|
27
30
|
}
|
|
28
31
|
}
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
onMount(() => {
|
|
34
|
+
prepareDate(input);
|
|
32
35
|
});
|
|
33
36
|
</script>
|
|
34
37
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import EasyScriptLoader from '@cloudparker/easy-script-loader-svelte';
|
|
3
3
|
import { BROWSER } from 'esm-env';
|
|
4
|
+
import { mount, onMount } from 'svelte';
|
|
4
5
|
|
|
5
6
|
let { input }: { input: string } = $props();
|
|
6
7
|
|
|
@@ -31,8 +32,8 @@
|
|
|
31
32
|
init();
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
onMount(() => {
|
|
36
|
+
prepare(input, states);
|
|
36
37
|
});
|
|
37
38
|
</script>
|
|
38
39
|
|