vanilla-jui 1.7.8 → 1.7.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vanilla-jui",
3
- "version": "1.7.8",
3
+ "version": "1.7.9",
4
4
  "private": false,
5
5
  "description": "A lightweight, reactive, and fully customizable vanilla JS UI library.",
6
6
  "keywords": [
@@ -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.is-vertical {
8
+ .j-form {
9
9
  flex-direction: column;
10
- gap: var(--s2);
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,24 @@
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.is-item-vertical .form-field {
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 {
28
+ justify-content: space-between;
38
29
  color: var(--ui-fg-muted);
39
30
  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
31
  gap: var(--space);
49
32
  }
50
33
 
51
- .j-form.is-horizontal .form-field .field-legend {
52
- align-items: center;
53
- height: var(--el-height-md);
54
- }
55
-
56
34
  .j-form .field-legend.is-required::after {
57
35
  content: '*';
58
36
  color: var(--state-danger);
59
37
  }
60
38
 
61
- .j-form .form-field .field-control {
62
- display: flex;
63
- flex-direction: column;
64
- margin: 0;
65
- }
66
-
67
39
  .j-form .form-field .field-control .help-block {
68
40
  font-size: var(--font-size-sm);
69
41
  color: var(--ui-fg-soft);
@@ -77,17 +49,13 @@
77
49
  .j-form .form-buttons {
78
50
  display: flex;
79
51
  gap: var(--s2);
80
- margin-top: 1rem;
52
+ margin-top: var(--s2);
81
53
  }
82
54
 
83
55
  .j-form [data-field-buttons] button {
84
56
  position: relative;
85
57
  }
86
58
 
87
- .j-form.is-horizontal .form-buttons {
88
- margin: 0;
89
- }
90
-
91
59
  /* input */
92
60
  .j-input {
93
61
  font-size: var(--input-font-size);
@@ -96,7 +64,6 @@
96
64
  }
97
65
 
98
66
  .j-input:not([type='checkbox']) {
99
- /* display: block; */
100
67
  border-width: 1px;
101
68
  border-style: solid;
102
69
  border-color: var(--ui-border);
@@ -520,9 +487,9 @@
520
487
  cursor: not-allowed;
521
488
  }
522
489
 
523
- .j-form.is-vertical input.j-input:not([type='checkbox']):not([type='radio']),
524
- .j-form.is-vertical select.j-select,
525
- .j-form.is-vertical textarea.j-textarea {
490
+ .j-form input.j-input:not([type='checkbox']):not([type='radio']),
491
+ .j-form select.j-select,
492
+ .j-form textarea.j-textarea {
526
493
  width: 100%;
527
494
  }
528
495
 
@@ -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-sm);
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
- /* .j-tip .tip-content {
38
- line-height: var(--line-height-paragraph);
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-muted);
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-muted);
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-muted);
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
@@ -27,6 +27,7 @@
27
27
 
28
28
  .j-tip .tip-content {
29
29
  grid-column-start: 2;
30
+ color: var(--ui-gray);
30
31
  }
31
32
 
32
33
  .j-tip .tip-content > *:first-child {
@@ -33,8 +33,8 @@ export function createLoading(
33
33
  position: 'absolute',
34
34
  width: '100%',
35
35
  height: '100%',
36
- borderRadius: 'inherit',
37
- backdropFilter: 'blur(4px)',
36
+ // borderRadius: 'inherit',
37
+ // backdropFilter: 'blur(4px)',
38
38
  },
39
39
  children: i,
40
40
  });