@alacris/ui 0.2.2 → 0.2.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/README.md +4 -4
- package/package.json +1 -1
- package/src/components/ui-text-field.js +45 -1
package/README.md
CHANGED
|
@@ -46,10 +46,10 @@ The published package is plain ESM. Point an import map at a pinned CDN build of
|
|
|
46
46
|
<script type="importmap">
|
|
47
47
|
{
|
|
48
48
|
"imports": {
|
|
49
|
-
"@alacris/core": "https://cdn.jsdelivr.net/npm/@alacris/core@0.11.
|
|
50
|
-
"@alacris/ui": "https://cdn.jsdelivr.net/npm/@alacris/ui@0.2.
|
|
51
|
-
"@alacris/ui/theme": "https://cdn.jsdelivr.net/npm/@alacris/ui@0.2.
|
|
52
|
-
"@alacris/ui/components/": "https://cdn.jsdelivr.net/npm/@alacris/ui@0.2.
|
|
49
|
+
"@alacris/core": "https://cdn.jsdelivr.net/npm/@alacris/core@0.11.1/dist/alacris.js",
|
|
50
|
+
"@alacris/ui": "https://cdn.jsdelivr.net/npm/@alacris/ui@0.2.4/src/index.js",
|
|
51
|
+
"@alacris/ui/theme": "https://cdn.jsdelivr.net/npm/@alacris/ui@0.2.4/src/theme/index.js",
|
|
52
|
+
"@alacris/ui/components/": "https://cdn.jsdelivr.net/npm/@alacris/ui@0.2.4/src/components/"
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
</script>
|
package/package.json
CHANGED
|
@@ -37,6 +37,11 @@ const t = vars('ui-text-field', {
|
|
|
37
37
|
radius: sys.radius.xs,
|
|
38
38
|
font: sys.type.bodyLg,
|
|
39
39
|
height: '56px',
|
|
40
|
+
|
|
41
|
+
// The lane reserved at the end of a number field for its stepper. It is a
|
|
42
|
+
// variable because the buttons are the browser's and their width is not the
|
|
43
|
+
// same on every engine — a consumer with a denser field can shorten it.
|
|
44
|
+
stepperWidth: '18px',
|
|
40
45
|
});
|
|
41
46
|
|
|
42
47
|
const styles = css`
|
|
@@ -217,6 +222,44 @@ const styles = css`
|
|
|
217
222
|
.filled.has-label textarea { padding-top: ${sys.space(7)}; }
|
|
218
223
|
.with-leading.multiline .field { padding-inline-start: ${sys.space(4)}; }
|
|
219
224
|
.with-leading.multiline textarea { padding-inline-start: 0; }
|
|
225
|
+
/* A number field's spin buttons are laid out at the inline end of the
|
|
226
|
+
input's *content* box rather than at the edge of the field. That is the
|
|
227
|
+
opposite of what it looks like, and it is why the obvious fix makes
|
|
228
|
+
things worse: padding the input to reserve a lane for them moves the end
|
|
229
|
+
of the content box inward and takes the buttons with it, so they land
|
|
230
|
+
further onto the label than they started. That is what shipped in 0.2.3
|
|
231
|
+
— a chevron sitting on the "n" of "Min", clipped to a single arrow —
|
|
232
|
+
and it was a regression, not the original complaint.
|
|
233
|
+
|
|
234
|
+
They cannot be moved out of the way either: margin-inline-end on the
|
|
235
|
+
pseudo-element is ignored. So they are left where the browser puts them,
|
|
236
|
+
at the end of the field where there is already room, and only the label
|
|
237
|
+
and the legend are shortened, so a long one ellipsises before it reaches
|
|
238
|
+
the buttons rather than sliding underneath them. appearance:none does
|
|
239
|
+
not help here: it removes the field's own chrome and leaves the
|
|
240
|
+
::-webkit-*-spin-button alone, which is why this needs saying. */
|
|
241
|
+
.numeric .label {
|
|
242
|
+
max-inline-size: calc(100% - ${sys.space(4)} - ${t.stepperWidth});
|
|
243
|
+
overflow: hidden;
|
|
244
|
+
text-overflow: ellipsis;
|
|
245
|
+
white-space: nowrap;
|
|
246
|
+
}
|
|
247
|
+
.numeric legend { max-inline-size: calc(100% - ${t.stepperWidth}); }
|
|
248
|
+
.numeric input::-webkit-outer-spin-button,
|
|
249
|
+
.numeric input::-webkit-inner-spin-button {
|
|
250
|
+
/* Nudged off the text rather than sitting tight against it, and always
|
|
251
|
+
visible: a stepper that only appears on hover is a control nobody
|
|
252
|
+
knows is there. */
|
|
253
|
+
margin: 0;
|
|
254
|
+
margin-inline-start: ${sys.space(2)};
|
|
255
|
+
opacity: 1;
|
|
256
|
+
}
|
|
257
|
+
/* Firefox draws no buttons at all unless asked. Asking for them makes the
|
|
258
|
+
two engines agree about what a number field looks like. */
|
|
259
|
+
@supports (-moz-appearance: number-input) {
|
|
260
|
+
.numeric input { -moz-appearance: number-input; }
|
|
261
|
+
}
|
|
262
|
+
|
|
220
263
|
input::placeholder, textarea::placeholder { color: ${t.labelFg}; opacity: 0; transition: opacity ${sys.duration.short2} linear; }
|
|
221
264
|
.floating input::placeholder, .floating textarea::placeholder { opacity: 1; }
|
|
222
265
|
|
|
@@ -255,7 +298,8 @@ define('ui-text-field', {
|
|
|
255
298
|
const cls = computed(() =>
|
|
256
299
|
['root', variant(), floating() && 'floating', focused() && 'focused',
|
|
257
300
|
error() && 'error', disabled() && 'disabled', label() && 'has-label',
|
|
258
|
-
hasLeading() && 'with-leading', type() === 'textarea' && 'multiline'
|
|
301
|
+
hasLeading() && 'with-leading', type() === 'textarea' && 'multiline',
|
|
302
|
+
type() === 'number' && 'numeric'].filter(Boolean).join(' '));
|
|
259
303
|
|
|
260
304
|
const onInput = (e) => {
|
|
261
305
|
value.set(e.target.value);
|