react-iro-gradient-picker 1.0.0
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/LICENSE +21 -0
- package/README.md +198 -0
- package/dist/App.test.d.ts +1 -0
- package/dist/__tests__/App.test.d.ts +1 -0
- package/dist/__tests__/setupTests.d.ts +1 -0
- package/dist/components/Colorpicker/ColorPanel/Alpha.d.ts +4 -0
- package/dist/components/Colorpicker/ColorPanel/Board.d.ts +4 -0
- package/dist/components/Colorpicker/ColorPanel/Ribbon.d.ts +4 -0
- package/dist/components/Colorpicker/ColorPanel/index.d.ts +4 -0
- package/dist/components/Colorpicker/ColorPanel/types.d.ts +34 -0
- package/dist/components/Colorpicker/DefaultColorPanel/index.d.ts +11 -0
- package/dist/components/Colorpicker/Gradient/index.d.ts +4 -0
- package/dist/components/Colorpicker/GradientPanel/Markers.d.ts +4 -0
- package/dist/components/Colorpicker/GradientPanel/index.d.ts +4 -0
- package/dist/components/Colorpicker/GradientPanel/types.d.ts +29 -0
- package/dist/components/Colorpicker/Solid/index.d.ts +4 -0
- package/dist/components/Colorpicker/constants.d.ts +6 -0
- package/dist/components/Colorpicker/helper.d.ts +4 -0
- package/dist/components/Colorpicker/index.d.ts +6 -0
- package/dist/components/Colorpicker/types.d.ts +35 -0
- package/dist/components/InputRgba/helpers.d.ts +34 -0
- package/dist/components/InputRgba/index.d.ts +16 -0
- package/dist/components/PopupTab/index.d.ts +15 -0
- package/dist/components/ThemeToggle/index.d.ts +6 -0
- package/dist/components/core/Colorpicker/ColorPanel/Alpha.d.ts +4 -0
- package/dist/components/core/Colorpicker/ColorPanel/Board.d.ts +4 -0
- package/dist/components/core/Colorpicker/ColorPanel/Ribbon.d.ts +4 -0
- package/dist/components/core/Colorpicker/ColorPanel/index.d.ts +4 -0
- package/dist/components/core/Colorpicker/ColorPanel/types.d.ts +34 -0
- package/dist/components/core/Colorpicker/DefaultColorPanel/index.d.ts +11 -0
- package/dist/components/core/Colorpicker/Gradient/index.d.ts +4 -0
- package/dist/components/core/Colorpicker/GradientPanel/Markers.d.ts +4 -0
- package/dist/components/core/Colorpicker/GradientPanel/index.d.ts +4 -0
- package/dist/components/core/Colorpicker/GradientPanel/types.d.ts +29 -0
- package/dist/components/core/Colorpicker/IroGradient/index.d.ts +4 -0
- package/dist/components/core/Colorpicker/IroSolid/index.d.ts +4 -0
- package/dist/components/core/Colorpicker/Solid/index.d.ts +4 -0
- package/dist/components/core/Colorpicker/helper.d.ts +4 -0
- package/dist/components/core/Colorpicker/index.d.ts +6 -0
- package/dist/components/core/IroColorPicker/index.d.ts +37 -0
- package/dist/components/forms/InputRgba/InputRgba.d.ts +15 -0
- package/dist/components/forms/InputRgba/helpers.d.ts +24 -0
- package/dist/components/forms/InputRgba/index.d.ts +1 -0
- package/dist/components/forms/index.d.ts +1 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/providers/ThemeContext.d.ts +14 -0
- package/dist/components/ui/PopupTab/index.d.ts +14 -0
- package/dist/components/ui/ThemeToggle/index.d.ts +6 -0
- package/dist/constants/constants.d.ts +6 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/context/ThemeContext.d.ts +14 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useDebounce.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +8284 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.js +8316 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/index.d.ts +6 -0
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/types.d.ts +35 -0
- package/dist/setupTests.d.ts +1 -0
- package/dist/utils/checkFormat.d.ts +2 -0
- package/dist/utils/cn.d.ts +6 -0
- package/dist/utils/color/color.d.ts +71 -0
- package/dist/utils/color/getHexAlpha.d.ts +5 -0
- package/dist/utils/color/hexToRgba.d.ts +2 -0
- package/dist/utils/color/index.d.ts +6 -0
- package/dist/utils/color/rgbaToArray.d.ts +2 -0
- package/dist/utils/color/rgbaToHex.d.ts +2 -0
- package/dist/utils/color.d.ts +71 -0
- package/dist/utils/format/checkFormat.d.ts +2 -0
- package/dist/utils/format/getGradient.d.ts +2 -0
- package/dist/utils/format/index.d.ts +3 -0
- package/dist/utils/format/parseGradient.d.ts +7 -0
- package/dist/utils/getGradient.d.ts +2 -0
- package/dist/utils/getHexAlpha.d.ts +5 -0
- package/dist/utils/hexToRgba.d.ts +2 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/isValidHex.d.ts +2 -0
- package/dist/utils/isValidRgba.d.ts +2 -0
- package/dist/utils/parseGradient.d.ts +7 -0
- package/dist/utils/rgbaToArray.d.ts +2 -0
- package/dist/utils/rgbaToHex.d.ts +2 -0
- package/dist/utils/useDebounce.d.ts +2 -0
- package/dist/utils/validGradient.d.ts +15 -0
- package/dist/utils/validation/index.d.ts +3 -0
- package/dist/utils/validation/isValidHex.d.ts +2 -0
- package/dist/utils/validation/isValidRgba.d.ts +2 -0
- package/dist/utils/validation/validGradient.d.ts +15 -0
- package/package.json +130 -0
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c)2021 undind
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
@@ -0,0 +1,198 @@
|
|
1
|
+
<!-- markdownlint-disable -->
|
2
|
+
# React Iro Gradient Picker
|
3
|
+
|
4
|
+
## ✨ Modern React Color Picker with Complete Dark Theme Support! ✨
|
5
|
+
|
6
|
+
A beautiful, modern React gradient and solid color picker with full dark theme integration, built with Tailwind CSS and TypeScript.
|
7
|
+
|
8
|
+
### Inspired by [gpickr](https://github.com/Simonwep/gpickr) and enhanced with modern features
|
9
|
+
|
10
|
+
[](https://www.npmjs.com/package/react-iro-gradient-picker) [](https://github.com/romfatal/react-iro-gradient-picker/blob/main/LICENSE)
|
11
|
+
|
12
|
+
**[Demo](https://romfatal.github.io/react-iro-gradient-picker/)**
|
13
|
+
|
14
|
+
## ✨ Features
|
15
|
+
|
16
|
+
- 🌙 **Complete Dark Theme** - Works perfectly across all components (modal, solid, gradient)
|
17
|
+
- 🎨 **Gradient & Solid Colors** - Full support for both gradient and solid color picking
|
18
|
+
- 🔄 **Theme Toggle** - Easy switching between light and dark themes
|
19
|
+
- 💾 **Theme Persistence** - Automatically saves user theme preference
|
20
|
+
- 🎯 **Tailwind CSS** - Modern styling with comprehensive theming system
|
21
|
+
- 📱 **Responsive Design** - Works great on all screen sizes
|
22
|
+
|
23
|
+
## Install
|
24
|
+
|
25
|
+
### **Important: this component uses React Hooks and works on React version 16.8.0 and higher**
|
26
|
+
|
27
|
+
---
|
28
|
+
|
29
|
+
```bash
|
30
|
+
npm install --save react-iro-gradient-picker
|
31
|
+
```
|
32
|
+
|
33
|
+
OR
|
34
|
+
|
35
|
+
```bash
|
36
|
+
yarn add react-iro-gradient-picker
|
37
|
+
```
|
38
|
+
|
39
|
+
## Usage
|
40
|
+
|
41
|
+
```tsx
|
42
|
+
import React from 'react';
|
43
|
+
import ReactIroGradientPicker from 'react-iro-gradient-picker';
|
44
|
+
|
45
|
+
function App() {
|
46
|
+
const onChange = (value) => {
|
47
|
+
console.log(value);
|
48
|
+
};
|
49
|
+
|
50
|
+
return <ReactIroGradientPicker value='red' onChange={onChange} />;
|
51
|
+
}
|
52
|
+
|
53
|
+
export default App;
|
54
|
+
```
|
55
|
+
|
56
|
+
## 🌟 What Makes This Special
|
57
|
+
|
58
|
+
This is an enhanced version of the original react-gcolor-picker with major improvements:
|
59
|
+
|
60
|
+
### 🌙 Complete Dark Theme Integration
|
61
|
+
|
62
|
+
- **Fixed all components** - Modal, solid picker, gradient picker, and inputs now work perfectly in dark mode
|
63
|
+
- **CSS Custom Properties** - Dynamic theming that responds to theme changes
|
64
|
+
- **Tailwind CSS Integration** - Modern, maintainable styling system
|
65
|
+
- **Theme Toggle Component** - Easy switching between light/dark themes
|
66
|
+
- **Persistent Preferences** - Automatically saves user's theme choice
|
67
|
+
|
68
|
+
### 🎯 Enhanced Storybook Documentation
|
69
|
+
|
70
|
+
- **Dark-themed Storybook** - Professional development environment
|
71
|
+
- **Comprehensive Documentation** - Updated guides and examples
|
72
|
+
- **Live Examples** - See all components working in both themes
|
73
|
+
|
74
|
+
### 🚀 Modern Development Stack
|
75
|
+
|
76
|
+
- **TypeScript Support** - Full type safety and better development experience
|
77
|
+
- **Updated Dependencies** - Latest versions of all packages
|
78
|
+
- **Better Build Process** - Optimized for modern React applications
|
79
|
+
|
80
|
+
export default App;
|
81
|
+
|
82
|
+
```
|
83
|
+
|
84
|
+
## Props
|
85
|
+
|
86
|
+
| Attribute | Type | Default | Description |
|
87
|
+
| :-------------------- | :--------: | :-------------------------: | :---------------------------------------------------------------------------------------------------- |
|
88
|
+
| value | `string` | `#ffffff` | Default color value. Accept: rgba/rgb, hsla/hsl, named colors |
|
89
|
+
| format | `string` | `rgb` | Return value format. Accept: 'rgb', 'hex', 'hsl' |
|
90
|
+
| gradient | `bool` | `false` | Show gradient color panel |
|
91
|
+
| solid | `bool` | `true` | Show solid color panel |
|
92
|
+
| debounceMS | `number` | `300` | Debounce ms value |
|
93
|
+
| debounce | `bool` | `true` | Debouce off/on |
|
94
|
+
| showAlpha | `bool` | `true` | Show/hide alpha input and range |
|
95
|
+
| showInputs | `bool` | `true` | Show/hide inputs alpha and color |
|
96
|
+
| showGradientResult | `bool` | `true` | Show/hide gradient result fields(angle, mode, position) |
|
97
|
+
| showGradientStops | `bool` | `true` | Show/hide gradient color stops |
|
98
|
+
| showGradientMode | `bool` | `true` | Show/hide gradient color mode switcher |
|
99
|
+
| showGradientAngle | `bool` | `true` | Show/hide gradient angle for linear-gradient |
|
100
|
+
| showGradientPosition | `bool` | `true` | Show/hide gradient position for radial-gradient |
|
101
|
+
| allowAddGradientStops | `bool` | `true` | Allow to add new gradient stops |
|
102
|
+
| popupWidth | `number` | `267` | Popup width |
|
103
|
+
| colorBoardHeight | `number` | `120` | Board color height |
|
104
|
+
| defaultColors | `array` | [List](#default-color-list) | Default colors array for panel picker |
|
105
|
+
| defaultActiveTab | `string` | `undefined` | Default value for active tab when initializing the component, takes two values: `solid` or `gradient` |
|
106
|
+
| onChangeTabs | `function` | `null` | Default onChange function detect when tabs change and return one of the values: `solid` or `gradient` |
|
107
|
+
| onChange | `function` | `null` | Default onChange function returns string value in the given format |
|
108
|
+
|
109
|
+
When passing a value for a gradient, you must specify the position of all colors. Otherwise the component will throw an exception.
|
110
|
+
For example:
|
111
|
+
|
112
|
+
### Wrong
|
113
|
+
|
114
|
+
```
|
115
|
+
|
116
|
+
linear-gradient(180deg, #000000,#ff0000)
|
117
|
+
|
118
|
+
```
|
119
|
+
|
120
|
+
### Correct
|
121
|
+
|
122
|
+
```
|
123
|
+
|
124
|
+
linear-gradient(180deg, #000000 0%,#ff0000 100%)
|
125
|
+
|
126
|
+
```
|
127
|
+
|
128
|
+
If you are using a radial gradient a list of possible directions for it:
|
129
|
+
|
130
|
+
```
|
131
|
+
|
132
|
+
circle at left top
|
133
|
+
circle at center top
|
134
|
+
circle at right top
|
135
|
+
circle at left
|
136
|
+
circle at center
|
137
|
+
circle at right
|
138
|
+
circle at left bottom
|
139
|
+
circle at center bottom
|
140
|
+
circle at right bottom
|
141
|
+
|
142
|
+
```
|
143
|
+
|
144
|
+
## Default color list
|
145
|
+
|
146
|
+
```
|
147
|
+
|
148
|
+
'#FF6900',
|
149
|
+
'#FCB900',
|
150
|
+
'#7BDCB5',
|
151
|
+
'#00D084',
|
152
|
+
'#8ED1FC',
|
153
|
+
'#0693E3',
|
154
|
+
'#ABB8C3',
|
155
|
+
'#607d8b',
|
156
|
+
'#EB144C',
|
157
|
+
'#F78DA7',
|
158
|
+
'#ba68c8',
|
159
|
+
'#9900EF',
|
160
|
+
'linear-gradient(0deg, rgb(255, 177, 153) 0%, rgb(255, 8, 68) 100%)',
|
161
|
+
'linear-gradient(270deg, rgb(251, 171, 126) 8.00%, rgb(247, 206, 104) 92.00%)',
|
162
|
+
'linear-gradient(315deg, rgb(150, 230, 161) 8.00%, rgb(212, 252, 121) 92.00%)',
|
163
|
+
'linear-gradient(to left, rgb(249, 240, 71) 0%, rgb(15, 216, 80) 100%)',
|
164
|
+
'linear-gradient(315deg, rgb(194, 233, 251) 8.00%, rgb(161, 196, 253) 92.00%)',
|
165
|
+
'linear-gradient(0deg, rgb(0, 198, 251) 0%, rgb(0, 91, 234) 100%)',
|
166
|
+
'linear-gradient(0deg, rgb(167, 166, 203) 0%, rgb(137, 137, 186) 51.00%, rgb(137, 137, 186) 100%)',
|
167
|
+
'linear-gradient(0deg, rgb(80, 82, 133) 0%, rgb(88, 94, 146) 15.0%, rgb(101, 104, 159) 28.00%, rgb(116, 116, 176) 43.00%, rgb(126, 126, 187) 57.00%, rgb(131, 137, 199) 71.00%, rgb(151, 149, 212) 82.00%, rgb(162, 161, 220) 92.00%, rgb(181, 174, 228) 100%)',
|
168
|
+
'linear-gradient(270deg, rgb(255, 126, 179) 0%, rgb(255, 117, 140) 100%)',
|
169
|
+
'linear-gradient(90deg, rgb(120, 115, 245) 0%, rgb(236, 119, 171) 100%)',
|
170
|
+
'linear-gradient(45deg, #2e266f 0.00%, #9664dd38 100.00%)',
|
171
|
+
'radial-gradient(circle at center, yellow 0%, #009966 50%, purple 100%)'
|
172
|
+
|
173
|
+
```
|
174
|
+
|
175
|
+
## FAQ
|
176
|
+
|
177
|
+
**Q:** There's any possibility to remove extra gradient lines?
|
178
|
+
|
179
|
+
**A:** Yes, you only need to drag them outside(bottom) the Gradient component area or double click on the element you want to remove.
|
180
|
+
|
181
|
+
## Credits & Attribution
|
182
|
+
|
183
|
+
This project is based on the excellent [react-gcolor-picker](https://github.com/undind/react-gcolor-picker) by [undind](https://github.com/undind), enhanced with:
|
184
|
+
|
185
|
+
- Complete dark theme integration
|
186
|
+
- Modern Tailwind CSS styling
|
187
|
+
- Improved TypeScript support
|
188
|
+
- Enhanced Storybook documentation
|
189
|
+
- Better accessibility features
|
190
|
+
|
191
|
+
Special thanks to the original author for creating such a solid foundation! 🙏
|
192
|
+
|
193
|
+
## License
|
194
|
+
|
195
|
+
MIT © [romfatal](https://github.com/romfatal)
|
196
|
+
|
197
|
+
Original project: MIT © [undind](https://github.com/undind)
|
198
|
+
```
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
2
|
+
import { ITinyColor } from '../../../utils/color';
|
3
|
+
export type TPropsChange = {
|
4
|
+
alpha: number;
|
5
|
+
hex: string;
|
6
|
+
};
|
7
|
+
export type TPropsComp = {
|
8
|
+
rootPrefixCls?: string;
|
9
|
+
color: ITinyColor;
|
10
|
+
alpha?: number;
|
11
|
+
colorBoardHeight?: number;
|
12
|
+
onChange: (color: ITinyColor) => void;
|
13
|
+
setChange: Dispatch<SetStateAction<boolean>>;
|
14
|
+
};
|
15
|
+
export type TPropsCompAlpha = {
|
16
|
+
rootPrefixCls?: string;
|
17
|
+
color: ITinyColor;
|
18
|
+
alpha?: number;
|
19
|
+
showAlpha?: boolean;
|
20
|
+
onChange: (alpha: number) => void;
|
21
|
+
setChange: Dispatch<SetStateAction<boolean>>;
|
22
|
+
};
|
23
|
+
export type TPropsMain = {
|
24
|
+
alpha: number;
|
25
|
+
className?: string;
|
26
|
+
hex: string;
|
27
|
+
showAlpha?: boolean;
|
28
|
+
colorBoardHeight?: number;
|
29
|
+
onChange: ({ alpha, hex }: TPropsChange) => void;
|
30
|
+
};
|
31
|
+
export type TCoords = {
|
32
|
+
x: number;
|
33
|
+
y: number;
|
34
|
+
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { FC } from 'react';
|
2
|
+
import { IActiveColor } from '../types';
|
3
|
+
interface IProps {
|
4
|
+
defaultColors?: Array<string>;
|
5
|
+
setColor: (color: any) => void;
|
6
|
+
setInit: (init: boolean) => void;
|
7
|
+
setActiveColor?: (color: IActiveColor) => void;
|
8
|
+
colorType: 'solid' | 'gradient';
|
9
|
+
}
|
10
|
+
declare const DefaultColorPanel: FC<IProps>;
|
11
|
+
export default DefaultColorPanel;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
2
|
+
import { IActiveColor } from '../types';
|
3
|
+
export interface IColor {
|
4
|
+
gradient: string;
|
5
|
+
type: string;
|
6
|
+
modifier: string | number;
|
7
|
+
stops: Array<any>;
|
8
|
+
}
|
9
|
+
export type TCoords = {
|
10
|
+
x: number;
|
11
|
+
y: number;
|
12
|
+
shiftKey?: number | boolean;
|
13
|
+
ctrlKey?: number | boolean;
|
14
|
+
};
|
15
|
+
export interface IPropsPanel {
|
16
|
+
color: IColor;
|
17
|
+
setColor: (color: IColor) => void;
|
18
|
+
activeColor: IActiveColor;
|
19
|
+
setActiveColor: Dispatch<SetStateAction<IActiveColor>>;
|
20
|
+
setInit: Dispatch<SetStateAction<boolean>>;
|
21
|
+
showAlpha?: boolean;
|
22
|
+
showGradientResult?: boolean;
|
23
|
+
showGradientStops?: boolean;
|
24
|
+
showGradientMode?: boolean;
|
25
|
+
showGradientAngle?: boolean;
|
26
|
+
showGradientPosition?: boolean;
|
27
|
+
allowAddGradientStops?: boolean;
|
28
|
+
format?: 'rgb' | 'hsl' | 'hex';
|
29
|
+
}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
export declare const getIndexActiveTag: (value: string) => string;
|
2
|
+
export declare const checkValidColorsArray: (arr: string[], type: "solid" | "grad") => string[];
|
3
|
+
export declare const arraysEqual: (a: Array<any>, b: Array<any>) => boolean;
|
4
|
+
export declare const shallowEqual: (object1: any, object2: any) => boolean;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { ReactText } from 'react';
|
2
|
+
export interface IPropsComp {
|
3
|
+
value: string;
|
4
|
+
format?: 'rgb' | 'hsl' | 'hex';
|
5
|
+
debounceMS?: number;
|
6
|
+
debounce?: boolean;
|
7
|
+
showAlpha?: boolean;
|
8
|
+
showInputs?: boolean;
|
9
|
+
showGradientResult?: boolean;
|
10
|
+
showGradientStops?: boolean;
|
11
|
+
showGradientMode?: boolean;
|
12
|
+
showGradientAngle?: boolean;
|
13
|
+
showGradientPosition?: boolean;
|
14
|
+
allowAddGradientStops?: boolean;
|
15
|
+
colorBoardHeight?: number;
|
16
|
+
defaultColors?: string[];
|
17
|
+
defaultActiveTab?: string | undefined;
|
18
|
+
onChangeTabs?: (tab: string) => void;
|
19
|
+
onChange: (value: string) => void;
|
20
|
+
}
|
21
|
+
export interface IPropsMain extends IPropsComp {
|
22
|
+
gradient?: boolean;
|
23
|
+
solid?: boolean;
|
24
|
+
popupWidth?: number;
|
25
|
+
}
|
26
|
+
export type TPropsChange = {
|
27
|
+
alpha: number;
|
28
|
+
hex: string;
|
29
|
+
};
|
30
|
+
export interface IActiveColor {
|
31
|
+
hex: string;
|
32
|
+
alpha: number;
|
33
|
+
loc: ReactText;
|
34
|
+
index: ReactText;
|
35
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { KeyboardEvent, ChangeEvent } from 'react';
|
2
|
+
interface IInput {
|
3
|
+
alphaValue: number;
|
4
|
+
hexValue: string;
|
5
|
+
showAlpha?: boolean;
|
6
|
+
onChangeAlpha: (value: string) => void;
|
7
|
+
onChangeHex: (value: string) => void;
|
8
|
+
}
|
9
|
+
export declare const getAlphaValue: (value: string) => string | number;
|
10
|
+
export declare const onlyDigits: (string: string) => string;
|
11
|
+
export declare const onlyLatins: (string: string) => string;
|
12
|
+
export declare const handlePressEnter: (e: KeyboardEvent, fn: () => void) => void;
|
13
|
+
export declare const inputsData: (props: IInput) => ({
|
14
|
+
wrapClass: string;
|
15
|
+
labelSymbol: boolean;
|
16
|
+
idInput: string;
|
17
|
+
valueInput: string;
|
18
|
+
labelText: string;
|
19
|
+
labelArea: string;
|
20
|
+
labelClass: string;
|
21
|
+
onChangeInput: (e: ChangeEvent<HTMLInputElement>) => void;
|
22
|
+
name: string;
|
23
|
+
} | {
|
24
|
+
wrapClass: string;
|
25
|
+
labelSymbol: boolean;
|
26
|
+
idInput: string;
|
27
|
+
valueInput: number;
|
28
|
+
labelText: string;
|
29
|
+
labelArea: string;
|
30
|
+
labelClass: string;
|
31
|
+
onChangeInput: (e: ChangeEvent<HTMLInputElement>) => void;
|
32
|
+
name: string;
|
33
|
+
})[];
|
34
|
+
export {};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { FC } from 'react';
|
2
|
+
import './_input_rgba.scss';
|
3
|
+
interface IChange {
|
4
|
+
hex: string;
|
5
|
+
alpha: number;
|
6
|
+
}
|
7
|
+
type TProps = {
|
8
|
+
hex: string;
|
9
|
+
alpha: number;
|
10
|
+
format?: 'rgb' | 'hsl' | 'hex';
|
11
|
+
showAlpha?: boolean;
|
12
|
+
onChange: ({ hex, alpha }: IChange) => void;
|
13
|
+
onSubmitChange?: (rgba: string) => void;
|
14
|
+
};
|
15
|
+
declare const InputRgba: FC<TProps>;
|
16
|
+
export default InputRgba;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { FC } from 'react';
|
2
|
+
import './_popup_tabs.scss';
|
3
|
+
interface Popups {
|
4
|
+
children?: any;
|
5
|
+
activeTab?: string | 'solid' | 'gradient';
|
6
|
+
tabName?: string;
|
7
|
+
popupWidth?: number;
|
8
|
+
onClick?: () => void;
|
9
|
+
}
|
10
|
+
export declare const PopupTabs: FC<Popups>;
|
11
|
+
export declare const PopupTabsHeaderLabel: FC<Popups>;
|
12
|
+
export declare const PopupTabsHeader: FC<Popups>;
|
13
|
+
export declare const PopupTabsBody: FC<Popups>;
|
14
|
+
export declare const PopupTabsBodyItem: FC<Popups>;
|
15
|
+
export {};
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
2
|
+
import type { ITinyColor } from '../../../../utils/color';
|
3
|
+
export type TPropsChange = {
|
4
|
+
alpha: number;
|
5
|
+
hex: string;
|
6
|
+
};
|
7
|
+
export type TPropsComp = {
|
8
|
+
rootPrefixCls?: string;
|
9
|
+
color: ITinyColor;
|
10
|
+
alpha?: number;
|
11
|
+
colorBoardHeight?: number;
|
12
|
+
onChange: (color: ITinyColor) => void;
|
13
|
+
setChange: Dispatch<SetStateAction<boolean>>;
|
14
|
+
};
|
15
|
+
export type TPropsCompAlpha = {
|
16
|
+
rootPrefixCls?: string;
|
17
|
+
color: ITinyColor;
|
18
|
+
alpha?: number;
|
19
|
+
showAlpha?: boolean;
|
20
|
+
onChange: (alpha: number) => void;
|
21
|
+
setChange: Dispatch<SetStateAction<boolean>>;
|
22
|
+
};
|
23
|
+
export type TPropsMain = {
|
24
|
+
alpha: number;
|
25
|
+
className?: string;
|
26
|
+
hex: string;
|
27
|
+
showAlpha?: boolean;
|
28
|
+
colorBoardHeight?: number;
|
29
|
+
onChange: ({ alpha, hex }: TPropsChange) => void;
|
30
|
+
};
|
31
|
+
export type TCoords = {
|
32
|
+
x: number;
|
33
|
+
y: number;
|
34
|
+
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { FC } from 'react';
|
2
|
+
import { IActiveColor } from '../../../../lib/types';
|
3
|
+
interface IProps {
|
4
|
+
defaultColors?: Array<string>;
|
5
|
+
setColor: (color: any) => void;
|
6
|
+
setInit: (init: boolean) => void;
|
7
|
+
setActiveColor?: (color: IActiveColor) => void;
|
8
|
+
colorType: 'solid' | 'gradient';
|
9
|
+
}
|
10
|
+
declare const DefaultColorPanel: FC<IProps>;
|
11
|
+
export default DefaultColorPanel;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
2
|
+
import { IActiveColor } from '../../../../lib/types';
|
3
|
+
export interface IColor {
|
4
|
+
gradient: string;
|
5
|
+
type: string;
|
6
|
+
modifier: string | number;
|
7
|
+
stops: Array<any>;
|
8
|
+
}
|
9
|
+
export type TCoords = {
|
10
|
+
x: number;
|
11
|
+
y: number;
|
12
|
+
shiftKey?: number | boolean;
|
13
|
+
ctrlKey?: number | boolean;
|
14
|
+
};
|
15
|
+
export interface IPropsPanel {
|
16
|
+
color: IColor;
|
17
|
+
setColor: (color: IColor) => void;
|
18
|
+
activeColor: IActiveColor;
|
19
|
+
setActiveColor: Dispatch<SetStateAction<IActiveColor>>;
|
20
|
+
setInit: Dispatch<SetStateAction<boolean>>;
|
21
|
+
showAlpha?: boolean;
|
22
|
+
showGradientResult?: boolean;
|
23
|
+
showGradientStops?: boolean;
|
24
|
+
showGradientMode?: boolean;
|
25
|
+
showGradientAngle?: boolean;
|
26
|
+
showGradientPosition?: boolean;
|
27
|
+
allowAddGradientStops?: boolean;
|
28
|
+
format?: 'rgb' | 'hsl' | 'hex';
|
29
|
+
}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
export declare const getIndexActiveTag: (value: string) => string;
|
2
|
+
export declare const checkValidColorsArray: (arr: string[], type: "solid" | "grad") => string[];
|
3
|
+
export declare const arraysEqual: (a: Array<any>, b: Array<any>) => boolean;
|
4
|
+
export declare const shallowEqual: (object1: any, object2: any) => boolean;
|