@kilivi/payloadcms-theme-management 0.2.10 → 0.2.12

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.
@@ -0,0 +1,12 @@
1
+ import type { SelectFieldClientComponent } from 'payload';
2
+ /**
3
+ * Extended Theme Field with Auto-Population
4
+ *
5
+ * This component:
6
+ * 1. Shows color swatches for each theme option
7
+ * 2. Auto-populates ALL color fields when a theme is selected
8
+ * 3. Fills in ALL light mode and dark mode colors with preset defaults
9
+ */
10
+ declare const ExtendedThemeAutoPopulateField: SelectFieldClientComponent;
11
+ export default ExtendedThemeAutoPopulateField;
12
+ //# sourceMappingURL=ExtendedThemeAutoPopulateField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExtendedThemeAutoPopulateField.d.ts","sourceRoot":"","sources":["../../src/fields/ExtendedThemeAutoPopulateField.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAA;AAIzD;;;;;;;GAOG;AACH,QAAA,MAAM,8BAA8B,EAAE,0BAsLrC,CAAA;AAED,eAAe,8BAA8B,CAAA"}
@@ -0,0 +1,176 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useField, useForm } from '@payloadcms/ui';
4
+ import { useCallback, useEffect, useRef } from 'react';
5
+ import { allExtendedThemePresets } from '../extended-presets.js';
6
+ /**
7
+ * Extended Theme Field with Auto-Population
8
+ *
9
+ * This component:
10
+ * 1. Shows color swatches for each theme option
11
+ * 2. Auto-populates ALL color fields when a theme is selected
12
+ * 3. Fills in ALL light mode and dark mode colors with preset defaults
13
+ */ const ExtendedThemeAutoPopulateField = ({ field, path })=>{
14
+ const { value, setValue } = useField({
15
+ path
16
+ });
17
+ const { dispatchFields } = useForm();
18
+ const hasInitializedRef = useRef(false);
19
+ const options = field.options || [];
20
+ const selectedOption = options.find((opt)=>opt.value === value);
21
+ // Auto-populate colors when theme is selected
22
+ const applyThemePreset = useCallback((presetKey)=>{
23
+ const preset = allExtendedThemePresets[presetKey];
24
+ if (!preset) return;
25
+ // Apply all light mode colors
26
+ Object.entries(preset.styles.light).forEach(([key, colorValue])=>{
27
+ dispatchFields({
28
+ type: 'UPDATE',
29
+ path: `themeConfiguration.extendedLightMode.${key}`,
30
+ value: colorValue
31
+ });
32
+ });
33
+ // Apply all dark mode colors
34
+ Object.entries(preset.styles.dark).forEach(([key, colorValue])=>{
35
+ dispatchFields({
36
+ type: 'UPDATE',
37
+ path: `themeConfiguration.extendedDarkMode.${key}`,
38
+ value: colorValue
39
+ });
40
+ });
41
+ }, [
42
+ dispatchFields
43
+ ]);
44
+ const handleChange = useCallback((newValue)=>{
45
+ setValue(newValue);
46
+ if (newValue) {
47
+ applyThemePreset(newValue);
48
+ }
49
+ }, [
50
+ setValue,
51
+ applyThemePreset
52
+ ]);
53
+ // Auto-populate on initial load if value exists
54
+ useEffect(()=>{
55
+ if (!hasInitializedRef.current && value) {
56
+ applyThemePreset(value);
57
+ hasInitializedRef.current = true;
58
+ }
59
+ }, [
60
+ value,
61
+ applyThemePreset
62
+ ]);
63
+ // Get color swatches for a preset
64
+ const getPresetColors = (presetValue)=>{
65
+ const preset = allExtendedThemePresets[presetValue];
66
+ if (!preset) return [];
67
+ const colors = [
68
+ preset.styles.light.primary,
69
+ preset.styles.light.secondary,
70
+ preset.styles.light.accent,
71
+ preset.styles.light.background,
72
+ preset.styles.light.foreground
73
+ ].filter(Boolean);
74
+ return colors.slice(0, 5);
75
+ };
76
+ const label = typeof field.label === 'string' ? field.label : field.label?.en || field.label?.cs || 'Theme Preset';
77
+ const description = typeof field.admin?.description === 'string' ? field.admin.description : field.admin?.description?.en || field.admin?.description?.cs;
78
+ return /*#__PURE__*/ _jsxs("div", {
79
+ style: {
80
+ marginBottom: '16px'
81
+ },
82
+ children: [
83
+ /*#__PURE__*/ _jsx("label", {
84
+ style: {
85
+ display: 'block',
86
+ marginBottom: '6px',
87
+ fontSize: '13px',
88
+ fontWeight: 600,
89
+ color: 'var(--theme-elevation-800)'
90
+ },
91
+ children: label
92
+ }),
93
+ description && /*#__PURE__*/ _jsx("div", {
94
+ style: {
95
+ fontSize: '12px',
96
+ color: 'var(--theme-elevation-500)',
97
+ marginBottom: '8px'
98
+ },
99
+ children: description
100
+ }),
101
+ /*#__PURE__*/ _jsxs("select", {
102
+ value: value || '',
103
+ onChange: (e)=>handleChange(e.target.value),
104
+ style: {
105
+ width: '100%',
106
+ padding: '10px 12px',
107
+ borderRadius: '6px',
108
+ border: '1px solid var(--theme-elevation-200)',
109
+ backgroundColor: 'var(--theme-input-bg)',
110
+ color: 'var(--theme-elevation-800)',
111
+ fontSize: '14px',
112
+ cursor: 'pointer'
113
+ },
114
+ children: [
115
+ /*#__PURE__*/ _jsx("option", {
116
+ value: "",
117
+ children: "Select a theme..."
118
+ }),
119
+ options.map((option)=>/*#__PURE__*/ _jsx("option", {
120
+ value: option.value,
121
+ children: option.label
122
+ }, option.value))
123
+ ]
124
+ }),
125
+ selectedOption && /*#__PURE__*/ _jsxs("div", {
126
+ style: {
127
+ marginTop: '12px',
128
+ padding: '12px',
129
+ borderRadius: '8px',
130
+ backgroundColor: 'var(--theme-elevation-50)',
131
+ border: '1px solid var(--theme-elevation-200)'
132
+ },
133
+ children: [
134
+ /*#__PURE__*/ _jsx("div", {
135
+ style: {
136
+ fontSize: '12px',
137
+ fontWeight: 600,
138
+ marginBottom: '8px',
139
+ color: 'var(--theme-elevation-700)'
140
+ },
141
+ children: selectedOption.label
142
+ }),
143
+ /*#__PURE__*/ _jsx("div", {
144
+ style: {
145
+ display: 'flex',
146
+ gap: '8px',
147
+ alignItems: 'center'
148
+ },
149
+ children: getPresetColors(selectedOption.value).map((color, index)=>/*#__PURE__*/ _jsx("div", {
150
+ style: {
151
+ width: '32px',
152
+ height: '32px',
153
+ borderRadius: '6px',
154
+ backgroundColor: color,
155
+ border: '1px solid rgba(0, 0, 0, 0.1)',
156
+ boxShadow: '0 2px 4px rgba(0, 0, 0, 0.05)'
157
+ },
158
+ title: color
159
+ }, `${selectedOption.value}-${index}`))
160
+ }),
161
+ /*#__PURE__*/ _jsx("div", {
162
+ style: {
163
+ marginTop: '8px',
164
+ fontSize: '11px',
165
+ color: 'var(--theme-elevation-500)'
166
+ },
167
+ children: "✅ All colors auto-populated from this theme"
168
+ })
169
+ ]
170
+ })
171
+ ]
172
+ });
173
+ };
174
+ export default ExtendedThemeAutoPopulateField;
175
+
176
+ //# sourceMappingURL=ExtendedThemeAutoPopulateField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/fields/ExtendedThemeAutoPopulateField.tsx"],"sourcesContent":["'use client'\n\nimport { useField, useForm } from '@payloadcms/ui'\nimport type { SelectFieldClientComponent } from 'payload'\nimport { useCallback, useEffect, useRef } from 'react'\nimport { allExtendedThemePresets } from '../extended-presets.js'\n\n/**\n * Extended Theme Field with Auto-Population\n *\n * This component:\n * 1. Shows color swatches for each theme option\n * 2. Auto-populates ALL color fields when a theme is selected\n * 3. Fills in ALL light mode and dark mode colors with preset defaults\n */\nconst ExtendedThemeAutoPopulateField: SelectFieldClientComponent = ({ field, path }) => {\n const { value, setValue } = useField<string>({ path })\n const { dispatchFields } = useForm()\n const hasInitializedRef = useRef(false)\n\n const options = (field.options as Array<{ label: string; value: string }>) || []\n const selectedOption = options.find((opt) => opt.value === value)\n\n // Auto-populate colors when theme is selected\n const applyThemePreset = useCallback(\n (presetKey: string) => {\n const preset = allExtendedThemePresets[presetKey as keyof typeof allExtendedThemePresets]\n if (!preset) return\n\n // Apply all light mode colors\n Object.entries(preset.styles.light).forEach(([key, colorValue]) => {\n dispatchFields({\n type: 'UPDATE',\n path: `themeConfiguration.extendedLightMode.${key}`,\n value: colorValue,\n })\n })\n\n // Apply all dark mode colors\n Object.entries(preset.styles.dark).forEach(([key, colorValue]) => {\n dispatchFields({\n type: 'UPDATE',\n path: `themeConfiguration.extendedDarkMode.${key}`,\n value: colorValue,\n })\n })\n },\n [dispatchFields],\n )\n\n const handleChange = useCallback(\n (newValue: string) => {\n setValue(newValue)\n if (newValue) {\n applyThemePreset(newValue)\n }\n },\n [setValue, applyThemePreset],\n )\n\n // Auto-populate on initial load if value exists\n useEffect(() => {\n if (!hasInitializedRef.current && value) {\n applyThemePreset(value)\n hasInitializedRef.current = true\n }\n }, [value, applyThemePreset])\n\n // Get color swatches for a preset\n const getPresetColors = (presetValue: string) => {\n const preset = allExtendedThemePresets[presetValue as keyof typeof allExtendedThemePresets]\n if (!preset) return []\n\n const colors = [\n preset.styles.light.primary,\n preset.styles.light.secondary,\n preset.styles.light.accent,\n preset.styles.light.background,\n preset.styles.light.foreground,\n ].filter(Boolean)\n\n return colors.slice(0, 5)\n }\n\n const label =\n typeof field.label === 'string'\n ? field.label\n : field.label?.en || field.label?.cs || 'Theme Preset'\n const description =\n typeof field.admin?.description === 'string'\n ? field.admin.description\n : field.admin?.description?.en || field.admin?.description?.cs\n\n return (\n <div style={{ marginBottom: '16px' }}>\n <label\n style={{\n display: 'block',\n marginBottom: '6px',\n fontSize: '13px',\n fontWeight: 600,\n color: 'var(--theme-elevation-800)',\n }}\n >\n {label}\n </label>\n\n {description && (\n <div\n style={{\n fontSize: '12px',\n color: 'var(--theme-elevation-500)',\n marginBottom: '8px',\n }}\n >\n {description}\n </div>\n )}\n\n <select\n value={value || ''}\n onChange={(e) => handleChange(e.target.value)}\n style={{\n width: '100%',\n padding: '10px 12px',\n borderRadius: '6px',\n border: '1px solid var(--theme-elevation-200)',\n backgroundColor: 'var(--theme-input-bg)',\n color: 'var(--theme-elevation-800)',\n fontSize: '14px',\n cursor: 'pointer',\n }}\n >\n <option value=\"\">Select a theme...</option>\n {options.map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </select>\n\n {/* Show color swatches for selected theme */}\n {selectedOption && (\n <div\n style={{\n marginTop: '12px',\n padding: '12px',\n borderRadius: '8px',\n backgroundColor: 'var(--theme-elevation-50)',\n border: '1px solid var(--theme-elevation-200)',\n }}\n >\n <div\n style={{\n fontSize: '12px',\n fontWeight: 600,\n marginBottom: '8px',\n color: 'var(--theme-elevation-700)',\n }}\n >\n {selectedOption.label}\n </div>\n <div\n style={{\n display: 'flex',\n gap: '8px',\n alignItems: 'center',\n }}\n >\n {getPresetColors(selectedOption.value).map((color, index) => (\n <div\n key={`${selectedOption.value}-${index}`}\n style={{\n width: '32px',\n height: '32px',\n borderRadius: '6px',\n backgroundColor: color,\n border: '1px solid rgba(0, 0, 0, 0.1)',\n boxShadow: '0 2px 4px rgba(0, 0, 0, 0.05)',\n }}\n title={color}\n />\n ))}\n </div>\n <div\n style={{\n marginTop: '8px',\n fontSize: '11px',\n color: 'var(--theme-elevation-500)',\n }}\n >\n ✅ All colors auto-populated from this theme\n </div>\n </div>\n )}\n </div>\n )\n}\n\nexport default ExtendedThemeAutoPopulateField\n"],"names":["useField","useForm","useCallback","useEffect","useRef","allExtendedThemePresets","ExtendedThemeAutoPopulateField","field","path","value","setValue","dispatchFields","hasInitializedRef","options","selectedOption","find","opt","applyThemePreset","presetKey","preset","Object","entries","styles","light","forEach","key","colorValue","type","dark","handleChange","newValue","current","getPresetColors","presetValue","colors","primary","secondary","accent","background","foreground","filter","Boolean","slice","label","en","cs","description","admin","div","style","marginBottom","display","fontSize","fontWeight","color","select","onChange","e","target","width","padding","borderRadius","border","backgroundColor","cursor","option","map","marginTop","gap","alignItems","index","height","boxShadow","title"],"mappings":"AAAA;;AAEA,SAASA,QAAQ,EAAEC,OAAO,QAAQ,iBAAgB;AAElD,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ,QAAO;AACtD,SAASC,uBAAuB,QAAQ,yBAAwB;AAEhE;;;;;;;CAOC,GACD,MAAMC,iCAA6D,CAAC,EAAEC,KAAK,EAAEC,IAAI,EAAE;IACjF,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGV,SAAiB;QAAEQ;IAAK;IAC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ACC,MAACkC;gBACCC,OAAO;oBACLkB,WAAW;oBACXP,SAAS;oBACTC,cAAc;oBACdE,iBAAiB;oBACjBD,QAAQ;gBACV;;kCAEA,KAACd;wBACCC,OAAO;4BACLG,UAAU;4BACVC,YAAY;4BACZH,cAAc;4BACdI,OAAO;wBACT;kCAECxC,eAAe6B,KAAK;;kCAEvB,KAACK;wBACCC,OAAO;4BACLE,SAAS;4BACTiB,KAAK;4BACLC,YAAY;wBACd;kCAECrC,gBAAgBlB,eAAeL,KAAK,EAAEyD,GAAG,CAAC,CAACZ,OAAOgB,sBACjD,KAACtB;gCAECC,OAAO;oCACLU,OAAO;oCACPY,QAAQ;oCACRV,cAAc;oCACdE,iBAAiBT;oCACjBQ,QAAQ;oCACRU,WAAW;gCACb;gCACAC,OAAOnB;+BATF,GAAGxC,eAAeL,KAAK,CAAC,CAAC,EAAE6D,OAAO;;kCAa7C,KAACtB;wBACCC,OAAO;4BACLkB,WAAW;4BACXf,UAAU;4BACVE,OAAO;wBACT;kCACD;;;;;;AAOX;AAEA,eAAehD,+BAA8B"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeColorPickerField.d.ts","sourceRoot":"","sources":["../../src/fields/ThemeColorPickerField.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAqGvD,QAAA,MAAM,qBAAqB,EAAE,wBA2O5B,CAAA;AAED,eAAe,qBAAqB,CAAA"}
1
+ {"version":3,"file":"ThemeColorPickerField.d.ts","sourceRoot":"","sources":["../../src/fields/ThemeColorPickerField.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAqGvD,QAAA,MAAM,qBAAqB,EAAE,wBAwQ5B,CAAA;AAED,eAAe,qBAAqB,CAAA"}
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Drawer, useField, useFormFields, useModal } from '@payloadcms/ui';
3
+ import { useField, useFormFields } from '@payloadcms/ui';
4
4
  import { HexColorInput, HexColorPicker } from 'react-colorful';
