@kilivi/payloadcms-theme-management 0.3.1 → 0.3.3
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/dist/fields/ColorPickerField.js +1 -1
- package/dist/fields/ColorPickerField.js.map +1 -1
- package/dist/fields/ThemeTokenSelectField.d.ts.map +1 -1
- package/dist/fields/ThemeTokenSelectField.js +1 -1
- package/dist/fields/ThemeTokenSelectField.js.map +1 -1
- package/dist/fields/themeConfigurationField.d.ts +3 -2
- package/dist/fields/themeConfigurationField.d.ts.map +1 -1
- package/dist/fields/themeConfigurationField.js +236 -274
- package/dist/fields/themeConfigurationField.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/fields/ExtendedThemeAutoPopulateField.d.ts +0 -12
- package/dist/fields/ExtendedThemeAutoPopulateField.d.ts.map +0 -1
- package/dist/fields/ExtendedThemeAutoPopulateField.js +0 -176
- package/dist/fields/ExtendedThemeAutoPopulateField.js.map +0 -1
- package/dist/fields/RadiusField.d.ts +0 -3
- package/dist/fields/RadiusField.d.ts.map +0 -1
- package/dist/fields/RadiusField.js +0 -174
- package/dist/fields/RadiusField.js.map +0 -1
- package/dist/fields/ThemeLivePreview.css +0 -190
- package/dist/fields/ThemeLivePreview.d.ts +0 -3
- package/dist/fields/ThemeLivePreview.d.ts.map +0 -1
- package/dist/fields/ThemeLivePreview.js +0 -195
- package/dist/fields/ThemeLivePreview.js.map +0 -1
- package/dist/fields/VISUAL_EXAMPLES.d.ts +0 -153
- package/dist/fields/VISUAL_EXAMPLES.d.ts.map +0 -1
- package/dist/fields/VISUAL_EXAMPLES.js +0 -148
- package/dist/fields/VISUAL_EXAMPLES.js.map +0 -1
- package/dist/fields/extendedThemeFields.d.ts +0 -139
- package/dist/fields/extendedThemeFields.d.ts.map +0 -1
- package/dist/fields/extendedThemeFields.js +0 -489
- package/dist/fields/extendedThemeFields.js.map +0 -1
- package/dist/views/ThemePreviewLoader.d.ts +0 -7
- package/dist/views/ThemePreviewLoader.d.ts.map +0 -1
- package/dist/views/ThemePreviewLoader.js +0 -43
- package/dist/views/ThemePreviewLoader.js.map +0 -1
- package/dist/views/ThemePreviewView.d.ts +0 -10
- package/dist/views/ThemePreviewView.d.ts.map +0 -1
- package/dist/views/ThemePreviewView.js +0 -43
- package/dist/views/ThemePreviewView.js.map +0 -1
- package/dist/views/ThemePreviewViewClient.d.ts +0 -7
- package/dist/views/ThemePreviewViewClient.d.ts.map +0 -1
- package/dist/views/ThemePreviewViewClient.js +0 -12
- package/dist/views/ThemePreviewViewClient.js.map +0 -1
|
@@ -35,6 +35,104 @@ import { darkModeField, lightModeField } from './colorModeFields.js';
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
];
|
|
38
|
+
// Border Radius Configuration - Always visible
|
|
39
|
+
fields.push({
|
|
40
|
+
type: 'row',
|
|
41
|
+
fields: [
|
|
42
|
+
{
|
|
43
|
+
name: 'borderRadius',
|
|
44
|
+
type: 'select',
|
|
45
|
+
label: {
|
|
46
|
+
en: '📐 Border Radius',
|
|
47
|
+
cs: '📐 Zaoblení rohů'
|
|
48
|
+
},
|
|
49
|
+
defaultValue: 'medium',
|
|
50
|
+
options: [
|
|
51
|
+
{
|
|
52
|
+
label: {
|
|
53
|
+
en: 'None (0px)',
|
|
54
|
+
cs: 'Žádné (0px)'
|
|
55
|
+
},
|
|
56
|
+
value: 'none'
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: {
|
|
60
|
+
en: 'Small (0.25rem)',
|
|
61
|
+
cs: 'Malé (0.25rem)'
|
|
62
|
+
},
|
|
63
|
+
value: 'small'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
label: {
|
|
67
|
+
en: 'Medium (0.5rem)',
|
|
68
|
+
cs: 'Střední (0.5rem)'
|
|
69
|
+
},
|
|
70
|
+
value: 'medium'
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
label: {
|
|
74
|
+
en: 'Large (0.75rem)',
|
|
75
|
+
cs: 'Velké (0.75rem)'
|
|
76
|
+
},
|
|
77
|
+
value: 'large'
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
label: {
|
|
81
|
+
en: 'XL (1rem)',
|
|
82
|
+
cs: 'XL (1rem)'
|
|
83
|
+
},
|
|
84
|
+
value: 'xl'
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
admin: {
|
|
88
|
+
description: {
|
|
89
|
+
en: 'Default corner rounding for UI elements',
|
|
90
|
+
cs: 'Výchozí zaoblení rohů pro UI prvky'
|
|
91
|
+
},
|
|
92
|
+
width: '50%'
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'spacing',
|
|
97
|
+
type: 'select',
|
|
98
|
+
label: {
|
|
99
|
+
en: '📏 Spacing Scale',
|
|
100
|
+
cs: '📏 Škála rozestupů'
|
|
101
|
+
},
|
|
102
|
+
defaultValue: 'medium',
|
|
103
|
+
options: [
|
|
104
|
+
{
|
|
105
|
+
label: {
|
|
106
|
+
en: 'Compact',
|
|
107
|
+
cs: 'Kompaktní'
|
|
108
|
+
},
|
|
109
|
+
value: 'compact'
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
label: {
|
|
113
|
+
en: 'Medium',
|
|
114
|
+
cs: 'Střední'
|
|
115
|
+
},
|
|
116
|
+
value: 'medium'
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
label: {
|
|
120
|
+
en: 'Comfortable',
|
|
121
|
+
cs: 'Pohodlné'
|
|
122
|
+
},
|
|
123
|
+
value: 'comfortable'
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
admin: {
|
|
127
|
+
description: {
|
|
128
|
+
en: 'Global spacing between elements',
|
|
129
|
+
cs: 'Globální rozestupy mezi prvky'
|
|
130
|
+
},
|
|
131
|
+
width: '50%'
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
});
|
|
38
136
|
// Color Mode Settings
|
|
39
137
|
if (includeColorModeToggle) {
|
|
40
138
|
fields.push({
|
|
@@ -116,283 +214,144 @@ import { darkModeField, lightModeField } from './colorModeFields.js';
|
|
|
116
214
|
]
|
|
117
215
|
});
|
|
118
216
|
}
|
|
119
|
-
// Typography
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
cs: 'Písmo pro text'
|
|
148
|
-
},
|
|
149
|
-
defaultValue: 'preset',
|
|
150
|
-
// @ts-expect-error - Pass full objects including fontFamily for custom rendering
|
|
151
|
-
options: BODY_FONT_OPTIONS,
|
|
152
|
-
admin: {
|
|
153
|
-
width: '50%',
|
|
154
|
-
components: {
|
|
155
|
-
Field: '@kilivi/payloadcms-theme-management/fields/FontSelectField'
|
|
156
|
-
}
|
|
157
|
-
}
|
|
217
|
+
// Typography - Always visible
|
|
218
|
+
fields.push({
|
|
219
|
+
type: 'collapsible',
|
|
220
|
+
label: {
|
|
221
|
+
en: '🅰️ Typography',
|
|
222
|
+
cs: '🅰️ Typografie'
|
|
223
|
+
},
|
|
224
|
+
admin: {
|
|
225
|
+
initCollapsed: true,
|
|
226
|
+
description: {
|
|
227
|
+
en: 'Choose font families and base typography settings. Leave fields on "Use preset" to inherit the theme defaults.',
|
|
228
|
+
cs: 'Zvolte rodiny písem a základní typografické nastavení. Hodnota "Použít výchozí" zachová nastavení motivu.'
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
fields: [
|
|
232
|
+
{
|
|
233
|
+
name: 'typography',
|
|
234
|
+
type: 'group',
|
|
235
|
+
fields: [
|
|
236
|
+
{
|
|
237
|
+
type: 'row',
|
|
238
|
+
fields: [
|
|
239
|
+
{
|
|
240
|
+
name: 'bodyFont',
|
|
241
|
+
type: 'select',
|
|
242
|
+
label: {
|
|
243
|
+
en: 'Body font',
|
|
244
|
+
cs: 'Písmo pro text'
|
|
158
245
|
},
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
defaultValue: 'preset',
|
|
167
|
-
// @ts-expect-error - Pass full objects including fontFamily for custom rendering
|
|
168
|
-
options: HEADING_FONT_OPTIONS,
|
|
169
|
-
admin: {
|
|
170
|
-
width: '50%',
|
|
171
|
-
components: {
|
|
172
|
-
Field: '@kilivi/payloadcms-theme-management/fields/FontSelectField'
|
|
173
|
-
}
|
|
246
|
+
defaultValue: 'preset',
|
|
247
|
+
// @ts-expect-error - Pass full objects including fontFamily for custom rendering
|
|
248
|
+
options: BODY_FONT_OPTIONS,
|
|
249
|
+
admin: {
|
|
250
|
+
width: '50%',
|
|
251
|
+
components: {
|
|
252
|
+
Field: '@kilivi/payloadcms-theme-management/fields/FontSelectField'
|
|
174
253
|
}
|
|
175
254
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
type: 'text',
|
|
184
|
-
label: {
|
|
185
|
-
en: 'Custom body font stack',
|
|
186
|
-
cs: 'Vlastní písmo pro text'
|
|
187
|
-
},
|
|
188
|
-
admin: {
|
|
189
|
-
width: '50%',
|
|
190
|
-
placeholder: '"IBM Plex Sans", sans-serif',
|
|
191
|
-
description: {
|
|
192
|
-
en: 'Provide full CSS font-family stack when using a custom font.',
|
|
193
|
-
cs: 'Při volbě vlastního písma zadejte celý CSS zápis font-family.'
|
|
194
|
-
},
|
|
195
|
-
condition: (_, siblingData)=>siblingData?.bodyFont === 'custom'
|
|
196
|
-
}
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
name: 'headingFont',
|
|
258
|
+
type: 'select',
|
|
259
|
+
label: {
|
|
260
|
+
en: 'Heading font',
|
|
261
|
+
cs: 'Písmo pro nadpisy'
|
|
197
262
|
},
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
admin: {
|
|
206
|
-
width: '50%',
|
|
207
|
-
placeholder: '"Cormorant Garamond", serif',
|
|
208
|
-
description: {
|
|
209
|
-
en: 'Provide full CSS font-family stack when using a custom heading font.',
|
|
210
|
-
cs: 'Při volbě vlastního nadpisového písma zadejte celý CSS zápis font-family.'
|
|
211
|
-
},
|
|
212
|
-
condition: (_, siblingData)=>siblingData?.headingFont === 'custom'
|
|
263
|
+
defaultValue: 'preset',
|
|
264
|
+
// @ts-expect-error - Pass full objects including fontFamily for custom rendering
|
|
265
|
+
options: HEADING_FONT_OPTIONS,
|
|
266
|
+
admin: {
|
|
267
|
+
width: '50%',
|
|
268
|
+
components: {
|
|
269
|
+
Field: '@kilivi/payloadcms-theme-management/fields/FontSelectField'
|
|
213
270
|
}
|
|
214
271
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
defaultValue: 'preset',
|
|
228
|
-
options: BASE_FONT_SIZE_OPTIONS.map((option)=>({
|
|
229
|
-
label: option.label,
|
|
230
|
-
value: option.value
|
|
231
|
-
})),
|
|
232
|
-
admin: {
|
|
233
|
-
width: '50%'
|
|
234
|
-
}
|
|
272
|
+
}
|
|
273
|
+
]
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
type: 'row',
|
|
277
|
+
fields: [
|
|
278
|
+
{
|
|
279
|
+
name: 'bodyFontCustom',
|
|
280
|
+
type: 'text',
|
|
281
|
+
label: {
|
|
282
|
+
en: 'Custom body font stack',
|
|
283
|
+
cs: 'Vlastní písmo pro text'
|
|
235
284
|
},
|
|
236
|
-
{
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
en: '
|
|
241
|
-
cs: '
|
|
285
|
+
admin: {
|
|
286
|
+
width: '50%',
|
|
287
|
+
placeholder: '"IBM Plex Sans", sans-serif',
|
|
288
|
+
description: {
|
|
289
|
+
en: 'Provide full CSS font-family stack when using a custom font.',
|
|
290
|
+
cs: 'Při volbě vlastního písma zadejte celý CSS zápis font-family.'
|
|
242
291
|
},
|
|
243
|
-
|
|
244
|
-
options: LINE_HEIGHT_OPTIONS.map((option)=>({
|
|
245
|
-
label: option.label,
|
|
246
|
-
value: option.value
|
|
247
|
-
})),
|
|
248
|
-
admin: {
|
|
249
|
-
width: '50%'
|
|
250
|
-
}
|
|
292
|
+
condition: (_, siblingData)=>siblingData?.bodyFont === 'custom'
|
|
251
293
|
}
|
|
252
|
-
]
|
|
253
|
-
}
|
|
254
|
-
]
|
|
255
|
-
}
|
|
256
|
-
]
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
// Design Customization (only when NOT using extended theme configuration)
|
|
260
|
-
if (!enableAdvancedFeatures) {
|
|
261
|
-
fields.push({
|
|
262
|
-
type: 'collapsible',
|
|
263
|
-
label: {
|
|
264
|
-
en: '✨ Design Customization',
|
|
265
|
-
cs: '✨ Přizpůsobení designu'
|
|
266
|
-
},
|
|
267
|
-
admin: {
|
|
268
|
-
initCollapsed: true
|
|
269
|
-
},
|
|
270
|
-
fields: [
|
|
271
|
-
{
|
|
272
|
-
name: 'borderRadius',
|
|
273
|
-
type: 'select',
|
|
274
|
-
label: {
|
|
275
|
-
en: 'Border Radius',
|
|
276
|
-
cs: 'Zaoblení rohů'
|
|
277
|
-
},
|
|
278
|
-
defaultValue: 'medium',
|
|
279
|
-
options: [
|
|
280
|
-
{
|
|
281
|
-
label: {
|
|
282
|
-
en: 'None',
|
|
283
|
-
cs: 'Žádné'
|
|
284
294
|
},
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
en: 'Large',
|
|
304
|
-
cs: 'Velké'
|
|
305
|
-
},
|
|
306
|
-
value: 'large'
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
label: {
|
|
310
|
-
en: 'Full',
|
|
311
|
-
cs: 'Plné'
|
|
312
|
-
},
|
|
313
|
-
value: 'xl'
|
|
314
|
-
}
|
|
315
|
-
],
|
|
316
|
-
admin: {
|
|
317
|
-
components: {
|
|
318
|
-
Field: '@kilivi/payloadcms-theme-management/fields/RadiusField'
|
|
319
|
-
},
|
|
320
|
-
width: '33%'
|
|
321
|
-
}
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
name: 'fontScale',
|
|
325
|
-
type: 'select',
|
|
326
|
-
label: {
|
|
327
|
-
en: 'Font Scale',
|
|
328
|
-
cs: 'Velikost písma'
|
|
329
|
-
},
|
|
330
|
-
defaultValue: 'medium',
|
|
331
|
-
options: [
|
|
332
|
-
{
|
|
333
|
-
label: {
|
|
334
|
-
en: 'Small',
|
|
335
|
-
cs: 'Malé'
|
|
336
|
-
},
|
|
337
|
-
value: 'small'
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
label: {
|
|
341
|
-
en: 'Medium',
|
|
342
|
-
cs: 'Střední'
|
|
343
|
-
},
|
|
344
|
-
value: 'medium'
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
label: {
|
|
348
|
-
en: 'Large',
|
|
349
|
-
cs: 'Velké'
|
|
350
|
-
},
|
|
351
|
-
value: 'large'
|
|
352
|
-
}
|
|
353
|
-
],
|
|
354
|
-
admin: {
|
|
355
|
-
width: '33%'
|
|
356
|
-
}
|
|
357
|
-
},
|
|
358
|
-
{
|
|
359
|
-
name: 'spacing',
|
|
360
|
-
type: 'select',
|
|
361
|
-
label: {
|
|
362
|
-
en: 'Spacing',
|
|
363
|
-
cs: 'Mezery'
|
|
295
|
+
{
|
|
296
|
+
name: 'headingFontCustom',
|
|
297
|
+
type: 'text',
|
|
298
|
+
label: {
|
|
299
|
+
en: 'Custom heading font stack',
|
|
300
|
+
cs: 'Vlastní písmo pro nadpisy'
|
|
301
|
+
},
|
|
302
|
+
admin: {
|
|
303
|
+
width: '50%',
|
|
304
|
+
placeholder: '"Cormorant Garamond", serif',
|
|
305
|
+
description: {
|
|
306
|
+
en: 'Provide full CSS font-family stack when using a custom heading font.',
|
|
307
|
+
cs: 'Při volbě vlastního nadpisového písma zadejte celý CSS zápis font-family.'
|
|
308
|
+
},
|
|
309
|
+
condition: (_, siblingData)=>siblingData?.headingFont === 'custom'
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
]
|
|
364
313
|
},
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
en: 'Spacious',
|
|
384
|
-
cs: 'Prostorné'
|
|
314
|
+
{
|
|
315
|
+
type: 'row',
|
|
316
|
+
fields: [
|
|
317
|
+
{
|
|
318
|
+
name: 'baseFontSize',
|
|
319
|
+
type: 'select',
|
|
320
|
+
label: {
|
|
321
|
+
en: 'Base font size',
|
|
322
|
+
cs: 'Základní velikost písma'
|
|
323
|
+
},
|
|
324
|
+
defaultValue: 'preset',
|
|
325
|
+
options: BASE_FONT_SIZE_OPTIONS.map((option)=>({
|
|
326
|
+
label: option.label,
|
|
327
|
+
value: option.value
|
|
328
|
+
})),
|
|
329
|
+
admin: {
|
|
330
|
+
width: '50%'
|
|
331
|
+
}
|
|
385
332
|
},
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
333
|
+
{
|
|
334
|
+
name: 'lineHeight',
|
|
335
|
+
type: 'select',
|
|
336
|
+
label: {
|
|
337
|
+
en: 'Line height',
|
|
338
|
+
cs: 'Řádkování'
|
|
339
|
+
},
|
|
340
|
+
defaultValue: 'preset',
|
|
341
|
+
options: LINE_HEIGHT_OPTIONS.map((option)=>({
|
|
342
|
+
label: option.label,
|
|
343
|
+
value: option.value
|
|
344
|
+
})),
|
|
345
|
+
admin: {
|
|
346
|
+
width: '50%'
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
]
|
|
391
350
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
}
|
|
351
|
+
]
|
|
352
|
+
}
|
|
353
|
+
]
|
|
354
|
+
});
|
|
396
355
|
// Advanced Settings (when using extended theme configuration)
|
|
397
356
|
if (enableAdvancedFeatures) {
|
|
398
357
|
const advancedFields = [
|
|
@@ -472,22 +431,25 @@ import { darkModeField, lightModeField } from './colorModeFields.js';
|
|
|
472
431
|
fields: advancedFields
|
|
473
432
|
});
|
|
474
433
|
}
|
|
475
|
-
// Return
|
|
476
|
-
// Return as group field with all theme configuration
|
|
434
|
+
// Return as tab configuration to be injected into tabs structure
|
|
477
435
|
return {
|
|
478
|
-
name: 'themeConfiguration',
|
|
479
|
-
type: 'group',
|
|
480
436
|
label: {
|
|
481
437
|
en: '🎨 Appearance Settings',
|
|
482
438
|
cs: '🎨 Nastavení vzhledu'
|
|
483
439
|
},
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
440
|
+
fields: [
|
|
441
|
+
{
|
|
442
|
+
name: 'themeConfiguration',
|
|
443
|
+
type: 'group',
|
|
444
|
+
admin: {
|
|
445
|
+
description: {
|
|
446
|
+
en: 'Configure website appearance and styling',
|
|
447
|
+
cs: 'Nakonfigurujte vzhled a stylování webu'
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
fields
|
|
488
451
|
}
|
|
489
|
-
|
|
490
|
-
fields
|
|
452
|
+
]
|
|
491
453
|
};
|
|
492
454
|
}
|
|
493
455
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/fields/themeConfigurationField.ts"],"sourcesContent":["import type { Field } from 'payload'\nimport {\n BASE_FONT_SIZE_OPTIONS,\n BODY_FONT_OPTIONS,\n HEADING_FONT_OPTIONS,\n LINE_HEIGHT_OPTIONS,\n} from '../constants/themeFonts.js'\nimport type { ThemePreset } from '../index.js'\nimport { darkModeField, lightModeField } from './colorModeFields.js'\n\ninterface ThemeConfigurationFieldOptions {\n themePresets: ThemePreset[]\n defaultTheme: string\n includeColorModeToggle: boolean\n includeCustomCSS: boolean\n includeBrandIdentity: boolean\n enableAdvancedFeatures?: boolean\n}\n\n/**\n * Theme Configuration Field with Theme Selection as default value setter\n * Theme Selection populates lightMode/darkMode colors automatically\n */\nexport function createThemeConfigurationField(options: ThemeConfigurationFieldOptions): Field {\n const {\n themePresets,\n defaultTheme,\n includeColorModeToggle,\n includeCustomCSS,\n enableAdvancedFeatures = true,\n } = options\n\n const themeOptions = themePresets.map((preset) => {\n const previewColor = preset.preview?.colors.primary\n const label = previewColor ? `${preset.label} • ${previewColor}` : preset.label\n return {\n label,\n value: preset.name,\n }\n })\n\n const fields: Field[] = [\n {\n name: 'theme',\n type: 'select',\n required: true,\n defaultValue: defaultTheme,\n options: themeOptions,\n label: {\n en: '🎨 Theme Selection',\n cs: '🎨 Výběr tématu',\n },\n admin: {\n description: {\n en: 'Select a theme to auto-populate color values. You can customize colors after selection.',\n cs: 'Vyberte téma pro automatické předvyplnění barev. Po výběru můžete barvy upravit.',\n },\n components: {\n Field: '@kilivi/payloadcms-theme-management/fields/ThemePreviewField',\n },\n },\n },\n ]\n\n // Color Mode Settings\n if (includeColorModeToggle) {\n fields.push({\n type: 'collapsible',\n label: {\n en: '🌗 Color Mode Settings',\n cs: '🌗 Nastavení barevného režimu',\n },\n admin: {\n initCollapsed: false,\n description: {\n en: 'Configure light and dark mode colors. Changes here override theme selection.',\n cs: 'Nakonfigurujte barvy světlého a tmavého režimu. Změny zde přepíší výběr tématu.',\n },\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'colorMode',\n type: 'select',\n label: {\n en: 'Default Color Mode',\n cs: 'Výchozí barevný režim',\n },\n defaultValue: 'auto',\n options: [\n {\n label: {\n en: 'Auto (System)',\n cs: 'Automaticky (Systém)',\n },\n value: 'auto',\n },\n {\n label: { en: 'Light', cs: 'Světlý' },\n value: 'light',\n },\n {\n label: { en: 'Dark', cs: 'Tmavý' },\n value: 'dark',\n },\n ],\n admin: {\n description: {\n en: 'Default color mode for visitors',\n cs: 'Výchozí barevný režim pro návštěvníky',\n },\n width: '50%',\n },\n },\n {\n name: 'allowColorModeToggle',\n type: 'checkbox',\n label: {\n en: 'Enable Mode Toggle',\n cs: 'Povolit přepínač režimu',\n },\n defaultValue: true,\n admin: {\n description: {\n en: 'Let visitors switch modes',\n cs: 'Umožnit návštěvníkům přepínat režimy',\n },\n width: '50%',\n },\n },\n ],\n },\n lightModeField,\n darkModeField,\n ],\n })\n }\n\n // Typography (only when NOT using extended theme configuration)\n if (!enableAdvancedFeatures) {\n fields.push({\n type: 'collapsible',\n label: {\n en: '🅰️ Typography',\n cs: '🅰️ Typografie',\n },\n admin: {\n initCollapsed: true,\n description: {\n en: 'Choose font families and base typography settings. Leave fields on \"Use preset\" to inherit the theme defaults.',\n cs: 'Zvolte rodiny písem a základní typografické nastavení. Hodnota \"Použít výchozí\" zachová nastavení motivu.',\n },\n },\n fields: [\n {\n name: 'typography',\n type: 'group',\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'bodyFont',\n type: 'select',\n label: {\n en: 'Body font',\n cs: 'Písmo pro text',\n },\n defaultValue: 'preset',\n // @ts-expect-error - Pass full objects including fontFamily for custom rendering\n options: BODY_FONT_OPTIONS,\n admin: {\n width: '50%',\n components: {\n Field: '@kilivi/payloadcms-theme-management/fields/FontSelectField',\n },\n },\n },\n {\n name: 'headingFont',\n type: 'select',\n label: {\n en: 'Heading font',\n cs: 'Písmo pro nadpisy',\n },\n defaultValue: 'preset',\n // @ts-expect-error - Pass full objects including fontFamily for custom rendering\n options: HEADING_FONT_OPTIONS,\n admin: {\n width: '50%',\n components: {\n Field: '@kilivi/payloadcms-theme-management/fields/FontSelectField',\n },\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'bodyFontCustom',\n type: 'text',\n label: {\n en: 'Custom body font stack',\n cs: 'Vlastní písmo pro text',\n },\n admin: {\n width: '50%',\n placeholder: '\"IBM Plex Sans\", sans-serif',\n description: {\n en: 'Provide full CSS font-family stack when using a custom font.',\n cs: 'Při volbě vlastního písma zadejte celý CSS zápis font-family.',\n },\n condition: (_, siblingData) => siblingData?.bodyFont === 'custom',\n },\n },\n {\n name: 'headingFontCustom',\n type: 'text',\n label: {\n en: 'Custom heading font stack',\n cs: 'Vlastní písmo pro nadpisy',\n },\n admin: {\n width: '50%',\n placeholder: '\"Cormorant Garamond\", serif',\n description: {\n en: 'Provide full CSS font-family stack when using a custom heading font.',\n cs: 'Při volbě vlastního nadpisového písma zadejte celý CSS zápis font-family.',\n },\n condition: (_, siblingData) => siblingData?.headingFont === 'custom',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'baseFontSize',\n type: 'select',\n label: {\n en: 'Base font size',\n cs: 'Základní velikost písma',\n },\n defaultValue: 'preset',\n options: BASE_FONT_SIZE_OPTIONS.map((option) => ({\n label: option.label,\n value: option.value,\n })),\n admin: {\n width: '50%',\n },\n },\n {\n name: 'lineHeight',\n type: 'select',\n label: {\n en: 'Line height',\n cs: 'Řádkování',\n },\n defaultValue: 'preset',\n options: LINE_HEIGHT_OPTIONS.map((option) => ({\n label: option.label,\n value: option.value,\n })),\n admin: {\n width: '50%',\n },\n },\n ],\n },\n ],\n },\n ],\n })\n }\n\n // Design Customization (only when NOT using extended theme configuration)\n if (!enableAdvancedFeatures) {\n fields.push({\n type: 'collapsible',\n label: {\n en: '✨ Design Customization',\n cs: '✨ Přizpůsobení designu',\n },\n admin: {\n initCollapsed: true,\n },\n fields: [\n {\n name: 'borderRadius',\n type: 'select',\n label: {\n en: 'Border Radius',\n cs: 'Zaoblení rohů',\n },\n defaultValue: 'medium',\n options: [\n { label: { en: 'None', cs: 'Žádné' }, value: 'none' },\n { label: { en: 'Small', cs: 'Malé' }, value: 'small' },\n { label: { en: 'Medium', cs: 'Střední' }, value: 'medium' },\n { label: { en: 'Large', cs: 'Velké' }, value: 'large' },\n { label: { en: 'Full', cs: 'Plné' }, value: 'xl' },\n ],\n admin: {\n components: {\n Field: '@kilivi/payloadcms-theme-management/fields/RadiusField',\n },\n width: '33%',\n },\n },\n {\n name: 'fontScale',\n type: 'select',\n label: {\n en: 'Font Scale',\n cs: 'Velikost písma',\n },\n defaultValue: 'medium',\n options: [\n { label: { en: 'Small', cs: 'Malé' }, value: 'small' },\n { label: { en: 'Medium', cs: 'Střední' }, value: 'medium' },\n { label: { en: 'Large', cs: 'Velké' }, value: 'large' },\n ],\n admin: {\n width: '33%',\n },\n },\n {\n name: 'spacing',\n type: 'select',\n label: {\n en: 'Spacing',\n cs: 'Mezery',\n },\n defaultValue: 'medium',\n options: [\n { label: { en: 'Compact', cs: 'Kompaktní' }, value: 'compact' },\n { label: { en: 'Medium', cs: 'Střední' }, value: 'medium' },\n { label: { en: 'Spacious', cs: 'Prostorné' }, value: 'spacious' },\n ],\n admin: {\n width: '34%',\n },\n },\n ],\n })\n } // End of !enableAdvancedFeatures block\n\n // Advanced Settings (when using extended theme configuration)\n if (enableAdvancedFeatures) {\n const advancedFields: Field[] = [\n {\n name: 'animationLevel',\n type: 'select',\n label: {\n en: 'Animation Level',\n cs: 'Úroveň animací',\n },\n defaultValue: 'medium',\n options: [\n { label: { en: 'None', cs: 'Žádné' }, value: 'none' },\n { label: { en: 'Reduced', cs: 'Snížené' }, value: 'reduced' },\n { label: { en: 'Medium', cs: 'Střední' }, value: 'medium' },\n { label: { en: 'High', cs: 'Vysoké' }, value: 'high' },\n ],\n admin: {\n description: {\n en: 'Control website animations and transitions',\n cs: 'Kontrola animací a přechodů na webu',\n },\n width: '50%',\n },\n },\n ]\n\n if (includeCustomCSS) {\n advancedFields.push({\n name: 'customCSS',\n type: 'code',\n label: {\n en: 'Custom CSS',\n cs: 'Vlastní CSS',\n },\n admin: {\n language: 'css',\n description: {\n en: 'Add custom CSS to override default styles',\n cs: 'Přidejte vlastní CSS pro přepsání výchozích stylů',\n },\n // placeholder:\n // ':root {\\n --primary: #your-color;\\n --border-radius: 8px;\\n --font-family: \"Your Font\";\\n}\\n\\n.custom-class {\\n /* Your custom styles */\\n}',\n // rows: 8,\n },\n })\n }\n\n fields.push({\n type: 'collapsible',\n label: {\n en: '⚙️ Advanced Settings',\n cs: '⚙️ Pokročilé nastavení',\n },\n admin: {\n initCollapsed: true,\n },\n fields: advancedFields,\n })\n }\n\n // Return just the tab configuration, not the full tabs field\n // Return as group field with all theme configuration\n return {\n name: 'themeConfiguration',\n type: 'group',\n label: {\n en: '🎨 Appearance Settings',\n cs: '🎨 Nastavení vzhledu',\n },\n admin: {\n description: {\n en: 'Configure website appearance and styling',\n cs: 'Nakonfigurujte vzhled a stylování webu',\n },\n },\n fields,\n }\n}\n"],"names":["BASE_FONT_SIZE_OPTIONS","BODY_FONT_OPTIONS","HEADING_FONT_OPTIONS","LINE_HEIGHT_OPTIONS","darkModeField","lightModeField","createThemeConfigurationField","options","themePresets","defaultTheme","includeColorModeToggle","includeCustomCSS","enableAdvancedFeatures","themeOptions","map","preset","previewColor","preview","colors","primary","label","value","name","fields","type","required","defaultValue","en","cs","admin","description","components","Field","push","initCollapsed","width","placeholder","condition","_","siblingData","bodyFont","headingFont","option","advancedFields","language"],"mappings":"AACA,SACEA,sBAAsB,EACtBC,iBAAiB,EACjBC,oBAAoB,EACpBC,mBAAmB,QACd,6BAA4B;AAEnC,SAASC,aAAa,EAAEC,cAAc,QAAQ,uBAAsB;AAWpE;;;CAGC,GACD,OAAO,SAASC,8BAA8BC,OAAuC;IACnF,MAAM,EACJC,YAAY,EACZC,YAAY,EACZC,sBAAsB,EACtBC,gBAAgB,EAChBC,yBAAyB,IAAI,EAC9B,GAAGL;IAEJ,MAAMM,eAAeL,aAAaM,GAAG,CAAC,CAACC;QACrC,MAAMC,eAAeD,OAAOE,OAAO,EAAEC,OAAOC;QAC5C,MAAMC,QAAQJ,eAAe,GAAGD,OAAOK,KAAK,CAAC,GAAG,EAAEJ,cAAc,GAAGD,OAAOK,KAAK;QAC/E,OAAO;YACLA;YACAC,OAAON,OAAOO,IAAI;QACpB;IACF;IAEA,MAAMC,SAAkB;QACtB;YACED,MAAM;YACNE,MAAM;YACNC,UAAU;YACVC,cAAcjB;YACdF,SAASM;YACTO,OAAO;gBACLO,IAAI;gBACJC,IAAI;YACN;YACAC,OAAO;gBACLC,aAAa;oBACXH,IAAI;oBACJC,IAAI;gBACN;gBACAG,YAAY;oBACVC,OAAO;gBACT;YACF;QACF;KACD;IAED,sBAAsB;IACtB,IAAItB,wBAAwB;QAC1Ba,OAAOU,IAAI,CAAC;YACVT,MAAM;YACNJ,OAAO;gBACLO,IAAI;gBACJC,IAAI;YACN;YACAC,OAAO;gBACLK,eAAe;gBACfJ,aAAa;oBACXH,IAAI;oBACJC,IAAI;gBACN;YACF;YACAL,QAAQ;gBACN;oBACEC,MAAM;oBACND,QAAQ;wBACN;4BACED,MAAM;4BACNE,MAAM;4BACNJ,OAAO;gCACLO,IAAI;gCACJC,IAAI;4BACN;4BACAF,cAAc;4BACdnB,SAA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ACJC,IAAI;QACN;QACAC,OAAO;YACLC,aAAa;gBACXH,IAAI;gBACJC,IAAI;YACN;QACF;QACAL;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/fields/themeConfigurationField.ts"],"sourcesContent":["import type { Field, TabsField } from 'payload'\nimport {\n BASE_FONT_SIZE_OPTIONS,\n BODY_FONT_OPTIONS,\n HEADING_FONT_OPTIONS,\n LINE_HEIGHT_OPTIONS,\n} from '../constants/themeFonts.js'\nimport type { ThemePreset } from '../index.js'\nimport { darkModeField, lightModeField } from './colorModeFields.js'\n\ninterface ThemeConfigurationFieldOptions {\n themePresets: ThemePreset[]\n defaultTheme: string\n includeColorModeToggle: boolean\n includeCustomCSS: boolean\n includeBrandIdentity: boolean\n enableAdvancedFeatures?: boolean\n}\n\n// Type for a single tab (not the full TabsField)\nexport type ThemeTab = NonNullable<TabsField['tabs']>[number]\n\n/**\n * Theme Configuration Field with Theme Selection as default value setter\n * Theme Selection populates lightMode/darkMode colors automatically\n */\nexport function createThemeConfigurationField(options: ThemeConfigurationFieldOptions): ThemeTab {\n const {\n themePresets,\n defaultTheme,\n includeColorModeToggle,\n includeCustomCSS,\n enableAdvancedFeatures = true,\n } = options\n\n const themeOptions = themePresets.map((preset) => {\n const previewColor = preset.preview?.colors.primary\n const label = previewColor ? `${preset.label} • ${previewColor}` : preset.label\n return {\n label,\n value: preset.name,\n }\n })\n\n const fields: Field[] = [\n {\n name: 'theme',\n type: 'select',\n required: true,\n defaultValue: defaultTheme,\n options: themeOptions,\n label: {\n en: '🎨 Theme Selection',\n cs: '🎨 Výběr tématu',\n },\n admin: {\n description: {\n en: 'Select a theme to auto-populate color values. You can customize colors after selection.',\n cs: 'Vyberte téma pro automatické předvyplnění barev. Po výběru můžete barvy upravit.',\n },\n components: {\n Field: '@kilivi/payloadcms-theme-management/fields/ThemePreviewField',\n },\n },\n },\n ]\n\n // Border Radius Configuration - Always visible\n fields.push({\n type: 'row',\n fields: [\n {\n name: 'borderRadius',\n type: 'select',\n label: {\n en: '📐 Border Radius',\n cs: '📐 Zaoblení rohů',\n },\n defaultValue: 'medium',\n options: [\n { label: { en: 'None (0px)', cs: 'Žádné (0px)' }, value: 'none' },\n { label: { en: 'Small (0.25rem)', cs: 'Malé (0.25rem)' }, value: 'small' },\n { label: { en: 'Medium (0.5rem)', cs: 'Střední (0.5rem)' }, value: 'medium' },\n { label: { en: 'Large (0.75rem)', cs: 'Velké (0.75rem)' }, value: 'large' },\n { label: { en: 'XL (1rem)', cs: 'XL (1rem)' }, value: 'xl' },\n ],\n admin: {\n description: {\n en: 'Default corner rounding for UI elements',\n cs: 'Výchozí zaoblení rohů pro UI prvky',\n },\n width: '50%',\n },\n },\n {\n name: 'spacing',\n type: 'select',\n label: {\n en: '📏 Spacing Scale',\n cs: '📏 Škála rozestupů',\n },\n defaultValue: 'medium',\n options: [\n { label: { en: 'Compact', cs: 'Kompaktní' }, value: 'compact' },\n { label: { en: 'Medium', cs: 'Střední' }, value: 'medium' },\n { label: { en: 'Comfortable', cs: 'Pohodlné' }, value: 'comfortable' },\n ],\n admin: {\n description: {\n en: 'Global spacing between elements',\n cs: 'Globální rozestupy mezi prvky',\n },\n width: '50%',\n },\n },\n ],\n })\n\n // Color Mode Settings\n if (includeColorModeToggle) {\n fields.push({\n type: 'collapsible',\n label: {\n en: '🌗 Color Mode Settings',\n cs: '🌗 Nastavení barevného režimu',\n },\n admin: {\n initCollapsed: false,\n description: {\n en: 'Configure light and dark mode colors. Changes here override theme selection.',\n cs: 'Nakonfigurujte barvy světlého a tmavého režimu. Změny zde přepíší výběr tématu.',\n },\n },\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'colorMode',\n type: 'select',\n label: {\n en: 'Default Color Mode',\n cs: 'Výchozí barevný režim',\n },\n defaultValue: 'auto',\n options: [\n {\n label: {\n en: 'Auto (System)',\n cs: 'Automaticky (Systém)',\n },\n value: 'auto',\n },\n {\n label: { en: 'Light', cs: 'Světlý' },\n value: 'light',\n },\n {\n label: { en: 'Dark', cs: 'Tmavý' },\n value: 'dark',\n },\n ],\n admin: {\n description: {\n en: 'Default color mode for visitors',\n cs: 'Výchozí barevný režim pro návštěvníky',\n },\n width: '50%',\n },\n },\n {\n name: 'allowColorModeToggle',\n type: 'checkbox',\n label: {\n en: 'Enable Mode Toggle',\n cs: 'Povolit přepínač režimu',\n },\n defaultValue: true,\n admin: {\n description: {\n en: 'Let visitors switch modes',\n cs: 'Umožnit návštěvníkům přepínat režimy',\n },\n width: '50%',\n },\n },\n ],\n },\n lightModeField,\n darkModeField,\n ],\n })\n }\n\n // Typography - Always visible\n fields.push({\n type: 'collapsible',\n label: {\n en: '🅰️ Typography',\n cs: '🅰️ Typografie',\n },\n admin: {\n initCollapsed: true,\n description: {\n en: 'Choose font families and base typography settings. Leave fields on \"Use preset\" to inherit the theme defaults.',\n cs: 'Zvolte rodiny písem a základní typografické nastavení. Hodnota \"Použít výchozí\" zachová nastavení motivu.',\n },\n },\n fields: [\n {\n name: 'typography',\n type: 'group',\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'bodyFont',\n type: 'select',\n label: {\n en: 'Body font',\n cs: 'Písmo pro text',\n },\n defaultValue: 'preset',\n // @ts-expect-error - Pass full objects including fontFamily for custom rendering\n options: BODY_FONT_OPTIONS,\n admin: {\n width: '50%',\n components: {\n Field: '@kilivi/payloadcms-theme-management/fields/FontSelectField',\n },\n },\n },\n {\n name: 'headingFont',\n type: 'select',\n label: {\n en: 'Heading font',\n cs: 'Písmo pro nadpisy',\n },\n defaultValue: 'preset',\n // @ts-expect-error - Pass full objects including fontFamily for custom rendering\n options: HEADING_FONT_OPTIONS,\n admin: {\n width: '50%',\n components: {\n Field: '@kilivi/payloadcms-theme-management/fields/FontSelectField',\n },\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'bodyFontCustom',\n type: 'text',\n label: {\n en: 'Custom body font stack',\n cs: 'Vlastní písmo pro text',\n },\n admin: {\n width: '50%',\n placeholder: '\"IBM Plex Sans\", sans-serif',\n description: {\n en: 'Provide full CSS font-family stack when using a custom font.',\n cs: 'Při volbě vlastního písma zadejte celý CSS zápis font-family.',\n },\n condition: (_, siblingData) => siblingData?.bodyFont === 'custom',\n },\n },\n {\n name: 'headingFontCustom',\n type: 'text',\n label: {\n en: 'Custom heading font stack',\n cs: 'Vlastní písmo pro nadpisy',\n },\n admin: {\n width: '50%',\n placeholder: '\"Cormorant Garamond\", serif',\n description: {\n en: 'Provide full CSS font-family stack when using a custom heading font.',\n cs: 'Při volbě vlastního nadpisového písma zadejte celý CSS zápis font-family.',\n },\n condition: (_, siblingData) => siblingData?.headingFont === 'custom',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n name: 'baseFontSize',\n type: 'select',\n label: {\n en: 'Base font size',\n cs: 'Základní velikost písma',\n },\n defaultValue: 'preset',\n options: BASE_FONT_SIZE_OPTIONS.map((option) => ({\n label: option.label,\n value: option.value,\n })),\n admin: {\n width: '50%',\n },\n },\n {\n name: 'lineHeight',\n type: 'select',\n label: {\n en: 'Line height',\n cs: 'Řádkování',\n },\n defaultValue: 'preset',\n options: LINE_HEIGHT_OPTIONS.map((option) => ({\n label: option.label,\n value: option.value,\n })),\n admin: {\n width: '50%',\n },\n },\n ],\n },\n ],\n },\n ],\n })\n\n // Advanced Settings (when using extended theme configuration)\n if (enableAdvancedFeatures) {\n const advancedFields: Field[] = [\n {\n name: 'animationLevel',\n type: 'select',\n label: {\n en: 'Animation Level',\n cs: 'Úroveň animací',\n },\n defaultValue: 'medium',\n options: [\n { label: { en: 'None', cs: 'Žádné' }, value: 'none' },\n { label: { en: 'Reduced', cs: 'Snížené' }, value: 'reduced' },\n { label: { en: 'Medium', cs: 'Střední' }, value: 'medium' },\n { label: { en: 'High', cs: 'Vysoké' }, value: 'high' },\n ],\n admin: {\n description: {\n en: 'Control website animations and transitions',\n cs: 'Kontrola animací a přechodů na webu',\n },\n width: '50%',\n },\n },\n ]\n\n if (includeCustomCSS) {\n advancedFields.push({\n name: 'customCSS',\n type: 'code',\n label: {\n en: 'Custom CSS',\n cs: 'Vlastní CSS',\n },\n admin: {\n language: 'css',\n description: {\n en: 'Add custom CSS to override default styles',\n cs: 'Přidejte vlastní CSS pro přepsání výchozích stylů',\n },\n // placeholder:\n // ':root {\\n --primary: #your-color;\\n --border-radius: 8px;\\n --font-family: \"Your Font\";\\n}\\n\\n.custom-class {\\n /* Your custom styles */\\n}',\n // rows: 8,\n },\n })\n }\n\n fields.push({\n type: 'collapsible',\n label: {\n en: '⚙️ Advanced Settings',\n cs: '⚙️ Pokročilé nastavení',\n },\n admin: {\n initCollapsed: true,\n },\n fields: advancedFields,\n })\n }\n\n // Return as tab configuration to be injected into tabs structure\n return {\n label: {\n en: '🎨 Appearance Settings',\n cs: '🎨 Nastavení vzhledu',\n },\n fields: [\n {\n name: 'themeConfiguration',\n type: 'group',\n admin: {\n description: {\n en: 'Configure website appearance and styling',\n cs: 'Nakonfigurujte vzhled a stylování webu',\n },\n },\n fields,\n },\n ],\n }\n}\n"],"names":["BASE_FONT_SIZE_OPTIONS","BODY_FONT_OPTIONS","HEADING_FONT_OPTIONS","LINE_HEIGHT_OPTIONS","darkModeField","lightModeField","createThemeConfigurationField","options","themePresets","defaultTheme","includeColorModeToggle","includeCustomCSS","enableAdvancedFeatures","themeOptions","map","preset","previewColor","preview","colors","primary","label","value","name","fields","type","required","defaultValue","en","cs","admin","description","components","Field","push","width","initCollapsed","placeholder","condition","_","siblingData","bodyFont","headingFont","option","advancedFields","language"],"mappings":"AACA,SACEA,sBAAsB,EACtBC,iBAAiB,EACjBC,oBAAoB,EACpBC,mBAAmB,QACd,6BAA4B;AAEnC,SAASC,aAAa,EAAEC,cAAc,QAAQ,uBAAsB;AAcpE;;;CAGC,GACD,OAAO,SAASC,8BAA8BC,OAAuC;IACnF,MAAM,EACJC,YAAY,EACZC,YAAY,EACZC,sBAAsB,EACtBC,gBAAgB,EAChBC,yBAAyB,IAAI,EAC9B,GAAGL;IA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ACH;IACF;IAEA,8BAA8B;IAC9BmB,OAAOU,IAAI,CAAC;QACVT,MAAM;QACNJ,OAAO;YACLO,IAAI;YACJC,IAAI;QACN;QACAC,OAAO;YACLM,eAAe;YACfL,aAAa;gBACXH,IAAI;gBACJC,IAAI;YACN;QACF;QACAL,QAAQ;YACN;gBACED,MAAM;gBACNE,MAAM;gBACND,QAAQ;oBACN;wBACEC,MAAM;wBACND,QAAQ;4BACN;gCACED,MAAM;gCACNE,MAAM;gCACNJ,OAAO;oCACLO,IAAI;oCACJC,IAAI;gCACN;gCACAF,cAAc;gCACd,iFAAiF;gCACjFnB,SAASN;gCACT4B,OAAO;oCACLK,OAAO;oCACPH,YAAY;wCACVC,OAAO;oCACT;gCACF;4BACF;4BACA;gCACEV,MAAM;gCACNE,MAAM;gCACNJ,OAAO;oCACLO,IAAI;oCACJC,IAAI;gCACN;gCACAF,cAAc;gCACd,iFAAiF;gCACjFnB,SAASL;gCACT2B,OAAO;oCACLK,OAAO;oCACPH,YAAY;wCACVC,OAAO;oCACT;gCACF;4BACF;yBACD;oBACH;oBACA;wBACER,MAAM;wBACND,QAAQ;4BACN;gCACED,MAAM;gCACNE,MAAM;gCACNJ,OAAO;oCACLO,IAAI;oCACJC,IAAI;gCACN;gCACAC,OAAO;oCACLK,OAAO;oCACPE,aAAa;oCACbN,aAAa;wCACXH,IAAI;wCACJC,IAAI;oCACN;oCACAS,WAAW,CAACC,GAAGC,cAAgBA,aAAaC,aAAa;gCAC3D;4BACF;4BACA;gCACElB,MAAM;gCACNE,MAAM;gCACNJ,OAAO;oCACLO,IAAI;oCACJC,IAAI;gCACN;gCACAC,OAAO;oCACLK,OAAO;oCACPE,aAAa;oCACbN,aAAa;wCACXH,IAAI;wCACJC,IAAI;oCACN;oCACAS,WAAW,CAACC,GAAGC,cAAgBA,aAAaE,gBAAgB;gCAC9D;4BACF;yBACD;oBACH;oBACA;wBACEjB,MAAM;wBACND,QAAQ;4BACN;gCACED,MAAM;gCACNE,MAAM;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