vanilla-jui 1.7.8 → 1.7.10
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/index.d.ts +0 -11
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/form.ts +1 -41
- package/src/css/form.css +7 -41
- package/src/css/themes/default/form.css +0 -6
- package/src/css/themes/default/tip.css +21 -17
- package/src/css/tip.css +1 -0
- package/src/primitives/loading.ts +2 -2
package/package.json
CHANGED
package/src/components/form.ts
CHANGED
|
@@ -50,10 +50,6 @@ type FormControlType =
|
|
|
50
50
|
|
|
51
51
|
export interface FormClassNames {
|
|
52
52
|
form: string;
|
|
53
|
-
vertical: string;
|
|
54
|
-
horizontal: string;
|
|
55
|
-
itemVertical: string;
|
|
56
|
-
itemHorizontal: string;
|
|
57
53
|
item: string;
|
|
58
54
|
label: string;
|
|
59
55
|
required: string;
|
|
@@ -68,8 +64,6 @@ export interface FormClassNames {
|
|
|
68
64
|
select: string;
|
|
69
65
|
radio: string;
|
|
70
66
|
checkbox: string;
|
|
71
|
-
choiceVertical: string;
|
|
72
|
-
choiceHorizontal: string;
|
|
73
67
|
choiceGroup: string;
|
|
74
68
|
radioLabel: string;
|
|
75
69
|
radioText: string;
|
|
@@ -117,7 +111,6 @@ export interface FormField {
|
|
|
117
111
|
readonly?: boolean;
|
|
118
112
|
autocomplete?: string;
|
|
119
113
|
multiple?: boolean;
|
|
120
|
-
vertical?: boolean;
|
|
121
114
|
group?: boolean;
|
|
122
115
|
size?: string;
|
|
123
116
|
variant?: string;
|
|
@@ -145,8 +138,6 @@ export type FormTextConfig = Partial<FormText>;
|
|
|
145
138
|
|
|
146
139
|
export interface FormProps extends Record<string, unknown> {
|
|
147
140
|
id?: string | null;
|
|
148
|
-
vertical?: boolean;
|
|
149
|
-
itemVertical?: boolean;
|
|
150
141
|
size?: string;
|
|
151
142
|
style?: FormStyle;
|
|
152
143
|
fields?: readonly FormItem<FormField>[];
|
|
@@ -163,8 +154,6 @@ export interface FormProps extends Record<string, unknown> {
|
|
|
163
154
|
|
|
164
155
|
interface ResolvedFormProps extends Record<string, unknown> {
|
|
165
156
|
id: string;
|
|
166
|
-
vertical: boolean;
|
|
167
|
-
itemVertical: boolean;
|
|
168
157
|
size: string;
|
|
169
158
|
style: FormStyle;
|
|
170
159
|
fields: FormItem<FormField>[];
|
|
@@ -203,10 +192,6 @@ interface FormControlContext {
|
|
|
203
192
|
|
|
204
193
|
const DEFAULT_CLASS_NAMES: FormClassNames = {
|
|
205
194
|
form: 'j-form',
|
|
206
|
-
vertical: 'is-vertical',
|
|
207
|
-
horizontal: 'is-horizontal',
|
|
208
|
-
itemVertical: 'is-item-vertical',
|
|
209
|
-
itemHorizontal: 'is-item-horizontal',
|
|
210
195
|
item: 'form-field',
|
|
211
196
|
label: 'field-legend',
|
|
212
197
|
required: 'is-required',
|
|
@@ -221,8 +206,6 @@ const DEFAULT_CLASS_NAMES: FormClassNames = {
|
|
|
221
206
|
select: 'j-select',
|
|
222
207
|
radio: 'j-radio',
|
|
223
208
|
checkbox: 'j-checkbox',
|
|
224
|
-
choiceVertical: 'is-vertical',
|
|
225
|
-
choiceHorizontal: 'is-horizontal',
|
|
226
209
|
choiceGroup: 'is-group',
|
|
227
210
|
radioLabel: 'radio-label',
|
|
228
211
|
radioText: 'radio-text',
|
|
@@ -249,8 +232,6 @@ const FORM_PROPS_SCHEMA = {
|
|
|
249
232
|
return value;
|
|
250
233
|
},
|
|
251
234
|
},
|
|
252
|
-
vertical: { default: true, type: 'boolean' },
|
|
253
|
-
itemVertical: { default: true, type: 'boolean' },
|
|
254
235
|
size: { default: 'md', type: 'string' },
|
|
255
236
|
style: { default: '', types: ['string', 'object', 'null'] },
|
|
256
237
|
fields: { default: [], type: 'array' },
|
|
@@ -429,8 +410,6 @@ function normalizeProps(input: FormProps): ResolvedFormProps {
|
|
|
429
410
|
return {
|
|
430
411
|
...props,
|
|
431
412
|
id: String(props.id),
|
|
432
|
-
vertical: Boolean(props.vertical),
|
|
433
|
-
itemVertical: Boolean(props.itemVertical),
|
|
434
413
|
size: props.size as string,
|
|
435
414
|
style: props.style as FormStyle,
|
|
436
415
|
fields,
|
|
@@ -713,21 +692,15 @@ export function createForm(input: FormProps = {}): Form {
|
|
|
713
692
|
return jsx('div', {
|
|
714
693
|
className: () => {
|
|
715
694
|
const field = fieldAccessor();
|
|
716
|
-
const direction = field.vertical ? 'vertical' : 'horizontal';
|
|
717
695
|
const names = props.className;
|
|
718
696
|
return joinClasses(
|
|
719
697
|
type === 'radio' ? names.radio : names.checkbox,
|
|
720
|
-
direction === 'vertical'
|
|
721
|
-
? names.choiceVertical
|
|
722
|
-
: names.choiceHorizontal,
|
|
723
698
|
field.group ? names.choiceGroup : '',
|
|
724
699
|
field.size ? `is-${field.size}` : ''
|
|
725
700
|
);
|
|
726
701
|
},
|
|
727
702
|
'data-field-choice-group': () => fieldAccessor().name || id,
|
|
728
703
|
'data-choice-type': type,
|
|
729
|
-
'data-choice-layout': () =>
|
|
730
|
-
fieldAccessor().vertical ? 'vertical' : 'horizontal',
|
|
731
704
|
children: () =>
|
|
732
705
|
(fieldAccessor().options || []).map((option, optionIndex) => {
|
|
733
706
|
const item = normalizeOption(option);
|
|
@@ -1090,23 +1063,10 @@ export function createForm(input: FormProps = {}): Form {
|
|
|
1090
1063
|
},
|
|
1091
1064
|
view: () => {
|
|
1092
1065
|
const element = jsx('form', {
|
|
1093
|
-
className: joinClasses(
|
|
1094
|
-
props.className.form,
|
|
1095
|
-
props.vertical
|
|
1096
|
-
? props.className.vertical
|
|
1097
|
-
: props.className.horizontal,
|
|
1098
|
-
props.itemVertical
|
|
1099
|
-
? props.className.itemVertical
|
|
1100
|
-
: props.className.itemHorizontal,
|
|
1101
|
-
formSizeClass()
|
|
1102
|
-
),
|
|
1066
|
+
className: joinClasses(props.className.form, formSizeClass()),
|
|
1103
1067
|
id: props.id,
|
|
1104
1068
|
novalidate: props.validator.vanilla === false,
|
|
1105
1069
|
'data-form': 'root',
|
|
1106
|
-
'data-form-layout': props.vertical ? 'vertical' : 'horizontal',
|
|
1107
|
-
'data-form-field-layout': props.itemVertical
|
|
1108
|
-
? 'vertical'
|
|
1109
|
-
: 'horizontal',
|
|
1110
1070
|
onSubmit: (event: Event) => void handleSubmit(event),
|
|
1111
1071
|
onReset: (event: Event) => {
|
|
1112
1072
|
resetValidationState();
|
package/src/css/form.css
CHANGED
|
@@ -5,14 +5,9 @@
|
|
|
5
5
|
display: flex;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
.j-form
|
|
8
|
+
.j-form {
|
|
9
9
|
flex-direction: column;
|
|
10
|
-
gap: var(--
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.j-form.is-horizontal {
|
|
14
|
-
flex-direction: row;
|
|
15
|
-
gap: var(--s2);
|
|
10
|
+
gap: var(--s3);
|
|
16
11
|
}
|
|
17
12
|
|
|
18
13
|
.j-form .form-field {
|
|
@@ -23,47 +18,23 @@
|
|
|
23
18
|
.j-form fieldset.form-field {
|
|
24
19
|
border: 0;
|
|
25
20
|
padding: 0;
|
|
26
|
-
min-inline-size: 0;
|
|
27
21
|
}
|
|
28
22
|
|
|
29
|
-
.j-form
|
|
23
|
+
.j-form .form-field {
|
|
30
24
|
flex-direction: column;
|
|
31
25
|
}
|
|
32
26
|
|
|
33
|
-
.j-form.is-item-horizontal .form-field {
|
|
34
|
-
flex-direction: row;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
27
|
.j-form .form-field .field-legend {
|
|
38
28
|
color: var(--ui-fg-muted);
|
|
39
29
|
font-size: var(--font-size-sm);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.j-form .form-field > legend.field-legend {
|
|
43
|
-
padding: 0;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.j-form .form-field .field-legend,
|
|
47
|
-
.j-form .form-field .field-control {
|
|
48
30
|
gap: var(--space);
|
|
49
31
|
}
|
|
50
32
|
|
|
51
|
-
.j-form.is-horizontal .form-field .field-legend {
|
|
52
|
-
align-items: center;
|
|
53
|
-
height: var(--el-height-md);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
33
|
.j-form .field-legend.is-required::after {
|
|
57
34
|
content: '*';
|
|
58
35
|
color: var(--state-danger);
|
|
59
36
|
}
|
|
60
37
|
|
|
61
|
-
.j-form .form-field .field-control {
|
|
62
|
-
display: flex;
|
|
63
|
-
flex-direction: column;
|
|
64
|
-
margin: 0;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
38
|
.j-form .form-field .field-control .help-block {
|
|
68
39
|
font-size: var(--font-size-sm);
|
|
69
40
|
color: var(--ui-fg-soft);
|
|
@@ -77,17 +48,13 @@
|
|
|
77
48
|
.j-form .form-buttons {
|
|
78
49
|
display: flex;
|
|
79
50
|
gap: var(--s2);
|
|
80
|
-
margin-top:
|
|
51
|
+
margin-top: var(--s2);
|
|
81
52
|
}
|
|
82
53
|
|
|
83
54
|
.j-form [data-field-buttons] button {
|
|
84
55
|
position: relative;
|
|
85
56
|
}
|
|
86
57
|
|
|
87
|
-
.j-form.is-horizontal .form-buttons {
|
|
88
|
-
margin: 0;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
58
|
/* input */
|
|
92
59
|
.j-input {
|
|
93
60
|
font-size: var(--input-font-size);
|
|
@@ -96,7 +63,6 @@
|
|
|
96
63
|
}
|
|
97
64
|
|
|
98
65
|
.j-input:not([type='checkbox']) {
|
|
99
|
-
/* display: block; */
|
|
100
66
|
border-width: 1px;
|
|
101
67
|
border-style: solid;
|
|
102
68
|
border-color: var(--ui-border);
|
|
@@ -520,9 +486,9 @@
|
|
|
520
486
|
cursor: not-allowed;
|
|
521
487
|
}
|
|
522
488
|
|
|
523
|
-
.j-form
|
|
524
|
-
.j-form
|
|
525
|
-
.j-form
|
|
489
|
+
.j-form input.j-input:not([type='checkbox']):not([type='radio']),
|
|
490
|
+
.j-form select.j-select,
|
|
491
|
+
.j-form textarea.j-textarea {
|
|
526
492
|
width: 100%;
|
|
527
493
|
}
|
|
528
494
|
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
@layer themes {
|
|
2
|
-
.j-form.is-lg {
|
|
3
|
-
--form-gap-vertical: var(--s3);
|
|
4
|
-
--form-gap-horizontal: var(--s3);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
2
|
.j-input {
|
|
8
3
|
--input-font-size: var(--font-size-md);
|
|
9
4
|
--input-bg: inherit;
|
|
@@ -87,7 +82,6 @@
|
|
|
87
82
|
--btn-fg: var(--ui-fg-muted);
|
|
88
83
|
--btn-bg: var(--ui-bg-muted);
|
|
89
84
|
--btn-padding: 0 var(--s2);
|
|
90
|
-
/* --btn-box-shadow: none; */
|
|
91
85
|
}
|
|
92
86
|
|
|
93
87
|
.input-group .el-addon .is-text {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
@layer themes {
|
|
2
2
|
.j-tip {
|
|
3
3
|
--tip-border-color: var(--ui-border);
|
|
4
|
-
--tip-fg: var(--ui-fg);
|
|
5
4
|
--tip-bg: var(--ui-bg);
|
|
6
5
|
|
|
7
6
|
row-gap: var(--s2);
|
|
@@ -12,17 +11,21 @@
|
|
|
12
11
|
border-radius: var(--radius-md);
|
|
13
12
|
padding: var(--s3) var(--s4);
|
|
14
13
|
font-size: var(--font-size-md);
|
|
15
|
-
color: var(--tip-fg);
|
|
16
14
|
background: var(--tip-bg);
|
|
17
|
-
box-shadow: var(--shadow-
|
|
15
|
+
box-shadow: var(--shadow-xs);
|
|
16
|
+
backdrop-filter: blur(2px);
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
.j-tip .tip-icon {
|
|
21
|
-
color: var(--tip-fg);
|
|
22
20
|
transform: translateY(calc(var(--space, 0.25rem) * 0.5));
|
|
23
21
|
margin: 0;
|
|
24
22
|
}
|
|
25
23
|
|
|
24
|
+
.j-tip .tip-icon,
|
|
25
|
+
.j-tip .tip-title {
|
|
26
|
+
color: var(--tip-fg);
|
|
27
|
+
}
|
|
28
|
+
|
|
26
29
|
.j-tip .tip-icon,
|
|
27
30
|
.j-tip .tip-icon svg {
|
|
28
31
|
width: var(--font-size-xl);
|
|
@@ -30,29 +33,30 @@
|
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
.j-tip .tip-title {
|
|
33
|
-
/* line-height: var(--line-height-paragraph); */
|
|
34
36
|
font-weight: var(--font-medium);
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
.j-tip.is-primary {
|
|
40
|
+
--tip-border-color: var(--state-info-border);
|
|
41
|
+
--tip-bg: var(--state-info-soft);
|
|
42
|
+
--tip-fg: var(--state-info-text);
|
|
43
|
+
}
|
|
40
44
|
|
|
41
45
|
.j-tip.is-success {
|
|
42
|
-
--tip-border-color: var(--state-success);
|
|
43
|
-
--tip-bg: var(--state-success-
|
|
44
|
-
--tip-fg: var(--state-success);
|
|
46
|
+
--tip-border-color: var(--state-success-border);
|
|
47
|
+
--tip-bg: var(--state-success-soft);
|
|
48
|
+
--tip-fg: var(--state-success-text);
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
.j-tip.is-warning {
|
|
48
|
-
--tip-border-color: var(--state-warning);
|
|
49
|
-
--tip-bg: var(--state-warning-
|
|
50
|
-
--tip-fg: var(--state-warning);
|
|
52
|
+
--tip-border-color: var(--state-warning-border);
|
|
53
|
+
--tip-bg: var(--state-warning-soft);
|
|
54
|
+
--tip-fg: var(--state-warning-text);
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
.j-tip.is-danger {
|
|
54
|
-
--tip-border-color: var(--state-danger);
|
|
55
|
-
--tip-bg: var(--state-danger-
|
|
56
|
-
--tip-fg: var(--state-danger);
|
|
58
|
+
--tip-border-color: var(--state-danger-border);
|
|
59
|
+
--tip-bg: var(--state-danger-soft);
|
|
60
|
+
--tip-fg: var(--state-danger-text);
|
|
57
61
|
}
|
|
58
62
|
}
|
package/src/css/tip.css
CHANGED