@primereact/mcp 11.0.0 → 11.2.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.
Files changed (189) hide show
  1. package/data/llms/headless/components/accordion/api.json +9 -9
  2. package/data/llms/headless/components/animateonscroll/api.json +2 -2
  3. package/data/llms/headless/components/autocomplete/api.json +33 -33
  4. package/data/llms/headless/components/avatar/api.json +1 -1
  5. package/data/llms/headless/components/carousel/api.json +15 -15
  6. package/data/llms/headless/components/checkbox/api.json +18 -18
  7. package/data/llms/headless/components/collapsible/api.json +14 -14
  8. package/data/llms/headless/components/compare/api.json +3 -3
  9. package/data/llms/headless/components/contextmenu/api.json +2 -2
  10. package/data/llms/headless/components/datatable/api.json +19 -19
  11. package/data/llms/headless/components/dataview/api.json +3 -3
  12. package/data/llms/headless/components/datepicker/api.json +43 -43
  13. package/data/llms/headless/components/dialog/api.json +19 -19
  14. package/data/llms/headless/components/divider/api.json +3 -3
  15. package/data/llms/headless/components/drawer/api.json +13 -13
  16. package/data/llms/headless/components/fieldset/api.json +9 -9
  17. package/data/llms/headless/components/fileupload/api.json +5 -5
  18. package/data/llms/headless/components/focustrap/api.json +4 -4
  19. package/data/llms/headless/components/gallery/api.json +23 -23
  20. package/data/llms/headless/components/inplace/api.json +3 -3
  21. package/data/llms/headless/components/inputcolor/api.json +6 -6
  22. package/data/llms/headless/components/inputcolor.md +0 -1
  23. package/data/llms/headless/components/inputnumber/api.json +8 -8
  24. package/data/llms/headless/components/inputotp/api.json +7 -7
  25. package/data/llms/headless/components/inputpassword/api.json +4 -4
  26. package/data/llms/headless/components/inputpassword.md +3 -3
  27. package/data/llms/headless/components/inputtags/api.json +8 -8
  28. package/data/llms/headless/components/inputtext/api.json +1 -1
  29. package/data/llms/headless/components/knob/api.json +18 -18
  30. package/data/llms/headless/components/listbox/api.json +27 -27
  31. package/data/llms/headless/components/menu/api.json +10 -10
  32. package/data/llms/headless/components/message/api.json +1 -1
  33. package/data/llms/headless/components/metergroup/api.json +3 -3
  34. package/data/llms/headless/components/motion/api.json +1 -1
  35. package/data/llms/headless/components/navigationmenu/api.json +5 -5
  36. package/data/llms/headless/components/orderlist/api.json +5 -5
  37. package/data/llms/headless/components/organizationchart/api.json +6 -6
  38. package/data/llms/headless/components/paginator/api.json +5 -5
  39. package/data/llms/headless/components/panel/api.json +9 -9
  40. package/data/llms/headless/components/picklist/api.json +5 -5
  41. package/data/llms/headless/components/popover/api.json +16 -16
  42. package/data/llms/headless/components/positioner/api.json +7 -7
  43. package/data/llms/headless/components/progressbar/api.json +3 -3
  44. package/data/llms/headless/components/progressspinner/api.json +3 -3
  45. package/data/llms/headless/components/radiobutton/api.json +16 -16
  46. package/data/llms/headless/components/rating/api.json +5 -5
  47. package/data/llms/headless/components/scrollarea/api.json +6 -6
  48. package/data/llms/headless/components/select/api.json +34 -34
  49. package/data/llms/headless/components/sidebar/api.json +1116 -141
  50. package/data/llms/headless/components/sidebar.md +4 -2
  51. package/data/llms/headless/components/slider/api.json +3 -3
  52. package/data/llms/headless/components/speeddial/api.json +4 -4
  53. package/data/llms/headless/components/splitter/api.json +5 -5
  54. package/data/llms/headless/components/stepper/api.json +13 -13
  55. package/data/llms/headless/components/styleclass/api.json +1 -1
  56. package/data/llms/headless/components/tabs/api.json +17 -17
  57. package/data/llms/headless/components/terminal/api.json +1 -1
  58. package/data/llms/headless/components/toast/api.json +4 -4
  59. package/data/llms/headless/components/togglebutton/api.json +27 -3
  60. package/data/llms/headless/components/toggleswitch/api.json +3 -3
  61. package/data/llms/headless/components/tooltip/api.json +17 -17
  62. package/data/llms/headless/components/tree/api.json +20 -20
  63. package/data/llms/headless/components/tree.md +1 -0
  64. package/data/llms/headless/components/treetable/api.json +19 -19
  65. package/data/llms/headless/guides/misc/internationalization.md +282 -0
  66. package/data/llms/hooks/use-filter.md +2 -2
  67. package/data/llms/hooks/use-tree-filter.md +3 -1
  68. package/data/llms/llms-full.txt +10444 -1743
  69. package/data/llms/llms.txt +15 -0
  70. package/data/llms/primitive/components/accordion/api.json +39 -39
  71. package/data/llms/primitive/components/animateonscroll/api.json +5 -5
  72. package/data/llms/primitive/components/autocomplete/api.json +105 -105
  73. package/data/llms/primitive/components/avatar/api.json +14 -14
  74. package/data/llms/primitive/components/badge/api.json +6 -6
  75. package/data/llms/primitive/components/breadcrumb/api.json +27 -27
  76. package/data/llms/primitive/components/button/api.json +8 -8
  77. package/data/llms/primitive/components/buttongroup/api.json +3 -3
  78. package/data/llms/primitive/components/card/api.json +24 -24
  79. package/data/llms/primitive/components/carousel/api.json +28 -28
  80. package/data/llms/primitive/components/checkbox/api.json +14 -14
  81. package/data/llms/primitive/components/checkboxgroup/api.json +5 -5
  82. package/data/llms/primitive/components/chip/api.json +19 -19
  83. package/data/llms/primitive/components/collapsible/api.json +18 -18
  84. package/data/llms/primitive/components/compare/api.json +18 -18
  85. package/data/llms/primitive/components/contextmenu/api.json +150 -1141
  86. package/data/llms/primitive/components/datatable/api.json +215 -164
  87. package/data/llms/primitive/components/dataview/api.json +17 -17
  88. package/data/llms/primitive/components/datepicker/api.json +230 -230
  89. package/data/llms/primitive/components/dialog/api.json +63 -63
  90. package/data/llms/primitive/components/divider/api.json +3 -3
  91. package/data/llms/primitive/components/drawer/api.json +47 -47
  92. package/data/llms/primitive/components/fieldset/api.json +31 -31
  93. package/data/llms/primitive/components/fileupload/api.json +53 -53
  94. package/data/llms/primitive/components/floatlabel/api.json +3 -3
  95. package/data/llms/primitive/components/focustrap/api.json +7 -7
  96. package/data/llms/primitive/components/gallery/api.json +91 -91
  97. package/data/llms/primitive/components/iconfield/api.json +7 -7
  98. package/data/llms/primitive/components/iftalabel/api.json +3 -3
  99. package/data/llms/primitive/components/inplace/api.json +18 -18
  100. package/data/llms/primitive/components/inputcolor/api.json +51 -51
  101. package/data/llms/primitive/components/inputnumber/api.json +10 -10
  102. package/data/llms/primitive/components/inputotp/api.json +12 -12
  103. package/data/llms/primitive/components/inputpassword/api.json +7 -7
  104. package/data/llms/primitive/components/inputtags/api.json +6 -6
  105. package/data/llms/primitive/components/inputtext/api.json +4 -4
  106. package/data/llms/primitive/components/knob/api.json +19 -19
  107. package/data/llms/primitive/components/label/api.json +3 -3
  108. package/data/llms/primitive/components/listbox/api.json +57 -57
  109. package/data/llms/primitive/components/menu/api.json +87 -279
  110. package/data/llms/primitive/components/message/api.json +22 -22
  111. package/data/llms/primitive/components/metergroup/api.json +27 -27
  112. package/data/llms/primitive/components/navigationmenu/api.json +8 -8
  113. package/data/llms/primitive/components/paginator/api.json +43 -43
  114. package/data/llms/primitive/components/panel/api.json +34 -34
  115. package/data/llms/primitive/components/popover/api.json +67 -67
  116. package/data/llms/primitive/components/portal/api.json +4 -4
  117. package/data/llms/primitive/components/progressbar/api.json +22 -22
  118. package/data/llms/primitive/components/progressspinner/api.json +18 -18
  119. package/data/llms/primitive/components/radiobutton/api.json +16 -16
  120. package/data/llms/primitive/components/rating/api.json +20 -20
  121. package/data/llms/primitive/components/scrollarea/api.json +23 -23
  122. package/data/llms/primitive/components/select/api.json +95 -95
  123. package/data/llms/primitive/components/sidebar/api.json +215 -121
  124. package/data/llms/primitive/components/sidebar.md +2 -1
  125. package/data/llms/primitive/components/skeleton/api.json +3 -3
  126. package/data/llms/primitive/components/slider/api.json +22 -22
  127. package/data/llms/primitive/components/speeddial/api.json +22 -22
  128. package/data/llms/primitive/components/splitter/api.json +18 -18
  129. package/data/llms/primitive/components/stepper/api.json +64 -64
  130. package/data/llms/primitive/components/tabs/api.json +51 -51
  131. package/data/llms/primitive/components/tag/api.json +3 -3
  132. package/data/llms/primitive/components/terminal/api.json +44 -44
  133. package/data/llms/primitive/components/textarea/api.json +4 -4
  134. package/data/llms/primitive/components/timeline/api.json +27 -27
  135. package/data/llms/primitive/components/toast/api.json +48 -48
  136. package/data/llms/primitive/components/togglebutton/api.json +10 -10
  137. package/data/llms/primitive/components/togglebuttongroup/api.json +5 -5
  138. package/data/llms/primitive/components/toggleswitch/api.json +12 -12
  139. package/data/llms/primitive/components/toolbar/api.json +15 -15
  140. package/data/llms/primitive/components/tooltip/api.json +52 -52
  141. package/data/llms/primitive/components/tree/api.json +73 -73
  142. package/data/llms/primitive/components/visuallyhidden/api.json +3 -3
  143. package/data/llms/primitive/guides/migration/updating-to-v11.md +2219 -0
  144. package/data/llms/primitive/guides/misc/internationalization.md +287 -0
  145. package/data/llms/styled/add-ons/designer/ci.md +273 -0
  146. package/data/llms/styled/add-ons/designer/guide.md +99 -0
  147. package/data/llms/styled/add-ons/designer/overview.md +194 -0
  148. package/data/llms/styled/add-ons/uikit/guide/v3.md +182 -0
  149. package/data/llms/styled/add-ons/uikit/guide/v4.md +163 -0
  150. package/data/llms/styled/add-ons/uikit/overview.md +204 -0
  151. package/data/llms/styled/components/button/api.json +8 -8
  152. package/data/llms/styled/components/carousel.md +65 -0
  153. package/data/llms/styled/components/datatable.md +101 -88
  154. package/data/llms/styled/components/floatlabel/api.json +3 -3
  155. package/data/llms/styled/components/fluid/api.json +3 -3
  156. package/data/llms/styled/components/iconfield/api.json +7 -7
  157. package/data/llms/styled/components/iftalabel/api.json +3 -3
  158. package/data/llms/styled/components/inputcolor.md +3 -0
  159. package/data/llms/styled/components/inputgroup/api.json +7 -7
  160. package/data/llms/styled/components/label/api.json +3 -3
  161. package/data/llms/styled/components/menu.md +39 -41
  162. package/data/llms/styled/components/organizationchart/api.json +33 -33
  163. package/data/llms/styled/components/rating/api.json +11 -11
  164. package/data/llms/styled/components/select.md +6 -0
  165. package/data/llms/styled/components/sidebar.md +12 -8
  166. package/data/llms/styled/components/tree.md +5 -0
  167. package/data/llms/styled/components/treetable.md +171 -62
  168. package/data/llms/styled/guides/configuration.md +223 -0
  169. package/data/llms/styled/guides/form/formik.md +448 -0
  170. package/data/llms/styled/guides/form/react-hook-form.md +503 -0
  171. package/data/llms/styled/guides/form/tanstack.md +502 -0
  172. package/data/llms/styled/guides/migration/updating-to-v11.md +2219 -0
  173. package/data/llms/styled/guides/misc/internationalization.md +379 -0
  174. package/data/llms/styled/guides/theming/tailwind.md +25 -0
  175. package/data/llms/tailwind/components/button/api.json +8 -8
  176. package/data/llms/tailwind/components/datatable.md +33 -42
  177. package/data/llms/tailwind/components/inputgroup.md +0 -1
  178. package/data/llms/tailwind/components/menu.md +5 -5
  179. package/data/llms/tailwind/components/select.md +3 -0
  180. package/data/llms/tailwind/components/sidebar.md +16 -11
  181. package/data/llms/tailwind/components/tooltip.md +4 -13
  182. package/data/llms/tailwind/guides/misc/internationalization.md +287 -0
  183. package/data/manifest.json +1089 -779
  184. package/data/mcp-data.json +263 -32
  185. package/dist/index.d.ts +7 -2
  186. package/dist/index.js +1 -1
  187. package/package.json +9 -8
  188. package/data/llms/styled/guides/installation/configuration.md +0 -135
  189. package/data/llms/tailwind/guides/theming/guide.md +0 -179
