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 CHANGED
@@ -1,13 +1,21 @@
1
- # React Color Picker
1
+ # GDP Color Picker
2
2
 
3
- 一个支持 React 16.8+ (Hooks) 的轻量级调色盘组件,仿 Ant Design 风格。支持色相、饱和度、亮度、透明度调节,以及 Hex/RGBA 输入。
3
+ 一个支持 React 16.8+ (Hooks) 的功能丰富的调色盘组件。支持色相、饱和度、亮度、透明度调节,提供推荐色板与最近使用记录,并支持高度可配置的 UI 展现。
4
4
 
5
5
  ## 特性
6
6
 
7
- - 🎨 **仿 Ant Design 风格**:界面美观,交互流畅。
7
+ - 🎨 **完整色彩控制**:支持 HSV 拖拽、色相滑块、透明度滑块。
8
+ - 🔄 **多格式支持**:支持 Hex、RGB、HSL 格式切换及精确输入。
9
+ - 🌈 **智能色板**:
10
+ - **Recommended**:内置精选推荐色板,支持展开/收起(More/Less)。
11
+ - **Recent**:自动记录最近使用的 10 种颜色,方便快速复用。
12
+ - 🧪 **取色器支持**:内置 EyeDropper 取色按钮(兼容支持该 API 的浏览器),可直接从屏幕拾取颜色。
13
+ - 🛠 **高度可配置**:
14
+ - 可控制是否显示 "Color" 标签及文本内容。
15
+ - 可控制是否显示下拉箭头、外部输入框。
16
+ - 可控制是否显示内部高级颜色面板。
17
+ - 支持自定义预设颜色列表。
8
18
  - 📦 **零依赖**:核心逻辑自研,不依赖 heavy 的第三方库。
9
- - 📱 **响应式**:支持拖拽交互。
10
- - 🌈 **全功能**:支持 HSV 拖拽、色相滑块、透明度滑块、Hex/RGB/HSL 格式切换及输入、吸管取色。
11
19
  - ⚛️ **React 16.8+**:完全基于 Hooks 编写。
12
20
 
13
21
  ## 安装
@@ -20,52 +28,103 @@ yarn add gdp-color-picker
20
28
 
21
29
  ## 使用方法
22
30
 
31
+ ### 基础用法
32
+
33
+ 最简单的使用方式,仅需提供 `value` 和 `onChange`。
34
+
23
35
  ```jsx
24
- import React, { useState } from 'react';
25
- import ColorPicker from 'gdp-color-picker';
26
- import 'gdp-color-picker/dist/index.css'; // 引入样式
36
+ import React, { useState } from "react";
37
+ import ColorPicker from "gdp-color-picker";
38
+ import "gdp-color-picker/dist/index.css"; // 引入样式
27
39
 
28
40
  function App() {
29
- const [color, setColor] = useState('#1677ff');
41
+ const [color, setColor] = useState("");
30
42
 
31
43
  return (
32
- <ColorPicker
44
+ <ColorPicker
33
45
  value={color}
34
46
  onChange={(hex, rgbObj) => {
35
- // 如果需要透明度,建议使用 rgba 字符串
47
+ // rgbObj 包含 {r, g, b, a}
36
48
  if (rgbObj.a < 1) {
37
- setColor(`rgba(${rgbObj.r}, ${rgbObj.g}, ${rgbObj.b}, ${rgbObj.a.toFixed(2)})`);
49
+ setColor(
50
+ `rgba(${rgbObj.r}, ${rgbObj.g}, ${rgbObj.b}, ${rgbObj.a.toFixed(
51
+ 2
52
+ )})`
53
+ );
38
54
  } else {
39
55
  setColor(hex);
40
56
  }
41
- }}
57
+ }}
42
58
  />
43
59
  );
44
60
  }
45
61
  ```
46
62
 
63
+ ### 高级配置
64
+
65
+ 自定义 UI 显示元素和预设颜色。
66
+
67
+ ```jsx
68
+ <ColorPicker
69
+ value={color}
70
+ onChange={handleColorChange}
71
+ // UI 配置
72
+ label="背景色" // 自定义标签文本
73
+ showLabel={true} // 显示标签
74
+ showArrow={true} // 显示下拉箭头
75
+ showInput={true} // 显示外部 Hex 输入框
76
+ showColorBoard={true} // 显示内部高级颜色选择器(色盘+滑块)
77
+ // 自定义预设颜色
78
+ presets={[
79
+ "#FF0000",
80
+ "#00FF00",
81
+ "#0000FF",
82
+ "#FFFF00",
83
+ "#00FFFF",
84
+ "#FF00FF",
85
+ "#C0C0C0",
86
+ "#808080",
87
+ "#800000",
88
+ "#808000",
89
+ "#008000",
90
+ "#800080",
91
+ ]}
92
+ />
93
+ ```
94
+
95
+ ### 屏幕取色
96
+
97
+ 组件内置了基于 `EyeDropper` API 的取色按钮,位于弹层中 “Recommended” 标题右侧的小眼睛图标:
98
+
99
+ - 在支持 `window.EyeDropper` 的浏览器(如 Chrome / Edge 新版)中点击该图标,可在屏幕任意位置拾取颜色。
100
+ - 取色完成后,调色板会自动同步到拾取到的颜色并触发 `onChange`。
101
+
47
102
  ## API
48
103
 
49
- ### ColorPicker
104
+ ### ColorPicker Props
50
105
 
51
- | 属性 | 说明 | 类型 | 默认值 |
52
- | --- | --- | --- | --- |
53
- | value | 当前颜色值,支持 Hex (`#RRGGBB`, `#RGB`) 或 RGBA (`rgba(r, g, b, a)`) | `string` | `#1677ff` |
54
- | defaultValue | 默认颜色值(非受控模式) | `string` | `#1677ff` |
55
- | onChange | 颜色变化时的回调 | `(hex: string, rgbObj: {r, g, b, a}) => void` | - |
56
- | className | 自定义类名 | `string` | - |
57
- | style | 自定义样式 | `CSSProperties` | - |
106
+ | 属性 | 说明 | 类型 | 默认值 |
107
+ | ---------------- | ------------------------------------------------------------- | --------------------------------------------- | ----------------- |
108
+ | `value` | 当前颜色值,支持 Hex (`#RRGGBB`) 或 RGBA (`rgba(r, g, b, a)`) | `string` | - |
109
+ | `defaultValue` | 默认颜色值(非受控模式) | `string` | `#1677ff` |
110
+ | `onChange` | 颜色变化时的回调 | `(hex: string, rgbObj: {r, g, b, a}) => void` | - |
111
+ | `showLabel` | 是否显示左侧标签文本 | `boolean` | `true` |
112
+ | `label` | 左侧标签的文本内容 | `string` | `"Color"` |
113
+ | `showArrow` | 是否显示触发器右侧的下拉箭头 | `boolean` | `true` |
114
+ | `showInput` | 是否显示触发器右侧的 Hex 输入框(支持清除) | `boolean` | `true` |
115
+ | `showColorBoard` | 是否显示下拉面板内部的高级颜色选择器(色盘、滑块、模式输入) | `boolean` | `true` |
116
+ | `presets` | 自定义预设颜色数组。如果不传,将使用内置的 28 色推荐色板。 | `string[]` | `DEFAULT_PRESETS` |
58
117
 
59
118
  ### onChange 回调参数
60
119
 
61
- `onChange` 回调函数接收两个参数:
120
+ `onChange(hex, rgbObj)`
62
121
 
63
- 1. **hex**: `string` - 颜色的 Hex 字符串表示(例如 `#ff0000`)。注意:Hex 格式不支持透明度,如果需要处理透明度,请使用第二个参数。
64
- 2. **rgbObj**: `object` - 包含颜色详细信息的对象:
65
- * `r`: `number` (0-255) - 红色通道
66
- * `g`: `number` (0-255) - 绿色通道
67
- * `b`: `number` (0-255) - 蓝色通道
68
- * `a`: `number` (0-1) - Alpha 透明度
122
+ 1. **hex**: `string` - 颜色的 Hex 字符串表示(例如 `#ff0000`)。_注意:标准 Hex 格式不包含透明度信息。_
123
+ 2. **rgbObj**: `object` - 包含颜色详细信息的对象,推荐使用此对象处理透明度:
124
+ - `r`: `number` (0-255) - 红色通道
125
+ - `g`: `number` (0-255) - 绿色通道
126
+ - `b`: `number` (0-255) - 蓝色通道
127
+ - `a`: `number` (0-1) - Alpha 透明度
69
128
 
70
129
  ## 开发与构建
71
130
 
