@kilivi/payloadcms-theme-management 0.3.4 → 0.5.2
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/ThemeColorPickerField.css +197 -76
- package/dist/fields/ThemeColorPickerField.d.ts.map +1 -1
- package/dist/fields/ThemeColorPickerField.js +41 -171
- package/dist/fields/ThemeColorPickerField.js.map +1 -1
- package/dist/fields/ThemePreviewField.js +3 -3
- package/dist/fields/ThemePreviewField.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/presets.d.ts +1 -0
- package/dist/presets.d.ts.map +1 -1
- package/dist/presets.js +7 -0
- package/dist/presets.js.map +1 -1
- package/dist/utils/tweakcnConverter.d.ts +14 -0
- package/dist/utils/tweakcnConverter.d.ts.map +1 -0
- package/dist/utils/tweakcnConverter.js +131 -0
- package/dist/utils/tweakcnConverter.js.map +1 -0
- package/package.json +2 -2
|
@@ -1,138 +1,259 @@
|
|
|
1
|
+
/* Theme Color Picker Field Styles */
|
|
2
|
+
|
|
1
3
|
.theme-color-picker-field {
|
|
2
|
-
margin-bottom:
|
|
4
|
+
margin-bottom: 1.5rem;
|
|
3
5
|
}
|
|
4
6
|
|
|
7
|
+
/* Field Header */
|
|
5
8
|
.theme-color-picker-field .field-header {
|
|
6
|
-
margin-bottom: 0.
|
|
9
|
+
margin-bottom: 0.75rem;
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
.theme-color-picker-field .field-label {
|
|
10
13
|
display: block;
|
|
11
|
-
font-weight:
|
|
14
|
+
font-weight: 600;
|
|
12
15
|
font-size: 0.875rem;
|
|
13
|
-
color: var(--theme-text);
|
|
16
|
+
color: var(--theme-text, #1e293b);
|
|
14
17
|
margin-bottom: 0.25rem;
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
.theme-color-picker-field .field-description {
|
|
18
21
|
font-size: 0.75rem;
|
|
19
|
-
color: var(--theme-elevation-400);
|
|
22
|
+
color: var(--theme-elevation-400, #94a3b8);
|
|
20
23
|
margin-top: 0.25rem;
|
|
24
|
+
line-height: 1.4;
|
|
21
25
|
}
|
|
22
26
|
|
|
27
|
+
/* Color Picker Container */
|
|
23
28
|
.theme-color-picker-field .color-picker-container {
|
|
24
|
-
|
|
25
|
-
gap: 0.75rem;
|
|
26
|
-
align-items: center;
|
|
29
|
+
position: relative;
|
|
27
30
|
}
|
|
28
31
|
|
|
29
|
-
.theme-color-picker-field .color-input-
|
|
32
|
+
.theme-color-picker-field .color-input-row {
|
|
30
33
|
display: flex;
|
|
31
|
-
gap: 0.
|
|
32
|
-
|
|
34
|
+
gap: 0.625rem;
|
|
35
|
+
align-items: center;
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
border
|
|
38
|
+
/* Color Swatch Button */
|
|
39
|
+
.theme-color-picker-field .color-swatch-btn {
|
|
40
|
+
width: 48px;
|
|
41
|
+
height: 48px;
|
|
42
|
+
border: 2px solid var(--theme-elevation-200, #e2e8f0);
|
|
43
|
+
border-radius: 8px;
|
|
40
44
|
cursor: pointer;
|
|
41
|
-
|
|
45
|
+
transition: all 0.2s ease;
|
|
46
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
47
|
+
flex-shrink: 0;
|
|
42
48
|
}
|
|
43
49
|
|
|
44
|
-
.theme-color-picker-field .color-
|
|
45
|
-
border-color: var(--theme-elevation-400);
|
|
50
|
+
.theme-color-picker-field .color-swatch-btn:hover {
|
|
51
|
+
border-color: var(--theme-elevation-400, #94a3b8);
|
|
52
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
|
|
53
|
+
transform: scale(1.05);
|
|
46
54
|
}
|
|
47
55
|
|
|
48
|
-
.theme-color-picker-field .color-
|
|
49
|
-
outline: 2px solid var(--theme-elevation-500);
|
|
50
|
-
outline-offset:
|
|
56
|
+
.theme-color-picker-field .color-swatch-btn:focus {
|
|
57
|
+
outline: 2px solid var(--theme-elevation-500, #3b82f6);
|
|
58
|
+
outline-offset: 2px;
|
|
51
59
|
}
|
|
52
60
|
|
|
53
|
-
|
|
61
|
+
/* Text Input */
|
|
62
|
+
.theme-color-picker-field .color-text-input {
|
|
54
63
|
flex: 1;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
border:
|
|
58
|
-
border-radius: 4px;
|
|
59
|
-
font-family: monospace;
|
|
64
|
+
padding: 0.625rem 0.875rem;
|
|
65
|
+
border: 1px solid var(--theme-elevation-200, #e2e8f0);
|
|
66
|
+
border-radius: 6px;
|
|
60
67
|
font-size: 0.875rem;
|
|
61
|
-
|
|
62
|
-
color: var(--theme-text);
|
|
68
|
+
font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
|
|
69
|
+
color: var(--theme-text, #1e293b);
|
|
70
|
+
background: var(--theme-elevation-0, #ffffff);
|
|
71
|
+
transition: all 0.2s ease;
|
|
63
72
|
}
|
|
64
73
|
|
|
65
|
-
.theme-color-picker-field .text-input:hover {
|
|
66
|
-
border-color: var(--theme-elevation-
|
|
74
|
+
.theme-color-picker-field .color-text-input:hover {
|
|
75
|
+
border-color: var(--theme-elevation-300, #cbd5e1);
|
|
67
76
|
}
|
|
68
77
|
|
|
69
|
-
.theme-color-picker-field .text-input:focus {
|
|
70
|
-
outline:
|
|
71
|
-
|
|
72
|
-
|
|
78
|
+
.theme-color-picker-field .color-text-input:focus {
|
|
79
|
+
outline: none;
|
|
80
|
+
border-color: var(--theme-elevation-500, #3b82f6);
|
|
81
|
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
|
73
82
|
}
|
|
74
83
|
|
|
75
|
-
.theme-color-picker-field .text-input::placeholder {
|
|
76
|
-
color: var(--theme-elevation-400);
|
|
84
|
+
.theme-color-picker-field .color-text-input::placeholder {
|
|
85
|
+
color: var(--theme-elevation-400, #94a3b8);
|
|
86
|
+
opacity: 0.7;
|
|
77
87
|
}
|
|
78
88
|
|
|
79
|
-
|
|
80
|
-
|
|
89
|
+
/* Color Picker Popover */
|
|
90
|
+
.theme-color-picker-field .color-picker-popover {
|
|
91
|
+
position: absolute;
|
|
92
|
+
top: calc(100% + 0.5rem);
|
|
93
|
+
left: 0;
|
|
94
|
+
padding: 1rem;
|
|
95
|
+
background: var(--theme-elevation-0, #ffffff);
|
|
96
|
+
border: 1px solid var(--theme-elevation-200, #e2e8f0);
|
|
97
|
+
border-radius: 12px;
|
|
98
|
+
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
99
|
+
z-index: 1000;
|
|
100
|
+
width: 280px;
|
|
101
|
+
animation: slideDown 0.2s ease;
|
|
81
102
|
}
|
|
82
103
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
104
|
+
@keyframes slideDown {
|
|
105
|
+
from {
|
|
106
|
+
opacity: 0;
|
|
107
|
+
transform: translateY(-8px);
|
|
108
|
+
}
|
|
109
|
+
to {
|
|
110
|
+
opacity: 1;
|
|
111
|
+
transform: translateY(0);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Picker Header */
|
|
116
|
+
.theme-color-picker-field .picker-header {
|
|
117
|
+
display: flex;
|
|
118
|
+
justify-content: space-between;
|
|
119
|
+
align-items: center;
|
|
120
|
+
margin-bottom: 0.875rem;
|
|
121
|
+
padding-bottom: 0.75rem;
|
|
122
|
+
border-bottom: 1px solid var(--theme-elevation-150, #f1f5f9);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.theme-color-picker-field .picker-title {
|
|
126
|
+
font-size: 0.875rem;
|
|
127
|
+
font-weight: 600;
|
|
128
|
+
color: var(--theme-text, #1e293b);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.theme-color-picker-field .picker-close-btn {
|
|
88
132
|
display: flex;
|
|
89
133
|
align-items: center;
|
|
90
134
|
justify-content: center;
|
|
91
|
-
|
|
135
|
+
width: 24px;
|
|
136
|
+
height: 24px;
|
|
137
|
+
border: none;
|
|
138
|
+
background: transparent;
|
|
139
|
+
color: var(--theme-elevation-400, #94a3b8);
|
|
140
|
+
cursor: pointer;
|
|
141
|
+
border-radius: 4px;
|
|
142
|
+
font-size: 1.125rem;
|
|
143
|
+
line-height: 1;
|
|
144
|
+
transition: all 0.15s ease;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.theme-color-picker-field .picker-close-btn:hover {
|
|
148
|
+
background: var(--theme-elevation-100, #f8fafc);
|
|
149
|
+
color: var(--theme-text, #1e293b);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* Hex Picker */
|
|
153
|
+
.theme-color-picker-field .hex-picker {
|
|
154
|
+
width: 100%;
|
|
155
|
+
height: 160px;
|
|
156
|
+
border-radius: 8px;
|
|
92
157
|
overflow: hidden;
|
|
93
158
|
}
|
|
94
159
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
padding: 0.25rem 0.5rem;
|
|
99
|
-
background: rgba(255, 255, 255, 0.9);
|
|
100
|
-
border-radius: 2px;
|
|
101
|
-
backdrop-filter: blur(4px);
|
|
102
|
-
color: #000;
|
|
103
|
-
font-weight: 500;
|
|
160
|
+
/* Hex Input Row */
|
|
161
|
+
.theme-color-picker-field .hex-input-row {
|
|
162
|
+
margin-top: 0.875rem;
|
|
104
163
|
}
|
|
105
164
|
|
|
106
|
-
.theme-color-picker-field .
|
|
107
|
-
|
|
108
|
-
padding:
|
|
165
|
+
.theme-color-picker-field .hex-input {
|
|
166
|
+
width: 100%;
|
|
167
|
+
padding: 0.625rem 0.875rem;
|
|
168
|
+
border: 1px solid var(--theme-elevation-150, #f1f5f9);
|
|
109
169
|
border-radius: 6px;
|
|
110
|
-
|
|
170
|
+
font-size: 0.8125rem;
|
|
171
|
+
font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
|
|
172
|
+
text-align: center;
|
|
173
|
+
color: var(--theme-text, #1e293b);
|
|
174
|
+
background: var(--theme-elevation-50, #f8fafc);
|
|
175
|
+
transition: all 0.15s ease;
|
|
111
176
|
}
|
|
112
177
|
|
|
113
|
-
.theme-color-picker-field .
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
178
|
+
.theme-color-picker-field .hex-input:hover {
|
|
179
|
+
border-color: var(--theme-elevation-200, #e2e8f0);
|
|
180
|
+
background: var(--theme-elevation-0, #ffffff);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.theme-color-picker-field .hex-input:focus {
|
|
184
|
+
outline: none;
|
|
185
|
+
border-color: var(--theme-elevation-500, #3b82f6);
|
|
186
|
+
background: var(--theme-elevation-0, #ffffff);
|
|
187
|
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* Color Swatches */
|
|
191
|
+
.theme-color-picker-field .color-swatches {
|
|
192
|
+
margin-top: 1rem;
|
|
193
|
+
padding-top: 1rem;
|
|
194
|
+
border-top: 1px solid var(--theme-elevation-150, #f1f5f9);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.theme-color-picker-field .swatches-label {
|
|
198
|
+
font-size: 0.6875rem;
|
|
199
|
+
font-weight: 600;
|
|
200
|
+
text-transform: uppercase;
|
|
201
|
+
letter-spacing: 0.05em;
|
|
202
|
+
color: var(--theme-elevation-500, #64748b);
|
|
203
|
+
margin-bottom: 0.625rem;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.theme-color-picker-field .swatches-grid {
|
|
207
|
+
display: grid;
|
|
208
|
+
grid-template-columns: repeat(6, 1fr);
|
|
118
209
|
gap: 0.5rem;
|
|
119
|
-
flex-wrap: wrap;
|
|
120
210
|
}
|
|
121
211
|
|
|
122
|
-
.theme-color-picker-field .
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
border:
|
|
126
|
-
|
|
127
|
-
font-weight: 500;
|
|
212
|
+
.theme-color-picker-field .swatch-btn {
|
|
213
|
+
width: 100%;
|
|
214
|
+
aspect-ratio: 1;
|
|
215
|
+
border: 1.5px solid var(--theme-elevation-150, #f1f5f9);
|
|
216
|
+
border-radius: 6px;
|
|
128
217
|
cursor: pointer;
|
|
129
|
-
transition:
|
|
218
|
+
transition: all 0.15s ease;
|
|
219
|
+
position: relative;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.theme-color-picker-field .swatch-btn:hover {
|
|
223
|
+
border-color: var(--theme-elevation-300, #cbd5e1);
|
|
224
|
+
transform: scale(1.1);
|
|
225
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.theme-color-picker-field .swatch-btn.selected {
|
|
229
|
+
border: 2px solid var(--theme-elevation-800, #1e293b);
|
|
230
|
+
box-shadow: 0 0 0 2px var(--theme-elevation-0, #ffffff),
|
|
231
|
+
0 0 0 4px var(--theme-elevation-800, #1e293b);
|
|
232
|
+
transform: scale(1.05);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.theme-color-picker-field .swatch-btn:focus {
|
|
236
|
+
outline: 2px solid var(--theme-elevation-500, #3b82f6);
|
|
237
|
+
outline-offset: 2px;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/* React Colorful Overrides */
|
|
241
|
+
.theme-color-picker-field .react-colorful {
|
|
242
|
+
border-radius: 8px;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.theme-color-picker-field .react-colorful__saturation {
|
|
246
|
+
border-radius: 8px 8px 0 0;
|
|
130
247
|
}
|
|
131
248
|
|
|
132
|
-
.theme-color-picker-field .
|
|
133
|
-
|
|
249
|
+
.theme-color-picker-field .react-colorful__hue {
|
|
250
|
+
border-radius: 0 0 8px 8px;
|
|
251
|
+
height: 12px;
|
|
134
252
|
}
|
|
135
253
|
|
|
136
|
-
.theme-color-picker-field .
|
|
137
|
-
|
|
254
|
+
.theme-color-picker-field .react-colorful__pointer {
|
|
255
|
+
width: 20px;
|
|
256
|
+
height: 20px;
|
|
257
|
+
border: 2px solid #ffffff;
|
|
258
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
|
|
138
259
|
}
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"ThemeColorPickerField.d.ts","sourceRoot":"","sources":["../../src/fields/ThemeColorPickerField.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAiGvD,QAAA,MAAM,qBAAqB,EAAE,wBAsI5B,CAAA;AAED,eAAe,qBAAqB,CAAA"}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useField
|
|
3
|
+
import { useField } from '@payloadcms/ui';
|
|
4
4
|
import { HexColorInput, HexColorPicker } from 'react-colorful';
|
|
5
|
-
import { useCallback, useEffect,
|
|
6
|
-
// Import CSS
|
|
7
|
-
// This prevents Node.js from trying to import CSS directly
|
|
8
|
-
// which causes ERR_UNKNOWN_FILE_EXTENSION error
|
|
5
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
6
|
+
// Import CSS for styling
|
|
9
7
|
if (typeof window !== 'undefined') {
|
|
10
|
-
// @ts-expect-error - Dynamic
|
|
11
|
-
import('./ThemeColorPickerField.css').catch((
|
|
12
|
-
console.warn('Failed to load CSS file:', err);
|
|
13
|
-
});
|
|
8
|
+
// @ts-expect-error - Dynamic CSS import
|
|
9
|
+
import('./ThemeColorPickerField.css').catch(()=>{});
|
|
14
10
|
}
|
|
15
11
|
function resolveLocalizedValue(value, fallback) {
|
|
16
12
|
if (typeof value === 'string') {
|
|
@@ -92,9 +88,6 @@ const ThemeColorPickerField = ({ field, path })=>{
|
|
|
92
88
|
const [showPicker, setShowPicker] = useState(false);
|
|
93
89
|
const [hexValue, setHexValue] = useState(toHex(value || ''));
|
|
94
90
|
const pickerRef = useRef(null);
|
|
95
|
-
const allFields = useFormFields(([fields])=>fields);
|
|
96
|
-
const mode = path.includes('lightMode') ? 'lightMode' : 'darkMode';
|
|
97
|
-
const modePrefix = `themeConfiguration.${mode}`;
|
|
98
91
|
useEffect(()=>{
|
|
99
92
|
setLocalValue(value || '');
|
|
100
93
|
setHexValue(toHex(value || ''));
|
|
@@ -115,41 +108,6 @@ const ThemeColorPickerField = ({ field, path })=>{
|
|
|
115
108
|
}, [
|
|
116
109
|
showPicker
|
|
117
110
|
]);
|
|
118
|
-
const colorValues = useMemo(()=>{
|
|
119
|
-
if (!allFields) {
|
|
120
|
-
return {};
|
|
121
|
-
}
|
|
122
|
-
const names = [
|
|
123
|
-
'background',
|
|
124
|
-
'foreground',
|
|
125
|
-
'card',
|
|
126
|
-
'cardForeground',
|
|
127
|
-
'popover',
|
|
128
|
-
'popoverForeground',
|
|
129
|
-
'primary',
|
|
130
|
-
'primaryForeground',
|
|
131
|
-
'secondary',
|
|
132
|
-
'secondaryForeground',
|
|
133
|
-
'muted',
|
|
134
|
-
'mutedForeground',
|
|
135
|
-
'accent',
|
|
136
|
-
'accentForeground',
|
|
137
|
-
'destructive',
|
|
138
|
-
'destructiveForeground',
|
|
139
|
-
'border',
|
|
140
|
-
'input',
|
|
141
|
-
'ring'
|
|
142
|
-
];
|
|
143
|
-
return names.reduce((accumulator, name)=>{
|
|
144
|
-
const fieldState = allFields[`${modePrefix}.${name}`];
|
|
145
|
-
const parsedValue = typeof fieldState?.value === 'string' ? fieldState.value : undefined;
|
|
146
|
-
accumulator[name] = parsedValue ?? '';
|
|
147
|
-
return accumulator;
|
|
148
|
-
}, {});
|
|
149
|
-
}, [
|
|
150
|
-
allFields,
|
|
151
|
-
modePrefix
|
|
152
|
-
]);
|
|
153
111
|
const handleHexChange = useCallback((hex)=>{
|
|
154
112
|
setHexValue(hex);
|
|
155
113
|
setLocalValue(hex);
|
|
@@ -185,114 +143,73 @@ const ThemeColorPickerField = ({ field, path })=>{
|
|
|
185
143
|
}),
|
|
186
144
|
/*#__PURE__*/ _jsxs("div", {
|
|
187
145
|
className: "color-picker-container",
|
|
188
|
-
style: {
|
|
189
|
-
position: 'relative'
|
|
190
|
-
},
|
|
191
146
|
children: [
|
|
192
147
|
/*#__PURE__*/ _jsxs("div", {
|
|
193
|
-
className: "color-input-
|
|
148
|
+
className: "color-input-row",
|
|
194
149
|
children: [
|
|
195
150
|
/*#__PURE__*/ _jsx("button", {
|
|
196
151
|
type: "button",
|
|
197
|
-
className: "color-swatch",
|
|
152
|
+
className: "color-swatch-btn",
|
|
198
153
|
style: {
|
|
199
154
|
backgroundColor: hexValue
|
|
200
155
|
},
|
|
201
156
|
onClick: ()=>setShowPicker(!showPicker),
|
|
202
|
-
"aria-label": "Open color picker"
|
|
157
|
+
"aria-label": "Open color picker",
|
|
158
|
+
title: hexValue
|
|
203
159
|
}),
|
|
204
160
|
/*#__PURE__*/ _jsx("input", {
|
|
205
161
|
type: "text",
|
|
206
162
|
value: localValue || '',
|
|
207
163
|
onChange: (event)=>handleTextChange(event.target.value),
|
|
208
164
|
placeholder: "oklch(...) or #hex",
|
|
209
|
-
className: "text-input"
|
|
165
|
+
className: "color-text-input"
|
|
210
166
|
})
|
|
211
167
|
]
|
|
212
168
|
}),
|
|
213
169
|
showPicker && /*#__PURE__*/ _jsxs("div", {
|
|
214
170
|
ref: pickerRef,
|
|
215
|
-
|
|
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
|
-
},
|
|
171
|
+
className: "color-picker-popover",
|
|
228
172
|
children: [
|
|
229
|
-
/*#__PURE__*/ _jsx(HexColorPicker, {
|
|
230
|
-
color: hexValue,
|
|
231
|
-
onChange: handleHexChange,
|
|
232
|
-
style: {
|
|
233
|
-
width: '100%',
|
|
234
|
-
height: '160px'
|
|
235
|
-
}
|
|
236
|
-
}),
|
|
237
173
|
/*#__PURE__*/ _jsxs("div", {
|
|
238
|
-
|
|
239
|
-
marginTop: '12px',
|
|
240
|
-
display: 'flex',
|
|
241
|
-
gap: '8px',
|
|
242
|
-
alignItems: 'center'
|
|
243
|
-
},
|
|
174
|
+
className: "picker-header",
|
|
244
175
|
children: [
|
|
245
|
-
/*#__PURE__*/ _jsx(
|
|
246
|
-
|
|
247
|
-
|
|
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
|
-
}
|
|
176
|
+
/*#__PURE__*/ _jsx("span", {
|
|
177
|
+
className: "picker-title",
|
|
178
|
+
children: "Color Picker"
|
|
258
179
|
}),
|
|
259
180
|
/*#__PURE__*/ _jsx("button", {
|
|
260
181
|
type: "button",
|
|
261
182
|
onClick: ()=>setShowPicker(false),
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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"
|
|
183
|
+
className: "picker-close-btn",
|
|
184
|
+
"aria-label": "Close",
|
|
185
|
+
children: "✕"
|
|
273
186
|
})
|
|
274
187
|
]
|
|
275
188
|
}),
|
|
189
|
+
/*#__PURE__*/ _jsx(HexColorPicker, {
|
|
190
|
+
color: hexValue,
|
|
191
|
+
onChange: handleHexChange,
|
|
192
|
+
className: "hex-picker"
|
|
193
|
+
}),
|
|
194
|
+
/*#__PURE__*/ _jsx("div", {
|
|
195
|
+
className: "hex-input-row",
|
|
196
|
+
children: /*#__PURE__*/ _jsx(HexColorInput, {
|
|
197
|
+
color: hexValue,
|
|
198
|
+
onChange: handleHexChange,
|
|
199
|
+
prefixed: true,
|
|
200
|
+
placeholder: "#000000",
|
|
201
|
+
className: "hex-input"
|
|
202
|
+
})
|
|
203
|
+
}),
|
|
276
204
|
/*#__PURE__*/ _jsxs("div", {
|
|
277
|
-
|
|
278
|
-
marginTop: '12px'
|
|
279
|
-
},
|
|
205
|
+
className: "color-swatches",
|
|
280
206
|
children: [
|
|
281
207
|
/*#__PURE__*/ _jsx("div", {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
fontWeight: 600,
|
|
285
|
-
marginBottom: '6px',
|
|
286
|
-
color: 'var(--theme-elevation-500)'
|
|
287
|
-
},
|
|
288
|
-
children: "Rychlé barvy"
|
|
208
|
+
className: "swatches-label",
|
|
209
|
+
children: "Quick Colors"
|
|
289
210
|
}),
|
|
290
211
|
/*#__PURE__*/ _jsx("div", {
|
|
291
|
-
|
|
292
|
-
display: 'grid',
|
|
293
|
-
gridTemplateColumns: 'repeat(6, 1fr)',
|
|
294
|
-
gap: '6px'
|
|
295
|
-
},
|
|
212
|
+
className: "swatches-grid",
|
|
296
213
|
children: [
|
|
297
214
|
'#ef4444',
|
|
298
215
|
'#f97316',
|
|
@@ -309,66 +226,19 @@ const ThemeColorPickerField = ({ field, path })=>{
|
|
|
309
226
|
].map((color)=>/*#__PURE__*/ _jsx("button", {
|
|
310
227
|
type: "button",
|
|
311
228
|
onClick: ()=>handleHexChange(color),
|
|
229
|
+
className: `swatch-btn ${hexValue.toLowerCase() === color.toLowerCase() ? 'selected' : ''}`,
|
|
312
230
|
style: {
|
|
313
|
-
|
|
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'
|
|
231
|
+
backgroundColor: color
|
|
319
232
|
},
|
|
320
|
-
"aria-label": `Select ${color}
|
|
233
|
+
"aria-label": `Select ${color}`,
|
|
234
|
+
title: color
|
|
321
235
|
}, color))
|
|
322
236
|
})
|
|
323
237
|
]
|
|
324
238
|
})
|
|
325
239
|
]
|
|
326
|
-
}),
|
|
327
|
-
/*#__PURE__*/ _jsx("div", {
|
|
328
|
-
className: "color-preview",
|
|
329
|
-
style: {
|
|
330
|
-
backgroundColor: hexValue
|
|
331
|
-
},
|
|
332
|
-
children: /*#__PURE__*/ _jsx("span", {
|
|
333
|
-
className: "preview-label",
|
|
334
|
-
children: localValue || 'Not set'
|
|
335
|
-
})
|
|
336
240
|
})
|
|
337
241
|
]
|
|
338
|
-
}),
|
|
339
|
-
(fieldName === 'primary' || fieldName === 'background') && /*#__PURE__*/ _jsx("div", {
|
|
340
|
-
className: "mini-preview",
|
|
341
|
-
style: {
|
|
342
|
-
backgroundColor: colorValues.background || '#ffffff',
|
|
343
|
-
color: colorValues.foreground || '#000000',
|
|
344
|
-
borderColor: colorValues.border || '#e2e8f0'
|
|
345
|
-
},
|
|
346
|
-
children: /*#__PURE__*/ _jsxs("div", {
|
|
347
|
-
className: "preview-card",
|
|
348
|
-
style: {
|
|
349
|
-
backgroundColor: colorValues.card || '#ffffff',
|
|
350
|
-
color: colorValues.cardForeground || '#000000',
|
|
351
|
-
borderColor: colorValues.border || '#e2e8f0'
|
|
352
|
-
},
|
|
353
|
-
children: [
|
|
354
|
-
/*#__PURE__*/ _jsx("button", {
|
|
355
|
-
className: "preview-button",
|
|
356
|
-
style: {
|
|
357
|
-
backgroundColor: colorValues.primary || '#0070f3',
|
|
358
|
-
color: colorValues.primaryForeground || '#ffffff'
|
|
359
|
-
},
|
|
360
|
-
children: "Primary Button"
|
|
361
|
-
}),
|
|
362
|
-
/*#__PURE__*/ _jsx("button", {
|
|
363
|
-
className: "preview-button secondary",
|
|
364
|
-
style: {
|
|
365
|
-
backgroundColor: colorValues.secondary || '#f1f5f9',
|
|
366
|
-
color: colorValues.secondaryForeground || '#0f172a'
|
|
367
|
-
},
|
|
368
|
-
children: "Secondary"
|
|
369
|
-
})
|
|
370
|
-
]
|
|
371
|
-
})
|
|
372
242
|
})
|
|
373
243
|
]
|
|
374
244
|
});
|