@biffo/design-tokens 0.425.0 → 0.427.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/kit.css ADDED
@@ -0,0 +1,152 @@
1
+ /**
2
+ * Biffo admin UI kit — the shared look for the portal and for plugin admin
3
+ * panels, so a panel opened from the portal reads as part of it (#2495).
4
+ *
5
+ * import '@biffo/design-tokens/tokens.css'
6
+ * import '@biffo/design-tokens/kit.css'
7
+ *
8
+ * Built only from the tokens in tokens.css (every colour is a `var(--…)`), so
9
+ * a token change reaches the kit too. tokens.css must be loaded first.
10
+ *
11
+ * Matches the portal's current look: near-black primary button, outline
12
+ * "delete" button in the negative (rose) tone, 24px bold page heading, and the
13
+ * `ui-sans-serif, system-ui` font stack.
14
+ *
15
+ * CLASSES
16
+ * .biffo-kit optional wrapper/body class: font stack, text colour
17
+ * .biffo-heading page heading (use on the page's h1)
18
+ * .biffo-btn-primary primary action, near-black fill
19
+ * .biffo-btn-delete outline destructive action
20
+ * .biffo-badge status badge; add one modifier:
21
+ * .biffo-badge--positive | --caution | --negative
22
+ * .biffo-confirm in-page confirm row (replaces window.confirm):
23
+ * <span class="biffo-confirm">
24
+ * <span class="biffo-confirm__prompt">Delete this agent?</span>
25
+ * <button class="biffo-btn-delete biffo-confirm__yes">Delete</button>
26
+ * <button class="biffo-confirm__no">Cancel</button>
27
+ * </span>
28
+ *
29
+ * STATUS WORDING
30
+ * One canonical wording and casing: Title case ("Active", "Enabled",
31
+ * "Disabled", …). Never "ACTIVE" or "enabled". Rendering the stored value
32
+ * through `statusLabel()` from '@biffo/design-tokens/status.mjs' gives it;
33
+ * the CSS `text-transform: none` on .biffo-badge stops a stylesheet
34
+ * upper-casing it. `statusTone()` returns the matching badge modifier.
35
+ */
36
+
37
+ .biffo-kit {
38
+ font-family: ui-sans-serif, system-ui, sans-serif;
39
+ color: var(--text);
40
+ background: var(--bg);
41
+ }
42
+
43
+ .biffo-heading {
44
+ font-family: ui-sans-serif, system-ui, sans-serif;
45
+ font-size: 24px;
46
+ font-weight: 700;
47
+ line-height: 1.25;
48
+ color: var(--text);
49
+ margin: 0 0 1rem;
50
+ }
51
+
52
+ .biffo-btn-primary,
53
+ .biffo-btn-delete,
54
+ .biffo-confirm__no {
55
+ font-family: inherit;
56
+ font-size: 0.875rem;
57
+ font-weight: 500;
58
+ line-height: 1.25rem;
59
+ padding: 0.375rem 0.75rem;
60
+ border-radius: 0.25rem;
61
+ border: 1px solid transparent;
62
+ cursor: pointer;
63
+ }
64
+
65
+ .biffo-btn-primary {
66
+ background: var(--text);
67
+ border-color: var(--text);
68
+ color: var(--text-invert);
69
+ }
70
+
71
+ .biffo-btn-primary:hover:not(:disabled) {
72
+ background: var(--ink);
73
+ }
74
+
75
+ .biffo-btn-delete {
76
+ background: var(--bg);
77
+ border-color: var(--state-negative);
78
+ color: var(--state-negative);
79
+ }
80
+
81
+ .biffo-btn-delete:hover:not(:disabled) {
82
+ background: var(--state-negative-soft);
83
+ }
84
+
85
+ .biffo-confirm__no {
86
+ background: var(--bg);
87
+ border-color: var(--border-strong);
88
+ color: var(--text);
89
+ }
90
+
91
+ .biffo-btn-primary:disabled,
92
+ .biffo-btn-delete:disabled,
93
+ .biffo-confirm__no:disabled {
94
+ opacity: 0.5;
95
+ cursor: not-allowed;
96
+ }
97
+
98
+ .biffo-btn-primary:focus-visible,
99
+ .biffo-btn-delete:focus-visible,
100
+ .biffo-confirm__no:focus-visible {
101
+ outline: 2px solid var(--brand);
102
+ outline-offset: 2px;
103
+ }
104
+
105
+ .biffo-badge {
106
+ display: inline-block;
107
+ font-size: 0.75rem;
108
+ font-weight: 500;
109
+ line-height: 1rem;
110
+ padding: 0.125rem 0.5rem;
111
+ border-radius: var(--radius-lg);
112
+ text-transform: none;
113
+ background: var(--bg-subtle);
114
+ color: var(--text-muted);
115
+ }
116
+
117
+ .biffo-badge--positive {
118
+ background: var(--state-positive-soft);
119
+ color: var(--state-positive);
120
+ }
121
+
122
+ .biffo-badge--caution {
123
+ background: var(--state-caution-soft);
124
+ color: var(--state-caution);
125
+ }
126
+
127
+ .biffo-badge--negative {
128
+ background: var(--state-negative-soft);
129
+ color: var(--state-negative);
130
+ }
131
+
132
+ .biffo-confirm {
133
+ display: inline-flex;
134
+ align-items: center;
135
+ gap: 0.5rem;
136
+ }
137
+
138
+ .biffo-confirm__prompt {
139
+ font-size: 0.75rem;
140
+ color: var(--state-negative);
141
+ }
142
+
143
+ .biffo-confirm__yes {
144
+ background: var(--state-negative);
145
+ border-color: var(--state-negative);
146
+ color: var(--text-invert);
147
+ }
148
+
149
+ .biffo-confirm__yes:hover:not(:disabled) {
150
+ background: var(--state-negative);
151
+ opacity: 0.9;
152
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biffo/design-tokens",
3
- "version": "0.425.0",
3
+ "version": "0.427.0",
4
4
  "description": "Biffo's design tokens — one definition of the platform's visual language, for the portal, sibling apps and plugin frontends.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -13,6 +13,11 @@
13
13
  ],