package/dist/index.css CHANGED
@@ -1,2 +1,2 @@
1
- .color-picker-panel{background:#fff;border-radius:4px;box-shadow:0 2px 8px #00000026;padding:8px;-webkit-user-select:none;user-select:none;width:200px}.color-board{border-radius:2px;cursor:pointer;height:150px;overflow:hidden;position:relative;width:100%}.color-board-white{background:linear-gradient(90deg,#fff,#fff0)}.color-board-black,.color-board-white{bottom:0;left:0;position:absolute;right:0;top:0}.color-board-black{background:linear-gradient(0deg,#000,#0000)}.color-board-handler{border:2px solid #fff;border-radius:50%;box-shadow:0 0 2px #00000080;height:10px;pointer-events:none;position:absolute;transform:translate(-50%,-50%);width:10px}.color-slider{border-radius:5px;cursor:pointer;height:10px;margin-top:8px;position:relative;width:100%}.color-slider-handler{background:#fff;border:1px solid #0000001a;border-radius:50%;box-shadow:0 0 2px #00000080;height:12px;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);width:12px}.hue-slider{background:linear-gradient(90deg,red 0,#ff0 17%,lime 33%,cyan 50%,blue 66%,#f0f 83%,red)}.alpha-slider-bg{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCzekwMjDjZ1IxjJwApDkHN9Fi7xwAAAABJRU5ErkJggg==")}.color-input-container{display:flex;flex-direction:column;gap:8px;margin-top:8px}.color-input-row{align-items:center;display:flex;justify-content:space-between}.mode-selector{align-items:center;border-radius:2px;color:#333;cursor:pointer;display:flex;font-size:12px;padding:2px 4px;position:relative;-webkit-user-select:none;user-select:none}.mode-selector:hover{background-color:#f5f5f5}.mode-dropdown{background:#fff;border:1px solid #d9d9d9;border-radius:2px;box-shadow:0 2px 8px #00000026;left:0;min-width:60px;position:absolute;top:100%;z-index:10}.mode-option{cursor:pointer;padding:4px 8px}.mode-option:hover{background:#e6f7ff}.eyedropper-icon{align-items:center;border-radius:2px;color:#666;cursor:pointer;display:flex;padding:2px}.eyedropper-icon:hover{background-color:#f5f5f5;color:#333}.color-input-fields{display:flex;gap:4px}.color-input{border:1px solid #d9d9d9;border-radius:2px;box-sizing:border-box;font-size:12px;padding:4px;width:100%}.color-input::-webkit-inner-spin-button,.color-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.color-input[type=number]{-moz-appearance:textfield}.alpha-display{align-items:center;background-color:#f5f5f5;border:1px solid #d9d9d9;color:#666;display:flex;justify-content:center;text-align:center;width:40px}.color-picker-trigger{background:#fff;border:1px solid #d9d9d9;border-radius:4px;cursor:pointer;display:inline-block;padding:4px}.color-block{border:1px solid #0000001a;border-radius:2px;height:20px;width:20px}
1
+ .color-picker-panel{background:#fff;border-radius:4px;box-shadow:0 2px 8px #00000026;padding:0 8px 8px;-webkit-user-select:none;user-select:none;width:222px}.color-board{border-radius:2px;cursor:pointer;height:150px;overflow:hidden;position:relative;width:100%}.color-board-white{background:linear-gradient(90deg,#fff,#fff0)}.color-board-black,.color-board-white{bottom:0;left:0;position:absolute;right:0;top:0}.color-board-black{background:linear-gradient(0deg,#000,#0000)}.color-board-handler{border:2px solid #fff;border-radius:50%;box-shadow:0 0 2px #00000080;height:10px;pointer-events:none;position:absolute;transform:translate(-50%,-50%);width:10px}.color-slider{border-radius:5px;cursor:pointer;height:10px;margin-top:8px;position:relative;width:100%}.color-slider-handler{background:#fff;border:1px solid #0000001a;border-radius:50%;box-shadow:0 0 2px #00000080;height:12px;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);width:12px}.hue-slider{background:linear-gradient(90deg,red 0,#ff0 17%,lime 33%,cyan 50%,blue 66%,#f0f 83%,red)}.alpha-slider-bg{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCzekwMjDjZ1IxjJwApDkHN9Fi7xwAAAABJRU5ErkJggg==")}.color-input-container{align-items:center;display:flex;flex-direction:row;gap:8px;margin-top:12px}.mode-selector{align-items:center;background-color:#fff;border:1px solid #d9d9d9;border-radius:4px;box-sizing:border-box;color:#333;cursor:pointer;display:flex;font-size:12px;height:24px;justify-content:space-between;min-width:60px;padding:4px 8px;position:relative;transition:all .3s;-webkit-user-select:none;user-select:none}.mode-selector:hover{border-color:#4096ff}.mode-dropdown{background:#fff;border:1px solid #d9d9d9;border-radius:4px;box-shadow:0 2px 8px #00000026;left:0;margin-top:4px;min-width:100%;position:absolute;top:100%;z-index:10}.mode-option{color:#333;cursor:pointer;font-size:12px;padding:5px 12px}.mode-option:hover{background:#f5f5f5}.color-input-fields{display:flex;flex:1;gap:6px}.hex-input-wrapper{align-items:center;background:#fff;border:1px solid #d9d9d9;border-radius:4px;box-sizing:border-box;display:flex;flex:1;height:24px;padding:0 8px;transition:border-color .3s}.hex-input-wrapper:focus-within,.hex-input-wrapper:hover{border-color:#4096ff}.hex-prefix{color:#bfbfbf;font-size:12px;margin-right:4px}.color-input{border:1px solid #d9d9d9;border-radius:4px;box-sizing:border-box;color:#333;font-size:12px;height:24px;padding:2px 0;text-align:center;width:100%}.color-input.hex{border:none;height:20px;outline:none;text-align:left}.color-input:focus{border-color:#4096ff;outline:none}.color-input::-webkit-inner-spin-button,.color-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.color-input[type=number]{-moz-appearance:textfield}.alpha-display{align-items:center;background-color:#f5f5f5;border:1px solid #d9d9d9;color:#666;display:flex;justify-content:center;text-align:center;width:40px}.color-picker-trigger{align-items:center;border:1px solid #0000;border-radius:4px;cursor:pointer;display:flex;margin-left:6px;transition:all .3s}.color-picker-trigger:hover{background-color:#0000000a}.color-block{border:1px solid #0000001a;border-radius:4px;box-shadow:0 0 2px #c5c5c5;height:16px;width:16px}.color-picker-container{align-items:flex-start;display:inline-flex;flex-direction:column;font-family:Arial,Microsoft Yahei,Helvetica Neue,Helvetica,sans-serif;font-size:14px;gap:8px;position:relative}.color-picker-main-row{align-items:center;display:flex;flex-wrap:nowrap;gap:0;width:100%}.color-picker-inline-presets{margin-top:8px;width:100%}.presets-grid.inline{display:grid;gap:8px;grid-template-columns:repeat(7,1fr);padding:4px}.color-picker-tooltip-trigger{align-items:center;border:1px solid #0000;border-radius:4px;display:inline-flex;gap:8px;position:relative;transition:all .3s}.tooltip-text{background-color:#000;border-radius:4px;bottom:110%;color:#fff;font-size:12px;left:77%;opacity:0;padding:5px 8px;position:absolute;text-align:center;transform:translateX(-50%);transition:opacity .3s;visibility:hidden;white-space:nowrap;z-index:1001}.tooltip-text:after{border:5px solid #0000;border-top-color:#000;content:"";left:50%;margin-left:-5px;position:absolute;top:100%}.color-picker-trigger:hover .tooltip-text{opacity:1;visibility:visible}.color-picker-trigger.is-open .tooltip-text{opacity:0;visibility:hidden}.color-picker-label{color:#ffffffa6}.color-picker-arrow{align-items:center;color:#8c8c8c;display:flex;margin-left:6px;transition:transform .3s}.color-picker-arrow img{display:block;height:12px;width:12px}.color-picker-arrow.open{transform:rotate(180deg)}.color-picker-input-wrapper{align-items:center;display:inline-flex;flex-shrink:0;position:relative}.color-picker-input-wrapper input{background-color:initial;border:1px solid #fff3;border-radius:4px;color:#fff;font-family:Arial,Microsoft Yahei,Helvetica Neue,Helvetica,sans-serif;font-size:14px;height:24px;outline:none;padding:4px 22px 4px 8px;transition:border-color .3s;width:140px}.color-picker-input-wrapper input:focus{border-color:#1677ff}.input-clear-icon{cursor:pointer;filter:invert(1);height:12px;opacity:.7;position:absolute;right:6px;top:50%;transform:translateY(-50%);transition:opacity .2s;width:12px}.input-clear-icon:hover{opacity:1}.color-picker-presets{padding-bottom:4px}.color-picker-icon-right{align-items:center;cursor:pointer;display:flex;float:right;justify-content:center;transition:transform .2s}.color-picker-icon-right:hover{transform:scale(1.1)}.palette-section-title{color:#999;font-size:12px;margin-bottom:5px;margin-top:5px}.presets-grid{display:grid;gap:8px;grid-template-columns:repeat(7,1fr);padding:4px}.preset-item{border:1px solid #0000001a;border-radius:4px;cursor:pointer;height:24px;transition:transform .1s,box-shadow .1s;width:24px}.preset-item-inner{height:20px;width:20px}.preset-item:hover{box-shadow:0 2px 4px #0003;transform:scale(1.15);z-index:1}.presets-collapse{align-items:center;color:#fff;cursor:pointer;display:flex;font-size:12px;gap:4px;justify-content:center}.collapse-arrow{display:inline-block;font-size:10px;opacity:.85;transition:transform .25s ease,color .25s ease,opacity .25s ease}.presets-collapse:hover .collapse-arrow{color:#1677ff;opacity:1;transform:translateY(1px)}.collapse-arrow.expanded{transform:rotate(180deg)}
2
2
  /*# sourceMappingURL=index.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["index.css"],"names":[],"mappings":"AACA,oBAGE,eAAgB,CAChB,iBAAkB,CAClB,8BAAyC,CAHzC,WAAY,CAIZ,wBAAiB,CAAjB,gBAAiB,CALjB,WAMF,CAGA,aAIE,iBAAkB,CAClB,cAAe,CAFf,YAAa,CAGb,eAAgB,CALhB,iBAAkB,CAClB,UAKF,CAEA,mBAME,4CACF,CAEA,sCAJE,QAAS,CAFT,MAAO,CAFP,iBAAkB,CAGlB,OAAQ,CAFR,KAcF,CAPA,mBAME,2CACF,CAEA,qBAIE,qB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hB,wBAAyB,CACzB,iBAAkB,CAClB,cAAe,CAJf,oBAAqB,CACrB,WAKF,CAEA,aAIE,0BAAoC,CADpC,iBAAkB,CADlB,WAAY,CADZ,UAIF","file":"index.css","sourcesContent":["\n.color-picker-panel {\n width: 200px;\n padding: 8px;\n background: #fff;\n border-radius: 4px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n user-select: none;\n}\n\n/* ColorBoard */\n.color-board {\n position: relative;\n width: 100%;\n height: 150px;\n border-radius: 2px;\n cursor: pointer;\n overflow: hidden;\n}\n\n.color-board-white {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0));\n}\n\n.color-board-black {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: linear-gradient(to top, #000, rgba(0, 0, 0, 0));\n}\n\n.color-board-handler {\n position: absolute;\n width: 10px;\n height: 10px;\n border: 2px solid #fff;\n border-radius: 50%;\n transform: translate(-50%, -50%);\n box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);\n pointer-events: none;\n}\n\n/* Sliders */\n.color-slider {\n position: relative;\n width: 100%;\n height: 10px;\n margin-top: 8px;\n border-radius: 5px;\n cursor: pointer;\n}\n\n.color-slider-handler {\n position: absolute;\n top: 50%;\n width: 12px;\n height: 12px;\n background: #fff;\n border-radius: 50%;\n transform: translate(-50%, -50%);\n box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);\n pointer-events: none;\n border: 1px solid rgba(0,0,0,0.1);\n}\n\n.hue-slider {\n background: linear-gradient(to right, red 0%, #ff0 17%, lime 33%, cyan 50%, blue 66%, magenta 83%, red 100%);\n}\n\n.alpha-slider-bg {\n background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCzekwMjDjZ1IxjJwApDkHN9Fi7xwAAAABJRU5ErkJggg==');\n}\n\n/* Inputs */\n.color-input-container {\n margin-top: 8px;\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.color-input-row {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n.mode-selector {\n position: relative;\n cursor: pointer;\n font-size: 12px;\n color: #333;\n padding: 2px 4px;\n border-radius: 2px;\n user-select: none;\n display: flex;\n align-items: center;\n}\n\n.mode-selector:hover {\n background-color: #f5f5f5;\n}\n\n.mode-dropdown {\n position: absolute;\n top: 100%;\n left: 0;\n background: #fff;\n border: 1px solid #d9d9d9;\n border-radius: 2px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n z-index: 10;\n min-width: 60px;\n}\n\n.mode-option {\n padding: 4px 8px;\n cursor: pointer;\n}\n\n.mode-option:hover {\n background: #e6f7ff;\n}\n\n.eyedropper-icon {\n cursor: pointer;\n padding: 2px;\n border-radius: 2px;\n color: #666;\n display: flex;\n align-items: center;\n}\n\n.eyedropper-icon:hover {\n background-color: #f5f5f5;\n color: #333;\n}\n\n.color-input-fields {\n display: flex;\n gap: 4px;\n}\n\n.color-input {\n width: 100%;\n padding: 4px;\n border: 1px solid #d9d9d9;\n border-radius: 2px;\n font-size: 12px;\n box-sizing: border-box;\n}\n\n/* Chrome, Safari, Edge, Opera - hide spin buttons */\n.color-input::-webkit-outer-spin-button,\n.color-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\n/* Firefox */\n.color-input[type=number] {\n -moz-appearance: textfield;\n}\n\n.alpha-display {\n width: 40px;\n text-align: center;\n background-color: #f5f5f5;\n color: #666;\n border: 1px solid #d9d9d9;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n/* Trigger */\n.color-picker-trigger {\n display: inline-block;\n padding: 4px;\n border: 1px solid #d9d9d9;\n border-radius: 4px;\n cursor: pointer;\n background: #fff;\n}\n\n.color-block {\n width: 20px;\n height: 20px;\n border-radius: 2px;\n border: 1px solid rgba(0, 0, 0, 0.1);\n}\n"]}
1
+ {"version":3,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CACA,mBAEE,WAAY,CADZ,UAEF,CACA,mBAEE,0BAAwC,CADxC,qBAAsB,CAEtB,SACF,CACA,kBAEE,kBAAmB,CAGnB,UAAY,CADZ,cAAe,CAHf,YAAa,CAKb,cAAe,CACf,OAAQ,CAJR,sBAKF,CAEA,gBACE,oBAAqB,CACrB,cAAe,CAEf,WAAa,CADb,gEAEF,CAEA,wCACE,aAAc,CACd,SAAU,CACV,yBACF,CAEA,yBACE,wBACF","file":"index.css","sourcesContent":[".color-picker-panel {\n width: 222px;\n padding: 0 8px 8px 8px;\n background: #fff;\n border-radius: 4px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n user-select: none;\n}\n\n.color-board {\n position: relative;\n width: 100%;\n height: 150px;\n border-radius: 2px;\n cursor: pointer;\n overflow: hidden;\n}\n\n.color-board-white {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0));\n}\n\n.color-board-black {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: linear-gradient(to top, #000, rgba(0, 0, 0, 0));\n}\n\n.color-board-handler {\n position: absolute;\n width: 10px;\n height: 10px;\n border: 2px solid #fff;\n border-radius: 50%;\n transform: translate(-50%, -50%);\n box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);\n pointer-events: none;\n}\n\n.color-slider {\n position: relative;\n width: 100%;\n height: 10px;\n margin-top: 8px;\n border-radius: 5px;\n cursor: pointer;\n}\n\n.color-slider-handler {\n position: absolute;\n top: 50%;\n width: 12px;\n height: 12px;\n background: #fff;\n border-radius: 50%;\n transform: translate(-50%, -50%);\n box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);\n pointer-events: none;\n border: 1px solid rgba(0, 0, 0, 0.1);\n}\n\n.hue-slider {\n background: linear-gradient(\n to right,\n red 0%,\n #ff0 17%,\n lime 33%,\n cyan 50%,\n blue 66%,\n magenta 83%,\n red 100%\n );\n}\n\n.alpha-slider-bg {\n background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCzekwMjDjZ1IxjJwApDkHN9Fi7xwAAAABJRU5ErkJggg==\");\n}\n\n.color-input-container {\n margin-top: 12px;\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 8px;\n}\n\n.mode-selector {\n position: relative;\n cursor: pointer;\n font-size: 12px;\n color: #333;\n padding: 4px 8px;\n border: 1px solid #d9d9d9;\n border-radius: 4px;\n user-select: none;\n display: flex;\n align-items: center;\n justify-content: space-between;\n min-width: 60px;\n height: 24px;\n box-sizing: border-box;\n background-color: #fff;\n transition: all 0.3s;\n}\n\n.mode-selector:hover {\n border-color: #4096ff;\n}\n\n.mode-dropdown {\n position: absolute;\n top: 100%;\n left: 0;\n background: #fff;\n border: 1px solid #d9d9d9;\n border-radius: 4px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n z-index: 10;\n min-width: 100%;\n margin-top: 4px;\n}\n\n.mode-option {\n padding: 5px 12px;\n cursor: pointer;\n font-size: 12px;\n color: #333;\n}\n\n.mode-option:hover {\n background: #f5f5f5;\n}\n\n.color-input-fields {\n display: flex;\n gap: 6px;\n flex: 1;\n}\n\n.hex-input-wrapper {\n display: flex;\n align-items: center;\n border: 1px solid #d9d9d9;\n border-radius: 4px;\n padding: 0 8px;\n flex: 1;\n height: 24px;\n box-sizing: border-box;\n background: #fff;\n transition: border-color 0.3s;\n}\n\n.hex-input-wrapper:hover,\n.hex-input-wrapper:focus-within {\n border-color: #4096ff;\n}\n\n.hex-prefix {\n color: #bfbfbf;\n margin-right: 4px;\n font-size: 12px;\n}\n\n.color-input {\n width: 100%;\n padding: 2px 0;\n border: 1px solid #d9d9d9;\n border-radius: 4px;\n font-size: 12px;\n box-sizing: border-box;\n text-align: center;\n height: 24px;\n color: #333;\n}\n\n.color-input.hex {\n border: none;\n text-align: left;\n height: 20px;\n outline: none;\n}\n\n.color-input:focus {\n border-color: #4096ff;\n outline: none;\n}\n\n.color-input::-webkit-outer-spin-button,\n.color-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\n.color-input[type=\"number\"] {\n -moz-appearance: textfield;\n}\n\n.alpha-display {\n width: 40px;\n text-align: center;\n background-color: #f5f5f5;\n color: #666;\n border: 1px solid #d9d9d9;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.color-picker-trigger {\n display: flex;\n align-items: center;\n border: 1px solid transparent;\n border-radius: 4px;\n cursor: pointer;\n transition: all 0.3s;\n margin-left: 6px;\n}\n\n.color-picker-trigger:hover {\n background-color: rgba(0, 0, 0, 0.04);\n}\n\n.color-block {\n width: 16px;\n height: 16px;\n border-radius: 4px;\n box-shadow: 0 0 2px #c5c5c5;\n border: 1px solid rgba(0, 0, 0, 0.1);\n}\n\n.color-picker-container {\n display: inline-flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 8px;\n font-family: Arial, \"Microsoft Yahei\", \"Helvetica Neue\", Helvetica, sans-serif;\n font-size: 14px;\n position: relative;\n}\n\n.color-picker-main-row {\n display: flex;\n align-items: center;\n gap: 0px;\n flex-wrap: nowrap;\n width: 100%;\n}\n\n.color-picker-inline-presets {\n margin-top: 8px;\n width: 100%;\n}\n\n.presets-grid.inline {\n display: grid;\n gap: 8px;\n padding: 4px;\n grid-template-columns: repeat(7, 1fr);\n}\n\n.color-picker-tooltip-trigger {\n position: relative;\n display: inline-flex;\n align-items: center;\n gap: 8px;\n border: 1px solid transparent;\n border-radius: 4px;\n transition: all 0.3s;\n}\n\n.tooltip-text {\n visibility: hidden;\n background-color: #000;\n color: #fff;\n text-align: center;\n border-radius: 4px;\n padding: 5px 8px;\n position: absolute;\n z-index: 1001;\n bottom: 110%;\n left: 77%;\n transform: translateX(-50%);\n opacity: 0;\n transition: opacity 0.3s;\n font-size: 12px;\n white-space: nowrap;\n}\n\n.tooltip-text::after {\n content: \"\";\n position: absolute;\n top: 100%;\n left: 50%;\n margin-left: -5px;\n border-width: 5px;\n border-style: solid;\n border-color: #000 transparent transparent transparent;\n}\n\n.color-picker-trigger:hover .tooltip-text {\n visibility: visible;\n opacity: 1;\n}\n\n.color-picker-trigger.is-open .tooltip-text {\n visibility: hidden;\n opacity: 0;\n}\n\n.color-picker-label {\n color: rgba(255, 255, 255, 0.65);\n}\n\n.color-picker-arrow {\n margin-left: 6px;\n color: #8c8c8c;\n display: flex;\n align-items: center;\n transition: transform 0.3s;\n}\n\n.color-picker-arrow img {\n width: 12px;\n height: 12px;\n display: block;\n}\n\n.color-picker-arrow.open {\n transform: rotate(180deg);\n}\n\n.color-picker-input-wrapper {\n position: relative;\n display: inline-flex;\n align-items: center;\n flex-shrink: 0;\n}\n\n.color-picker-input-wrapper input {\n width: 140px;\n padding: 4px 22px 4px 8px;\n border: 1px solid rgba(255, 255, 255, 0.2);\n border-radius: 4px;\n outline: none;\n font-size: 14px;\n color: #fff;\n background-color: transparent;\n transition: border-color 0.3s;\n font-family: Arial, \"Microsoft Yahei\", \"Helvetica Neue\", Helvetica, sans-serif;\n height: 24px;\n}\n\n.color-picker-input-wrapper input:focus {\n border-color: #1677ff;\n}\n\n.input-clear-icon {\n position: absolute;\n right: 6px;\n top: 50%;\n transform: translateY(-50%);\n width: 12px;\n height: 12px;\n cursor: pointer;\n opacity: 0.7;\n transition: opacity 0.2s;\n filter: invert(1);\n}\n\n.input-clear-icon:hover {\n opacity: 1;\n}\n\n.color-picker-presets {\n padding-bottom: 4px;\n}\n.color-picker-icon-right {\n float: right;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n transition: transform 0.2s;\n}\n\n.color-picker-icon-right:hover {\n transform: scale(1.1);\n}\n.palette-section-title {\n font-size: 12px;\n color: #999;\n margin-bottom: 5px;\n margin-top: 5px;\n}\n\n.presets-grid {\n display: grid;\n gap: 8px;\n padding: 4px;\n grid-template-columns: repeat(7, 1fr);\n}\n\n.preset-item {\n width: 24px;\n height: 24px;\n border-radius: 4px;\n cursor: pointer;\n border: 1px solid rgba(0, 0, 0, 0.1);\n transition: transform 0.1s, box-shadow 0.1s;\n}\n.preset-item-inner {\n width: 20px;\n height: 20px;\n}\n.preset-item:hover {\n transform: scale(1.15);\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n z-index: 1;\n}\n.presets-collapse {\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n color: white;\n font-size: 12px;\n gap: 4px;\n}\n\n.collapse-arrow {\n display: inline-block;\n font-size: 10px;\n transition: transform 0.25s ease, color 0.25s ease, opacity 0.25s ease;\n opacity: 0.85;\n}\n\n.presets-collapse:hover .collapse-arrow {\n color: #1677ff;\n opacity: 1;\n transform: translateY(1px);\n}\n\n.collapse-arrow.expanded {\n transform: rotate(180deg);\n}\n"]}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var e=require("react");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=/*#__PURE__*/t(e);function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},n.apply(null,arguments)}function r(e,t,a){return Math.min(Math.max(e,t),a)}function l(e,t,a){let n,r,l;e=(e%360+360)%360;let o=Math.floor(e/60),s=e/60-o,c=a*(1-t),u=a*(1-s*t),i=a*(1-(1-s)*t);switch(o%6){case 0:n=a,r=i,l=c;break;case 1:n=u,r=a,l=c;break;case 2:n=c,r=a,l=i;break;case 3:n=c,r=u,l=a;break;case 4:n=i,r=c,l=a;break;case 5:n=a,r=c,l=u;break;default:n=0,r=0,l=0}return{r:Math.round(255*n),g:Math.round(255*r),b:Math.round(255*l)}}function o(e,t,a){e/=255,t/=255,a/=255;let n,r,l=Math.max(e,t,a),o=Math.min(e,t,a),s=l,c=l-o;if(r=0===l?0:c/l,l===o)n=0;else{switch(l){case e:n=(t-a)/c+(t<a?6:0);break;case t:n=(a-e)/c+2;break;case a:n=(e-t)/c+4;break;default:n=0}n/=6}return{h:360*n,s:r,v:s}}function s(e,t,a){const n=e=>{const t=Math.round(e).toString(16);return 1===t.length?"0"+t:t};return"#"+n(e)+n(t)+n(a)}function c(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(e,t,a,n){return t+t+a+a+n+n});const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function u(e){if(!e)return{h:0,s:1,v:1,a:1};if(e.startsWith("#")){const t=c(e);if(t)return{...o(t.r,t.g,t.b),a:1}}const t=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)$/);if(t){const e=parseInt(t[1],10),a=parseInt(t[2],10),n=parseInt(t[3],10),r=void 0!==t[4]?parseFloat(t[4]):1;return{...o(e,a,n),a:r}}return{h:0,s:1,v:1,a:1}}const i=t=>{let{hue:n,saturation:l,value:o,onChange:s}=t;const c=e.useRef(null),[u,i]=e.useState(!1),d=e.useCallback(e=>{if(!c.current)return;const{width:t,height:a,left:n,top:l}=c.current.getBoundingClientRect(),o=r(e.clientX-n,0,t),u=r(e.clientY-l,0,a);s(o/t,1-u/a)},[s]),m=e.useCallback(()=>{i(!1)},[]);return e.useEffect(()=>{const e=e=>{u&&d(e)};return u&&(window.addEventListener("mousemove",e),window.addEventListener("mouseup",m)),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",m)}},[u,d,m]),/*#__PURE__*/a.default.createElement("div",{ref:c,className:"color-board",style:{backgroundColor:"hsl("+n+", 100%, 50%)"},onMouseDown:e=>{i(!0),d(e)}},/*#__PURE__*/a.default.createElement("div",{className:"color-board-white"}),/*#__PURE__*/a.default.createElement("div",{className:"color-board-black"}),/*#__PURE__*/a.default.createElement("div",{className:"color-board-handler",style:{left:100*l+"%",top:100*(1-o)+"%"}}))},d=({value:t,max:n,onChange:l,className:o,style:s,children:c})=>{const u=e.useRef(null),[i,d]=e.useState(!1),m=e.useCallback(e=>{if(!u.current)return;const{width:t,left:a}=u.current.getBoundingClientRect(),o=r(e.clientX-a,0,t);l(o/t*n)},[n,l]),f=e.useCallback(()=>{d(!1)},[]);return e.useEffect(()=>{const e=e=>{i&&m(e)};return i&&(window.addEventListener("mousemove",e),window.addEventListener("mouseup",f)),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",f)}},[i,m,f]),/*#__PURE__*/a.default.createElement("div",{ref:u,className:`color-slider ${o||""}`,style:s,onMouseDown:e=>{d(!0),m(e)}},/*#__PURE__*/a.default.createElement("div",{className:"color-slider-handler",style:{left:t/n*100+"%"}}),c)},m=({hue:e,onChange:t})=>/*#__PURE__*/a.default.createElement(d,{value:e,max:360,onChange:t,className:"hue-slider"}),f=({alpha:e,color:t,onChange:n})=>{const{r:r,g:l,b:o}=t;/*#__PURE__*/return a.default.createElement(d,{value:e,max:1,onChange:n,className:"alpha-slider-bg",style:{background:`linear-gradient(to right, rgba(${r},${l},${o},0) 0%, rgba(${r},${l},${o},1) 100%)`}})},h=({hue:t,saturation:n,value:r,alpha:u,onChange:i})=>{const[d,m]=e.useState("HEX"),[f,h]=e.useState({}),[p,v]=e.useState(!1),g=e.useRef(null);e.useEffect(()=>{const e=e=>{g.current&&!g.current.contains(e.target)&&v(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const E=e.useCallback(()=>l(t,n,r),[t,n,r]);e.useEffect(()=>{const e=E();if("HEX"===d)h({hex:s(e.r,e.g,e.b)});else if("RGB"===d)h({r:e.r,g:e.g,b:e.b});else if("HSL"===d){const t=function(e,t,a){e/=255,t/=255,a/=255;let n,r,l=Math.max(e,t,a),o=Math.min(e,t,a),s=(l+o)/2;if(l===o)n=r=0;else{let c=l-o;switch(r=s>.5?c/(2-l-o):c/(l+o),l){case e:n=(t-a)/c+(t<a?6:0);break;case t:n=(a-e)/c+2;break;case a:n=(e-t)/c+4}n/=6}return{h:360*n,s:r,l:s}}(e.r,e.g,e.b);h({h:Math.round(t.h),s:Math.round(100*t.s),l:Math.round(100*t.l)})}},[t,n,r,d,E]);const b=(e,t)=>{const a={...f,[e]:t};h(a);const n=parseInt(a.r,10),r=parseInt(a.g,10),l=parseInt(a.b,10);if(!isNaN(n)&&!isNaN(r)&&!isNaN(l)){const e=o(Math.min(255,Math.max(0,n)),Math.min(255,Math.max(0,r)),Math.min(255,Math.max(0,l)));i({...e,a:u})}},N=(e,t)=>{const a={...f,[e]:t};h(a);const n=parseInt(a.h,10),r=parseInt(a.s,10),l=parseInt(a.l,10);if(!isNaN(n)&&!isNaN(r)&&!isNaN(l)){const e=function(e,t,a){let n,r,l;if(0===t)n=r=l=a;else{const o=(e,t,a)=>(a<0&&(a+=1),a>1&&(a-=1),a<1/6?e+6*(t-e)*a:a<.5?t:a<2/3?e+(t-e)*(2/3-a)*6:e),s=a<.5?a*(1+t):a+t-a*t,c=2*a-s;n=o(c,s,(e/=360)+1/3),r=o(c,s,e),l=o(c,s,e-1/3)}return{r:Math.round(255*n),g:Math.round(255*r),b:Math.round(255*l)}}(Math.min(360,Math.max(0,n)),Math.min(100,Math.max(0,r))/100,Math.min(100,Math.max(0,l))/100),t=o(e.r,e.g,e.b);i({...t,a:u})}};/*#__PURE__*/return a.default.createElement("div",{className:"color-input-container"},/*#__PURE__*/a.default.createElement("div",{className:"color-input-row"},/*#__PURE__*/a.default.createElement("div",{className:"mode-selector",ref:g,onClick:()=>v(!p)},/*#__PURE__*/a.default.createElement("span",null,d),/*#__PURE__*/a.default.createElement("span",{className:"arrow",style:{fontSize:"10px",marginLeft:"4px",transform:p?"rotate(180deg)":"rotate(0deg)",display:"inline-block",transition:"transform 0.2s"}},"▼"),p&&/*#__PURE__*/a.default.createElement("div",{className:"mode-dropdown"},/*#__PURE__*/a.default.createElement("div",{className:"mode-option",onClick:e=>{e.stopPropagation(),m("HEX"),v(!1)}},"HEX"),/*#__PURE__*/a.default.createElement("div",{className:"mode-option",onClick:e=>{e.stopPropagation(),m("RGB"),v(!1)}},"RGB"),/*#__PURE__*/a.default.createElement("div",{className:"mode-option",onClick:e=>{e.stopPropagation(),m("HSL"),v(!1)}},"HSL"))),window.EyeDropper&&/*#__PURE__*/a.default.createElement("div",{className:"eyedropper-icon",onClick:function(){try{if(!window.EyeDropper)return Promise.resolve();const e=new window.EyeDropper,t=function(){try{var t=Promise.resolve(e.open()).then(function(e){const t=c(e.sRGBHex);if(t){const e=o(t.r,t.g,t.b);i({...e,a:u})}})}catch(e){return}return t&&t.then?t.then(void 0,function(){}):t}();return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},title:"Pick Color"},/*#__PURE__*/a.default.createElement("svg",{viewBox:"0 0 24 24",width:"16",height:"16"},/*#__PURE__*/a.default.createElement("path",{fill:"currentColor",d:"M17.5,1.5c-0.8,0-1.5,0.3-2.1,0.9l-8,8c-0.6,0.6-0.9,1.3-0.9,2.1v2.5l-4,4l1.5,1.5l4-4h2.5c0.8,0,1.5-0.3,2.1-0.9l8-8c0.6-0.6,0.9-1.3,0.9-2.1s-0.3-1.5-0.9-2.1S18.3,1.5,17.5,1.5z M17.5,10l-8-8l8,8z M6.5,12.5v2.5h-2.5L2,17l2,2l2-2v-2.5h2.5l8-8L10,5L6.5,8.5V12.5z"}),/*#__PURE__*/a.default.createElement("path",{d:"M19.3 8.9L15.1 4.7 17.5 2.3c.4-.4 1-.4 1.4 0l2.7 2.7c.4.4.4 1 0 1.4L19.3 8.9zM13.7 6.1L4 15.8V20h4.2l9.7-9.7-4.2-4.2z",fill:"currentColor"})))),/*#__PURE__*/a.default.createElement("div",{className:"color-input-fields"},"HEX"===d&&/*#__PURE__*/a.default.createElement("input",{className:"color-input",value:f.hex||"",onChange:e=>{const t=e.target.value;if(h({...f,hex:t}),/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i.test(t)){const e=c(t);if(e){const t=o(e.r,e.g,e.b);i({...t,a:u})}}}}),"RGB"===d&&/*#__PURE__*/a.default.createElement(a.default.Fragment,null,/*#__PURE__*/a.default.createElement("input",{className:"color-input",type:"number",placeholder:"R",value:void 0!==f.r?f.r:"",onChange:e=>b("r",e.target.value)}),/*#__PURE__*/a.default.createElement("input",{className:"color-input",type:"number",placeholder:"G",value:void 0!==f.g?f.g:"",onChange:e=>b("g",e.target.value)}),/*#__PURE__*/a.default.createElement("input",{className:"color-input",type:"number",placeholder:"B",value:void 0!==f.b?f.b:"",onChange:e=>b("b",e.target.value)})),"HSL"===d&&/*#__PURE__*/a.default.createElement(a.default.Fragment,null,/*#__PURE__*/a.default.createElement("input",{className:"color-input",type:"number",placeholder:"H",value:void 0!==f.h?f.h:"",onChange:e=>N("h",e.target.value)}),/*#__PURE__*/a.default.createElement("input",{className:"color-input",type:"number",placeholder:"S",value:void 0!==f.s?f.s:"",onChange:e=>N("s",e.target.value)}),/*#__PURE__*/a.default.createElement("input",{className:"color-input",type:"number",placeholder:"L",value:void 0!==f.l?f.l:"",onChange:e=>N("l",e.target.value)})),/*#__PURE__*/a.default.createElement("div",{className:"color-input alpha-display"},Math.round(100*u),"%")))};module.exports=t=>{let{value:r,defaultValue:o,onChange:c}=t;const[d,p]=e.useState(!1),[v,g]=e.useState(()=>u(r||o||"#1677ff")),E=e.useRef(null);e.useEffect(()=>{void 0!==r&&g(u(r))},[r]);const b=e=>{const t=n({},v,e);if(g(t),c){const e=l(t.h,t.s,t.v),a=s(e.r,e.g,e.b);c(a,n({},e,{a:t.a}))}};e.useEffect(()=>{const e=e=>{E.current&&!E.current.contains(e.target)&&p(!1)};return d&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[d]);const N=l(v.h,v.s,v.v);/*#__PURE__*/return a.default.createElement("div",{className:"color-picker-container",ref:E,style:{position:"relative",display:"inline-block"}},/*#__PURE__*/a.default.createElement("div",{className:"color-picker-trigger",onClick:()=>p(!d)},/*#__PURE__*/a.default.createElement("div",{className:"color-block",style:{backgroundColor:"rgba("+N.r+", "+N.g+", "+N.b+", "+v.a+")"}})),d&&/*#__PURE__*/a.default.createElement("div",{className:"color-picker-panel",style:{position:"absolute",top:"100%",left:0,zIndex:1e3,marginTop:4}},/*#__PURE__*/a.default.createElement(i,{hue:v.h,saturation:v.s,value:v.v,onChange:(e,t)=>b({s:e,v:t})}),/*#__PURE__*/a.default.createElement(m,{hue:v.h,onChange:e=>b({h:e})}),/*#__PURE__*/a.default.createElement(f,{alpha:v.a,color:N,onChange:e=>b({a:e})}),/*#__PURE__*/a.default.createElement(h,{hue:v.h,saturation:v.s,value:v.v,alpha:v.a,onChange:e=>b(e)})))};
1
+ var e=require("react"),t=require("react-dom");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=/*#__PURE__*/a(e),l=/*#__PURE__*/a(t);function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},r.apply(null,arguments)}function o(e,t,a){return Math.min(Math.max(e,t),a)}function s(e,t,a){let n,l,r;e=(e%360+360)%360;let o=Math.floor(e/60),s=e/60-o,c=a*(1-t),u=a*(1-s*t),i=a*(1-(1-s)*t);switch(o%6){case 0:n=a,l=i,r=c;break;case 1:n=u,l=a,r=c;break;case 2:n=c,l=a,r=i;break;case 3:n=c,l=u,r=a;break;case 4:n=i,l=c,r=a;break;case 5:n=a,l=c,r=u;break;default:n=0,l=0,r=0}return{r:Math.round(255*n),g:Math.round(255*l),b:Math.round(255*r)}}function c(e,t,a){e/=255,t/=255,a/=255;let n,l,r=Math.max(e,t,a),o=Math.min(e,t,a),s=r,c=r-o;if(l=0===r?0:c/r,r===o)n=0;else{switch(r){case e:n=(t-a)/c+(t<a?6:0);break;case t:n=(a-e)/c+2;break;case a:n=(e-t)/c+4;break;default:n=0}n/=6}return{h:360*n,s:l,v:s}}function u(e,t,a){const n=e=>{const t=Math.round(e).toString(16);return 1===t.length?"0"+t:t};return"#"+n(e)+n(t)+n(a)}function i(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(e,t,a,n){return t+t+a+a+n+n});const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function d(e){if(!e)return{h:0,s:1,v:1,a:1};if(e.startsWith("#")){const t=i(e);if(t)return{...c(t.r,t.g,t.b),a:1}}const t=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)$/);if(t){const e=parseInt(t[1],10),a=parseInt(t[2],10),n=parseInt(t[3],10),l=void 0!==t[4]?parseFloat(t[4]):1;return{...c(e,a,n),a:l}}return{h:0,s:1,v:1,a:1}}const m=({hue:t,saturation:a,value:l,onChange:r})=>{const s=e.useRef(null),[c,u]=e.useState(!1),i=e.useCallback(e=>{if(!s.current)return;const{width:t,height:a,left:n,top:l}=s.current.getBoundingClientRect(),c=o(e.clientX-n,0,t),u=o(e.clientY-l,0,a);r(c/t,1-u/a)},[r]),d=e.useCallback(()=>{u(!1)},[]);return e.useEffect(()=>{const e=e=>{c&&i(e)};return c&&(window.addEventListener("mousemove",e),window.addEventListener("mouseup",d)),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",d)}},[c,i,d]),/*#__PURE__*/n.default.createElement("div",{ref:s,className:"color-board",style:{backgroundColor:`hsl(${t}, 100%, 50%)`},onMouseDown:e=>{u(!0),i(e)}},/*#__PURE__*/n.default.createElement("div",{className:"color-board-white"}),/*#__PURE__*/n.default.createElement("div",{className:"color-board-black"}),/*#__PURE__*/n.default.createElement("div",{className:"color-board-handler",style:{left:100*a+"%",top:100*(1-l)+"%"}}))},f=({value:t,max:a,onChange:l,className:r,style:s,children:c})=>{const u=e.useRef(null),[i,d]=e.useState(!1),m=e.useCallback(e=>{if(!u.current)return;const{width:t,left:n}=u.current.getBoundingClientRect(),r=o(e.clientX-n,0,t);l(r/t*a)},[a,l]),f=e.useCallback(()=>{d(!1)},[]);return e.useEffect(()=>{const e=e=>{i&&m(e)};return i&&(window.addEventListener("mousemove",e),window.addEventListener("mouseup",f)),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",f)}},[i,m,f]),/*#__PURE__*/n.default.createElement("div",{ref:u,className:`color-slider ${r||""}`,style:s,onMouseDown:e=>{d(!0),m(e)}},/*#__PURE__*/n.default.createElement("div",{className:"color-slider-handler",style:{left:t/a*100+"%"}}),c)},p=({hue:e,onChange:t})=>/*#__PURE__*/n.default.createElement(f,{value:e,max:360,onChange:t,className:"hue-slider"}),h=({alpha:e,color:t,onChange:a})=>{const{r:l,g:r,b:o}=t;/*#__PURE__*/return n.default.createElement(f,{value:e,max:1,onChange:a,className:"alpha-slider-bg",style:{background:`linear-gradient(to right, rgba(${l},${r},${o},0) 0%, rgba(${l},${r},${o},1) 100%)`}})},g=({hue:t,saturation:a,value:l,alpha:r,onChange:o})=>{const[d,m]=e.useState("HEX"),[f,p]=e.useState({}),[h,g]=e.useState(!1),E=e.useRef(null);e.useEffect(()=>{const e=e=>{E.current&&!E.current.contains(e.target)&&g(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const v=e.useCallback(()=>s(t,a,l),[t,a,l]);e.useEffect(()=>{const e=v();if("HEX"===d)p({hex:u(e.r,e.g,e.b)});else if("RGB"===d)p({r:e.r,g:e.g,b:e.b});else if("HSL"===d){const t=function(e,t,a){e/=255,t/=255,a/=255;let n,l,r=Math.max(e,t,a),o=Math.min(e,t,a),s=(r+o)/2;if(r===o)n=l=0;else{let c=r-o;switch(l=s>.5?c/(2-r-o):c/(r+o),r){case e:n=(t-a)/c+(t<a?6:0);break;case t:n=(a-e)/c+2;break;case a:n=(e-t)/c+4;break;default:n=0}n/=6}return{h:360*n,s:l,l:s}}(e.r,e.g,e.b);p({h:Math.round(t.h),s:Math.round(100*t.s),l:Math.round(100*t.l)})}},[t,a,l,d,v]);const C=(e,t)=>{const a={...f,[e]:t};p(a);const n=parseInt(a.r,10),l=parseInt(a.g,10),s=parseInt(a.b,10);if(!isNaN(n)&&!isNaN(l)&&!isNaN(s)){const e=c(Math.min(255,Math.max(0,n)),Math.min(255,Math.max(0,l)),Math.min(255,Math.max(0,s)));o({...e,a:r})}},w=(e,t)=>{const a={...f,[e]:t};p(a);const n=parseInt(a.h,10),l=parseInt(a.s,10),s=parseInt(a.l,10);if(!isNaN(n)&&!isNaN(l)&&!isNaN(s)){const e=function(e,t,a){let n,l,r;if(0===t)n=l=r=a;else{const o=(e,t,a)=>(a<0&&(a+=1),a>1&&(a-=1),a<1/6?e+6*(t-e)*a:a<.5?t:a<2/3?e+(t-e)*(2/3-a)*6:e),s=a<.5?a*(1+t):a+t-a*t,c=2*a-s;n=o(c,s,(e/=360)+1/3),l=o(c,s,e),r=o(c,s,e-1/3)}return{r:Math.round(255*n),g:Math.round(255*l),b:Math.round(255*r)}}(Math.min(360,Math.max(0,n)),Math.min(100,Math.max(0,l))/100,Math.min(100,Math.max(0,s))/100),t=c(e.r,e.g,e.b);o({...t,a:r})}};/*#__PURE__*/return n.default.createElement("div",{className:"color-input-container"},/*#__PURE__*/n.default.createElement("div",{className:"mode-selector",ref:E,onClick:()=>g(!h)},/*#__PURE__*/n.default.createElement("span",null,d.charAt(0)+d.slice(1).toLowerCase()),/*#__PURE__*/n.default.createElement("span",{className:"arrow",style:{fontSize:"10px",marginLeft:"4px",transform:h?"rotate(180deg)":"rotate(0deg)",display:"inline-block",transition:"transform 0.2s",color:"#8c8c8c"}},/*#__PURE__*/n.default.createElement("svg",{viewBox:"0 0 1024 1024",width:"10",height:"10",fill:"currentColor"},/*#__PURE__*/n.default.createElement("path",{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3 0.1-12.7-6.4-12.7z"}))),h&&/*#__PURE__*/n.default.createElement("div",{className:"mode-dropdown"},/*#__PURE__*/n.default.createElement("div",{className:"mode-option",onClick:e=>{e.stopPropagation(),m("HEX"),g(!1)}},"Hex"),/*#__PURE__*/n.default.createElement("div",{className:"mode-option",onClick:e=>{e.stopPropagation(),m("RGB"),g(!1)}},"RGB"),/*#__PURE__*/n.default.createElement("div",{className:"mode-option",onClick:e=>{e.stopPropagation(),m("HSL"),g(!1)}},"HSL"))),/*#__PURE__*/n.default.createElement("div",{className:"color-input-fields"},"HEX"===d&&/*#__PURE__*/n.default.createElement("div",{className:"hex-input-wrapper"},/*#__PURE__*/n.default.createElement("span",{className:"hex-prefix"},"#"),/*#__PURE__*/n.default.createElement("input",{className:"color-input hex",value:f.hex?f.hex.replace("#",""):"",onChange:e=>{const t=e.target.value;if(p({...f,hex:t}),/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i.test(t)){const e=i(t);if(e){const t=c(e.r,e.g,e.b);o({...t,a:r})}}}})),"RGB"===d&&/*#__PURE__*/n.default.createElement(n.default.Fragment,null,/*#__PURE__*/n.default.createElement("input",{className:"color-input",type:"number",placeholder:"R",value:void 0!==f.r?f.r:"",onChange:e=>C("r",e.target.value)}),/*#__PURE__*/n.default.createElement("input",{className:"color-input",type:"number",placeholder:"G",value:void 0!==f.g?f.g:"",onChange:e=>C("g",e.target.value)}),/*#__PURE__*/n.default.createElement("input",{className:"color-input",type:"number",placeholder:"B",value:void 0!==f.b?f.b:"",onChange:e=>C("b",e.target.value)})),"HSL"===d&&/*#__PURE__*/n.default.createElement(n.default.Fragment,null,/*#__PURE__*/n.default.createElement("input",{className:"color-input",type:"number",placeholder:"H",value:void 0!==f.h?f.h:"",onChange:e=>w("h",e.target.value)}),/*#__PURE__*/n.default.createElement("input",{className:"color-input",type:"number",placeholder:"S",value:void 0!==f.s?f.s:"",onChange:e=>w("s",e.target.value)}),/*#__PURE__*/n.default.createElement("input",{className:"color-input",type:"number",placeholder:"L",value:void 0!==f.l?f.l:"",onChange:e=>w("l",e.target.value)})),/*#__PURE__*/n.default.createElement("div",{className:"color-input alpha-display"},Math.round(100*r),"%")))},E=["#E0B5AE","#B2BBDE","#F2DDB3","#E0E5C5","#BBD0C3","#B5D1E3","#FFFFFF","#D25536","#EFA154","#F7DA7E","#5FA67F","#A2829D","#D390A2","#000000","#0099A4","#EABA00","#C9462C","#3171AC","#783780","#1E80EA","#2AAC3B","#B63455","#81532F","#AA9A5C","#828281","#055753","#8F262B","#F0D8D0"];module.exports=t=>{let{value:a,defaultValue:o,onChange:f,showLabel:v=!0,label:C="Color",showArrow:w=!0,showInput:b=!0,showColorBoard:k=!0,presets:N}=t;const[A,L]=e.useState(!1),[x,y]=e.useState(!1),[M,F]=e.useState([]),B=N||E,[R,S]=e.useState(()=>d(a||o||"#1677ff")),[D,I]=e.useState(()=>{const e=s(R.h,R.s,R.v);return u(e.r,e.g,e.b).toUpperCase()}),X=e.useRef(null),H=e.useRef(null),[P,O]=e.useState({});e.useEffect(()=>{if(void 0!==a){const e=d(a);S(e);const t=s(e.h,e.s,e.v);I(u(t.r,t.g,t.b).toUpperCase())}},[a]);const $=e=>{const t=r({},R,e);S(t);const a=s(t.h,t.s,t.v),n=u(a.r,a.g,a.b).toUpperCase();I(n),f&&f(n,r({},a,{a:t.a}))};e.useEffect(()=>{if(!A||!H.current||"undefined"==typeof window||"undefined"==typeof document)return;const e=H.current.getBoundingClientRect(),t=e.bottom+4+window.scrollY,a=e.left+window.scrollX;O({position:"absolute",top:t,left:a,zIndex:9999})},[A]),e.useEffect(()=>{const e=e=>{X.current&&!X.current.contains(e.target)&&L(!1)};if(A)document.addEventListener("mousedown",e);else{const e=s(R.h,R.s,R.v),t=u(e.r,e.g,e.b).toUpperCase();F(e=>e.includes(t)?e:[t,...e].slice(0,10))}return()=>{document.removeEventListener("mousedown",e)}},[A,R]);const U=s(R.h,R.s,R.v),z="rgba("+U.r+", "+U.g+", "+U.b+", "+R.a+")",T=x?B:B.slice(0,14),G=B.length>14,q=A?/*#__PURE__*/n.default.createElement("div",{className:"color-picker-panel",style:P},k&&/*#__PURE__*/n.default.createElement("div",{className:"color-picker-board-wrapper",style:{marginTop:"10px",paddingTop:"10px",borderTop:"1px solid #eee"}},/*#__PURE__*/n.default.createElement(m,{hue:R.h,saturation:R.s,value:R.v,onChange:(e,t)=>$({s:e,v:t})}),/*#__PURE__*/n.default.createElement(p,{hue:R.h,onChange:e=>$({h:e})}),/*#__PURE__*/n.default.createElement(h,{alpha:R.a,color:U,onChange:e=>$({a:e})}),/*#__PURE__*/n.default.createElement(g,{hue:R.h,saturation:R.s,value:R.v,alpha:R.a,onChange:e=>$(e)})),/*#__PURE__*/n.default.createElement("div",{className:"color-picker-presets"},/*#__PURE__*/n.default.createElement("div",{className:"palette-section-title",style:{marginTop:8}},/*#__PURE__*/n.default.createElement("span",null,"Recommended"),/*#__PURE__*/n.default.createElement("span",{className:"color-picker-icon-right",onClick:function(){try{if(!window.EyeDropper)return alert("当前浏览器不支持屏幕取色功能"),Promise.resolve();const e=function(e,t){try{var a=function(){const e=new window.EyeDropper;return Promise.resolve(e.open()).then(function(e){const{sRGBHex:t}=e,a=i(t);if(a){const e=c(a.r,a.g,a.b);$(r({},e,{a:1}))}})}()}catch(e){return t(e)}return a&&a.then?a.then(void 0,t):a}(0,function(e){console.log("EyeDropper failed or canceled:",e)});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},title:"屏幕取色"},/*#__PURE__*/n.default.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},/*#__PURE__*/n.default.createElement("defs",null,/*#__PURE__*/n.default.createElement("rect",{id:"path-1",x:"0",y:"0",width:"16",height:"16"})),/*#__PURE__*/n.default.createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},/*#__PURE__*/n.default.createElement("g",{transform:"translate(-920.000000, -594.000000)"},/*#__PURE__*/n.default.createElement("g",{transform:"translate(720.000000, 418.000000)"},/*#__PURE__*/n.default.createElement("g",{transform:"translate(200.000000, 176.000000)"},/*#__PURE__*/n.default.createElement("mask",{id:"mask-2",fill:"white"},/*#__PURE__*/n.default.createElement("use",{xlinkHref:"#path-1"})),/*#__PURE__*/n.default.createElement("g",null),/*#__PURE__*/n.default.createElement("g",{mask:"url(#mask-2)",fill:"#000000",fillOpacity:"0.85",fillRule:"nonzero"},/*#__PURE__*/n.default.createElement("g",{transform:"translate(8.106532, 8.106532) rotate(-315.000000) translate(-8.106532, -8.106532) translate(-0.266667, -0.266667)"},/*#__PURE__*/n.default.createElement("path",{d:"M5.67238576,2.96585378 L6.99478644,4.28811977 L7.03978941,4.24867364 C7.66833128,3.72977631 8.60030981,3.76436946 9.18839345,4.3524531 L9.94264069,5.10670034 C10.1509203,5.31497996 10.1509203,5.65266795 9.94264069,5.86094757 L9.18778644,6.61411977 L13.7138769,11.1406782 C14.4428555,11.8696569 14.4428555,13.0515648 13.7138769,13.7805435 C12.9848982,14.5095222 11.8029902,14.5095222 11.0740115,13.7805435 L6.54778644,9.25411977 L5.7942809,10.0093074 C5.58600128,10.217587 5.24831329,10.217587 5.04003367,10.0093074 L4.28578644,9.25506012 C3.66094757,8.63022125 3.66094757,7.61715729 4.28578644,6.99231842 L4.35178644,6.92511977 L3.03252045,5.6057191 C2.30354177,4.87674042 2.30354177,3.69483246 3.03252045,2.96585378 C3.76149912,2.2368751 4.94340708,2.2368751 5.67238576,2.96585378 Z M8.43414622,7.36944204 L7.86778644,7.93411977 L7.30277537,8.50081289 L11.8282588,13.0262963 C12.1295204,13.3275579 12.6112769,13.3383172 12.925431,13.0585743 L12.9596296,13.0262963 C13.2720491,12.7138769 13.2720491,12.2073449 12.9596296,11.8949254 L8.43414622,7.36944204 Z M7.70907857,5.07958956 L7.67989899,5.10670034 L5.04003367,7.74656565 C4.83175405,7.95484528 4.83175405,8.29253326 5.04003367,8.50081289 L5.41715729,8.8779365 L8.81126984,5.48382395 L8.43414622,5.10670034 C8.23533385,4.90788797 7.91861014,4.89885105 7.70907857,5.07958956 Z M3.82096628,3.68782298 L3.78676768,3.72010101 C3.47434825,4.03252045 3.47434825,4.53905243 3.78676768,4.85147186 L5.10670034,6.17140452 L6.23807119,5.04003367 L4.91813853,3.72010101 C4.61687693,3.41883942 4.13512038,3.40808007 3.82096628,3.68782298 Z",transform:"translate(8.373199, 8.373199) rotate(-315.000000) translate(-8.373199, -8.373199)"})))))))))),/*#__PURE__*/n.default.createElement("div",{className:"presets-grid modern"},B.map((e,t)=>/*#__PURE__*/n.default.createElement("div",{key:t,className:"preset-item preset-item-inner",style:{backgroundColor:e},onClick:()=>{const t=i(e);if(t){const e=c(t.r,t.g,t.b);$(r({},e,{a:1}))}},title:e}))),M.length>0&&/*#__PURE__*/n.default.createElement(n.default.Fragment,null,/*#__PURE__*/n.default.createElement("div",{className:"palette-section-title"},"Recent"),/*#__PURE__*/n.default.createElement("div",{className:"presets-grid recent"},M.map((e,t)=>/*#__PURE__*/n.default.createElement("div",{key:t,className:"preset-item",style:{backgroundColor:e},onClick:()=>{const t=i(e);if(t){const e=c(t.r,t.g,t.b);$(r({},e,{a:1}))}},title:e})))))):null;/*#__PURE__*/return n.default.createElement("div",{className:"color-picker-container",ref:X},/*#__PURE__*/n.default.createElement("div",{className:"color-picker-main-row"},/*#__PURE__*/n.default.createElement("div",{className:"color-picker-tooltip-trigger"},v&&/*#__PURE__*/n.default.createElement("span",{className:"color-picker-label"},C),/*#__PURE__*/n.default.createElement("div",{className:"color-picker-trigger "+(A?"is-open":""),onClick:()=>L(!A),ref:H},/*#__PURE__*/n.default.createElement("div",{className:"color-block",style:{backgroundColor:z}}),w&&/*#__PURE__*/n.default.createElement("span",{className:"color-picker-arrow "+(A?"open":"")},/*#__PURE__*/n.default.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},/*#__PURE__*/n.default.createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},/*#__PURE__*/n.default.createElement("g",{transform:"translate(-1348.000000, -88.000000)",fillRule:"nonzero"},/*#__PURE__*/n.default.createElement("g",{transform:"translate(0.000000, 60.000000)"},/*#__PURE__*/n.default.createElement("g",{transform:"translate(584.000000, 20.000000)"},/*#__PURE__*/n.default.createElement("g",{transform:"translate(728.000000, 4.000000)"},/*#__PURE__*/n.default.createElement("g",{transform:"translate(44.000000, 12.000000) rotate(-360.000000) translate(-44.000000, -12.000000) translate(36.000000, 4.000000)"},/*#__PURE__*/n.default.createElement("rect",{fill:"#000000",opacity:"0",x:"0",y:"0",width:"16",height:"16"}),/*#__PURE__*/n.default.createElement("path",{d:"M13.0750341,5.34788541 C12.9440655,5.21691678 12.7257845,5.21691678 12.5948158,5.34788541 L8.01091405,9.93178717 L3.40518417,5.34788541 C3.27421555,5.21691678 3.05593452,5.21691678 2.92496589,5.34788541 C2.79399727,5.47885403 2.79399727,5.69713506 2.92496589,5.82810369 L7.77080491,10.6521146 C7.90177353,10.7830832 8.12005456,10.7830832 8.25102319,10.6521146 L13.0750341,5.82810369 C13.2060027,5.69713506 13.2060027,5.47885403 13.0750341,5.34788541 Z",stroke:"#FFFFFF"}))))))))),/*#__PURE__*/n.default.createElement("span",{className:"tooltip-text"},"Color Picker"))),b&&/*#__PURE__*/n.default.createElement("div",{className:"color-picker-input-wrapper"},/*#__PURE__*/n.default.createElement("input",{type:"text",value:D,onChange:e=>{const t=e.target.value;if(I(t),/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i.test(t)){const e=i(t);if(e){const t=c(e.r,e.g,e.b);$(r({},t,{a:R.a}))}}},placeholder:"Please input color"}),D&&/*#__PURE__*/n.default.createElement("span",{className:"input-clear-icon",onClick:()=>I("")},/*#__PURE__*/n.default.createElement("img",{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAA8klEQVQ4T51SwVHDQAzcdQOETugAqISkg/Cw9CRf2Q+gAkwlJB1QimnAYnRz57m55AG5l2+9K632RFw44zg+ALiPX+5+FJFTS2MNmNme5AuATUOcARxE5L3gq9DMJpJPlxxU2CQiu7gnYe70mq19tgXcfcXc/VlV34pwJnkTBFXdDsOwBfCRO+1EZKoczSJyywjC3b8qO4mYxai+SyGQfKSZHXIg9XhJHEDTPXHC7vXCq63mVP8cjrv/qOrm7DkAxGyRan1qLM3/rwUoz7UuQCkdixCrFW9atwt7JPcl6TNhIUdgy7Lcxb3ruu++74/tKv4CNXed5xhXezYAAAAASUVORK5CYII=",alt:"",width:"12",height:"12"})))),"undefined"!=typeof document&&l.default.createPortal(q,document.body),/*#__PURE__*/n.default.createElement("div",null,/*#__PURE__*/n.default.createElement("div",{className:"presets-grid modern"},T.map((e,t)=>/*#__PURE__*/n.default.createElement("div",{key:t,className:"preset-item",style:{backgroundColor:e},onClick:()=>{const t=i(e);if(t){const e=c(t.r,t.g,t.b);$(r({},e,{a:1}))}},title:e}))),G&&/*#__PURE__*/n.default.createElement("div",{className:"presets-collapse",onClick:()=>y(!x)},x?"Less":"More",/*#__PURE__*/n.default.createElement("span",{className:"collapse-arrow "+(x?"expanded":"")},"▼"))))};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/lib/utils/color.js","../src/lib/ColorBoard.js","../src/lib/Sliders.js","../src/lib/ColorInput.js","../src/lib/index.js"],"sourcesContent":["\n/**\n * Clamps a value between min and max\n * @param {number} value \n * @param {number} min \n * @param {number} max \n */\nexport function clamp(value, min, max) {\n return Math.min(Math.max(value, min), max);\n}\n\n/**\n * Converts HSV to RGB\n * @param {number} h Hue 0-360\n * @param {number} s Saturation 0-1\n * @param {number} v Value 0-1\n * @returns {{r: number, g: number, b: number}}\n */\nexport function hsvToRgb(h, s, v) {\n h = ((h % 360) + 360) % 360; // Normalize hue\n let r, g, b;\n let i = Math.floor(h / 60);\n let f = h / 60 - i;\n let p = v * (1 - s);\n let q = v * (1 - f * s);\n let t = v * (1 - (1 - f) * s);\n\n switch (i % 6) {\n case 0: r = v; g = t; b = p; break;\n case 1: r = q; g = v; b = p; break;\n case 2: r = p; g = v; b = t; break;\n case 3: r = p; g = q; b = v; break;\n case 4: r = t; g = p; b = v; break;\n case 5: r = v; g = p; b = q; break;\n default: r = 0; g = 0; b = 0;\n }\n\n return {\n r: Math.round(r * 255),\n g: Math.round(g * 255),\n b: Math.round(b * 255)\n };\n}\n\n/**\n * Converts RGB to HSV\n * @param {number} r Red 0-255\n * @param {number} g Green 0-255\n * @param {number} b Blue 0-255\n * @returns {{h: number, s: number, v: number}}\n */\nexport function rgbToHsv(r, g, b) {\n r /= 255;\n g /= 255;\n b /= 255;\n\n let max = Math.max(r, g, b);\n let min = Math.min(r, g, b);\n let h, s, v = max;\n\n let d = max - min;\n s = max === 0 ? 0 : d / max;\n\n if (max === min) {\n h = 0; // achromatic\n } else {\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n default: h = 0;\n }\n h /= 6;\n }\n\n return {\n h: h * 360,\n s: s,\n v: v\n };\n}\n\n/**\n * Converts RGB to Hex string\n * @param {number} r \n * @param {number} g \n * @param {number} b \n * @returns {string} Hex string (e.g., \"#ff0000\")\n */\nexport function rgbToHex(r, g, b) {\n const toHex = (c) => {\n const hex = Math.round(c).toString(16);\n return hex.length === 1 ? \"0\" + hex : hex;\n };\n return \"#\" + toHex(r) + toHex(g) + toHex(b);\n}\n\n/**\n * Converts Hex string to RGB\n * @param {string} hex \n * @returns {{r: number, g: number, b: number} | null}\n */\nexport function hexToRgb(hex) {\n // Expand shorthand form (e.g. \"03F\") to full form (e.g. \"0033FF\")\n const shorthandRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;\n hex = hex.replace(shorthandRegex, function(m, r, g, b) {\n return r + r + g + g + b + b;\n });\n\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n return result ? {\n r: parseInt(result[1], 16),\n g: parseInt(result[2], 16),\n b: parseInt(result[3], 16)\n } : null;\n}\n\n/**\n * Parses a color string to HSV\n * @param {string} color \n * @returns {{h: number, s: number, v: number, a: number}}\n */\nexport function parseColor(color) {\n if (!color) return { h: 0, s: 1, v: 1, a: 1 };\n\n // Hex\n if (color.startsWith('#')) {\n const rgb = hexToRgb(color);\n if (rgb) {\n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b);\n return { ...hsv, a: 1 };\n }\n }\n \n // RGB/RGBA\n const rgbaMatch = color.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*([\\d.]+))?\\)$/);\n if (rgbaMatch) {\n const r = parseInt(rgbaMatch[1], 10);\n const g = parseInt(rgbaMatch[2], 10);\n const b = parseInt(rgbaMatch[3], 10);\n const a = rgbaMatch[4] !== undefined ? parseFloat(rgbaMatch[4]) : 1;\n const hsv = rgbToHsv(r, g, b);\n return { ...hsv, a };\n }\n\n // Default fallback\n return { h: 0, s: 1, v: 1, a: 1 };\n}\n\n/**\n * Converts RGB to HSL\n * @param {number} r Red 0-255\n * @param {number} g Green 0-255\n * @param {number} b Blue 0-255\n * @returns {{h: number, s: number, l: number}}\n */\nexport function rgbToHsl(r, g, b) {\n r /= 255;\n g /= 255;\n b /= 255;\n\n let max = Math.max(r, g, b), min = Math.min(r, g, b);\n let h, s, l = (max + min) / 2;\n\n if (max === min) {\n h = s = 0; // achromatic\n } else {\n let d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h /= 6;\n }\n\n return { h: h * 360, s: s, l: l };\n}\n\n/**\n * Converts HSL to RGB\n * @param {number} h Hue 0-360\n * @param {number} s Saturation 0-1\n * @param {number} l Lightness 0-1\n * @returns {{r: number, g: number, b: number}}\n */\nexport function hslToRgb(h, s, l) {\n let r, g, b;\n\n if (s === 0) {\n r = g = b = l; // achromatic\n } else {\n const hue2rgb = (p, q, t) => {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1/6) return p + (q - p) * 6 * t;\n if (t < 1/2) return q;\n if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;\n return p;\n };\n\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n h /= 360;\n r = hue2rgb(p, q, h + 1/3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1/3);\n }\n\n return {\n r: Math.round(r * 255),\n g: Math.round(g * 255),\n b: Math.round(b * 255)\n };\n}\n","\nimport React, { useRef, useEffect, useState, useCallback } from 'react';\nimport { clamp } from './utils/color';\n\nconst ColorBoard = ({ hue, saturation, value, onChange }) => {\n const containerRef = useRef(null);\n const [isDragging, setIsDragging] = useState(false);\n\n const handleChange = useCallback((e) => {\n if (!containerRef.current) return;\n const { width, height, left, top } = containerRef.current.getBoundingClientRect();\n const x = clamp(e.clientX - left, 0, width);\n const y = clamp(e.clientY - top, 0, height);\n\n const newSaturation = x / width;\n const newValue = 1 - y / height;\n\n onChange(newSaturation, newValue);\n }, [onChange]);\n\n const handleMouseDown = (e) => {\n setIsDragging(true);\n handleChange(e);\n };\n\n const handleMouseUp = useCallback(() => {\n setIsDragging(false);\n }, []);\n\n useEffect(() => {\n const handleMouseMove = (e) => {\n if (isDragging) {\n handleChange(e);\n }\n };\n\n if (isDragging) {\n window.addEventListener('mousemove', handleMouseMove);\n window.addEventListener('mouseup', handleMouseUp);\n }\n\n return () => {\n window.removeEventListener('mousemove', handleMouseMove);\n window.removeEventListener('mouseup', handleMouseUp);\n };\n }, [isDragging, handleChange, handleMouseUp]);\n\n return (\n <div\n ref={containerRef}\n className=\"color-board\"\n style={{\n backgroundColor: `hsl(${hue}, 100%, 50%)`,\n }}\n onMouseDown={handleMouseDown}\n >\n <div className=\"color-board-white\" />\n <div className=\"color-board-black\" />\n <div\n className=\"color-board-handler\"\n style={{\n left: `${saturation * 100}%`,\n top: `${(1 - value) * 100}%`,\n }}\n />\n </div>\n );\n};\n\nexport default ColorBoard;\n","\nimport React, { useRef, useState, useEffect, useCallback } from 'react';\nimport { clamp } from './utils/color';\n\nconst Slider = ({ value, max, onChange, className, style, children }) => {\n const containerRef = useRef(null);\n const [isDragging, setIsDragging] = useState(false);\n\n const handleChange = useCallback((e) => {\n if (!containerRef.current) return;\n const { width, left } = containerRef.current.getBoundingClientRect();\n const x = clamp(e.clientX - left, 0, width);\n const newValue = (x / width) * max;\n onChange(newValue);\n }, [max, onChange]);\n\n const handleMouseDown = (e) => {\n setIsDragging(true);\n handleChange(e);\n };\n\n const handleMouseUp = useCallback(() => {\n setIsDragging(false);\n }, []);\n\n useEffect(() => {\n const handleMouseMove = (e) => {\n if (isDragging) {\n handleChange(e);\n }\n };\n\n if (isDragging) {\n window.addEventListener('mousemove', handleMouseMove);\n window.addEventListener('mouseup', handleMouseUp);\n }\n\n return () => {\n window.removeEventListener('mousemove', handleMouseMove);\n window.removeEventListener('mouseup', handleMouseUp);\n };\n }, [isDragging, handleChange, handleMouseUp]);\n\n return (\n <div\n ref={containerRef}\n className={`color-slider ${className || ''}`}\n style={style}\n onMouseDown={handleMouseDown}\n >\n <div\n className=\"color-slider-handler\"\n style={{\n left: `${(value / max) * 100}%`,\n }}\n />\n {children}\n </div>\n );\n};\n\nexport const HueSlider = ({ hue, onChange }) => {\n return (\n <Slider\n value={hue}\n max={360}\n onChange={onChange}\n className=\"hue-slider\"\n />\n );\n};\n\nexport const AlphaSlider = ({ alpha, color, onChange }) => {\n const { r, g, b } = color;\n return (\n <Slider\n value={alpha}\n max={1}\n onChange={onChange}\n className=\"alpha-slider-bg\"\n style={{\n background: `linear-gradient(to right, rgba(${r},${g},${b},0) 0%, rgba(${r},${g},${b},1) 100%)`\n }}\n />\n );\n};\n","import React, { useState, useEffect, useCallback, useRef } from 'react';\nimport { rgbToHex, hexToRgb, hsvToRgb, rgbToHsv, rgbToHsl, hslToRgb } from './utils/color';\n\nconst ColorInput = ({ hue, saturation, value, alpha, onChange }) => {\n const [mode, setMode] = useState('HEX');\n const [localValue, setLocalValue] = useState({});\n const [showDropdown, setShowDropdown] = useState(false);\n const dropdownRef = useRef(null);\n\n // Close dropdown when clicking outside\n useEffect(() => {\n const handleClickOutside = (event) => {\n if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {\n setShowDropdown(false);\n }\n };\n document.addEventListener('mousedown', handleClickOutside);\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n };\n }, []);\n\n const getRgb = useCallback(() => hsvToRgb(hue, saturation, value), [hue, saturation, value]);\n\n useEffect(() => {\n const rgb = getRgb();\n if (mode === 'HEX') {\n setLocalValue({ hex: rgbToHex(rgb.r, rgb.g, rgb.b) });\n } else if (mode === 'RGB') {\n setLocalValue({ r: rgb.r, g: rgb.g, b: rgb.b });\n } else if (mode === 'HSL') {\n const hsl = rgbToHsl(rgb.r, rgb.g, rgb.b);\n setLocalValue({ h: Math.round(hsl.h), s: Math.round(hsl.s * 100), l: Math.round(hsl.l * 100) });\n }\n }, [hue, saturation, value, mode, getRgb]);\n\n const handleHexChange = (e) => {\n const val = e.target.value;\n setLocalValue({ ...localValue, hex: val });\n if (/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i.test(val)) {\n const rgb = hexToRgb(val);\n if (rgb) {\n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b);\n onChange({ ...hsv, a: alpha });\n }\n }\n };\n\n const handleRgbChange = (key, val) => {\n const newValue = { ...localValue, [key]: val };\n setLocalValue(newValue);\n const r = parseInt(newValue.r, 10);\n const g = parseInt(newValue.g, 10);\n const b = parseInt(newValue.b, 10);\n if (!isNaN(r) && !isNaN(g) && !isNaN(b)) {\n const hsv = rgbToHsv(Math.min(255, Math.max(0, r)), Math.min(255, Math.max(0, g)), Math.min(255, Math.max(0, b)));\n onChange({ ...hsv, a: alpha });\n }\n };\n\n const handleHslChange = (key, val) => {\n const newValue = { ...localValue, [key]: val };\n setLocalValue(newValue);\n const h = parseInt(newValue.h, 10);\n const s = parseInt(newValue.s, 10);\n const l = parseInt(newValue.l, 10);\n if (!isNaN(h) && !isNaN(s) && !isNaN(l)) {\n const rgb = hslToRgb(Math.min(360, Math.max(0, h)), Math.min(100, Math.max(0, s)) / 100, Math.min(100, Math.max(0, l)) / 100);\n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b);\n onChange({ ...hsv, a: alpha });\n }\n };\n\n const openEyeDropper = async () => {\n if (!window.EyeDropper) return;\n const eyeDropper = new window.EyeDropper();\n try {\n const result = await eyeDropper.open();\n const rgb = hexToRgb(result.sRGBHex);\n if (rgb) {\n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b);\n onChange({ ...hsv, a: alpha });\n }\n } catch (e) {\n // User canceled\n }\n };\n\n return (\n <div className=\"color-input-container\">\n <div className=\"color-input-row\">\n <div className=\"mode-selector\" ref={dropdownRef} onClick={() => setShowDropdown(!showDropdown)}>\n <span>{mode}</span>\n <span className=\"arrow\" style={{ fontSize: '10px', marginLeft: '4px', transform: showDropdown ? 'rotate(180deg)' : 'rotate(0deg)', display: 'inline-block', transition: 'transform 0.2s' }}>▼</span>\n {showDropdown && (\n <div className=\"mode-dropdown\">\n <div className=\"mode-option\" onClick={(e) => { e.stopPropagation(); setMode('HEX'); setShowDropdown(false); }}>HEX</div>\n <div className=\"mode-option\" onClick={(e) => { e.stopPropagation(); setMode('RGB'); setShowDropdown(false); }}>RGB</div>\n <div className=\"mode-option\" onClick={(e) => { e.stopPropagation(); setMode('HSL'); setShowDropdown(false); }}>HSL</div>\n </div>\n )}\n </div>\n \n {window.EyeDropper && (\n <div className=\"eyedropper-icon\" onClick={openEyeDropper} title=\"Pick Color\">\n <svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\">\n <path fill=\"currentColor\" d=\"M17.5,1.5c-0.8,0-1.5,0.3-2.1,0.9l-8,8c-0.6,0.6-0.9,1.3-0.9,2.1v2.5l-4,4l1.5,1.5l4-4h2.5c0.8,0,1.5-0.3,2.1-0.9l8-8c0.6-0.6,0.9-1.3,0.9-2.1s-0.3-1.5-0.9-2.1S18.3,1.5,17.5,1.5z M17.5,10l-8-8l8,8z M6.5,12.5v2.5h-2.5L2,17l2,2l2-2v-2.5h2.5l8-8L10,5L6.5,8.5V12.5z\"/>\n <path d=\"M19.3 8.9L15.1 4.7 17.5 2.3c.4-.4 1-.4 1.4 0l2.7 2.7c.4.4.4 1 0 1.4L19.3 8.9zM13.7 6.1L4 15.8V20h4.2l9.7-9.7-4.2-4.2z\" fill=\"currentColor\"/>\n </svg>\n </div>\n )}\n </div>\n\n <div className=\"color-input-fields\">\n {mode === 'HEX' && (\n <input className=\"color-input\" value={localValue.hex || ''} onChange={handleHexChange} />\n )}\n {mode === 'RGB' && (\n <>\n <input className=\"color-input\" type=\"number\" placeholder=\"R\" value={localValue.r !== undefined ? localValue.r : ''} onChange={(e) => handleRgbChange('r', e.target.value)} />\n <input className=\"color-input\" type=\"number\" placeholder=\"G\" value={localValue.g !== undefined ? localValue.g : ''} onChange={(e) => handleRgbChange('g', e.target.value)} />\n <input className=\"color-input\" type=\"number\" placeholder=\"B\" value={localValue.b !== undefined ? localValue.b : ''} onChange={(e) => handleRgbChange('b', e.target.value)} />\n </>\n )}\n {mode === 'HSL' && (\n <>\n <input className=\"color-input\" type=\"number\" placeholder=\"H\" value={localValue.h !== undefined ? localValue.h : ''} onChange={(e) => handleHslChange('h', e.target.value)} />\n <input className=\"color-input\" type=\"number\" placeholder=\"S\" value={localValue.s !== undefined ? localValue.s : ''} onChange={(e) => handleHslChange('s', e.target.value)} />\n <input className=\"color-input\" type=\"number\" placeholder=\"L\" value={localValue.l !== undefined ? localValue.l : ''} onChange={(e) => handleHslChange('l', e.target.value)} />\n </>\n )}\n <div className=\"color-input alpha-display\">\n {Math.round(alpha * 100)}%\n </div>\n </div>\n </div>\n );\n};\n\nexport default ColorInput;\n","\nimport React, { useState, useRef, useEffect } from 'react';\nimport ColorBoard from './ColorBoard';\nimport { HueSlider, AlphaSlider } from './Sliders';\nimport ColorInput from './ColorInput';\nimport { hsvToRgb, rgbToHex, parseColor } from './utils/color';\nimport './index.css';\n\nconst ColorPicker = ({ value, defaultValue, onChange }) => {\n // Initialize state\n const [isOpen, setIsOpen] = useState(false);\n \n // Internal state for color components\n const [color, setColor] = useState(() => {\n const initColor = value || defaultValue || '#1677ff';\n return parseColor(initColor);\n });\n\n const containerRef = useRef(null);\n\n // Sync with prop value if controlled\n useEffect(() => {\n if (value !== undefined) {\n setColor(parseColor(value));\n }\n }, [value]);\n\n const handleChange = (newColor) => {\n const nextColor = { ...color, ...newColor };\n setColor(nextColor);\n \n if (onChange) {\n const rgb = hsvToRgb(nextColor.h, nextColor.s, nextColor.v);\n const hex = rgbToHex(rgb.r, rgb.g, rgb.b);\n // Return a rich object or just hex string? \n // AntD returns an object, but simple string is often easier. \n // Let's return the hex string and the object as second arg just in case.\n onChange(hex, { ...rgb, a: nextColor.a });\n }\n };\n\n // Click outside to close\n useEffect(() => {\n const handleClickOutside = (event) => {\n if (containerRef.current && !containerRef.current.contains(event.target)) {\n setIsOpen(false);\n }\n };\n\n if (isOpen) {\n document.addEventListener('mousedown', handleClickOutside);\n }\n \n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n };\n }, [isOpen]);\n\n const rgb = hsvToRgb(color.h, color.s, color.v);\n const displayColor = `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${color.a})`;\n\n return (\n <div className=\"color-picker-container\" ref={containerRef} style={{ position: 'relative', display: 'inline-block' }}>\n <div \n className=\"color-picker-trigger\"\n onClick={() => setIsOpen(!isOpen)}\n >\n <div \n className=\"color-block\" \n style={{ backgroundColor: displayColor }} \n />\n </div>\n\n {isOpen && (\n <div \n className=\"color-picker-panel\" \n style={{ \n position: 'absolute', \n top: '100%', \n left: 0, \n zIndex: 1000, \n marginTop: 4 \n }}\n >\n <ColorBoard\n hue={color.h}\n saturation={color.s}\n value={color.v}\n onChange={(s, v) => handleChange({ s, v })}\n />\n <HueSlider\n hue={color.h}\n onChange={(h) => handleChange({ h })}\n />\n <AlphaSlider\n alpha={color.a}\n color={rgb}\n onChange={(a) => handleChange({ a })}\n />\n <ColorInput\n hue={color.h}\n saturation={color.s}\n value={color.v}\n alpha={color.a}\n onChange={(newHsv) => handleChange(newHsv)}\n />\n </div>\n )}\n </div>\n );\n};\n\nexport default ColorPicker;\n"],"names":["clamp","value","min","max","Math","hsvToRgb","h","s","v","r","g","b","i","floor","f","p","q","t","round","rgbToHsv","d","rgbToHex","toHex","c","hex","toString","length","hexToRgb","replace","m","result","exec","parseInt","parseColor","color","a","startsWith","rgb","rgbaMatch","match","undefined","parseFloat","ColorBoard","_ref","hue","saturation","onChange","containerRef","useRef","isDragging","setIsDragging","useState","handleChange","useCallback","e","current","width","height","left","top","getBoundingClientRect","x","clientX","y","clientY","handleMouseUp","useEffect","handleMouseMove","window","addEventListener","removeEventListener","React","createElement","ref","className","style","backgroundColor","onMouseDown","Slider","children","HueSlider","AlphaSlider","alpha","background","ColorInput","mode","setMode","localValue","setLocalValue","showDropdown","setShowDropdown","dropdownRef","handleClickOutside","event","contains","target","document","getRgb","hsl","l","rgbToHsl","handleRgbChange","key","val","newValue","isNaN","hsv","handleHslChange","hue2rgb","hslToRgb","onClick","fontSize","marginLeft","transform","display","transition","stopPropagation","EyeDropper","Promise","resolve","eyeDropper","_temp","open","then","sRGBHex","_catch","reject","title","viewBox","fill","test","Fragment","type","placeholder","defaultValue","isOpen","setIsOpen","setColor","newColor","nextColor","_extends","position","zIndex","marginTop","newHsv"],"mappings":"+UAOgB,SAAAA,EAAMC,EAAOC,EAAKC,GAChC,OAAOC,KAAKF,IAAIE,KAAKD,IAAIF,EAAOC,GAAMC,EACxC,CASgB,SAAAE,EAASC,EAA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AAM5B,EACXuC,WAAYX,EAAM3B,EAClBN,MAAOiC,EAAM1B,EACb0E,MAAOhD,EAAMC,EACbW,SAAWkG,GAAW5F,EAAa4F"}
1
+ {"version":3,"file":"index.js","sources":["../src/lib/utils/color.js","../src/lib/ColorBoard.js","../src/lib/Sliders.js","../src/lib/ColorInput.js","../src/lib/index.js"],"sourcesContent":["export function clamp(value, min, max) {\n return Math.min(Math.max(value, min), max);\n}\n\nexport function hsvToRgb(h, s, v) {\n h = ((h % 360) + 360) % 360;\n let r, g, b;\n let i = Math.floor(h / 60);\n let f = h / 60 - i;\n let p = v * (1 - s);\n let q = v * (1 - f * s);\n let t = v * (1 - (1 - f) * s);\n\n switch (i % 6) {\n case 0:\n r = v;\n g = t;\n b = p;\n break;\n case 1:\n r = q;\n g = v;\n b = p;\n break;\n case 2:\n r = p;\n g = v;\n b = t;\n break;\n case 3:\n r = p;\n g = q;\n b = v;\n break;\n case 4:\n r = t;\n g = p;\n b = v;\n break;\n case 5:\n r = v;\n g = p;\n b = q;\n break;\n default:\n r = 0;\n g = 0;\n b = 0;\n }\n\n return {\n r: Math.round(r * 255),\n g: Math.round(g * 255),\n b: Math.round(b * 255),\n };\n}\n\nexport function rgbToHsv(r, g, b) {\n r /= 255;\n g /= 255;\n b /= 255;\n\n let max = Math.max(r, g, b);\n let min = Math.min(r, g, b);\n let h,\n s,\n v = max;\n\n let d = max - min;\n s = max === 0 ? 0 : d / max;\n\n if (max === min) {\n h = 0;\n } else {\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n default:\n h = 0;\n }\n h /= 6;\n }\n\n return {\n h: h * 360,\n s: s,\n v: v,\n };\n}\n\nexport function rgbToHex(r, g, b) {\n const toHex = (c) => {\n const hex = Math.round(c).toString(16);\n return hex.length === 1 ? \"0\" + hex : hex;\n };\n return \"#\" + toHex(r) + toHex(g) + toHex(b);\n}\n\nexport function hexToRgb(hex) {\n const shorthandRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;\n hex = hex.replace(shorthandRegex, function(m, r, g, b) {\n return r + r + g + g + b + b;\n });\n\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n return result\n ? {\n r: parseInt(result[1], 16),\n g: parseInt(result[2], 16),\n b: parseInt(result[3], 16),\n }\n : null;\n}\n\nexport function parseColor(color) {\n if (!color) return { h: 0, s: 1, v: 1, a: 1 };\n\n if (color.startsWith(\"#\")) {\n const rgb = hexToRgb(color);\n if (rgb) {\n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b);\n return { ...hsv, a: 1 };\n }\n }\n\n const rgbaMatch = color.match(\n /^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*([\\d.]+))?\\)$/\n );\n if (rgbaMatch) {\n const r = parseInt(rgbaMatch[1], 10);\n const g = parseInt(rgbaMatch[2], 10);\n const b = parseInt(rgbaMatch[3], 10);\n const a = rgbaMatch[4] !== undefined ? parseFloat(rgbaMatch[4]) : 1;\n const hsv = rgbToHsv(r, g, b);\n return { ...hsv, a };\n }\n\n return { h: 0, s: 1, v: 1, a: 1 };\n}\n\nexport function rgbToHsl(r, g, b) {\n r /= 255;\n g /= 255;\n b /= 255;\n\n let max = Math.max(r, g, b),\n min = Math.min(r, g, b);\n let h,\n s,\n l = (max + min) / 2;\n\n if (max === min) {\n h = s = 0;\n } else {\n let d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n default:\n h = 0;\n }\n h /= 6;\n }\n\n return { h: h * 360, s: s, l: l };\n}\n\nexport function hslToRgb(h, s, l) {\n let r, g, b;\n\n if (s === 0) {\n r = g = b = l;\n } else {\n const hue2rgb = (p, q, t) => {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n };\n\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n h /= 360;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n\n return {\n r: Math.round(r * 255),\n g: Math.round(g * 255),\n b: Math.round(b * 255),\n };\n}\n","import React, { useRef, useEffect, useState, useCallback } from \"react\";\nimport { clamp } from \"./utils/color\";\n\nconst ColorBoard = ({ hue, saturation, value, onChange }) => {\n const containerRef = useRef(null);\n const [isDragging, setIsDragging] = useState(false);\n\n const handleChange = useCallback(\n (e) => {\n if (!containerRef.current) return;\n const {\n width,\n height,\n left,\n top,\n } = containerRef.current.getBoundingClientRect();\n const x = clamp(e.clientX - left, 0, width);\n const y = clamp(e.clientY - top, 0, height);\n\n const newSaturation = x / width;\n const newValue = 1 - y / height;\n\n onChange(newSaturation, newValue);\n },\n [onChange]\n );\n\n const handleMouseDown = (e) => {\n setIsDragging(true);\n handleChange(e);\n };\n\n const handleMouseUp = useCallback(() => {\n setIsDragging(false);\n }, []);\n\n useEffect(() => {\n const handleMouseMove = (e) => {\n if (isDragging) {\n handleChange(e);\n }\n };\n\n if (isDragging) {\n window.addEventListener(\"mousemove\", handleMouseMove);\n window.addEventListener(\"mouseup\", handleMouseUp);\n }\n\n return () => {\n window.removeEventListener(\"mousemove\", handleMouseMove);\n window.removeEventListener(\"mouseup\", handleMouseUp);\n };\n }, [isDragging, handleChange, handleMouseUp]);\n\n return (\n <div\n ref={containerRef}\n className=\"color-board\"\n style={{\n backgroundColor: `hsl(${hue}, 100%, 50%)`,\n }}\n onMouseDown={handleMouseDown}\n >\n <div className=\"color-board-white\" />\n <div className=\"color-board-black\" />\n <div\n className=\"color-board-handler\"\n style={{\n left: `${saturation * 100}%`,\n top: `${(1 - value) * 100}%`,\n }}\n />\n </div>\n );\n};\n\nexport default ColorBoard;\n","import React, { useRef, useState, useEffect, useCallback } from \"react\";\nimport { clamp } from \"./utils/color\";\n\nconst Slider = ({ value, max, onChange, className, style, children }) => {\n const containerRef = useRef(null);\n const [isDragging, setIsDragging] = useState(false);\n\n const handleChange = useCallback(\n (e) => {\n if (!containerRef.current) return;\n const { width, left } = containerRef.current.getBoundingClientRect();\n const x = clamp(e.clientX - left, 0, width);\n const newValue = (x / width) * max;\n onChange(newValue);\n },\n [max, onChange]\n );\n\n const handleMouseDown = (e) => {\n setIsDragging(true);\n handleChange(e);\n };\n\n const handleMouseUp = useCallback(() => {\n setIsDragging(false);\n }, []);\n\n useEffect(() => {\n const handleMouseMove = (e) => {\n if (isDragging) {\n handleChange(e);\n }\n };\n\n if (isDragging) {\n window.addEventListener(\"mousemove\", handleMouseMove);\n window.addEventListener(\"mouseup\", handleMouseUp);\n }\n\n return () => {\n window.removeEventListener(\"mousemove\", handleMouseMove);\n window.removeEventListener(\"mouseup\", handleMouseUp);\n };\n }, [isDragging, handleChange, handleMouseUp]);\n\n return (\n <div\n ref={containerRef}\n className={`color-slider ${className || \"\"}`}\n style={style}\n onMouseDown={handleMouseDown}\n >\n <div\n className=\"color-slider-handler\"\n style={{\n left: `${(value / max) * 100}%`,\n }}\n />\n {children}\n </div>\n );\n};\n\nexport const HueSlider = ({ hue, onChange }) => {\n return (\n <Slider value={hue} max={360} onChange={onChange} className=\"hue-slider\" />\n );\n};\n\nexport const AlphaSlider = ({ alpha, color, onChange }) => {\n const { r, g, b } = color;\n return (\n <Slider\n value={alpha}\n max={1}\n onChange={onChange}\n className=\"alpha-slider-bg\"\n style={{\n background: `linear-gradient(to right, rgba(${r},${g},${b},0) 0%, rgba(${r},${g},${b},1) 100%)`,\n }}\n />\n );\n};\n","import React, { useState, useEffect, useCallback, useRef } from \"react\";\nimport {\n rgbToHex,\n hexToRgb,\n hsvToRgb,\n rgbToHsv,\n rgbToHsl,\n hslToRgb,\n} from \"./utils/color\";\n\nconst ColorInput = ({ hue, saturation, value, alpha, onChange }) => {\n const [mode, setMode] = useState(\"HEX\");\n const [localValue, setLocalValue] = useState({});\n const [showDropdown, setShowDropdown] = useState(false);\n const dropdownRef = useRef(null);\n\n // 点击外部关闭下拉菜单\n useEffect(() => {\n const handleClickOutside = (event) => {\n if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {\n setShowDropdown(false);\n }\n };\n document.addEventListener(\"mousedown\", handleClickOutside);\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, []);\n\n const getRgb = useCallback(() => hsvToRgb(hue, saturation, value), [\n hue,\n saturation,\n value,\n ]);\n\n useEffect(() => {\n const rgb = getRgb();\n if (mode === \"HEX\") {\n setLocalValue({ hex: rgbToHex(rgb.r, rgb.g, rgb.b) });\n } else if (mode === \"RGB\") {\n setLocalValue({ r: rgb.r, g: rgb.g, b: rgb.b });\n } else if (mode === \"HSL\") {\n const hsl = rgbToHsl(rgb.r, rgb.g, rgb.b);\n setLocalValue({\n h: Math.round(hsl.h),\n s: Math.round(hsl.s * 100),\n l: Math.round(hsl.l * 100),\n });\n }\n }, [hue, saturation, value, mode, getRgb]);\n\n const handleHexChange = (e) => {\n const val = e.target.value;\n setLocalValue({ ...localValue, hex: val });\n if (/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i.test(val)) {\n const rgb = hexToRgb(val);\n if (rgb) {\n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b);\n onChange({ ...hsv, a: alpha });\n }\n }\n };\n\n const handleRgbChange = (key, val) => {\n const newValue = { ...localValue, [key]: val };\n setLocalValue(newValue);\n const r = parseInt(newValue.r, 10);\n const g = parseInt(newValue.g, 10);\n const b = parseInt(newValue.b, 10);\n if (!isNaN(r) && !isNaN(g) && !isNaN(b)) {\n const hsv = rgbToHsv(\n Math.min(255, Math.max(0, r)),\n Math.min(255, Math.max(0, g)),\n Math.min(255, Math.max(0, b))\n );\n onChange({ ...hsv, a: alpha });\n }\n };\n\n const handleHslChange = (key, val) => {\n const newValue = { ...localValue, [key]: val };\n setLocalValue(newValue);\n const h = parseInt(newValue.h, 10);\n const s = parseInt(newValue.s, 10);\n const l = parseInt(newValue.l, 10);\n if (!isNaN(h) && !isNaN(s) && !isNaN(l)) {\n const rgb = hslToRgb(\n Math.min(360, Math.max(0, h)),\n Math.min(100, Math.max(0, s)) / 100,\n Math.min(100, Math.max(0, l)) / 100\n );\n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b);\n onChange({ ...hsv, a: alpha });\n }\n };\n\n return (\n <div className=\"color-input-container\">\n <div\n className=\"mode-selector\"\n ref={dropdownRef}\n onClick={() => setShowDropdown(!showDropdown)}\n >\n <span>{mode.charAt(0) + mode.slice(1).toLowerCase()}</span>\n <span\n className=\"arrow\"\n style={{\n fontSize: \"10px\",\n marginLeft: \"4px\",\n transform: showDropdown ? \"rotate(180deg)\" : \"rotate(0deg)\",\n display: \"inline-block\",\n transition: \"transform 0.2s\",\n color: \"#8c8c8c\",\n }}\n >\n <svg\n viewBox=\"0 0 1024 1024\"\n width=\"10\"\n height=\"10\"\n fill=\"currentColor\"\n >\n <path d=\"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3 0.1-12.7-6.4-12.7z\" />\n </svg>\n </span>\n {showDropdown && (\n <div className=\"mode-dropdown\">\n <div\n className=\"mode-option\"\n onClick={(e) => {\n e.stopPropagation();\n setMode(\"HEX\");\n setShowDropdown(false);\n }}\n >\n Hex\n </div>\n <div\n className=\"mode-option\"\n onClick={(e) => {\n e.stopPropagation();\n setMode(\"RGB\");\n setShowDropdown(false);\n }}\n >\n RGB\n </div>\n <div\n className=\"mode-option\"\n onClick={(e) => {\n e.stopPropagation();\n setMode(\"HSL\");\n setShowDropdown(false);\n }}\n >\n HSL\n </div>\n </div>\n )}\n </div>\n\n <div className=\"color-input-fields\">\n {mode === \"HEX\" && (\n <div className=\"hex-input-wrapper\">\n <span className=\"hex-prefix\">#</span>\n <input\n className=\"color-input hex\"\n value={localValue.hex ? localValue.hex.replace(\"#\", \"\") : \"\"}\n onChange={handleHexChange}\n />\n </div>\n )}\n {mode === \"RGB\" && (\n <>\n <input\n className=\"color-input\"\n type=\"number\"\n placeholder=\"R\"\n value={localValue.r !== undefined ? localValue.r : \"\"}\n onChange={(e) => handleRgbChange(\"r\", e.target.value)}\n />\n <input\n className=\"color-input\"\n type=\"number\"\n placeholder=\"G\"\n value={localValue.g !== undefined ? localValue.g : \"\"}\n onChange={(e) => handleRgbChange(\"g\", e.target.value)}\n />\n <input\n className=\"color-input\"\n type=\"number\"\n placeholder=\"B\"\n value={localValue.b !== undefined ? localValue.b : \"\"}\n onChange={(e) => handleRgbChange(\"b\", e.target.value)}\n />\n </>\n )}\n {mode === \"HSL\" && (\n <>\n <input\n className=\"color-input\"\n type=\"number\"\n placeholder=\"H\"\n value={localValue.h !== undefined ? localValue.h : \"\"}\n onChange={(e) => handleHslChange(\"h\", e.target.value)}\n />\n <input\n className=\"color-input\"\n type=\"number\"\n placeholder=\"S\"\n value={localValue.s !== undefined ? localValue.s : \"\"}\n onChange={(e) => handleHslChange(\"s\", e.target.value)}\n />\n <input\n className=\"color-input\"\n type=\"number\"\n placeholder=\"L\"\n value={localValue.l !== undefined ? localValue.l : \"\"}\n onChange={(e) => handleHslChange(\"l\", e.target.value)}\n />\n </>\n )}\n <div className=\"color-input alpha-display\">\n {Math.round(alpha * 100)}%\n </div>\n </div>\n </div>\n );\n};\n\nexport default ColorInput;\n","import React, { useState, useRef, useEffect } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport ColorBoard from \"./ColorBoard\";\nimport { HueSlider, AlphaSlider } from \"./Sliders\";\nimport ColorInput from \"./ColorInput\";\nimport {\n hsvToRgb,\n rgbToHex,\n parseColor,\n hexToRgb,\n rgbToHsv,\n} from \"./utils/color\";\nimport \"./index.css\";\n\nconst DEFAULT_PRESETS = [\n \"#E0B5AE\",\n \"#B2BBDE\",\n \"#F2DDB3\",\n \"#E0E5C5\",\n \"#BBD0C3\",\n \"#B5D1E3\",\n \"#FFFFFF\",\n \"#D25536\",\n \"#EFA154\",\n \"#F7DA7E\",\n \"#5FA67F\",\n \"#A2829D\",\n \"#D390A2\",\n \"#000000\",\n \"#0099A4\",\n \"#EABA00\",\n \"#C9462C\",\n \"#3171AC\",\n \"#783780\",\n \"#1E80EA\",\n \"#2AAC3B\",\n \"#B63455\",\n \"#81532F\",\n \"#AA9A5C\",\n \"#828281\",\n \"#055753\",\n \"#8F262B\",\n \"#F0D8D0\",\n];\n\nconst ColorPicker = ({\n value,\n defaultValue,\n onChange,\n showLabel = true,\n label = \"Color\",\n showArrow = true,\n showInput = true,\n showColorBoard = true,\n presets: customPresets,\n}) => {\n const [isOpen, setIsOpen] = useState(false);\n const [isExpanded, setIsExpanded] = useState(false);\n const [recentColors, setRecentColors] = useState([]);\n const presets = customPresets || DEFAULT_PRESETS;\n\n const [color, setColor] = useState(() => {\n const initColor = value || defaultValue || \"#1677ff\";\n return parseColor(initColor);\n });\n\n const [inputValue, setInputValue] = useState(() => {\n const rgb = hsvToRgb(color.h, color.s, color.v);\n return rgbToHex(rgb.r, rgb.g, rgb.b).toUpperCase();\n });\n\n const containerRef = useRef(null);\n const triggerRef = useRef(null);\n const [panelStyle, setPanelStyle] = useState({});\n\n useEffect(() => {\n if (value !== undefined) {\n const newColor = parseColor(value);\n setColor(newColor);\n const rgb = hsvToRgb(newColor.h, newColor.s, newColor.v);\n setInputValue(rgbToHex(rgb.r, rgb.g, rgb.b).toUpperCase());\n }\n }, [value]);\n\n const handleChange = (newColor) => {\n const nextColor = { ...color, ...newColor };\n setColor(nextColor);\n\n const rgb = hsvToRgb(nextColor.h, nextColor.s, nextColor.v);\n const hex = rgbToHex(rgb.r, rgb.g, rgb.b).toUpperCase();\n setInputValue(hex);\n\n if (onChange) {\n onChange(hex, { ...rgb, a: nextColor.a });\n }\n };\n\n const handleInputChange = (e) => {\n const val = e.target.value;\n setInputValue(val);\n\n if (/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i.test(val)) {\n const rgb = hexToRgb(val);\n if (rgb) {\n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b);\n handleChange({ ...hsv, a: color.a });\n }\n }\n };\n\n useEffect(() => {\n if (\n !isOpen ||\n !triggerRef.current ||\n typeof window === \"undefined\" ||\n typeof document === \"undefined\"\n ) {\n return;\n }\n\n const triggerRect = triggerRef.current.getBoundingClientRect();\n const top = triggerRect.bottom + 4 + window.scrollY;\n const left = triggerRect.left + window.scrollX;\n\n setPanelStyle({\n position: \"absolute\",\n top,\n left,\n zIndex: 9999,\n });\n }, [isOpen]);\n\n const handleEyeDropper = async () => {\n if (!window.EyeDropper) {\n alert(\"当前浏览器不支持屏幕取色功能\");\n return;\n }\n\n try {\n const eyeDropper = new window.EyeDropper();\n const result = await eyeDropper.open();\n const { sRGBHex } = result;\n const rgb = hexToRgb(sRGBHex);\n if (rgb) {\n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b);\n handleChange({ ...hsv, a: 1 });\n }\n } catch (e) {\n // 用户取消取色或发生错误\n console.log(\"EyeDropper failed or canceled:\", e);\n }\n };\n\n useEffect(() => {\n const handleClickOutside = (event) => {\n if (\n containerRef.current &&\n !containerRef.current.contains(event.target)\n ) {\n setIsOpen(false);\n }\n };\n\n if (isOpen) {\n document.addEventListener(\"mousedown\", handleClickOutside);\n } else {\n const rgb = hsvToRgb(color.h, color.s, color.v);\n const currentHex = rgbToHex(rgb.r, rgb.g, rgb.b).toUpperCase();\n setRecentColors((prev) => {\n if (prev.includes(currentHex)) return prev;\n return [currentHex, ...prev].slice(0, 10);\n });\n }\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [isOpen, color]);\n\n const rgb = hsvToRgb(color.h, color.s, color.v);\n const displayColor = `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${color.a})`;\n const initialLimit = 14;\n const visiblePresets = isExpanded ? presets : presets.slice(0, initialLimit);\n const showExpand = presets.length > initialLimit;\n\n const panel = isOpen ? (\n <div className=\"color-picker-panel\" style={panelStyle}>\n {showColorBoard && (\n <div\n className=\"color-picker-board-wrapper\"\n style={{\n marginTop: \"10px\",\n paddingTop: \"10px\",\n borderTop: \"1px solid #eee\",\n }}\n >\n <ColorBoard\n hue={color.h}\n saturation={color.s}\n value={color.v}\n onChange={(s, v) => handleChange({ s, v })}\n />\n <HueSlider hue={color.h} onChange={(h) => handleChange({ h })} />\n <AlphaSlider\n alpha={color.a}\n color={rgb}\n onChange={(a) => handleChange({ a })}\n />\n <ColorInput\n hue={color.h}\n saturation={color.s}\n value={color.v}\n alpha={color.a}\n onChange={(newHsv) => handleChange(newHsv)}\n />\n </div>\n )}\n <div className=\"color-picker-presets\">\n <div className=\"palette-section-title\" style={{ marginTop: 8 }}>\n <span>Recommended</span>\n <span\n className=\"color-picker-icon-right\"\n onClick={handleEyeDropper}\n title=\"屏幕取色\"\n >\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <defs>\n <rect id=\"path-1\" x=\"0\" y=\"0\" width=\"16\" height=\"16\" />\n </defs>\n <g stroke=\"none\" strokeWidth=\"1\" fill=\"none\" fillRule=\"evenodd\">\n <g transform=\"translate(-920.000000, -594.000000)\">\n <g transform=\"translate(720.000000, 418.000000)\">\n <g transform=\"translate(200.000000, 176.000000)\">\n <mask id=\"mask-2\" fill=\"white\">\n <use xlinkHref=\"#path-1\" />\n </mask>\n <g />\n <g\n mask=\"url(#mask-2)\"\n fill=\"#000000\"\n fillOpacity=\"0.85\"\n fillRule=\"nonzero\"\n >\n <g transform=\"translate(8.106532, 8.106532) rotate(-315.000000) translate(-8.106532, -8.106532) translate(-0.266667, -0.266667)\">\n <path d=\"M5.67238576,2.96585378 L6.99478644,4.28811977 L7.03978941,4.24867364 C7.66833128,3.72977631 8.60030981,3.76436946 9.18839345,4.3524531 L9.94264069,5.10670034 C10.1509203,5.31497996 10.1509203,5.65266795 9.94264069,5.86094757 L9.18778644,6.61411977 L13.7138769,11.1406782 C14.4428555,11.8696569 14.4428555,13.0515648 13.7138769,13.7805435 C12.9848982,14.5095222 11.8029902,14.5095222 11.0740115,13.7805435 L6.54778644,9.25411977 L5.7942809,10.0093074 C5.58600128,10.217587 5.24831329,10.217587 5.04003367,10.0093074 L4.28578644,9.25506012 C3.66094757,8.63022125 3.66094757,7.61715729 4.28578644,6.99231842 L4.35178644,6.92511977 L3.03252045,5.6057191 C2.30354177,4.87674042 2.30354177,3.69483246 3.03252045,2.96585378 C3.76149912,2.2368751 4.94340708,2.2368751 5.67238576,2.96585378 Z M8.43414622,7.36944204 L7.86778644,7.93411977 L7.30277537,8.50081289 L11.8282588,13.0262963 C12.1295204,13.3275579 12.6112769,13.3383172 12.925431,13.0585743 L12.9596296,13.0262963 C13.2720491,12.7138769 13.2720491,12.2073449 12.9596296,11.8949254 L8.43414622,7.36944204 Z M7.70907857,5.07958956 L7.67989899,5.10670034 L5.04003367,7.74656565 C4.83175405,7.95484528 4.83175405,8.29253326 5.04003367,8.50081289 L5.41715729,8.8779365 L8.81126984,5.48382395 L8.43414622,5.10670034 C8.23533385,4.90788797 7.91861014,4.89885105 7.70907857,5.07958956 Z M3.82096628,3.68782298 L3.78676768,3.72010101 C3.47434825,4.03252045 3.47434825,4.53905243 3.78676768,4.85147186 L5.10670034,6.17140452 L6.23807119,5.04003367 L4.91813853,3.72010101 C4.61687693,3.41883942 4.13512038,3.40808007 3.82096628,3.68782298 Z\" transform=\"translate(8.373199, 8.373199) rotate(-315.000000) translate(-8.373199, -8.373199)\" />\n </g>\n </g>\n </g>\n </g>\n </g>\n </g>\n </svg>\n </span>\n </div>\n <div className={`presets-grid modern`}>\n {presets.map((preset, idx) => (\n <div\n key={idx}\n className=\"preset-item preset-item-inner\"\n style={{ backgroundColor: preset }}\n onClick={() => {\n const rgbValue = hexToRgb(preset);\n if (rgbValue) {\n const hsv = rgbToHsv(rgbValue.r, rgbValue.g, rgbValue.b);\n handleChange({ ...hsv, a: 1 });\n }\n }}\n title={preset}\n />\n ))}\n </div>\n {/* {showExpand && (\n <div\n className=\"presets-collapse\"\n onClick={() => setIsExpanded(!isExpanded)}\n >\n {isExpanded ? \"Less\" : \"More\"}\n <span className={`collapse-arrow ${isExpanded ? \"expanded\" : \"\"}`}>\n ▼\n </span>\n </div>\n )} */}\n\n {recentColors.length > 0 && (\n <>\n <div className=\"palette-section-title\">Recent</div>\n <div className=\"presets-grid recent\">\n {recentColors.map((recentColor, idx) => (\n <div\n key={idx}\n className=\"preset-item\"\n style={{ backgroundColor: recentColor }}\n onClick={() => {\n const rgbValue = hexToRgb(recentColor);\n if (rgbValue) {\n const hsv = rgbToHsv(\n rgbValue.r,\n rgbValue.g,\n rgbValue.b\n );\n handleChange({ ...hsv, a: 1 });\n }\n }}\n title={recentColor}\n />\n ))}\n </div>\n </>\n )}\n </div>\n </div>\n ) : null;\n\n return (\n <div className=\"color-picker-container\" ref={containerRef}>\n <div className=\"color-picker-main-row\">\n <div className=\"color-picker-tooltip-trigger\">\n {showLabel && <span className=\"color-picker-label\">{label}</span>}\n\n <div\n className={`color-picker-trigger ${isOpen ? \"is-open\" : \"\"}`}\n onClick={() => setIsOpen(!isOpen)}\n ref={triggerRef}\n >\n <div\n className=\"color-block\"\n style={{ backgroundColor: displayColor }}\n />\n {showArrow && (\n <span className={`color-picker-arrow ${isOpen ? \"open\" : \"\"}`}>\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <g stroke=\"none\" strokeWidth=\"1\" fill=\"none\" fillRule=\"evenodd\">\n <g\n transform=\"translate(-1348.000000, -88.000000)\"\n fillRule=\"nonzero\"\n >\n <g transform=\"translate(0.000000, 60.000000)\">\n <g transform=\"translate(584.000000, 20.000000)\">\n <g transform=\"translate(728.000000, 4.000000)\">\n <g transform=\"translate(44.000000, 12.000000) rotate(-360.000000) translate(-44.000000, -12.000000) translate(36.000000, 4.000000)\">\n <rect\n fill=\"#000000\"\n opacity=\"0\"\n x=\"0\"\n y=\"0\"\n width=\"16\"\n height=\"16\"\n />\n <path\n d=\"M13.0750341,5.34788541 C12.9440655,5.21691678 12.7257845,5.21691678 12.5948158,5.34788541 L8.01091405,9.93178717 L3.40518417,5.34788541 C3.27421555,5.21691678 3.05593452,5.21691678 2.92496589,5.34788541 C2.79399727,5.47885403 2.79399727,5.69713506 2.92496589,5.82810369 L7.77080491,10.6521146 C7.90177353,10.7830832 8.12005456,10.7830832 8.25102319,10.6521146 L13.0750341,5.82810369 C13.2060027,5.69713506 13.2060027,5.47885403 13.0750341,5.34788541 Z\"\n stroke=\"#FFFFFF\"\n />\n </g>\n </g>\n </g>\n </g>\n </g>\n </g>\n </svg>\n </span>\n )}\n <span className=\"tooltip-text\">Color Picker</span>\n </div>\n </div>\n\n {showInput && (\n <div className=\"color-picker-input-wrapper\">\n <input\n type=\"text\"\n value={inputValue}\n onChange={handleInputChange}\n placeholder=\"Please input color\"\n />\n {inputValue && (\n <span\n className=\"input-clear-icon\"\n onClick={() => setInputValue(\"\")}\n >\n <img\n src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAA8klEQVQ4T51SwVHDQAzcdQOETugAqISkg/Cw9CRf2Q+gAkwlJB1QimnAYnRz57m55AG5l2+9K632RFw44zg+ALiPX+5+FJFTS2MNmNme5AuATUOcARxE5L3gq9DMJpJPlxxU2CQiu7gnYe70mq19tgXcfcXc/VlV34pwJnkTBFXdDsOwBfCRO+1EZKoczSJyywjC3b8qO4mYxai+SyGQfKSZHXIg9XhJHEDTPXHC7vXCq63mVP8cjrv/qOrm7DkAxGyRan1qLM3/rwUoz7UuQCkdixCrFW9atwt7JPcl6TNhIUdgy7Lcxb3ruu++74/tKv4CNXed5xhXezYAAAAASUVORK5CYII=\"\n alt=\"\"\n width=\"12\"\n height=\"12\"\n />\n </span>\n )}\n </div>\n )}\n </div>\n\n {typeof document !== \"undefined\" &&\n ReactDOM.createPortal(panel, document.body)}\n\n <div>\n <div className={`presets-grid modern`}>\n {visiblePresets.map((preset, idx) => (\n <div\n key={idx}\n className=\"preset-item\"\n style={{ backgroundColor: preset }}\n onClick={() => {\n const rgb = hexToRgb(preset);\n if (rgb) {\n const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b);\n handleChange({ ...hsv, a: 1 });\n }\n }}\n title={preset}\n />\n ))}\n </div>\n {showExpand && (\n <div\n className=\"presets-collapse\"\n onClick={() => setIsExpanded(!isExpanded)}\n >\n {isExpanded ? \"Less\" : \"More\"}\n <span className={`collapse-arrow ${isExpanded ? \"expanded\" : \"\"}`}>\n ▼\n </span>\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport default ColorPicker;\n"],"names":["clamp","value","min","max","Math","hsvToRgb","h","s","v","r","g","b","i","floor","f","p","q","t","round","rgbToHsv","d","rgbToHex","toHex","c","hex","toString","length","hexToRgb","replace","m","result","exec","parseInt","parseColor","color","a","startsWith","rgb","rgbaMatch","match","undefined","parseFloat","ColorBoard","hue","saturation","onChange","containerRef","useRef","isDragging","setIsDragging","useState","handleChange","useCallback","e","current","width","height","left","top","getBoundingClientRect","x","clientX","y","clientY","handleMouseUp","useEffect","handleMouseMove","window","addEventListener","removeEventListener","React","createElement","ref","className","style","backgroundColor","onMouseDown","Slider","children","HueSlider","AlphaSlider","alpha","background","ColorInput","mode","setMode","localValue","setLocalValue","showDropdown","setShowDropdown","dropdownRef","handleClickOutside","event","contains","target","document","getRgb","hsl","l","rgbToHsl","handleRgbChange","key","val","newValue","isNaN","hsv","handleHslChange","hue2rgb","hslToRgb","onClick","charAt","slice","toLowerCase","fontSize","marginLeft","transform","display","transition","viewBox","fill","stopPropagation","test","Fragment","type","placeholder","DEFAULT_PRESETS","_ref","defaultValue","showLabel","label","showArrow","showInput","showColorBoard","presets","customPresets","isOpen","setIsOpen","isExpanded","setIsExpanded","recentColors","setRecentColors","setColor","inputValue","setInputValue","toUpperCase","triggerRef","panelStyle","setPanelStyle","newColor","nextColor","_extends","triggerRect","bottom","scrollY","scrollX","position","zIndex","currentHex","prev","includes","displayColor","visiblePresets","showExpand","panel","marginTop","paddingTop","borderTop","newHsv","handleEyeDropper","EyeDropper","alert","Promise","resolve","_temp","body","recover","eyeDropper","open","then","sRGBHex","_catch","console","log","reject","title","xmlns","id","stroke","strokeWidth","fillRule","xlinkHref","mask","fillOpacity","map","preset","idx","rgbValue","recentColor","opacity","src","alt","ReactDOM","createPortal"],"mappings":"0XAAgB,SAAAA,EAAMC,EAAOC,EAAKC,GAChC,OAAOC,KAAKF,IAAIE,KAAKD,IAAIF,EAAOC,GAAMC,EACxC,CAEgB,SAAAE,EAASC,EAAGC,EAAGC,GAE7B,IAAIC,EAAGC,EAAGC,EADVL,GAAMA,EAAI,IAAO,KAAO,IAExB,IAAIM,EAAIR,KAAKS,MAAMP,EAAI,IACnBQ,EAAIR,EAAI,GAAKM,EACbG,EAAIP,GAAK,EAAID,GACbS,EAAIR,GAAK,EAAIM,EAAIP,GACjBU,EAAIT,GAAK,GAAK,EAAIM,GAAKP,GAE3B,OAAQK,EAAI,GACV,KAAK,EACHH,EAAID,EACJE,EAAIO,EACJN,EAAII,EACJ,MACF,KAAM,EACJN,EAAIO,EACJN,EAAIF,EACJG,EAAII,EACJ,MACF,OACEN,EAAIM,EACJL,EAAIF,EACJG,EAAIM,EACJ,MACF,KAAM,EACJR,EAAIM,EACJL,EAAIM,EACJL,EAAIH,EACJ,MACF,KAAK,EACHC,EAAIQ,EACJP,EAAIK,EACJJ,EAAIH,EACJ,MACF,KAAM,EACJC,EAAID,EACJE,EAAIK,EACJJ,EAAIK,EACJ,MACF,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