alchemy-form 0.1.1 → 0.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/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ ## 0.1.4 (2022-03-16)
2
+
3
+ * Make fields work with the new `Alchemy.Map.Backed` and `Alchemy.Map.Enum` class
4
+ * Add the `field_path_in_current_schema` property
5
+ * Make sure `alchemy-fields` know which `alchemy-form` they belong to
6
+ * Improve the `original_value` getters
7
+ * Set the `field-type` attribute of `alchemy-field` elements
8
+ * Fix `alchemy-field` elements sometimes not getting their value elements
9
+
10
+ ## 0.1.3 (2022-02-20)
11
+
12
+ * Fix datetime fields never showing their value
13
+ * `alchemy-table` elements will now ignore old loadRemote responses
14
+ * The `index` property of a `alchemy-field-array-entry` element will now return the current, actual index
15
+ * Fix `schema` fields breaking when their schema depends on another field
16
+ * Populate `alchemy-form` with violations from the widget context
17
+ * Fix `alchemy-label` not always focusing on input after clicking on it
18
+ * Fix `alchemy-string-input` element and add `alchemy-number-input`
19
+ * Fix `alchemy-field` not setting the `for` attribute of its label
20
+
21
+ ## 0.1.2 (2022-01-28)
22
+
23
+ * Add readonly attribute to fields
24
+ * Clear text input on focus out + improve accessibility of alchemy-select
25
+ * Add widget settings to alchemy-field
26
+ * Enable setting the language mode of ace editor
27
+
1
28
  ## 0.1.1 (2021-09-12)
2
29
 
3
30
  * `alchemy-table` will now use the `FieldConfig#getDisplayValueIn(data)` method
