@appdirect/design-system 0.0.12 → 0.0.14
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 +19 -0
- package/bin/ad-sync-design-md.mjs +168 -0
- package/dist/DESIGN.md +635 -0
- package/dist/contracts/index.json +1 -1
- package/dist/css/mantine.css +2 -2
- package/dist/stories/index.json +1 -1
- package/package.json +8 -3
package/README.md
CHANGED
|
@@ -23,10 +23,29 @@ Peer dependencies (install at the versions declared by this package):
|
|
|
23
23
|
| Config / shared types | `@appdirect/design-system/config`, `@appdirect/design-system/types` | Scales, variant unions |
|
|
24
24
|
| Stories (source) | `@appdirect/design-system/stories`, `.../stories/*` | Agent / designer reference patterns (`add-feature`) |
|
|
25
25
|
| Contracts | `@appdirect/design-system/contracts`, `.../contracts/*` | `ds-audit` and enforcement |
|
|
26
|
+
| Design spec | `@appdirect/design-system/DESIGN.md` | Canonical `apps/design-system/DESIGN.md` (token tables + prose) |
|
|
26
27
|
| CLI | `ds-audit` | Audit a prototype or app against contracts |
|
|
28
|
+
| CLI | `ad-sync-design-md` | Copy `DESIGN.md` into the consumer repo (`postinstall` / `sync-design-docs`) |
|
|
27
29
|
|
|
28
30
|
Bundlers (Rspack, webpack, Vite, Next) should resolve the package entry to **`.js`**. You do **not** need `transpilePackages` / SWC includes for this package’s TypeScript. Keep loading `*.module.css` from the package with your CSS-modules rule.
|
|
29
31
|
|
|
32
|
+
## Keep `DESIGN.md` in sync
|
|
33
|
+
|
|
34
|
+
Do **not** hand-copy the design spec. Wire consumers to pull the published file on install:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"scripts": {
|
|
39
|
+
"postinstall": "ad-sync-design-md",
|
|
40
|
+
"sync-design-docs": "ad-sync-design-md"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- Default destination: `docs/DESIGN.md`
|
|
46
|
+
- Repo-root destination: `DESIGN_MD_PATH=DESIGN.md` or `ad-sync-design-md --out DESIGN.md`
|
|
47
|
+
- Authoring source of truth in this monorepo: [`apps/design-system/DESIGN.md`](../../apps/design-system/DESIGN.md)
|
|
48
|
+
|
|
30
49
|
## App usage
|
|
31
50
|
|
|
32
51
|
Load token CSS once near the app root (standalone prototypes often use this package’s CSS re-exports; the tokens package is the same files):
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Copy the published DESIGN.md from @appdirect/design-system into the
|
|
4
|
+
* consumer repo (default: docs/DESIGN.md).
|
|
5
|
+
*
|
|
6
|
+
* Canonical source in this monorepo: apps/design-system/DESIGN.md
|
|
7
|
+
* (copied into dist/DESIGN.md at package build time).
|
|
8
|
+
*
|
|
9
|
+
* Intended for consumer package.json:
|
|
10
|
+
* "postinstall": "ad-sync-design-md"
|
|
11
|
+
* "sync-design-docs": "ad-sync-design-md"
|
|
12
|
+
*
|
|
13
|
+
* Options:
|
|
14
|
+
* --out <path> Destination relative to the consumer project root
|
|
15
|
+
* (default: docs/DESIGN.md, or DESIGN_MD_PATH env)
|
|
16
|
+
* --dry-run Print the planned write without changing files
|
|
17
|
+
* --help Show usage
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { realpathSync } from 'node:fs';
|
|
21
|
+
import { mkdir, readFile, writeFile, access } from 'node:fs/promises';
|
|
22
|
+
import path from 'node:path';
|
|
23
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
24
|
+
|
|
25
|
+
const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
26
|
+
const DEFAULT_SOURCE = path.join(PACKAGE_ROOT, 'dist', 'DESIGN.md');
|
|
27
|
+
const DEFAULT_OUT = 'docs/DESIGN.md';
|
|
28
|
+
|
|
29
|
+
export function parseArgs(argv) {
|
|
30
|
+
const args = { out: process.env.DESIGN_MD_PATH || DEFAULT_OUT, dryRun: false, help: false };
|
|
31
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
32
|
+
const arg = argv[i];
|
|
33
|
+
if (arg === '--help' || arg === '-h') {
|
|
34
|
+
args.help = true;
|
|
35
|
+
} else if (arg === '--dry-run') {
|
|
36
|
+
args.dryRun = true;
|
|
37
|
+
} else if (arg === '--out') {
|
|
38
|
+
const next = argv[i + 1];
|
|
39
|
+
if (!next || next.startsWith('-')) {
|
|
40
|
+
throw new Error('--out requires a path argument');
|
|
41
|
+
}
|
|
42
|
+
args.out = next;
|
|
43
|
+
i += 1;
|
|
44
|
+
} else {
|
|
45
|
+
throw new Error(`Unknown argument: ${arg}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return args;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function resolveProjectRoot(options = {}) {
|
|
52
|
+
const initCwd = Object.prototype.hasOwnProperty.call(options, 'initCwd')
|
|
53
|
+
? options.initCwd
|
|
54
|
+
: process.env.INIT_CWD;
|
|
55
|
+
const cwd = Object.prototype.hasOwnProperty.call(options, 'cwd')
|
|
56
|
+
? options.cwd
|
|
57
|
+
: process.cwd();
|
|
58
|
+
if (typeof initCwd === 'string' && initCwd.length > 0 && path.isAbsolute(initCwd)) {
|
|
59
|
+
return initCwd;
|
|
60
|
+
}
|
|
61
|
+
return cwd;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Copy package DESIGN.md into the consumer. Idempotent when contents match.
|
|
66
|
+
*/
|
|
67
|
+
export async function syncDesignMd({
|
|
68
|
+
sourcePath = DEFAULT_SOURCE,
|
|
69
|
+
projectRoot = resolveProjectRoot(),
|
|
70
|
+
outRelative = DEFAULT_OUT,
|
|
71
|
+
dryRun = false,
|
|
72
|
+
readFn = readFile,
|
|
73
|
+
writeFn = writeFile,
|
|
74
|
+
mkdirFn = mkdir,
|
|
75
|
+
accessFn = access,
|
|
76
|
+
log = console.log,
|
|
77
|
+
warn = console.warn,
|
|
78
|
+
} = {}) {
|
|
79
|
+
try {
|
|
80
|
+
await accessFn(sourcePath);
|
|
81
|
+
} catch {
|
|
82
|
+
warn(`[ad-sync-design-md] Source not found at ${sourcePath}`);
|
|
83
|
+
warn(
|
|
84
|
+
'[ad-sync-design-md] Skipping. Build or upgrade @appdirect/design-system to enable sync.'
|
|
85
|
+
);
|
|
86
|
+
return { status: 'skipped', reason: 'source-missing' };
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const destPath = path.isAbsolute(outRelative)
|
|
90
|
+
? outRelative
|
|
91
|
+
: path.resolve(projectRoot, outRelative);
|
|
92
|
+
|
|
93
|
+
const next = await readFn(sourcePath, 'utf8');
|
|
94
|
+
|
|
95
|
+
let previous = null;
|
|
96
|
+
try {
|
|
97
|
+
previous = await readFn(destPath, 'utf8');
|
|
98
|
+
} catch (err) {
|
|
99
|
+
if (err.code !== 'ENOENT') {
|
|
100
|
+
throw err;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (previous === next) {
|
|
105
|
+
log(`[ad-sync-design-md] Already in sync: ${path.relative(projectRoot, destPath) || destPath}`);
|
|
106
|
+
return { status: 'unchanged', destPath };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (dryRun) {
|
|
110
|
+
log(`[ad-sync-design-md] Dry run: would write ${destPath}`);
|
|
111
|
+
return { status: 'dry-run', destPath };
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
await mkdirFn(path.dirname(destPath), { recursive: true });
|
|
115
|
+
await writeFn(destPath, next, 'utf8');
|
|
116
|
+
log(`[ad-sync-design-md] Updated ${path.relative(projectRoot, destPath) || destPath}`);
|
|
117
|
+
return { status: 'updated', destPath };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function printHelp() {
|
|
121
|
+
console.log(`Usage: ad-sync-design-md [--out <path>] [--dry-run]
|
|
122
|
+
|
|
123
|
+
Copies @appdirect/design-system/dist/DESIGN.md into the consumer project.
|
|
124
|
+
|
|
125
|
+
Default destination: docs/DESIGN.md
|
|
126
|
+
Override with --out or DESIGN_MD_PATH (e.g. DESIGN.md for repo root).
|
|
127
|
+
|
|
128
|
+
Canonical authoring path in the monorepo: apps/design-system/DESIGN.md
|
|
129
|
+
`);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* True when this file is the process entrypoint. Resolve symlinks so npm's
|
|
134
|
+
* `node_modules/.bin/ad-sync-design-md` link still matches import.meta.url
|
|
135
|
+
* (Node realpaths the module URL).
|
|
136
|
+
*/
|
|
137
|
+
export function isCliEntrypoint({
|
|
138
|
+
argv1 = process.argv[1],
|
|
139
|
+
moduleUrl = import.meta.url,
|
|
140
|
+
realpathFn = realpathSync,
|
|
141
|
+
} = {}) {
|
|
142
|
+
if (!argv1) return false;
|
|
143
|
+
try {
|
|
144
|
+
return moduleUrl === pathToFileURL(realpathFn(path.resolve(argv1))).href;
|
|
145
|
+
} catch {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (isCliEntrypoint()) {
|
|
151
|
+
try {
|
|
152
|
+
const args = parseArgs(process.argv.slice(2));
|
|
153
|
+
if (args.help) {
|
|
154
|
+
printHelp();
|
|
155
|
+
process.exit(0);
|
|
156
|
+
}
|
|
157
|
+
const result = await syncDesignMd({
|
|
158
|
+
outRelative: args.out,
|
|
159
|
+
dryRun: args.dryRun,
|
|
160
|
+
});
|
|
161
|
+
if (result.status === 'skipped') {
|
|
162
|
+
process.exit(0);
|
|
163
|
+
}
|
|
164
|
+
} catch (err) {
|
|
165
|
+
console.error(`[ad-sync-design-md] ${err.message}`);
|
|
166
|
+
process.exit(1);
|
|
167
|
+
}
|
|
168
|
+
}
|
package/dist/DESIGN.md
ADDED
|
@@ -0,0 +1,635 @@
|
|
|
1
|
+
---
|
|
2
|
+
version: alpha
|
|
3
|
+
name: AppDirect Admin
|
|
4
|
+
description: Design tokens for AppDirect admin-facing web UIs built on Mantine 9. Sourced from @appdirect/design-tokens (^0.0.6) — CSS variables are the authoritative runtime values.
|
|
5
|
+
colors:
|
|
6
|
+
# Brand + interaction
|
|
7
|
+
primary: "#326FDE" # blue.6 — A11y-compliant override of Open Color blue; --ad-color-brand-primary
|
|
8
|
+
primary-hover: "#1c7ed6" # blue.7; --ad-color-brand-primary-hover
|
|
9
|
+
primary-active: "#1971c2" # blue.8; --ad-action-primary-bg-active
|
|
10
|
+
on-primary: "#f8f9fa" # gray.0; --ad-color-brand-on-primary
|
|
11
|
+
secondary: "#15aabf" # cyan.6; --ad-action-secondary-bg (AppDirect secondary action color)
|
|
12
|
+
secondary-hover: "#1098ad" # cyan.7; --ad-action-secondary-bg-hover
|
|
13
|
+
on-secondary: "#000000" # black; --ad-action-secondary-fg (A11Y: black on cyan.6 = 7.53:1)
|
|
14
|
+
# App chrome (pending tokenization)
|
|
15
|
+
navy: "#011B58" # AppDirect header/nav background — hardcoded in AppShellLayout.tsx; no --ad-* variable yet
|
|
16
|
+
# Surfaces
|
|
17
|
+
surface: "#ffffff" # --ad-color-bg-default
|
|
18
|
+
surface-subtle: "#f1f3f5" # gray.1; --ad-color-bg-subtle
|
|
19
|
+
surface-muted: "#e9ecef" # gray.2; --ad-color-bg-muted
|
|
20
|
+
surface-tinted: "#f1f3f5" # gray.1; --ad-color-bg-tinted (recessed containers, e.g. SegmentedControl)
|
|
21
|
+
surface-control: "#dee2e6" # gray.3; --ad-color-bg-control (Switch unchecked track)
|
|
22
|
+
# Text
|
|
23
|
+
on-surface: "#000000" # --ad-color-text-default
|
|
24
|
+
on-surface-dimmed: "#868e96" # gray.6; --ad-color-text-dimmed
|
|
25
|
+
on-surface-placeholder: "#adb5bd" # gray.5; --ad-color-text-placeholder
|
|
26
|
+
text-link: "#326FDE" # blue.6; --ad-color-text-link
|
|
27
|
+
text-inverse: "#f8f9fa" # gray.0; --ad-color-text-inverse (text on dark surfaces)
|
|
28
|
+
# Borders / dividers
|
|
29
|
+
border: "#ced4da" # gray.4; --ad-color-border-default
|
|
30
|
+
border-subtle: "#e9ecef" # gray.2; --ad-color-border-subtle
|
|
31
|
+
border-strong: "#868e96" # gray.6; --ad-color-border-strong
|
|
32
|
+
border-primary: "#326FDE" # blue.6; --ad-color-border-primary (focus rings, active inputs)
|
|
33
|
+
# Status
|
|
34
|
+
info: "#326FDE" # blue.6; --ad-color-status-info
|
|
35
|
+
on-info: "#ffffff" # --ad-color-status-on-info
|
|
36
|
+
success: "#40c057" # green.6; --ad-color-status-success
|
|
37
|
+
on-success: "#ffffff" # --ad-color-status-on-success
|
|
38
|
+
pending: "#fab005" # yellow.6; --ad-color-status-warning (Badge, Chip, Indicator, Alert use "pending")
|
|
39
|
+
warning: "#fab005" # yellow.6; token alias for pending (Badge still accepts `warning`)
|
|
40
|
+
on-warning: "#000000" # --ad-color-status-on-warning (A11Y override: dark text on yellow bg)
|
|
41
|
+
danger: "#fa5252" # red.6; --ad-color-status-error
|
|
42
|
+
on-danger: "#ffffff" # --ad-color-status-on-error
|
|
43
|
+
# State
|
|
44
|
+
disabled: "#e9ecef" # gray.2; --ad-color-state-disabled
|
|
45
|
+
disabled-text: "#adb5bd" # gray.5; --ad-color-state-disabled-text
|
|
46
|
+
disabled-border: "#dee2e6" # gray.3; --ad-color-state-disabled-border
|
|
47
|
+
# Neutral scale endpoints
|
|
48
|
+
neutral-0: "#f8f9fa" # gray.0
|
|
49
|
+
neutral-9: "#212529" # gray.9
|
|
50
|
+
typography:
|
|
51
|
+
h1:
|
|
52
|
+
fontFamily: Inter
|
|
53
|
+
fontSize: 34px # --ad-headings-sizes-h1-font-size
|
|
54
|
+
fontWeight: 700 # --ad-headings-font-weight
|
|
55
|
+
lineHeight: 1.3 # --ad-headings-sizes-h1-line-height
|
|
56
|
+
h2:
|
|
57
|
+
fontFamily: Inter
|
|
58
|
+
fontSize: 26px
|
|
59
|
+
fontWeight: 700
|
|
60
|
+
lineHeight: 1.35
|
|
61
|
+
h3:
|
|
62
|
+
fontFamily: Inter
|
|
63
|
+
fontSize: 22px
|
|
64
|
+
fontWeight: 700
|
|
65
|
+
lineHeight: 1.4
|
|
66
|
+
h4:
|
|
67
|
+
fontFamily: Inter
|
|
68
|
+
fontSize: 18px
|
|
69
|
+
fontWeight: 700
|
|
70
|
+
lineHeight: 1.45
|
|
71
|
+
h5:
|
|
72
|
+
fontFamily: Inter
|
|
73
|
+
fontSize: 16px
|
|
74
|
+
fontWeight: 700
|
|
75
|
+
lineHeight: 1.5
|
|
76
|
+
h6:
|
|
77
|
+
fontFamily: Inter
|
|
78
|
+
fontSize: 14px
|
|
79
|
+
fontWeight: 700
|
|
80
|
+
lineHeight: 1.5
|
|
81
|
+
body-lg:
|
|
82
|
+
fontFamily: Inter
|
|
83
|
+
fontSize: 18px # --ad-font-sizes-lg
|
|
84
|
+
fontWeight: 400 # --ad-font-weights-regular
|
|
85
|
+
lineHeight: 1.6 # --ad-line-heights-lg
|
|
86
|
+
body-md:
|
|
87
|
+
fontFamily: Inter
|
|
88
|
+
fontSize: 16px # --ad-font-sizes-md
|
|
89
|
+
fontWeight: 400
|
|
90
|
+
lineHeight: 1.55 # --ad-line-heights-md
|
|
91
|
+
body-sm:
|
|
92
|
+
fontFamily: Inter
|
|
93
|
+
fontSize: 14px # --ad-font-sizes-sm
|
|
94
|
+
fontWeight: 400
|
|
95
|
+
lineHeight: 1.45 # --ad-line-heights-sm
|
|
96
|
+
label-md:
|
|
97
|
+
fontFamily: Inter
|
|
98
|
+
fontSize: 14px
|
|
99
|
+
fontWeight: 600 # --ad-font-weights-medium
|
|
100
|
+
lineHeight: 1
|
|
101
|
+
label-sm:
|
|
102
|
+
fontFamily: Inter
|
|
103
|
+
fontSize: 12px # --ad-font-sizes-xs
|
|
104
|
+
fontWeight: 600
|
|
105
|
+
lineHeight: 1
|
|
106
|
+
code:
|
|
107
|
+
fontFamily: Roboto Mono # --ad-font-family-monospace
|
|
108
|
+
fontSize: 14px
|
|
109
|
+
fontWeight: 400
|
|
110
|
+
lineHeight: 1.4
|
|
111
|
+
icon-sizes:
|
|
112
|
+
xs: 12px # --ad-icon-size-xs
|
|
113
|
+
sm: 14px # --ad-icon-size-sm
|
|
114
|
+
md: 16px # --ad-icon-size-md (default for most inline icons)
|
|
115
|
+
lg: 18px # --ad-icon-size-lg
|
|
116
|
+
xl: 20px # --ad-icon-size-xl
|
|
117
|
+
rounded:
|
|
118
|
+
none: 0px
|
|
119
|
+
xs: 2px # --ad-radius-xs
|
|
120
|
+
sm: 4px # --ad-radius-sm — theme defaultRadius
|
|
121
|
+
md: 8px # --ad-radius-md
|
|
122
|
+
lg: 16px # --ad-radius-lg
|
|
123
|
+
xl: 32px # --ad-radius-xl
|
|
124
|
+
full: 9999px
|
|
125
|
+
spacing:
|
|
126
|
+
none: 0px # --ad-spacing-none
|
|
127
|
+
xxs: 4px # --ad-spacing-xxs (tight internal gaps)
|
|
128
|
+
xs: 10px # --ad-spacing-xs
|
|
129
|
+
sm: 12px # --ad-spacing-sm
|
|
130
|
+
md: 16px # --ad-spacing-md
|
|
131
|
+
lg: 20px # --ad-spacing-lg
|
|
132
|
+
xl: 32px # --ad-spacing-xl
|
|
133
|
+
xxl: 48px # layout/Mantine gap token; not yet --ad-spacing-xxl
|
|
134
|
+
sizing: # Component minimum heights (buttons, inputs, controls)
|
|
135
|
+
xs: 24px # --ad-sizing-xs
|
|
136
|
+
sm: 30px # --ad-sizing-sm
|
|
137
|
+
md: 36px # --ad-sizing-md
|
|
138
|
+
lg: 42px # --ad-sizing-lg
|
|
139
|
+
xl: 50px # --ad-sizing-xl
|
|
140
|
+
shadows:
|
|
141
|
+
xs: "0px 1px 3px 0px rgba(0,0,0,0.05), 0px 1px 2px 0px rgba(0,0,0,0.1)" # --ad-shadows-xs
|
|
142
|
+
sm: "0px 1px 3px 0px rgba(0,0,0,0.05), 0px 10px 15px -5px rgba(0,0,0,0.05), 0px 7px 7px -5px rgba(0,0,0,0.04)" # --ad-shadows-sm
|
|
143
|
+
md: "0px 1px 3px 0px rgba(0,0,0,0.05), 0px 20px 25px -5px rgba(0,0,0,0.05), 0px 10px 10px -5px rgba(0,0,0,0.04)" # --ad-shadows-md
|
|
144
|
+
lg: "0px 1px 3px 0px rgba(0,0,0,0.05), 0px 28px 23px -7px rgba(0,0,0,0.05), 0px 12px 12px -7px rgba(0,0,0,0.04)" # --ad-shadows-lg
|
|
145
|
+
xl: "0px 1px 3px 0px rgba(0,0,0,0.05), 0px 36px 28px -7px rgba(0,0,0,0.05), 0px 17px 17px -7px rgba(0,0,0,0.04)" # --ad-shadows-xl
|
|
146
|
+
z-index:
|
|
147
|
+
app: 100 # --ad-z-index-app (header, sidebar)
|
|
148
|
+
modal: 200 # --ad-z-index-modal
|
|
149
|
+
popover: 300 # --ad-z-index-popover
|
|
150
|
+
overlay: 400 # --ad-z-index-overlay
|
|
151
|
+
max: 9999 # --ad-z-index-max
|
|
152
|
+
components:
|
|
153
|
+
button-primary:
|
|
154
|
+
backgroundColor: "{colors.primary}"
|
|
155
|
+
textColor: "{colors.on-primary}"
|
|
156
|
+
rounded: "{rounded.sm}"
|
|
157
|
+
typography: "{typography.label-md}"
|
|
158
|
+
button-primary-hover:
|
|
159
|
+
backgroundColor: "{colors.primary-hover}"
|
|
160
|
+
button-primary-active:
|
|
161
|
+
backgroundColor: "{colors.primary-active}"
|
|
162
|
+
button-secondary:
|
|
163
|
+
backgroundColor: "{colors.secondary}" # cyan.6 — #15aabf
|
|
164
|
+
textColor: "{colors.on-secondary}" # black (A11Y: 7.53:1 contrast)
|
|
165
|
+
rounded: "{rounded.sm}"
|
|
166
|
+
typography: "{typography.label-md}"
|
|
167
|
+
button-default:
|
|
168
|
+
backgroundColor: "{colors.surface}"
|
|
169
|
+
textColor: "{colors.on-surface}"
|
|
170
|
+
border: "{colors.border}"
|
|
171
|
+
rounded: "{rounded.sm}"
|
|
172
|
+
typography: "{typography.label-md}"
|
|
173
|
+
button-outline:
|
|
174
|
+
backgroundColor: "{colors.surface}"
|
|
175
|
+
textColor: "{colors.primary}"
|
|
176
|
+
border: "{colors.primary}"
|
|
177
|
+
rounded: "{rounded.sm}"
|
|
178
|
+
typography: "{typography.label-md}"
|
|
179
|
+
button-danger:
|
|
180
|
+
backgroundColor: "{colors.danger}"
|
|
181
|
+
textColor: "{colors.on-danger}"
|
|
182
|
+
rounded: "{rounded.sm}"
|
|
183
|
+
typography: "{typography.label-md}"
|
|
184
|
+
button-link:
|
|
185
|
+
backgroundColor: transparent
|
|
186
|
+
textColor: "{colors.text-link}"
|
|
187
|
+
rounded: "{rounded.sm}"
|
|
188
|
+
typography: "{typography.label-md}"
|
|
189
|
+
button-secret:
|
|
190
|
+
backgroundColor: transparent
|
|
191
|
+
textColor: "{colors.on-surface}"
|
|
192
|
+
rounded: "{rounded.sm}"
|
|
193
|
+
typography: "{typography.label-md}"
|
|
194
|
+
input-default:
|
|
195
|
+
backgroundColor: "{colors.surface}"
|
|
196
|
+
textColor: "{colors.on-surface}"
|
|
197
|
+
border: "{colors.border}"
|
|
198
|
+
rounded: "{rounded.sm}"
|
|
199
|
+
typography: "{typography.body-sm}"
|
|
200
|
+
input-focus:
|
|
201
|
+
border: "{colors.border-primary}" # primary blue on focus
|
|
202
|
+
badge-info:
|
|
203
|
+
backgroundColor: "{colors.info}"
|
|
204
|
+
textColor: "{colors.on-info}"
|
|
205
|
+
rounded: "{rounded.sm}"
|
|
206
|
+
typography: "{typography.label-sm}"
|
|
207
|
+
badge-success:
|
|
208
|
+
backgroundColor: "{colors.success}"
|
|
209
|
+
textColor: "{colors.on-success}"
|
|
210
|
+
rounded: "{rounded.sm}"
|
|
211
|
+
typography: "{typography.label-sm}"
|
|
212
|
+
badge-pending:
|
|
213
|
+
backgroundColor: "{colors.pending}"
|
|
214
|
+
textColor: "{colors.on-warning}" # black — A11Y override; same on-color as warning
|
|
215
|
+
rounded: "{rounded.sm}"
|
|
216
|
+
typography: "{typography.label-sm}"
|
|
217
|
+
badge-warning:
|
|
218
|
+
backgroundColor: "{colors.warning}" # same value as pending (#fab005); alert context
|
|
219
|
+
textColor: "{colors.on-warning}" # black — A11Y override
|
|
220
|
+
rounded: "{rounded.sm}"
|
|
221
|
+
typography: "{typography.label-sm}"
|
|
222
|
+
badge-danger:
|
|
223
|
+
backgroundColor: "{colors.danger}"
|
|
224
|
+
textColor: "{colors.on-danger}"
|
|
225
|
+
rounded: "{rounded.sm}"
|
|
226
|
+
typography: "{typography.label-sm}"
|
|
227
|
+
tooltip:
|
|
228
|
+
backgroundColor: "{colors.neutral-9}"
|
|
229
|
+
textColor: "{colors.text-inverse}"
|
|
230
|
+
rounded: "{rounded.sm}"
|
|
231
|
+
typography: "{typography.body-sm}"
|
|
232
|
+
# padding intentionally omitted — DS wrapper uses off-scale custom padding (5px 8px) to match Figma
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
# AppDirect Admin — DESIGN.md
|
|
236
|
+
|
|
237
|
+
> **Proof-of-concept.** Tokens above are mechanically derived from `design/tokens/mantine-tokens-subset.json`, `design/tokens/open-color.overrides.json`, and `styles/theme.ts`. Prose below is a starter skeleton — brand and DS leads should revise for voice, rationale, and enforcement guidance. This file is a candidate for eventual generation from `@appdirect/design-tokens`.
|
|
238
|
+
|
|
239
|
+
## Overview
|
|
240
|
+
|
|
241
|
+
AppDirect admin UIs are built for **operators doing real work on dense data**. The visual language prioritizes clarity, scannability, and low visual noise over brand flourish. Screens often carry many controls, tables, and status indicators at once, so every visual element must earn its weight. The tone is **professional, utilitarian, and quietly confident** — we use color and elevation sparingly and let typography and spacing carry most of the structure.
|
|
242
|
+
|
|
243
|
+
We extend Mantine 9's component library with a thin AppDirect Design System (DS) layer (`components/DesignSystem/`), adding accessibility-safe color choices, opinionated variants, and layout primitives (`PageContentHeader`, `DataTable`, `Shell`) tuned to admin workflows.
|
|
244
|
+
|
|
245
|
+
## Colors
|
|
246
|
+
|
|
247
|
+
The palette has four groups: brand, neutrals, status, and app chrome.
|
|
248
|
+
|
|
249
|
+
- **Primary (#326FDE)** — A11y-compliant override of Open Color's blue.6. The **one interaction color**: links, primary buttons, focus rings, active tabs. Reserve it for the single most important action on a surface. `--ad-color-brand-primary`
|
|
250
|
+
- **Secondary (#15aabf)** — AppDirect cyan.6. Used for secondary action buttons. Not a generic "alternate" color — use it specifically for the `secondary` Button variant. `--ad-action-secondary-bg`
|
|
251
|
+
- **Neutrals (gray.0–gray.9)** — Carry all page chrome: backgrounds, borders, dividers, secondary text, disabled states. Neutrals do most of the visual work.
|
|
252
|
+
- **Status colors (info / success / pending / danger)** — Used only on badges, alerts, and status indicators. Never as decoration. Danger is reserved for destructive outcomes and error states. `pending` is the canonical yellow status name on Badge, Chip, Indicator, **and Alert**. `warning` is a Badge color/variant alias for the same yellow (`#fab005`), not an Alert `color`.
|
|
253
|
+
- **AppDirect Navy (#011B58)** — The app header/sidebar background color. Not yet in the `--ad-*` token system; currently hardcoded in `AppShellLayout.tsx`. Do not use this color for anything other than app chrome until it is tokenized.
|
|
254
|
+
- **Surface / on-surface** — Pure white surface (`--ad-color-bg-default`) with black text (`--ad-color-text-default`). Tinted surfaces (`--ad-color-bg-subtle`, `--ad-color-bg-muted`) are used for secondary areas only.
|
|
255
|
+
|
|
256
|
+
**A11Y notes:**
|
|
257
|
+
- `on-warning` is **black** (`#000000`), not white — yellow backgrounds fail WCAG AA with white text
|
|
258
|
+
- `on-secondary` is **black** (`#000000`) — cyan.6 provides 7.53:1 contrast ratio against black (AAA)
|
|
259
|
+
- Primary (#326FDE) on white = 4.56:1 — meets WCAG AA for normal text
|
|
260
|
+
|
|
261
|
+
### Dark mode
|
|
262
|
+
|
|
263
|
+
Dark mode tokens are fully defined in `@appdirect/design-tokens` and activate automatically when `data-theme="dark"` is set on the root `<html>` element. No in-app toggle has been implemented yet — the app currently renders light mode only. When the toggle is added, no component code changes are required; all `--ad-*` semantic variables will remap automatically.
|
|
264
|
+
|
|
265
|
+
## Typography
|
|
266
|
+
|
|
267
|
+
Two families carry the whole system:
|
|
268
|
+
|
|
269
|
+
- **Inter** — All UI text: headings, body, labels, buttons, inputs. Chosen for its legibility at small sizes and broad weight coverage.
|
|
270
|
+
- **Roboto Mono** — All technical data: IDs, timestamps, code, JSON payloads, CLI examples.
|
|
271
|
+
|
|
272
|
+
Scale: 6 heading levels (h1–h6), 3 body sizes (lg/md/sm), 2 label sizes (md/sm), and a monospace `code` style. Headings are Inter Bold (700); body and input text are Inter Regular (400); labels are Inter Semi-Bold (600).
|
|
273
|
+
|
|
274
|
+
**Rules of thumb:**
|
|
275
|
+
- Page titles: `h1` or `h2`
|
|
276
|
+
- Section titles: `h3`
|
|
277
|
+
- Card / widget titles: `h4` or `h5`
|
|
278
|
+
- Body content: `body-md` (16px) is the default
|
|
279
|
+
- Form labels, buttons, tab labels: `label-md`
|
|
280
|
+
- Metadata, captions, timestamps: `body-sm` or `code`
|
|
281
|
+
|
|
282
|
+
## Layout & Spacing
|
|
283
|
+
|
|
284
|
+
The spacing scale is Mantine Core `xs–xl` (10 / 12 / 16 / 20 / 32px) plus added `none` (0), `xxs` (4), and `xxl` (48). Use spacing tokens — never raw pixel values — for padding, gap, and margin. Common patterns:
|
|
285
|
+
|
|
286
|
+
- Card interior padding: `md` (16px)
|
|
287
|
+
- Section gaps: `lg` (20px)
|
|
288
|
+
- Top-level page margins: `xl` (32px)
|
|
289
|
+
- Inline label-to-input gap: `xs` (10px)
|
|
290
|
+
|
|
291
|
+
Breakpoints (Mantine defaults): `xs 36em / sm 48em / md 62em / lg 75em / xl 88em`. Admin layouts assume `md+` as the primary target; below `sm` we degrade to stacked layouts but do not optimize heavily for phone viewports.
|
|
292
|
+
|
|
293
|
+
## Elevation & Depth
|
|
294
|
+
|
|
295
|
+
Depth is conveyed through a **restrained 5-level shadow scale** (xs–xl) layered over pure-white surfaces. Shadows are soft, single-color, and never used for decoration — only to establish interactive layers:
|
|
296
|
+
|
|
297
|
+
- `xs` — input focus rings, chip borders
|
|
298
|
+
- `sm` — hover states on cards and list items
|
|
299
|
+
- `md` — floating menus, popovers, dropdowns
|
|
300
|
+
- `lg` — modals, drawers
|
|
301
|
+
- `xl` — rare; reserved for critical alert overlays
|
|
302
|
+
|
|
303
|
+
For flat hierarchy (tabs, navigation, dividers) we prefer **borders and color contrast over shadows**. Tonal separation uses `surface-subtle` (#f1f3f5) and `surface-muted` (#e9ecef) against pure white.
|
|
304
|
+
|
|
305
|
+
## Shapes
|
|
306
|
+
|
|
307
|
+
A 5-step radius scale (xs 2px, sm 4px, md 8px, lg 16px, xl 32px) plus `none` and `full`. The system-wide default is `sm` (4px) — applied to all components: buttons, inputs, cards, badges, modals, drawers, menus. Do not use larger radii unless there is an explicit design reason to deviate.
|
|
308
|
+
|
|
309
|
+
**Rule:** Reserve `full` (9999px) for genuinely circular elements (avatars). Do not use it for buttons, badges, or chips — those are `sm`.
|
|
310
|
+
|
|
311
|
+
## Components
|
|
312
|
+
|
|
313
|
+
The AppDirect DS layer wraps Mantine 9 components under `components/DesignSystem/`, organized into 11 categories. All components are exported from the single barrel `@/components/DesignSystem`. **Never import raw Mantine components in app code.**
|
|
314
|
+
|
|
315
|
+
### Buttons
|
|
316
|
+
|
|
317
|
+
| Component | Key props | Notes |
|
|
318
|
+
|---|---|---|
|
|
319
|
+
| `Button` | `variant`, `size`, `loading`, `disabled`, `leftSection`, `rightSection` | Default `variant="default"`, default `size="sm"`, always `radius="sm"` |
|
|
320
|
+
| `ActionIcon` | `size`, `variant` | Icon-only button; default `size="md"`, always `radius="sm"` |
|
|
321
|
+
| `CloseButton` | `size` | Preconfigured dismiss button |
|
|
322
|
+
|
|
323
|
+
**ActionIcon variants:** `default` · `outline` · `link`
|
|
324
|
+
|
|
325
|
+
- `default` — light blue tinted background; use for primary icon actions in toolbars and inline controls
|
|
326
|
+
- `outline` — white surface with gray border and on-surface icon color; matches Button `default` surface styling for icon-only actions
|
|
327
|
+
- `link` — no background, primary-colored icon; inline or low-prominence actions
|
|
328
|
+
|
|
329
|
+
**ActionIcon sizes:** `xs` · `sm` · `md` (default) · `lg` · `xl`
|
|
330
|
+
|
|
331
|
+
**Button variants:** `primary` · `secondary` · `default` · `outline` · `danger` · `link` · `secret` · `disabled`
|
|
332
|
+
|
|
333
|
+
- `primary` — blue filled (`#326FDE`); use for the single most important action per view
|
|
334
|
+
- `secondary` — **cyan filled (`#15aabf`)** with black text; AppDirect's secondary action color — not a neutral fallback
|
|
335
|
+
- `default` — white fill with gray border; general / tertiary actions
|
|
336
|
+
- `outline` — white fill with primary-colored border and text; alternative to default when primary context is needed without fill
|
|
337
|
+
- `danger` — red filled (`#fa5252`); destructive or irreversible actions
|
|
338
|
+
- `link` — no background, primary-colored text; inline or low-prominence actions
|
|
339
|
+
- `secret` — no background, no border; contextual actions that should recede visually
|
|
340
|
+
- `disabled` — maps to Mantine `default` variant + sets `disabled=true`; prefer passing `disabled` prop directly
|
|
341
|
+
|
|
342
|
+
**Button sizes:** `xs` · `sm` (default) · `md` · `lg` · `xl`
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
### Inputs
|
|
347
|
+
|
|
348
|
+
`TextInput` · `TextArea` · `NumberInput` · `ColorInput` · `Slider` · `Switch` · `SegmentedControl` · `Checkbox` · `Radio` · `RadioGroup` · `DropZone` · `FileInput`
|
|
349
|
+
|
|
350
|
+
All inputs default to `radius="sm"` and `size="sm"` matching the button default. Focus ring shifts border to `primary` (#326FDE).
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
### Combobox
|
|
355
|
+
|
|
356
|
+
`Select` · `SearchableSelect` · `AutocompleteClearable` · `Multiselect` · `Combobox`
|
|
357
|
+
|
|
358
|
+
`SearchableSelect` and `AutocompleteClearable` are opinionated wrappers with built-in clear affordance. Use `Multiselect` for tag-style multi-value selection.
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
### Navigation
|
|
363
|
+
|
|
364
|
+
`Tabs` · `Breadcrumb` · `BackBreadcrumb` · `NavLink` · `Stepper`
|
|
365
|
+
|
|
366
|
+
`BackBreadcrumb` is a single-step back link with a left-arrow affordance, used at the top of detail pages. `Stepper` is used for multi-step flows (onboarding, wizards).
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
### Overlays
|
|
371
|
+
|
|
372
|
+
`Modal` · `ConfirmationModal` · `Drawer` · `Menu` · `Popover` · `ConfirmationPopover` · `Tooltip`
|
|
373
|
+
|
|
374
|
+
- `ConfirmationModal` — preconfigured two-button (confirm/cancel) modal for destructive actions
|
|
375
|
+
- `ConfirmationPopover` — inline confirm/cancel popover; preferred over modal for lower-stakes confirmations that don't require full-screen focus
|
|
376
|
+
- `Menu` accepts typed `MenuItem` and `MenuSection` arrays for structured dropdowns
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
### DataDisplay
|
|
381
|
+
|
|
382
|
+
`Alert` · `Avatar` · `Badge` · `Card` · `CardSection` · `Chip` · `Pill` · `Indicator` · `Progress` · `ThemeIcon` · `List` · `Table`
|
|
383
|
+
|
|
384
|
+
**Badge:**
|
|
385
|
+
- Variants: `filled` (default) · `outline` · `info` · `success` · `pending` · `warning` · `danger` · `default`
|
|
386
|
+
- Colors: `info` · `success` · `pending` · `warning` · `danger` · `default` · `blue` · `green` · `yellow` · `red` · `gray`
|
|
387
|
+
- Use `pending` for in-progress/queued states (including Alert `color="pending"`). `warning` is a Badge alias for the same yellow.
|
|
388
|
+
- Always `radius="sm"` (4px) — never pill-shaped, despite Mantine's default
|
|
389
|
+
- Semantic shorthand: `<Badge variant="success">` resolves color automatically; `color` prop is only needed when overriding
|
|
390
|
+
|
|
391
|
+
**Avatar:**
|
|
392
|
+
- Variants: `icon` (default icon) · `image` (photo with fallback) · `initials` (two-character text)
|
|
393
|
+
- Sizes: `xs` (16px) · `sm` (26px) · `md` (38px) · `lg` (56px) · `xl` (84px)
|
|
394
|
+
- Always **circular** (`radius=1000`) — this is a hardcoded DS override of Mantine's default square avatar
|
|
395
|
+
- Image variant supports `fallback="icon"` or `fallback="initials"` with `fallbackInitials` prop
|
|
396
|
+
- Default icon is `RiUser3Fill` (Remix Icons)
|
|
397
|
+
|
|
398
|
+
**ThemeIcon:** `size`, `variant`, `color`, `radius` — used to frame icons in containers (e.g. `PageContentHeader` icon slot uses `variant="outline"`, `radius="md"`, `size="xxl"`)
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
### Typography
|
|
403
|
+
|
|
404
|
+
`Title` · `Text` · `Code` · `Kbd`
|
|
405
|
+
|
|
406
|
+
`Title` maps `order` 1–6 to the heading scale above. `Code` uses Roboto Mono. `Kbd` renders keyboard shortcut chips.
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
### Misc
|
|
411
|
+
|
|
412
|
+
`Divider` · `Paper`
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
### Icons
|
|
417
|
+
|
|
418
|
+
Three icon sets are in use. Each has a distinct purpose — do not substitute one for another.
|
|
419
|
+
|
|
420
|
+
| Set | Package | Purpose |
|
|
421
|
+
|---|---|---|
|
|
422
|
+
| **Tabler** | `@tabler/icons-react` | Mantine component UI only — pre-baked affordances (Select chevron, Accordion toggle, etc.) |
|
|
423
|
+
| **Remix** | `@remixicon/react` | Primary set for all product UI design decisions |
|
|
424
|
+
| **ad-svg-icons** | `git@github.com:AppDirect/ad-svg-icons.git` | Legacy proprietary icons for specific AppDirect concepts |
|
|
425
|
+
|
|
426
|
+
**Tabler** — use exclusively for icons that are built into Mantine component internals (e.g. the double-triangle on a Select, a chevron in an Accordion or Button). These have no design selection requirement — Mantine uses them automatically. Do not use Tabler for any icon that a designer has chosen.
|
|
427
|
+
|
|
428
|
+
**Remix** (`@remixicon/react`) — the primary and growing set. When a new icon is needed for any designed UI element, look here first. The collection is actively expanded based on use-case. Browse at [remixicon.com](https://remixicon.com).
|
|
429
|
+
|
|
430
|
+
**ad-svg-icons** — legacy proprietary collection containing icons built for specific AppDirect software concepts (Quotes, Opportunities, Leads) or cases where the Remix equivalent was aesthetically inappropriate (e.g. credit card, bell). Use only when a required icon exists here and has no suitable Remix equivalent.
|
|
431
|
+
|
|
432
|
+
**Icon sizing** — always use the `--ad-icon-size-*` scale, not arbitrary pixel values:
|
|
433
|
+
|
|
434
|
+
| Token | Size | Use |
|
|
435
|
+
|---|---|---|
|
|
436
|
+
| `--ad-icon-size-xs` | 12px | Tight inline contexts (badge, chip) |
|
|
437
|
+
| `--ad-icon-size-sm` | 14px | Small buttons, dense list rows |
|
|
438
|
+
| `--ad-icon-size-md` | 16px | Default for most inline icons |
|
|
439
|
+
| `--ad-icon-size-lg` | 18px | Medium buttons, section headers |
|
|
440
|
+
| `--ad-icon-size-xl` | 20px | Large standalone icons |
|
|
441
|
+
|
|
442
|
+
Pass `size` as a number prop: `<RiArrowDownSLine size={16} />`. Do not use CSS to resize icons.
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
### Layout
|
|
447
|
+
|
|
448
|
+
`Stack` · `Inline` · `Group` · `Box` · `SimpleGrid` · `Grid` · `Flex` · `Container` · `Center`
|
|
449
|
+
|
|
450
|
+
`Inline` is the DS name for a horizontal flex row (Mantine `Group`). `Stack` is vertical. Use layout primitives exclusively — no raw `div` with inline flex/grid styles.
|
|
451
|
+
|
|
452
|
+
Figma auto-layout mapping: `flex-direction: column` → `Stack`; `flex-direction: row` → `Inline`; `grid` → `Grid`; padding-only container → `Box`.
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
|
|
456
|
+
### Shell
|
|
457
|
+
|
|
458
|
+
`AppShellLayout` · `HeaderBar` · `SidebarNav` · `SidebarNavLink` · `SingleColumnLayout` · `TertiaryColumnLayout`
|
|
459
|
+
|
|
460
|
+
**AppShellLayout specs:**
|
|
461
|
+
- Header height: **68px**
|
|
462
|
+
- Header background: **AppDirect Navy (`#011B58`)** — hardcoded, not a token
|
|
463
|
+
- Sidebar width: **300px**, breakpoint `sm`, no mobile collapse
|
|
464
|
+
- Main content padding: `lg` (20px)
|
|
465
|
+
- Nav is optional: pass `hideNav` or omit `navItems` for header-only layout
|
|
466
|
+
|
|
467
|
+
**SingleColumnLayout** — full-width content area inside `AppShellLayout`
|
|
468
|
+
|
|
469
|
+
**TertiaryColumnLayout** — 8/4 grid split: primary content + narrower right aside
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
### ComplexComponents
|
|
474
|
+
|
|
475
|
+
`PageContentHeader` · `DataTable` · `DashboardWidget` · `KeyInsight` · `NameValue` / `NameValueItem` · `CopyButton` · `DescriptionBlock`
|
|
476
|
+
|
|
477
|
+
**PageContentHeader** — the standard page/detail header. Renders as a `Card` with:
|
|
478
|
+
- Header: optional icon (`ThemeIcon`, 58px container), `subhead`, `title` (h3), optional `badge`, optional edit affordance
|
|
479
|
+
- Actions: array of `{ label, onClick, variant }` — renders as `Button` row
|
|
480
|
+
- Content section (one of, mutually exclusive):
|
|
481
|
+
- `insights` — `KeyInsight` grid (horizontal KPI strip)
|
|
482
|
+
- `description` — optional title + body text (supports `allowLinks` for HTML)
|
|
483
|
+
- `descriptionBlock` — `DescriptionBlock` component (bleeds to card edges)
|
|
484
|
+
- `nameValuePairs` — `NameValue` grid with configurable column count
|
|
485
|
+
- `drawer` — collapsible section with Show More / Show Less toggle button
|
|
486
|
+
|
|
487
|
+
**DataTable** — built on `mantine-react-table-open`. Features:
|
|
488
|
+
- Cursor-based and offset pagination
|
|
489
|
+
- Column sorting (`enableSorting`) and filtering (`enableColumnFilter`)
|
|
490
|
+
- Row selection (`RowSelectionState`)
|
|
491
|
+
- Density control (`DensityState`)
|
|
492
|
+
- Custom top toolbar with filter chips, search, and date range
|
|
493
|
+
- Custom bottom toolbar
|
|
494
|
+
- Server-side data via `onPaginationChange` / `onSortingChange` callbacks
|
|
495
|
+
- `totalCount` for pagination display; `pageInfo` for cursor navigation
|
|
496
|
+
|
|
497
|
+
**KeyInsight** — single KPI tile: `value`, `title`, `subtitle`, optional right border divider
|
|
498
|
+
|
|
499
|
+
**NameValue / NameValueItem** — name-value pair grid; `columns` prop controls grid width
|
|
500
|
+
|
|
501
|
+
**DashboardWidget** — card with title, optional icon, optional link list, and arbitrary `children`
|
|
502
|
+
|
|
503
|
+
---
|
|
504
|
+
|
|
505
|
+
### Consumption rules
|
|
506
|
+
|
|
507
|
+
- **Always use DS components** from `@/components/DesignSystem` — never raw `@mantine/core` imports
|
|
508
|
+
- When a Mantine component lacks a DS wrapper, create one: `forwardRef`, typed as `DS[Name]Props extends Mantine[Name]Props`, exported through category index and main barrel
|
|
509
|
+
- **No Tailwind, no CSS modules, no inline `style` props** — use Mantine system props (`bg`, `c`, `w`, `h`, `p`, `m`, `radius`, `shadow`)
|
|
510
|
+
- For any list / grid / table use `Table` or `DataTable` from DS (not raw `@mantine/core`)
|
|
511
|
+
- For page headers use `PageContentHeader` from DS
|
|
512
|
+
|
|
513
|
+
### Component tokens
|
|
514
|
+
|
|
515
|
+
The `components` section in the front matter defines per-variant tokens for the most commonly overridden components (buttons, inputs, badges, tooltip). Other components inherit from Mantine defaults + the theme color/radius/spacing tokens; authoring tokens for the full component surface is an ongoing effort tracked in the `@appdirect/design-tokens` package.
|
|
516
|
+
|
|
517
|
+
## Do's and Don'ts
|
|
518
|
+
|
|
519
|
+
- **Do** use `primary` (#326FDE) for the **single most important action** per surface; default buttons everywhere else
|
|
520
|
+
- **Don't** use more than one primary button on a single view
|
|
521
|
+
- **Do** use status colors (info / success / pending / danger) for badges, chips, indicators, and alerts. Alert `color` is `pending`, not `warning`.
|
|
522
|
+
- **Don't** use status colors for decoration or emphasis in body text
|
|
523
|
+
- **Do** use `label-md` (Inter Semi-Bold 14px) for button labels, tab labels, and form field labels
|
|
524
|
+
- **Don't** use more than two type families on a screen (Inter for UI, Roboto Mono for data — that's it)
|
|
525
|
+
- **Do** use `rounded.sm` (4px) for all components — buttons, inputs, cards, badges, modals, drawers; `rounded.full` only for avatars
|
|
526
|
+
- **Don't** use `rounded.md` or larger unless explicitly required by design; don't use `rounded.full` for buttons or badges
|
|
527
|
+
- **Do** rely on spacing tokens (xs–xl) for all padding, gap, margin
|
|
528
|
+
- **Don't** use raw pixel values or ad-hoc spacing
|
|
529
|
+
- **Do** maintain WCAG AA contrast ratios (4.5:1 normal text, 3:1 large text) — the A11y blue (#326FDE) was chosen precisely to meet this on white
|
|
530
|
+
- **Don't** rely on color alone to convey meaning; always pair status colors with icons or text labels
|
|
531
|
+
- **Do** use shadows (xs–xl) sparingly, only to mark interactive layers
|
|
532
|
+
- **Don't** use shadow for decoration or to fake depth on static content
|
|
533
|
+
|
|
534
|
+
---
|
|
535
|
+
|
|
536
|
+
## `--ad-*` CSS variable reference
|
|
537
|
+
|
|
538
|
+
These variables are injected by `@appdirect/design-tokens/css/foundations.css` and are available globally. Use them in any component that needs to reference design tokens outside of Mantine system props.
|
|
539
|
+
|
|
540
|
+
### Semantic colors (light mode → dark mode)
|
|
541
|
+
|
|
542
|
+
| Variable | Light | Dark | Use |
|
|
543
|
+
|---|---|---|---|
|
|
544
|
+
| `--ad-color-bg-default` | `#ffffff` | `#2e2e2e` | Page / card background |
|
|
545
|
+
| `--ad-color-bg-subtle` | `#f1f3f5` | `#2e2e2e` | Secondary surface, sidebars |
|
|
546
|
+
| `--ad-color-bg-muted` | `#e9ecef` | `#3b3b3b` | Recessed areas |
|
|
547
|
+
| `--ad-color-bg-tinted` | `#f1f3f5` | `#1f1f1f` | SegmentedControl root |
|
|
548
|
+
| `--ad-color-text-default` | `#000000` | `#C9C9C9` | Body text |
|
|
549
|
+
| `--ad-color-text-dimmed` | `#868e96` | `#828282` | Secondary / muted text |
|
|
550
|
+
| `--ad-color-text-placeholder` | `#adb5bd` | `#696969` | Input placeholder |
|
|
551
|
+
| `--ad-color-text-link` | `#326FDE` | `#4dabf7` | Link text |
|
|
552
|
+
| `--ad-color-text-inverse` | `#f8f9fa` | `#212529` | Text on dark surfaces |
|
|
553
|
+
| `--ad-color-border-default` | `#ced4da` | `#424242` | Default border |
|
|
554
|
+
| `--ad-color-border-subtle` | `#e9ecef` | `#424242` | Subtle dividers |
|
|
555
|
+
| `--ad-color-border-strong` | `#868e96` | `#696969` | Emphasized borders |
|
|
556
|
+
| `--ad-color-border-primary` | `#326FDE` | `#1971c2` | Focus ring, active input |
|
|
557
|
+
| `--ad-color-brand-primary` | `#326FDE` | `#1971c2` | Brand blue |
|
|
558
|
+
| `--ad-color-brand-light` | blue @ 10% | blue @ 15% | Tinted brand surface |
|
|
559
|
+
| `--ad-color-brand-light-hover` | blue @ 33% | blue @ 20% | Hovered tinted surface |
|
|
560
|
+
| `--ad-color-state-disabled` | `#e9ecef` | `#2e2e2e` | Disabled background |
|
|
561
|
+
| `--ad-color-state-disabled-text` | `#adb5bd` | `#696969` | Disabled text |
|
|
562
|
+
| `--ad-color-status-info` | `#326FDE` | `#4dabf7` | Info badge/alert |
|
|
563
|
+
| `--ad-color-status-success` | `#40c057` | `#2f9e44` | Success badge/alert |
|
|
564
|
+
| `--ad-color-status-warning` | `#fab005` | `#f08c00` | Warning alert/notification (`pending` for badges/chips) |
|
|
565
|
+
| `--ad-color-status-error` | `#fa5252` | `#e03131` | Error/danger badge/alert |
|
|
566
|
+
| `--ad-action-primary-bg` | `#326FDE` | `#1971c2` | Primary button fill |
|
|
567
|
+
| `--ad-action-secondary-bg` | `#15aabf` | `#0c8599` | Secondary button fill |
|
|
568
|
+
| `--ad-action-default-bg` | `#ffffff` | `#2e2e2e` | Default button fill |
|
|
569
|
+
| `--ad-action-default-border` | `#ced4da` | `#424242` | Default button border |
|
|
570
|
+
|
|
571
|
+
### Scales
|
|
572
|
+
|
|
573
|
+
| Variable pattern | Values | Use |
|
|
574
|
+
|---|---|---|
|
|
575
|
+
| `--ad-spacing-{xxs\|xs\|sm\|md\|lg\|xl}` | 4 / 10 / 12 / 16 / 20 / 32px | Padding, gap, margin |
|
|
576
|
+
| `--ad-radius-{xs\|sm\|md\|lg\|xl}` | 2 / 4 / 8 / 16 / 32px | Border radius |
|
|
577
|
+
| `--ad-icon-size-{xs\|sm\|md\|lg\|xl}` | 12 / 14 / 16 / 18 / 20px | SVG icon dimensions |
|
|
578
|
+
| `--ad-sizing-{xs\|sm\|md\|lg\|xl}` | 24 / 30 / 36 / 42 / 50px | Component min-heights |
|
|
579
|
+
| `--ad-shadows-{xs\|sm\|md\|lg\|xl}` | see YAML above | Box shadows |
|
|
580
|
+
| `--ad-z-index-{app\|modal\|popover\|overlay\|max}` | 100 / 200 / 300 / 400 / 9999 | Stacking order |
|
|
581
|
+
|
|
582
|
+
### CSS load order
|
|
583
|
+
|
|
584
|
+
```css
|
|
585
|
+
@mantine/core/styles.css /* Mantine base */
|
|
586
|
+
@appdirect/design-tokens/css/foundations.css /* --ad-* variables */
|
|
587
|
+
@appdirect/design-tokens/css/mantine.css /* Mantine component overrides */
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
This order is already configured in `app/layout.tsx` and `.storybook/preview.tsx`. Do not reorder.
|
|
591
|
+
|
|
592
|
+
---
|
|
593
|
+
|
|
594
|
+
## Dependencies & setup
|
|
595
|
+
|
|
596
|
+
| Package | Version | Role |
|
|
597
|
+
|---|---|---|
|
|
598
|
+
| `@mantine/core` | `^9.6.0` | Base component library |
|
|
599
|
+
| `@mantine/hooks` | `^9.6.0` | Utility hooks (useDisclosure, etc.) |
|
|
600
|
+
| `@mantine/dates` | `^9.6.0` | Date/time inputs |
|
|
601
|
+
| `@mantine/notifications` | `^9.6.0` | Toast notifications |
|
|
602
|
+
| `@mantine/dropzone` | `^9.6.0` | File drag-and-drop |
|
|
603
|
+
| `@appdirect/design-tokens` | `^0.0.6` | AppDirect token CSS variables (`--ad-*`) |
|
|
604
|
+
| `@tabler/icons-react` | `^3.33.0` | Icon library (supplementary) |
|
|
605
|
+
| `@remixicon/react` | `^4.6.0` | Primary icon library; default avatar icon |
|
|
606
|
+
| `mantine-react-table-open` | `^9.0.3` | DataTable foundation |
|
|
607
|
+
| `open-color` | `^1.9.1` | Base color palette (extended by `styles/theme.ts`) |
|
|
608
|
+
| `@fontsource-variable/inter` | `^5.2.8` | Variable Inter font |
|
|
609
|
+
| `@fontsource-variable/roboto-mono` | `^5.2.8` | Variable Roboto Mono font |
|
|
610
|
+
|
|
611
|
+
**Registry:** `@appdirect` scoped packages are hosted on the internal Artifactory npm registry. The `.npmrc` in this repo scopes `@appdirect` to `https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo`. VPN access is required for `npm install`.
|
|
612
|
+
|
|
613
|
+
**Token CSS variables:** `@appdirect/design-tokens` injects `--ad-*` CSS custom properties used by some DS components (e.g. `var(--ad-color-text-default)`, `var(--ad-color-border-strong)`, `var(--ad-color-bg-subtle)`, `var(--ad-color-brand-light)`). These are loaded via the package's CSS imports in `app/layout.tsx` and `.storybook/preview.tsx`.
|
|
614
|
+
|
|
615
|
+
---
|
|
616
|
+
|
|
617
|
+
## Token notes
|
|
618
|
+
|
|
619
|
+
Per-token annotations that don't fit naturally into the prose sections above. The YAML front matter is generated and carries no comments — anything that needs to be remembered about a specific token belongs here.
|
|
620
|
+
|
|
621
|
+
- **`components.tooltip` padding** — intentionally omitted from the YAML. The DS Tooltip wrapper uses off-scale custom padding (5px 8px) to match Figma; this is a deliberate exception to the spacing scale.
|
|
622
|
+
|
|
623
|
+
---
|
|
624
|
+
|
|
625
|
+
## Pending work
|
|
626
|
+
|
|
627
|
+
1. **AppDirect Navy tokenization** — `#011B58` is hardcoded in `AppShellLayout.tsx`; will become `--ad-color-brand-navy` (or similar) once the brand color group is added to `@appdirect/design-tokens`
|
|
628
|
+
2. **Dark mode toggle** — `[data-theme="dark"]` tokens are fully defined; the app needs a toggle that sets this attribute on `<html>` and persists the preference
|
|
629
|
+
3. **Form composition patterns** — document label placement, required field indicators, error/validation states, help text, and field grouping conventions
|
|
630
|
+
4. **Page-level composition patterns** — document standard list page (PageContentHeader + DataTable) and detail page (PageContentHeader + Cards) structures with code examples
|
|
631
|
+
5. **Loading / empty / error states** — document how to handle async loading (Button `loading`, Progress, Skeleton), empty DataTable, and form validation errors
|
|
632
|
+
6. **Component token expansion** — remaining components in `@appdirect/design-tokens/tokens/components/*.json` (30+ files) not yet reflected in the `components:` YAML block
|
|
633
|
+
7. **Prose pass** — brand/DS leads should revise Overview + Do's-and-Don'ts sections for voice and rationale
|
|
634
|
+
8. **Harvest Figma component docs** — each Figma component has a `utilities/doc-section` with usage guidance; extract and merge into Components subsections
|
|
635
|
+
9. **Wire into tokens pipeline** — `@appdirect/design-tokens` will emit a `dist/design-spec.yaml` adapter; a `sync-design-docs` script in this repo will replace the YAML front matter automatically on `npm install`. Backlog item added to `appdirect-design-tokens/CLAUDE.md`.
|
package/dist/css/mantine.css
CHANGED
|
@@ -615,7 +615,7 @@
|
|
|
615
615
|
}
|
|
616
616
|
.mantine-Checkbox-label {
|
|
617
617
|
font-size: var(--ad-font-sizes-sm);
|
|
618
|
-
font-weight: var(--ad-font-weights-
|
|
618
|
+
font-weight: var(--ad-font-weights-regular);
|
|
619
619
|
color: var(--ad-color-text-default);
|
|
620
620
|
}
|
|
621
621
|
/* === Chip === */
|
|
@@ -1397,7 +1397,7 @@
|
|
|
1397
1397
|
}
|
|
1398
1398
|
.mantine-Radio-label {
|
|
1399
1399
|
font-size: var(--ad-font-sizes-sm);
|
|
1400
|
-
font-weight: var(--ad-font-weights-
|
|
1400
|
+
font-weight: var(--ad-font-weights-regular);
|
|
1401
1401
|
color: var(--ad-color-text-default);
|
|
1402
1402
|
}
|
|
1403
1403
|
/* === SegmentedControl === */
|
package/dist/stories/index.json
CHANGED
package/package.json
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appdirect/design-system",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "AppDirect Design System components. Wraps Mantine v9 with standardized props, variants, and tokens.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.ts",
|
|
7
7
|
"bin": {
|
|
8
|
-
"ds-audit": "./dist/bin/ds-audit.js"
|
|
8
|
+
"ds-audit": "./dist/bin/ds-audit.js",
|
|
9
|
+
"ad-sync-design-md": "./bin/ad-sync-design-md.mjs"
|
|
9
10
|
},
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
12
13
|
"types": "./dist/index.ts",
|
|
13
14
|
"default": "./dist/index.js"
|
|
14
15
|
},
|
|
16
|
+
"./package.json": "./package.json",
|
|
17
|
+
"./DESIGN.md": "./dist/DESIGN.md",
|
|
15
18
|
"./config": {
|
|
16
19
|
"types": "./dist/config.ts",
|
|
17
20
|
"default": "./dist/config.js"
|
|
@@ -28,6 +31,7 @@
|
|
|
28
31
|
"./stories/*": "./dist/stories/*"
|
|
29
32
|
},
|
|
30
33
|
"files": [
|
|
34
|
+
"bin/ad-sync-design-md.mjs",
|
|
31
35
|
"dist",
|
|
32
36
|
"README.md"
|
|
33
37
|
],
|
|
@@ -35,11 +39,12 @@
|
|
|
35
39
|
"clean": "rm -rf dist",
|
|
36
40
|
"build": "node scripts/build.js",
|
|
37
41
|
"tarball": "npm run build && npm pack",
|
|
42
|
+
"test:sync-design-md": "node --test bin/ad-sync-design-md.test.mjs",
|
|
38
43
|
"verify:package": "npm pack --dry-run --ignore-scripts",
|
|
39
44
|
"prepublishOnly": "npm run build"
|
|
40
45
|
},
|
|
41
46
|
"dependencies": {
|
|
42
|
-
"@appdirect/ad-design-tokens": "0.0.
|
|
47
|
+
"@appdirect/ad-design-tokens": "0.0.14",
|
|
43
48
|
"@mantine/dropzone": "^9.6.0",
|
|
44
49
|
"@remixicon/react": "^4.6.0",
|
|
45
50
|
"@tabler/icons-react": "^3.33.0",
|