@aitrien/motifspec 1.26.0 → 1.27.1
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 +23 -0
- package/README.md +2 -2
- package/dist/codex.css +165 -2
- package/dist/codex.js +423 -104
- package/dist/contrast.md +9 -1
- package/dist/icons.svg +1 -0
- package/dist/tokens.css +5 -1
- package/dist/tokens.js +83 -1
- package/dist/tokens.json +83 -1
- package/docs/components/_groups.json +1 -0
- package/docs/components/button-and-link.md +19 -1
- package/docs/components/choice.md +104 -0
- package/docs/components/date-picker.md +108 -0
- package/docs/components/dialog.md +148 -0
- package/docs/components/field.md +181 -0
- package/docs/components/icon.md +3 -0
- package/docs/hugo.md +1 -0
- package/docs/layouts/dashboard.md +3 -3
- package/icons/manifest.json +8 -4
- package/icons/svg/calendar_today.svg +1 -0
- package/layouts/_partials/motifspec/field.html +53 -0
- package/package.json +1 -1
- package/scripts/lib.mjs +4 -0
- package/tokens/color.json +74 -0
package/dist/contrast.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Contrast report (generated)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
107 declared pairs, each measured in both themes. Target is the pair's `min`.
|
|
4
4
|
|
|
5
5
|
| Foreground | Background | Min | Light | Dark | Result |
|
|
6
6
|
|---|---|---|---|---|---|
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
| `color.text.primary` | `color.surface.sunken` | 7 | 15.28 | 15.28 | pass |
|
|
10
10
|
| `color.text.primary` | `color.surface.hover` | 7 | 15.28 | 10.21 | pass |
|
|
11
11
|
| `color.text.primary` | `color.surface.highlight` | 7 | 15.47 | 9.91 | pass |
|
|
12
|
+
| `color.text.primary` | `color.surface.selected` | 7 | 15.47 | 9.91 | pass |
|
|
12
13
|
| `color.text.primary` | `color.status.success.surface` | 7 | 16.48 | 15.12 | pass |
|
|
13
14
|
| `color.text.primary` | `color.status.warning.surface` | 7 | 16.29 | 15.28 | pass |
|
|
14
15
|
| `color.text.primary` | `color.status.danger.surface` | 7 | 16.23 | 15.57 | pass |
|
|
@@ -26,6 +27,8 @@
|
|
|
26
27
|
| `color.text.inverse` | `color.surface.inverse` | 7 | 13.61 | 12.71 | pass |
|
|
27
28
|
| `color.text.on-accent` | `color.accent.fill.rest` | 4.5 | 6.77 | 12.02 | pass |
|
|
28
29
|
| `color.text.on-accent` | `color.accent.fill.hover` | 4.5 | 11.20 | 15.03 | pass |
|
|
30
|
+
| `color.text.on-danger` | `color.status.danger.fill` | 4.5 | 7.67 | 11.29 | pass |
|
|
31
|
+
| `color.text.on-danger` | `color.status.danger.fill-hover` | 4.5 | 12.15 | 14.36 | pass |
|
|
29
32
|
| `color.link.rest` | `color.surface.base` | 7 | 10.61 | 9.18 | pass |
|
|
30
33
|
| `color.link.rest` | `color.surface.raised` | 7 | 11.20 | 8.12 | pass |
|
|
31
34
|
| `color.link.rest` | `color.surface.sunken` | 7 | 9.91 | 11.03 | pass |
|
|
@@ -58,6 +61,11 @@
|
|
|
58
61
|
| `color.status.danger.text` | `color.surface.raised` | 4.5 | 7.67 | 7.63 | pass |
|
|
59
62
|
| `color.status.danger.text` | `color.surface.hover` | 4.5 | 6.79 | 6.92 | pass |
|
|
60
63
|
| `color.status.danger.border` | `color.status.danger.surface` | 3 | 5.04 | 7.39 | pass |
|
|
64
|
+
| `color.status.danger.fill` | `color.surface.base` | 3 | 7.27 | 8.62 | pass |
|
|
65
|
+
| `color.status.danger.fill` | `color.surface.raised` | 3 | 7.67 | 7.63 | pass |
|
|
66
|
+
| `color.status.danger.fill` | `color.surface.sunken` | 3 | 6.79 | 10.36 | pass |
|
|
67
|
+
| `color.status.danger.fill-hover` | `color.surface.raised` | 3 | 12.15 | 9.70 | pass |
|
|
68
|
+
| `color.status.danger.fill-hover` | `color.surface.sunken` | 3 | 10.75 | 13.18 | pass |
|
|
61
69
|
| `color.status.info.text` | `color.status.info.surface` | 4.5 | 6.72 | 10.74 | pass |
|
|
62
70
|
| `color.status.info.text` | `color.surface.base` | 4.5 | 6.76 | 8.95 | pass |
|
|
63
71
|
| `color.status.info.text` | `color.surface.raised` | 4.5 | 7.13 | 7.92 | pass |
|
package/dist/icons.svg
CHANGED
|
@@ -28,4 +28,5 @@
|
|
|
28
28
|
<symbol id="cx-icon-settings" viewBox="0 -960 960 960"><path d="m400.69-100-18.07-120.23q-20.54-7-44.23-20.35-23.7-13.34-40.85-28.27l-111.85 50.93-79.92-141.31 101.08-74.38q-2-10.54-2.89-23.01-.88-12.46-.88-23 0-10.15.88-22.61.89-12.46 2.89-24.16l-101.08-74.76 79.92-140.16 111.46 50.16q18.31-14.93 41.24-28.08 22.92-13.15 43.84-19.54L400.69-860h158.62l18.07 120.62q22.08 8.15 44.16 20.23 22.07 12.07 39.77 28l113.38-50.16 79.54 140.16-102.62 74.3q2.77 11.93 3.47 24 .69 12.08.69 22.85 0 10.38-.89 22.15-.88 11.77-3.27 24.47l102.23 74.15-79.92 141.31-112.61-51.31q-18.7 15.69-40.35 28.96-21.65 13.27-43.58 19.65L559.31-100H400.69Zm36.46-45.39h85.31L536.85-257q31.84-8 59.42-23.85 27.58-15.84 52.73-40.23l104.46 45.23 40-70.84L701-414.92q4-17.77 6.31-33.5 2.3-15.73 2.3-31.58 0-16.62-2-31.96-2-15.35-6.61-32.35l93.23-69-40-70.84-105.62 45.23q-21.07-23.69-50.84-41.77Q568-698.77 536.46-703l-13.61-111.61h-85.7l-13.23 111.23q-33.23 6.61-61.19 22.65t-52.11 41.42l-104.85-44.84-40 70.84 92.46 67.85q-4.38 15.84-6.69 32.15-2.31 16.31-2.31 33.69 0 16.62 2.31 32.54 2.31 15.93 6.31 32.16l-92.08 68.23 40 70.84 104.46-44.84q24 24.38 52.15 40.23 28.16 15.84 61.16 23.84l13.61 111.23Zm41.7-221.92q47.07 0 79.88-32.81 32.81-32.8 32.81-79.88t-32.81-79.88q-32.81-32.81-79.88-32.81-46.7 0-79.7 32.81-32.99 32.8-32.99 79.88t32.99 79.88q33 32.81 79.7 32.81ZM480-480Z"/></symbol>
|
|
29
29
|
<symbol id="cx-icon-restart" viewBox="0 -960 960 960"><path d="M447.92-142.77q-113.77-11.15-190.84-96Q180-323.62 180-439.38q0-68.93 31.08-130.2 31.07-61.26 86.23-102.34l32.23 32.61q-49.85 33-77 86.46-27.15 53.47-27.15 113.47 0 96.92 63.49 167.99 63.5 71.08 159.04 83.24v45.38Zm65.39.77v-45.39q96.15-14.3 159.04-84.88 62.88-70.58 62.88-167.11 0-106.7-73.96-180.66T480.62-694h-26.54l65.77 65.77-32.62 32.61-121.07-121.07 121.07-121.08 32.62 32.62-65.77 65.77h26.54q125.53 0 212.76 87.73 87.23 87.73 87.23 212.27 0 115.76-76.76 200.42-76.77 84.65-190.54 96.96Z"/></symbol>
|
|
30
30
|
<symbol id="cx-icon-logs" viewBox="0 -960 960 960"><path d="M100-180v-600h760v600H100Zm45.39-45.39h669.22v-426.38H145.39v426.38ZM300-303.15l-31.61-31.23 103-104-104-104L300-574l135.61 135.62L300-303.15Zm197.31 7.46v-45.39h205.38v45.39H497.31Z"/></symbol>
|
|
31
|
+
<symbol id="cx-icon-calendar" viewBox="0 -960 960 960"><path d="M140-100v-694.61h131.54v-70h50.38v70h317.69v-70h49.23v70H820V-100H140Zm45.39-45.39h589.22V-555H185.39v409.61Zm0-454.99h589.22v-148.85H185.39v148.85Zm0 0v-148.85 148.85Z"/></symbol>
|
|
31
32
|
</svg>
|
package/dist/tokens.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* MotifSpec 1.
|
|
1
|
+
/* MotifSpec 1.27.1 — generated from tokens/*.json. Do not edit.
|
|
2
2
|
Themes: semantic colours use light-dark(); color-scheme follows the system unless
|
|
3
3
|
<html data-theme="light|dark"> pins it. --cx-primitive-* are for this file only. */
|
|
4
4
|
:root {
|
|
@@ -100,6 +100,7 @@
|
|
|
100
100
|
--cx-color-surface-hover: light-dark(var(--cx-primitive-color-ash-100), var(--cx-primitive-color-ash-800));
|
|
101
101
|
--cx-color-surface-inverse: light-dark(var(--cx-primitive-color-ash-900), var(--cx-primitive-color-ash-100));
|
|
102
102
|
--cx-color-surface-highlight: light-dark(var(--cx-primitive-color-sap-100), var(--cx-primitive-color-sap-800));
|
|
103
|
+
--cx-color-surface-selected: light-dark(var(--cx-primitive-color-sap-100), var(--cx-primitive-color-sap-800));
|
|
103
104
|
|
|
104
105
|
/* color.text */
|
|
105
106
|
--cx-color-text-primary: light-dark(var(--cx-primitive-color-ash-950), var(--cx-primitive-color-ash-100));
|
|
@@ -108,6 +109,7 @@
|
|
|
108
109
|
--cx-color-text-accent: light-dark(var(--cx-primitive-color-sap-700), var(--cx-primitive-color-sap-300));
|
|
109
110
|
--cx-color-text-inverse: light-dark(var(--cx-primitive-color-ash-50), var(--cx-primitive-color-ash-900));
|
|
110
111
|
--cx-color-text-on-accent: light-dark(var(--cx-primitive-color-ash-0), var(--cx-primitive-color-ash-1000));
|
|
112
|
+
--cx-color-text-on-danger: light-dark(var(--cx-primitive-color-ash-0), var(--cx-primitive-color-ash-1000));
|
|
111
113
|
|
|
112
114
|
/* color.link */
|
|
113
115
|
--cx-color-link-rest: light-dark(var(--cx-primitive-color-sap-800), var(--cx-primitive-color-sap-300));
|
|
@@ -141,6 +143,8 @@
|
|
|
141
143
|
--cx-color-status-danger-text: light-dark(var(--cx-primitive-color-madder-700), var(--cx-primitive-color-madder-300));
|
|
142
144
|
--cx-color-status-danger-surface: light-dark(var(--cx-primitive-color-madder-50), var(--cx-primitive-color-madder-950));
|
|
143
145
|
--cx-color-status-danger-border: light-dark(var(--cx-primitive-color-madder-600), var(--cx-primitive-color-madder-400));
|
|
146
|
+
--cx-color-status-danger-fill: light-dark(var(--cx-primitive-color-madder-700), var(--cx-primitive-color-madder-300));
|
|
147
|
+
--cx-color-status-danger-fill-hover: light-dark(var(--cx-primitive-color-madder-800), var(--cx-primitive-color-madder-200));
|
|
144
148
|
--cx-color-status-info-text: light-dark(var(--cx-primitive-color-woad-700), var(--cx-primitive-color-woad-300));
|
|
145
149
|
--cx-color-status-info-surface: light-dark(var(--cx-primitive-color-woad-50), var(--cx-primitive-color-woad-950));
|
|
146
150
|
--cx-color-status-info-border: light-dark(var(--cx-primitive-color-woad-600), var(--cx-primitive-color-woad-400));
|
package/dist/tokens.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by npm run build. Do not edit.
|
|
2
|
-
export const version = "1.
|
|
2
|
+
export const version = "1.27.1";
|
|
3
3
|
export const changelog = "https://github.com/Aitrien/motifspec/blob/main/CHANGELOG.md";
|
|
4
4
|
export const showcase = "https://motifspec.com";
|
|
5
5
|
export const tokens = [
|
|
@@ -584,6 +584,17 @@ export const tokens = [
|
|
|
584
584
|
"valueDark": "#01441f",
|
|
585
585
|
"description": "Text selection and <mark>. Never for large areas or decoration."
|
|
586
586
|
},
|
|
587
|
+
{
|
|
588
|
+
"name": "color.surface.selected",
|
|
589
|
+
"css": "--cx-color-surface-selected",
|
|
590
|
+
"tier": "semantic",
|
|
591
|
+
"type": "color",
|
|
592
|
+
"references": "primitive.color.sap.100",
|
|
593
|
+
"referencesDark": "primitive.color.sap.800",
|
|
594
|
+
"value": "#d8f9df",
|
|
595
|
+
"valueDark": "#01441f",
|
|
596
|
+
"description": "The chosen item among options the reader picks from: a calendar's date, month or year (date-picker.md). With color.text.primary. Never for large areas or decoration."
|
|
597
|
+
},
|
|
587
598
|
{
|
|
588
599
|
"name": "color.text.primary",
|
|
589
600
|
"css": "--cx-color-text-primary",
|
|
@@ -615,6 +626,10 @@ export const tokens = [
|
|
|
615
626
|
"token": "color.surface.highlight",
|
|
616
627
|
"min": 7
|
|
617
628
|
},
|
|
629
|
+
{
|
|
630
|
+
"token": "color.surface.selected",
|
|
631
|
+
"min": 7
|
|
632
|
+
},
|
|
618
633
|
{
|
|
619
634
|
"token": "color.status.success.surface",
|
|
620
635
|
"min": 7
|
|
@@ -750,6 +765,27 @@ export const tokens = [
|
|
|
750
765
|
}
|
|
751
766
|
]
|
|
752
767
|
},
|
|
768
|
+
{
|
|
769
|
+
"name": "color.text.on-danger",
|
|
770
|
+
"css": "--cx-color-text-on-danger",
|
|
771
|
+
"tier": "semantic",
|
|
772
|
+
"type": "color",
|
|
773
|
+
"references": "primitive.color.ash.0",
|
|
774
|
+
"referencesDark": "primitive.color.ash.1000",
|
|
775
|
+
"value": "#fbfefd",
|
|
776
|
+
"valueDark": "#0e100f",
|
|
777
|
+
"description": "Text and icons on color.status.danger.fill and its hover, such as a danger button’s label. Only there.",
|
|
778
|
+
"pairsWith": [
|
|
779
|
+
{
|
|
780
|
+
"token": "color.status.danger.fill",
|
|
781
|
+
"min": 4.5
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
"token": "color.status.danger.fill-hover",
|
|
785
|
+
"min": 4.5
|
|
786
|
+
}
|
|
787
|
+
]
|
|
788
|
+
},
|
|
753
789
|
{
|
|
754
790
|
"name": "color.link.rest",
|
|
755
791
|
"css": "--cx-color-link-rest",
|
|
@@ -1137,6 +1173,52 @@ export const tokens = [
|
|
|
1137
1173
|
}
|
|
1138
1174
|
]
|
|
1139
1175
|
},
|
|
1176
|
+
{
|
|
1177
|
+
"name": "color.status.danger.fill",
|
|
1178
|
+
"css": "--cx-color-status-danger-fill",
|
|
1179
|
+
"tier": "semantic",
|
|
1180
|
+
"type": "color",
|
|
1181
|
+
"references": "primitive.color.madder.700",
|
|
1182
|
+
"referencesDark": "primitive.color.madder.300",
|
|
1183
|
+
"value": "#942f29",
|
|
1184
|
+
"valueDark": "#feb5ac",
|
|
1185
|
+
"description": "Fill of a button that deletes or stops something, in a dialog asking to confirm it (cx-button--danger, button-and-link.md). Its label says what it does; never the only sign.",
|
|
1186
|
+
"pairsWith": [
|
|
1187
|
+
{
|
|
1188
|
+
"token": "color.surface.base",
|
|
1189
|
+
"min": 3
|
|
1190
|
+
},
|
|
1191
|
+
{
|
|
1192
|
+
"token": "color.surface.raised",
|
|
1193
|
+
"min": 3
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
"token": "color.surface.sunken",
|
|
1197
|
+
"min": 3
|
|
1198
|
+
}
|
|
1199
|
+
]
|
|
1200
|
+
},
|
|
1201
|
+
{
|
|
1202
|
+
"name": "color.status.danger.fill-hover",
|
|
1203
|
+
"css": "--cx-color-status-danger-fill-hover",
|
|
1204
|
+
"tier": "semantic",
|
|
1205
|
+
"type": "color",
|
|
1206
|
+
"references": "primitive.color.madder.800",
|
|
1207
|
+
"referencesDark": "primitive.color.madder.200",
|
|
1208
|
+
"value": "#651916",
|
|
1209
|
+
"valueDark": "#ffd6d1",
|
|
1210
|
+
"description": "Fill of a danger button while hovered or pressed.",
|
|
1211
|
+
"pairsWith": [
|
|
1212
|
+
{
|
|
1213
|
+
"token": "color.surface.raised",
|
|
1214
|
+
"min": 3
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
"token": "color.surface.sunken",
|
|
1218
|
+
"min": 3
|
|
1219
|
+
}
|
|
1220
|
+
]
|
|
1221
|
+
},
|
|
1140
1222
|
{
|
|
1141
1223
|
"name": "color.status.info.text",
|
|
1142
1224
|
"css": "--cx-color-status-info-text",
|
package/dist/tokens.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.27.1",
|
|
3
3
|
"changelog": "https://github.com/Aitrien/motifspec/blob/main/CHANGELOG.md",
|
|
4
4
|
"showcase": "https://motifspec.com",
|
|
5
5
|
"tokens": [
|
|
@@ -584,6 +584,17 @@
|
|
|
584
584
|
"valueDark": "#01441f",
|
|
585
585
|
"description": "Text selection and <mark>. Never for large areas or decoration."
|
|
586
586
|
},
|
|
587
|
+
{
|
|
588
|
+
"name": "color.surface.selected",
|
|
589
|
+
"css": "--cx-color-surface-selected",
|
|
590
|
+
"tier": "semantic",
|
|
591
|
+
"type": "color",
|
|
592
|
+
"references": "primitive.color.sap.100",
|
|
593
|
+
"referencesDark": "primitive.color.sap.800",
|
|
594
|
+
"value": "#d8f9df",
|
|
595
|
+
"valueDark": "#01441f",
|
|
596
|
+
"description": "The chosen item among options the reader picks from: a calendar's date, month or year (date-picker.md). With color.text.primary. Never for large areas or decoration."
|
|
597
|
+
},
|
|
587
598
|
{
|
|
588
599
|
"name": "color.text.primary",
|
|
589
600
|
"css": "--cx-color-text-primary",
|
|
@@ -615,6 +626,10 @@
|
|
|
615
626
|
"token": "color.surface.highlight",
|
|
616
627
|
"min": 7
|
|
617
628
|
},
|
|
629
|
+
{
|
|
630
|
+
"token": "color.surface.selected",
|
|
631
|
+
"min": 7
|
|
632
|
+
},
|
|
618
633
|
{
|
|
619
634
|
"token": "color.status.success.surface",
|
|
620
635
|
"min": 7
|
|
@@ -750,6 +765,27 @@
|
|
|
750
765
|
}
|
|
751
766
|
]
|
|
752
767
|
},
|
|
768
|
+
{
|
|
769
|
+
"name": "color.text.on-danger",
|
|
770
|
+
"css": "--cx-color-text-on-danger",
|
|
771
|
+
"tier": "semantic",
|
|
772
|
+
"type": "color",
|
|
773
|
+
"references": "primitive.color.ash.0",
|
|
774
|
+
"referencesDark": "primitive.color.ash.1000",
|
|
775
|
+
"value": "#fbfefd",
|
|
776
|
+
"valueDark": "#0e100f",
|
|
777
|
+
"description": "Text and icons on color.status.danger.fill and its hover, such as a danger button’s label. Only there.",
|
|
778
|
+
"pairsWith": [
|
|
779
|
+
{
|
|
780
|
+
"token": "color.status.danger.fill",
|
|
781
|
+
"min": 4.5
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
"token": "color.status.danger.fill-hover",
|
|
785
|
+
"min": 4.5
|
|
786
|
+
}
|
|
787
|
+
]
|
|
788
|
+
},
|
|
753
789
|
{
|
|
754
790
|
"name": "color.link.rest",
|
|
755
791
|
"css": "--cx-color-link-rest",
|
|
@@ -1137,6 +1173,52 @@
|
|
|
1137
1173
|
}
|
|
1138
1174
|
]
|
|
1139
1175
|
},
|
|
1176
|
+
{
|
|
1177
|
+
"name": "color.status.danger.fill",
|
|
1178
|
+
"css": "--cx-color-status-danger-fill",
|
|
1179
|
+
"tier": "semantic",
|
|
1180
|
+
"type": "color",
|
|
1181
|
+
"references": "primitive.color.madder.700",
|
|
1182
|
+
"referencesDark": "primitive.color.madder.300",
|
|
1183
|
+
"value": "#942f29",
|
|
1184
|
+
"valueDark": "#feb5ac",
|
|
1185
|
+
"description": "Fill of a button that deletes or stops something, in a dialog asking to confirm it (cx-button--danger, button-and-link.md). Its label says what it does; never the only sign.",
|
|
1186
|
+
"pairsWith": [
|
|
1187
|
+
{
|
|
1188
|
+
"token": "color.surface.base",
|
|
1189
|
+
"min": 3
|
|
1190
|
+
},
|
|
1191
|
+
{
|
|
1192
|
+
"token": "color.surface.raised",
|
|
1193
|
+
"min": 3
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
"token": "color.surface.sunken",
|
|
1197
|
+
"min": 3
|
|
1198
|
+
}
|
|
1199
|
+
]
|
|
1200
|
+
},
|
|
1201
|
+
{
|
|
1202
|
+
"name": "color.status.danger.fill-hover",
|
|
1203
|
+
"css": "--cx-color-status-danger-fill-hover",
|
|
1204
|
+
"tier": "semantic",
|
|
1205
|
+
"type": "color",
|
|
1206
|
+
"references": "primitive.color.madder.800",
|
|
1207
|
+
"referencesDark": "primitive.color.madder.200",
|
|
1208
|
+
"value": "#651916",
|
|
1209
|
+
"valueDark": "#ffd6d1",
|
|
1210
|
+
"description": "Fill of a danger button while hovered or pressed.",
|
|
1211
|
+
"pairsWith": [
|
|
1212
|
+
{
|
|
1213
|
+
"token": "color.surface.raised",
|
|
1214
|
+
"min": 3
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
"token": "color.surface.sunken",
|
|
1218
|
+
"min": 3
|
|
1219
|
+
}
|
|
1220
|
+
]
|
|
1221
|
+
},
|
|
1140
1222
|
{
|
|
1141
1223
|
"name": "color.status.info.text",
|
|
1142
1224
|
"css": "--cx-color-status-info-text",
|
|
@@ -14,10 +14,13 @@ tokens:
|
|
|
14
14
|
- color.focus.ring
|
|
15
15
|
- color.link.hover
|
|
16
16
|
- color.link.rest
|
|
17
|
+
- color.status.danger.fill
|
|
18
|
+
- color.status.danger.fill-hover
|
|
17
19
|
- color.surface.hover
|
|
18
20
|
- color.surface.raised
|
|
19
21
|
- color.text.muted
|
|
20
22
|
- color.text.on-accent
|
|
23
|
+
- color.text.on-danger
|
|
21
24
|
- color.text.primary
|
|
22
25
|
- font.family.body
|
|
23
26
|
- font.family.mono
|
|
@@ -48,6 +51,7 @@ Buttons start actions or journeys; standalone links and back links move between
|
|
|
48
51
|
|
|
49
52
|
- `cx-button--primary`: the one main action in a view ("View work").
|
|
50
53
|
- `cx-button`: a secondary action beside it.
|
|
54
|
+
- `cx-button--danger`: the action that deletes or stops something, in a dialog that asks the reader to confirm it ("Remove service"; `dialog.md`).
|
|
51
55
|
- `cx-link`: a standalone forward link at the end of a section ("All projects" plus a forward arrow).
|
|
52
56
|
- `cx-back`: the return link at the top of a post or case study (back arrow plus "All writing").
|
|
53
57
|
|
|
@@ -55,6 +59,7 @@ Buttons start actions or journeys; standalone links and back links move between
|
|
|
55
59
|
|
|
56
60
|
- For inline links in text; `prose` styles those.
|
|
57
61
|
- Two primary buttons in one view. Make the second one secondary.
|
|
62
|
+
- `cx-button--danger` on a page or in a table row. A destructive action there opens a dialog, and the danger button is in the dialog.
|
|
58
63
|
- For navigation between sibling posts; use `pagination`.
|
|
59
64
|
|
|
60
65
|
## Markup
|
|
@@ -69,6 +74,15 @@ Buttons start actions or journeys; standalone links and back links move between
|
|
|
69
74
|
<a class="cx-back" href="/writing/"><svg class="cx-icon cx-icon--sm cx-button__arrow" aria-hidden="true" focusable="false"><use href="#cx-icon-arrow-back"></use></svg>All writing</a>
|
|
70
75
|
```
|
|
71
76
|
|
|
77
|
+
In a dialog that confirms a destructive action, the danger button takes the primary's place, after Cancel:
|
|
78
|
+
|
|
79
|
+
```html {preview=true}
|
|
80
|
+
<div class="cx-actions">
|
|
81
|
+
<button class="cx-button" type="button">Cancel</button>
|
|
82
|
+
<button class="cx-button cx-button--danger" type="button">Remove service</button>
|
|
83
|
+
</div>
|
|
84
|
+
```
|
|
85
|
+
|
|
72
86
|
Add `cx-button--sm` for a compact button in a table row or a toolbar, where full-size buttons would make every row tall:
|
|
73
87
|
|
|
74
88
|
```html {preview=true}
|
|
@@ -94,7 +108,7 @@ Add `cx-button--sm` for a compact button in a table row or a toolbar, where full
|
|
|
94
108
|
|
|
95
109
|
- Buttons are 40px tall (`size.target.control`); links at least 24px.
|
|
96
110
|
- Focus shows `color.focus.ring` 2px off the element, so it never sits on the green fill.
|
|
97
|
-
- Pairs: `color.text.on-accent` on `color.accent.fill.rest` and `.hover` (4.5:1); `color.accent.fill.rest` against the page (3:1); secondary border `color.border.strong` (3:1); `color.link.rest` (7:1).
|
|
111
|
+
- Pairs: `color.text.on-accent` on `color.accent.fill.rest` and `.hover` (4.5:1); `color.text.on-danger` on `color.status.danger.fill` and `.fill-hover` (4.5:1); `color.accent.fill.rest` against the page (3:1); secondary border `color.border.strong` (3:1); `color.link.rest` (7:1).
|
|
98
112
|
|
|
99
113
|
## Specimens
|
|
100
114
|
|
|
@@ -106,6 +120,10 @@ For the Components page: each variant at a glance. Ids start "sp-"; `wide=true`
|
|
|
106
120
|
<button class="cx-button" type="button" disabled>Not yet published</button>
|
|
107
121
|
```
|
|
108
122
|
|
|
123
|
+
```html {specimen="Danger"}
|
|
124
|
+
<button class="cx-button cx-button--danger" type="button">Remove service</button>
|
|
125
|
+
```
|
|
126
|
+
|
|
109
127
|
```html {specimen="Small"}
|
|
110
128
|
<a class="cx-button cx-button--sm" href="/reference/changelog/">Changelog</a>
|
|
111
129
|
```
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: choice
|
|
3
|
+
status: stable
|
|
4
|
+
layouts: [shared]
|
|
5
|
+
group: forms
|
|
6
|
+
tokens:
|
|
7
|
+
- border.focus.offset
|
|
8
|
+
- border.focus.width
|
|
9
|
+
- border.width.emphasis
|
|
10
|
+
- border.width.hairline
|
|
11
|
+
- color.accent.fill.rest
|
|
12
|
+
- color.border.strong
|
|
13
|
+
- color.focus.ring
|
|
14
|
+
- color.surface.sunken
|
|
15
|
+
- color.text.muted
|
|
16
|
+
- color.text.on-accent
|
|
17
|
+
- color.text.secondary
|
|
18
|
+
- font.line-height.ui
|
|
19
|
+
- font.size.small
|
|
20
|
+
- motion.duration.fast
|
|
21
|
+
- motion.easing.standard
|
|
22
|
+
- radius.pill
|
|
23
|
+
- size.icon.md
|
|
24
|
+
- size.target.min
|
|
25
|
+
- size.target.touch
|
|
26
|
+
- space.inline.sm
|
|
27
|
+
- space.stack.sm
|
|
28
|
+
- space.stack.xs
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
# Choice
|
|
32
|
+
|
|
33
|
+
A checkbox, radio button or switch, with its label beside it: native inputs in the accent colour.
|
|
34
|
+
|
|
35
|
+
## When to use
|
|
36
|
+
|
|
37
|
+
- A checkbox for one thing that's on or off when the form is sent ("Start when the node starts"), or for each of several that can all be on.
|
|
38
|
+
- Radio buttons for one choice among two to five, all shown at once.
|
|
39
|
+
- A switch for a setting that takes effect as soon as it's changed ("Send alerts").
|
|
40
|
+
|
|
41
|
+
## When not to use
|
|
42
|
+
|
|
43
|
+
- For more than five options, or options that don't need to be seen together; use a select (`field.md`).
|
|
44
|
+
- For switching between views of the same content; that's tabs (`tabs.md`).
|
|
45
|
+
- A switch in a form that waits for Save. Use a checkbox there.
|
|
46
|
+
|
|
47
|
+
## Markup
|
|
48
|
+
|
|
49
|
+
```html {preview=true}
|
|
50
|
+
<fieldset class="cx-fieldset">
|
|
51
|
+
<legend>When it fails</legend>
|
|
52
|
+
<div class="cx-choices">
|
|
53
|
+
<label class="cx-choice"><input type="radio" name="on-failure" value="restart" checked><span class="cx-choice__text">Restart it<span class="cx-field__hint">Up to 3 times, then stop and raise an alert.</span></span></label>
|
|
54
|
+
<label class="cx-choice"><input type="radio" name="on-failure" value="stop"><span class="cx-choice__text">Leave it stopped</span></label>
|
|
55
|
+
</div>
|
|
56
|
+
<label class="cx-choice"><input type="checkbox" name="start-on-boot" checked><span class="cx-choice__text">Start when the node starts</span></label>
|
|
57
|
+
<label class="cx-choice"><input type="checkbox" role="switch" name="alerts" checked><span class="cx-choice__text">Send alerts</span></label>
|
|
58
|
+
</fieldset>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
A switch is a checkbox with `role="switch"`. Its label names the setting, and the switch shows whether it's on.
|
|
62
|
+
|
|
63
|
+
## Do
|
|
64
|
+
|
|
65
|
+
- Put radio buttons in a `fieldset` whose `legend` asks the question, and give them one `name`.
|
|
66
|
+
- Write each label as what happens when it's chosen, in a few words. A hint can go under it, inside `cx-choice__text`.
|
|
67
|
+
- Pick a sensible default for radio buttons, so one is always chosen.
|
|
68
|
+
|
|
69
|
+
## Don't
|
|
70
|
+
|
|
71
|
+
- Don't use one checkbox with a negative label ("Don't send alerts").
|
|
72
|
+
- Don't make a switch wait for a Save button.
|
|
73
|
+
- Don't hide a disabled choice's reason; say it in a hint.
|
|
74
|
+
|
|
75
|
+
## Accessibility
|
|
76
|
+
|
|
77
|
+
- Each input is inside its label, so the whole line can be clicked or tapped, and it's at least `size.target.min` tall.
|
|
78
|
+
- Radio buttons in a fieldset are announced as a group, with the legend; the arrow keys move between them.
|
|
79
|
+
- A switch is announced as a switch, on or off.
|
|
80
|
+
- Focus shows `color.focus.ring` around the input.
|
|
81
|
+
- Pairs: `color.accent.fill.rest` against `color.surface.base` (3:1) for a ticked box or an on switch; `color.text.on-accent` for the switch's knob; `color.border.strong` for an off switch.
|
|
82
|
+
|
|
83
|
+
## Specimens
|
|
84
|
+
|
|
85
|
+
```html {specimen="Checkboxes"}
|
|
86
|
+
<div class="cx-choices">
|
|
87
|
+
<label class="cx-choice"><input type="checkbox" checked><span class="cx-choice__text">Start on boot</span></label>
|
|
88
|
+
<label class="cx-choice"><input type="checkbox"><span class="cx-choice__text">Pull a new image nightly</span></label>
|
|
89
|
+
</div>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
```html {specimen="Radio buttons"}
|
|
93
|
+
<div class="cx-choices">
|
|
94
|
+
<label class="cx-choice"><input type="radio" name="sp-choice-r" checked><span class="cx-choice__text">Restart it</span></label>
|
|
95
|
+
<label class="cx-choice"><input type="radio" name="sp-choice-r"><span class="cx-choice__text">Leave it stopped</span></label>
|
|
96
|
+
</div>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```html {specimen="Switch, on and off"}
|
|
100
|
+
<div class="cx-choices">
|
|
101
|
+
<label class="cx-choice"><input type="checkbox" role="switch" checked><span class="cx-choice__text">Send alerts</span></label>
|
|
102
|
+
<label class="cx-choice"><input type="checkbox" role="switch"><span class="cx-choice__text">Quiet hours</span></label>
|
|
103
|
+
</div>
|
|
104
|
+
```
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: date-picker
|
|
3
|
+
status: stable
|
|
4
|
+
layouts: [shared]
|
|
5
|
+
group: forms
|
|
6
|
+
tokens:
|
|
7
|
+
- border.focus.width
|
|
8
|
+
- border.width.hairline
|
|
9
|
+
- color.accent.border
|
|
10
|
+
- color.border.strong
|
|
11
|
+
- color.border.subtle
|
|
12
|
+
- color.focus.ring
|
|
13
|
+
- color.surface.hover
|
|
14
|
+
- color.surface.raised
|
|
15
|
+
- color.surface.selected
|
|
16
|
+
- color.text.accent
|
|
17
|
+
- color.text.muted
|
|
18
|
+
- color.text.primary
|
|
19
|
+
- color.text.secondary
|
|
20
|
+
- font.family.mono
|
|
21
|
+
- font.size.label
|
|
22
|
+
- font.size.small
|
|
23
|
+
- font.tracking.label
|
|
24
|
+
- font.weight.strong
|
|
25
|
+
- font.weight.ui
|
|
26
|
+
- motion.duration.fast
|
|
27
|
+
- motion.easing.standard
|
|
28
|
+
- radius.pill
|
|
29
|
+
- size.target.control
|
|
30
|
+
- size.target.touch
|
|
31
|
+
- space.inline.sm
|
|
32
|
+
- space.inline.xs
|
|
33
|
+
- space.inset.sm
|
|
34
|
+
- space.inset.xs
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
# Date picker
|
|
38
|
+
|
|
39
|
+
A date field with a button that opens a calendar, where the month and the year can each be picked from a grid.
|
|
40
|
+
|
|
41
|
+
## When to use
|
|
42
|
+
|
|
43
|
+
- When the date matters in relation to the days around it, such as a weekday for maintenance.
|
|
44
|
+
- When the reader may need to go a long way back, as for a date of birth: the year grid goes twenty years at a time.
|
|
45
|
+
- Where the calendar should look like the rest of the page.
|
|
46
|
+
|
|
47
|
+
## When not to use
|
|
48
|
+
|
|
49
|
+
- When the browser's own date field is enough: `<input type="date">` in a field (`field.md`) gives the reader's own calendar, in their language and date order, and the system's date wheel on a phone. It's the better choice in most forms.
|
|
50
|
+
- For a range of dates, or to grey out dates that can't be chosen; this calendar doesn't do either yet.
|
|
51
|
+
- For a time of day.
|
|
52
|
+
|
|
53
|
+
## Markup
|
|
54
|
+
|
|
55
|
+
```html {preview=true}
|
|
56
|
+
<div class="cx-field">
|
|
57
|
+
<div class="cx-field__box cx-field__box--date" data-date-picker>
|
|
58
|
+
<input class="cx-field__control cx-field__control--mono" id="maintenance-date" placeholder="DD/MM/YYYY" inputmode="numeric" autocomplete="off" value="12/12/2026" aria-describedby="maintenance-date-hint">
|
|
59
|
+
<label class="cx-field__label" for="maintenance-date">Maintenance date</label>
|
|
60
|
+
<button class="cx-date__button" type="button" aria-label="Choose a maintenance date" aria-haspopup="dialog" hidden><svg class="cx-icon" aria-hidden="true" focusable="false"><use href="#cx-icon-calendar"></use></svg></button>
|
|
61
|
+
</div>
|
|
62
|
+
<p class="cx-field__hint" id="maintenance-date-hint">Day, month and year, like 12/12/2026.</p>
|
|
63
|
+
</div>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The browser's own date field is a field with `type="date"`:
|
|
67
|
+
|
|
68
|
+
```html {preview=true}
|
|
69
|
+
<div class="cx-field">
|
|
70
|
+
<div class="cx-field__box">
|
|
71
|
+
<input class="cx-field__control cx-field__control--mono" id="backup-date" type="date" value="2026-12-12">
|
|
72
|
+
<label class="cx-field__label" for="backup-date">Backup date</label>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Do
|
|
78
|
+
|
|
79
|
+
- Keep the text field: typing a date is often quicker than finding it.
|
|
80
|
+
- Say the format in the hint ("Day, month and year, like 12/12/2026"). The calendar reads and writes day first.
|
|
81
|
+
- Name the button for what it chooses ("Choose a date of birth").
|
|
82
|
+
|
|
83
|
+
## Don't
|
|
84
|
+
|
|
85
|
+
- Don't make the field read-only so that the calendar is the only way in.
|
|
86
|
+
- Don't put two date pickers next to each other for a range. Use two fields with hints until a range picker exists.
|
|
87
|
+
|
|
88
|
+
## Accessibility
|
|
89
|
+
|
|
90
|
+
- The button is `hidden` until `codex.js` shows it, so without script the field still takes a typed date.
|
|
91
|
+
- The calendar is a non-modal dialog named by its button. Focus moves to the chosen date (or today) when it opens, and back to the button when it closes.
|
|
92
|
+
- The days, months and years are each a grid of buttons with one tab stop. Each day is named in full ("Saturday 12 December 2026"), today has `aria-current="date"`, the chosen date `aria-pressed="true"`, and the shown month is read out when it changes.
|
|
93
|
+
- Days are `size.target.touch` square, and the calendar is a fixed size, so its arrows never move under the pointer.
|
|
94
|
+
- Pairs: `color.text.primary` on `color.surface.selected` (the chosen date) and on `color.surface.raised`; `color.border.strong` outlines today.
|
|
95
|
+
|
|
96
|
+
## Behaviour
|
|
97
|
+
|
|
98
|
+
`dist/codex.js` does this; an app that renders the date picker itself does the same.
|
|
99
|
+
|
|
100
|
+
- **Opening:** the button opens one calendar for the page (a `popover`), on the field's date if it can read one, or today. Pressing it again closes it.
|
|
101
|
+
- **Placing:** under the field, or above it when there's more room there; left-aligned with it, kept inside the window, and in page coordinates, so it scrolls with the field.
|
|
102
|
+
- **Days:** the arrow keys move a day or a week, Page Up and Page Down a month, Home and End to the ends of the week (Monday to Sunday). Enter, Space or a click chooses the date, writes it as DD/MM/YYYY, fires `input` and `change` on the field, and closes the calendar.
|
|
103
|
+
- **Months and years:** the month and year at the top open a grid of the year's months, or of twenty years. The arrows at the sides then step a year, or twenty years. Choosing a year opens its months; choosing a month opens its days.
|
|
104
|
+
- **Closing:** Escape, a click outside, Close, or choosing a date. Today moves back to today.
|
|
105
|
+
|
|
106
|
+
## Specimens
|
|
107
|
+
|
|
108
|
+
None: the calendar opens from the field, so its page shows it working.
|