@cloudparker/moldex.js 0.0.29 → 0.0.31
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/tailwind.css +1 -1
- package/dist/views/core/button/components/button/button.svelte +54 -33
- package/dist/views/core/button/components/button-back/button-back.svelte +26 -14
- 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-list-item/button-list-item.svelte +78 -30
- package/dist/views/core/button/components/button-menu/button-menu.svelte +143 -90
- package/dist/views/core/button/components/button-ok/button-ok.svelte +4 -2
- package/dist/views/core/dialog/components/dialog/dialog.svelte +245 -158
- package/dist/views/core/dialog/components/dialog/dialog.svelte.d.ts +2 -7
- package/dist/views/core/dialog/components/list-dialog/list-picker-dialog.svelte +152 -108
- package/dist/views/core/dialog/components/msg-dialog/msg-dialog.svelte +22 -13
- package/dist/views/core/dialog/index.d.ts +4 -2
- package/dist/views/core/dialog/index.js +2 -2
- package/dist/views/core/drawer/components/drawer/drawer.svelte +52 -34
- package/dist/views/core/icon/components/icon/icon.svelte +24 -13
- package/dist/views/core/input/components/color-field/color-field.svelte +71 -61
- package/dist/views/core/input/components/combobox-field/combobox-field.svelte +330 -248
- package/dist/views/core/input/components/combobox-field/combobox-field.svelte.d.ts +1 -1
- package/dist/views/core/input/components/date-field/date-field.svelte +10 -6
- package/dist/views/core/input/components/datetime-field/datetime-field.svelte +10 -6
- package/dist/views/core/input/components/email-field/email-field.svelte +9 -6
- package/dist/views/core/input/components/file-field/file-field.svelte +69 -57
- package/dist/views/core/input/components/input-field/input-field.svelte +251 -151
- package/dist/views/core/input/components/label/label.svelte +24 -10
- package/dist/views/core/input/components/number-field/number-field.svelte +10 -6
- package/dist/views/core/input/components/password-field/password-field.svelte +59 -48
- package/dist/views/core/input/components/phone-field/phone-field.svelte +62 -48
- package/dist/views/core/input/components/radio-field/radio-field.svelte +120 -0
- package/dist/views/core/input/components/radio-field/radio-field.svelte.d.ts +45 -0
- package/dist/views/core/input/components/range-field/range-field.svelte +51 -32
- package/dist/views/core/input/components/search-field/search-field.svelte +52 -38
- package/dist/views/core/input/components/text-field/text-field.svelte +9 -6
- package/dist/views/core/input/components/textarea-field/textarea-field.svelte +9 -6
- package/dist/views/core/input/components/time-field/time-field.svelte +9 -6
- package/dist/views/core/input/index.d.ts +4 -2
- package/dist/views/core/input/index.js +2 -2
- package/dist/views/core/navbar/components/navbar/navbar.svelte +63 -31
- package/dist/views/core/no-data/components/no-data/no-data.svelte +37 -20
- package/dist/views/core/no-data/components/no-data/no-data.svelte.d.ts +1 -1
- package/dist/views/core/pagination/components/pagination/pagination.svelte +100 -71
- package/dist/views/core/progressbar/components/progressbar/progressbar.svelte +37 -23
- package/dist/views/core/referrer/components/referrer.svelte +15 -13
- package/dist/views/core/ruler/components/vertical-ruler/verticcal-ruler.svelte +6 -2
- package/dist/views/core/screen-detector/components/screen-detector.svelte +13 -9
- package/dist/views/core/spinner/components/spinner/spinner.svelte +7 -2
- package/dist/views/core/text/components/text-await/text-await.svelte +8 -2
- package/dist/views/core/text/components/text-copy/text-copy.svelte +28 -17
- package/dist/views/core/text/components/text-country/text-country.svelte +41 -29
- package/dist/views/core/text/components/text-country-state/text-country-state.svelte +37 -29
- package/dist/views/core/text/components/text-currency/text-currency.svelte +21 -10
- package/dist/views/core/text/components/text-date/text-date.svelte +33 -21
- package/dist/views/core/text/components/text-email/text-email.svelte +13 -4
- package/dist/views/core/text/components/text-html/text-html.svelte +3 -2
- package/dist/views/core/text/components/text-phone/text-phone.svelte +13 -4
- package/dist/views/core/toast/components/toast/toast.svelte +44 -21
- package/package.json +1 -1
|
@@ -1,60 +1,72 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
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 { openFilePicker } from '../../../../../services';
|
|
4
|
+
import { mdiAttachment } from '../../../icon';
|
|
5
|
+
import Icon from '../../../icon/components/icon/icon.svelte';
|
|
6
|
+
import InputField, { type InputFieldPropsType } from '../input-field/input-field.svelte';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
appearance,
|
|
10
|
+
size,
|
|
11
|
+
className,
|
|
12
|
+
accept = '',
|
|
13
|
+
multiple = false,
|
|
14
|
+
value,
|
|
15
|
+
...props
|
|
16
|
+
}: InputFieldPropsType & {
|
|
17
|
+
accept?: string;
|
|
18
|
+
multiple?: boolean;
|
|
19
|
+
value?: File | File[];
|
|
20
|
+
} = $props();
|
|
21
|
+
|
|
22
|
+
let btnRoundedClassName = $state('');
|
|
23
|
+
let btnIconSizeClassName = $state('');
|
|
24
|
+
let fileNameDisplay = $state('');
|
|
25
|
+
|
|
26
|
+
let inputFieldRef: InputField | null = $state(null);
|
|
27
|
+
|
|
28
|
+
export function focus() {
|
|
29
|
+
inputFieldRef?.focus();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function handleFileAttachment() {
|
|
33
|
+
let res: File | File[] = await openFilePicker({ accept, multiple });
|
|
34
|
+
if (res) {
|
|
35
|
+
value = res;
|
|
36
|
+
if (multiple) {
|
|
37
|
+
let files: File[] = value as File[];
|
|
38
|
+
fileNameDisplay = files.map((file) => file.name).join(', ');
|
|
39
|
+
} else {
|
|
40
|
+
let file: File = value as File;
|
|
41
|
+
fileNameDisplay = file.name;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
$effect(() => {
|
|
47
|
+
if (size) {
|
|
48
|
+
switch (size) {
|
|
49
|
+
case 'lg':
|
|
50
|
+
btnIconSizeClassName = '!h-7 !w-7';
|
|
51
|
+
break;
|
|
52
|
+
case 'md':
|
|
53
|
+
btnIconSizeClassName = '!h-6 !w-6';
|
|
54
|
+
break;
|
|
55
|
+
case 'sm':
|
|
56
|
+
btnIconSizeClassName = '!h-5 !w-5';
|
|
57
|
+
break;
|
|
58
|
+
case 'xs':
|
|
59
|
+
btnIconSizeClassName = '!h-4 !w-4';
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
$effect(() => {
|
|
66
|
+
if (!appearance || appearance == 'normal') {
|
|
67
|
+
btnRoundedClassName = 'rounded-tr-lg rounded-br-lg';
|
|
68
|
+
}
|
|
69
|
+
});
|
|
58
70
|
</script>
|
|
59
71
|
|
|
60
72
|
{#snippet fileButton()}
|
|
@@ -1,155 +1,255 @@
|
|
|
1
|
-
<script module lang="ts"
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export type InputFieldSizeType = 'lg' | 'md' | 'sm' | 'xs';
|
|
3
|
+
export type InputFieldAppearanceType =
|
|
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
|
-
|
|
11
|
+
export type InputValueType =
|
|
12
|
+
| string
|
|
13
|
+
| string[]
|
|
14
|
+
| number
|
|
15
|
+
| number[]
|
|
16
|
+
| Date
|
|
17
|
+
| Date[]
|
|
18
|
+
| File
|
|
19
|
+
| File[]
|
|
20
|
+
| null
|
|
21
|
+
| undefined;
|
|
22
|
+
|
|
23
|
+
export type InputFieldPropsType = {
|
|
24
|
+
appearance?: InputFieldAppearanceType;
|
|
25
|
+
ariaControls?: string;
|
|
26
|
+
ariaExpanded?: boolean;
|
|
27
|
+
autofocus?: boolean;
|
|
28
|
+
className?: string;
|
|
29
|
+
cols?: number;
|
|
30
|
+
containerClassName?: string;
|
|
31
|
+
contentSnippet?: Snippet;
|
|
32
|
+
contentSnippetClassName?: string;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
floatingLabel?: boolean;
|
|
35
|
+
hasRequiredSymbol?: boolean;
|
|
36
|
+
iconClassName?: string;
|
|
37
|
+
iconPath?: string;
|
|
38
|
+
id?: string;
|
|
39
|
+
label?: string;
|
|
40
|
+
labelClassName?: string;
|
|
41
|
+
leftSnippet?: Snippet;
|
|
42
|
+
leftSnippetContainerClassName?: string;
|
|
43
|
+
max?: number;
|
|
44
|
+
maxlength?: number;
|
|
45
|
+
min?: number;
|
|
46
|
+
minlength?: number;
|
|
47
|
+
multiple?: boolean;
|
|
48
|
+
name?: string;
|
|
49
|
+
title?: string;
|
|
50
|
+
onblur?: (ev: any) => void;
|
|
51
|
+
onchange?: (ev: any) => void;
|
|
52
|
+
onclick?: (ev: MouseEvent) => void;
|
|
53
|
+
ondblclick?: (ev: MouseEvent) => void;
|
|
54
|
+
ondrag?: (ev: DragEvent) => void;
|
|
55
|
+
ondragover?: (ev: DragEvent) => void;
|
|
56
|
+
ondrop?: (ev: DragEvent) => void;
|
|
57
|
+
onfocus?: (ev: any) => void;
|
|
58
|
+
oninput?: (ev: any) => void;
|
|
59
|
+
onkeydown?: (ev: KeyboardEvent) => void;
|
|
60
|
+
onkeypress?: (ev: KeyboardEvent) => void;
|
|
61
|
+
onkeyup?: (ev: KeyboardEvent) => void;
|
|
62
|
+
onmousedown?: (ev: MouseEvent) => void;
|
|
63
|
+
onmouseup?: (ev: MouseEvent) => void;
|
|
64
|
+
pattern?: string;
|
|
65
|
+
placeholder?: string;
|
|
66
|
+
readonly?: boolean;
|
|
67
|
+
required?: boolean;
|
|
68
|
+
requiredSymbol?: string;
|
|
69
|
+
requiredSymbolColor?: string;
|
|
70
|
+
rightSnippet?: Snippet;
|
|
71
|
+
rightSnippetContainerClassName?: string;
|
|
72
|
+
role?: AriaRole;
|
|
73
|
+
rows?: number;
|
|
74
|
+
size?: InputFieldSizeType;
|
|
75
|
+
step?: number;
|
|
76
|
+
type?: HTMLInputTypeAttribute | 'textarea';
|
|
77
|
+
value?: InputValueType;
|
|
78
|
+
};
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
<script lang="ts">
|
|
82
|
+
import type { Snippet } from 'svelte';
|
|
83
|
+
import type { HTMLInputTypeAttribute, AriaRole } from 'svelte/elements';
|
|
84
|
+
import Label from '../label/label.svelte';
|
|
85
|
+
|
|
86
|
+
let {
|
|
87
|
+
appearance = 'normal',
|
|
88
|
+
ariaControls,
|
|
89
|
+
ariaExpanded,
|
|
90
|
+
autofocus = false,
|
|
91
|
+
className = '',
|
|
92
|
+
cols,
|
|
93
|
+
containerClassName = '',
|
|
94
|
+
contentSnippet,
|
|
95
|
+
contentSnippetClassName,
|
|
96
|
+
disabled = false,
|
|
97
|
+
floatingLabel = false,
|
|
98
|
+
hasRequiredSymbol = true,
|
|
99
|
+
id = '',
|
|
100
|
+
label = '',
|
|
101
|
+
labelClassName = '',
|
|
102
|
+
leftSnippet,
|
|
103
|
+
leftSnippetContainerClassName = '',
|
|
104
|
+
max,
|
|
105
|
+
maxlength,
|
|
106
|
+
min,
|
|
107
|
+
minlength,
|
|
108
|
+
multiple = false,
|
|
109
|
+
name = '',
|
|
110
|
+
title,
|
|
111
|
+
onblur,
|
|
112
|
+
onchange,
|
|
113
|
+
onclick,
|
|
114
|
+
ondblclick,
|
|
115
|
+
ondrag,
|
|
116
|
+
ondragover,
|
|
117
|
+
ondrop,
|
|
118
|
+
onfocus,
|
|
119
|
+
oninput,
|
|
120
|
+
onkeydown,
|
|
121
|
+
onkeypress,
|
|
122
|
+
onkeyup,
|
|
123
|
+
onmousedown,
|
|
124
|
+
onmouseup,
|
|
125
|
+
pattern = '',
|
|
126
|
+
placeholder = '',
|
|
127
|
+
readonly = false,
|
|
128
|
+
required = false,
|
|
129
|
+
requiredSymbol = '*',
|
|
130
|
+
requiredSymbolColor = 'red',
|
|
131
|
+
rightSnippet,
|
|
132
|
+
rightSnippetContainerClassName = '',
|
|
133
|
+
role,
|
|
134
|
+
rows = 5,
|
|
135
|
+
size = 'md',
|
|
136
|
+
step,
|
|
137
|
+
type = 'text',
|
|
138
|
+
value = $bindable('')
|
|
139
|
+
}: InputFieldPropsType = $props();
|
|
140
|
+
|
|
141
|
+
let inputRef: HTMLInputElement | HTMLTextAreaElement | HTMLButtonElement | null = $state(null);
|
|
142
|
+
|
|
143
|
+
let sizeClassName = $state('');
|
|
144
|
+
let appearanceClassName = $state('');
|
|
145
|
+
let floatingLabelClassName = $state('');
|
|
146
|
+
let floatingLabelPaddingClassName = $state('');
|
|
147
|
+
let floatingLabelTextClassName = $state('');
|
|
148
|
+
|
|
149
|
+
export function focus() {
|
|
150
|
+
inputRef && inputRef.focus();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
$effect(() => {
|
|
154
|
+
if (floatingLabel || leftSnippet != null || rightSnippet != null) {
|
|
155
|
+
containerClassName = (containerClassName || '') + ' relative';
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
$effect(() => {
|
|
160
|
+
if (floatingLabel) {
|
|
161
|
+
if (size) {
|
|
162
|
+
let flpcn = '';
|
|
163
|
+
switch (size) {
|
|
164
|
+
case 'lg':
|
|
165
|
+
flpcn = ` px-1 peer-focus:px-1 peer-placeholder-shown:px-4 `;
|
|
166
|
+
floatingLabelTextClassName = 'text-base';
|
|
167
|
+
break;
|
|
168
|
+
case 'md':
|
|
169
|
+
flpcn = ' px-1 peer-focus:px-1 peer-placeholder-shown:px-2.5 ';
|
|
170
|
+
floatingLabelTextClassName = 'text-sm';
|
|
171
|
+
|
|
172
|
+
break;
|
|
173
|
+
case 'sm':
|
|
174
|
+
flpcn = ' px-1 peer-focus:px-1 peer-placeholder-shown:px-2';
|
|
175
|
+
floatingLabelTextClassName = 'text-xs';
|
|
176
|
+
break;
|
|
177
|
+
case 'xs':
|
|
178
|
+
flpcn = ' px-0 peer-focus:px-0 peer-placeholder-shown:px-1 ';
|
|
179
|
+
floatingLabelTextClassName = 'text-xs';
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
floatingLabelPaddingClassName = flpcn;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
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}`;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
$effect(() => {
|
|
190
|
+
if (appearance) {
|
|
191
|
+
switch (appearance) {
|
|
192
|
+
case 'normal':
|
|
193
|
+
appearanceClassName =
|
|
194
|
+
'bg-gray-50 border border-gray-300 text-gray-900 rounded-lg focus:ring-indigo-500 focus:border-indigo-500 dark:bg-gray-700 ';
|
|
195
|
+
break;
|
|
196
|
+
case 'box':
|
|
197
|
+
appearanceClassName =
|
|
198
|
+
'bg-gray-50 border border-gray-300 text-gray-900 focus:ring-indigo-500 focus:border-indigo-500 ';
|
|
199
|
+
break;
|
|
200
|
+
case 'fill':
|
|
201
|
+
appearanceClassName =
|
|
202
|
+
'bg-gray-100 border-0 appearance-none focus:bg-gray-200 focus:outline-none focus:ring-0';
|
|
203
|
+
break;
|
|
204
|
+
|
|
205
|
+
case 'underline':
|
|
206
|
+
appearanceClassName =
|
|
207
|
+
'bg-transparent border-0 border-b-2 border-gray-300 appearance-none focus:outline-none focus:ring-0 focus:border-blue-600';
|
|
208
|
+
break;
|
|
209
|
+
case 'fill-underline':
|
|
210
|
+
appearanceClassName =
|
|
211
|
+
'bg-gray-100 border-0 border-b-2 border-gray-300 appearance-none focus:outline-none focus:ring-0 focus:border-blue-600';
|
|
212
|
+
break;
|
|
213
|
+
case 'none':
|
|
214
|
+
appearanceClassName =
|
|
215
|
+
'hover:bg-gray-100 focus:bg-gray-100 border-0 focus:outline-none focus:ring-0 appearance-none';
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
$effect(() => {
|
|
222
|
+
if (size) {
|
|
223
|
+
switch (size) {
|
|
224
|
+
case 'lg':
|
|
225
|
+
sizeClassName = 'p-4 text-base';
|
|
226
|
+
break;
|
|
227
|
+
case 'md':
|
|
228
|
+
sizeClassName = 'p-2.5 text-sm';
|
|
229
|
+
break;
|
|
230
|
+
case 'sm':
|
|
231
|
+
sizeClassName = 'p-2 text-xs';
|
|
232
|
+
break;
|
|
233
|
+
case 'xs':
|
|
234
|
+
sizeClassName = 'p-1 text-xs';
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
$effect(() => {
|
|
241
|
+
if (name && !id) {
|
|
242
|
+
id = name;
|
|
243
|
+
} else if (id && !name) {
|
|
244
|
+
name = id;
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
$effect(() => {
|
|
249
|
+
if (inputRef && autofocus) {
|
|
250
|
+
inputRef.focus();
|
|
251
|
+
}
|
|
252
|
+
});
|
|
153
253
|
</script>
|
|
154
254
|
|
|
155
255
|
{#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,9 +1,13 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import InputField, { type InputFieldPropsType } from '../input-field/input-field.svelte';
|
|
3
|
+
|
|
4
|
+
let props: InputFieldPropsType = $props();
|
|
5
|
+
|
|
6
|
+
let inputFieldRef: InputField | null = $state(null);
|
|
7
|
+
|
|
8
|
+
export function focus() {
|
|
9
|
+
inputFieldRef?.focus();
|
|
10
|
+
}
|
|
7
11
|
</script>
|
|
8
12
|
|
|
9
13
|
<InputField bind:this={inputFieldRef} {...props} type="number" />
|