@xsolla/xui-color-picker 0.64.0-pr56.1768440195

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.
@@ -0,0 +1,120 @@
1
+ import React, { ReactElement, ReactNode } from 'react';
2
+
3
+ type InputColorFormat = "hex" | "rgb" | "hsl" | "hsb";
4
+ type ColorFormat = "hex" | "hexa" | "hsl" | "hsla" | "rgb" | "rgba" | "hsb" | "hsba";
5
+ type ColorPickerChangeEvent = {
6
+ /**
7
+ * The value of the color in the initial format (defined by `colorFormat`).
8
+ */
9
+ valueInInitialFormat: string;
10
+ /**
11
+ * The currently selected color format.
12
+ */
13
+ currentColorFormat: InputColorFormat;
14
+ /**
15
+ * The value of the color in the currently selected format.
16
+ */
17
+ valueInCurrentFormat: string;
18
+ };
19
+ type ColorPickerProps = {
20
+ /**
21
+ * The default format for the color value.
22
+ * Note: Internally, color calculations are always performed in the HSB color space.
23
+ */
24
+ colorFormat?: InputColorFormat;
25
+ /**
26
+ * Specifies the list of color formats that the user can select from.
27
+ * By default, all supported formats (`hex`, `rgb`, `hsl`, `hsb`) will be available.
28
+ * Note: The `colorFormat` prop determines the default format.
29
+ */
30
+ selectableFormats?: Array<InputColorFormat>;
31
+ /**
32
+ * Whether the alpha channel (opacity) is enabled.
33
+ */
34
+ alpha?: boolean;
35
+ /**
36
+ * The current value of the color (usually) in the format specified by `colorFormat`.
37
+ */
38
+ value?: string;
39
+ /**
40
+ * Event handler when the value of a ColorPicker changes.
41
+ */
42
+ onChange?: (value: ColorPickerChangeEvent) => void;
43
+ /**
44
+ * Property for passing a new icon to replace the default success copied icon.
45
+ */
46
+ copiedIcon?: ReactElement;
47
+ /**
48
+ * Enables or disables the eyedropper tool within the ColorPicker.
49
+ */
50
+ eyedropper?: boolean;
51
+ /**
52
+ * Custom content to be displayed at the bottom of the ColorPicker.
53
+ */
54
+ bottomContent?: ReactNode;
55
+ /**
56
+ * Test ID for testing frameworks
57
+ */
58
+ testID?: string;
59
+ };
60
+ interface CustomColorAreaProps {
61
+ colorSpace?: "hsb" | "hsl" | "rgb";
62
+ xChannel?: "saturation" | "red";
63
+ yChannel?: "brightness" | "lightness" | "green";
64
+ xChannelStep?: number;
65
+ yChannelStep?: number;
66
+ value?: string;
67
+ defaultValue?: string;
68
+ onChange?: (color: string) => void;
69
+ onChangeEnd?: (color: string) => void;
70
+ className?: string;
71
+ }
72
+
73
+ declare const ColorPicker: React.ForwardRefExoticComponent<ColorPickerProps & React.RefAttributes<any>>;
74
+
75
+ type ColorChannel = "hue" | "saturation" | "brightness" | "lightness" | "red" | "green" | "blue" | "alpha";
76
+ interface ColorValue {
77
+ getChannelValue(channel: ColorChannel): number;
78
+ setChannelValue(channel: ColorChannel, value: number): ColorValue;
79
+ getChannelRange(channel: ColorChannel): {
80
+ minValue: number;
81
+ maxValue: number;
82
+ step: number;
83
+ pageSize: number;
84
+ };
85
+ getColorChannels(): ColorChannel[];
86
+ toFormat(format: string): string;
87
+ toString(format?: string): string;
88
+ toHsb(): {
89
+ h: number;
90
+ s: number;
91
+ b: number;
92
+ a: number;
93
+ };
94
+ toRgb(): {
95
+ r: number;
96
+ g: number;
97
+ b: number;
98
+ a: number;
99
+ };
100
+ toHsl(): {
101
+ h: number;
102
+ s: number;
103
+ l: number;
104
+ a: number;
105
+ };
106
+ }
107
+ declare function parseColor(color: string): ColorValue;
108
+ declare function createColorFromHsb(h: number, s: number, b: number, a?: number): ColorValue;
109
+
110
+ declare const ColorPickerArea: React.ForwardRefExoticComponent<CustomColorAreaProps & React.RefAttributes<any>>;
111
+
112
+ type ColorPickerSliderProps = {
113
+ channel: "hue" | "alpha";
114
+ value: string;
115
+ onChange?: (color: string) => void;
116
+ onChangeEnd?: (color: string) => void;
117
+ };
118
+ declare const ColorPickerSlider: React.FC<ColorPickerSliderProps>;
119
+
120
+ export { type ColorChannel, type ColorFormat, ColorPicker, ColorPickerArea, type ColorPickerChangeEvent, type ColorPickerProps, ColorPickerSlider, type ColorValue, type CustomColorAreaProps, type InputColorFormat, createColorFromHsb, parseColor };
@@ -0,0 +1,120 @@
1
+ import React, { ReactElement, ReactNode } from 'react';
2
+
3
+ type InputColorFormat = "hex" | "rgb" | "hsl" | "hsb";
4
+ type ColorFormat = "hex" | "hexa" | "hsl" | "hsla" | "rgb" | "rgba" | "hsb" | "hsba";
5
+ type ColorPickerChangeEvent = {
6
+ /**
7
+ * The value of the color in the initial format (defined by `colorFormat`).
8
+ */
9
+ valueInInitialFormat: string;
10
+ /**
11
+ * The currently selected color format.
12
+ */
13
+ currentColorFormat: InputColorFormat;
14
+ /**
15
+ * The value of the color in the currently selected format.
16
+ */
17
+ valueInCurrentFormat: string;
18
+ };
19
+ type ColorPickerProps = {
20
+ /**
21
+ * The default format for the color value.
22
+ * Note: Internally, color calculations are always performed in the HSB color space.
23
+ */
24
+ colorFormat?: InputColorFormat;
25
+ /**
26
+ * Specifies the list of color formats that the user can select from.
27
+ * By default, all supported formats (`hex`, `rgb`, `hsl`, `hsb`) will be available.
28
+ * Note: The `colorFormat` prop determines the default format.
29
+ */
30
+ selectableFormats?: Array<InputColorFormat>;
31
+ /**
32
+ * Whether the alpha channel (opacity) is enabled.
33
+ */
34
+ alpha?: boolean;
35
+ /**
36
+ * The current value of the color (usually) in the format specified by `colorFormat`.
37
+ */
38
+ value?: string;
39
+ /**
40
+ * Event handler when the value of a ColorPicker changes.
41
+ */
42
+ onChange?: (value: ColorPickerChangeEvent) => void;
43
+ /**
44
+ * Property for passing a new icon to replace the default success copied icon.
45
+ */
46
+ copiedIcon?: ReactElement;
47
+ /**
48
+ * Enables or disables the eyedropper tool within the ColorPicker.
49
+ */
50
+ eyedropper?: boolean;
51
+ /**
52
+ * Custom content to be displayed at the bottom of the ColorPicker.
53
+ */
54
+ bottomContent?: ReactNode;
55
+ /**
56
+ * Test ID for testing frameworks
57
+ */
58
+ testID?: string;
59
+ };
60
+ interface CustomColorAreaProps {
61
+ colorSpace?: "hsb" | "hsl" | "rgb";
62
+ xChannel?: "saturation" | "red";
63
+ yChannel?: "brightness" | "lightness" | "green";
64
+ xChannelStep?: number;
65
+ yChannelStep?: number;
66
+ value?: string;
67
+ defaultValue?: string;
68
+ onChange?: (color: string) => void;
69
+ onChangeEnd?: (color: string) => void;
70
+ className?: string;
71
+ }
72
+
73
+ declare const ColorPicker: React.ForwardRefExoticComponent<ColorPickerProps & React.RefAttributes<any>>;
74
+
75
+ type ColorChannel = "hue" | "saturation" | "brightness" | "lightness" | "red" | "green" | "blue" | "alpha";
76
+ interface ColorValue {
77
+ getChannelValue(channel: ColorChannel): number;
78
+ setChannelValue(channel: ColorChannel, value: number): ColorValue;
79
+ getChannelRange(channel: ColorChannel): {
80
+ minValue: number;
81
+ maxValue: number;
82
+ step: number;
83
+ pageSize: number;
84
+ };
85
+ getColorChannels(): ColorChannel[];
86
+ toFormat(format: string): string;
87
+ toString(format?: string): string;
88
+ toHsb(): {
89
+ h: number;
90
+ s: number;
91
+ b: number;
92
+ a: number;
93
+ };
94
+ toRgb(): {
95
+ r: number;
96
+ g: number;
97
+ b: number;
98
+ a: number;
99
+ };
100
+ toHsl(): {
101
+ h: number;
102
+ s: number;
103
+ l: number;
104
+ a: number;
105
+ };
106
+ }
107
+ declare function parseColor(color: string): ColorValue;
108
+ declare function createColorFromHsb(h: number, s: number, b: number, a?: number): ColorValue;
109
+
110
+ declare const ColorPickerArea: React.ForwardRefExoticComponent<CustomColorAreaProps & React.RefAttributes<any>>;
111
+
112
+ type ColorPickerSliderProps = {
113
+ channel: "hue" | "alpha";
114
+ value: string;
115
+ onChange?: (color: string) => void;
116
+ onChangeEnd?: (color: string) => void;
117
+ };
118
+ declare const ColorPickerSlider: React.FC<ColorPickerSliderProps>;
119
+
120
+ export { type ColorChannel, type ColorFormat, ColorPicker, ColorPickerArea, type ColorPickerChangeEvent, type ColorPickerProps, ColorPickerSlider, type ColorValue, type CustomColorAreaProps, type InputColorFormat, createColorFromHsb, parseColor };