@worldresources/wri-design-systems 2.191.11 → 2.191.15
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 +120 -7
- package/agents/AGENTS.md +48 -13
- package/agents/border-width.md +13 -0
- package/agents/radius.md +14 -0
- package/agents/setup-ai.sh +0 -0
- package/agents/spacing.md +14 -0
- package/agents/typography.md +27 -0
- package/dist/index.cjs.js +1523 -1457
- package/dist/index.d.ts +16 -3
- package/dist/index.esm.js +1531 -1465
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -141,6 +141,26 @@ export const system = createSystem(designSystemStyles._config, {
|
|
|
141
141
|
'controls-on-neutral-darks': { value: '#F5BF4F' }, // primary 400
|
|
142
142
|
},
|
|
143
143
|
},
|
|
144
|
+
spacing: {
|
|
145
|
+
// Available steps: 0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1400, 1600, 2000, 2400, 2800
|
|
146
|
+
400: { value: '1rem' },
|
|
147
|
+
},
|
|
148
|
+
radii: {
|
|
149
|
+
// Available steps: 100, 200, 300, 400, 500, 600, 700, 800, 900
|
|
150
|
+
500: { value: '0.5rem' },
|
|
151
|
+
},
|
|
152
|
+
borderWidths: {
|
|
153
|
+
// Available steps: 100, 200, 300, 400
|
|
154
|
+
100: { value: '0.0625rem' },
|
|
155
|
+
},
|
|
156
|
+
fontSizes: {
|
|
157
|
+
// Available steps: 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100
|
|
158
|
+
500: { value: '1rem' },
|
|
159
|
+
},
|
|
160
|
+
lineHeights: {
|
|
161
|
+
// Available steps: 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200
|
|
162
|
+
600: { value: '1.5rem' },
|
|
163
|
+
},
|
|
144
164
|
},
|
|
145
165
|
},
|
|
146
166
|
})
|
|
@@ -230,18 +250,101 @@ function App() {
|
|
|
230
250
|
--color-accessible-controls-on-neutral-darks: var(
|
|
231
251
|
--chakra-colors-accessible-controls-on-neutral-darks
|
|
232
252
|
);
|
|
253
|
+
|
|
254
|
+
/* Spacing */
|
|
255
|
+
--spacing-0: var(--chakra-spacing-0);
|
|
256
|
+
--spacing-50: var(--chakra-spacing-50);
|
|
257
|
+
--spacing-100: var(--chakra-spacing-100);
|
|
258
|
+
--spacing-200: var(--chakra-spacing-200);
|
|
259
|
+
--spacing-300: var(--chakra-spacing-300);
|
|
260
|
+
--spacing-400: var(--chakra-spacing-400);
|
|
261
|
+
--spacing-500: var(--chakra-spacing-500);
|
|
262
|
+
--spacing-600: var(--chakra-spacing-600);
|
|
263
|
+
--spacing-700: var(--chakra-spacing-700);
|
|
264
|
+
--spacing-800: var(--chakra-spacing-800);
|
|
265
|
+
--spacing-900: var(--chakra-spacing-900);
|
|
266
|
+
--spacing-1000: var(--chakra-spacing-1000);
|
|
267
|
+
--spacing-1100: var(--chakra-spacing-1100);
|
|
268
|
+
--spacing-1200: var(--chakra-spacing-1200);
|
|
269
|
+
--spacing-1400: var(--chakra-spacing-1400);
|
|
270
|
+
--spacing-1600: var(--chakra-spacing-1600);
|
|
271
|
+
--spacing-2000: var(--chakra-spacing-2000);
|
|
272
|
+
--spacing-2400: var(--chakra-spacing-2400);
|
|
273
|
+
--spacing-2800: var(--chakra-spacing-2800);
|
|
274
|
+
|
|
275
|
+
/* Radius */
|
|
276
|
+
--radius-100: var(--chakra-radii-100);
|
|
277
|
+
--radius-200: var(--chakra-radii-200);
|
|
278
|
+
--radius-300: var(--chakra-radii-300);
|
|
279
|
+
--radius-400: var(--chakra-radii-400);
|
|
280
|
+
--radius-500: var(--chakra-radii-500);
|
|
281
|
+
--radius-600: var(--chakra-radii-600);
|
|
282
|
+
--radius-700: var(--chakra-radii-700);
|
|
283
|
+
--radius-800: var(--chakra-radii-800);
|
|
284
|
+
--radius-900: var(--chakra-radii-900);
|
|
285
|
+
|
|
286
|
+
/* Border Widths */
|
|
287
|
+
--border-width-100: var(--chakra-border-widths-100);
|
|
288
|
+
--border-width-200: var(--chakra-border-widths-200);
|
|
289
|
+
--border-width-300: var(--chakra-border-widths-300);
|
|
290
|
+
--border-width-400: var(--chakra-border-widths-400);
|
|
291
|
+
|
|
292
|
+
/* Font Sizes */
|
|
293
|
+
--font-size-200: var(--chakra-font-sizes-200);
|
|
294
|
+
--font-size-300: var(--chakra-font-sizes-300);
|
|
295
|
+
--font-size-400: var(--chakra-font-sizes-400);
|
|
296
|
+
--font-size-500: var(--chakra-font-sizes-500);
|
|
297
|
+
--font-size-600: var(--chakra-font-sizes-600);
|
|
298
|
+
--font-size-700: var(--chakra-font-sizes-700);
|
|
299
|
+
--font-size-800: var(--chakra-font-sizes-800);
|
|
300
|
+
--font-size-900: var(--chakra-font-sizes-900);
|
|
301
|
+
--font-size-1000: var(--chakra-font-sizes-1000);
|
|
302
|
+
--font-size-1100: var(--chakra-font-sizes-1100);
|
|
303
|
+
|
|
304
|
+
/* Line Heights */
|
|
305
|
+
--line-height-300: var(--chakra-line-heights-300);
|
|
306
|
+
--line-height-400: var(--chakra-line-heights-400);
|
|
307
|
+
--line-height-500: var(--chakra-line-heights-500);
|
|
308
|
+
--line-height-600: var(--chakra-line-heights-600);
|
|
309
|
+
--line-height-700: var(--chakra-line-heights-700);
|
|
310
|
+
--line-height-800: var(--chakra-line-heights-800);
|
|
311
|
+
--line-height-900: var(--chakra-line-heights-900);
|
|
312
|
+
--line-height-1000: var(--chakra-line-heights-1000);
|
|
313
|
+
--line-height-1100: var(--chakra-line-heights-1100);
|
|
314
|
+
--line-height-1200: var(--chakra-line-heights-1200);
|
|
233
315
|
```
|
|
234
316
|
|
|
235
|
-
###
|
|
317
|
+
### Theme Token Functions
|
|
236
318
|
|
|
237
|
-
Use **
|
|
319
|
+
Use the **getThemed\*** functions to access your design system tokens.
|
|
238
320
|
|
|
239
321
|
```tsx
|
|
240
|
-
import {
|
|
322
|
+
import {
|
|
323
|
+
getThemedColor,
|
|
324
|
+
getThemedSpacing,
|
|
325
|
+
getThemedRadius,
|
|
326
|
+
getThemedBorderWidth,
|
|
327
|
+
getThemedFontSize,
|
|
328
|
+
getThemedLineHeight,
|
|
329
|
+
} from '@worldresources/wri-design-systems'
|
|
241
330
|
```
|
|
242
331
|
|
|
243
|
-
```
|
|
244
|
-
|
|
332
|
+
```css
|
|
333
|
+
/* Colors */
|
|
334
|
+
border-color: ${getThemedColor('neutral', 400)};
|
|
335
|
+
|
|
336
|
+
/* Spacing */
|
|
337
|
+
margin-bottom: ${getThemedSpacing(200)};
|
|
338
|
+
|
|
339
|
+
/* Radius */
|
|
340
|
+
border-radius: ${getThemedRadius(500)};
|
|
341
|
+
|
|
342
|
+
/* Border Widths */
|
|
343
|
+
border-width: ${getThemedBorderWidth(100)};
|
|
344
|
+
|
|
345
|
+
/* Typography */
|
|
346
|
+
font-size: ${getThemedFontSize(500)};
|
|
347
|
+
line-height: ${getThemedLineHeight(600)};
|
|
245
348
|
```
|
|
246
349
|
|
|
247
350
|
## Components
|
|
@@ -262,6 +365,8 @@ border: 1px solid ${getThemedColor('neutral', 400)};
|
|
|
262
365
|
|
|
263
366
|
## Forms
|
|
264
367
|
|
|
368
|
+
- [Form Container](https://github.com/wri/wri-design-systems/tree/main/src/components/Forms/FormContainer)
|
|
369
|
+
|
|
265
370
|
### Actions
|
|
266
371
|
|
|
267
372
|
- [Button](https://github.com/wri/wri-design-systems/tree/main/src/components/Forms/Actions/Button)
|
|
@@ -284,6 +389,7 @@ border: 1px solid ${getThemedColor('neutral', 400)};
|
|
|
284
389
|
### Inputs
|
|
285
390
|
|
|
286
391
|
- [Checkbox List](https://github.com/wri/wri-design-systems/tree/main/src/components/Forms/Inputs/CheckboxList)
|
|
392
|
+
- [Combobox](https://github.com/wri/wri-design-systems/tree/main/src/components/Forms/Inputs/Combobox)
|
|
287
393
|
- [Input With Units](https://github.com/wri/wri-design-systems/tree/main/src/components/Forms/Inputs/InputWithUnits)
|
|
288
394
|
- [Password](https://github.com/wri/wri-design-systems/tree/main/src/components/Forms/Inputs/Password)
|
|
289
395
|
- [Radio List](https://github.com/wri/wri-design-systems/tree/main/src/components/Forms/Inputs/RadioList)
|
|
@@ -296,10 +402,14 @@ border: 1px solid ${getThemedColor('neutral', 400)};
|
|
|
296
402
|
|
|
297
403
|
- [Tag](https://github.com/wri/wri-design-systems/tree/main/src/components/Forms/Tag)
|
|
298
404
|
|
|
405
|
+
### Form Container
|
|
406
|
+
|
|
407
|
+
- [Form Container](https://github.com/wri/wri-design-systems/tree/main/src/components/Forms/FormContainer)
|
|
408
|
+
|
|
299
409
|
## Geospatial
|
|
300
410
|
|
|
301
411
|
- [Base Map](https://github.com/wri/wri-design-systems/tree/main/src/components/Geospatial/BaseMap)
|
|
302
|
-
- [
|
|
412
|
+
- [Map Marker](https://github.com/wri/wri-design-systems/tree/main/src/components/Geospatial/MapMarker)
|
|
303
413
|
- [Map Pop Up](https://github.com/wri/wri-design-systems/tree/main/src/components/Geospatial/MapPopUp)
|
|
304
414
|
|
|
305
415
|
### Layers
|
|
@@ -313,6 +423,7 @@ border: 1px solid ${getThemedColor('neutral', 400)};
|
|
|
313
423
|
- [Layer Parameters](https://github.com/wri/wri-design-systems/tree/main/src/components/Geospatial/Legends/LayerParameters)
|
|
314
424
|
- [Legend Item](https://github.com/wri/wri-design-systems/tree/main/src/components/Geospatial/Legends/LegendItem)
|
|
315
425
|
- [Legend Panel](https://github.com/wri/wri-design-systems/tree/main/src/components/Geospatial/Legends/LegendPanel)
|
|
426
|
+
- [Opacity Control](https://github.com/wri/wri-design-systems/tree/main/src/components/Geospatial/Legends/OpacityControl)
|
|
316
427
|
- [Qualitative Attribute](https://github.com/wri/wri-design-systems/tree/main/src/components/Geospatial/Legends/QualitativeAttribute)
|
|
317
428
|
- [Scale Bar](https://github.com/wri/wri-design-systems/tree/main/src/components/Geospatial/Legends/ScaleBar)
|
|
318
429
|
|
|
@@ -324,15 +435,17 @@ border: 1px solid ${getThemedColor('neutral', 400)};
|
|
|
324
435
|
- [Navbar](https://github.com/wri/wri-design-systems/tree/main/src/components/Navigation/Navbar)
|
|
325
436
|
- [Navigation Rail](https://github.com/wri/wri-design-systems/tree/main/src/components/Navigation/NavigationRail)
|
|
326
437
|
- [Pagination](https://github.com/wri/wri-design-systems/tree/main/src/components/Navigation/Pagination)
|
|
438
|
+
- [Search](https://github.com/wri/wri-design-systems/tree/main/src/components/Navigation/Search)
|
|
327
439
|
- [Tab Bar](https://github.com/wri/wri-design-systems/tree/main/src/components/Navigation/TabBar)
|
|
328
440
|
|
|
329
441
|
## Status
|
|
330
442
|
|
|
443
|
+
- [Alert Banner](https://github.com/wri/wri-design-systems/tree/main/src/components/Status/AlertBanner)
|
|
331
444
|
- [Avatar](https://github.com/wri/wri-design-systems/tree/main/src/components/Status/Avatar)
|
|
332
445
|
- [Badge](https://github.com/wri/wri-design-systems/tree/main/src/components/Status/Badge)
|
|
333
446
|
- [Inline Message](https://github.com/wri/wri-design-systems/tree/main/src/components/Status/InlineMessage)
|
|
334
447
|
- [Progress Bar](https://github.com/wri/wri-design-systems/tree/main/src/components/Status/ProgressBar)
|
|
335
|
-
- [Step Progress Indicator](https://github.com/wri/wri-design-systems/tree/main/src/components/
|
|
448
|
+
- [Step Progress Indicator](https://github.com/wri/wri-design-systems/tree/main/src/components/Status/StepProgressIndicator)
|
|
336
449
|
- [Toast](https://github.com/wri/wri-design-systems/tree/main/src/components/Status/Toast)
|
|
337
450
|
|
|
338
451
|
## Templates
|
package/agents/AGENTS.md
CHANGED
|
@@ -193,6 +193,39 @@ getThemedColor(
|
|
|
193
193
|
- For overridden scales (`neutral`, `primary`, `secondary`), valid steps are listed in the table above.
|
|
194
194
|
- For non-overridden scales (`success`, `warning`, `error`, `accessible`), query the Storybook MCP before using any step — do not assume which steps are defined.
|
|
195
195
|
|
|
196
|
+
### Other Theme Tokens — Spacing, Radius, Borders, and Typography
|
|
197
|
+
|
|
198
|
+
Just like colors, spacing, radius, border widths, and typography must use their respective `getThemed*` functions.
|
|
199
|
+
|
|
200
|
+
- **Spacing:** `getThemedSpacing(token)` (Tokens: `0`, `50`, `100`, `200`, `300`, `400`, `500`, `600`, `700`, `800`, `900`, `1000`, `1100`, `1200`, `1400`, `1600`, `2000`, `2400`, `2800`)
|
|
201
|
+
- **Radius:** `getThemedRadius(token)` (Tokens: `100`, `200`, `300`, `400`, `500`, `600`, `700`, `800`, `900`)
|
|
202
|
+
- **Border Width:** `getThemedBorderWidth(token)` (Tokens: `100`, `200`, `300`, `400`)
|
|
203
|
+
- **Font Size:** `getThemedFontSize(token)` (Tokens: `200`, `300`, `400`, `500`, `600`, `700`, `800`, `900`, `1000`, `1100`)
|
|
204
|
+
- **Line Height:** `getThemedLineHeight(token)` (Tokens: `300`, `400`, `500`, `600`, `700`, `800`, `900`, `1000`, `1100`, `1200`)
|
|
205
|
+
|
|
206
|
+
```tsx
|
|
207
|
+
import {
|
|
208
|
+
getThemedSpacing,
|
|
209
|
+
getThemedRadius,
|
|
210
|
+
getThemedBorderWidth,
|
|
211
|
+
getThemedFontSize,
|
|
212
|
+
getThemedLineHeight,
|
|
213
|
+
} from '@worldresources/wri-design-systems'
|
|
214
|
+
|
|
215
|
+
// ✅ Correct
|
|
216
|
+
;<Box
|
|
217
|
+
p={getThemedSpacing(400)}
|
|
218
|
+
borderRadius={getThemedRadius(500)}
|
|
219
|
+
border={`${getThemedBorderWidth(100)} solid ${getThemedColor('neutral', 300)}`}
|
|
220
|
+
>
|
|
221
|
+
<Text fontSize={getThemedFontSize(500)} lineHeight={getThemedLineHeight(600)}>
|
|
222
|
+
Label
|
|
223
|
+
</Text>
|
|
224
|
+
</Box>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
For full references, check `agents/spacing.md`, `agents/radius.md`, `agents/border-width.md`, and `agents/typography.md`.
|
|
228
|
+
|
|
196
229
|
---
|
|
197
230
|
|
|
198
231
|
## What NOT to Do
|
|
@@ -204,10 +237,11 @@ import { Button } from "@chakra-ui/react" // → use WRI DS Button
|
|
|
204
237
|
// ❌ Do not override WRI DS styles
|
|
205
238
|
<Button sx={{ backgroundColor: "red" }}>Delete</Button>
|
|
206
239
|
|
|
207
|
-
// ❌ Do not hardcode design values
|
|
208
|
-
<Text fontSize="14px" color="#333333">Label</Text>
|
|
240
|
+
// ❌ Do not hardcode design values or use raw strings for spacing, radius, etc.
|
|
241
|
+
<Text fontSize="14px" color="#333333">Label</Text> // → use getThemedFontSize, getThemedColor
|
|
242
|
+
<Box p="1rem" borderRadius="8px" /> // → use getThemedSpacing, getThemedRadius
|
|
209
243
|
|
|
210
|
-
// ❌ Do not use raw token strings as
|
|
244
|
+
// ❌ Do not use raw token strings as styling props — always use getThemed* functions
|
|
211
245
|
<Box bg="primary.500" /> // → use getThemedColor('primary', 500)
|
|
212
246
|
|
|
213
247
|
// ❌ Do not create custom components without the searchable marker
|
|
@@ -223,13 +257,14 @@ const MyButton = () => <button style={{ background: "blue" }}>Click</button>
|
|
|
223
257
|
|
|
224
258
|
## Quick Reference
|
|
225
259
|
|
|
226
|
-
| Question | Where to look
|
|
227
|
-
| --------------------------------------------- |
|
|
228
|
-
| Does a WRI DS component exist? | [Storybook](https://wri.github.io/wri-design-systems/) or Storybook MCP
|
|
229
|
-
| Detailed props / usage for a WRI DS component | Component README in GitHub: `src/components/<Category>/<Name>/README.md`
|
|
230
|
-
| What props does a Chakra component accept? | Chakra MCP → `get_component_props`
|
|
231
|
-
| What design tokens are available? | Chakra MCP → `get_theme
|
|
232
|
-
| Which color scales/steps are overridden here? | Read `src/components/Providers/index.tsx` — that is the source of truth
|
|
233
|
-
| Which steps exist for non-overridden scales? | Query Storybook MCP — do not guess
|
|
234
|
-
| How do I use a color in JSX? | `getThemedColor('scale', step)` from `@worldresources/wri-design-systems`
|
|
235
|
-
|
|
|
260
|
+
| Question | Where to look |
|
|
261
|
+
| --------------------------------------------- | ------------------------------------------------------------------------- |
|
|
262
|
+
| Does a WRI DS component exist? | [Storybook](https://wri.github.io/wri-design-systems/) or Storybook MCP |
|
|
263
|
+
| Detailed props / usage for a WRI DS component | Component README in GitHub: `src/components/<Category>/<Name>/README.md` |
|
|
264
|
+
| What props does a Chakra component accept? | Chakra MCP → `get_component_props` |
|
|
265
|
+
| What design tokens are available? | `agents/*.md` files, Chakra MCP → `get_theme`, or Zeroheight |
|
|
266
|
+
| Which color scales/steps are overridden here? | Read `src/components/Providers/index.tsx` — that is the source of truth |
|
|
267
|
+
| Which steps exist for non-overridden scales? | Query Storybook MCP — do not guess |
|
|
268
|
+
| How do I use a color in JSX? | `getThemedColor('scale', step)` from `@worldresources/wri-design-systems` |
|
|
269
|
+
| How do I use spacing/radius/fonts in JSX? | `getThemedSpacing`, `getThemedRadius`, `getThemedFontSize`, etc. |
|
|
270
|
+
| Where are all custom components in this repo? | "Find in Files" → `[CUSTOM COMPONENT]` |
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Border width tokens
|
|
2
|
+
|
|
3
|
+
This package defines border width primitives as Chakra `borderWidths` tokens.
|
|
4
|
+
|
|
5
|
+
Use `getThemedBorderWidth(token)` where `token` is one of:
|
|
6
|
+
|
|
7
|
+
- `100` `200` `300` `400`
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { getThemedBorderWidth } from '@worldresources/wri-design-systems'
|
|
11
|
+
|
|
12
|
+
const thin = getThemedBorderWidth(100) // "0.0625rem"
|
|
13
|
+
```
|
package/agents/radius.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Radius tokens
|
|
2
|
+
|
|
3
|
+
This package defines border radius primitives as Chakra `radii` tokens.
|
|
4
|
+
|
|
5
|
+
Use `getThemedRadius(token)` where `token` is one of:
|
|
6
|
+
|
|
7
|
+
- `100` `200` `300` `400` `500` `600` `700` `800` `900`
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { getThemedRadius } from '@worldresources/wri-design-systems'
|
|
11
|
+
|
|
12
|
+
const cardRadius = getThemedRadius(500) // "0.5rem"
|
|
13
|
+
const pillRadius = getThemedRadius(900) // "9999px"
|
|
14
|
+
```
|
package/agents/setup-ai.sh
CHANGED
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Spacing tokens
|
|
2
|
+
|
|
3
|
+
This package defines spacing primitives as Chakra `spacing` tokens (in `rem`).
|
|
4
|
+
|
|
5
|
+
Use `getThemedSpacing(token)` where `token` is one of:
|
|
6
|
+
|
|
7
|
+
- `0` `50` `100` `200` `300` `400` `500` `600` `700` `800` `900`
|
|
8
|
+
- `1000` `1100` `1200` `1400` `1600` `2000` `2400` `2800`
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { getThemedSpacing } from '@worldresources/wri-design-systems'
|
|
12
|
+
|
|
13
|
+
const pad = getThemedSpacing(400) // "1rem"
|
|
14
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Typography tokens
|
|
2
|
+
|
|
3
|
+
This package defines typography primitives as Chakra system tokens (in `rem`).
|
|
4
|
+
|
|
5
|
+
## Font sizes
|
|
6
|
+
|
|
7
|
+
Use `getThemedFontSize(token)` where `token` is one of:
|
|
8
|
+
|
|
9
|
+
- `200` `300` `400` `500` `600` `700` `800` `900` `1000` `1100`
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { getThemedFontSize } from '@worldresources/wri-design-systems'
|
|
13
|
+
|
|
14
|
+
const titleSize = getThemedFontSize(700) // "1.5rem"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Line heights
|
|
18
|
+
|
|
19
|
+
Use `getThemedLineHeight(token)` where `token` is one of:
|
|
20
|
+
|
|
21
|
+
- `300` `400` `500` `600` `700` `800` `900` `1000` `1100` `1200`
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { getThemedLineHeight } from '@worldresources/wri-design-systems'
|
|
25
|
+
|
|
26
|
+
const tight = getThemedLineHeight(400) // "1rem"
|
|
27
|
+
```
|