@tenancy.nz/tokens 1.8.5

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 ADDED
@@ -0,0 +1,86 @@
1
+ # @tenancy.nz/tokens
2
+
3
+ Design tokens for TPS UI. Figma Token Studio is the source of truth — designers
4
+ push/pull the single raw export in [`raw/tokens.json`](./raw/tokens.json). A
5
+ prebuild step fans that out into the Token Studio "pro" multi-file layout under
6
+ `src/`, then Style Dictionary compiles **one theme at a time** into the artifacts
7
+ the component packages consume.
8
+
9
+ ## Folder structure
10
+
11
+ ```
12
+ packages/tokens/
13
+ ├── raw/tokens.json ← Token Studio sync target (single-file export)
14
+ ├── scripts/split-tokens.mjs ← prebuild: raw/tokens.json → src/ (pro layout)
15
+ ├── src/ ← generated, gitignored — one folder per theme
16
+ │ ├── $metadata.json ← Token Studio: token-set order
17
+ │ ├── $themes.json ← Token Studio: theme definitions
18
+ │ ├── light/{primitive,semantic,component}.json
19
+ │ └── dark/{primitive,semantic,component}.json
20
+ ├── style-dictionary.config.js ← themeConfig() factory (one instance per theme)
21
+ ├── build.mjs ← `pnpm build` entry point
22
+ └── dist/ ← generated, gitignored, rebuilt in CI
23
+ ├── css/tokens.css ← :root (light) + [data-theme="dark"] (+ light.css/dark.css)
24
+ ├── esm/index.js ← ESM: { light, dark } value trees
25
+ ├── cjs/index.cjs ← CommonJS
26
+ └── types/index.d.ts ← TypeScript declarations
27
+ ```
28
+
29
+ > `raw/tokens.json` is the **only** hand-off point. Everything under `src/` and
30
+ > `dist/` is machine-owned — the prebuild wipes and regenerates `src/` on every
31
+ > build, so edit tokens in Figma Token Studio and push, not by hand.
32
+
33
+ Each theme is compiled by its own Style Dictionary instance so the identical
34
+ `primitive`/`semantic`/`component` groups across themes don't collide. Token
35
+ references (`{primitive.colors.blue.Blue500}`) are theme-agnostic and resolve
36
+ within whichever theme is being built.
37
+
38
+ ## Connecting Figma Token Studio
39
+
40
+ In the Token Studio plugin → **Settings → Sync** add a Git provider (GitLab, to
41
+ match this repo) with:
42
+
43
+ - **Branch**: a dedicated branch, e.g. `design-tokens`, so designer pushes arrive
44
+ as merge requests rather than landing on `main`.
45
+ - **File path**: `packages/tokens/raw/tokens.json`
46
+ - **Token format**: **DTCG** (`$value` / `$type`).
47
+
48
+ Push from the plugin to write the JSON here; a merge to a release branch triggers
49
+ the build below.
50
+
51
+ ## Build
52
+
53
+ ```sh
54
+ pnpm --filter @tenancy.nz/tokens build
55
+ ```
56
+
57
+ `prebuild` runs `scripts/split-tokens.mjs` first (also available standalone as
58
+ `pnpm --filter @tenancy.nz/tokens split`).
59
+
60
+ ## Consuming
61
+
62
+ Tokens are exported as clean, resolved value trees — one per theme — keyed by
63
+ their Token Studio paths, ready to map into a Material UI theme:
64
+
65
+ ```ts
66
+ import tokens, {light, dark} from '@tenancy.nz/tokens';
67
+
68
+ tokens.light.primitive.colors.turquoise.Turquoise500; // "#0cc1a3"
69
+ light.semantic.text['--color--text-accent']; // "#0cc1a3"
70
+
71
+ // MUI: feed both schemes (or map the tokens into your palette shape)
72
+ import {createTheme} from '@mui/material/styles';
73
+ const theme = createTheme({
74
+ colorSchemes: {
75
+ light: {palette: {primary: {main: light.semantic.text['--color--text-accent']}}},
76
+ dark: {palette: {primary: {main: dark.semantic.text['--color--text-accent']}}},
77
+ },
78
+ });
79
+ ```
80
+
81
+ Or use the CSS custom properties (light under `:root`, dark under
82
+ `[data-theme="dark"]`):
83
+
84
+ ```ts
85
+ import '@tenancy.nz/tokens/css';
86
+ ```
@@ -0,0 +1,490 @@
1
+ module.exports = {
2
+ "component": {
3
+ "button": {
4
+ "primary": {
5
+ "backgroundPressed": "#0e0044",
6
+ "backgroundDisabled": "#eeeeee",
7
+ "backgroundHover": "#3e3369",
8
+ "backgroundDefault": "#0e0044"
9
+ },
10
+ "secondary": {
11
+ "borderDisabledColor": "#bdbdbd",
12
+ "backgroundDefault": "#ffffff",
13
+ "borderColor": "#0e0044",
14
+ "backgroundDisabled": "#eeeeee",
15
+ "backgroundPressed": "#e0e0e0",
16
+ "backgroundHover": "#eeeeee"
17
+ },
18
+ "tertiary": {
19
+ "backgroundPressed": "rgba(0, 0, 0, 0.12)",
20
+ "backgroundHover": "rgba(0, 0, 0, 0.04)"
21
+ },
22
+ "accent": {
23
+ "backgroundDisabled": "#eeeeee",
24
+ "backgroundPressed": "#0a9a82",
25
+ "backgroundHover": "#0bae93",
26
+ "backgroundDefault": "#0cc1a3"
27
+ },
28
+ "destructive": {
29
+ "backgroundDisabled": "#eeeeee",
30
+ "backgroundPressed": "#870000",
31
+ "backgroundHover": "#b40000",
32
+ "backgroundDefault": "#e73333"
33
+ },
34
+ "destructiveOutline": {
35
+ "borderDisabledColor": "#bdbdbd",
36
+ "borderColor": "#e10000",
37
+ "iconColor": "#e10000",
38
+ "backgroundPressed": "#f9cccc",
39
+ "textColor": "#e10000",
40
+ "backgroundHover": "#fce6e6",
41
+ "backgroundDisabled": "#eeeeee",
42
+ "backgroundDefault": "#ffffff"
43
+ },
44
+ "favourite": {
45
+ "backgroundDisabled": "#eeeeee",
46
+ "backgroundHover": "#cc9200",
47
+ "backgroundPressed": "#996e00",
48
+ "backgroundDefault": "#ffb700"
49
+ },
50
+ "citation": {
51
+ "backgroundDisabled": "#eeeeee",
52
+ "backgroundPressed": "#b6ece3",
53
+ "backgroundHover": "#cef3ed",
54
+ "backgroundDefault": "#e7f9f6"
55
+ }
56
+ },
57
+ "switches": {
58
+ "handleOnDisabled": "#ffffff",
59
+ "handleOff": "#757575",
60
+ "handleOn": "#ffffff",
61
+ "backgroundOffDisabled": "#f5f5f5",
62
+ "handleOffDisabled": "#bdbdbd",
63
+ "backgroundOnDisabled": "#e0e0e0",
64
+ "backgroundOff": "#f5f5f5",
65
+ "backgroundOn": "#0cc1a3"
66
+ },
67
+ "tag": {
68
+ "backgroundCobalt": "#e6ecf8",
69
+ "backgroundPurple": "#f6eefd",
70
+ "backgroundRed": "#fce6e6",
71
+ "iconGrey": "#9e9e9e",
72
+ "iconPurple": "#a954ef",
73
+ "iconRed": "#e10000",
74
+ "backgroundGold": "#faf2e9",
75
+ "iconOrange": "#ff6200",
76
+ "iconYellow": "#c97a20",
77
+ "iconGreen": "#38a06c",
78
+ "textWhite": "#ffffff",
79
+ "textGrey": "#616161",
80
+ "textGreen": "#226041",
81
+ "iconBlue": "#4589ff",
82
+ "borderTrademe": "#4854d3",
83
+ "textGold": "#794913",
84
+ "borderRealestate": "#0098ff",
85
+ "borderDarkGrey": "#616161",
86
+ "textOrange": "#662700",
87
+ "textYellow": "#794913",
88
+ "backgroundBlue": "#ecf3ff",
89
+ "borderOfficeWebsite": "#616161",
90
+ "iconCobalt": "#1d58be",
91
+ "borderOneroof": "#ff8500",
92
+ "iconGold": "#c97a20",
93
+ "backgroundYellow": "#fffbde",
94
+ "borderLightGrey": "#9e9e9e",
95
+ "borderAllhouse": "#000000",
96
+ "borderTenantPortal": "#0cc1a3",
97
+ "textCobalt": "#1c3766",
98
+ "textBlue": "#0445b7",
99
+ "backgroundPink": "#db2c73",
100
+ "backgroundGreen": "#ebf6f0",
101
+ "backgroundOrange": "#ffefe6",
102
+ "backgroundGrey": "#f5f5f5",
103
+ "textRed": "#5a0000",
104
+ "backgroundPrimary": "#0e0044",
105
+ "textPurple": "#6f2c91",
106
+ "backgroundEdit": "#ff8133",
107
+ "backgroundAccent": "#0cc1a3"
108
+ },
109
+ "interactiveSurface": {
110
+ "primary": {
111
+ "backgroundPressed": "#eeeeee",
112
+ "backgroundHover": "#fafafa",
113
+ "backgroundDisabled": "#ffffff",
114
+ "backgroundDefault": "#ffffff"
115
+ },
116
+ "secondary": {
117
+ "backgroundDefault": "#fafafa",
118
+ "backgroundHover": "#f5f5f5",
119
+ "backgroundPressed": "#eeeeee",
120
+ "backgroundDisabled": "#fafafa"
121
+ }
122
+ },
123
+ "creditscore": {
124
+ "borderExcellent": "#38a06c",
125
+ "borderGood": "#6ac233",
126
+ "borderAverage": "#ffb700",
127
+ "borderFair": "#ff6200",
128
+ "borderPoor": "#b40000",
129
+ "iconPoor": "#b40000",
130
+ "iconExcellent": "#38a06c",
131
+ "iconFair": "#ff6200",
132
+ "iconGood": "#6ac233",
133
+ "iconAverage": "#ffb700"
134
+ },
135
+ "segmentedControl": {
136
+ "backgroundColor": "#e7e6ec"
137
+ },
138
+ "progressBar": {
139
+ "incompleteColor": "#e0e0e0",
140
+ "accentColor": "#0cc1a3",
141
+ "errorColor": "#870000",
142
+ "successColor": "#16402b",
143
+ "warningColor": "#794913"
144
+ },
145
+ "chip": {
146
+ "backgroundHover": "#eeeeee",
147
+ "backgroundPressed": "#e0e0e0",
148
+ "backgroundDefault": "#ffffff",
149
+ "backgroundActive": "#0e0044",
150
+ "backgroundDisabled": "#ffffff"
151
+ },
152
+ "profile": {
153
+ "border": {
154
+ "turquoise": "#9ee6da",
155
+ "gold": "#dfaf79",
156
+ "orange": "#ffa166",
157
+ "purple": "#cb98f5",
158
+ "pink": "#f1abc7",
159
+ "blue": "#b5d0ff",
160
+ "cobalt": "#9bb5e2"
161
+ },
162
+ "text": {
163
+ "turquoise": "#0a9a82",
164
+ "gold": "#c97a20",
165
+ "orange": "#cc4e00",
166
+ "purple": "#a954ef",
167
+ "pink": "#db2c73",
168
+ "blue": "#376ecc",
169
+ "cobalt": "#366ac5"
170
+ },
171
+ "background": {
172
+ "turquoise": "#e7f9f6",
173
+ "yellow": "#fffdef",
174
+ "orange": "#ffefe6",
175
+ "purple": "#f6eefd",
176
+ "pink": "#fbeaf1",
177
+ "blue": "#ecf3ff",
178
+ "cobalt": "#e6ecf8"
179
+ }
180
+ }
181
+ },
182
+ "primitive": {
183
+ "color": {
184
+ "orange": {
185
+ "50": "#ffefe6",
186
+ "100": "#ffe0cc",
187
+ "200": "#ffa166",
188
+ "300": "#ff8133",
189
+ "400": "#ff6200",
190
+ "500": "#cc4e00",
191
+ "600": "#993b00",
192
+ "700": "#662700",
193
+ "800": "#331400",
194
+ "900": "#1a0a00"
195
+ },
196
+ "purple": {
197
+ "50": "#f6eefd",
198
+ "100": "#eeddfc",
199
+ "200": "#cb98f5",
200
+ "300": "#ba76f2",
201
+ "400": "#a954ef",
202
+ "500": "#8743bf",
203
+ "600": "#6f2c91",
204
+ "700": "#442260",
205
+ "800": "#221130",
206
+ "900": "#110818"
207
+ },
208
+ "grey": {
209
+ "50": "#fafafa",
210
+ "100": "#f5f5f5",
211
+ "200": "#eeeeee",
212
+ "300": "#e0e0e0",
213
+ "400": "#bdbdbd",
214
+ "500": "#9e9e9e",
215
+ "600": "#757575",
216
+ "700": "#616161",
217
+ "800": "#424242",
218
+ "900": "#212121"
219
+ },
220
+ "white": "#ffffff",
221
+ "turquoise": {
222
+ "50": "#e7f9f6",
223
+ "100": "#cef3ed",
224
+ "150": "#b6ece3",
225
+ "200": "#9ee6da",
226
+ "250": "#86e0d1",
227
+ "300": "#6ddac8",
228
+ "350": "#55d4bf",
229
+ "400": "#3dcdb5",
230
+ "450": "#24c7ac",
231
+ "500": "#0cc1a3",
232
+ "550": "#0bae93",
233
+ "600": "#0a9a82",
234
+ "650": "#088772",
235
+ "700": "#077462",
236
+ "750": "#066152",
237
+ "800": "#054d41",
238
+ "850": "#043a31",
239
+ "900": "#022721",
240
+ "950": "#011310"
241
+ },
242
+ "cobalt": {
243
+ "50": "#e6ecf8",
244
+ "100": "#cddaf1",
245
+ "150": "#b4c7e9",
246
+ "200": "#9bb5e2",
247
+ "250": "#82a2db",
248
+ "300": "#688fd4",
249
+ "350": "#4f7dcd",
250
+ "400": "#366ac5",
251
+ "450": "#1d58be",
252
+ "500": "#0445b7",
253
+ "550": "#043ea5",
254
+ "600": "#033792",
255
+ "650": "#033080",
256
+ "700": "#02296e",
257
+ "750": "#02235c",
258
+ "800": "#021c49",
259
+ "850": "#011537",
260
+ "900": "#010e25",
261
+ "950": "#000712"
262
+ },
263
+ "darkBlue": {
264
+ "50": "#e7e6ec",
265
+ "100": "#cfccda",
266
+ "200": "#b7b3c7",
267
+ "300": "#9f99b4",
268
+ "400": "#8780a2",
269
+ "500": "#6e668f",
270
+ "600": "#564d7c",
271
+ "700": "#3e3369",
272
+ "800": "#261a57",
273
+ "900": "#261a57",
274
+ "1000": "#0e0044"
275
+ },
276
+ "pink": {
277
+ "50": "#fbeaf1",
278
+ "100": "#f8d5e3",
279
+ "150": "#f4c0d5",
280
+ "200": "#f1abc7",
281
+ "250": "#ed96b9",
282
+ "300": "#e980ab",
283
+ "350": "#e66b9d",
284
+ "400": "#e2568f",
285
+ "450": "#df4181",
286
+ "500": "#db2c73",
287
+ "550": "#c52868",
288
+ "600": "#af235c",
289
+ "650": "#991f51",
290
+ "700": "#831a45",
291
+ "750": "#6e163a",
292
+ "800": "#58122e",
293
+ "850": "#420d22",
294
+ "900": "#2c0917",
295
+ "950": "#16040b"
296
+ },
297
+ "red": {
298
+ "50": "#fce6e6",
299
+ "100": "#f9cccc",
300
+ "200": "#ed6666",
301
+ "300": "#e73333",
302
+ "400": "#e10000",
303
+ "500": "#b40000",
304
+ "600": "#870000",
305
+ "700": "#5a0000",
306
+ "800": "#2d0000",
307
+ "900": "#170000"
308
+ },
309
+ "green": {
310
+ "50": "#ebf6f0",
311
+ "100": "#d7ece2",
312
+ "200": "#afd9c4",
313
+ "300": "#88c6a7",
314
+ "400": "#60b389",
315
+ "500": "#38a06c",
316
+ "600": "#2d8056",
317
+ "700": "#226041",
318
+ "800": "#16402b",
319
+ "900": "#0b2016"
320
+ },
321
+ "gold": {
322
+ "50": "#faf2e9",
323
+ "100": "#f4e4d2",
324
+ "200": "#dfaf79",
325
+ "300": "#d4954d",
326
+ "400": "#c97a20",
327
+ "500": "#a1621a",
328
+ "600": "#794913",
329
+ "700": "#50310d",
330
+ "800": "#281806",
331
+ "900": "#140c03"
332
+ },
333
+ "yellow": {
334
+ "50": "#fffdef",
335
+ "100": "#fffbde",
336
+ "200": "#fef49d",
337
+ "300": "#fdf17c",
338
+ "400": "#fded5b",
339
+ "500": "#cabe49",
340
+ "600": "#988e37",
341
+ "700": "#655f24",
342
+ "800": "#332f12",
343
+ "900": "#191809"
344
+ },
345
+ "blue": {
346
+ "50": "#ecf3ff",
347
+ "100": "#dae7ff",
348
+ "200": "#b5d0ff",
349
+ "300": "#8fb8ff",
350
+ "400": "#6aa1ff",
351
+ "500": "#4589ff",
352
+ "600": "#376ecc",
353
+ "700": "#295299",
354
+ "800": "#1c3766",
355
+ "900": "#0e1b33",
356
+ "1000": "#070e1a"
357
+ },
358
+ "gradient": {
359
+ "100": "#0cc1a3",
360
+ "200": "#0445b7"
361
+ },
362
+ "mango": {
363
+ "50": "#fff8e6",
364
+ "100": "#ffe299",
365
+ "200": "#ffd466",
366
+ "300": "#ffc533",
367
+ "400": "#ffb700",
368
+ "500": "#cc9200",
369
+ "600": "#996e00",
370
+ "700": "#664900",
371
+ "800": "#332500",
372
+ "900": "#1a1200"
373
+ },
374
+ "brand": {
375
+ "mint": "#0cc1a3",
376
+ "pink": "#db2c73",
377
+ "cobalt": "#274a9a",
378
+ "darkBlue": "#0e0044"
379
+ }
380
+ },
381
+ "opacity": {
382
+ "opacity9": "rgba(0, 0, 0, 0.74)",
383
+ "opacity8": "rgba(0, 0, 0, 0.62)",
384
+ "opacity10": "rgba(0, 0, 0, 0.87)",
385
+ "opacity6": "rgba(0, 0, 0, 0.38)",
386
+ "opacity3": "rgba(0, 0, 0, 0.07)",
387
+ "opacity5": "rgba(0, 0, 0, 0.26)",
388
+ "opacity7": "rgba(0, 0, 0, 0.54)",
389
+ "opacity1": "rgba(0, 0, 0, 0.02)",
390
+ "opacity4": "rgba(0, 0, 0, 0.12)",
391
+ "opacity2": "rgba(0, 0, 0, 0.04)"
392
+ },
393
+ "radius": {
394
+ "radius6": "1.5rem",
395
+ "radius2": "0.5rem",
396
+ "radius5": "1.25rem",
397
+ "radius4": "1rem",
398
+ "radius3": "0.75rem",
399
+ "radius1": "0.25rem"
400
+ },
401
+ "spacing": {
402
+ "spacing10": "2.25rem",
403
+ "spacing9": "2rem",
404
+ "spacing4": "0.75rem",
405
+ "spacing6": "1.25rem",
406
+ "spacing13": "3rem",
407
+ "spacing17": "4rem",
408
+ "spacing8": "1.75rem",
409
+ "spacing15": "3.5rem",
410
+ "spacing14": "3.25rem",
411
+ "spacing3": "0.5rem",
412
+ "spacing12": "2.75rem",
413
+ "spacing2": "0.25rem",
414
+ "spacing7": "1.5rem",
415
+ "spacing5": "1rem",
416
+ "spacing11": "2.5rem",
417
+ "spacing16": "3.75rem",
418
+ "spacing1": "0rem"
419
+ }
420
+ },
421
+ "semantic": {
422
+ "surface": {
423
+ "warningColor": "#fffbde",
424
+ "errorColor": "#fce6e6",
425
+ "primaryColor": "#0e0044",
426
+ "infoColor": "#dae7ff",
427
+ "editColor": "#faf2e9",
428
+ "background2": "#fafafa",
429
+ "background3": "#f5f5f5",
430
+ "successColor": "#d7ece2",
431
+ "background1": "#ffffff",
432
+ "accentColor": "#cef3ed",
433
+ "scrim": "rgba(0, 0, 0, 0.74)"
434
+ },
435
+ "icons": {
436
+ "warningColor": "#794913",
437
+ "errorColor": "#870000",
438
+ "iconOnColor": "#ffffff",
439
+ "disabledColor": "#757575",
440
+ "primaryColor": "#0e0044",
441
+ "accentColor": "#0cc1a3",
442
+ "infoColor": "#043ea5",
443
+ "successColor": "#16402b",
444
+ "secondaryColor": "#6e668f",
445
+ "incompleteStepColor": "#6e668f",
446
+ "destructiveColor": "#e10000",
447
+ "archivedColor": "#c97a20"
448
+ },
449
+ "selelectionControl": {
450
+ "selectedDisabled": "#bdbdbd",
451
+ "selectedHover": "#0bae93",
452
+ "selectedDefault": "#0cc1a3",
453
+ "unselectedDefault": "#616161",
454
+ "unselectedHoverColor": "#212121",
455
+ "selectedPressed": "#0a9a82",
456
+ "unselectedPressed": "#212121",
457
+ "unselectedDisabled": "#bdbdbd"
458
+ },
459
+ "border": {
460
+ "accentColor": "#0cc1a3",
461
+ "successColor": "#16402b",
462
+ "errorColor": "#870000",
463
+ "focusColor": "#0e0044",
464
+ "mediumColor": "#bdbdbd",
465
+ "warningColor": "#794913",
466
+ "subtleColor": "#e0e0e0",
467
+ "primaryColor": "#0e0044",
468
+ "strongColor": "#424242",
469
+ "infoColor": "#043ea5",
470
+ "editColor": "#ff8133"
471
+ },
472
+ "text": {
473
+ "disabledColor": "#757575",
474
+ "accentColor": "#0cc1a3",
475
+ "warningColor": "#794913",
476
+ "textOnColor": "#ffffff",
477
+ "successColor": "#16402b",
478
+ "errorColor": "#870000",
479
+ "placeholderColor": "#616161",
480
+ "primaryColor": "#0e0044",
481
+ "infoColor": "#043ea5",
482
+ "secondaryColor": "#6e668f",
483
+ "archivedColor": "#c97a20",
484
+ "destructiveColor": "#e10000",
485
+ "linkColor": "#0e0044",
486
+ "requiredStarColor": "#b40000",
487
+ "incompleteStepColor": "#6e668f"
488
+ }
489
+ }
490
+ };
@@ -0,0 +1,3 @@
1
+ const light = require('./light.cjs');
2
+ const dark = require('./dark.cjs');
3
+ module.exports = {light, dark};