@@ -0,0 +1,287 @@
1
+ # Internationalization and Localization
2
+
3
+ Translating component messages and configuring regional settings such as date formats and the first day of the week.
4
+
5
+ ## Overview
6
+
7
+ Components ship with a set of built-in messages such as filter operator labels, month names and ARIA descriptions. These messages live in a locale registry that is shared across PrimeReact, PrimeVue and PrimeNG through the `@primeuix/locale` package, and are re-exported from `@primereact/core/locale`.
8
+
9
+ English is registered by default, so no configuration is required until another language is needed.
10
+
11
+ Setting a language is enough for components to pick it up. No per-component prop is involved. A DatePicker then renders its month and day names in that language, with the first day of the week adjusted to match.
12
+
13
+ ```jsx
14
+ import { PrimeReactProvider } from '@primereact/core';
15
+ import { de } from 'primelocale/js/de.js';
16
+
17
+ <PrimeReactProvider locale="de" locales={{ de }}>
18
+ <App />
19
+ </PrimeReactProvider>;
20
+ ```
21
+
22
+ ## Import
23
+
24
+ ```js
25
+ import { $t, $l, defineLocale, updateLocale, useLocale, Locale, LocaleService, en } from '@primereact/core/locale';
26
+ ```
27
+
28
+ ## Setting the Language
29
+
30
+ `Locale.use` selects the active language. Every component reading a message re-renders when it changes, so this works both at startup and later in response to a language switcher.
31
+
32
+ ```js
33
+ import { Locale } from '@primereact/core/locale';
34
+
35
+ Locale.use('de');
36
+ ```
37
+
38
+ Only `en` is built in, so any other language has to be registered first. See [Adding a Language](#adding-a-language) below.
39
+
40
+ `PrimeReactProvider` also accepts a `locale` prop, which sets the initial language for the components beneath it.
41
+
42
+ ```jsx
43
+ import { PrimeReactProvider } from '@primereact/core';
44
+
45
+ <PrimeReactProvider locale="de">
46
+ <App />
47
+ </PrimeReactProvider>;
48
+ ```
49
+
50
+ ## Adding a Language
51
+
52
+ `defineLocale` registers a new language.
53
+
54
+ ```js
55
+ import { defineLocale, Locale } from '@primereact/core/locale';
56
+
57
+ defineLocale('es', {
58
+ clear: 'Limpiar',
59
+ apply: 'Aplicar',
60
+ accept: 'Sí',
61
+ reject: 'No',
62
+ dayNames: ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'],
63
+ dayNamesShort: ['dom', 'lun', 'mar', 'mié', 'jue', 'vie', 'sáb'],
64
+ dayNamesMin: ['D', 'L', 'M', 'X', 'J', 'V', 'S'],
65
+ monthNames: ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'],
66
+ monthNamesShort: ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic']
67
+ });
68
+
69
+ Locale.use('es');
70
+ ```
71
+
72
+ A registered language must be complete. Keys that are left out resolve to `undefined` rather than falling back to English, which renders as an empty label. The practical approach is to spread the built-in English messages and override from there:
73
+
74
+ ```js
75
+ import { defineLocale, en } from '@primereact/core/locale';
76
+
77
+ defineLocale('es', {
78
+ ...en,
79
+ clear: 'Limpiar',
80
+ apply: 'Aplicar'
81
+ });
82
+ ```
83
+
84
+ The `en` object holds the built-in English messages and is exported for exactly this purpose. Ready-made translations from [PrimeLocale](#ready-made-translations) already cover every key, so spreading is only needed for hand-written translations.
85
+
86
+ The provider accepts a `locales` map, which registers languages and selects one in a single step. Anything listed here is registered before `locale` is applied.
87
+
88
+ ```jsx
89
+ import { PrimeReactProvider } from '@primereact/core';
90
+
91
+ <PrimeReactProvider locale="es" locales={{ es: spanishMessages }}>
92
+ <App />
93
+ </PrimeReactProvider>;
94
+ ```
95
+
96
+ ## Updating an Existing Language
97
+
98
+ `updateLocale` merges new values into a language that is already registered, leaving the remaining keys untouched. It is useful for overriding a handful of labels without redefining a full translation.
99
+
100
+ ```js
101
+ import { updateLocale } from '@primereact/core/locale';
102
+
103
+ updateLocale('en', {
104
+ clear: 'Reset',
105
+ apply: 'Confirm'
106
+ });
107
+ ```
108
+
109
+ If the language does not exist yet, `updateLocale` registers it, behaving like `defineLocale`.
110
+
111
+ ## Reading Messages
112
+
113
+ ### In Components
114
+
115
+ `useLocale` is the React hook for reading the active locale. It re-renders the calling component when the language changes.
116
+
117
+ ```jsx
118
+ import { Button } from 'primereact/button';
119
+ import { useLocale } from '@primereact/core/locale';
120
+
121
+ function ClearFilterButton({ onClear }) {
122
+ const { t } = useLocale();
123
+
124
+ return (
125
+ <Button severity="secondary" onClick={onClear}>
126
+ {t('clear')}
127
+ </Button>
128
+ );
129
+ }
130
+ ```
131
+
132
+ | Field | Description |
133
+ | ---------- | --------------------------------------------- |
134
+ | `lang` | Active language code, such as `en` or `de`. |
135
+ | `messages` | Full message object of the active language. |
136
+ | `t` | Translates a key against the active language. |
137
+
138
+ Re-rendering on a language change relies on the context published by `PrimeReactProvider`, which applications normally have at their root. A component rendered outside any provider still reads the correct messages on first render, but will not update when the language changes later.
139
+
140
+ ### Outside Components
141
+
142
+ `$t` performs the same lookup without a React context, which suits utilities, event handlers and module-level code.
143
+
144
+ ```js
145
+ import { $t } from '@primereact/core/locale';
146
+
147
+ $t('clear'); // 'Clear'
148
+ ```
149
+
150
+ Nested keys use dot notation.
151
+
152
+ ```js
153
+ $t('aria.selectRow'); // 'Row Selected'
154
+ ```
155
+
156
+ Messages containing placeholders accept replacement values. Positional placeholders such as `{0}` are filled from the argument order, while named ones are filled from an object.
157
+
158
+ ```js
159
+ $t('searchMessage', 5); // '5 results are available'
160
+ $t('selectionMessage', 3); // '3 items selected'
161
+ $t('aria.stars', { star: 4 }); // '4 stars'
162
+ ```
163
+
164
+ ## Reacting to Language Changes
165
+
166
+ Language changes emit a `locale:change` event. Components handle this automatically through `useLocale`; the event is only needed for code living outside React, such as syncing a third-party library.
167
+
168
+ ```js
169
+ import { LocaleService } from '@primereact/core/locale';
170
+
171
+ const onChange = ({ lang }) => console.log('Language is now', lang);
172
+
173
+ LocaleService.on('locale:change', onChange);
174
+
175
+ // remove the listener when it is no longer needed
176
+ LocaleService.off('locale:change', onChange);
177
+ ```
178
+
179
+ ## Inspecting the Registry
180
+
181
+ `$l` returns a facade over the registry, which helps when building a language switcher.
182
+
183
+ ```js
184
+ import { $l } from '@primereact/core/locale';
185
+
186
+ $l().langs; // ['en', 'es']
187
+ $l().get('es'); // message object of the Spanish locale
188
+ ```
189
+
190
+ ## Message Keys
191
+
192
+ These components read their labels from the active language:
193
+
194
+ | Component | Keys |
195
+ | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
196
+ | DatePicker | `dayNames`, `dayNamesShort`, `dayNamesMin`, `monthNames`, `monthNamesShort`, `today`, `weekHeader`, `clear`, `am`, `pm`, `firstDayOfWeek`, `dateFormat` |
197
+ | FileUpload | `fileSizeTypes` |
198
+ | Paginator | `aria.firstPageLabel`, `aria.prevPageLabel`, `aria.nextPageLabel`, `aria.lastPageLabel`, `aria.pageLabel` |
199
+ | Sidebar | `aria.toggleSidebar` |
200
+
201
+ The registry holds a larger set covering filter operators, password strength labels, empty-state messages and the remaining `aria` labels. Those are reserved for components that do not consume them yet, so translating them has no visible effect today.
202
+
203
+ Not every entry is a string. `firstDayOfWeek` is a number, `showMonthAfterYear` is a boolean, and `dayNames`, `monthNames` and `fileSizeTypes` are arrays. `searchMessage` and similar entries carry a `{0}` placeholder.
204
+
205
+ The full set with default English values is exported as `en`, which can also be inspected at runtime:
206
+
207
+ ```js
208
+ import { en } from '@primereact/core/locale';
209
+
210
+ Object.keys(en); // every top-level key
211
+ ```
212
+
213
+ ## Ready-Made Translations
214
+
215
+ Writing a translation from scratch is rarely necessary. The community maintained [PrimeLocale](https://github.com/primefaces/primelocale) repository publishes complete translations for 70+ languages, shared across all Prime libraries. Each file covers every built-in message key, so nothing is left resolving to `undefined`.
216
+
217
+ ### Copying a File
218
+
219
+ Grab the JSON file for the desired language from the repository, for example `es.json`, and place it in the project.
220
+
221
+ Each file wraps its messages in a single key named after the language:
222
+
223
+ ```json
224
+ {
225
+ "es": {
226
+ "clear": "Limpiar",
227
+ "apply": "Aplicar",
228
+ "aria": { "selectRow": "Seleccionar fila" }
229
+ }
230
+ }
231
+ ```
232
+
233
+ That wrapper has to be unwrapped before registering, otherwise every lookup resolves to `undefined`:
234
+
235
+ ```js
236
+ import { defineLocale, Locale } from '@primereact/core/locale';
237
+ import es from './locales/es.json';
238
+
239
+ defineLocale('es', es.es);
240
+ Locale.use('es');
241
+ ```
242
+
243
+ The same unwrapping applies when the language is registered through the provider:
244
+
245
+ ```jsx
246
+ import { PrimeReactProvider } from '@primereact/core';
247
+ import es from './locales/es.json';
248
+
249
+ <PrimeReactProvider locale="es" locales={{ es: es.es }}>
250
+ <App />
251
+ </PrimeReactProvider>;
252
+ ```
253
+
254
+ ### Installing the Package
255
+
256
+ The translations are also published to npm, which avoids maintaining copies by hand.
257
+
258
+ ```bash
259
+ npm install primelocale
260
+ ```
261
+
262
+ ```js
263
+ import { defineLocale, Locale } from '@primereact/core/locale';
264
+ import { es } from 'primelocale/js/es.js';
265
+
266
+ defineLocale('es', es);
267
+ Locale.use('es');
268
+ ```
269
+
270
+ The package entry points export the messages directly, so no unwrapping is needed there.
271
+
272
+ Regional variants are named with an underscore in the package and a hyphen in the JSON files. Brazilian Portuguese is `primelocale/js/pt_BR.js` when imported and `pt-BR.json` when copied.
273
+
274
+ ### Adjusting a Translation
275
+
276
+ A ready-made translation can be tuned without editing the file, by layering overrides on top of it:
277
+
278
+ ```js
279
+ defineLocale('es', es.es);
280
+ updateLocale('es', { clear: 'Borrar' });
281
+ ```
282
+
283
+ Contributions of new languages and corrections are welcome in the PrimeLocale repository, and benefit every Prime library at once.
284
+
285
+ ## Coming from v10
286
+
287
+ The locale helpers from `primereact/api` were replaced. The [migration guide](/docs/primitive/guides/migration/updating-to-v11) maps each one to its replacement.
@@ -0,0 +1,273 @@
1
+ # Figma to Theme Code CI Pipeline
2
+
3
+ Automate the conversion of Figma design tokens to theme code using CI pipelines and the theme designer API.
4
+
5
+ > **UI Kit v4 Users:** You may ignore this documentation and use the [PrimeUI Theme Generator](https://www.figma.com/community/plugin/1592914021886732603/primeui-theme-generator) Figma plugin instead, which provides built-in synchronization capabilities that automate the theme generation process.
6
+ >
7
+ > **UI Kit v3 Users:** Follow the CI pipeline configuration below to integrate with Figma via the Tokens Studio plugin.
8
+
9
+ ## Overview
10
+
11
+ The Figma UI Kit and the theming api is fully synchronized, meaning the design tokens in Figma map to the corresponding properties in a theme preset. The Theme Designer offers a feature to create a theme by uploading a tokens.json file that is exported from the Tokens Studio plugin in Figma. Once the theme is converted, it can either be edited further in the visual editor or downloaded as a zip file to access the full code. Visit the [Figma](/docs/styled/add-ons/designer/guide#figma) section at the designer documentation for more information.
12
+
13
+ Manually exporting the tokens file from Figma and uploading it to the online designer tool may quickly become tedious in active development cycles. As a solution, theme designer provides a remote API that can be integrated into your CI pipeline.
14
+
15
+ ![Theme Designer CI](https://fqjltiegiezfetthbags.supabase.co/storage/v1/object/public/common.images/designer/themedesigner-ci.jpg)
16
+
17
+ ## Video Tutorial
18
+
19
+ Before diving into the implementation details, if you would like to understand the final outcome and see how the solution operates, please refer to the [video tutorial](https://www.youtube.com/watch?v=ksNPUrCYcto) for a comprehensive walkthrough and demonstration.
20
+
21
+ ## Designer API
22
+
23
+ Theme Designer public endpoint is hosted at PrimeUI Store.
24
+
25
+ ```text
26
+ https://primeui.store/api/designer/integration/theme/create
27
+ ```
28
+
29
+ ### Get a Secret Key
30
+
31
+ 1. Visit the [PrimeUI Store](https://primeui.store/designer).
32
+ 2. Purchase an Extended License of Theme Designer.
33
+ 3. Navigate to your [account settings](https://primeui.store/user/designer).
34
+ 4. Generate a secret key for CI/CD integration.
35
+
36
+ ### Authentication
37
+
38
+ Define an _Authorization: Bearer_ request header to configure your secret key.
39
+
40
+ ### Parameters
41
+
42
+ The request type must be _POST_.
43
+
44
+ | Name | Type | Required | Description |
45
+ | -------------------- | ------ | -------- | ----------------------------------------------------------------------------------- |
46
+ | `name` | string | yes | Name of the theme to be generated. |
47
+ | `tokens` | json | yes | Content of the json file exported from Figma. |
48
+ | `project` | string | yes | Name of the project, possible values are "primereact", "primeng" or "primevue". |
49
+ | `config.font_size` | string | no | Font size for theme preview in visual editor at website, defaults to "14px". |
50
+ | `config.font_family` | string | no | Font family for theme preview in visual editor at website, defaults to "Inter Var". |
51
+
52
+ ### Example
53
+
54
+ ```ts
55
+ const response = await fetch('https://primeui.store/api/designer/integration/theme/create', {
56
+ method: 'POST',
57
+ headers: {
58
+ 'Content-Type': 'application/json',
59
+ Accept: 'application/json, application/zip',
60
+ Authorization: `Bearer ${designer_secret_key}`
61
+ },
62
+ body: JSON.stringify({
63
+ name: 'acme-theme',
64
+ project: 'primereact',
65
+ tokens: tokensJson // JSON data
66
+ })
67
+ });
68
+ ```
69
+
70
+ ### Response
71
+
72
+ A successful response returns a zip file containing the source code of the generated theme preset. The content-type header of this type of response is _application/zip_.
73
+
74
+ ### Error Handling
75
+
76
+ When theme generation fails, a json response is returned with _application/json_ content-type header. The response contains an error object with _code_ and _message_.
77
+
78
+ ```json
79
+ {
80
+ "error": {
81
+ "code": "download_failed",
82
+ "message": "Failed to create archive."
83
+ }
84
+ }
85
+ ```
86
+
87
+ ## Figma
88
+
89
+ Tokens Studio in Figma is the starting point of a continuous integration pipeline. You can connect a remote repository to sync your tokens data so that changes are saved remotely instead of locally. Tokens Studio offers various remote storage options such as [GitHub](https://docs.tokens.studio/token-storage/remote/sync-git-github), [GitLab](https://docs.tokens.studio/token-storage/remote/sync-git-gitlab) and [Bitbucket](https://docs.tokens.studio/token-storage/remote/sync-git-bitbucket). Refer to these documentations based on your environment before proceeding to the integrations in the next section.
90
+
91
+ ## Integration
92
+
93
+ Once the Tokens Studio Sync Provider is running and you have obtained a Secret Key for the Designer API, you can connect your repository to the Theme Designer API to automatically generate themes whenever the tokens file changes via your CI pipeline. For GitHub, PrimeTek provides an official GitHub Action available on the GitHub Marketplace, while for GitLab and Bitbucket, sample implementations are provided as references for building your own integration.
94
+
95
+ ### GitHub
96
+
97
+ The [prime-figma-to-theme-code-generator](https://github.com/marketplace/actions/prime-figma-to-theme-code-generator) is a GitHub Action that is available on the marketplace.
98
+
99
+ #### 1. Add Secret Key to Repository Secrets
100
+
101
+ - Go to your GitHub repository.
102
+ - Navigate to **Settings > Secrets and variables > Actions**.
103
+ - Click **New repository secret**.
104
+ - Give a name such as: _THEME_DESIGNER_SECRET_KEY_.
105
+ - Value: Your API key from Prime Theme Designer.
106
+ - Click **Add secret**.
107
+
108
+ #### 2. Add the action to your `.github/workflows`
109
+
110
+ Visit the [inputs](https://github.com/marketplace/actions/prime-figma-to-theme-code-generator#-inputs) documentation for more details about the parameters such as the _theme-name_.
111
+
112
+ ```yaml
113
+ name: Automated Figma To Theme Code
114
+
115
+ on:
116
+ push:
117
+ paths:
118
+ - 'tokens.json'
119
+
120
+ permissions:
121
+ contents: write
122
+
123
+ jobs:
124
+ generate-tokens:
125
+ name: Generate Theme Code
126
+ runs-on: ubuntu-latest
127
+ steps:
128
+ - name: Checkout repository
129
+ uses: actions/checkout@v3
130
+
131
+ - name: Generate Prime Theme
132
+ uses: primefaces/theme-designer-ci@1.0.0-beta.4
133
+ with:
134
+ designer-secret: ${{ secrets.THEME_DESIGNER_SECRET_KEY }}
135
+ theme-name: 'acme'
136
+ project: 'primereact'
137
+ font-size: '14px'
138
+ font-family: 'Inter Var'
139
+ tokens-path: 'tokens.json'
140
+ output-dir: './acme-theme'
141
+ ```
142
+
143
+ #### 3. Test Integration
144
+
145
+ Edit a token in Tokens Studio in Figma and click **Push to GitHub** button to update the tokens file in your Git repository, triggering the configured GitHub Action. The GitHub Action then sends the updated file content to the Theme Designer API, receives the generated theme code, and commits the resulting changes back to your repository. An [example repository](https://github.com/primefaces/theme-designer-ci-test) is available at GitHub that you may use as a starter.
146
+
147
+ ### GitLab
148
+
149
+ The GitLab integration is implemented by executing a script whenever the tokens file changes.
150
+
151
+ #### 1. Add Secret Key to Repository Secrets
152
+
153
+ - Go to your GitLab repository.
154
+ - Navigate to **Settings > CI/CD > Variables**.
155
+ - Click **Add variable**.
156
+ - Give a name such as: _THEME_DESIGNER_SECRET_KEY_.
157
+ - Value: Your API key from Prime Theme Designer.
158
+ - Click **Add variable**.
159
+
160
+ #### 2. Add the script to your project
161
+
162
+ A sample script named [figma-to-theme-converter.sh](https://gitlab.com/cagataycivici/theme-designer-ci-test/-/blob/main/figma-to-theme-converter.sh?ref_type=heads) is available as a starter, copy and paste this script to your project. You may alter the script further per your requirements.
163
+
164
+ #### 3. Add the script to your `.gitlab-ci.yml`
165
+
166
+ Define the configuration parameters for the Designer API and add the script to the action.
167
+
168
+ ```yaml
169
+ variables:
170
+ # Set these as GitLab CI/CD variables for security
171
+ DESIGNER_SECRET: ${THEME_DESIGNER_SECRET_KEY}
172
+ THEME_NAME: 'my-custom-theme'
173
+ PROJECT: 'primereact' # or your target project
174
+ TOKENS_PATH: './tokens.json'
175
+ OUTPUT_DIR: './my-custom-theme'
176
+ # Optional configuration
177
+ FONT_SIZE: '14px'
178
+ FONT_FAMILY: 'Inter'
179
+
180
+ stages:
181
+ - generate-theme
182
+
183
+ generate_theme_tokens:
184
+ stage: generate-theme
185
+ image: ubuntu:22.04
186
+
187
+ before_script:
188
+ # Install required dependencies
189
+ - apt-get update -qq
190
+ - apt-get install -y -qq git curl python3 unzip
191
+ - git config --global --add safe.directory $CI_PROJECT_DIR
192
+ # Ensure we're on the correct branch and have latest changes
193
+ - git fetch origin
194
+ - git checkout $CI_COMMIT_REF_NAME
195
+ - git pull origin $CI_COMMIT_REF_NAME || true
196
+
197
+ script:
198
+ # Run the theme generator script
199
+ - ./figma-to-theme-converter.sh
200
+
201
+ artifacts:
202
+ paths:
203
+ - $OUTPUT_DIR/
204
+ expire_in: 1 week
205
+
206
+ rules:
207
+ # Run on main branch when tokens.json is modified
208
+ - if: $CI_COMMIT_BRANCH == "main"
209
+ changes:
210
+ - tokens.json
211
+ # Or run manually
212
+ - when: manual
213
+ ```
214
+
215
+ #### 4. Test Integration
216
+
217
+ Edit a token in Tokens Studio in Figma and click **Push to GitLab** button to update the tokens file in your Git repository, triggering the configured GitLab Action. The GitLab Action then sends the updated file content to the Theme Designer API, receives the generated theme code, and commits the resulting changes back to your repository. An [example repository](https://gitlab.com/cagataycivici/theme-designer-ci-test) is available at GitLab that you may use as a starter.
218
+
219
+ ### Bitbucket
220
+
221
+ The BitBucket integration is implemented by executing a custom pipe whenever the tokens file changes.
222
+
223
+ #### 1. Add Secret Key to Repository Secrets
224
+
225
+ - Go to your BitBucket repository.
226
+ - Navigate to **Repository Settings > Repository Variables**.
227
+ - Give a name such as: _THEME_DESIGNER_SECRET_KEY_.
228
+ - Value: Your API key from Prime Theme Designer.
229
+ - Click **Add**.
230
+
231
+ #### 2. Add the pipe configuration to your `bitbucket-pipelines.yml`
232
+
233
+ Define the configuration parameters for the Designer API and add the pipe as a runnable script to the action. Notice that, the referenced [pipe](https://bitbucket.org/cagataycivici/figma-to-theme-code-generator/src/main/) is executed as a script rather than a pipe from the BitBucket pipe registry as PrimeTek currently has no intentions to maintain an official pipe for BitBucket. You may further improve this example by building a dockerized pipe that is accessible in the BitBucket Registry to refer it with the _pipe_ config in yml.
234
+
235
+ ```yaml
236
+ image: atlassian/default-image:4
237
+
238
+ pipelines:
239
+ default:
240
+ - step:
241
+ name: Generate Theme with Theme Designer
242
+ condition:
243
+ changesets:
244
+ includePaths:
245
+ - 'tokens.json'
246
+ script:
247
+ - apt-get update && apt-get install -y jq curl unzip
248
+ - git clone https://bitbucket.org/cagataycivici/figma-to-theme-code-generator.git temp-pipe
249
+ - cp temp-pipe/pipe.sh ./
250
+ - chmod +x pipe.sh
251
+ - export DESIGNER_SECRET="${THEME_DESIGNER_SECRET_KEY}"
252
+ - export THEME_NAME="acme-theme"
253
+ - export PROJECT="primereact"
254
+ - export FONT_SIZE="14px"
255
+ - export FONT_FAMILY="Inter Var"
256
+ - export TOKENS_PATH="./tokens.json"
257
+ - export OUTPUT_DIR="./acme-theme"
258
+ - ./pipe.sh
259
+ ```
260
+
261
+ #### 3. Test Integration
262
+
263
+ Edit a token in Tokens Studio in Figma and click **Push to BitBucket** button to update the tokens file in your Git repository, triggering the configured BitBucket Pipe. The pipe then sends the updated file content to the Theme Designer API, receives the generated theme code, and commits the resulting changes back to your repository. An [example repository](https://bitbucket.org/cagataycivici/theme-designer-ci-test) is available at BitBucket that you may use as a starter.
264
+
265
+ ## Live Preview
266
+
267
+ After your CI pipeline completes successfully, your theme also becomes available in the Prime UI Theme Designer.
268
+
269
+ - Navigate to the Prime UI library website.
270
+ - Click the ⚙️ icon at topbar to open up Designer Editor.
271
+ - Sign in with your license key and pass key credentials.
272
+ - Then select your theme from the available options to apply it across all demos and website content.
273
+ - Note that CI-generated themes are provided in read-only mode for preview purposes only and cannot be edited within the Theme Designer. The Migration Assistant is available to identify any missing tokens in your preset; however, if tokens are missing, they must be added manually in Figma as needed.
@@ -0,0 +1,99 @@
1
+ # Designer
2
+
3
+ Theme Designer is the ultimate tool to customize and design your own themes featuring a visual editor, Figma to theme code, cloud storage, and migration assistant.
4
+
5
+ ## Overview
6
+
7
+ The [theming api](/docs/styled/guides/theming/styled) is open source and freely available with an extensive documentation. Theme Designer is a tool built on top of this theming api with important features to make theming easier. Designer consists of 4 key features; the **visual editor** provides a UI to edit the complete set of tokens. The **Figma to theme code** generator is extremely useful to automate the design to code process and integrates seamlessly with the Figma UI Kit. The themes are saved in the **cloud storage** to be accessible from anywhere and any device and finally the **migration assistant** automatically updates your themes to the latest library version.
8
+
9
+ ## License
10
+
11
+ A license key is required to be able to use all the services provided by the designer. Without a license, the visual editor is still available for trial purposes with various options such as downloads, and cloud storage disabled. The license key can be purchased at [PrimeStore](https://primeui.store/designer), it is valid for 1 year and needs to be renewed manually after a year.
12
+
13
+ ## Dashboard
14
+
15
+ Dashboard is the entry point of the designer. The license key can be configured at this view before getting started with the full set of features. In the **My Themes** section, you're able to create a theme, and manage existing themes. A theme can be renamed, duplicated and downloaded using the more options (⋯) button.
16
+
17
+ ![Designer Dashboard](https://fqjltiegiezfetthbags.supabase.co/storage/v1/object/public/common.images/designer/guide-dashboard.png)
18
+
19
+ ## Create Theme
20
+
21
+ A theme can be initiated from one of the built-in themes or from Figma UI Kit.
22
+
23
+ ### Base
24
+
25
+ In the new theme section, all of the built-in themes are available to use as the base. These are; _Aura_, _Material_, _Lara_ and _Nora_. Each have their own characteristics, and it is recommended to choose the one that best suits your requirements.
26
+
27
+ ### Figma
28
+
29
+ For teams with UI designers, we recommend using PrimeOne Figma UI Kit for the design phase and utilizing the Theme Designer service to automate code generation during handoff. This workflow eliminates manual design-to-code translation, reducing implementation time and ensuring consistency between design and production.
30
+
31
+ #### UI Kit v4
32
+
33
+ **Automated Flow**
34
+
35
+ Recommended approach is using the PrimeUI Theme Generator Figma plugin which provides built-in synchronization capabilities that automate the theme generation process. Visit [the plugin website](https://www.figma.com/community/plugin/1592914021886732603/primeui-theme-generator) to learn more about this workflow.
36
+
37
+ **Manual Flow**
38
+
39
+ Instead of generating themes directly from Figma using the plugin, for quick prototyping purposes, you may also choose to manually export a tokens json file and then upload it to the Theme Designer. Note that, this flow would get tedious and repetitive in active development cycles when compared to an automated flow.
40
+
41
+ Open the [PrimeOne UI Kit](/docs/styled/add-ons/uikit/overview) in which you've modified tokens. In the PrimeUI Theme Generator plugin, click the _Export_ option to export all variable collections.
42
+
43
+ ![Figma Plugin Export](https://fqjltiegiezfetthbags.supabase.co/storage/v1/object/public/common.images/designer/figma-plugin.png)
44
+
45
+ When creating a new theme at Theme Designer, choose the _Import Figma Variables_ option and import the json file.
46
+
47
+ ![Create Theme from Figma](https://fqjltiegiezfetthbags.supabase.co/storage/v1/object/public/common.images/designer/guide-create.png)
48
+
49
+ #### UI Kit v3 (Deprecated)
50
+
51
+ **CI Pipeline**
52
+
53
+ Recommended approach is setting up the CI Pipeline flow as manually exporting the tokens file from Figma and uploading it to the online designer tool may quickly become tedious in active development cycles. As a solution, theme designer provides a remote API that can be integrated into your flow. Visit the [CI Pipeline](/docs/styled/add-ons/designer/ci) documentation for comprehensive information and examples for GitHub, GitLab and BitBucket.
54
+
55
+ **Manual Flow**
56
+
57
+ Instead of setting a CI pipeline, for quick prototyping purposes, you may also choose to manually export a tokens json file and then upload it to the designer. Note that, this flow would get tedious and repetitive in active development cycles when compared to an automated CI pipeline.
58
+
59
+ Open the PrimeOne UI Kit in which you've modified tokens. In the Tokens Studio plugin, navigate to the _Tools_ menu and select _Export to file/folder._ When the Export tokens modal appears, make sure the _Single file_ tab is selected. Check the _All tokens sets_ option, then click _Export_.
60
+
61
+ In case you utilize custom tokens, create a new token set named _custom_ and define your tokens under this set to make sure they are also exported to the theme code.
62
+
63
+ ![Tokens Studio export](https://primefaces.org/cdn/designer/tokens-studio.png)
64
+
65
+ When creating a new theme at Theme Designer, choose the _Import Figma Variables_ option and import the json file.
66
+
67
+ ## Editor
68
+
69
+ ### Token Collections
70
+
71
+ The theming architecture is based on primitive, semantic and components tokens. The visual editor, displays a dedicated section for each collection. For basic purposes such as customizing the primary and surface colors, primitive and semantic sections would be more than enough. The component tokens are displayed per route so navigate to the component page first to view the tokens of the specific component.
72
+
73
+ ### Custom Tokens
74
+
75
+ Custom tokens allow bringing in your own design tokens to the theme to go beyond the built-in ones. A design token requires a name and a value where the value can be a static value like a color or another token. The name of the token should be a dot separated lowercase value e.g. `accent.color`. For example, a custom token name can be defined as `accent.color` and the value can either be a value like `#eab308` or another token such as `{yellow.50}`. Custom tokens can also refer to each other, e.g. `selection.background` custom token can define `{accent.color}` as a value.
76
+
77
+ If you have created a theme from Figma, use the name **custom** as the name of your token set group. This keyword is special since the import tool will populate the custom tokens using this set in tokens json file.
78
+
79
+ ### Intelligent Completion
80
+
81
+ The editor is packed with features for improved user experience. The input fields in the editor are capable of displaying a color preview when the value is a color, and beginning the value with a curly brace (`{`) opens up the autocompletion feature to list the available tokens to choose from. The _pi-sort-alt_ symbol over the input, transfers the token between the common tokens and color scheme specific tokens so that you are able to define tokens based on light and dark mode as well.
82
+
83
+ ![Editor Intelligent Completion](https://fqjltiegiezfetthbags.supabase.co/storage/v1/object/public/common.images/designer/guide-editor.png)
84
+
85
+ ### Typography
86
+
87
+ The components are not opinionated about the typography. Important properties such as the font family, font size, and line-height do not have design tokens since they can be inherited from the document. For preview purposes, the _settings_ tab displays options to customize the base font and the font family of the document. These values are not available in the generated theme and need to be applied to your application at the document level.
88
+
89
+ ## Migration Assistant
90
+
91
+ Prime UI libraries continue to evolve with each version. New tokens are likely to be added with each major release, in order to keep your themes up to date the migration assistant is available featuring automated migration. The **Check for Updates** option initially scans a theme for any missing tokens. This tool does not override the values of existing tokens, and only adds missing tokens if necessary. Still, it is recommended to duplicate your theme as a backup and run a preview before the migration. Depending on the result, you may choose to proceed with the migration process. In case there are missing tokens, your theme would receive them with placeholder values so it is recommended to take a note of them before migration and then visit the components to replace the placeholder values with actual values of your choice. These types of newly added tokens would be highlighted in Editor.
92
+
93
+ ![Migration Assistant](https://fqjltiegiezfetthbags.supabase.co/storage/v1/object/public/common.images/designer/guide-migration.png)
94
+
95
+ ## Limitations
96
+
97
+ Current known technical limitations are listed at this section.
98
+
99
+ - The border width token in Figma does not support multiple values, related [issue](https://github.com/tokens-studio/figma-plugin/issues/3237).