@worldresources/wri-design-systems 2.191.24 → 2.192.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/README.md +1 -0
- package/agents/AGENTS.md +22 -0
- package/agents/setup-ai.mjs +1 -0
- package/agents/wri-ds.instructions.md +30 -0
- package/dist/index.cjs.js +1021 -1004
- package/dist/index.d.ts +51 -9
- package/dist/index.esm.js +1544 -1527
- package/package.json +15 -2
package/README.md
CHANGED
|
@@ -399,6 +399,7 @@ line-height: ${getThemedLineHeight(600)};
|
|
|
399
399
|
- [Slider Input](https://github.com/wri/wri-design-systems/tree/main/src/components/Forms/Inputs/SliderInput)
|
|
400
400
|
- [Text Area](https://github.com/wri/wri-design-systems/tree/main/src/components/Forms/Inputs/Textarea)
|
|
401
401
|
- [Text Input](https://github.com/wri/wri-design-systems/tree/main/src/components/Forms/Inputs/TextInput)
|
|
402
|
+
- [Rich Text Editor](https://github.com/wri/wri-design-systems/tree/main/src/components/Forms/Inputs/RichTextEditor)
|
|
402
403
|
|
|
403
404
|
### Tags
|
|
404
405
|
|
package/agents/AGENTS.md
CHANGED
|
@@ -39,6 +39,28 @@ Key rules (full details in the instructions file):
|
|
|
39
39
|
5. **No Chakra v2 API** — v3 has breaking changes. Verify props via Chakra MCP.
|
|
40
40
|
6. **Accessibility first** — always provide `aria-*` props (like `aria-label` or `aria-describedby`), explicit `role` attributes, and ensure keyboard focus navigation context when consuming components.
|
|
41
41
|
|
|
42
|
+
## Internationalization (i18n) — Optional
|
|
43
|
+
|
|
44
|
+
All WRI DS components ship with English defaults. No i18n setup is needed for English-only apps.
|
|
45
|
+
|
|
46
|
+
If your application supports multiple languages, override internal component strings by passing pre-translated values via `DesignSystemLocaleProvider` (app-wide) or the component's `labels` prop (per-instance). The library has no runtime i18n dependency — pass strings from your own stack (react-intl, react-i18next, etc.).
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import { DesignSystemLocaleProvider } from '@worldresources/wri-design-systems'
|
|
50
|
+
;<DesignSystemLocaleProvider
|
|
51
|
+
labels={{
|
|
52
|
+
TextInput: {
|
|
53
|
+
optionalSuffix: t('common.optional'),
|
|
54
|
+
requiredSymbolLabel: t('common.required'),
|
|
55
|
+
},
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
<App />
|
|
59
|
+
</DesignSystemLocaleProvider>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Full reference — supported components, label types, and usage patterns: `docs/i18n/README.md`.
|
|
63
|
+
|
|
42
64
|
## Design Tokens — Source of Truth
|
|
43
65
|
|
|
44
66
|
All token functions are imported from the **package**:
|
package/agents/setup-ai.mjs
CHANGED
|
@@ -126,3 +126,33 @@ import {
|
|
|
126
126
|
| Raw token strings: `<Box bg="primary.500" />` | `getThemedColor('primary', 500)` |
|
|
127
127
|
| Inventing prop names without checking MCP | Query Storybook MCP first |
|
|
128
128
|
| Chakra v2 API (`colorScheme`, `variant` on v2 components) | Verify via Chakra MCP |
|
|
129
|
+
|
|
130
|
+
## Internationalization (i18n)
|
|
131
|
+
|
|
132
|
+
All WRI DS components render English by default — no setup required for English-only apps.
|
|
133
|
+
|
|
134
|
+
To provide translated strings, use one of two opt-in approaches:
|
|
135
|
+
|
|
136
|
+
**Provider** (recommended when multiple components or screens need translations):
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
import { DesignSystemLocaleProvider, type DesignSystemLabels } from '@worldresources/wri-design-systems'
|
|
140
|
+
|
|
141
|
+
const labels: DesignSystemLabels = {
|
|
142
|
+
CheckboxList: { expandLabel: t('ds.expand'), hideLabel: t('ds.hide') },
|
|
143
|
+
TextInput: { optionalSuffix: t('common.optional'), requiredSymbolLabel: t('common.required') },
|
|
144
|
+
}
|
|
145
|
+
<DesignSystemLocaleProvider labels={labels}><App /></DesignSystemLocaleProvider>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Per-component `labels` prop** (for isolated instances):
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
<Password
|
|
152
|
+
labels={{ showLabel: t('password.show'), hideLabel: t('password.hide') }}
|
|
153
|
+
/>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Pass pre-resolved strings only — never hardcoded English literals in `labels` props. Always route through your app's translation function.
|
|
157
|
+
|
|
158
|
+
Full reference — all supported components, label types, and patterns: `docs/i18n/README.md`.
|