14
14
  "exports": {
15
15
  "./tokens.css": "./tokens.css",
16
+ "./kit.css": "./kit.css",
17
+ "./status.mjs": {
18
+ "types": "./status.d.mts",
19
+ "default": "./status.mjs"
20
+ },
16
21
  "./package.json": "./package.json"
17
22
  },
18
23
  "bin": {
@@ -20,6 +25,9 @@
20
25
  },
21
26
  "files": [
22
27
  "tokens.css",
28
+ "kit.css",
29
+ "status.mjs",
30
+ "status.d.mts",
23
31
  "bin/scale-guard.mjs",
24
32
  "bin/scale-guard-lib.mjs"
25
33
  ],
package/status.d.mts ADDED
@@ -0,0 +1,4 @@
1
+ export declare const STATUS_LABELS: Readonly<Record<string, string>>
2
+ export declare const STATUS_TONES: Readonly<Record<string, 'positive' | 'caution' | 'negative'>>
3
+ export declare function statusLabel(value: unknown): string
4
+ export declare function statusBadgeClass(value: unknown): string
package/status.mjs ADDED
@@ -0,0 +1,47 @@
1
+ // Canonical status wording for Biffo admin surfaces (#2495).
2
+ //
3
+ // One wording, one casing: Title case. The same state was previously written
4
+ // "ACTIVE", "Active" and "enabled" on three surfaces. Pair with the
5
+ // `.biffo-badge` classes in kit.css.
6
+
7
+ /** Stored value (any casing) -> canonical label. */
8
+ export const STATUS_LABELS = Object.freeze({
9
+ active: 'Active',
10
+ inactive: 'Inactive',
11
+ enabled: 'Enabled',
12
+ disabled: 'Disabled',
13
+ pending: 'Pending',
14
+ draft: 'Draft',
15
+ archived: 'Archived',
16
+ failed: 'Failed',
17
+ error: 'Error',
18
+ })
19
+
20
+ /** Stored value (any casing) -> kit.css badge modifier. */
21
+ export const STATUS_TONES = Object.freeze({
22
+ active: 'positive',
23
+ enabled: 'positive',
24
+ pending: 'caution',
25
+ draft: 'caution',
26
+ failed: 'negative',
27
+ error: 'negative',
28
+ })
29
+
30
+ function key(value) {
31
+ return String(value ?? '')
32
+ .trim()
33
+ .toLowerCase()
34
+ }
35
+
36
+ /** Canonical label; unknown values are Title-cased rather than passed through. */
37
+ export function statusLabel(value) {
38
+ const k = key(value)
39
+ if (k in STATUS_LABELS) return STATUS_LABELS[k]
40
+ return k.charAt(0).toUpperCase() + k.slice(1)
41
+ }
42
+
43
+ /** Badge class string, e.g. "biffo-badge biffo-badge--positive". */
44
+ export function statusBadgeClass(value) {
45
+ const tone = STATUS_TONES[key(value)]
46
+ return tone ? `biffo-badge biffo-badge--${tone}` : 'biffo-badge'
47
+ }