5
- import { useCallback, useEffect, useMemo, useState } from 'react';
5
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
6
6
  // Import CSS only in browser environment
7
7
  // This prevents Node.js from trying to import CSS directly
8
8
  // which causes ERR_UNKNOWN_FILE_EXTENSION error
@@ -89,19 +89,32 @@ const ThemeColorPickerField = ({ field, path })=>{
89
89
  path
90
90
  });
91
91
  const [localValue, setLocalValue] = useState(value || '');
92
- const { openModal, closeModal } = useModal();
92
+ const [showPicker, setShowPicker] = useState(false);
93
93
  const [hexValue, setHexValue] = useState(toHex(value || ''));
94
+ const pickerRef = useRef(null);
94
95
  const allFields = useFormFields(([fields])=>fields);
95
96
  const mode = path.includes('lightMode') ? 'lightMode' : 'darkMode';
96
97
  const modePrefix = `themeConfiguration.${mode}`;
97
- // Generate unique drawer slug for this color picker instance
98
- const drawerSlug = `color-picker-${path.replace(/\./g, '-')}`;
99
98
  useEffect(()=>{
100
99
  setLocalValue(value || '');
101
100
  setHexValue(toHex(value || ''));
102
101
  }, [
103
102
  value
104
103
  ]);
104
+ // Close picker when clicking outside
105
+ useEffect(()=>{
106
+ function handleClickOutside(event) {
107
+ if (pickerRef.current && !pickerRef.current.contains(event.target)) {
108
+ setShowPicker(false);
109
+ }
110
+ }
111
+ if (showPicker) {
112
+ document.addEventListener('mousedown', handleClickOutside);
113
+ return ()=>document.removeEventListener('mousedown', handleClickOutside);
114
+ }
115
+ }, [
116
+ showPicker
117
+ ]);
105
118
  const colorValues = useMemo(()=>{
106
119
  if (!allFields) {
107
120
  return {};
@@ -172,6 +185,9 @@ const ThemeColorPickerField = ({ field, path })=>{
172
185
  }),
173
186
  /*#__PURE__*/ _jsxs("div", {
174
187
  className: "color-picker-container",
188
+ style: {
189
+ position: 'relative'
190
+ },
175
191
  children: [
176
192
  /*#__PURE__*/ _jsxs("div", {
177
193
  className: "color-input-wrapper",
@@ -182,7 +198,7 @@ const ThemeColorPickerField = ({ field, path })=>{
182
198
  style: {
183
199
  backgroundColor: hexValue
184
200
  },
185
- onClick: ()=>openModal(drawerSlug),
201
+ onClick: ()=>setShowPicker(!showPicker),
186
202
  "aria-label": "Open color picker"
187
203
  }),
188
204
  /*#__PURE__*/ _jsx("input", {
@@ -194,111 +210,119 @@ const ThemeColorPickerField = ({ field, path })=>{
194
210
  })
195
211
  ]
196
212
  }),
197
- /*#__PURE__*/ _jsx(Drawer, {
198
- slug: drawerSlug,
199
- title: `Choose ${label}`,
200
- children: /*#__PURE__*/ _jsxs("div", {
201
- style: {
202
- padding: '20px'
203
- },
204
- children: [
205
- /*#__PURE__*/ _jsx(HexColorPicker, {
206
- color: hexValue,
207
- onChange: handleHexChange,
208
- style: {
209
- width: '100%',
210
- height: '220px'
211
- }
212
- }),
213
- /*#__PURE__*/ _jsxs("div", {
214
- style: {
215
- marginTop: '16px',
216
- display: 'flex',
217
- gap: '12px',
218
- alignItems: 'center'
219
- },
220
- children: [
221
- /*#__PURE__*/ _jsx(HexColorInput, {
222
- color: hexValue,
223
- onChange: handleHexChange,
224
- prefixed: true,
225
- placeholder: "#000000",
226
- style: {
227
- flex: 1,
228
- padding: '10px',
229
- borderRadius: '6px',
230
- border: '1px solid var(--theme-elevation-150)',
231
- fontSize: '14px',
232
- fontFamily: 'monospace'
233
- }
234
- }),
235
- /*#__PURE__*/ _jsx("button", {
236
- type: "button",
237
- onClick: ()=>closeModal(drawerSlug),
238
- style: {
239
- padding: '10px 20px',
240
- borderRadius: '6px',
241
- border: 'none',
242
- backgroundColor: 'var(--theme-elevation-500)',
243
- color: 'var(--theme-elevation-0)',
244
- cursor: 'pointer',
245
- fontWeight: 600
246
- },
247
- children: "Done"
248
- })
249
- ]
250
- }),
251
- /*#__PURE__*/ _jsxs("div", {
252
- style: {
253
- marginTop: '16px'
254
- },
255
- children: [
256
- /*#__PURE__*/ _jsx("div", {
257
- style: {
258
- fontSize: '12px',
259
- fontWeight: 600,
260
- marginBottom: '8px',
261
- color: 'var(--theme-elevation-500)'
262
- },
263
- children: "Quick Colors"
264
- }),
265
- /*#__PURE__*/ _jsx("div", {
266
- style: {
267
- display: 'grid',
268
- gridTemplateColumns: 'repeat(8, 1fr)',
269
- gap: '8px'
270
- },
271
- children: [
272
- '#ef4444',
273
- '#f97316',
274
- '#f59e0b',
275
- '#84cc16',
276
- '#10b981',
277
- '#06b6d4',
278
- '#3b82f6',
279
- '#8b5cf6',
280
- '#ec4899',
281
- '#64748b',
282
- '#000000',
283
- '#ffffff'
284
- ].map((color)=>/*#__PURE__*/ _jsx("button", {
285
- type: "button",
286
- onClick: ()=>handleHexChange(color),
287
- style: {
288
- width: '100%',
289
- height: '32px',
290
- borderRadius: '4px',
291
- border: hexValue.toLowerCase() === color.toLowerCase() ? '2px solid var(--theme-elevation-800)' : '1px solid var(--theme-elevation-150)',
292
- backgroundColor: color,
293
- cursor: 'pointer'
294
- },
295
- "aria-label": `Select ${color}`
296
- }, color))
297
- })
298
- ]
299
- })
300
- ]
301
- })
213
+ showPicker && /*#__PURE__*/ _jsxs("div", {
214
+ ref: pickerRef,
215
+ style: {
216
+ position: 'absolute',
217
+ top: '100%',
218
+ left: 0,
219
+ marginTop: '8px',
220
+ padding: '16px',
221
+ backgroundColor: 'var(--theme-elevation-0)',
222
+ border: '1px solid var(--theme-elevation-200)',
223
+ borderRadius: '8px',
224
+ boxShadow: '0 8px 24px rgba(15, 23, 42, 0.15)',
225
+ zIndex: 1000,
226
+ width: '280px'
227
+ },
228
+ children: [
229
+ /*#__PURE__*/ _jsx(HexColorPicker, {
230
+ color: hexValue,
231
+ onChange: handleHexChange,
232
+ style: {
233
+ width: '100%',
234
+ height: '160px'
235
+ }
236
+ }),
237
+ /*#__PURE__*/ _jsxs("div", {
238
+ style: {
239
+ marginTop: '12px',
240
+ display: 'flex',
241
+ gap: '8px',
242
+ alignItems: 'center'
243
+ },
244
+ children: [
245
+ /*#__PURE__*/ _jsx(HexColorInput, {
246
+ color: hexValue,
247
+ onChange: handleHexChange,
248
+ prefixed: true,
249
+ placeholder: "#000000",
250
+ style: {
251
+ flex: 1,
252
+ padding: '8px',
253
+ borderRadius: '4px',
254
+ border: '1px solid var(--theme-elevation-150)',
255
+ fontSize: '13px',
256
+ fontFamily: 'monospace'
257
+ }
258
+ }),
259
+ /*#__PURE__*/ _jsx("button", {
260
+ type: "button",
261
+ onClick: ()=>setShowPicker(false),
262
+ style: {
263
+ padding: '8px 14px',
264
+ borderRadius: '4px',
265
+ border: 'none',
266
+ backgroundColor: 'var(--theme-elevation-500)',
267
+ color: 'var(--theme-elevation-0)',
268
+ cursor: 'pointer',
269
+ fontSize: '12px',
270
+ fontWeight: 600
271
+ },
272
+ children: "OK"
273
+ })
274
+ ]
275
+ }),
276
+ /*#__PURE__*/ _jsxs("div", {
277
+ style: {
278
+ marginTop: '12px'
279
+ },
280
+ children: [
281
+ /*#__PURE__*/ _jsx("div", {
282
+ style: {
283
+ fontSize: '11px',
284
+ fontWeight: 600,
285
+ marginBottom: '6px',
286
+ color: 'var(--theme-elevation-500)'
287
+ },
288
+ children: "Rychlé barvy"
289
+ }),
290
+ /*#__PURE__*/ _jsx("div", {
291
+ style: {
292
+ display: 'grid',
293
+ gridTemplateColumns: 'repeat(6, 1fr)',
294
+ gap: '6px'
295
+ },
296
+ children: [
297
+ '#ef4444',
298
+ '#f97316',
299
+ '#f59e0b',
300
+ '#84cc16',
301
+ '#10b981',
302
+ '#06b6d4',
303
+ '#3b82f6',
304
+ '#8b5cf6',
305
+ '#ec4899',
306
+ '#64748b',
307
+ '#000000',
308
+ '#ffffff'
309
+ ].map((color)=>/*#__PURE__*/ _jsx("button", {
310
+ type: "button",
311
+ onClick: ()=>handleHexChange(color),
312
+ style: {
313
+ width: '100%',
314
+ height: '28px',
315
+ borderRadius: '4px',
316
+ border: hexValue.toLowerCase() === color.toLowerCase() ? '2px solid var(--theme-elevation-800)' : '1px solid var(--theme-elevation-150)',
317
+ backgroundColor: color,
318
+ cursor: 'pointer'
319
+ },
320
+ "aria-label": `Select ${color}`
321
+ }, color))
322
+ })
323
+ ]
324
+ })
325
+ ]
302
326
  }),
303
327
  /*#__PURE__*/ _jsx("div", {
304
328
  className: "color-preview",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/fields/ThemeColorPickerField.tsx"],"sourcesContent":["'use client'\n\nimport { Drawer, useField, useFormFields, useModal } from '@payloadcms/ui'\nimport type { TextFieldClientComponent } from 'payload'\nimport { HexColorInput, HexColorPicker } from 'react-colorful'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\n\n// Import CSS only in browser environment\n// This prevents Node.js from trying to import CSS directly\n// which causes ERR_UNKNOWN_FILE_EXTENSION error\nif (typeof window !== 'undefined') {\n // @ts-expect-error - Dynamic import of CSS is not recognized by TypeScript\n import('./ThemeColorPickerField.css').catch((err) => {\n console.warn('Failed to load CSS file:', err)\n })\n}\n\nfunction resolveLocalizedValue(value: unknown, fallback: string) {\n if (typeof value === 'string') {\n return value\n }\n\n if (typeof value === 'object' && value !== null) {\n const localized = value as Record<string, unknown>\n const resolved = localized.en ?? localized.cs ?? localized['']\n if (typeof resolved === 'string') {\n return resolved\n }\n }\n\n return fallback\n}\n\n/**\n * Convert various color formats to HEX for the color picker\n */\nfunction toHex(color: string): string {\n if (!color) return '#000000'\n\n // Already hex\n if (color.startsWith('#')) return color\n\n // OKLCH format - extract hue and convert to approximate hex\n if (color.startsWith('oklch')) {\n // For now, return a default - proper conversion requires color-conversion library\n return '#3b82f6' // blue-500 as default\n }\n\n // HSL format\n if (color.startsWith('hsl')) {\n const regex = /hsl\\((\\d+),\\s*(\\d+)%,\\s*(\\d+)%\\)/\n const match = regex.exec(color)\n if (match) {\n const [, h, s, l] = match.map(Number)\n return hslToHex(h, s, l)\n }\n }\n\n return '#000000'\n}\n\n/**\n * Convert HSL to HEX\n */\nfunction hslToHex(h: number, s: number, l: number): string {\n s /= 100\n l /= 100\n\n const c = (1 - Math.abs(2 * l - 1)) * s\n const x = c * (1 - Math.abs(((h / 60) % 2) - 1))\n const m = l - c / 2\n\n let r = 0\n let g = 0\n let b = 0\n\n if (h >= 0 && h < 60) {\n r = c\n g = x\n } else if (h >= 60 && h < 120) {\n r = x\n g = c\n } else if (h >= 120 && h < 180) {\n g = c\n b = x\n } else if (h >= 180 && h < 240) {\n g = x\n b = c\n } else if (h >= 240 && h < 300) {\n r = x\n b = c\n } else if (h >= 300 && h < 360) {\n r = c\n b = x\n }\n\n const toHex = (n: number) => {\n const hex = Math.round((n + m) * 255).toString(16)\n return hex.length === 1 ? '0' + hex : hex\n }\n\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`\n}\n\nconst ThemeColorPickerField: TextFieldClientComponent = ({ field, path }) => {\n const { value, setValue } = useField<string>({ path })\n const [localValue, setLocalValue] = useState(value || '')\n const { openModal, closeModal } = useModal()\n const [hexValue, setHexValue] = useState(toHex(value || ''))\n const allFields = useFormFields(([fields]) => fields)\n\n const mode = path.includes('lightMode') ? 'lightMode' : 'darkMode'\n const modePrefix = `themeConfiguration.${mode}`\n\n // Generate unique drawer slug for this color picker instance\n const drawerSlug = `color-picker-${path.replace(/\\./g, '-')}`\n\n useEffect(() => {\n setLocalValue(value || '')\n setHexValue(toHex(value || ''))\n }, [value])\n\n const colorValues = useMemo(() => {\n if (!allFields) {\n return {}\n }\n\n const names = [\n 'background',\n 'foreground',\n 'card',\n 'cardForeground',\n 'popover',\n 'popoverForeground',\n 'primary',\n 'primaryForeground',\n 'secondary',\n 'secondaryForeground',\n 'muted',\n 'mutedForeground',\n 'accent',\n 'accentForeground',\n 'destructive',\n 'destructiveForeground',\n 'border',\n 'input',\n 'ring',\n ]\n\n return names.reduce<Record<string, string>>((accumulator, name) => {\n const fieldState = allFields[`${modePrefix}.${name}`]\n const parsedValue = typeof fieldState?.value === 'string' ? fieldState.value : undefined\n accumulator[name] = parsedValue ?? ''\n return accumulator\n }, {})\n }, [allFields, modePrefix])\n\n const handleHexChange = useCallback(\n (hex: string) => {\n setHexValue(hex)\n setLocalValue(hex)\n setValue(hex)\n },\n [setValue],\n )\n\n const handleTextChange = useCallback(\n (nextValue: string) => {\n setLocalValue(nextValue)\n setValue(nextValue)\n setHexValue(toHex(nextValue))\n },\n [setValue],\n )\n\n const fieldName = path.split('.').pop() || ''\n const label = resolveLocalizedValue(field.label, fieldName)\n const description = resolveLocalizedValue(field.admin?.description, '')\n\n return (\n <div className=\"theme-color-picker-field\">\n <div className=\"field-header\">\n <label className=\"field-label\">{label}</label>\n {description && <div className=\"field-description\">{description}</div>}\n </div>\n\n <div className=\"color-picker-container\">\n <div className=\"color-input-wrapper\">\n <button\n type=\"button\"\n className=\"color-swatch\"\n style={{ backgroundColor: hexValue }}\n onClick={() => openModal(drawerSlug)}\n aria-label=\"Open color picker\"\n />\n <input\n type=\"text\"\n value={localValue || ''}\n onChange={(event) => handleTextChange(event.target.value)}\n placeholder=\"oklch(...) or #hex\"\n className=\"text-input\"\n />\n </div>\n\n {/* Color Picker Modal Drawer */}\n <Drawer slug={drawerSlug} title={`Choose ${label}`}>\n <div style={{ padding: '20px' }}>\n <HexColorPicker\n color={hexValue}\n onChange={handleHexChange}\n style={{ width: '100%', height: '220px' }}\n />\n <div style={{ marginTop: '16px', display: 'flex', gap: '12px', alignItems: 'center' }}>\n <HexColorInput\n color={hexValue}\n onChange={handleHexChange}\n prefixed\n placeholder=\"#000000\"\n style={{\n flex: 1,\n padding: '10px',\n borderRadius: '6px',\n border: '1px solid var(--theme-elevation-150)',\n fontSize: '14px',\n fontFamily: 'monospace',\n }}\n />\n <button\n type=\"button\"\n onClick={() => closeModal(drawerSlug)}\n style={{\n padding: '10px 20px',\n borderRadius: '6px',\n border: 'none',\n backgroundColor: 'var(--theme-elevation-500)',\n color: 'var(--theme-elevation-0)',\n cursor: 'pointer',\n fontWeight: 600,\n }}\n >\n Done\n </button>\n </div>\n\n {/* Quick Color Swatches */}\n <div style={{ marginTop: '16px' }}>\n <div\n style={{\n fontSize: '12px',\n fontWeight: 600,\n marginBottom: '8px',\n color: 'var(--theme-elevation-500)',\n }}\n >\n Quick Colors\n </div>\n <div style={{ display: 'grid', gridTemplateColumns: 'repeat(8, 1fr)', gap: '8px' }}>\n {[\n '#ef4444',\n '#f97316',\n '#f59e0b',\n '#84cc16',\n '#10b981',\n '#06b6d4',\n '#3b82f6',\n '#8b5cf6',\n '#ec4899',\n '#64748b',\n '#000000',\n '#ffffff',\n ].map((color) => (\n <button\n key={color}\n type=\"button\"\n onClick={() => handleHexChange(color)}\n style={{\n width: '100%',\n height: '32px',\n borderRadius: '4px',\n border:\n hexValue.toLowerCase() === color.toLowerCase()\n ? '2px solid var(--theme-elevation-800)'\n : '1px solid var(--theme-elevation-150)',\n backgroundColor: color,\n cursor: 'pointer',\n }}\n aria-label={`Select ${color}`}\n />\n ))}\n </div>\n </div>\n </div>\n </Drawer>\n\n <div className=\"color-preview\" style={{ backgroundColor: hexValue }}>\n <span className=\"preview-label\">{localValue || 'Not set'}</span>\n </div>\n </div>\n\n {(fieldName === 'primary' || fieldName === 'background') && (\n <div\n className=\"mini-preview\"\n style={{\n backgroundColor: colorValues.background || '#ffffff',\n color: colorValues.foreground || '#000000',\n borderColor: colorValues.border || '#e2e8f0',\n }}\n >\n <div\n className=\"preview-card\"\n style={{\n backgroundColor: colorValues.card || '#ffffff',\n color: colorValues.cardForeground || '#000000',\n borderColor: colorValues.border || '#e2e8f0',\n }}\n >\n <button\n className=\"preview-button\"\n style={{\n backgroundColor: colorValues.primary || '#0070f3',\n color: colorValues.primaryForeground || '#ffffff',\n }}\n >\n Primary Button\n </button>\n <button\n className=\"preview-button secondary\"\n style={{\n backgroundColor: colorValues.secondary || '#f1f5f9',\n color: colorValues.secondaryForeground || '#0f172a',\n }}\n >\n Secondary\n </button>\n </div>\n </div>\n )}\n </div>\n )\n}\n\nexport default ThemeColorPickerField\n"],"names":["Drawer","useField","useFormFields","useModal","HexColorInput","HexColorPicker","useCallback","useEffect","useMemo","useState","window","catch","err","console","warn","resolveLocalizedValue","value","fallback","localized","resolved","en","cs","toHex","color","startsWith","regex","match","exec","h","s","l","map","Number","hslToHex","c","Math","abs","x","m","r","g","b","n","hex","round","toString","length","ThemeColorPickerField","field","path","setValue","localValue","setLocalValue","openModal","closeModal","hexValue","setHexValue","allFields","fields","mode","includes","modePrefix","drawerSlug","replace","colorValues","names","reduce","accumulator","name","fieldState","parsedValue","undefined","handleHexChange","handleTextChange","nextValue","fieldName","split","pop","label","description","admin","div","className","button","type","style","backgroundColor","onClick","aria-label","input","onChange","event","target","placeholder","slug","title","padding","width","height","marginTop","display","gap","alignItems","prefixed","flex","borderRadius","border","fontSize","fontFamily","cursor","fontWeight","marginBottom","gridTemplateColumns","toLowerCase","span","background","foreground","borderColor","card","cardForeground","primary","primaryForeground","secondary","secondaryForeground"],"mappings":"AAAA;;AAEA,SAASA,MAAM,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,QAAQ,QAAQ,iBAAgB;AAE1E,SAASC,aAAa,EAAEC,cAAc,QAAQ,iBAAgB;AAC9D,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AAEjE,yCAAyC;AACzC,2DAA2D;AAC3D,gDAAgD;AAChD,IAAI,OAAOC,WAAW,aAAa;IACjC,2EAA2E;IAC3E,MAAM,CAAC,+BAA+BC,KAAK,CAAC,CAACC;QAC3CC,QAAQC,IAAI,CAAC,4BAA4BF;IAC3C;AACF;AAEA,SAASG,sBAAsBC,KAAc,EAAEC,QAAgB;IAC7D,IAAI,OAAOD,UAAU,UAAU;QAC7B,OAAOA;IACT;IAEA,IAAI,OAAOA,UAAU,YAAYA,UAAU,MAAM;QAC/C,MAAME,YAAYF;QAClB,MAAMG,WAAWD,UAAUE,EAAE,IAAIF,UAAUG,EAAE,IAAIH,SAAS,CAAC,GAAG;QAC9D,IAAI,OAAOC,aAAa,UAAU;YAChC,OAAOA;QACT;IACF;IAEA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AAO;4BAAEC,iBAAiB/B;wBAAS;kCAChE,cAAA,KAAC2D;4BAAKhC,WAAU;sCAAiB/B,cAAc;;;;;YAIjDwB,CAAAA,cAAc,aAAaA,cAAc,YAAW,mBACpD,KAACM;gBACCC,WAAU;gBACVG,OAAO;oBACLC,iBAAiBtB,YAAYmD,UAAU,IAAI;oBAC3C5F,OAAOyC,YAAYoD,UAAU,IAAI;oBACjCC,aAAarD,YAAY0C,MAAM,IAAI;gBACrC;0BAEA,cAAA,MAACzB;oBACCC,WAAU;oBACVG,OAAO;wBACLC,iBAAiBtB,YAAYsD,IAAI,IAAI;wBACrC/F,OAAOyC,YAAYuD,cAAc,IAAI;wBACrCF,aAAarD,YAAY0C,MAAM,IAAI;oBACrC;;sCAEA,KAACvB;4BACCD,WAAU;4BACVG,OAAO;gCACLC,iBAAiBtB,YAAYwD,OAAO,IAAI;gCACxCjG,OAAOyC,YAAYyD,iBAAiB,IAAI;4BAC1C;sCACD;;sCAGD,KAACtC;4BACCD,WAAU;4BACVG,OAAO;gCACLC,iBAAiBtB,YAAY0D,SAAS,IAAI;gCAC1CnG,OAAOyC,YAAY2D,mBAAmB,IAAI;4BAC5C;sCACD;;;;;;;AAQb;AAEA,eAAe5E,sBAAqB"}
1
+ {"version":3,"sources":["../../src/fields/ThemeColorPickerField.tsx"],"sourcesContent":["'use client'\n\nimport { useField, useFormFields } from '@payloadcms/ui'\nimport type { TextFieldClientComponent } from 'payload'\nimport { HexColorInput, HexColorPicker } from 'react-colorful'\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\n\n// Import CSS only in browser environment\n// This prevents Node.js from trying to import CSS directly\n// which causes ERR_UNKNOWN_FILE_EXTENSION error\nif (typeof window !== 'undefined') {\n // @ts-expect-error - Dynamic import of CSS is not recognized by TypeScript\n import('./ThemeColorPickerField.css').catch((err) => {\n console.warn('Failed to load CSS file:', err)\n })\n}\n\nfunction resolveLocalizedValue(value: unknown, fallback: string) {\n if (typeof value === 'string') {\n return value\n }\n\n if (typeof value === 'object' && value !== null) {\n const localized = value as Record<string, unknown>\n const resolved = localized.en ?? localized.cs ?? localized['']\n if (typeof resolved === 'string') {\n return resolved\n }\n }\n\n return fallback\n}\n\n/**\n * Convert various color formats to HEX for the color picker\n */\nfunction toHex(color: string): string {\n if (!color) return '#000000'\n\n // Already hex\n if (color.startsWith('#')) return color\n\n // OKLCH format - extract hue and convert to approximate hex\n if (color.startsWith('oklch')) {\n // For now, return a default - proper conversion requires color-conversion library\n return '#3b82f6' // blue-500 as default\n }\n\n // HSL format\n if (color.startsWith('hsl')) {\n const regex = /hsl\\((\\d+),\\s*(\\d+)%,\\s*(\\d+)%\\)/\n const match = regex.exec(color)\n if (match) {\n const [, h, s, l] = match.map(Number)\n return hslToHex(h, s, l)\n }\n }\n\n return '#000000'\n}\n\n/**\n * Convert HSL to HEX\n */\nfunction hslToHex(h: number, s: number, l: number): string {\n s /= 100\n l /= 100\n\n const c = (1 - Math.abs(2 * l - 1)) * s\n const x = c * (1 - Math.abs(((h / 60) % 2) - 1))\n const m = l - c / 2\n\n let r = 0\n let g = 0\n let b = 0\n\n if (h >= 0 && h < 60) {\n r = c\n g = x\n } else if (h >= 60 && h < 120) {\n r = x\n g = c\n } else if (h >= 120 && h < 180) {\n g = c\n b = x\n } else if (h >= 180 && h < 240) {\n g = x\n b = c\n } else if (h >= 240 && h < 300) {\n r = x\n b = c\n } else if (h >= 300 && h < 360) {\n r = c\n b = x\n }\n\n const toHex = (n: number) => {\n const hex = Math.round((n + m) * 255).toString(16)\n return hex.length === 1 ? '0' + hex : hex\n }\n\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`\n}\n\nconst ThemeColorPickerField: TextFieldClientComponent = ({ field, path }) => {\n const { value, setValue } = useField<string>({ path })\n const [localValue, setLocalValue] = useState(value || '')\n const [showPicker, setShowPicker] = useState(false)\n const [hexValue, setHexValue] = useState(toHex(value || ''))\n const pickerRef = useRef<HTMLDivElement>(null)\n const allFields = useFormFields(([fields]) => fields)\n\n const mode = path.includes('lightMode') ? 'lightMode' : 'darkMode'\n const modePrefix = `themeConfiguration.${mode}`\n\n useEffect(() => {\n setLocalValue(value || '')\n setHexValue(toHex(value || ''))\n }, [value])\n\n // Close picker when clicking outside\n useEffect(() => {\n function handleClickOutside(event: MouseEvent) {\n if (pickerRef.current && !pickerRef.current.contains(event.target as Node)) {\n setShowPicker(false)\n }\n }\n\n if (showPicker) {\n document.addEventListener('mousedown', handleClickOutside)\n return () => document.removeEventListener('mousedown', handleClickOutside)\n }\n }, [showPicker])\n\n const colorValues = useMemo(() => {\n if (!allFields) {\n return {}\n }\n\n const names = [\n 'background',\n 'foreground',\n 'card',\n 'cardForeground',\n 'popover',\n 'popoverForeground',\n 'primary',\n 'primaryForeground',\n 'secondary',\n 'secondaryForeground',\n 'muted',\n 'mutedForeground',\n 'accent',\n 'accentForeground',\n 'destructive',\n 'destructiveForeground',\n 'border',\n 'input',\n 'ring',\n ]\n\n return names.reduce<Record<string, string>>((accumulator, name) => {\n const fieldState = allFields[`${modePrefix}.${name}`]\n const parsedValue = typeof fieldState?.value === 'string' ? fieldState.value : undefined\n accumulator[name] = parsedValue ?? ''\n return accumulator\n }, {})\n }, [allFields, modePrefix])\n\n const handleHexChange = useCallback(\n (hex: string) => {\n setHexValue(hex)\n setLocalValue(hex)\n setValue(hex)\n },\n [setValue],\n )\n\n const handleTextChange = useCallback(\n (nextValue: string) => {\n setLocalValue(nextValue)\n setValue(nextValue)\n setHexValue(toHex(nextValue))\n },\n [setValue],\n )\n\n const fieldName = path.split('.').pop() || ''\n const label = resolveLocalizedValue(field.label, fieldName)\n const description = resolveLocalizedValue(field.admin?.description, '')\n\n return (\n <div className=\"theme-color-picker-field\">\n <div className=\"field-header\">\n <label className=\"field-label\">{label}</label>\n {description && <div className=\"field-description\">{description}</div>}\n </div>\n\n <div className=\"color-picker-container\" style={{ position: 'relative' }}>\n <div className=\"color-input-wrapper\">\n <button\n type=\"button\"\n className=\"color-swatch\"\n style={{ backgroundColor: hexValue }}\n onClick={() => setShowPicker(!showPicker)}\n aria-label=\"Open color picker\"\n />\n <input\n type=\"text\"\n value={localValue || ''}\n onChange={(event) => handleTextChange(event.target.value)}\n placeholder=\"oklch(...) or #hex\"\n className=\"text-input\"\n />\n </div>\n\n {/* Compact Color Picker Popover */}\n {showPicker && (\n <div\n ref={pickerRef}\n style={{\n position: 'absolute',\n top: '100%',\n left: 0,\n marginTop: '8px',\n padding: '16px',\n backgroundColor: 'var(--theme-elevation-0)',\n border: '1px solid var(--theme-elevation-200)',\n borderRadius: '8px',\n boxShadow: '0 8px 24px rgba(15, 23, 42, 0.15)',\n zIndex: 1000,\n width: '280px',\n }}\n >\n <HexColorPicker\n color={hexValue}\n onChange={handleHexChange}\n style={{ width: '100%', height: '160px' }}\n />\n\n <div style={{ marginTop: '12px', display: 'flex', gap: '8px', alignItems: 'center' }}>\n <HexColorInput\n color={hexValue}\n onChange={handleHexChange}\n prefixed\n placeholder=\"#000000\"\n style={{\n flex: 1,\n padding: '8px',\n borderRadius: '4px',\n border: '1px solid var(--theme-elevation-150)',\n fontSize: '13px',\n fontFamily: 'monospace',\n }}\n />\n <button\n type=\"button\"\n onClick={() => setShowPicker(false)}\n style={{\n padding: '8px 14px',\n borderRadius: '4px',\n border: 'none',\n backgroundColor: 'var(--theme-elevation-500)',\n color: 'var(--theme-elevation-0)',\n cursor: 'pointer',\n fontSize: '12px',\n fontWeight: 600,\n }}\n >\n OK\n </button>\n </div>\n\n {/* Quick Color Swatches */}\n <div style={{ marginTop: '12px' }}>\n <div\n style={{\n fontSize: '11px',\n fontWeight: 600,\n marginBottom: '6px',\n color: 'var(--theme-elevation-500)',\n }}\n >\n Rychlé barvy\n </div>\n <div style={{ display: 'grid', gridTemplateColumns: 'repeat(6, 1fr)', gap: '6px' }}>\n {[\n '#ef4444',\n '#f97316',\n '#f59e0b',\n '#84cc16',\n '#10b981',\n '#06b6d4',\n '#3b82f6',\n '#8b5cf6',\n '#ec4899',\n '#64748b',\n '#000000',\n '#ffffff',\n ].map((color) => (\n <button\n key={color}\n type=\"button\"\n onClick={() => handleHexChange(color)}\n style={{\n width: '100%',\n height: '28px',\n borderRadius: '4px',\n border:\n hexValue.toLowerCase() === color.toLowerCase()\n ? '2px solid var(--theme-elevation-800)'\n : '1px solid var(--theme-elevation-150)',\n backgroundColor: color,\n cursor: 'pointer',\n }}\n aria-label={`Select ${color}`}\n />\n ))}\n </div>\n </div>\n </div>\n )}\n\n <div className=\"color-preview\" style={{ backgroundColor: hexValue }}>\n <span className=\"preview-label\">{localValue || 'Not set'}</span>\n </div>\n </div>\n\n {(fieldName === 'primary' || fieldName === 'background') && (\n <div\n className=\"mini-preview\"\n style={{\n backgroundColor: colorValues.background || '#ffffff',\n color: colorValues.foreground || '#000000',\n borderColor: colorValues.border || '#e2e8f0',\n }}\n >\n <div\n className=\"preview-card\"\n style={{\n backgroundColor: colorValues.card || '#ffffff',\n color: colorValues.cardForeground || '#000000',\n borderColor: colorValues.border || '#e2e8f0',\n }}\n >\n <button\n className=\"preview-button\"\n style={{\n backgroundColor: colorValues.primary || '#0070f3',\n color: colorValues.primaryForeground || '#ffffff',\n }}\n >\n Primary Button\n </button>\n <button\n className=\"preview-button secondary\"\n style={{\n backgroundColor: colorValues.secondary || '#f1f5f9',\n color: colorValues.secondaryForeground || '#0f172a',\n }}\n >\n Secondary\n </button>\n </div>\n </div>\n )}\n </div>\n )\n}\n\nexport default ThemeColorPickerField\n"],"names":["useField","useFormFields","HexColorInput","HexColorPicker","useCallback","useEffect","useMemo","useRef","useState","window","catch","err","console","warn","resolveLocalizedValue","value","fallback","localized","resolved","en","cs","toHex","color","startsWith","regex","match","exec","h","s","l","map","Number","hslToHex","c","Math","abs","x","m","r","g","b","n","hex","round","toString","length","ThemeColorPickerField","field","path","setValue","localValue","setLocalValue","showPicker","setShowPicker","hexValue","setHexValue","pickerRef","allFields","fields","mode","includes","modePrefix","handleClickOutside","event","current","contains","target","document","addEventListener","removeEventListener","colorValues","names","reduce","accumulator","name","fieldState","parsedValue","undefined","handleHexChange","handleTextChange","nextValue","fieldName","split","pop","label","description","admin","div","className","style","position","button","type","backgroundColor","onClick","aria-label","input","onChange","placeholder","ref","top","left","marginTop","padding","border","borderRadius","boxShadow","zIndex","width","height","display","gap","alignItems","prefixed","flex","fontSize","fontFamily","cursor","fontWeight","marginBottom","gridTemplateColumns","toLowerCase","span","background","foreground","borderColor","card","cardForeground","primary","primaryForeground","secondary","secondaryForeground"],"mappings":"AAAA;;AAEA,SAASA,QAAQ,EAAEC,aAAa,QAAQ,iBAAgB;AAExD,SAASC,aAAa,EAAEC,cAAc,QAAQ,iBAAgB;AAC9D,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAEzE,yCAAyC;AACzC,2DAA2D;AAC3D,gDAAgD;AAChD,IAAI,OAAOC,WAAW,aAAa;IACjC,2EAA2E;IAC3E,MAAM,CAAC,+BAA+BC,KAAK,CAAC,CAACC;QAC3CC,QAAQC,IAAI,CAAC,4BAA4BF;IAC3C;AACF;AAEA,SAASG,sBAAsBC,KAAc,EAAEC,QAAgB;IAC7D,IAAI,OAAOD,UAAU,UAAU;QAC7B,OAAOA;IACT;IAEA,IAAI,OAAOA,UAAU,YAAYA,UAAU,MAAM;QAC/C,MAAME,YAAYF;QAClB,MAAMG,WAAWD,UAAUE,EAAE,IAAIF,UAAUG,EAAE,IAAIH,SAAS,CAAC,GAAG;QAC9D,IAAI,OAAOC,aAAa,UAAU;YAChC,OAAOA;QACT;IACF;IAEA,OAAOF;AACT;AAEA;;CAEC,GACD,SAASK,MAAMC,KAAa;IAC1B,IAAI,CAACA,OAAO,OAAO;IAEnB,cAAc;IACd,IAAIA,MAAMC,UAAU,CAAC,MAAM,OAAOD;IAElC,4DAA4D;IAC5D,IAAIA,MAAMC,UAAU,CAAC,UAAU;QAC7B,kFAAkF;QAClF,OAAO,UAAU,sBAAsB;;IACzC;IAEA,aAAa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iBAAiBvE;oDACjB+F,QAAQ;gDACV;gDACAtB,cAAY,CAAC,OAAO,EAAEzE,OAAO;+CAdxBA;;;;;;kCAsBjB,KAACiE;wBAAIC,WAAU;wBAAgBC,OAAO;4BAAEI,iBAAiBvC;wBAAS;kCAChE,cAAA,KAACoE;4BAAKlC,WAAU;sCAAiBtC,cAAc;;;;;YAIjD+B,CAAAA,cAAc,aAAaA,cAAc,YAAW,mBACpD,KAACM;gBACCC,WAAU;gBACVC,OAAO;oBACLI,iBAAiBvB,YAAYqD,UAAU,IAAI;oBAC3CrG,OAAOgD,YAAYsD,UAAU,IAAI;oBACjCC,aAAavD,YAAYkC,MAAM,IAAI;gBACrC;0BAEA,cAAA,MAACjB;oBACCC,WAAU;oBACVC,OAAO;wBACLI,iBAAiBvB,YAAYwD,IAAI,IAAI;wBACrCxG,OAAOgD,YAAYyD,cAAc,IAAI;wBACrCF,aAAavD,YAAYkC,MAAM,IAAI;oBACrC;;sCAEA,KAACb;4BACCH,WAAU;4BACVC,OAAO;gCACLI,iBAAiBvB,YAAY0D,OAAO,IAAI;gCACxC1G,OAAOgD,YAAY2D,iBAAiB,IAAI;4BAC1C;sCACD;;sCAGD,KAACtC;4BACCH,WAAU;4BACVC,OAAO;gCACLI,iBAAiBvB,YAAY4D,SAAS,IAAI;gCAC1C5G,OAAOgD,YAAY6D,mBAAmB,IAAI;4BAC5C;sCACD;;;;;;;AAQb;AAEA,eAAerF,sBAAqB"}
@@ -28,7 +28,8 @@ export declare const advancedTypographyFields: Field[];
28
28
  */
29
29
  export declare const designSystemFields: Field[];
30
30
  /**
31
- * Extended Theme Selection Field with Visual Preview
31
+ * Extended Theme Selection Field with Visual Preview and Auto-Population
32
+ * Automatically fills all color fields when a theme is selected
32
33
  */
33
34
  export declare const extendedThemeSelectionField: Field;
34
35
  /**