@handamade/psi-tokens 0.21.0 → 0.22.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/dist/components/field.d.ts +14 -1
- package/dist/components/field.js +15 -1
- package/dist/components/field.vars.css +1 -0
- package/dist/components/toolbar.d.ts +10 -0
- package/dist/components/toolbar.js +11 -0
- package/dist/components/toolbar.vars.css +1 -0
- package/dist/components.css +2 -0
- package/dist/guidance.json +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
/** Field component tokens (--psi-field-*). Label/message/error colors alias
|
|
2
|
-
* gated semantic fg tokens; gap is the label→control→message grid gap (D49).
|
|
2
|
+
* gated semantic fg tokens; gap is the label→control→message grid gap (D49).
|
|
3
|
+
*
|
|
4
|
+
* label-height (D92) is the label's line box: the line height of
|
|
5
|
+
* --psi-text-14-20-medium, which the label's `font` shorthand sets. A font
|
|
6
|
+
* shorthand exposes no line-height variable to read, and --psi-space-* is
|
|
7
|
+
* scoped to gap/padding/margin, so the height is a standalone 20px literal
|
|
8
|
+
* (the --psi-toolbar-control-width precedent). The label holds it as its
|
|
9
|
+
* min-block-size, and --psi-toolbar-action-offset is derived from it, so a
|
|
10
|
+
* filter row's unlabelled button and its labelled controls read one source.
|
|
11
|
+
* Change it together with the label's font. --psi-toolbar-action-offset
|
|
12
|
+
* resolves from this token and `gap` at the theme root: overriding either on
|
|
13
|
+
* a narrower scope inside a Toolbar align="start" row also needs
|
|
14
|
+
* --psi-toolbar-action-offset set on that same scope, or the row's button
|
|
15
|
+
* keeps the theme-root offset. */
|
|
3
16
|
export declare const fieldVars: Record<string, string>;
|
package/dist/components/field.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
/** Field component tokens (--psi-field-*). Label/message/error colors alias
|
|
2
|
-
* gated semantic fg tokens; gap is the label→control→message grid gap (D49).
|
|
2
|
+
* gated semantic fg tokens; gap is the label→control→message grid gap (D49).
|
|
3
|
+
*
|
|
4
|
+
* label-height (D92) is the label's line box: the line height of
|
|
5
|
+
* --psi-text-14-20-medium, which the label's `font` shorthand sets. A font
|
|
6
|
+
* shorthand exposes no line-height variable to read, and --psi-space-* is
|
|
7
|
+
* scoped to gap/padding/margin, so the height is a standalone 20px literal
|
|
8
|
+
* (the --psi-toolbar-control-width precedent). The label holds it as its
|
|
9
|
+
* min-block-size, and --psi-toolbar-action-offset is derived from it, so a
|
|
10
|
+
* filter row's unlabelled button and its labelled controls read one source.
|
|
11
|
+
* Change it together with the label's font. --psi-toolbar-action-offset
|
|
12
|
+
* resolves from this token and `gap` at the theme root: overriding either on
|
|
13
|
+
* a narrower scope inside a Toolbar align="start" row also needs
|
|
14
|
+
* --psi-toolbar-action-offset set on that same scope, or the row's button
|
|
15
|
+
* keeps the theme-root offset. */
|
|
3
16
|
export const fieldVars = {
|
|
4
17
|
"label-fg": "var(--psi-fg-secondary)",
|
|
5
18
|
"message-fg": "var(--psi-fg-tertiary)",
|
|
@@ -11,4 +24,5 @@ export const fieldVars = {
|
|
|
11
24
|
// foreground the contrast matrix does not gate.
|
|
12
25
|
"required-text-fg": "var(--psi-fg-secondary)",
|
|
13
26
|
gap: "var(--psi-space-6)",
|
|
27
|
+
"label-height": "20px",
|
|
14
28
|
};
|
|
@@ -9,5 +9,15 @@
|
|
|
9
9
|
* Dialog's width={400|560|720} precedent — no shared scale reaches this
|
|
10
10
|
* range (sizeScale tops at 48, spacingScale at 144, both for heights/gaps
|
|
11
11
|
* not component widths).
|
|
12
|
+
*
|
|
13
|
+
* action-offset (D92) moves an unlabelled button or link onto the control
|
|
14
|
+
* line of a `Toolbar align="start"` row: a Field's control starts one label
|
|
15
|
+
* line and one field gap below the Field's top. It is derived from Field's
|
|
16
|
+
* own tokens rather than restated, so the two cannot drift. The calc()
|
|
17
|
+
* resolves where it is declared, `:where(:root, [data-psi-theme])`: retuning
|
|
18
|
+
* --psi-field-label-height or --psi-field-gap there moves the button too;
|
|
19
|
+
* retuning either on a narrower scope needs this token set on that scope.
|
|
20
|
+
* Bound to margin-block-start in toolbar.module.css (Toolbar CSS may read
|
|
21
|
+
* only --psi-toolbar-* and the scales, so it reads Field through this).
|
|
12
22
|
*/
|
|
13
23
|
export declare const toolbarVars: Record<string, string>;
|
|
@@ -9,7 +9,18 @@
|
|
|
9
9
|
* Dialog's width={400|560|720} precedent — no shared scale reaches this
|
|
10
10
|
* range (sizeScale tops at 48, spacingScale at 144, both for heights/gaps
|
|
11
11
|
* not component widths).
|
|
12
|
+
*
|
|
13
|
+
* action-offset (D92) moves an unlabelled button or link onto the control
|
|
14
|
+
* line of a `Toolbar align="start"` row: a Field's control starts one label
|
|
15
|
+
* line and one field gap below the Field's top. It is derived from Field's
|
|
16
|
+
* own tokens rather than restated, so the two cannot drift. The calc()
|
|
17
|
+
* resolves where it is declared, `:where(:root, [data-psi-theme])`: retuning
|
|
18
|
+
* --psi-field-label-height or --psi-field-gap there moves the button too;
|
|
19
|
+
* retuning either on a narrower scope needs this token set on that scope.
|
|
20
|
+
* Bound to margin-block-start in toolbar.module.css (Toolbar CSS may read
|
|
21
|
+
* only --psi-toolbar-* and the scales, so it reads Field through this).
|
|
12
22
|
*/
|
|
13
23
|
export const toolbarVars = {
|
|
14
24
|
"control-width": "200px",
|
|
25
|
+
"action-offset": "calc(var(--psi-field-label-height) + var(--psi-field-gap))",
|
|
15
26
|
};
|
package/dist/components.css
CHANGED
|
@@ -158,6 +158,7 @@
|
|
|
158
158
|
--psi-field-marker-fg: var(--psi-fg-danger);
|
|
159
159
|
--psi-field-required-text-fg: var(--psi-fg-secondary);
|
|
160
160
|
--psi-field-gap: var(--psi-space-6);
|
|
161
|
+
--psi-field-label-height: 20px;
|
|
161
162
|
}
|
|
162
163
|
}
|
|
163
164
|
|
|
@@ -407,6 +408,7 @@
|
|
|
407
408
|
@layer psi.components {
|
|
408
409
|
:where(:root, [data-psi-theme]) {
|
|
409
410
|
--psi-toolbar-control-width: 200px;
|
|
411
|
+
--psi-toolbar-action-offset: calc(var(--psi-field-label-height) + var(--psi-field-gap));
|
|
410
412
|
}
|
|
411
413
|
}
|
|
412
414
|
|
package/dist/guidance.json
CHANGED
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"Override component tokens (--psi-{component}-*), not semantic tokens, for one-off theming.",
|
|
55
55
|
"--psi-button-font overrides button typography across all sizes (documented D34 override; ember → mono).",
|
|
56
56
|
"Wrap labeled form controls in Field — label association, description/error line, aria-describedby and aria-invalid come wired; don't hand-roll label+message rows.",
|
|
57
|
-
"Field is for a control with a *visible* label. A toolbar filter control named by aria-label or placeholder takes neither a Field nor a hand-rolled label row — compare filter-toolbar (no labels) with table-pagination (\"Rows per page\" visible, so Field). Filters with visible labels submitted together by a Find button are filter-form: a Toolbar as=\"form\" align=\"
|
|
57
|
+
"Field is for a control with a *visible* label. A toolbar filter control named by aria-label or placeholder takes neither a Field nor a hand-rolled label row — compare filter-toolbar (no labels) with table-pagination (\"Rows per page\" visible, so Field). Filters with visible labels submitted together by a Find button are filter-form: a Toolbar as=\"form\" align=\"start\" of Fields with one-line labels, where a field's error line is the Field's own and hangs below its control (D87, D92).",
|
|
58
58
|
"Use Dialog for blocking modal flows — title/footer slots, dismissible gate; danger stays on the footer Buttons, one accent per group."
|
|
59
59
|
],
|
|
60
60
|
"states": {
|