gdp-color-picker 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -28
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +1 -1
- package/dist/index.modern.mjs.map +1 -1
- package/dist/index.module.js +1 -1
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -4
- package/src/lib/ColorBoard.js +23 -16
- package/src/lib/ColorInput.js +167 -77
- package/src/lib/Sliders.js +19 -22
- package/src/lib/index.css +302 -47
- package/src/lib/index.js +375 -50
- package/src/lib/utils/color.js +88 -93
package/src/lib/index.css
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
.color-picker-panel {
|
|
3
|
-
width:
|
|
4
|
-
padding: 8px;
|
|
2
|
+
width: 222px;
|
|
3
|
+
padding: 0 8px 8px 8px;
|
|
5
4
|
background: #fff;
|
|
6
5
|
border-radius: 4px;
|
|
7
6
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
8
7
|
user-select: none;
|
|
9
8
|
}
|
|
10
9
|
|
|
11
|
-
/* ColorBoard */
|
|
12
10
|
.color-board {
|
|
13
11
|
position: relative;
|
|
14
12
|
width: 100%;
|
|
@@ -47,7 +45,6 @@
|
|
|
47
45
|
pointer-events: none;
|
|
48
46
|
}
|
|
49
47
|
|
|
50
|
-
/* Sliders */
|
|
51
48
|
.color-slider {
|
|
52
49
|
position: relative;
|
|
53
50
|
width: 100%;
|
|
@@ -67,29 +64,32 @@
|
|
|
67
64
|
transform: translate(-50%, -50%);
|
|
68
65
|
box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
|
|
69
66
|
pointer-events: none;
|
|
70
|
-
border: 1px solid rgba(0,0,0,0.1);
|
|
67
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
71
68
|
}
|
|
72
69
|
|
|
73
70
|
.hue-slider {
|
|
74
|
-
background: linear-gradient(
|
|
71
|
+
background: linear-gradient(
|
|
72
|
+
to right,
|
|
73
|
+
red 0%,
|
|
74
|
+
#ff0 17%,
|
|
75
|
+
lime 33%,
|
|
76
|
+
cyan 50%,
|
|
77
|
+
blue 66%,
|
|
78
|
+
magenta 83%,
|
|
79
|
+
red 100%
|
|
80
|
+
);
|
|
75
81
|
}
|
|
76
82
|
|
|
77
83
|
.alpha-slider-bg {
|
|
78
|
-
background-image: url(
|
|
84
|
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCzekwMjDjZ1IxjJwApDkHN9Fi7xwAAAABJRU5ErkJggg==");
|
|
79
85
|
}
|
|
80
86
|
|
|
81
|
-
/* Inputs */
|
|
82
87
|
.color-input-container {
|
|
83
|
-
margin-top:
|
|
88
|
+
margin-top: 12px;
|
|
84
89
|
display: flex;
|
|
85
|
-
flex-direction:
|
|
86
|
-
gap: 8px;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.color-input-row {
|
|
90
|
-
display: flex;
|
|
91
|
-
justify-content: space-between;
|
|
90
|
+
flex-direction: row;
|
|
92
91
|
align-items: center;
|
|
92
|
+
gap: 8px;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
.mode-selector {
|
|
@@ -97,15 +97,22 @@
|
|
|
97
97
|
cursor: pointer;
|
|
98
98
|
font-size: 12px;
|
|
99
99
|
color: #333;
|
|
100
|
-
padding:
|
|
101
|
-
border
|
|
100
|
+
padding: 4px 8px;
|
|
101
|
+
border: 1px solid #d9d9d9;
|
|
102
|
+
border-radius: 4px;
|
|
102
103
|
user-select: none;
|
|
103
104
|
display: flex;
|
|
104
105
|
align-items: center;
|
|
106
|
+
justify-content: space-between;
|
|
107
|
+
min-width: 60px;
|
|
108
|
+
height: 24px;
|
|
109
|
+
box-sizing: border-box;
|
|
110
|
+
background-color: #fff;
|
|
111
|
+
transition: all 0.3s;
|
|
105
112
|
}
|
|
106
113
|
|
|
107
114
|
.mode-selector:hover {
|
|
108
|
-
|
|
115
|
+
border-color: #4096ff;
|
|
109
116
|
}
|
|
110
117
|
|
|
111
118
|
.mode-dropdown {
|
|
@@ -114,58 +121,85 @@
|
|
|
114
121
|
left: 0;
|
|
115
122
|
background: #fff;
|
|
116
123
|
border: 1px solid #d9d9d9;
|
|
117
|
-
border-radius:
|
|
124
|
+
border-radius: 4px;
|
|
118
125
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
119
126
|
z-index: 10;
|
|
120
|
-
min-width:
|
|
127
|
+
min-width: 100%;
|
|
128
|
+
margin-top: 4px;
|
|
121
129
|
}
|
|
122
130
|
|
|
123
131
|
.mode-option {
|
|
124
|
-
padding:
|
|
132
|
+
padding: 5px 12px;
|
|
125
133
|
cursor: pointer;
|
|
134
|
+
font-size: 12px;
|
|
135
|
+
color: #333;
|
|
126
136
|
}
|
|
127
137
|
|
|
128
138
|
.mode-option:hover {
|
|
129
|
-
background: #
|
|
139
|
+
background: #f5f5f5;
|
|
130
140
|
}
|
|
131
141
|
|
|
132
|
-
.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
142
|
+
.color-input-fields {
|
|
143
|
+
display: flex;
|
|
144
|
+
gap: 6px;
|
|
145
|
+
flex: 1;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.hex-input-wrapper {
|
|
137
149
|
display: flex;
|
|
138
150
|
align-items: center;
|
|
151
|
+
border: 1px solid #d9d9d9;
|
|
152
|
+
border-radius: 4px;
|
|
153
|
+
padding: 0 8px;
|
|
154
|
+
flex: 1;
|
|
155
|
+
height: 24px;
|
|
156
|
+
box-sizing: border-box;
|
|
157
|
+
background: #fff;
|
|
158
|
+
transition: border-color 0.3s;
|
|
139
159
|
}
|
|
140
160
|
|
|
141
|
-
.
|
|
142
|
-
|
|
143
|
-
color: #
|
|
161
|
+
.hex-input-wrapper:hover,
|
|
162
|
+
.hex-input-wrapper:focus-within {
|
|
163
|
+
border-color: #4096ff;
|
|
144
164
|
}
|
|
145
165
|
|
|
146
|
-
.
|
|
147
|
-
|
|
148
|
-
|
|
166
|
+
.hex-prefix {
|
|
167
|
+
color: #bfbfbf;
|
|
168
|
+
margin-right: 4px;
|
|
169
|
+
font-size: 12px;
|
|
149
170
|
}
|
|
150
171
|
|
|
151
172
|
.color-input {
|
|
152
173
|
width: 100%;
|
|
153
|
-
padding:
|
|
174
|
+
padding: 2px 0;
|
|
154
175
|
border: 1px solid #d9d9d9;
|
|
155
|
-
border-radius:
|
|
176
|
+
border-radius: 4px;
|
|
156
177
|
font-size: 12px;
|
|
157
178
|
box-sizing: border-box;
|
|
179
|
+
text-align: center;
|
|
180
|
+
height: 24px;
|
|
181
|
+
color: #333;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.color-input.hex {
|
|
185
|
+
border: none;
|
|
186
|
+
text-align: left;
|
|
187
|
+
height: 20px;
|
|
188
|
+
outline: none;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.color-input:focus {
|
|
192
|
+
border-color: #4096ff;
|
|
193
|
+
outline: none;
|
|
158
194
|
}
|
|
159
195
|
|
|
160
|
-
/* Chrome, Safari, Edge, Opera - hide spin buttons */
|
|
161
196
|
.color-input::-webkit-outer-spin-button,
|
|
162
197
|
.color-input::-webkit-inner-spin-button {
|
|
163
198
|
-webkit-appearance: none;
|
|
164
199
|
margin: 0;
|
|
165
200
|
}
|
|
166
201
|
|
|
167
|
-
|
|
168
|
-
.color-input[type=number] {
|
|
202
|
+
.color-input[type="number"] {
|
|
169
203
|
-moz-appearance: textfield;
|
|
170
204
|
}
|
|
171
205
|
|
|
@@ -180,19 +214,240 @@
|
|
|
180
214
|
justify-content: center;
|
|
181
215
|
}
|
|
182
216
|
|
|
183
|
-
/* Trigger */
|
|
184
217
|
.color-picker-trigger {
|
|
185
|
-
display:
|
|
186
|
-
|
|
187
|
-
border: 1px solid
|
|
218
|
+
display: flex;
|
|
219
|
+
align-items: center;
|
|
220
|
+
border: 1px solid transparent;
|
|
188
221
|
border-radius: 4px;
|
|
189
222
|
cursor: pointer;
|
|
190
|
-
|
|
223
|
+
transition: all 0.3s;
|
|
224
|
+
margin-left: 6px;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.color-picker-trigger:hover {
|
|
228
|
+
background-color: rgba(0, 0, 0, 0.04);
|
|
191
229
|
}
|
|
192
230
|
|
|
193
231
|
.color-block {
|
|
232
|
+
width: 16px;
|
|
233
|
+
height: 16px;
|
|
234
|
+
border-radius: 4px;
|
|
235
|
+
box-shadow: 0 0 2px #c5c5c5;
|
|
236
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.color-picker-container {
|
|
240
|
+
display: inline-flex;
|
|
241
|
+
flex-direction: column;
|
|
242
|
+
align-items: flex-start;
|
|
243
|
+
gap: 8px;
|
|
244
|
+
font-family: Arial, "Microsoft Yahei", "Helvetica Neue", Helvetica, sans-serif;
|
|
245
|
+
font-size: 14px;
|
|
246
|
+
position: relative;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.color-picker-main-row {
|
|
250
|
+
display: flex;
|
|
251
|
+
align-items: center;
|
|
252
|
+
gap: 0px;
|
|
253
|
+
flex-wrap: nowrap;
|
|
254
|
+
width: 100%;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.color-picker-inline-presets {
|
|
258
|
+
margin-top: 8px;
|
|
259
|
+
width: 100%;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.presets-grid.inline {
|
|
263
|
+
display: grid;
|
|
264
|
+
gap: 8px;
|
|
265
|
+
padding: 4px;
|
|
266
|
+
grid-template-columns: repeat(7, 1fr);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.color-picker-tooltip-trigger {
|
|
270
|
+
position: relative;
|
|
271
|
+
display: inline-flex;
|
|
272
|
+
align-items: center;
|
|
273
|
+
gap: 8px;
|
|
274
|
+
border: 1px solid transparent;
|
|
275
|
+
border-radius: 4px;
|
|
276
|
+
transition: all 0.3s;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.tooltip-text {
|
|
280
|
+
visibility: hidden;
|
|
281
|
+
background-color: #000;
|
|
282
|
+
color: #fff;
|
|
283
|
+
text-align: center;
|
|
284
|
+
border-radius: 4px;
|
|
285
|
+
padding: 5px 8px;
|
|
286
|
+
position: absolute;
|
|
287
|
+
z-index: 1001;
|
|
288
|
+
bottom: 110%;
|
|
289
|
+
left: 77%;
|
|
290
|
+
transform: translateX(-50%);
|
|
291
|
+
opacity: 0;
|
|
292
|
+
transition: opacity 0.3s;
|
|
293
|
+
font-size: 12px;
|
|
294
|
+
white-space: nowrap;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.tooltip-text::after {
|
|
298
|
+
content: "";
|
|
299
|
+
position: absolute;
|
|
300
|
+
top: 100%;
|
|
301
|
+
left: 50%;
|
|
302
|
+
margin-left: -5px;
|
|
303
|
+
border-width: 5px;
|
|
304
|
+
border-style: solid;
|
|
305
|
+
border-color: #000 transparent transparent transparent;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.color-picker-trigger:hover .tooltip-text {
|
|
309
|
+
visibility: visible;
|
|
310
|
+
opacity: 1;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.color-picker-trigger.is-open .tooltip-text {
|
|
314
|
+
visibility: hidden;
|
|
315
|
+
opacity: 0;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.color-picker-label {
|
|
319
|
+
color: rgba(255, 255, 255, 0.65);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.color-picker-arrow {
|
|
323
|
+
margin-left: 6px;
|
|
324
|
+
color: #8c8c8c;
|
|
325
|
+
display: flex;
|
|
326
|
+
align-items: center;
|
|
327
|
+
transition: transform 0.3s;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.color-picker-arrow img {
|
|
331
|
+
width: 12px;
|
|
332
|
+
height: 12px;
|
|
333
|
+
display: block;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.color-picker-arrow.open {
|
|
337
|
+
transform: rotate(180deg);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.color-picker-input-wrapper {
|
|
341
|
+
position: relative;
|
|
342
|
+
display: inline-flex;
|
|
343
|
+
align-items: center;
|
|
344
|
+
flex-shrink: 0;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.color-picker-input-wrapper input {
|
|
348
|
+
width: 140px;
|
|
349
|
+
padding: 4px 22px 4px 8px;
|
|
350
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
351
|
+
border-radius: 4px;
|
|
352
|
+
outline: none;
|
|
353
|
+
font-size: 14px;
|
|
354
|
+
color: #fff;
|
|
355
|
+
background-color: transparent;
|
|
356
|
+
transition: border-color 0.3s;
|
|
357
|
+
font-family: Arial, "Microsoft Yahei", "Helvetica Neue", Helvetica, sans-serif;
|
|
358
|
+
height: 24px;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.color-picker-input-wrapper input:focus {
|
|
362
|
+
border-color: #1677ff;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.input-clear-icon {
|
|
366
|
+
position: absolute;
|
|
367
|
+
right: 6px;
|
|
368
|
+
top: 50%;
|
|
369
|
+
transform: translateY(-50%);
|
|
370
|
+
width: 12px;
|
|
371
|
+
height: 12px;
|
|
372
|
+
cursor: pointer;
|
|
373
|
+
opacity: 0.7;
|
|
374
|
+
transition: opacity 0.2s;
|
|
375
|
+
filter: invert(1);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.input-clear-icon:hover {
|
|
379
|
+
opacity: 1;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.color-picker-presets {
|
|
383
|
+
padding-bottom: 4px;
|
|
384
|
+
}
|
|
385
|
+
.color-picker-icon-right {
|
|
386
|
+
float: right;
|
|
387
|
+
display: flex;
|
|
388
|
+
align-items: center;
|
|
389
|
+
justify-content: center;
|
|
390
|
+
cursor: pointer;
|
|
391
|
+
transition: transform 0.2s;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.color-picker-icon-right:hover {
|
|
395
|
+
transform: scale(1.1);
|
|
396
|
+
}
|
|
397
|
+
.palette-section-title {
|
|
398
|
+
font-size: 12px;
|
|
399
|
+
color: #999;
|
|
400
|
+
margin-bottom: 5px;
|
|
401
|
+
margin-top: 5px;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.presets-grid {
|
|
405
|
+
display: grid;
|
|
406
|
+
gap: 8px;
|
|
407
|
+
padding: 4px;
|
|
408
|
+
grid-template-columns: repeat(7, 1fr);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.preset-item {
|
|
412
|
+
width: 24px;
|
|
413
|
+
height: 24px;
|
|
414
|
+
border-radius: 4px;
|
|
415
|
+
cursor: pointer;
|
|
416
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
417
|
+
transition: transform 0.1s, box-shadow 0.1s;
|
|
418
|
+
}
|
|
419
|
+
.preset-item-inner {
|
|
194
420
|
width: 20px;
|
|
195
421
|
height: 20px;
|
|
196
|
-
|
|
197
|
-
|
|
422
|
+
}
|
|
423
|
+
.preset-item:hover {
|
|
424
|
+
transform: scale(1.15);
|
|
425
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
426
|
+
z-index: 1;
|
|
427
|
+
}
|
|
428
|
+
.presets-collapse {
|
|
429
|
+
display: flex;
|
|
430
|
+
align-items: center;
|
|
431
|
+
justify-content: center;
|
|
432
|
+
cursor: pointer;
|
|
433
|
+
color: white;
|
|
434
|
+
font-size: 12px;
|
|
435
|
+
gap: 4px;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.collapse-arrow {
|
|
439
|
+
display: inline-block;
|
|
440
|
+
font-size: 10px;
|
|
441
|
+
transition: transform 0.25s ease, color 0.25s ease, opacity 0.25s ease;
|
|
442
|
+
opacity: 0.85;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.presets-collapse:hover .collapse-arrow {
|
|
446
|
+
color: #1677ff;
|
|
447
|
+
opacity: 1;
|
|
448
|
+
transform: translateY(1px);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.collapse-arrow.expanded {
|
|
452
|
+
transform: rotate(180deg);
|
|
198
453
|
}
|