@threadlabs/looma 0.13.5 → 0.14.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/components/ui-button/ui-button.html +2 -1
- package/components/ui-checkbox/ui-checkbox.html +35 -0
- package/components/ui-combobox/ui-combobox.html +38 -3
- package/components/ui-icon/ui-icon.html +67 -7
- package/components/ui-input/ui-input.html +27 -0
- package/components/ui-input-group/ui-input-group.html +15 -0
- package/components/ui-radio/ui-radio.html +35 -0
- package/components/ui-select/ui-select.html +29 -3
- package/components/ui-switch/ui-switch.html +36 -0
- package/components/ui-textarea/ui-textarea.html +20 -0
- package/dist/index.js +17 -18
- package/package.json +1 -1
- package/styles/ui-button.css +3 -1
- package/styles/ui-checkbox.css +38 -0
- package/styles/ui-combobox.css +38 -1
- package/styles/ui-input-group.css +20 -0
- package/styles/ui-input.css +29 -0
- package/styles/ui-radio.css +38 -0
- package/styles/ui-select.css +29 -3
- package/styles/ui-switch.css +41 -0
- package/styles/ui-textarea.css +21 -0
- package/vanilla/UiCheckbox.d.ts +1 -0
- package/vanilla/UiCheckbox.js +1 -1
- package/vanilla/UiCombobox.d.ts +1 -1
- package/vanilla/UiCombobox.js +1 -1
- package/vanilla/UiIcon.js +1 -3
- package/vanilla/UiInput.d.ts +1 -0
- package/vanilla/UiInput.js +1 -1
- package/vanilla/UiRadio.d.ts +1 -0
- package/vanilla/UiRadio.js +1 -1
- package/vanilla/UiSelect.d.ts +1 -0
- package/vanilla/UiSelect.js +1 -1
- package/vanilla/UiSwitch.d.ts +1 -0
- package/vanilla/UiSwitch.js +1 -1
- package/vanilla/UiTextarea.d.ts +1 -0
- package/vanilla/UiTextarea.js +1 -1
- package/vue/UiButton.vue +2 -1
- package/vue/UiCheckbox.d.ts +2 -0
- package/vue/UiCheckbox.vue +34 -0
- package/vue/UiCombobox.d.ts +2 -2
- package/vue/UiCombobox.vue +39 -2
- package/vue/UiIcon.vue +337 -42
- package/vue/UiInput.d.ts +2 -0
- package/vue/UiInput.vue +41 -0
- package/vue/UiInputGroup.vue +15 -0
- package/vue/UiRadio.d.ts +2 -0
- package/vue/UiRadio.vue +34 -0
- package/vue/UiSelect.d.ts +2 -0
- package/vue/UiSelect.vue +34 -3
- package/vue/UiSwitch.d.ts +2 -0
- package/vue/UiSwitch.vue +35 -0
- package/vue/UiTextarea.d.ts +2 -0
- package/vue/UiTextarea.vue +27 -0
- package/vue/chunks/UiButton.js +1 -1
- package/vue/chunks/UiCheckbox.js +3 -2
- package/vue/chunks/UiCombobox.js +1 -1
- package/vue/chunks/UiIcon.js +950 -32
- package/vue/chunks/UiInput.js +7 -2
- package/vue/chunks/UiInputGroup.js +1 -1
- package/vue/chunks/UiRadio.js +3 -2
- package/vue/chunks/UiSelect.js +7 -2
- package/vue/chunks/UiSwitch.js +3 -2
- package/vue/chunks/UiTextarea.js +7 -2
- package/vue/components.css +368 -168
- package/components/ui-icon/ui-icon.js +0 -8
|
@@ -316,8 +316,9 @@
|
|
|
316
316
|
border-color: transparent;
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
+
/* The size states outrank :host, so sm is named too, or a small button would stay small. */
|
|
319
320
|
@media (pointer: coarse) {
|
|
320
|
-
:host {
|
|
321
|
+
:host, :host-state([size="sm"]) {
|
|
321
322
|
min-block-size: var(--ui-control-min-block-size);
|
|
322
323
|
}
|
|
323
324
|
}
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
<prop name="value" type="string" default="on"
|
|
15
15
|
>The value a form submits under name while the checkbox is checked, also reported in the change event's detail so one handler can tell checkboxes apart. on
|
|
16
16
|
by default, as on a native checkbox.</prop>
|
|
17
|
+
<prop name="size" type="sm | md | lg" default="md"
|
|
18
|
+
>Aligns the checkbox with fields and buttons of the same size. It keeps its box size; the label takes that size's field type size and its first line centres
|
|
19
|
+
in that control height (sm 2rem, lg 3rem by default), so in a row of inputs, selects, and buttons of one size it shares their height and their text
|
|
20
|
+
baseline. Under a coarse pointer an sm row grows to the 44px touch minimum, as they do. md is the standard layout.</prop>
|
|
17
21
|
<state name="internalChecked" :value="false"></state>
|
|
18
22
|
<event name="change" type="object({ checked: boolean, value: string, trigger: keyboard | pointer | programmatic })"></event>
|
|
19
23
|
</defs>
|
|
@@ -154,6 +158,37 @@
|
|
|
154
158
|
cursor: not-allowed;
|
|
155
159
|
}
|
|
156
160
|
|
|
161
|
+
/* A sized choice keeps its box and aligns instead: the label takes that size's field type size,
|
|
162
|
+
and the first line centres in that control height, so the label shares a row's baseline.
|
|
163
|
+
Multi-line labels and descriptions still grow downward from that first line. */
|
|
164
|
+
:host-state([size="sm"]) {
|
|
165
|
+
--_font: var(--ui-font-size-sm);
|
|
166
|
+
--_row: var(--ui-control-size-sm);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
:host-state([size="lg"]) {
|
|
170
|
+
--_font: var(--ui-font-size-md);
|
|
171
|
+
--_row: var(--ui-control-size-lg);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
:host-state([size="sm"]),
|
|
175
|
+
:host-state([size="lg"]) {
|
|
176
|
+
--_line: calc(var(--_font) * var(--ui-line-height-md));
|
|
177
|
+
font-size: var(--_font);
|
|
178
|
+
padding-block: calc((var(--_row) - var(--_line)) / 2);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
:host-state([size="sm"]) input,
|
|
182
|
+
:host-state([size="lg"]) input {
|
|
183
|
+
margin-top: calc((var(--_line) - var(--_ui-checkbox-size, 1.125rem)) / 2);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@media (pointer: coarse) {
|
|
187
|
+
:host-state([size="sm"]) {
|
|
188
|
+
--_row: var(--ui-control-min-block-size);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
157
192
|
/* A component that sets its display still honours the hidden attribute on its root. */
|
|
158
193
|
:host[hidden] {
|
|
159
194
|
display: none;
|
|
@@ -44,8 +44,10 @@
|
|
|
44
44
|
<prop name="required" type="boolean" default="false"
|
|
45
45
|
>Requires a value: adds an asterisk to the label, marks the input required for native form validation, and makes validation report "A value is required."
|
|
46
46
|
when the field is left empty. In multiple mode a chosen item satisfies it, whatever is left in the input.</prop>
|
|
47
|
-
<prop name="size" type="sm | md" default="md"
|
|
48
|
-
>Field height
|
|
47
|
+
<prop name="size" type="sm | md | lg" default="md"
|
|
48
|
+
>Field height, padding, and type size, matching Button's sizes so a field and a button of one size share a row. sm is the small control height (2rem by
|
|
49
|
+
default) with smaller text, for compact rows such as a table row or a filter bar; md is the standard control height; lg is taller with roomier padding.
|
|
50
|
+
Under a coarse pointer, sm grows to the 44px touch minimum and keeps body-size text. The label keeps its size.</prop>
|
|
49
51
|
<prop name="labelVisibility" type="visible | sr-only" default="visible"
|
|
50
52
|
>visible shows the label above the field; sr-only hides it visually but keeps it as the input's accessible name. Use sr-only only when the surrounding
|
|
51
53
|
layout already makes the field's purpose clear.</prop>
|
|
@@ -395,9 +397,18 @@
|
|
|
395
397
|
margin: 0;
|
|
396
398
|
outline: none;
|
|
397
399
|
}
|
|
400
|
+
:host-state([size="sm"]) {
|
|
401
|
+
--_row: var(--ui-control-size-sm);
|
|
402
|
+
}
|
|
398
403
|
:host-state([size="sm"]) input {
|
|
399
|
-
min-block-size: calc(var(--
|
|
404
|
+
min-block-size: calc(var(--_row) - 2px);
|
|
400
405
|
padding: var(--ui-space-1) var(--ui-space-2);
|
|
406
|
+
font-size: var(--ui-font-size-sm);
|
|
407
|
+
}
|
|
408
|
+
:host-state([size="lg"]) input {
|
|
409
|
+
min-block-size: calc(var(--ui-control-size-lg) - 2px);
|
|
410
|
+
padding: var(--ui-space-3) var(--ui-space-4);
|
|
411
|
+
font-size: var(--ui-font-size-md);
|
|
401
412
|
}
|
|
402
413
|
button {
|
|
403
414
|
appearance: none;
|
|
@@ -498,6 +509,14 @@
|
|
|
498
509
|
min-inline-size: 2.75rem;
|
|
499
510
|
min-block-size: 2.75rem;
|
|
500
511
|
}
|
|
512
|
+
/* Under touch a small field is still a touch-sized target, as a small button is, and keeps
|
|
513
|
+
body-size text: below 16px, iOS zooms the page into the focused field. */
|
|
514
|
+
:host-state([size="sm"]) {
|
|
515
|
+
--_row: var(--ui-control-min-block-size);
|
|
516
|
+
}
|
|
517
|
+
:host-state([size="sm"]) input {
|
|
518
|
+
font-size: inherit;
|
|
519
|
+
}
|
|
501
520
|
}
|
|
502
521
|
@media (forced-colors: active) {
|
|
503
522
|
.field, .popup {
|
|
@@ -555,6 +574,22 @@
|
|
|
555
574
|
min-block-size: 1.75rem;
|
|
556
575
|
padding: var(--ui-space-0-5) var(--ui-space-1);
|
|
557
576
|
}
|
|
577
|
+
/* A small multiple field starts at the small control height; chosen items still wrap it taller. */
|
|
578
|
+
:host-state([multiple]):host-state([size="sm"]) .field {
|
|
579
|
+
min-block-size: 0;
|
|
580
|
+
padding: var(--ui-space-0-5);
|
|
581
|
+
}
|
|
582
|
+
:host-state([multiple]):host-state([size="sm"]) input {
|
|
583
|
+
min-block-size: calc(var(--_row) - 2px - 2 * var(--ui-space-0-5));
|
|
584
|
+
padding: 0 var(--ui-space-1);
|
|
585
|
+
}
|
|
586
|
+
/* A large multiple field starts at the large control height, as sm starts at the small one. */
|
|
587
|
+
:host-state([multiple]):host-state([size="lg"]) .field {
|
|
588
|
+
min-block-size: 0;
|
|
589
|
+
}
|
|
590
|
+
:host-state([multiple]):host-state([size="lg"]) input {
|
|
591
|
+
min-block-size: calc(var(--ui-control-size-lg) - 2px - 2 * var(--ui-space-1));
|
|
592
|
+
}
|
|
558
593
|
.item {
|
|
559
594
|
appearance: none;
|
|
560
595
|
display: inline-flex;
|
|
@@ -1,21 +1,81 @@
|
|
|
1
|
-
<template component="ui-icon"
|
|
1
|
+
<template component="ui-icon">
|
|
2
2
|
<defs>
|
|
3
3
|
<prop name="name" type="string" default=""
|
|
4
4
|
>Which icon to draw, by its name in Looma's icon set (LOOMA_ICONS), such as "align-left". An unknown or empty name draws nothing. The icon is hidden from
|
|
5
5
|
assistive technology, so name the control it sits in.</prop>
|
|
6
|
-
|
|
6
|
+
<!-- Derived from name as it renders, so every render path, a server render included, draws the icon without JavaScript. Generated from LOOMA_ICONS by tools/scripts/generate-icon-catalog.mjs. -->
|
|
7
|
+
<computed
|
|
7
8
|
name="shapes"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
from="{
|
|
10
|
+
'align-center': [{ tag: 'path', d: 'M21 5H3' }, { tag: 'path', d: 'M17 12H7' }, { tag: 'path', d: 'M19 19H5' }],
|
|
11
|
+
'align-left': [{ tag: 'path', d: 'M21 5H3' }, { tag: 'path', d: 'M15 12H3' }, { tag: 'path', d: 'M17 19H3' }],
|
|
12
|
+
'align-right': [{ tag: 'path', d: 'M21 5H3' }, { tag: 'path', d: 'M21 12H9' }, { tag: 'path', d: 'M21 19H7' }],
|
|
13
|
+
'arrow-left': [{ tag: 'path', d: 'm12 19-7-7 7-7' }, { tag: 'path', d: 'M19 12H5' }],
|
|
14
|
+
'bold': [{ tag: 'path', d: 'M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8' }],
|
|
15
|
+
'book-user': [{ tag: 'path', d: 'M15 13a3 3 0 1 0-6 0' }, { tag: 'path', d: 'M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20' }, { tag: 'circle', cx: '12', cy: '8', r: '2' }],
|
|
16
|
+
'braces': [{ tag: 'path', d: 'M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1' }, { tag: 'path', d: 'M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1' }],
|
|
17
|
+
'calculator': [{ tag: 'rect', width: '16', height: '20', x: '4', y: '2', rx: '2' }, { tag: 'line', x1: '8', x2: '16', y1: '6', y2: '6' }, { tag: 'line', x1: '16', x2: '16', y1: '14', y2: '18' }, { tag: 'path', d: 'M16 10h.01' }, { tag: 'path', d: 'M12 10h.01' }, { tag: 'path', d: 'M8 10h.01' }, { tag: 'path', d: 'M12 14h.01' }, { tag: 'path', d: 'M8 14h.01' }, { tag: 'path', d: 'M12 18h.01' }, { tag: 'path', d: 'M8 18h.01' }],
|
|
18
|
+
'chevron-down': [{ tag: 'path', d: 'm6 9 6 6 6-6' }],
|
|
19
|
+
'chevron-left': [{ tag: 'path', d: 'm15 18-6-6 6-6' }],
|
|
20
|
+
'chevron-right': [{ tag: 'path', d: 'm9 18 6-6-6-6' }],
|
|
21
|
+
'circle-check': [{ tag: 'circle', cx: '12', cy: '12', r: '10' }, { tag: 'path', d: 'm9 12 2 2 4-4' }],
|
|
22
|
+
'circle-x': [{ tag: 'circle', cx: '12', cy: '12', r: '10' }, { tag: 'path', d: 'm15 9-6 6' }, { tag: 'path', d: 'm9 9 6 6' }],
|
|
23
|
+
'code-xml': [{ tag: 'path', d: 'm18 16 4-4-4-4' }, { tag: 'path', d: 'm6 8-4 4 4 4' }, { tag: 'path', d: 'm14.5 4-5 16' }],
|
|
24
|
+
'columns': [{ tag: 'rect', width: '18', height: '18', x: '3', y: '3', rx: '2' }, { tag: 'path', d: 'M9 3v18' }, { tag: 'path', d: 'M15 3v18' }],
|
|
25
|
+
'credit-card': [{ tag: 'rect', width: '20', height: '14', x: '2', y: '5', rx: '2' }, { tag: 'line', x1: '2', x2: '22', y1: '10', y2: '10' }],
|
|
26
|
+
'ellipsis': [{ tag: 'circle', cx: '12', cy: '12', r: '1' }, { tag: 'circle', cx: '19', cy: '12', r: '1' }, { tag: 'circle', cx: '5', cy: '12', r: '1' }],
|
|
27
|
+
'eraser': [{ tag: 'path', d: 'M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21' }, { tag: 'path', d: 'm5.082 11.09 8.828 8.828' }],
|
|
28
|
+
'file-text': [{ tag: 'path', d: 'M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z' }, { tag: 'path', d: 'M14 2v5a1 1 0 0 0 1 1h5' }, { tag: 'path', d: 'M10 9H8' }, { tag: 'path', d: 'M16 13H8' }, { tag: 'path', d: 'M16 17H8' }],
|
|
29
|
+
'folder': [{ tag: 'path', d: 'M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z' }],
|
|
30
|
+
'grip-horizontal': [{ tag: 'circle', cx: '12', cy: '9', r: '1' }, { tag: 'circle', cx: '19', cy: '9', r: '1' }, { tag: 'circle', cx: '5', cy: '9', r: '1' }, { tag: 'circle', cx: '12', cy: '15', r: '1' }, { tag: 'circle', cx: '19', cy: '15', r: '1' }, { tag: 'circle', cx: '5', cy: '15', r: '1' }],
|
|
31
|
+
'grip-vertical': [{ tag: 'circle', cx: '9', cy: '12', r: '1' }, { tag: 'circle', cx: '9', cy: '5', r: '1' }, { tag: 'circle', cx: '9', cy: '19', r: '1' }, { tag: 'circle', cx: '15', cy: '12', r: '1' }, { tag: 'circle', cx: '15', cy: '5', r: '1' }, { tag: 'circle', cx: '15', cy: '19', r: '1' }],
|
|
32
|
+
'heading-1': [{ tag: 'path', d: 'M4 12h8' }, { tag: 'path', d: 'M4 18V6' }, { tag: 'path', d: 'M12 18V6' }, { tag: 'path', d: 'm17 12 3-2v8' }],
|
|
33
|
+
'heading-2': [{ tag: 'path', d: 'M4 12h8' }, { tag: 'path', d: 'M4 18V6' }, { tag: 'path', d: 'M12 18V6' }, { tag: 'path', d: 'M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1' }],
|
|
34
|
+
'heading-3': [{ tag: 'path', d: 'M4 12h8' }, { tag: 'path', d: 'M4 18V6' }, { tag: 'path', d: 'M12 18V6' }, { tag: 'path', d: 'M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2' }, { tag: 'path', d: 'M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2' }],
|
|
35
|
+
'help': [{ tag: 'circle', cx: '12', cy: '12', r: '10' }, { tag: 'path', d: 'M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3' }, { tag: 'path', d: 'M12 17h.01' }],
|
|
36
|
+
'highlighter': [{ tag: 'path', d: 'm9 11-6 6v3h9l3-3' }, { tag: 'path', d: 'm22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4' }],
|
|
37
|
+
'image': [{ tag: 'rect', width: '18', height: '18', x: '3', y: '3', rx: '2', ry: '2' }, { tag: 'circle', cx: '9', cy: '9', r: '2' }, { tag: 'path', d: 'm21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21' }],
|
|
38
|
+
'info': [{ tag: 'circle', cx: '12', cy: '12', r: '10' }, { tag: 'path', d: 'M12 16v-4' }, { tag: 'path', d: 'M12 8h.01' }],
|
|
39
|
+
'italic': [{ tag: 'line', x1: '19', x2: '10', y1: '4', y2: '4' }, { tag: 'line', x1: '14', x2: '5', y1: '20', y2: '20' }, { tag: 'line', x1: '15', x2: '9', y1: '4', y2: '20' }],
|
|
40
|
+
'layout-dashboard': [{ tag: 'rect', width: '7', height: '9', x: '3', y: '3', rx: '1' }, { tag: 'rect', width: '7', height: '5', x: '14', y: '3', rx: '1' }, { tag: 'rect', width: '7', height: '9', x: '14', y: '12', rx: '1' }, { tag: 'rect', width: '7', height: '5', x: '3', y: '16', rx: '1' }],
|
|
41
|
+
'list': [{ tag: 'path', d: 'M3 5h.01' }, { tag: 'path', d: 'M3 12h.01' }, { tag: 'path', d: 'M3 19h.01' }, { tag: 'path', d: 'M8 5h13' }, { tag: 'path', d: 'M8 12h13' }, { tag: 'path', d: 'M8 19h13' }],
|
|
42
|
+
'list-ordered': [{ tag: 'path', d: 'M11 5h10' }, { tag: 'path', d: 'M11 12h10' }, { tag: 'path', d: 'M11 19h10' }, { tag: 'path', d: 'M4 4h1v5' }, { tag: 'path', d: 'M4 9h2' }, { tag: 'path', d: 'M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02' }],
|
|
43
|
+
'list-todo': [{ tag: 'path', d: 'M13 5h8' }, { tag: 'path', d: 'M13 12h8' }, { tag: 'path', d: 'M13 19h8' }, { tag: 'path', d: 'm3 17 2 2 4-4' }, { tag: 'rect', x: '3', y: '4', width: '6', height: '6', rx: '1' }],
|
|
44
|
+
'loader': [{ tag: 'path', d: 'M21 12a9 9 0 1 1-6.219-8.56' }],
|
|
45
|
+
'merge': [{ tag: 'path', d: 'm8 6 4-4 4 4' }, { tag: 'path', d: 'M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22' }, { tag: 'path', d: 'm20 22-5-5' }],
|
|
46
|
+
'minus': [{ tag: 'path', d: 'M5 12h14' }],
|
|
47
|
+
'notebook-pen': [{ tag: 'path', d: 'M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4' }, { tag: 'path', d: 'M2 6h4' }, { tag: 'path', d: 'M2 10h4' }, { tag: 'path', d: 'M2 14h4' }, { tag: 'path', d: 'M2 18h4' }, { tag: 'path', d: 'M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z' }],
|
|
48
|
+
'paint-bucket': [{ tag: 'path', d: 'm19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z' }, { tag: 'path', d: 'm5 2 5 5' }, { tag: 'path', d: 'M2 13h15' }, { tag: 'path', d: 'M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z' }],
|
|
49
|
+
'panel-bottom': [{ tag: 'rect', width: '18', height: '18', x: '3', y: '3', rx: '2' }, { tag: 'path', d: 'M3 15h18' }],
|
|
50
|
+
'panel-left': [{ tag: 'rect', width: '18', height: '18', x: '3', y: '3', rx: '2' }, { tag: 'path', d: 'M9 3v18' }],
|
|
51
|
+
'panel-right': [{ tag: 'rect', width: '18', height: '18', x: '3', y: '3', rx: '2' }, { tag: 'path', d: 'M15 3v18' }],
|
|
52
|
+
'panel-top': [{ tag: 'rect', width: '18', height: '18', x: '3', y: '3', rx: '2' }, { tag: 'path', d: 'M3 9h18' }],
|
|
53
|
+
'pilcrow': [{ tag: 'path', d: 'M13 4v16' }, { tag: 'path', d: 'M17 4v16' }, { tag: 'path', d: 'M19 4H9.5a4.5 4.5 0 0 0 0 9H13' }],
|
|
54
|
+
'plus': [{ tag: 'path', d: 'M5 12h14' }, { tag: 'path', d: 'M12 5v14' }],
|
|
55
|
+
'quote': [{ tag: 'path', d: 'M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z' }, { tag: 'path', d: 'M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z' }],
|
|
56
|
+
'receipt': [{ tag: 'path', d: 'M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z' }, { tag: 'path', d: 'M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8' }, { tag: 'path', d: 'M12 17.5v-11' }],
|
|
57
|
+
'redo': [{ tag: 'path', d: 'm15 14 5-5-5-5' }, { tag: 'path', d: 'M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13' }],
|
|
58
|
+
'rows': [{ tag: 'rect', width: '18', height: '18', x: '3', y: '3', rx: '2' }, { tag: 'path', d: 'M21 9H3' }, { tag: 'path', d: 'M21 15H3' }],
|
|
59
|
+
'settings': [{ tag: 'path', d: 'M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915' }, { tag: 'circle', cx: '12', cy: '12', r: '3' }],
|
|
60
|
+
'split': [{ tag: 'path', d: 'M16 3h5v5' }, { tag: 'path', d: 'M8 3H3v5' }, { tag: 'path', d: 'M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3' }, { tag: 'path', d: 'm15 9 6-6' }],
|
|
61
|
+
'strikethrough': [{ tag: 'path', d: 'M16 4H9a3 3 0 0 0-2.83 4' }, { tag: 'path', d: 'M14 12a4 4 0 0 1 0 8H6' }, { tag: 'line', x1: '4', x2: '20', y1: '12', y2: '12' }],
|
|
62
|
+
'table': [{ tag: 'path', d: 'M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18' }],
|
|
63
|
+
'trash': [{ tag: 'path', d: 'M10 11v6' }, { tag: 'path', d: 'M14 11v6' }, { tag: 'path', d: 'M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6' }, { tag: 'path', d: 'M3 6h18' }, { tag: 'path', d: 'M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2' }],
|
|
64
|
+
'triangle-alert': [{ tag: 'path', d: 'm21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3' }, { tag: 'path', d: 'M12 9v4' }, { tag: 'path', d: 'M12 17h.01' }],
|
|
65
|
+
'truck': [{ tag: 'path', d: 'M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2' }, { tag: 'path', d: 'M15 18H9' }, { tag: 'path', d: 'M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14' }, { tag: 'circle', cx: '17', cy: '18', r: '2' }, { tag: 'circle', cx: '7', cy: '18', r: '2' }],
|
|
66
|
+
'underline': [{ tag: 'path', d: 'M6 4v6a6 6 0 0 0 12 0V4' }, { tag: 'line', x1: '4', x2: '20', y1: '20', y2: '20' }],
|
|
67
|
+
'undo': [{ tag: 'path', d: 'M9 14 4 9l5-5' }, { tag: 'path', d: 'M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11' }],
|
|
68
|
+
'users': [{ tag: 'path', d: 'M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2' }, { tag: 'path', d: 'M16 3.128a4 4 0 0 1 0 7.744' }, { tag: 'path', d: 'M22 21v-2a4 4 0 0 0-3-3.87' }, { tag: 'circle', cx: '9', cy: '7', r: '4' }],
|
|
69
|
+
}[name]"
|
|
70
|
+
></computed>
|
|
11
71
|
</defs>
|
|
12
72
|
<span aria-hidden="true">
|
|
13
73
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" focusable="false">
|
|
14
74
|
<g $each="shape of shapes">
|
|
15
75
|
<path $if="shape.tag = 'path'" :d="shape.d"></path>
|
|
16
76
|
<circle $if="shape.tag = 'circle'" :cx="shape.cx" :cy="shape.cy" :r="shape.r"></circle>
|
|
17
|
-
<rect $if="shape.tag = 'rect'" :x="shape.x" :y="shape.y" :width="shape.width" :height="shape.height" :rx="shape.rx"></rect>
|
|
18
|
-
<line $if="shape.tag = 'line'" :x1="shape.x1" :
|
|
77
|
+
<rect $if="shape.tag = 'rect'" :x="shape.x" :y="shape.y" :width="shape.width" :height="shape.height" :rx="shape.rx" :ry="shape.ry"></rect>
|
|
78
|
+
<line $if="shape.tag = 'line'" :x1="shape.x1" :y1="shape.y1" :x2="shape.x2" :y2="shape.y2"></line>
|
|
19
79
|
</g>
|
|
20
80
|
</svg>
|
|
21
81
|
</span>
|
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
<prop name="invalid" type="boolean" default="false">Exposes invalid state to assistive technology and styling.</prop>
|
|
8
8
|
<prop name="readonly" type="boolean" default="false">Allows selection without allowing edits.</prop>
|
|
9
9
|
<prop name="required" type="boolean" default="false">Marks the control as required for form validation.</prop>
|
|
10
|
+
<prop name="size" type="sm | md | lg" default="md"
|
|
11
|
+
>Height, padding, and type size, matching Button's sizes so a field and a button of one size share a row. sm is the small control height (2rem by default)
|
|
12
|
+
with smaller text, for compact rows such as a table row or a filter bar; md is the standard control height; lg is taller with roomier padding. Under a
|
|
13
|
+
coarse pointer, sm grows to the 44px touch minimum and keeps body-size text. Change it after render through this option; the element's size property is
|
|
14
|
+
the native one.</prop>
|
|
10
15
|
</defs>
|
|
11
16
|
<input :value="value" :disabled="disabled" :readonly="readonly" :required="required" :aria-invalid="invalid">
|
|
12
17
|
<style>
|
|
@@ -84,6 +89,28 @@
|
|
|
84
89
|
background-color var(--ui-motion-fast) var(--ui-motion-ease);
|
|
85
90
|
}
|
|
86
91
|
|
|
92
|
+
/* Each size reads the hook and then an Input Group's default first, so a group, which draws the frame, can zero it. */
|
|
93
|
+
:host-state([size="sm"]) {
|
|
94
|
+
min-block-size: var(--ui-input-min-block-size, var(--_ui-default-input-min-block-size, var(--ui-control-size-sm)));
|
|
95
|
+
padding: var(--ui-space-1) var(--ui-space-2);
|
|
96
|
+
font-size: var(--ui-font-size-sm);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:host-state([size="lg"]) {
|
|
100
|
+
min-block-size: var(--ui-input-min-block-size, var(--_ui-default-input-min-block-size, var(--ui-control-size-lg)));
|
|
101
|
+
padding: var(--ui-space-3) var(--ui-space-4);
|
|
102
|
+
font-size: var(--ui-font-size-md);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* Under touch a small field is still a touch-sized target, as a small button is, and keeps
|
|
106
|
+
body-size text: below 16px, iOS zooms the page into the focused field. */
|
|
107
|
+
@media (pointer: coarse) {
|
|
108
|
+
:host-state([size="sm"]) {
|
|
109
|
+
min-block-size: var(--ui-input-min-block-size, var(--_ui-default-input-min-block-size, var(--ui-control-min-block-size)));
|
|
110
|
+
font-size: inherit;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
87
114
|
/* Tabbing into a field selects its text; tint that selection softly instead of the page highlight. */
|
|
88
115
|
:host::selection {
|
|
89
116
|
background: color-mix(in srgb, var(--ui-accent-solid) 20%, transparent);
|
|
@@ -50,6 +50,21 @@
|
|
|
50
50
|
transition: border-color var(--ui-motion-fast) var(--ui-motion-ease), box-shadow var(--ui-motion-fast) var(--ui-motion-ease);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
/* The frame takes its input's size, so a small group lines up with small buttons and fields. */
|
|
54
|
+
:host:has(.field [data-ui-input-state~="size=sm"]) {
|
|
55
|
+
min-block-size: var(--ui-control-size-sm);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:host:has(.field [data-ui-input-state~="size=lg"]) {
|
|
59
|
+
min-block-size: var(--ui-control-size-lg);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@media (pointer: coarse) {
|
|
63
|
+
:host:has(.field [data-ui-input-state~="size=sm"]) {
|
|
64
|
+
min-block-size: var(--ui-control-min-block-size);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
53
68
|
:host:hover:not(:has(input:focus, input:disabled)) {
|
|
54
69
|
border-color: var(--ui-control-border-hover, var(--ui-text-secondary));
|
|
55
70
|
}
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
<prop name="value" type="string" default="on"
|
|
13
13
|
>The value this radio stands for: submitted with a form, reported in its change event, and matched against a ui-radio-group's value to decide which radio is
|
|
14
14
|
checked.</prop>
|
|
15
|
+
<prop name="size" type="sm | md | lg" default="md"
|
|
16
|
+
>Aligns the radio with fields and buttons of the same size. It keeps its box size; the label takes that size's field type size and its first line centres in
|
|
17
|
+
that control height (sm 2rem, lg 3rem by default), so in a row of inputs, selects, and buttons of one size it shares their height and their text baseline.
|
|
18
|
+
Under a coarse pointer an sm row grows to the 44px touch minimum, as they do. md is the standard layout.</prop>
|
|
15
19
|
<state name="internalChecked" :value="false"></state>
|
|
16
20
|
<event name="change" type="object({ checked: boolean, value: string, trigger: keyboard | pointer | programmatic })"></event>
|
|
17
21
|
</defs>
|
|
@@ -90,6 +94,37 @@
|
|
|
90
94
|
cursor: not-allowed;
|
|
91
95
|
}
|
|
92
96
|
|
|
97
|
+
/* A sized choice keeps its box and aligns instead: the label takes that size's field type size,
|
|
98
|
+
and the first line centres in that control height, so the label shares a row's baseline.
|
|
99
|
+
Multi-line labels and descriptions still grow downward from that first line. */
|
|
100
|
+
:host-state([size="sm"]) {
|
|
101
|
+
--_font: var(--ui-font-size-sm);
|
|
102
|
+
--_row: var(--ui-control-size-sm);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
:host-state([size="lg"]) {
|
|
106
|
+
--_font: var(--ui-font-size-md);
|
|
107
|
+
--_row: var(--ui-control-size-lg);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
:host-state([size="sm"]),
|
|
111
|
+
:host-state([size="lg"]) {
|
|
112
|
+
--_line: calc(var(--_font) * var(--ui-line-height-md));
|
|
113
|
+
font-size: var(--_font);
|
|
114
|
+
padding-block: calc((var(--_row) - var(--_line)) / 2);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
:host-state([size="sm"]) input,
|
|
118
|
+
:host-state([size="lg"]) input {
|
|
119
|
+
margin-top: calc((var(--_line) - var(--_ui-radio-size, 1.125rem)) / 2);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@media (pointer: coarse) {
|
|
123
|
+
:host-state([size="sm"]) {
|
|
124
|
+
--_row: var(--ui-control-min-block-size);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
93
128
|
/* A component that sets its display still honours the hidden attribute on its root. */
|
|
94
129
|
:host[hidden] {
|
|
95
130
|
display: none;
|
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
<prop name="disabled" type="boolean" default="false">Prevents selection and form submission.</prop>
|
|
7
7
|
<prop name="invalid" type="boolean" default="false">Exposes invalid state to assistive technology and styling.</prop>
|
|
8
8
|
<prop name="required" type="boolean" default="false">Requires a non-empty option for form validation.</prop>
|
|
9
|
+
<prop name="size" type="sm | md | lg" default="md"
|
|
10
|
+
>Height, padding, chevron, and type size, matching Button's sizes so a field and a button of one size share a row. sm is the small control height (2rem by
|
|
11
|
+
default) with smaller text and a smaller chevron, for compact rows such as a table row or a filter bar; md is the standard control height; lg is taller
|
|
12
|
+
with roomier padding. Under a coarse pointer, sm grows to the 44px touch minimum and keeps body-size text. It is not the native size attribute: a select
|
|
13
|
+
is always a single-choice dropdown. Change it after render through this option; the element's size property is the native one.</prop>
|
|
9
14
|
</defs>
|
|
10
15
|
<select :disabled="disabled" :required="required" :aria-invalid="invalid"><slot></slot></select>
|
|
11
16
|
<style>
|
|
@@ -88,9 +93,30 @@
|
|
|
88
93
|
cursor: not-allowed;
|
|
89
94
|
}
|
|
90
95
|
|
|
91
|
-
:host
|
|
92
|
-
min-block-size:
|
|
93
|
-
padding: var(--ui-space-2);
|
|
96
|
+
:host-state([size="sm"]) {
|
|
97
|
+
min-block-size: var(--ui-control-size-sm);
|
|
98
|
+
padding: var(--ui-space-1) var(--ui-space-2);
|
|
99
|
+
padding-inline-end: calc(var(--ui-space-2) + var(--ui-icon-size-sm) + var(--ui-space-1));
|
|
100
|
+
background-position: right var(--ui-space-2) center;
|
|
101
|
+
background-size: var(--ui-icon-size-sm) var(--ui-icon-size-sm);
|
|
102
|
+
font-size: var(--ui-font-size-sm);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
:host-state([size="lg"]) {
|
|
106
|
+
min-block-size: var(--ui-control-size-lg);
|
|
107
|
+
padding: var(--ui-space-3) var(--ui-space-4);
|
|
108
|
+
padding-inline-end: calc(var(--ui-space-4) + 1.5rem);
|
|
109
|
+
background-position: right var(--ui-space-4) center;
|
|
110
|
+
font-size: var(--ui-font-size-md);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* Under touch a small field is still a touch-sized target, as a small button is, and keeps
|
|
114
|
+
body-size text: below 16px, iOS zooms the page into the focused field. */
|
|
115
|
+
@media (pointer: coarse) {
|
|
116
|
+
:host-state([size="sm"]) {
|
|
117
|
+
min-block-size: var(--ui-control-min-block-size);
|
|
118
|
+
font-size: inherit;
|
|
119
|
+
}
|
|
94
120
|
}
|
|
95
121
|
|
|
96
122
|
/* A component that sets its display still honours the hidden attribute on its root. */
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
<prop name="value" type="string" default="on"
|
|
10
10
|
>The value a form submits under name while the switch is on, also reported in the change event's detail so one handler can tell switches apart. on by
|
|
11
11
|
default, as on a native checkbox.</prop>
|
|
12
|
+
<prop name="size" type="sm | md | lg" default="md"
|
|
13
|
+
>Aligns the switch with fields and buttons of the same size. It keeps its track size; the label takes that size's field type size and its first line centres
|
|
14
|
+
in that control height (sm 2rem, lg 3rem by default), so in a row of inputs, selects, and buttons of one size it shares their height and their text
|
|
15
|
+
baseline. Under a coarse pointer an sm row grows to the 44px touch minimum, as they do. md is the standard layout.</prop>
|
|
12
16
|
<state name="internalChecked" :value="false"></state>
|
|
13
17
|
<event name="change" type="object({ checked: boolean, value: string, trigger: keyboard | pointer | programmatic })"></event>
|
|
14
18
|
</defs>
|
|
@@ -131,6 +135,38 @@
|
|
|
131
135
|
}
|
|
132
136
|
}
|
|
133
137
|
|
|
138
|
+
/* A sized switch keeps its track and aligns instead: the label takes that size's field type size,
|
|
139
|
+
and the first line centres in that control height, so the label shares a row's baseline.
|
|
140
|
+
Multi-line labels and descriptions still grow downward from that first line. */
|
|
141
|
+
:host-state([size="sm"]) {
|
|
142
|
+
--_font: var(--ui-font-size-sm);
|
|
143
|
+
--_row: var(--ui-control-size-sm);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
:host-state([size="lg"]) {
|
|
147
|
+
--_font: var(--ui-font-size-md);
|
|
148
|
+
--_row: var(--ui-control-size-lg);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
:host-state([size="sm"]),
|
|
152
|
+
:host-state([size="lg"]) {
|
|
153
|
+
--_line: calc(var(--_font) * var(--ui-line-height-md));
|
|
154
|
+
font-size: var(--_font);
|
|
155
|
+
padding-block: calc((var(--_row) - var(--ui-switch-track-height, 1.5rem)) / 2);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* The label centres on the track. */
|
|
159
|
+
:host-state([size="sm"]) .text,
|
|
160
|
+
:host-state([size="lg"]) .text {
|
|
161
|
+
margin-top: calc((var(--_ui-switch-track-height, 1.5rem) - var(--_line)) / 2);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
@media (pointer: coarse) {
|
|
165
|
+
:host-state([size="sm"]) {
|
|
166
|
+
--_row: var(--ui-control-min-block-size);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
134
170
|
/* A component that sets its display still honours the hidden attribute on its root. */
|
|
135
171
|
:host[hidden] {
|
|
136
172
|
display: none;
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
<prop name="readonly" type="boolean" default="false">Allows selection without allowing edits.</prop>
|
|
9
9
|
<prop name="required" type="boolean" default="false">Marks the control as required for form validation.</prop>
|
|
10
10
|
<prop name="rows" type="integer" default="4">Initial number of visible text rows.</prop>
|
|
11
|
+
<prop name="size" type="sm | md | lg" default="md"
|
|
12
|
+
>Padding and type size, matching Input's sizes so a textarea sits with fields of the same size; rows sets its height. sm has tighter padding and smaller
|
|
13
|
+
text, for compact forms; lg has roomier padding. Under a coarse pointer, sm keeps body-size text.</prop>
|
|
11
14
|
</defs>
|
|
12
15
|
<textarea :value="value" :disabled="disabled" :readonly="readonly" :required="required" :aria-invalid="invalid" :rows="rows"></textarea>
|
|
13
16
|
<style>
|
|
@@ -88,6 +91,23 @@
|
|
|
88
91
|
cursor: not-allowed;
|
|
89
92
|
}
|
|
90
93
|
|
|
94
|
+
:host-state([size="sm"]) {
|
|
95
|
+
padding: var(--ui-space-1) var(--ui-space-2);
|
|
96
|
+
font-size: var(--ui-font-size-sm);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:host-state([size="lg"]) {
|
|
100
|
+
padding: var(--ui-space-3) var(--ui-space-4);
|
|
101
|
+
font-size: var(--ui-font-size-md);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Below 16px, iOS zooms the page into the focused field, so touch keeps body-size text. */
|
|
105
|
+
@media (pointer: coarse) {
|
|
106
|
+
:host-state([size="sm"]) {
|
|
107
|
+
font-size: inherit;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
91
111
|
/* A component that sets its display still honours the hidden attribute on its root. */
|
|
92
112
|
:host[hidden] {
|
|
93
113
|
display: none;
|