react-iro-gradient-picker 1.1.7 → 1.2.3

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.
@@ -1,6 +1,17 @@
1
1
  import { ReactText } from 'react';
2
+ export interface IGradientStop {
3
+ color: string;
4
+ position: number;
5
+ }
6
+ export interface IGradientData {
7
+ type: 'linear' | 'radial';
8
+ angle?: number;
9
+ stops: IGradientStop[];
10
+ defaultActiveTab?: 'gradient';
11
+ }
12
+ export type TValueProp = string | IGradientData;
2
13
  export interface IPropsComp {
3
- value: string;
14
+ value: TValueProp;
4
15
  format?: 'rgb' | 'hsl' | 'hex';
5
16
  debounceMS?: number;
6
17
  debounce?: boolean;
@@ -20,6 +31,38 @@ export interface IPropsComp {
20
31
  showReset?: boolean;
21
32
  onReset?: () => void;
22
33
  }
34
+ export interface IPropsSolid {
35
+ value: string;
36
+ format?: 'rgb' | 'hsl' | 'hex';
37
+ debounceMS?: number;
38
+ debounce?: boolean;
39
+ showAlpha?: boolean;
40
+ showInputs?: boolean;
41
+ colorBoardHeight?: number;
42
+ defaultColors?: string[];
43
+ onChange?: (value: string) => void;
44
+ showReset?: boolean;
45
+ onReset?: () => void;
46
+ }
47
+ export interface IPropsGradient {
48
+ value: string;
49
+ format?: 'rgb' | 'hsl' | 'hex';
50
+ debounceMS?: number;
51
+ debounce?: boolean;
52
+ showAlpha?: boolean;
53
+ showInputs?: boolean;
54
+ showGradientResult?: boolean;
55
+ showGradientStops?: boolean;
56
+ showGradientMode?: boolean;
57
+ showGradientAngle?: boolean;
58
+ showGradientPosition?: boolean;
59
+ allowAddGradientStops?: boolean;
60
+ colorBoardHeight?: number;
61
+ defaultColors?: string[];
62
+ onChange?: (value: string) => void;
63
+ showReset?: boolean;
64
+ onReset?: () => void;
65
+ }
23
66
  export interface IPropsMain extends IPropsComp {
24
67
  gradient?: boolean;
25
68
  solid?: boolean;
@@ -0,0 +1,17 @@
1
+ import { IGradientData } from '../../lib/types';
2
+ /**
3
+ * Convert gradient object to CSS gradient string
4
+ */
5
+ export declare function gradientObjectToCss(gradientData: IGradientData): string;
6
+ /**
7
+ * Convert CSS gradient string to gradient object
8
+ */
9
+ export declare function cssToGradientObject(cssGradient: string): IGradientData | null;
10
+ /**
11
+ * Check if a value is a gradient object
12
+ */
13
+ export declare function isGradientObject(value: any): value is IGradientData;
14
+ /**
15
+ * Normalize value to always return a CSS gradient string
16
+ */
17
+ export declare function normalizeGradientValue(value: string | IGradientData): string;
@@ -0,0 +1 @@
1
+ export * from './gradientConverter';
@@ -1,4 +1,5 @@
1
1
  export * from './cn';
2
2
  export * from './color';
3
3
  export * from './format';
4
+ export * from './gradient';
4
5
  export * from './validation';
@@ -11,5 +11,5 @@ interface IParsedGraient {
11
11
  sideCorner?: string;
12
12
  parseWarning?: boolean;
13
13
  }
14
- declare const _default: (input: string) => string | IParsedGraient;
14
+ declare const _default: (input: string) => IParsedGraient | string;
15
15
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-iro-gradient-picker",
3
- "version": "1.1.7",
3
+ "version": "1.2.3",
4
4
  "description": "Modern React gradient and solid color picker with complete dark theme support, built with TypeScript and Tailwind CSS",
5
5
  "keywords": [
6
6
  "react",