@alacris/ui 0.3.0 → 0.4.0
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 +33 -2
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.
|
|
51
|
-
"@alacris/ui/theme": "https://cdn.jsdelivr.net/npm/@alacris/ui@0.
|
|
52
|
-
"@alacris/ui/components/": "https://cdn.jsdelivr.net/npm/@alacris/ui@0.
|
|
49
|
+
"@alacris/core": "https://cdn.jsdelivr.net/npm/@alacris/core@0.11.3/dist/alacris.js",
|
|
50
|
+
"@alacris/ui": "https://cdn.jsdelivr.net/npm/@alacris/ui@0.4.0/src/index.js",
|
|
51
|
+
"@alacris/ui/theme": "https://cdn.jsdelivr.net/npm/@alacris/ui@0.4.0/src/theme/index.js",
|
|
52
|
+
"@alacris/ui/components/": "https://cdn.jsdelivr.net/npm/@alacris/ui@0.4.0/src/components/"
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
</script>
|
package/package.json
CHANGED
|
@@ -12,7 +12,16 @@
|
|
|
12
12
|
// @prop {boolean} clearable=false — trailing ✕ while there is content
|
|
13
13
|
// @prop {string} name='' — form participation
|
|
14
14
|
// @prop {number} maxlength=0 — >0 shows a character counter and enforces it
|
|
15
|
-
// @prop {number} rows=3
|
|
15
|
+
// @prop {number} rows=3
|
|
16
|
+
// @prop {string} autocomplete='' — absent unless set; 'off' keeps the
|
|
17
|
+
// browser's saved-value list out of a
|
|
18
|
+
// field whose contents are not a name,
|
|
19
|
+
// an address or a password
|
|
20
|
+
// @prop {string} autocapitalize='' — 'off' for anything case-sensitive
|
|
21
|
+
// @prop {string} autocorrect='' — 'off' to stop substitutions
|
|
22
|
+
// @prop {string} spellcheck='' — 'false' for code and query syntax
|
|
23
|
+
// @prop {string} inputmode=''
|
|
24
|
+
// @prop {string} enterkeyhint='' — textarea rows
|
|
16
25
|
// @event input — every keystroke; detail: { value }
|
|
17
26
|
// @event change — committed (blur/Enter); detail: { value }
|
|
18
27
|
// @event clear — the clear affordance was used
|
|
@@ -284,10 +293,20 @@ define('ui-text-field', {
|
|
|
284
293
|
variant: 'filled', label: '', value: '', type: 'text', placeholder: '',
|
|
285
294
|
helper: '', error: '', disabled: false, required: false, clearable: false,
|
|
286
295
|
name: '', maxlength: 0, rows: 3,
|
|
296
|
+
// A field the platform must keep its hands off has to be able to say so.
|
|
297
|
+
// These are absent unless set, so nothing changes for an ordinary field.
|
|
298
|
+
autocomplete: '', autocapitalize: '', autocorrect: '', spellcheck: '',
|
|
299
|
+
inputmode: '', enterkeyhint: '',
|
|
287
300
|
},
|
|
288
301
|
styles: [base, styles],
|
|
289
302
|
setup(p, host) {
|
|
290
|
-
const { variant, label, value, type, placeholder, helper, error, disabled, required, clearable, name, maxlength, rows
|
|
303
|
+
const { variant, label, value, type, placeholder, helper, error, disabled, required, clearable, name, maxlength, rows,
|
|
304
|
+
autocomplete, autocapitalize, autocorrect, spellcheck, inputmode, enterkeyhint } = p;
|
|
305
|
+
|
|
306
|
+
// An empty prop means "say nothing", so the browser keeps its default.
|
|
307
|
+
// Writing the attribute as an empty string would not: autocomplete="" is
|
|
308
|
+
// a value, and spellcheck="" reads as spellcheck="true".
|
|
309
|
+
const attr = (sig) => () => (sig() === '' ? null : sig());
|
|
291
310
|
formBind(host, { name, value, disabled });
|
|
292
311
|
|
|
293
312
|
const focused = signal(false);
|
|
@@ -325,6 +344,12 @@ define('ui-text-field', {
|
|
|
325
344
|
maxlength=${() => (maxlength() > 0 ? maxlength() : null)}
|
|
326
345
|
?required=${required} ?disabled=${disabled}
|
|
327
346
|
aria-invalid=${() => (error() ? 'true' : null)}
|
|
347
|
+
autocomplete=${attr(autocomplete)}
|
|
348
|
+
autocapitalize=${attr(autocapitalize)}
|
|
349
|
+
autocorrect=${attr(autocorrect)}
|
|
350
|
+
spellcheck=${attr(spellcheck)}
|
|
351
|
+
inputmode=${attr(inputmode)}
|
|
352
|
+
enterkeyhint=${attr(enterkeyhint)}
|
|
328
353
|
@input=${onInput} @change=${commit}
|
|
329
354
|
@focus=${() => focused.set(true)} @blur=${() => focused.set(false)}></textarea></span>`
|
|
330
355
|
: html`<input part="input" ref=${(el) => (input = el)}
|
|
@@ -333,6 +358,12 @@ define('ui-text-field', {
|
|
|
333
358
|
maxlength=${() => (maxlength() > 0 ? maxlength() : null)}
|
|
334
359
|
?required=${required} ?disabled=${disabled}
|
|
335
360
|
aria-invalid=${() => (error() ? 'true' : null)}
|
|
361
|
+
autocomplete=${attr(autocomplete)}
|
|
362
|
+
autocapitalize=${attr(autocapitalize)}
|
|
363
|
+
autocorrect=${attr(autocorrect)}
|
|
364
|
+
spellcheck=${attr(spellcheck)}
|
|
365
|
+
inputmode=${attr(inputmode)}
|
|
366
|
+
enterkeyhint=${attr(enterkeyhint)}
|
|
336
367
|
@input=${onInput} @change=${commit}
|
|
337
368
|
@focus=${() => focused.set(true)} @blur=${() => focused.set(false)}>`)}
|
|
338
369
|
${() => (clearable() && value() !== '' && !disabled()
|