@@ -0,0 +1,336 @@
1
+ @import "./general/index.scss";
2
+
3
+ .textareabox,
4
+ .inputbox {
5
+ $inputbox: &;
6
+ position: relative;
7
+ display: flex;
8
+ flex-grow: 1;
9
+
10
+ background: var(--color-input-border, $color-input-border);
11
+
12
+ .input {
13
+ display: block;
14
+ flex-grow: 1;
15
+ margin: 0.1rem;
16
+ border: 1px solid transparent;
17
+ outline: none;
18
+ padding: 1.2rem 2.2rem;
19
+ min-width: 0;
20
+
21
+ background-color: var(--color-input-background, $color-input-input-background);
22
+
23
+ font-size: $text-size-input-input;
24
+ color: var(--color-input-input, $color-input-input);
25
+ transition: border-color 0.2s ease-in;
26
+
27
+ &:focus {
28
+ border-color: var(--color-input-focus);
29
+ }
30
+ }
31
+
32
+ &.error {
33
+ background: var(--color-input-border-error, $color-input-border-error);
34
+ }
35
+
36
+ &.valid {
37
+ background: var(--color-input-border-filled, $color-input-border-filled);
38
+
39
+ &.focus {
40
+ background: var(--color-input-border-success, $color-input-border-success);
41
+ }
42
+ }
43
+ }
44
+
45
+ .inputfield,
46
+ alchemy-string-input {
47
+ $inputfield: &;
48
+ position: relative;
49
+ display: flex;
50
+ flex-direction: column;
51
+ margin: 0;
52
+
53
+ & +.rest-fields > string-input:first-of-type {
54
+ margin-top: 3rem;
55
+ }
56
+
57
+ .inputgrid + &,
58
+ &:not(.column) + &:not(.column) {
59
+ margin-top: 3rem;
60
+ }
61
+
62
+ &.closer {
63
+ margin-top: 1.5rem;
64
+ }
65
+
66
+ .connect {
67
+ &:not(:first-of-type) {
68
+ margin-top: 3rem;
69
+ }
70
+ }
71
+
72
+ &.valid {
73
+ .icon {
74
+ &.cross {
75
+ display: none;
76
+ }
77
+
78
+ &.checkmark {
79
+ display: block;
80
+ }
81
+ }
82
+ }
83
+
84
+ &.error {
85
+ .icon {
86
+ &.cross {
87
+ display: block;
88
+ }
89
+
90
+ &.checkmark {
91
+ display: none;
92
+ }
93
+ }
94
+ }
95
+
96
+ .icon {
97
+ display: none;
98
+ position: absolute;
99
+ height: auto;
100
+ top: 50%;
101
+ right: 1rem;
102
+
103
+ transform: translateY(-50%) scale(0) rotate(10deg);
104
+ animation: icon--show 200ms ease-out forwards;
105
+
106
+ &.cross {
107
+ //@extend .customicon, .customicon-cross;
108
+ font-size: 1rem;
109
+ color: var(--color-input-cross, $color-input-cross);
110
+
111
+ &:before {
112
+ content: "❌";
113
+ }
114
+ }
115
+
116
+ &.checkmark {
117
+ //@extend .customicon, .customicon-checkmark;
118
+ font-size: 1.2rem;
119
+ color: var(--color-input-checkmark, $color-input-checkmark);
120
+
121
+ &:before {
122
+ content: "✔";
123
+ }
124
+ }
125
+
126
+ &.locked {
127
+ color: var(--color-input-checkmark, $color-input-checkmark);
128
+ }
129
+ }
130
+
131
+ &[readonly],
132
+ &[readonly].valid {
133
+ .checkmark,
134
+ .cross {
135
+ display: none;
136
+ }
137
+
138
+ .locked {
139
+ display: block;
140
+ }
141
+
142
+ &,
143
+ input {
144
+ cursor: default;
145
+ }
146
+ }
147
+
148
+ .meta,
149
+ .errors,
150
+ .success {
151
+ margin-top: 1.8rem;
152
+
153
+ &:empty {
154
+ display: none;
155
+ }
156
+ }
157
+
158
+ .meta {
159
+ font-weight: 600;
160
+ font-size: $text-size-inputfield-meta;
161
+ color: var(--color-inputfield-meta, $color-inputfield-meta);
162
+ }
163
+
164
+ .inputlabel {
165
+
166
+ .spacer {
167
+ display: none;
168
+ }
169
+
170
+ .label:not(:empty) ~ .spacer,
171
+ .description:not(:empty) ~ .spacer {
172
+ display: block;
173
+ margin-bottom: 0.5rem;
174
+ }
175
+ }
176
+ }
177
+
178
+ alchemy-string-input {
179
+ .inputlabel {
180
+ .label {
181
+ margin-bottom: 0 !important;
182
+ }
183
+ }
184
+ }
185
+
186
+ alchemy-password-input {
187
+ @extend alchemy-string-input;
188
+
189
+ & > label:first-of-type {
190
+ margin-bottom: 2rem;
191
+ }
192
+ }
193
+
194
+ @keyframes icon--show {
195
+ 0% {
196
+ transform: translateY(-50%) scale(0) rotate(-30deg);
197
+ }
198
+
199
+ 100% {
200
+ transform: translateY(-50%) scale(1) rotate(0deg);
201
+ }
202
+ }
203
+
204
+ .inputlabel {
205
+ display: flex;
206
+ flex-direction: column;
207
+
208
+ .label {
209
+ color: var(--color-inputlabel-label);
210
+ font-weight: 700;
211
+ font-size: $text-size-inputlabel-label;
212
+ margin-bottom: 0.5rem;
213
+ }
214
+
215
+ .description {
216
+ margin-top: .4em;
217
+
218
+ color: var(--color-inputlabel-description);
219
+ font-size: $text-size-inputlabel-description;
220
+ }
221
+ }
222
+
223
+ .errorlabel {
224
+ display: flex;
225
+ justify-content: flex-start;
226
+ align-items: center;
227
+
228
+ font-size: $text-size-errorlabel;
229
+ color: var(--color--errorlabel, $color-errorlabel);
230
+
231
+ .erroricon {
232
+ font-style: normal;
233
+
234
+ &:before {
235
+ content: "❌";
236
+ }
237
+
238
+ margin-right: 1rem;
239
+ }
240
+
241
+ strong {
242
+ color: var(--color-errorlabel-accent, $color-errorlabel-accent);
243
+ }
244
+ }
245
+
246
+ .successlabel {
247
+ font-size: $text-size-successlabel;
248
+ color: var(--color-successlabel, $color-successlabel);
249
+ font-weight: initial;
250
+
251
+ strong {
252
+ color: var(--color-successlabel-accent, $color-successlabel-accent);
253
+ }
254
+ }
255
+
256
+ alchemy-number-input {
257
+ $numberinput: &;
258
+ display: flex;
259
+ flex-flow: column wrap;
260
+ justify-content: center;
261
+ align-items: center;
262
+
263
+ .label {
264
+ margin-bottom: 0 !important;
265
+ width: 100%;
266
+
267
+ color: var(--color-numberinput-label, $color-numberinput-label);
268
+ font-size: $text-size-numberinput-label;
269
+ text-align: center;
270
+ }
271
+
272
+ .control {
273
+ cursor: pointer;
274
+ border: 0;
275
+ outline: 0;
276
+ padding: 0;
277
+ background: transparent;
278
+ min-width: 3.5rem;
279
+
280
+ font-size: $text-size-numberinput-control;
281
+ line-height: 0.8;
282
+
283
+ &:disabled {
284
+ cursor: default;
285
+ opacity: 0.5;
286
+ }
287
+
288
+ &.minus {
289
+ &:before {
290
+ content: "-";
291
+ }
292
+ //@extend .iconpack, .iconpack-less;
293
+ }
294
+
295
+ &.plus {
296
+ &:before {
297
+ content: "+";
298
+ }
299
+ //@extend .iconpack, .iconpack-plus;
300
+ }
301
+ }
302
+
303
+ .input {
304
+ margin: 0 2rem;
305
+ border: 0;
306
+ appearance: none;
307
+ -moz-appearance: textfield;
308
+ padding: 2rem 1rem;
309
+ width: 12rem;
310
+
311
+ color: var(--color-numberinput-input, $color-numberinput-input);
312
+ font-size: $text-size-numberinput-input;
313
+ font-weight: 800;
314
+ text-align: center;
315
+
316
+ background-color: var(--color-numberinput-background, $color-numberinput-background);
317
+
318
+ &::-webkit-inner-spin-button,
319
+ &::-webkit-outer-spin-button {
320
+ -webkit-appearance: none;
321
+ margin: 0;
322
+ }
323
+ }
324
+
325
+ .label {
326
+ #{ $numberinput }__label {
327
+ display: block;
328
+ }
329
+ }
330
+
331
+ .inputlabel {
332
+ .description:empty {
333
+ display: none;
334
+ }
335
+ }
336
+ }
@@ -3,6 +3,12 @@ alchemy-select {
3
3
  position: relative;
4
4
  display: block;
5
5
 
6
+ --active-item-bg: #a7deff;
7
+ --active-item-fg: #272727;
8
+
9
+ --selected-item-bg: #31317a;
10
+ --selected-item-fg: #f5f5f5;
11
+
6
12
  .dropdown-content,
7
13
  .value-wrapper,
8
14
  .dropdown {
@@ -10,8 +16,6 @@ alchemy-select {
10
16
  }
11
17
 
12
18
  &:focus {
13
- outline: 0 !important;
14
-
15
19
  .value-wrapper {
16
20
  border-color: rgba(82, 168, 236, 0.8) !important;
17
21
  }
@@ -31,6 +35,12 @@ alchemy-select {
31
35
  flex-wrap: wrap;
32
36
  //box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1);
33
37
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
38
+
39
+ align-items: center;
40
+
41
+ input.type-area {
42
+ height: 1.5rem;
43
+ }
34
44
  }
35
45
 
36
46
  &[aria-expanded="true"] .value-wrapper {
@@ -149,11 +159,15 @@ alchemy-select {
149
159
  .dropdown [role="option"] {
150
160
 
151
161
  &:hover,
152
- &.focused,
153
- &[selected] {
162
+ &.focused {
154
163
  background-color: var(--active-item-bg, #f5fafd);
155
164
  color: var(--active-item-fg, #495c68);
156
165
  }
166
+
167
+ &[selected] {
168
+ background-color: var(--selected-item-bg, #f5fafd);
169
+ color: var(--selected-item-fg, #495c68);
170
+ }
157
171
  }
158
172
 
159
173
  &[aria-expanded="true"] .dropdown {
@@ -0,0 +1,114 @@
1
+ $color-dark: #000000;
2
+ $color-light: #ffffff;
3
+
4
+ $color-scorpion: #585858;
5
+ $color-mineshaft: #383838;
6
+ $color-silverchalice: #a8a8a8;
7
+ $color-mercury: #e8e8e8;
8
+ $color-gray: #888888;
9
+ $color-alto: #dddddd;
10
+ $color-mineshaft: #282828;
11
+ $color-alabaster: #f7f7f7;
12
+ $color-dustygray: #989898;
13
+ $color-concrete: #f2f2f2;
14
+
15
+ $color-light-gray: #e3e3e3;
16
+ $color-light-dark: #1c1c1c;
17
+
18
+ $color-red: #e5002d;
19
+ $color-guardsman: #cc0000;
20
+ $color-green: #87dd0e;
21
+ $color-jungle-green: #31c063;
22
+ $color-science: #0066cc;
23
+ $color-sunglow: #ffc132;
24
+ $color-bittersweet: #ff6b6b;
25
+
26
+ $color-facebook: #3a579a;
27
+ $color-messenger: #007fff;
28
+ $color-whatsapp: #57bb63;
29
+ $color-sms: #40c088;
30
+
31
+ $color-selectlistitem-background: $color-light;
32
+ $color-selectlistitem-background-hover: $color-concrete;
33
+ $color-selectlistitem-heading: $color-dark;
34
+ $color-selectlistitem-title: $color-gray;
35
+ $color-selectlistitem-subtitle: $color-gray;
36
+ $color-selectlistitem-description: $color-scorpion;
37
+ $color-selectlistitem-title-selected: $color-dark;
38
+ $color-selectlistitem-value: $color-dustygray;
39
+ $color-selectlistitem-value-selected: $color-dark;
40
+ $color-selectlistitem-checkmark-fill: $color-green;
41
+
42
+ $color-meta: $color-dark;
43
+ $color-meta-facebook: $color-facebook;
44
+ $color-meta-success: $color-green;
45
+ $color-meta-error: $color-red;
46
+ $color-meta-info: $color-science;
47
+ $color-meta-extra: $color-scorpion;
48
+
49
+ $color-button-hover: $color-dark;
50
+ $color-button-hover-dark: $color-light;
51
+ $color-button-color: $color-dark;
52
+ $color-button-light-color: $color-light;
53
+ $color-button-shadow: rgba($color-dark, 0.15);
54
+ $color-button-background: $color-light;
55
+ $color-button-black-background: $color-dark;
56
+ $color-button-green-background: $color-green;
57
+ $color-button-gray-background: $color-gray;
58
+ $color-button-positive-background: $color-green;
59
+ $color-button-negative-background: $color-red;
60
+ $color-button-border: $color-mercury;
61
+ $color-button-mark: $color-green;
62
+ $color-button-light-gray-background: $color-light-gray;
63
+ $color-button-light-gray-color: $color-alabaster;
64
+
65
+ $color-inputfield-meta: $color-scorpion;
66
+
67
+ $color-numberinput-background: $color-light;
68
+ $color-numberinput-label: $color-dark;
69
+ $color-numberinput-input: $color-dark;
70
+
71
+ $color-numberselector-number-border: linear-gradient(
72
+ 0deg,
73
+ $color-alto,
74
+ $color-light
75
+ );
76
+ $color-numberselector-number-background: $color-light;
77
+ $color-numberselector-number-color: $color-dustygray;
78
+ $color-numberselector-number-color-hover: $color-dark;
79
+ $color-numberselector-number-background-hover: $color-alabaster;
80
+ $color-numberselector-number-active-color: $color-green;
81
+
82
+ $color-input-input: $color-dark;
83
+ $color-input-border: linear-gradient(0deg, $color-alto, $color-light);
84
+ $color-input-cross: $color-guardsman;
85
+ $color-input-checkmark: $color-green;
86
+ $color-input-input-background: $color-light;
87
+ $color-input-placeholder: $color-gray;
88
+ $color-input-border-error: linear-gradient(
89
+ 0deg,
90
+ $color-guardsman,
91
+ $color-alto 0.1rem,
92
+ $color-light
93
+ );
94
+ $color-input-border-filled: linear-gradient(
95
+ 0deg,
96
+ $color-dark,
97
+ $color-alto 0.1rem,
98
+ $color-light
99
+ );
100
+ $color-input-border-success: linear-gradient(
101
+ 0deg,
102
+ $color-green,
103
+ $color-alto 0.1rem,
104
+ $color-light
105
+ );
106
+
107
+ $color-inputlabel-label: $color-dark;
108
+ $color-inputlabel-description: $color-dark;
109
+
110
+ $color-errorlabel: $color-scorpion;
111
+ $color-errorlabel-accent: $color-guardsman;
112
+
113
+ $color-successlabel: $color-green;
114
+ $color-successlabel-accent: $color-green;
@@ -0,0 +1,55 @@
1
+ $text-size-xgiant: 6rem;
2
+ $text-size-giant: 4.5rem;
3
+ $text-size-xlarge: 4rem;
4
+ $text-size-large: 3.2rem;
5
+ $text-size-2xbig: 2.4rem;
6
+ $text-size-xbig: 2.2rem;
7
+ $text-size-big: 2rem;
8
+ $text-size-medium: 1.8rem;
9
+ $text-size-regular: 1.6rem;
10
+ $text-size-small: 1.3rem;
11
+ $text-size-xsmall: 1.2rem;
12
+ $text-size-tiny: 1rem;
13
+
14
+ $text-size-meta: $text-size-regular;
15
+ $text-size-meta-small: $text-size-small;
16
+ $text-size-meta-medium: $text-size-medium;
17
+ $text-size-meta-large: $text-size-big;
18
+ $text-size-meta-xlarge: $text-size-2xbig;
19
+ $text-size-meta-giant: $text-size-large;
20
+
21
+ $text-size-button: $text-size-regular;
22
+ $text-size-button-big: $text-size-2xbig;
23
+ $text-size-button-small: $text-size-xsmall;
24
+
25
+ $text-size-inputfield-meta: $text-size-small;
26
+
27
+ $text-size-numberinput-label: $text-size-medium;
28
+ $text-size-numberinput-control: $text-size-giant;
29
+ $text-size-numberinput-input: $text-size-2xbig;
30
+
31
+ $text-size-numberselector-number: $text-size-large;
32
+
33
+ $text-size-checkbox-info: $text-size-regular;
34
+
35
+ $text-size-checklistitem-title: $text-size-big;
36
+ $text-size-checklistitem-subtitle: $text-size-regular;
37
+ $text-size-checklistitem-suffix: $text-size-xsmall;
38
+
39
+ $text-size-input-input: $text-size-regular;
40
+ $text-size-input-message: $text-size-regular;
41
+
42
+ $text-size-infoblock-title: $text-size-xsmall;
43
+ $text-size-infoblock-value: $text-size-large;
44
+
45
+ $text-size-inputlabel-label: $text-size-big;
46
+ $text-size-inputlabel-description: $text-size-regular;
47
+
48
+ $text-size-errorlabel: $text-size-regular;
49
+
50
+ $text-size-successlabel: $text-size-regular;
51
+
52
+ $text-size-comboinput-item: $text-size-big;
53
+
54
+ $text-size-selectinput-item: $text-size-big;
55
+ $text-size-selectinput-item-suffix: $text-size-regular;
@@ -0,0 +1,2 @@
1
+ @import "_textsizes.scss";
2
+ @import "_colors.scss";