@primereact/headless 11.0.0-alpha.6 → 11.0.0-alpha.8

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.
Files changed (88) hide show
  1. package/colorpicker/colorManager.d.ts +101 -0
  2. package/colorpicker/index.d.ts +3 -0
  3. package/colorpicker/index.mjs +2 -0
  4. package/colorpicker/index.mjs.map +1 -0
  5. package/colorpicker/input/index.d.ts +2 -0
  6. package/colorpicker/input/index.mjs +2 -0
  7. package/colorpicker/input/index.mjs.map +1 -0
  8. package/colorpicker/input/useColorPickerInput.d.ts +11 -0
  9. package/colorpicker/input/useColorPickerInput.props.d.ts +2 -0
  10. package/colorpicker/input/useColorPickerInput.test.d.ts +0 -0
  11. package/colorpicker/slider/index.d.ts +2 -0
  12. package/colorpicker/slider/index.mjs +2 -0
  13. package/colorpicker/slider/index.mjs.map +1 -0
  14. package/colorpicker/slider/useColorPickerSlider.d.ts +13 -0
  15. package/colorpicker/slider/useColorPickerSlider.props.d.ts +2 -0
  16. package/colorpicker/slider/useColorPickerSlider.test.d.ts +0 -0
  17. package/colorpicker/useColorPicker.d.ts +26 -0
  18. package/colorpicker/useColorPicker.props.d.ts +2 -0
  19. package/colorpicker/useColorPicker.test.d.ts +0 -0
  20. package/dataview/index.d.ts +2 -0
  21. package/dataview/index.mjs +2 -0
  22. package/dataview/index.mjs.map +1 -0
  23. package/dataview/useDataView.d.ts +3 -0
  24. package/dataview/useDataView.props.d.ts +2 -0
  25. package/dataview/useDataView.test.d.ts +0 -0
  26. package/datepicker/index.d.ts +2 -0
  27. package/datepicker/index.mjs +2 -0
  28. package/datepicker/index.mjs.map +1 -0
  29. package/datepicker/useDatePicker.d.ts +114 -0
  30. package/datepicker/useDatePicker.props.d.ts +2 -0
  31. package/datepicker/useDatePicker.test.d.ts +0 -0
  32. package/fileupload/index.d.ts +2 -0
  33. package/fileupload/index.mjs +2 -0
  34. package/fileupload/index.mjs.map +1 -0
  35. package/fileupload/useFileUpload.d.ts +26 -0
  36. package/fileupload/useFileUpload.props.d.ts +2 -0
  37. package/fileupload/useFileUpload.test.d.ts +0 -0
  38. package/gallery/index.d.ts +2 -0
  39. package/gallery/index.mjs +2 -0
  40. package/gallery/index.mjs.map +1 -0
  41. package/gallery/item/index.d.ts +2 -0
  42. package/gallery/item/index.mjs +2 -0
  43. package/gallery/item/index.mjs.map +1 -0
  44. package/gallery/item/useGalleryItem.d.ts +45 -0
  45. package/gallery/item/useGalleryItem.props.d.ts +2 -0
  46. package/gallery/useGallery.d.ts +31 -0
  47. package/gallery/useGallery.props.d.ts +2 -0
  48. package/gallery/useGallery.test.d.ts +0 -0
  49. package/listbox/index.d.ts +2 -0
  50. package/listbox/index.mjs +2 -0
  51. package/listbox/index.mjs.map +1 -0
  52. package/listbox/useListbox.d.ts +45 -0
  53. package/listbox/useListbox.props.d.ts +2 -0
  54. package/listbox/useListbox.test.d.ts +0 -0
  55. package/orgchart/index.d.ts +2 -0
  56. package/orgchart/index.mjs +2 -0
  57. package/orgchart/index.mjs.map +1 -0
  58. package/orgchart/useOrgChart.d.ts +20 -0
  59. package/orgchart/useOrgChart.props.d.ts +2 -0
  60. package/orgchart/useOrgChart.test.d.ts +0 -0
  61. package/overlay/index.d.ts +2 -0
  62. package/overlay/index.mjs +2 -0
  63. package/overlay/index.mjs.map +1 -0
  64. package/overlay/useOverlay.d.ts +16 -0
  65. package/overlay/useOverlay.props.d.ts +2 -0
  66. package/overlay/useOverlay.test.d.ts +0 -0
  67. package/package.json +4 -4
  68. package/password/index.d.ts +2 -0
  69. package/password/index.mjs +2 -0
  70. package/password/index.mjs.map +1 -0
  71. package/password/usePassword.d.ts +35 -0
  72. package/password/usePassword.props.d.ts +2 -0
  73. package/password/usePassword.test.d.ts +0 -0
  74. package/speeddial/index.mjs +1 -1
  75. package/speeddial/index.mjs.map +1 -1
  76. package/speeddial/useSpeedDial.d.ts +2 -1
  77. package/toast/index.d.ts +1 -0
  78. package/toast/index.mjs +1 -1
  79. package/toast/index.mjs.map +1 -1
  80. package/toast/item/index.css +1 -1
  81. package/toast/item/index.css.map +1 -1
  82. package/toast/item/index.mjs +1 -1
  83. package/toast/item/index.mjs.map +1 -1
  84. package/toast/item/useToastItem.d.ts +11 -7
  85. package/toast/toastStore.d.ts +39 -0
  86. package/toast/useToast.d.ts +12 -4
  87. package/toast/index.css +0 -2
  88. package/toast/index.css.map +0 -1
@@ -0,0 +1,101 @@
1
+ import type { Color2DAxes, Color3DAxes, ColorChannel, ColorChannelRange, ColorInputChannel, ColorInstance, ColorOutput, ColorSliderChannel, ColorSpace } from '@primereact/types/shared/colorpicker';
2
+ export declare const isEqual: (a: unknown, b: unknown) => boolean;
3
+ declare abstract class Color {
4
+ abstract clone(): ColorInstance;
5
+ abstract toString(format: ColorOutput): string;
6
+ abstract toFormat(format: ColorSpace): ColorInstance;
7
+ abstract toJSON(): Record<string, number>;
8
+ abstract getChannelRange(channel: ColorChannel): ColorChannelRange;
9
+ abstract getFormat(): ColorSpace;
10
+ abstract getChannels(): [ColorChannel, ColorChannel, ColorChannel];
11
+ getChannelValue(channel: ColorChannel): number;
12
+ withChannelValue(channel: ColorChannel, value: number): ColorInstance;
13
+ getSpaceAxes(xyChannels: Color2DAxes): Color3DAxes;
14
+ incChannelValue(channel: ColorChannel, step: number): ColorInstance;
15
+ decChannelValue(channel: ColorChannel, step: number): ColorInstance;
16
+ }
17
+ export declare class HSBColor extends Color {
18
+ private hue;
19
+ private saturation;
20
+ private brightness;
21
+ private alpha;
22
+ constructor(hue: number, saturation: number, brightness: number, alpha: number);
23
+ static parse(value: string): HSBColor | undefined;
24
+ private toRGB;
25
+ private toHSL;
26
+ toFormat(format: ColorSpace): ColorInstance;
27
+ toString(format: ColorOutput): string;
28
+ toJSON(): {
29
+ hue: number;
30
+ saturation: number;
31
+ brightness: number;
32
+ alpha: number;
33
+ };
34
+ clone(): ColorInstance;
35
+ getChannelRange(channel: ColorChannel): ColorChannelRange;
36
+ getFormat(): ColorSpace;
37
+ getChannels(): [ColorChannel, ColorChannel, ColorChannel];
38
+ }
39
+ export declare class HSLColor extends Color {
40
+ private hue;
41
+ private saturation;
42
+ private lightness;
43
+ private alpha;
44
+ constructor(hue: number, saturation: number, lightness: number, alpha: number);
45
+ static parse(value: string): HSLColor | undefined;
46
+ private toRGB;
47
+ private toHSB;
48
+ toFormat(format: ColorSpace): ColorInstance;
49
+ toString(format: ColorOutput): string;
50
+ toJSON(): Record<string, number>;
51
+ clone(): ColorInstance;
52
+ getChannelRange(channel: ColorChannel): ColorChannelRange;
53
+ getFormat(): ColorSpace;
54
+ getChannels(): [ColorChannel, ColorChannel, ColorChannel];
55
+ }
56
+ export declare class RGBColor extends Color {
57
+ private red;
58
+ private green;
59
+ private blue;
60
+ private alpha;
61
+ constructor(red: number, green: number, blue: number, alpha: number);
62
+ static parse(value: string): RGBColor | undefined;
63
+ private static parseHexColor;
64
+ private static parseRgbFunction;
65
+ private toHSB;
66
+ private toHSL;
67
+ private toOKLCH;
68
+ toHexInt(): number;
69
+ toFormat(format: ColorSpace): ColorInstance;
70
+ toString(format: ColorOutput): string;
71
+ toJSON(): Record<string, number>;
72
+ clone(): ColorInstance;
73
+ getChannelRange(channel: ColorChannel): ColorChannelRange;
74
+ getFormat(): ColorSpace;
75
+ getChannels(): [ColorChannel, ColorChannel, ColorChannel];
76
+ }
77
+ export declare class OKLCHColor extends Color {
78
+ private L;
79
+ private C;
80
+ private H;
81
+ private alpha;
82
+ constructor(L: number, C: number, H: number, alpha: number);
83
+ static parse(value: string): OKLCHColor | undefined;
84
+ private toRGB;
85
+ toJSON(): Record<string, number>;
86
+ clone(): ColorInstance;
87
+ toFormat(format: ColorSpace): ColorInstance;
88
+ toString(format: ColorOutput): string;
89
+ getChannelRange(channel: ColorChannel): ColorChannelRange;
90
+ getFormat(): ColorSpace;
91
+ getChannels(): [ColorChannel, ColorChannel, ColorChannel];
92
+ }
93
+ export declare const parseColor: (color: string) => ColorInstance;
94
+ export declare function getChannelGradient(channel: ColorSliderChannel, value: ColorInstance, orientation: 'horizontal' | 'vertical'): string;
95
+ export declare function getChannelColor(color: ColorInstance, channel: ColorChannel): ColorInstance;
96
+ export declare function getAreaGradient(color: ColorInstance, axes: Color2DAxes): {
97
+ '--area-gradient': string;
98
+ };
99
+ export declare function getInputChannelValue(color: ColorInstance, channel: ColorInputChannel, format?: ColorSpace): string;
100
+ export declare function getInputChannelRange(color: ColorInstance, channel?: ColorInputChannel): ColorChannelRange | undefined;
101
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './colorManager';
2
+ export * from './useColorPicker';
3
+ export * from './useColorPicker.props';
@@ -0,0 +1,2 @@
1
+ var it=Object.defineProperty,ht=Object.defineProperties;var lt=Object.getOwnPropertyDescriptors;var O=Object.getOwnPropertySymbols;var ut=Object.prototype.hasOwnProperty,ct=Object.prototype.propertyIsEnumerable;var T=(n,t,e)=>t in n?it(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,X=(n,t)=>{for(var e in t||(t={}))ut.call(t,e)&&T(n,e,t[e]);if(O)for(var e of O(t))ct.call(t,e)&&T(n,e,t[e]);return n},U=(n,t)=>ht(n,lt(t));var gt=/hsb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/,mt=/hsl\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsla\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/,Ct=/^#?([a-fA-F0-9]{3,8})$/,bt=/^rgba?\(\s*([^)]+)\s*\)$/,dt=/oklch\(\s*([\d.]+)%?\s+([\d.]+)\s+([\d.]+)(deg)?(?:\s*\/\s*([\d.]+))?\)/i;function C(n,t,e){return Math.min(Math.max(n,t),e)}var Rt=(n,t)=>JSON.stringify(n)===JSON.stringify(t),N=(n,t)=>[n[0]*t[0]+n[1]*t[1]+n[2]*t[2],n[3]*t[0]+n[4]*t[1]+n[5]*t[2],n[6]*t[0]+n[7]*t[1]+n[8]*t[2]];function pt(n,t,e,r){let s=C(n,t,e)-t,h=Math.round(s/r),o=t+h*r,l=(r.toString().split(".")[1]||"").length;return parseFloat(o.toFixed(l))}var M=class{getChannelValue(t){if(t in this)return this[t];throw new Error(`Channel ${t} not found`)}withChannelValue(t,e){let{min:r,max:a}=this.getChannelRange(t);if(t in this){let s=this.clone();return s[t]=C(e,r,a),s}throw new Error(`Channel ${t} not found`)}getSpaceAxes(t){let{xChannel:e,yChannel:r}=t;if(e===r)throw new Error("xChannel and yChannel cannot be the same");let a=this.getChannels().find(s=>s!==e&&s!==r);if(!a)throw new Error("zChannel not found");return{xChannel:e,yChannel:r,zChannel:a}}incChannelValue(t,e){let{min:r,max:a,step:s}=this.getChannelRange(t),h=pt(C(this.getChannelValue(t)+e,r,a),r,a,s);return this.withChannelValue(t,h)}decChannelValue(t,e){return this.incChannelValue(t,-e)}},$=class n extends M{constructor(t,e,r,a){super(),this.hue=t,this.saturation=e,this.brightness=r,this.alpha=a}static parse(t){var o;let e=t.match(gt);if(!e)return;let[r,a,s,h]=((o=e[1])!=null?o:e[2]).split(",").map(l=>Number(l.trim().replace("%","")));return new n(r%360,C(a,0,100),C(s,0,100),C(h!=null?h:1,0,1))}toRGB(){let t=this.hue,e=this.saturation/100,r=this.brightness/100;function a(h){let o=(h+t/60)%6;return r-r*e*Math.max(0,Math.min(o,4-o,1))}let s=255;return new H(Math.round(a(5)*s),Math.round(a(3)*s),Math.round(a(1)*s),Number(this.alpha.toFixed(2)))}toHSL(){let t=this.hue,e=this.saturation/100,r=this.brightness/100,a=r*(1-e/2);return a===0||a===1?e=0:e=(r-a)/Math.min(a,1-a),new k(Number(t.toFixed(2)),Number((e*100).toFixed(2)),Number((a*100).toFixed(2)),Number(this.alpha.toFixed(2)))}toFormat(t){switch(t){case"hsba":return this;case"rgba":return this.toRGB();case"hsla":return this.toHSL();case"oklcha":return this.toRGB().toFormat("oklcha");default:throw new Error(`Invalid format: ${t}`)}}toString(t){switch(t){case"css":return this.toHSL().toString("css");case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsb":return`hsb(${this.hue}, ${this.saturation.toFixed(2)}%, ${this.brightness.toFixed(2)}%)`;case"hsba":return`hsba(${this.hue}, ${this.saturation.toFixed(2)}%, ${this.brightness.toFixed(2)}%, ${this.alpha})`;case"hsl":return this.toHSL().toString("hsl");case"rgb":return this.toRGB().toString("rgb");case"oklch":return this.toRGB().toFormat("oklcha").toString("oklch");default:return this.toFormat(t).toString(t)}}toJSON(){return{hue:this.hue,saturation:this.saturation,brightness:this.brightness,alpha:this.alpha}}clone(){return new n(this.hue,this.saturation,this.brightness,this.alpha)}getChannelRange(t){switch(t){case"hue":return{min:0,max:360,step:1};case"saturation":case"brightness":return{min:0,max:100,step:1};case"alpha":return{min:0,max:1,step:.01};default:throw new Error("Unknown color channel: "+t)}}getFormat(){return"hsba"}getChannels(){return["hue","saturation","brightness"]}},k=class n extends M{constructor(t,e,r,a){super(),this.hue=t,this.saturation=e,this.lightness=r,this.alpha=a}static parse(t){var o,l;let e=t.match(mt);if(!e)return;let[r,a,s,h]=(l=(o=e[1]||e[2])==null?void 0:o.split(",").map(c=>Number(c.trim().replace("%",""))))!=null?l:[];return new n(r%360,C(a,0,100),C(s,0,100),C(h!=null?h:1,0,1))}toRGB(){let t=this.hue,e=this.saturation/100,r=this.lightness/100;function a(h){let o=(h+t/30)%12,l=e*Math.min(r,1-r);return r-l*Math.max(-1,Math.min(o-3,9-o,1))}let s=255;return new H(Math.round(a(0)*s),Math.round(a(8)*s),Math.round(a(4)*s),Number(this.alpha.toFixed(2)))}toHSB(){let t=this.hue,e=this.saturation/100,r=this.lightness/100,a=r+e*Math.min(r,1-r);return a===0?e=0:e=2*(1-r/a),new $(Number(t.toFixed(2)),Number((e*100).toFixed(2)),Number((a*100).toFixed(2)),Number(this.alpha.toFixed(2)))}toFormat(t){switch(t){case"hsla":return this;case"rgba":return this.toRGB();case"hsba":return this.toHSB();case"oklcha":return this.toRGB().toFormat("oklcha");default:throw new Error(`Invalid format: ${t}`)}}toString(t){switch(t){case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsl":return`hsl(${this.hue}, ${this.saturation.toFixed(2)}%, ${this.lightness.toFixed(2)}%)`;case"css":case"hsla":return`hsla(${this.hue}, ${this.saturation.toFixed(2)}%, ${this.lightness.toFixed(2)}%, ${this.alpha})`;case"rgb":return this.toRGB().toString("rgb");case"hsb":return this.toHSB().toString("hsb");case"oklch":return this.toRGB().toFormat("oklcha").toString("oklch");default:return this.toFormat(t).toString(t)}}toJSON(){return{hue:this.hue,saturation:this.saturation,lightness:this.lightness,alpha:this.alpha}}clone(){return new n(this.hue,this.saturation,this.lightness,this.alpha)}getChannelRange(t){switch(t){case"hue":return{min:0,max:360,step:1};case"saturation":case"lightness":return{min:0,max:100,step:1};case"alpha":return{min:0,max:1,step:.01};default:throw new Error("Unknown color channel: "+t)}}getFormat(){return"hsla"}getChannels(){return["hue","saturation","lightness"]}},H=class n extends M{constructor(t,e,r,a){super(),this.red=t,this.green=e,this.blue=r,this.alpha=a}static parse(t){var r;if(!t)return;let e=t.trim();return(r=this.parseHexColor(e))!=null?r:this.parseRgbFunction(e)}static parseHexColor(t){let e=t.match(Ct);if(!e)return;let r=e[1];if(r.length<=4&&(r=r.split("").map(l=>l+l).join("")),![6,8].includes(r.length))return;let a=parseInt(r.slice(0,2),16),s=parseInt(r.slice(2,4),16),h=parseInt(r.slice(4,6),16),o=r.length===8?parseInt(r.slice(6,8),16)/255:1;return new n(a,s,h,o)}static parseRgbFunction(t){let e=t.match(bt);if(!(e!=null&&e[1]))return;let[r,a,s,h]=e[1].split(",").map(b=>b.trim()),o=C(Number(r),0,255),l=C(Number(a),0,255),c=C(Number(s),0,255),i=h!==void 0?C(Number(h),0,1):1;if(![o,l,c,i].some(b=>Number.isNaN(b)))return new n(o,l,c,i)}toHSB(){let[e,r,a]=[this.red/255,this.green/255,this.blue/255],s=Math.max(e,r,a),h=Math.min(e,r,a),o=s-h,l=s,c=s===0?0:o/s,i=0;if(o!==0){switch(s){case e:i=(r-a)/o%6;break;case r:i=(a-e)/o+2;break;case a:i=(e-r)/o+4;break}i*=60,i<0&&(i+=360)}return new $(Number(i.toFixed(2)),Number((c*100).toFixed(2)),Number((l*100).toFixed(2)),Number(this.alpha.toFixed(2)))}toHSL(){let[e,r,a]=[this.red/255,this.green/255,this.blue/255],s=Math.max(e,r,a),h=Math.min(e,r,a),o=(s+h)/2,l=s-h,c=0,i=-1;if(l!==0){switch(s){case e:c=(r-a)/l%6;break;case r:c=(a-e)/l+2;break;case a:c=(e-r)/l+4;break}c*=60,c<0&&(c+=360)}return o===0||o===1?i=0:i=l/(1-Math.abs(2*s-l-1)),new k(Number(c.toFixed(2)),Number((i*100).toFixed(2)),Number((o*100).toFixed(2)),Number(this.alpha.toFixed(2)))}toOKLCH(){let e=[this.red/255,this.green/255,this.blue/255].map(S=>Math.abs(S)<=.04045?S/12.92:(S<0?-1:1)*((Math.abs(S)+.055)/1.055)**2.4),r=N([.41239079926595934,.357584339383878,.1804807884018343,.21263900587151027,.715168678767756,.07219231536073371,.01933081871559182,.11919477979462598,.9505321522496607],e),s=N([.819022437996703,.3619062600528904,-.1288737815209879,.0329836539323885,.9292868615863434,.0361446663506424,.0481771893596242,.2642395317527308,.6335478284694309],r).map(S=>Math.cbrt(S)),[h,o,l]=N([.210454268309314,.7936177747023054,-.0040720430116193,1.9779985324311684,-2.42859224204858,.450593709617411,.0259040424655478,.7827717124575296,-.8086757549230774],s),c=Math.sqrt(o**2+l**2),i=Math.abs(o)<2e-4&&Math.abs(l)<2e-4?NaN:(Math.atan2(l,o)*180/Math.PI%360+360)%360,b=Number(Math.min(1,Math.max(0,h)).toFixed(4)),V=Number(c.toFixed(4)),E=Number.isNaN(i)?NaN:Number(i.toFixed(2));return new P(b,V,E,Number(this.alpha.toFixed(2)))}toHexInt(){return this.red<<16|this.green<<8|this.blue}toFormat(t){switch(t){case"rgba":return this;case"hsla":return this.toHSL();case"hsba":return this.toHSB();case"oklcha":return this.toOKLCH();default:throw new Error(`Invalid format: ${t}`)}}toString(t){switch(t){case"hex":return`#${this.red.toString(16).padStart(2,"0")}${this.green.toString(16).padStart(2,"0")}${this.blue.toString(16).padStart(2,"0")}`;case"hexa":return`#${this.red.toString(16).padStart(2,"0")}${this.green.toString(16).padStart(2,"0")}${this.blue.toString(16).padStart(2,"0")}${Math.round(this.alpha*255).toString(16).padStart(2,"0")}`;case"rgb":return`rgb(${this.red}, ${this.green}, ${this.blue})`;case"rgba":case"css":return`rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;case"hsl":return this.toHSL().toString("hsl");case"hsb":return this.toHSB().toString("hsb");case"oklch":return this.toOKLCH().toString("oklch");default:return this.toFormat(t).toString(t)}}toJSON(){return{red:this.red,green:this.green,blue:this.blue,alpha:this.alpha}}clone(){return new n(this.red,this.green,this.blue,this.alpha)}getChannelRange(t){switch(t){case"red":case"green":case"blue":return{min:0,max:255,step:1};case"alpha":return{min:0,max:1,step:.01};default:throw new Error("Unknown color channel: "+t)}}getFormat(){return"rgba"}getChannels(){return["red","green","blue"]}},P=class n extends M{constructor(t,e,r,a){super(),this.L=t,this.C=e,this.H=r,this.alpha=a}static parse(t){if(!t)return;let e=t.trim().match(dt);if(!e)return;let r=Number(e[1])/100,a=Number(e[2]),s=Number(e[3]),h=e[5]!==void 0?Number(e[5]):1;return new n(r,a,s,h)}toRGB(){let t=this.L,e=Number.isNaN(this.H)?0:this.C*Math.cos(this.H*Math.PI/180),r=Number.isNaN(this.H)?0:this.C*Math.sin(this.H*Math.PI/180),s=N([1,.3963377774,.2158037573,1,-.1055613458,-.0638541728,1,-.0894841775,-1.291485548],[t,e,r]).map(i=>i**3),h=N([1.2268798758,-.5578149945,.2813910457,-.0405757452,1.1122868033,-.0717110581,-.0763729367,-.4214933324,1.5869240198],s),[o,l,c]=N([3.240969942,-1.537383178,-.49861076,-.969243636,1.875967502,.041555057,.05563008,-.203976959,1.056971514],h);return[o,l,c]=[o,l,c].map(i=>Math.abs(i)>.0031308?(i<0?-1:1)*(1.055*Math.abs(i)**(1/2.4)-.055):12.92*i),new H(Math.round(C(o,0,1)*255),Math.round(C(l,0,1)*255),Math.round(C(c,0,1)*255),Number(this.alpha.toFixed(2)))}toJSON(){return{L:this.L,C:this.C,H:this.H,alpha:this.alpha}}clone(){return new n(this.L,this.C,this.H,this.alpha)}toFormat(t){switch(t){case"oklcha":return this;case"rgba":return this.toRGB();case"hsla":return this.toRGB().toFormat("hsla");case"hsba":return this.toRGB().toFormat("hsba");default:throw new Error(`Invalid format: ${t}`)}}toString(t){switch(t){case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"oklch":{let e=Number.isNaN(this.L)?0:Number((this.L*100).toFixed(2)),r=Number.isNaN(this.C)?0:Number(this.C.toFixed(4)),a=Number.isNaN(this.H)?0:Number(this.H.toFixed(2));return`oklch(${e}% ${r} ${a})`}case"oklcha":case"css":{let e=Number.isNaN(this.L)?0:Number((this.L*100).toFixed(2)),r=Number.isNaN(this.C)?0:Number(this.C.toFixed(4)),a=Number.isNaN(this.H)?0:Number(this.H.toFixed(2)),s=Number.isNaN(this.alpha)?1:Number(this.alpha.toFixed(2));return`oklch(${e}% ${r} ${a} / ${s})`}case"hsl":return this.toRGB().toString("hsl");case"hsb":return this.toRGB().toString("hsb");case"rgb":return this.toRGB().toString("rgb");default:return this.toFormat(t).toString(t)}}getChannelRange(t){switch(t){case"L":return{min:0,max:1,step:.01};case"C":return{min:0,max:.4,step:.01};case"H":return{min:0,max:360,step:1};case"alpha":return{min:0,max:1,step:.01};default:throw new Error("Unknown color channel: "+t)}}getFormat(){return"oklcha"}getChannels(){return["L","C","H"]}},f=n=>{var e,r,a;let t=(a=(r=(e=H.parse(n))!=null?e:k.parse(n))!=null?r:$.parse(n))!=null?a:void 0;if(!t)throw new Error(`Invalid color: ${n}`);return t};function Ft(n,t,e){let{min:r,max:a}=t.getChannelRange(n),s=e==="horizontal"?"right":"bottom";switch(n){case"hue":return`linear-gradient(to ${s}, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)`;case"lightness":{let h=t.withChannelValue(n,r).toString("css"),o=t.withChannelValue(n,(a-r)/2).toString("css"),l=t.withChannelValue(n,a).toString("css");return`linear-gradient(to ${s}, ${h}, ${o}, ${l})`}case"red":case"green":case"blue":case"saturation":case"brightness":case"alpha":{let h=t.withChannelValue(n,r).toString("css"),o=t.withChannelValue(n,a).toString("css");return`linear-gradient(to ${s}, ${h}, ${o})`}default:throw new Error(`Unknown color channel: ${n}`)}}function Nt(n,t){switch(t){case"hue":return f(`hsl(${n.getChannelValue("hue")}, 100%, 50%)`);case"red":case"green":case"blue":case"lightness":case"brightness":case"saturation":return n.withChannelValue("alpha",1);case"alpha":return n;default:throw new Error("Unknown color channel: "+t)}}var xt={hue:n=>[0,60,120,180,240,300,360].map(t=>n.withChannelValue("hue",t).toString("css")).join(", "),saturation:n=>`${n.withChannelValue("saturation",0).toString("css")}, transparent`,lightness:()=>"black, transparent, white",brightness:()=>"black, transparent"};function z(n,t){let{xChannel:e,zChannel:r}=n.getSpaceAxes(t),a=n.getChannelValue(r),s=n.getFormat(),o=f((s==="rgba"||s==="oklcha"?"hsba":s)==="hsla"?"hsl(0, 100%, 50%)":"hsb(0, 100%, 100%)").withChannelValue(r,a),l=n.getChannels(),c=b=>b===e?"right":"top",i=l.filter(b=>b!==r).map(b=>`linear-gradient(to ${c(b)}, ${xt[b](o)})`).reverse();return r==="hue"&&i.push(o.toString("css")),{"--area-gradient":i.join(", ")}}function J(n,t,e="hsba"){let r=n.getFormat()==="hsla";switch(t){case"hex":return n.getChannelValue("alpha")<n.getChannelRange("alpha").max?n.toString("hexa"):n.toString("hex");case"css":return n.toFormat(e).toString("css");case"red":case"green":case"blue":return n.toFormat("rgba").getChannelValue(t).toString();case"hue":return n.toFormat(r?"hsla":"hsba").getChannelValue("hue").toString();case"saturation":return n.toFormat(r?"hsla":"hsba").getChannelValue("saturation").toString();case"lightness":return n.toFormat("hsla").getChannelValue("lightness").toString();case"brightness":return n.toFormat("hsba").getChannelValue("brightness").toString();case"C":return n.toFormat("oklcha").getChannelValue("C").toString();case"H":return n.toFormat("oklcha").getChannelValue("H").toString();case"L":return n.toFormat("oklcha").getChannelValue("L").toString();default:return n.getChannelValue(t).toString()}}function Mt(n,t="hex"){switch(t){case"hex":return{min:f("#000000").toHexInt(),max:f("#FFFFFF").toHexInt(),step:1};case"css":return;case"red":case"green":case"blue":return n.toFormat("rgba").getChannelRange(t);case"hue":case"lightness":case"saturation":return n.toFormat("hsla").getChannelRange(t);case"brightness":return n.toFormat("hsba").getChannelRange(t);case"L":case"C":case"H":return n.toFormat("oklcha").getChannelRange(t);default:return n.getChannelRange(t)}}import{withHeadless as ft}from"@primereact/core/headless";import{useControlledState as St}from"@primereact/hooks/use-controlled-state";import*as x from"react";var K={defaultValue:void 0,value:void 0,format:"hsba",disabled:!1,onValueChange:void 0};var Et=ft({name:"useColorPicker",defaultProps:K,setup({props:n}){let{format:t="hsba",disabled:e}=n,[r,a]=x.useState(!1),s=x.useRef([]),[h,o]=St({value:x.useMemo(()=>n.value,[n.value]),defaultValue:x.useMemo(()=>{var u;return(u=n.defaultValue)!=null?u:f("#ff0000").toFormat(n.format||"hsba")},[n.defaultValue]),onChange:n.onValueChange}),l=x.useMemo(()=>h!=null?h:f("#ff0000").toFormat(t),[h,t]),c=t.startsWith("hsl")?"hsla":"hsba",i=x.useMemo(()=>l.toFormat(c),[l,c]),b={value:l,isAreaDragging:r},V=(u,g,d)=>{if(!d||e)return;let p=d.getBoundingClientRect(),w=Math.max(0,Math.min(1,(u-p.left)/p.width)),F=Math.max(0,Math.min(1,(g-p.top)/p.height)),{xChannel:m,yChannel:y}=G(),B=i.getChannelRange(m),v=i.getChannelRange(y),rt=w*(B.max-B.min)+B.min,at=(1-F)*(v.max-v.min)+v.min,st=rt-i.getChannelValue(m),ot=at-i.getChannelValue(y),L=i.incChannelValue(m,st).incChannelValue(y,ot);o([L,{color:L.toString(t),value:L}]),I(L)},E=u=>{let g=u.currentTarget;!g||u.button!==0||(g.setPointerCapture(u.pointerId),a(!0),V(u.clientX,u.clientY,g))},S=u=>{r&&V(u.clientX,u.clientY,u.currentTarget)},Y=u=>{let g=u.currentTarget;g&&(g.releasePointerCapture(u.pointerId),a(!1))},j=u=>{if(e)return;let g=u.key;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown"].includes(g))return;u.preventDefault();let{xChannel:d,yChannel:p}=G(),{step:w}=i.getChannelRange(d),{step:F}=i.getChannelRange(p),m=i;g==="ArrowRight"&&(m=m.incChannelValue(d,w)),g==="ArrowLeft"&&(m=m.decChannelValue(d,w)),g==="ArrowUp"&&(m=m.incChannelValue(p,F)),g==="ArrowDown"&&(m=m.decChannelValue(p,F)),o([m,{color:m.toString(t),value:m}]),I(m)},G=()=>{let u=i.getChannels();return{xChannel:u[1],yChannel:u[2]}},q=()=>{if(typeof window!="undefined"&&!window.EyeDropper||e)return;new window.EyeDropper().open().then(g=>{let d=f(g.sRGBHex);o([d,{color:d.toString(t),value:d}]),I(d)}).catch(g=>{console.error("Error opening eyedropper",g)})},R=G(),{min:A,max:W}=i.getChannelRange(R.xChannel),{min:D,max:Q}=i.getChannelRange(R.yChannel),Z=i.getChannelValue(R.xChannel),_=i.getChannelValue(R.yChannel),tt=U(X({},z(i,R)),{"--thumb-background":i.withChannelValue("alpha",1).toString("css"),"--thumb-position-left":(Z-A)/(W-A)*100+"%","--thumb-position-top":(1-(_-D)/(Q-D))*100+"%"}),et={"--swatch-background":l.toString("css")},nt=u=>{let g=u.elementRef.current;s.current.includes(g)||s.current.push(g)},I=u=>{requestAnimationFrame(()=>{let g=u||l;s.current.forEach(p=>{let w=p.getAttribute("data-channel");if(w){let F=J(g,w,t);p.value=String(F)}})})};return x.useEffect(()=>{I()},[t]),{state:b,value:h,areaValue:i,areaChannels:R,setValue:o,handleAreaPointerDown:E,handleAreaPointerMove:S,handleAreaPointerUp:Y,handleAreaKeyDown:j,areaStyles:tt,swatchStyles:et,openEyeDropper:q,syncChannelInputs:I,registerInputEl:nt}}});export{$ as HSBColor,k as HSLColor,P as OKLCHColor,H as RGBColor,K as defaultProps,z as getAreaGradient,Nt as getChannelColor,Ft as getChannelGradient,Mt as getInputChannelRange,J as getInputChannelValue,Rt as isEqual,f as parseColor,Et as useColorPicker};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/colorpicker/colorManager.ts","../../src/colorpicker/useColorPicker.ts","../../src/colorpicker/useColorPicker.props.ts"],"sourcesContent":["import type { Color2DAxes, Color3DAxes, ColorChannel, ColorChannelRange, ColorInputChannel, ColorInstance, ColorOutput, ColorSliderChannel, ColorSpace } from '@primereact/types/shared/colorpicker';\n\n// CONSTANTS\nconst HSB_REGEX = /hsb\\(([-+]?\\d+(?:.\\d+)?\\s*,\\s*[-+]?\\d+(?:.\\d+)?%\\s*,\\s*[-+]?\\d+(?:.\\d+)?%)\\)|hsba\\(([-+]?\\d+(?:.\\d+)?\\s*,\\s*[-+]?\\d+(?:.\\d+)?%\\s*,\\s*[-+]?\\d+(?:.\\d+)?%\\s*,\\s*[-+]?\\d(.\\d+)?)\\)/;\nconst HSL_REGEX = /hsl\\(([-+]?\\d+(?:.\\d+)?\\s*,\\s*[-+]?\\d+(?:.\\d+)?%\\s*,\\s*[-+]?\\d+(?:.\\d+)?%)\\)|hsla\\(([-+]?\\d+(?:.\\d+)?\\s*,\\s*[-+]?\\d+(?:.\\d+)?%\\s*,\\s*[-+]?\\d+(?:.\\d+)?%\\s*,\\s*[-+]?\\d(.\\d+)?)\\)/;\nconst HEX_REGEX = /^#?([a-fA-F0-9]{3,8})$/;\nconst RGB_REGEX = /^rgba?\\(\\s*([^)]+)\\s*\\)$/;\nconst OKLCH_REGEX = /oklch\\(\\s*([\\d.]+)%?\\s+([\\d.]+)\\s+([\\d.]+)(deg)?(?:\\s*\\/\\s*([\\d.]+))?\\)/i;\n\n// UTILS\nfunction clamp(value: number, min: number, max: number) {\n return Math.min(Math.max(value, min), max);\n}\n\nexport const isEqual = (a: unknown, b: unknown) => JSON.stringify(a) === JSON.stringify(b);\n\nconst multiplyMatrices = (A: number[], B: number[]) => {\n return [A[0] * B[0] + A[1] * B[1] + A[2] * B[2], A[3] * B[0] + A[4] * B[1] + A[5] * B[2], A[6] * B[0] + A[7] * B[1] + A[8] * B[2]];\n};\n\n/**\n * Snaps a value to the nearest step increment within min/max bounds\n * @example snap(23.7, 0, 100, 5) => 25\n * @example snap(0.234, 0, 1, 0.01) => 0.23\n */\nfunction snap(value: number, min: number, max: number, step: number) {\n const clamped = clamp(value, min, max);\n\n const offset = clamped - min;\n const steps = Math.round(offset / step);\n\n const snapped = min + steps * step;\n\n const precision = (step.toString().split('.')[1] || '').length;\n\n return parseFloat(snapped.toFixed(precision));\n}\n\nabstract class Color {\n abstract clone(): ColorInstance;\n abstract toString(format: ColorOutput): string;\n abstract toFormat(format: ColorSpace): ColorInstance;\n abstract toJSON(): Record<string, number>;\n abstract getChannelRange(channel: ColorChannel): ColorChannelRange;\n abstract getFormat(): ColorSpace;\n abstract getChannels(): [ColorChannel, ColorChannel, ColorChannel];\n\n getChannelValue(channel: ColorChannel): number {\n if (channel in this) {\n return this[channel as keyof this] as number;\n }\n\n throw new Error(`Channel ${channel} not found`);\n }\n\n withChannelValue(channel: ColorChannel, value: number): ColorInstance {\n const { min, max } = this.getChannelRange(channel);\n\n if (channel in this) {\n const cloned = this.clone();\n\n // @ts-expect-error - channel\n cloned[channel] = clamp(value, min, max);\n\n return cloned;\n }\n\n throw new Error(`Channel ${channel} not found`);\n }\n\n getSpaceAxes(xyChannels: Color2DAxes): Color3DAxes {\n const { xChannel, yChannel } = xyChannels;\n\n if (xChannel === yChannel) {\n throw new Error('xChannel and yChannel cannot be the same');\n }\n\n const zChannel = this.getChannels().find((channel) => channel !== xChannel && channel !== yChannel);\n\n if (!zChannel) {\n throw new Error('zChannel not found');\n }\n\n return { xChannel, yChannel, zChannel };\n }\n\n incChannelValue(channel: ColorChannel, step: number): ColorInstance {\n const { min, max, step: availableStep } = this.getChannelRange(channel);\n\n const value = snap(clamp(this.getChannelValue(channel) + step, min, max), min, max, availableStep);\n\n return this.withChannelValue(channel, value);\n }\n\n decChannelValue(channel: ColorChannel, step: number): ColorInstance {\n return this.incChannelValue(channel, -step);\n }\n}\n\nexport class HSBColor extends Color {\n private hue: number;\n private saturation: number;\n private brightness: number;\n private alpha: number;\n\n constructor(hue: number, saturation: number, brightness: number, alpha: number) {\n super();\n this.hue = hue;\n this.saturation = saturation;\n this.brightness = brightness;\n this.alpha = alpha;\n }\n\n static parse(value: string): HSBColor | undefined {\n const match = value.match(HSB_REGEX);\n\n if (!match) return undefined;\n\n const [h, s, b, a] = (match[1] ?? match[2]).split(',').map((n) => Number(n.trim().replace('%', '')));\n\n return new HSBColor(h % 360, clamp(s, 0, 100), clamp(b, 0, 100), clamp(a ?? 1, 0, 1));\n }\n\n private toRGB(): RGBColor {\n const h = this.hue;\n const s = this.saturation / 100;\n const b = this.brightness / 100;\n\n function f(n: number) {\n const k = (n + h / 60) % 6;\n\n return b - b * s * Math.max(0, Math.min(k, 4 - k, 1));\n }\n\n const scale = 255;\n\n return new RGBColor(Math.round(f(5) * scale), Math.round(f(3) * scale), Math.round(f(1) * scale), Number(this.alpha.toFixed(2)));\n }\n\n private toHSL(): HSLColor {\n const h = this.hue;\n let s = this.saturation / 100;\n const b = this.brightness / 100;\n\n const l = b * (1 - s / 2);\n\n if (l === 0 || l === 1) {\n s = 0;\n } else {\n s = (b - l) / Math.min(l, 1 - l);\n }\n\n return new HSLColor(Number(h.toFixed(2)), Number((s * 100).toFixed(2)), Number((l * 100).toFixed(2)), Number(this.alpha.toFixed(2)));\n }\n\n toFormat(format: ColorSpace): ColorInstance {\n switch (format) {\n case 'hsba':\n return this;\n case 'rgba':\n return this.toRGB();\n case 'hsla':\n return this.toHSL();\n case 'oklcha':\n return this.toRGB().toFormat('oklcha');\n default:\n throw new Error(`Invalid format: ${format}`);\n }\n }\n\n toString(format: ColorOutput): string {\n switch (format) {\n case 'css':\n return this.toHSL().toString('css');\n case 'hex':\n return this.toRGB().toString('hex');\n case 'hexa':\n return this.toRGB().toString('hexa');\n case 'hsb':\n return `hsb(${this.hue}, ${this.saturation.toFixed(2)}%, ${this.brightness.toFixed(2)}%)`;\n case 'hsba':\n return `hsba(${this.hue}, ${this.saturation.toFixed(2)}%, ${this.brightness.toFixed(2)}%, ${this.alpha})`;\n case 'hsl':\n return this.toHSL().toString('hsl');\n case 'rgb':\n return this.toRGB().toString('rgb');\n case 'oklch':\n return this.toRGB().toFormat('oklcha').toString('oklch');\n default:\n return this.toFormat(format).toString(format);\n }\n }\n\n toJSON() {\n return {\n hue: this.hue,\n saturation: this.saturation,\n brightness: this.brightness,\n alpha: this.alpha\n };\n }\n\n clone(): ColorInstance {\n return new HSBColor(this.hue, this.saturation, this.brightness, this.alpha);\n }\n\n getChannelRange(channel: ColorChannel): ColorChannelRange {\n switch (channel) {\n case 'hue':\n return { min: 0, max: 360, step: 1 };\n case 'saturation':\n case 'brightness':\n return { min: 0, max: 100, step: 1 };\n case 'alpha':\n return { min: 0, max: 1, step: 0.01 };\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n }\n\n getFormat(): ColorSpace {\n return 'hsba';\n }\n\n getChannels(): [ColorChannel, ColorChannel, ColorChannel] {\n return ['hue', 'saturation', 'brightness'];\n }\n}\n\nexport class HSLColor extends Color {\n private hue: number;\n private saturation: number;\n private lightness: number;\n private alpha: number;\n\n constructor(hue: number, saturation: number, lightness: number, alpha: number) {\n super();\n this.hue = hue;\n this.saturation = saturation;\n this.lightness = lightness;\n this.alpha = alpha;\n }\n\n static parse(value: string): HSLColor | undefined {\n const match = value.match(HSL_REGEX);\n\n if (!match) return undefined;\n\n const [h, s, l, a] = (match[1] || match[2])?.split(',').map((n) => Number(n.trim().replace('%', ''))) ?? [];\n\n return new HSLColor(h % 360, clamp(s, 0, 100), clamp(l, 0, 100), clamp(a ?? 1, 0, 1));\n }\n\n private toRGB(): RGBColor {\n const h = this.hue;\n const s = this.saturation / 100;\n const l = this.lightness / 100;\n\n function f(n: number) {\n const k = (n + h / 30) % 12;\n const a = s * Math.min(l, 1 - l);\n\n return l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));\n }\n\n const scale = 255;\n\n return new RGBColor(Math.round(f(0) * scale), Math.round(f(8) * scale), Math.round(f(4) * scale), Number(this.alpha.toFixed(2)));\n }\n\n private toHSB(): HSBColor {\n const h = this.hue;\n let s = this.saturation / 100;\n const l = this.lightness / 100;\n\n const b = l + s * Math.min(l, 1 - l);\n\n if (b === 0) {\n s = 0;\n } else {\n s = 2 * (1 - l / b);\n }\n\n return new HSBColor(Number(h.toFixed(2)), Number((s * 100).toFixed(2)), Number((b * 100).toFixed(2)), Number(this.alpha.toFixed(2)));\n }\n\n toFormat(format: ColorSpace): ColorInstance {\n switch (format) {\n case 'hsla':\n return this;\n case 'rgba':\n return this.toRGB();\n case 'hsba':\n return this.toHSB();\n case 'oklcha':\n return this.toRGB().toFormat('oklcha');\n default:\n throw new Error(`Invalid format: ${format}`);\n }\n }\n\n toString(format: ColorOutput): string {\n switch (format) {\n case 'hex':\n return this.toRGB().toString('hex');\n case 'hexa':\n return this.toRGB().toString('hexa');\n case 'hsl':\n return `hsl(${this.hue}, ${this.saturation.toFixed(2)}%, ${this.lightness.toFixed(2)}%)`;\n case 'css':\n case 'hsla':\n return `hsla(${this.hue}, ${this.saturation.toFixed(2)}%, ${this.lightness.toFixed(2)}%, ${this.alpha})`;\n case 'rgb':\n return this.toRGB().toString('rgb');\n case 'hsb':\n return this.toHSB().toString('hsb');\n case 'oklch':\n return this.toRGB().toFormat('oklcha').toString('oklch');\n default:\n return this.toFormat(format).toString(format);\n }\n }\n\n toJSON(): Record<string, number> {\n return {\n hue: this.hue,\n saturation: this.saturation,\n lightness: this.lightness,\n alpha: this.alpha\n };\n }\n\n clone(): ColorInstance {\n return new HSLColor(this.hue, this.saturation, this.lightness, this.alpha);\n }\n\n getChannelRange(channel: ColorChannel): ColorChannelRange {\n switch (channel) {\n case 'hue':\n return { min: 0, max: 360, step: 1 };\n case 'saturation':\n case 'lightness':\n return { min: 0, max: 100, step: 1 };\n case 'alpha':\n return { min: 0, max: 1, step: 0.01 };\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n }\n\n getFormat(): ColorSpace {\n return 'hsla';\n }\n\n getChannels(): [ColorChannel, ColorChannel, ColorChannel] {\n return ['hue', 'saturation', 'lightness'];\n }\n}\n\nexport class RGBColor extends Color {\n private red: number;\n private green: number;\n private blue: number;\n private alpha: number;\n\n constructor(red: number, green: number, blue: number, alpha: number) {\n super();\n this.red = red;\n this.green = green;\n this.blue = blue;\n this.alpha = alpha;\n }\n\n static parse(value: string): RGBColor | undefined {\n if (!value) return undefined;\n\n const input = value.trim();\n\n return this.parseHexColor(input) ?? this.parseRgbFunction(input);\n }\n\n private static parseHexColor(input: string): RGBColor | undefined {\n const match = input.match(HEX_REGEX);\n\n if (!match) return undefined;\n\n let hex = match[1];\n\n // Expand shorthand (#abc -> #aabbcc)\n if (hex.length <= 4) {\n hex = hex\n .split('')\n .map((c) => c + c)\n .join('');\n }\n\n if (![6, 8].includes(hex.length)) return undefined;\n\n const r = parseInt(hex.slice(0, 2), 16);\n const g = parseInt(hex.slice(2, 4), 16);\n const b = parseInt(hex.slice(4, 6), 16);\n const a = hex.length === 8 ? parseInt(hex.slice(6, 8), 16) / 255 : 1;\n\n return new RGBColor(r, g, b, a);\n }\n\n private static parseRgbFunction(input: string): RGBColor | undefined {\n const match = input.match(RGB_REGEX);\n\n if (!match?.[1]) return undefined;\n\n const [rStr, gStr, bStr, aStr] = match[1].split(',').map((v) => v.trim());\n\n const r = clamp(Number(rStr), 0, 255);\n const g = clamp(Number(gStr), 0, 255);\n const b = clamp(Number(bStr), 0, 255);\n const a = aStr !== undefined ? clamp(Number(aStr), 0, 1) : 1;\n\n if ([r, g, b, a].some((v) => Number.isNaN(v))) return undefined;\n\n return new RGBColor(r, g, b, a);\n }\n\n private toHSB(): HSBColor {\n const scale = 255;\n const [r, g, b] = [this.red / scale, this.green / scale, this.blue / scale];\n\n const mmax = Math.max(r, g, b);\n const mmin = Math.min(r, g, b);\n\n const chroma = mmax - mmin;\n const brightness = mmax;\n\n const saturation = mmax === 0 ? 0 : chroma / mmax;\n\n let hue = 0;\n\n if (chroma !== 0) {\n switch (mmax) {\n case r:\n hue = ((g - b) / chroma) % 6;\n break;\n case g:\n hue = (b - r) / chroma + 2;\n break;\n case b:\n hue = (r - g) / chroma + 4;\n break;\n }\n\n hue *= 60;\n\n if (hue < 0) {\n hue += 360;\n }\n }\n\n return new HSBColor(Number(hue.toFixed(2)), Number((saturation * 100).toFixed(2)), Number((brightness * 100).toFixed(2)), Number(this.alpha.toFixed(2)));\n }\n\n private toHSL(): HSLColor {\n const scale = 255;\n const [r, g, b] = [this.red / scale, this.green / scale, this.blue / scale];\n\n const mmax = Math.max(r, g, b);\n const mmin = Math.min(r, g, b);\n\n const lightness = (mmax + mmin) / 2;\n const chroma = mmax - mmin;\n\n let hue = 0;\n let saturation = -1;\n\n if (chroma !== 0) {\n switch (mmax) {\n case r:\n hue = ((g - b) / chroma) % 6;\n break;\n case g:\n hue = (b - r) / chroma + 2;\n break;\n case b:\n hue = (r - g) / chroma + 4;\n break;\n }\n\n hue *= 60;\n\n if (hue < 0) {\n hue += 360;\n }\n }\n\n if (lightness === 0 || lightness === 1) {\n saturation = 0;\n } else {\n saturation = chroma / (1 - Math.abs(2 * mmax - chroma - 1));\n }\n\n return new HSLColor(Number(hue.toFixed(2)), Number((saturation * 100).toFixed(2)), Number((lightness * 100).toFixed(2)), Number(this.alpha.toFixed(2)));\n }\n\n private toOKLCH(): OKLCHColor {\n const rgb = [this.red / 255, this.green / 255, this.blue / 255];\n\n const rgbLinear = rgb.map((c) => (Math.abs(c) <= 0.04045 ? c / 12.92 : (c < 0 ? -1 : 1) * ((Math.abs(c) + 0.055) / 1.055) ** 2.4));\n\n const xyz = multiplyMatrices([0.41239079926595934, 0.357584339383878, 0.1804807884018343, 0.21263900587151027, 0.715168678767756, 0.07219231536073371, 0.01933081871559182, 0.11919477979462598, 0.9505321522496607], rgbLinear);\n\n const LMS = multiplyMatrices([0.819022437996703, 0.3619062600528904, -0.1288737815209879, 0.0329836539323885, 0.9292868615863434, 0.0361446663506424, 0.0481771893596242, 0.2642395317527308, 0.6335478284694309], xyz);\n\n const LMSg = LMS.map((val) => Math.cbrt(val));\n\n const [L, a, b] = multiplyMatrices([0.210454268309314, 0.7936177747023054, -0.0040720430116193, 1.9779985324311684, -2.4285922420485799, 0.450593709617411, 0.0259040424655478, 0.7827717124575296, -0.8086757549230774], LMSg);\n\n const C = Math.sqrt(a ** 2 + b ** 2);\n const H = Math.abs(a) < 0.0002 && Math.abs(b) < 0.0002 ? NaN : ((((Math.atan2(b, a) * 180) / Math.PI) % 360) + 360) % 360;\n\n const outL = Number(Math.min(1, Math.max(0, L)).toFixed(4));\n\n const outC = Number(C.toFixed(4));\n\n const outH = Number.isNaN(H) ? NaN : Number(H.toFixed(2));\n\n return new OKLCHColor(outL, outC, outH, Number(this.alpha.toFixed(2)));\n }\n\n toHexInt(): number {\n return (this.red << 16) | (this.green << 8) | this.blue;\n }\n\n toFormat(format: ColorSpace): ColorInstance {\n switch (format) {\n case 'rgba':\n return this;\n case 'hsla':\n return this.toHSL();\n case 'hsba':\n return this.toHSB();\n case 'oklcha':\n return this.toOKLCH();\n default:\n throw new Error(`Invalid format: ${format}`);\n }\n }\n\n toString(format: ColorOutput): string {\n switch (format) {\n case 'hex':\n return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue.toString(16).padStart(2, '0')}`;\n case 'hexa':\n return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue.toString(16).padStart(2, '0')}${Math.round(this.alpha * 255)\n .toString(16)\n .padStart(2, '0')}`;\n case 'rgb':\n return `rgb(${this.red}, ${this.green}, ${this.blue})`;\n case 'rgba':\n case 'css':\n return `rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;\n case 'hsl':\n return this.toHSL().toString('hsl');\n case 'hsb':\n return this.toHSB().toString('hsb');\n case 'oklch':\n return this.toOKLCH().toString('oklch');\n default:\n return this.toFormat(format).toString(format);\n }\n }\n\n toJSON(): Record<string, number> {\n return {\n red: this.red,\n green: this.green,\n blue: this.blue,\n alpha: this.alpha\n };\n }\n\n clone(): ColorInstance {\n return new RGBColor(this.red, this.green, this.blue, this.alpha);\n }\n\n getChannelRange(channel: ColorChannel): ColorChannelRange {\n switch (channel) {\n case 'red':\n case 'green':\n case 'blue':\n return { min: 0, max: 255, step: 1 };\n case 'alpha':\n return { min: 0, max: 1, step: 0.01 };\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n }\n\n getFormat(): ColorSpace {\n return 'rgba';\n }\n\n getChannels(): [ColorChannel, ColorChannel, ColorChannel] {\n return ['red', 'green', 'blue'];\n }\n}\n\nexport class OKLCHColor extends Color {\n private L: number; // 0–1\n private C: number; // ~0–0.4 typical usable range\n private H: number; // 0–360\n private alpha: number; // 0–1\n\n constructor(L: number, C: number, H: number, alpha: number) {\n super();\n this.L = L;\n this.C = C;\n this.H = H;\n this.alpha = alpha;\n }\n\n static parse(value: string): OKLCHColor | undefined {\n if (!value) return undefined;\n\n const m = value.trim().match(OKLCH_REGEX);\n\n if (!m) return;\n\n const l = Number(m[1]) / 100;\n const c = Number(m[2]);\n const h = Number(m[3]);\n const alpha = m[5] !== undefined ? Number(m[5]) : 1;\n\n return new OKLCHColor(l, c, h, alpha);\n }\n\n private toRGB(): RGBColor {\n const L = this.L;\n const a = Number.isNaN(this.H) ? 0 : this.C * Math.cos((this.H * Math.PI) / 180);\n const b = Number.isNaN(this.H) ? 0 : this.C * Math.sin((this.H * Math.PI) / 180);\n\n const LMSg = multiplyMatrices([1, 0.3963377774, 0.2158037573, 1, -0.1055613458, -0.0638541728, 1, -0.0894841775, -1.291485548], [L, a, b]);\n\n const LMS = LMSg.map((v) => v ** 3);\n\n const xyz = multiplyMatrices([1.2268798758, -0.5578149945, 0.2813910457, -0.0405757452, 1.1122868033, -0.0717110581, -0.0763729367, -0.4214933324, 1.5869240198], LMS);\n\n let [r, g, b2] = multiplyMatrices([3.240969942, -1.537383178, -0.49861076, -0.969243636, 1.875967502, 0.041555057, 0.05563008, -0.203976959, 1.056971514], xyz);\n\n [r, g, b2] = [r, g, b2].map((c) => (Math.abs(c) > 0.0031308 ? (c < 0 ? -1 : 1) * (1.055 * Math.abs(c) ** (1 / 2.4) - 0.055) : 12.92 * c));\n\n return new RGBColor(Math.round(clamp(r, 0, 1) * 255), Math.round(clamp(g, 0, 1) * 255), Math.round(clamp(b2, 0, 1) * 255), Number(this.alpha.toFixed(2)));\n }\n\n toJSON(): Record<string, number> {\n return {\n L: this.L,\n C: this.C,\n H: this.H,\n alpha: this.alpha\n };\n }\n\n clone(): ColorInstance {\n return new OKLCHColor(this.L, this.C, this.H, this.alpha);\n }\n\n toFormat(format: ColorSpace): ColorInstance {\n switch (format) {\n case 'oklcha':\n return this;\n case 'rgba':\n return this.toRGB();\n case 'hsla':\n return this.toRGB().toFormat('hsla');\n case 'hsba':\n return this.toRGB().toFormat('hsba');\n default:\n throw new Error(`Invalid format: ${format}`);\n }\n }\n\n toString(format: ColorOutput): string {\n switch (format) {\n case 'hex':\n return this.toRGB().toString('hex');\n case 'hexa':\n return this.toRGB().toString('hexa');\n\n case 'oklch': {\n const l = Number.isNaN(this.L) ? 0 : Number((this.L * 100).toFixed(2));\n const c = Number.isNaN(this.C) ? 0 : Number(this.C.toFixed(4));\n const h = Number.isNaN(this.H) ? 0 : Number(this.H.toFixed(2));\n\n return `oklch(${l}% ${c} ${h})`;\n }\n\n case 'oklcha':\n\n case 'css': {\n const l = Number.isNaN(this.L) ? 0 : Number((this.L * 100).toFixed(2));\n const c = Number.isNaN(this.C) ? 0 : Number(this.C.toFixed(4));\n const h = Number.isNaN(this.H) ? 0 : Number(this.H.toFixed(2));\n const a = Number.isNaN(this.alpha) ? 1 : Number(this.alpha.toFixed(2));\n\n return `oklch(${l}% ${c} ${h} / ${a})`;\n }\n\n case 'hsl':\n return this.toRGB().toString('hsl');\n case 'hsb':\n return this.toRGB().toString('hsb');\n case 'rgb':\n return this.toRGB().toString('rgb');\n default:\n return this.toFormat(format).toString(format);\n }\n }\n\n getChannelRange(channel: ColorChannel): ColorChannelRange {\n switch (channel) {\n case 'L':\n return { min: 0, max: 1, step: 0.01 };\n case 'C':\n return { min: 0, max: 0.4, step: 0.01 };\n case 'H':\n return { min: 0, max: 360, step: 1 };\n case 'alpha':\n return { min: 0, max: 1, step: 0.01 };\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n }\n\n getFormat(): ColorSpace {\n return 'oklcha';\n }\n\n getChannels(): [ColorChannel, ColorChannel, ColorChannel] {\n return ['L', 'C', 'H'];\n }\n}\n\nexport const parseColor = (color: string): ColorInstance => {\n const parsedColor = RGBColor.parse(color) ?? HSLColor.parse(color) ?? HSBColor.parse(color) ?? undefined;\n\n if (!parsedColor) {\n throw new Error(`Invalid color: ${color}`);\n }\n\n return parsedColor;\n};\n\nexport function getChannelGradient(channel: ColorSliderChannel, value: ColorInstance, orientation: 'horizontal' | 'vertical') {\n const { min, max } = value.getChannelRange(channel);\n\n const direction = orientation === 'horizontal' ? 'right' : 'bottom';\n\n switch (channel) {\n case 'hue':\n return `linear-gradient(to ${direction}, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)`;\n\n case 'lightness': {\n const start = value.withChannelValue(channel, min).toString('css');\n const middle = value.withChannelValue(channel, (max - min) / 2).toString('css');\n const end = value.withChannelValue(channel, max).toString('css');\n\n return `linear-gradient(to ${direction}, ${start}, ${middle}, ${end})`;\n }\n\n case 'red':\n case 'green':\n case 'blue':\n case 'saturation':\n case 'brightness':\n\n case 'alpha': {\n const start = value.withChannelValue(channel, min).toString('css');\n const end = value.withChannelValue(channel, max).toString('css');\n\n return `linear-gradient(to ${direction}, ${start}, ${end})`;\n }\n\n default:\n throw new Error(`Unknown color channel: ${channel}`);\n }\n}\n\nexport function getChannelColor(color: ColorInstance, channel: ColorChannel) {\n switch (channel) {\n case 'hue':\n return parseColor(`hsl(${color.getChannelValue('hue')}, 100%, 50%)`);\n\n case 'red':\n case 'green':\n case 'blue':\n case 'lightness':\n case 'brightness':\n case 'saturation':\n return color.withChannelValue('alpha', 1);\n\n case 'alpha': {\n return color;\n }\n\n default:\n throw new Error('Unknown color channel: ' + channel);\n }\n}\n\nconst channelGenerators = {\n hue: (color: ColorInstance) => [0, 60, 120, 180, 240, 300, 360].map((h) => color.withChannelValue('hue', h).toString('css')).join(', '),\n\n saturation: (color: ColorInstance) => `${color.withChannelValue('saturation', 0).toString('css')}, transparent`,\n\n lightness: () => 'black, transparent, white',\n brightness: () => 'black, transparent'\n};\n\nexport function getAreaGradient(color: ColorInstance, axes: Color2DAxes) {\n const { xChannel, zChannel } = color.getSpaceAxes(axes);\n const zValue = color.getChannelValue(zChannel);\n const baseFormat = color.getFormat();\n\n const format = baseFormat === 'rgba' || baseFormat === 'oklcha' ? 'hsba' : baseFormat;\n\n const base = (format === 'hsla' ? parseColor('hsl(0, 100%, 50%)') : parseColor('hsb(0, 100%, 100%)')).withChannelValue(zChannel, zValue);\n\n const channels = color.getChannels();\n\n const direction = (c: string) => (c === xChannel ? 'right' : 'top');\n\n const layers = channels\n .filter((c) => c !== zChannel)\n .map((c) => `linear-gradient(to ${direction(c)}, ${channelGenerators[c as keyof typeof channelGenerators](base)})`)\n .reverse();\n\n if (zChannel === 'hue') {\n layers.push(base.toString('css'));\n }\n\n return {\n '--area-gradient': layers.join(', ')\n };\n}\n\nexport function getInputChannelValue(color: ColorInstance, channel: ColorInputChannel, format: ColorSpace = 'hsba') {\n const isHSL = color.getFormat() === 'hsla';\n\n switch (channel) {\n case 'hex': {\n if (color.getChannelValue('alpha') < color.getChannelRange('alpha').max) {\n return color.toString('hexa');\n }\n\n return color.toString('hex');\n }\n\n case 'css':\n return color.toFormat(format).toString('css');\n\n case 'red':\n case 'green':\n case 'blue':\n return color.toFormat('rgba').getChannelValue(channel).toString();\n\n case 'hue':\n return color\n .toFormat(isHSL ? 'hsla' : 'hsba')\n .getChannelValue('hue')\n .toString();\n\n case 'saturation':\n return color\n .toFormat(isHSL ? 'hsla' : 'hsba')\n .getChannelValue('saturation')\n .toString();\n\n case 'lightness':\n return color.toFormat('hsla').getChannelValue('lightness').toString();\n\n case 'brightness':\n return color.toFormat('hsba').getChannelValue('brightness').toString();\n\n case 'C':\n return color.toFormat('oklcha').getChannelValue('C').toString();\n case 'H':\n return color.toFormat('oklcha').getChannelValue('H').toString();\n case 'L':\n return color.toFormat('oklcha').getChannelValue('L').toString();\n default:\n return color.getChannelValue(channel).toString();\n }\n}\n\nexport function getInputChannelRange(color: ColorInstance, channel: ColorInputChannel = 'hex'): ColorChannelRange | undefined {\n switch (channel) {\n case 'hex': {\n return {\n min: (parseColor('#000000') as RGBColor).toHexInt(),\n max: (parseColor('#FFFFFF') as RGBColor).toHexInt(),\n step: 1\n };\n }\n\n case 'css':\n return undefined;\n\n case 'red':\n case 'green':\n case 'blue':\n return color.toFormat('rgba').getChannelRange(channel);\n\n case 'hue':\n case 'lightness':\n case 'saturation':\n return color.toFormat('hsla').getChannelRange(channel);\n\n case 'brightness':\n return color.toFormat('hsba').getChannelRange(channel);\n\n case 'L':\n case 'C':\n case 'H':\n return color.toFormat('oklcha').getChannelRange(channel);\n\n default:\n return color.getChannelRange(channel);\n }\n}\n","import { withHeadless } from '@primereact/core/headless';\nimport { useControlledState } from '@primereact/hooks/use-controlled-state';\nimport type { ColorInputChannel, ColorInstance } from '@primereact/types/shared/colorpicker';\nimport * as React from 'react';\nimport { getAreaGradient, getInputChannelValue, parseColor } from './colorManager';\nimport { defaultProps } from './useColorPicker.props';\n\nexport const useColorPicker = withHeadless({\n name: 'useColorPicker',\n defaultProps,\n setup({ props }) {\n const { format = 'hsba', disabled } = props;\n const [isAreaDragging, setIsAreaDragging] = React.useState(false);\n const inputElRefs = React.useRef<HTMLInputElement[]>([]);\n\n const [value, setValue] = useControlledState({\n value: React.useMemo(() => props.value, [props.value]),\n defaultValue: React.useMemo(() => props.defaultValue ?? parseColor('#ff0000').toFormat(props.format || 'hsba'), [props.defaultValue]),\n onChange: props.onValueChange\n });\n\n const ensuredValue: ColorInstance = React.useMemo(() => {\n return ((value as ColorInstance | undefined) ?? parseColor('#ff0000').toFormat(format)) as ColorInstance;\n }, [value, format]);\n\n const areaFormat = format.startsWith('hsl') ? 'hsla' : 'hsba';\n const areaValue = React.useMemo(() => {\n return ensuredValue.toFormat(areaFormat);\n }, [ensuredValue, areaFormat]);\n\n const state = {\n value: ensuredValue,\n isAreaDragging\n };\n\n const moveArea = (x: number, y: number, element: HTMLElement) => {\n if (!element || disabled) return;\n\n const rect = element.getBoundingClientRect();\n const nx = Math.max(0, Math.min(1, (x - rect.left) / rect.width));\n const ny = Math.max(0, Math.min(1, (y - rect.top) / rect.height));\n\n const { xChannel, yChannel } = getAreaChannels();\n\n const xRange = areaValue.getChannelRange(xChannel);\n const yRange = areaValue.getChannelRange(yChannel);\n\n const xValue = nx * (xRange.max - xRange.min) + xRange.min;\n const yValue = (1 - ny) * (yRange.max - yRange.min) + yRange.min;\n\n const xDelta = xValue - areaValue.getChannelValue(xChannel);\n const yDelta = yValue - areaValue.getChannelValue(yChannel);\n\n const newColor = areaValue.incChannelValue(xChannel, xDelta).incChannelValue(yChannel, yDelta);\n\n setValue([\n newColor,\n {\n color: newColor.toString(format),\n value: newColor\n }\n ]);\n\n syncChannelInputs(newColor);\n };\n\n const handleAreaPointerDown = (event: PointerEvent) => {\n const element = event.currentTarget as HTMLElement;\n\n if (!element || event.button !== 0) return;\n\n element.setPointerCapture(event.pointerId);\n setIsAreaDragging(true);\n moveArea(event.clientX, event.clientY, element);\n };\n\n const handleAreaPointerMove = (event: PointerEvent) => {\n if (!isAreaDragging) return;\n\n moveArea(event.clientX, event.clientY, event.currentTarget as HTMLElement);\n };\n\n const handleAreaPointerUp = (event: PointerEvent) => {\n const element = event.currentTarget as HTMLElement;\n\n if (!element) return;\n\n element.releasePointerCapture(event.pointerId);\n setIsAreaDragging(false);\n };\n\n const handleAreaKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (disabled) return;\n\n const key = event.key;\n\n if (!['ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown'].includes(key)) return;\n\n event.preventDefault();\n\n const { xChannel, yChannel } = getAreaChannels();\n const { step: stepX } = areaValue.getChannelRange(xChannel);\n const { step: stepY } = areaValue.getChannelRange(yChannel);\n\n let next = areaValue;\n\n if (key === 'ArrowRight') next = next.incChannelValue(xChannel, stepX);\n\n if (key === 'ArrowLeft') next = next.decChannelValue(xChannel, stepX);\n\n if (key === 'ArrowUp') next = next.incChannelValue(yChannel, stepY);\n\n if (key === 'ArrowDown') next = next.decChannelValue(yChannel, stepY);\n\n setValue([\n next,\n {\n color: next.toString(format),\n value: next\n }\n ]);\n\n syncChannelInputs(next);\n };\n\n const getAreaChannels = () => {\n const channels = areaValue.getChannels();\n\n return {\n xChannel: channels[1],\n yChannel: channels[2]\n };\n };\n\n const openEyeDropper = () => {\n // @ts-expect-error - EyeDropper is not supported by some browsers\n if ((typeof window !== 'undefined' && !window.EyeDropper) || disabled) return;\n\n const eyeDropper = new (window as Window & typeof globalThis & { EyeDropper: new () => { open: () => Promise<{ sRGBHex: string }> } }).EyeDropper();\n\n eyeDropper\n .open()\n .then((result: { sRGBHex: string }) => {\n const newColor = parseColor(result.sRGBHex);\n\n setValue([\n newColor,\n {\n color: newColor.toString(format),\n value: newColor\n }\n ]);\n syncChannelInputs(newColor);\n })\n .catch((e: Error) => {\n // User cancelled the eyedropper\n // eslint-disable-next-line no-console\n console.error('Error opening eyedropper', e);\n });\n };\n\n const areaChannels = getAreaChannels();\n const { min: minX, max: maxX } = areaValue.getChannelRange(areaChannels.xChannel);\n const { min: minY, max: maxY } = areaValue.getChannelRange(areaChannels.yChannel);\n const xValue = areaValue.getChannelValue(areaChannels.xChannel);\n const yValue = areaValue.getChannelValue(areaChannels.yChannel);\n\n const areaStyles = {\n ...getAreaGradient(areaValue, areaChannels),\n '--thumb-background': areaValue.withChannelValue('alpha', 1).toString('css'),\n '--thumb-position-left': ((xValue - minX) / (maxX - minX)) * 100 + '%',\n '--thumb-position-top': (1 - (yValue - minY) / (maxY - minY)) * 100 + '%'\n } as React.CSSProperties;\n\n const swatchStyles = {\n '--swatch-background': ensuredValue.toString('css')\n } as React.CSSProperties;\n\n const registerInputEl = (el: { elementRef: React.RefObject<HTMLInputElement> }) => {\n const element = el.elementRef.current;\n\n if (inputElRefs.current.includes(element)) return;\n\n inputElRefs.current.push(element);\n };\n\n const syncChannelInputs = (color?: ColorInstance) => {\n requestAnimationFrame(() => {\n const base = color || ensuredValue;\n\n const channelInputs = inputElRefs.current;\n\n channelInputs.forEach((input) => {\n const channel = input.getAttribute('data-channel');\n\n if (channel) {\n const channelValue = getInputChannelValue(base, channel as ColorInputChannel, format);\n\n input.value = String(channelValue);\n }\n });\n });\n };\n\n React.useEffect(() => {\n syncChannelInputs();\n }, [format]);\n\n return {\n state,\n value,\n areaValue,\n areaChannels,\n setValue,\n handleAreaPointerDown,\n handleAreaPointerMove,\n handleAreaPointerUp,\n handleAreaKeyDown,\n areaStyles,\n swatchStyles,\n openEyeDropper,\n syncChannelInputs,\n registerInputEl\n };\n }\n});\n","import type { useColorPickerProps } from '@primereact/types/shared/colorpicker';\n\nexport const defaultProps: useColorPickerProps = {\n defaultValue: undefined,\n value: undefined,\n format: 'hsba',\n disabled: false,\n onValueChange: undefined\n};\n"],"mappings":"ubAGA,IAAMA,GAAY,kLACZC,GAAY,kLACZC,GAAY,yBACZC,GAAY,2BACZC,GAAc,2EAGpB,SAASC,EAAMC,EAAeC,EAAaC,EAAa,CACpD,OAAO,KAAK,IAAI,KAAK,IAAIF,EAAOC,CAAG,EAAGC,CAAG,CAC7C,CAEO,IAAMC,GAAU,CAACC,EAAYC,IAAe,KAAK,UAAUD,CAAC,IAAM,KAAK,UAAUC,CAAC,EAEnFC,EAAmB,CAACC,EAAaC,IAC5B,CAACD,EAAE,CAAC,EAAIC,EAAE,CAAC,EAAID,EAAE,CAAC,EAAIC,EAAE,CAAC,EAAID,EAAE,CAAC,EAAIC,EAAE,CAAC,EAAGD,EAAE,CAAC,EAAIC,EAAE,CAAC,EAAID,EAAE,CAAC,EAAIC,EAAE,CAAC,EAAID,EAAE,CAAC,EAAIC,EAAE,CAAC,EAAGD,EAAE,CAAC,EAAIC,EAAE,CAAC,EAAID,EAAE,CAAC,EAAIC,EAAE,CAAC,EAAID,EAAE,CAAC,EAAIC,EAAE,CAAC,CAAC,EAQrI,SAASC,GAAKT,EAAeC,EAAaC,EAAaQ,EAAc,CAGjE,IAAMC,EAFUZ,EAAMC,EAAOC,EAAKC,CAAG,EAEZD,EACnBW,EAAQ,KAAK,MAAMD,EAASD,CAAI,EAEhCG,EAAUZ,EAAMW,EAAQF,EAExBI,GAAaJ,EAAK,SAAS,EAAE,MAAM,GAAG,EAAE,CAAC,GA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IAAMC,EAAUD,EAAM,aAAa,cAAc,EAEjD,GAAIC,EAAS,CACT,IAAMC,EAAeC,EAAqBJ,EAAME,EAA8B5D,CAAM,EAEpF2D,EAAM,MAAQ,OAAOE,CAAY,CACrC,CACJ,CAAC,CACL,CAAC,CACL,EAEA,OAAM,YAAU,IAAM,CAClB9B,EAAkB,CACtB,EAAG,CAAC/B,CAAM,CAAC,EAEJ,CACH,MAAAa,EACA,MAAAR,EACA,UAAAO,EACA,aAAAiC,EACA,SAAAvC,EACA,sBAAA0B,EACA,sBAAAE,EACA,oBAAAC,EACA,kBAAAC,EACA,WAAAc,GACA,aAAAI,GACA,eAAAZ,EACA,kBAAAX,EACA,gBAAAwB,EACJ,CACJ,CACJ,CAAC","names":["HSB_REGEX","HSL_REGEX","HEX_REGEX","RGB_REGEX","OKLCH_REGEX","clamp","value","min","max","isEqual","a","b","multiplyMatrices","A","B","snap","step","offset","steps","snapped","precision","Color","channel","cloned","xyChannels","xChannel","yChannel","zChannel","availableStep","HSBColor","_HSBColor","hue","saturation","brightness","alpha","_a","match","h","s","n","f","k","scale","RGBColor","l","HSLColor","format","_HSLColor","lightness","_b","_RGBColor","red","green","blue","input","hex","c","r","g","rStr","gStr","bStr","aStr","v","mmax","mmin","chroma","rgbLinear","xyz","LMSg","val","L","C","H","outL","outC","outH","OKLCHColor","_OKLCHColor","m","LMS","b2","parseColor","color","_c","parsedColor","getChannelGradient","orientation","direction","start","middle","end","getChannelColor","channelGenerators","getAreaGradient","axes","zValue","baseFormat","base","channels","layers","getInputChannelValue","isHSL","getInputChannelRange","withHeadless","useControlledState","React","defaultProps","useColorPicker","withHeadless","defaultProps","props","format","disabled","isAreaDragging","setIsAreaDragging","inputElRefs","value","setValue","useControlledState","_a","parseColor","ensuredValue","areaFormat","areaValue","state","moveArea","x","y","element","rect","nx","ny","xChannel","yChannel","getAreaChannels","xRange","yRange","xValue","yValue","xDelta","yDelta","newColor","syncChannelInputs","handleAreaPointerDown","event","handleAreaPointerMove","handleAreaPointerUp","handleAreaKeyDown","key","stepX","stepY","next","channels","openEyeDropper","result","e","areaChannels","minX","maxX","minY","maxY","areaStyles","__spreadProps","__spreadValues","getAreaGradient","swatchStyles","registerInputEl","el","color","base","input","channel","channelValue","getInputChannelValue"]}
@@ -0,0 +1,2 @@
1
+ export * from './useColorPickerInput';
2
+ export * from './useColorPickerInput.props';
@@ -0,0 +1,2 @@
1
+ var Ot=Object.defineProperty,Kt=Object.defineProperties;var Ut=Object.getOwnPropertyDescriptors;var j=Object.getOwnPropertySymbols;var zt=Object.prototype.hasOwnProperty,Xt=Object.prototype.propertyIsEnumerable;var q=(e,r,o)=>r in e?Ot(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,u=(e,r)=>{for(var o in r||(r={}))zt.call(r,o)&&q(e,o,r[o]);if(j)for(var o of j(r))Xt.call(r,o)&&q(e,o,r[o]);return e},d=(e,r)=>Kt(e,Ut(r));import{withHeadless as _r}from"@primereact/core/headless";import{Component as Ur}from"@primereact/core/component";import{useColorPicker as zr}from"@primereact/headless/colorpicker";import{styles as Xr}from"@primereact/styles/colorpicker";import{mergeProps as Jr}from"@primeuix/utils";import{withComponent as Jt}from"@primereact/core/component";import{styles as jt}from"@primereact/styles/base";var l=({name:e="UnknownComponent",defaultProps:r,styles:o=d(u({},jt),{name:"global"}),components:t,setup:n,render:s})=>Jt({name:e,defaultProps:r,styles:o,components:t,setup:n,render:s});import*as F from"react";import{createOptionalContext as qt}from"@primereact/core/utils";var[W,c]=qt();import*as Q from"@primereact/headless/colorpicker";var Y=u({},Q.defaultProps);import{Component as _t}from"@primereact/core/component";import{mergeProps as tr}from"@primeuix/utils";import*as P from"react";import{Component as Wt}from"@primereact/core/component";import{mergeProps as Qt}from"@primeuix/utils";import*as _ from"react";var Z={as:"div"};var B=l({name:"ColorPickerAreaBackground",defaultProps:Z,setup(){return{colorpicker:c()}},render(e){let{props:r,ptmi:o,colorpicker:t}=e,n=Qt({className:t==null?void 0:t.cx("areaBackground")},t==null?void 0:t.ptm("areaBackground"),o("root"));return _.createElement(Wt,{instance:e,attrs:n,children:r.children})}});import{Component as Yt}from"@primereact/core/component";import{mergeProps as Zt}from"@primeuix/utils";import*as rt from"react";var tt={as:"div"};var H=l({name:"ColorPickerAreaThumb",defaultProps:tt,setup(){return{colorpicker:c()}},render(e){var i,a;let{props:r,ptmi:o,colorpicker:t}=e,n=t==null?void 0:t.props.disabled,s=Zt({className:t==null?void 0:t.cx("areaThumb",{disabled:n}),onKeyDown:t==null?void 0:t.handleAreaKeyDown,role:"slider",tabIndex:n?-1:0,"aria-disabled":n,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":(a=(i=t==null?void 0:t.areaValue)==null?void 0:i.getChannelValue(t==null?void 0:t.areaChannels.xChannel))!=null?a:0,"aria-label":`${t==null?void 0:t.areaChannels.xChannel} and ${t==null?void 0:t.areaChannels.yChannel}`,"aria-roledescription":"2d slider","aria-valuetext":`${t==null?void 0:t.areaChannels.xChannel} ${t==null?void 0:t.areaValue.getChannelValue(t==null?void 0:t.areaChannels.xChannel)}, ${t==null?void 0:t.areaChannels.yChannel} ${t==null?void 0:t.areaValue.getChannelValue(t==null?void 0:t.areaChannels.yChannel)}`},t==null?void 0:t.ptm("areaThumb"),o("root"));return rt.createElement(Yt,{instance:e,attrs:s,children:r.children})}});var et={as:"div"};var ot=l({name:"ColorPickerArea",defaultProps:et,setup(){return{colorpicker:c()}},render(e){var s;let{props:r,ptmi:o,colorpicker:t}=e,n=tr({className:t==null?void 0:t.cx("area"),onPointerDown:t==null?void 0:t.handleAreaPointerDown,onPointerMove:t==null?void 0:t.handleAreaPointerMove,onPointerUp:t==null?void 0:t.handleAreaPointerUp,style:u(u({},t==null?void 0:t.areaStyles),t==null?void 0:t.sx("area"))},t==null?void 0:t.ptm("area"),o("root"));return P.createElement(_t,{instance:e,attrs:n,children:(s=r.children)!=null?s:P.createElement(P.Fragment,null,P.createElement(B,null),P.createElement(H,null))})}});import{Component as mr}from"@primereact/core/component";import{EyeDropperIcon as hr}from"@primereact/icons/eyedropper";import{mergeProps as cr}from"@primeuix/utils";import{Component as ar}from"@primereact/core/component";import{useButton as ir}from"@primereact/headless/button";import{styles as pr}from"@primereact/styles/button";import{mergeProps as ur}from"@primeuix/utils";import*as A from"react";import{createOptionalContext as rr}from"@primereact/core/utils";var[nt,Je]=rr();import*as st from"@primereact/headless/button";var $=d(u({},st.defaultProps),{as:"button",size:void 0,severity:void 0,variant:void 0,plain:!1,rounded:!1,raised:!1,iconOnly:!1,fluid:!1});import{Component as or}from"@primereact/core/component";import{groupStyles as nr}from"@primereact/styles/button";import{mergeProps as sr}from"@primeuix/utils";import*as D from"react";import{createOptionalContext as er}from"@primereact/core/utils";var[at,Ye]=er();var it={as:"div"};var pt=l({name:"ButtonGroup",defaultProps:it,styles:nr,render(e){let{props:r,ptmi:o,cx:t}=e,n=sr({className:t("root")},o("root"));return D.createElement(at,{value:e},D.createElement(or,{instance:e,attrs:n,children:r.children}))}});var ut=l({name:"Button",defaultProps:$,styles:pr,setup(e){return ir(e.inProps)},render(e){let{id:r,props:o,ptmi:t,cx:n}=e,s=ur({id:r,className:n("root")},t("root"));return A.createElement(nt,{value:e},A.createElement(ar,{instance:e,attrs:s,children:o.children}))},components:{Group:pt}});import*as O from"react";var lt=d(u({},$),{iconOnly:!0,variant:"outlined",severity:"secondary"});var mt=l({name:"ColorPickerEyeDropper",defaultProps:lt,setup(){return{colorpicker:c()}},render(e){var a;let{props:r,ptmi:o,colorpicker:t}=e,n=cr({type:"button",className:t==null?void 0:t.cx("eyeDropper"),onClick:t==null?void 0:t.openEyeDropper,disabled:r.disabled||(t==null?void 0:t.props.disabled)},t==null?void 0:t.ptm("eyeDropper"),o("root")),i=O.createElement(hr,{pt:t==null?void 0:t.ptm("eyeDropperIcon")});return O.createElement(mr,{as:ut,instance:e,attrs:u(u({},r),n),pt:t==null?void 0:t.ptm("eyeDropper"),children:(a=r.children)!=null?a:i})}});import{Component as Nr}from"@primereact/core/component";import{useColorPickerInput as Fr}from"@primereact/headless/colorpicker/input";import{mergeProps as vr}from"@primeuix/utils";import{Component as Pr}from"@primereact/core/component";import{useInputText as Sr}from"@primereact/headless/inputtext";import{styles as wr}from"@primereact/styles/inputtext";import{mergeProps as yr}from"@primeuix/utils";import{Component as Cr}from"@primereact/core/component";import{useFluid as fr}from"@primereact/headless/fluid";import{styles as gr}from"@primereact/styles/fluid";import{mergeProps as br}from"@primeuix/utils";import*as K from"react";import{createOptionalContext as dr}from"@primereact/core/utils";var[ht,ct]=dr();import*as dt from"@primereact/headless/fluid";var Ct=d(u({},dt.defaultProps),{as:"div"});var Jo=l({name:"Fluid",defaultProps:Ct,styles:gr,setup(e){return fr(e.inProps)},render(e){let{id:r,props:o,ptmi:t,cx:n}=e,s=br({id:r,className:n("root")},t("root"));return K.createElement(ht,{value:e},K.createElement(Cr,{instance:e,attrs:s,children:o.children}))}});import*as U from"react";import{createOptionalContext as xr}from"@primereact/core/utils";var[ft,_o]=xr();import*as gt from"@primereact/headless/inputtext";var G=d(u({},gt.defaultProps),{as:"input",size:void 0,variant:void 0,fluid:void 0,invalid:!1});var bt=l({name:"InputText",defaultProps:G,styles:wr,setup(e){let r=Sr(e==null?void 0:e.inProps),o=ct();return d(u({},r),{fluid:o})},render(e){let{id:r,props:o,ptmi:t,cx:n,fluid:s}=e,i=yr({id:r,type:"text",className:n("root",{$fluid:!!s})},t("root"));return U.createElement(ft,{value:e},U.createElement(Pr,{instance:e,attrs:i,children:o.children}))}});import*as z from"react";import{createOptionalContext as kr}from"@primereact/core/utils";var[xt,bn]=kr();import*as Pt from"@primereact/headless/colorpicker/input";var St=u(u({},G),Pt.defaultProps);var wt=l({name:"ColorPickerInput",defaultProps:St,setup(e){let r=c(),o=Fr(e.inProps);return u({colorpicker:r},o)},render(e){let{props:r,ptmi:o,colorpicker:t,type:n,channelRange:s,channelValue:i,handleBlur:a,handleKeyDown:p}=e,m=vr({id:r.inputId,className:t==null?void 0:t.cx("input"),type:n,spellCheck:!1,autoComplete:"off",defaultValue:i,min:s==null?void 0:s.min,max:s==null?void 0:s.max,step:s==null?void 0:s.step,onBlur:a,onKeyDown:p,"data-channel":r.channel,"aria-label":r.channel,disabled:r.disabled||(t==null?void 0:t.props.disabled)},t==null?void 0:t.ptm("input"),o("root"));return z.createElement(xt,{value:e},z.createElement(Nr,{as:bt,instance:e,attrs:u(u({},r),m),pt:t==null?void 0:t.ptm("input"),children:r.children,ref:t==null?void 0:t.registerInputEl}))}});import{Component as Er}from"@primereact/core/component";import{useColorPickerSlider as Vr}from"@primereact/headless/colorpicker/slider";import{mergeProps as Lr}from"@primeuix/utils";import*as x from"react";import{Component as Br}from"@primereact/core/component";import{mergeProps as Hr}from"@primeuix/utils";import*as kt from"react";import{createOptionalContext as Rr}from"@primereact/core/utils";var[yt,T]=Rr();var It={as:"div"};var M=l({name:"ColorPickerSliderThumb",defaultProps:It,setup(){let e=c(),r=T();return{colorpicker:e,colorpickerslider:r}},render(e){var a,p,m,h;let{props:r,ptmi:o,colorpicker:t,colorpickerslider:n}=e,s=!!(n!=null&&n.props.disabled||t!=null&&t.props.disabled),i=Hr({className:t==null?void 0:t.cx("slider-thumb",{disabled:(n==null?void 0:n.props.disabled)||(t==null?void 0:t.props.disabled)}),role:"slider",tabIndex:s?-1:0,onKeyDown:n==null?void 0:n.handleSliderKeyDown,"data-orientation":n==null?void 0:n.props.orientation,"data-channel":n==null?void 0:n.props.channel,"aria-orientation":n==null?void 0:n.props.orientation,"aria-disabled":s,"aria-label":`${n==null?void 0:n.props.channel} slider`,"aria-valuemin":(p=(a=n==null?void 0:n.channelRange)==null?void 0:a.min)!=null?p:0,"aria-valuemax":(h=(m=n==null?void 0:n.channelRange)==null?void 0:m.max)!=null?h:100,"aria-valuenow":n==null?void 0:n.channelValue,"aria-valuetext":`${n==null?void 0:n.props.channel} ${n==null?void 0:n.channelValue}`},t==null?void 0:t.ptm("slider-thumb"),o("root"));return kt.createElement(Br,{instance:e,attrs:i,children:r.children})}});import{Component as $r}from"@primereact/core/component";import{mergeProps as Gr}from"@primeuix/utils";import*as Ft from"react";var Nt={as:"div"};var E=l({name:"ColorPickerSliderTrack",defaultProps:Nt,setup(){let e=c(),r=T();return{colorpicker:e,colorpickerslider:r}},render(e){let{props:r,ptmi:o,colorpicker:t,colorpickerslider:n}=e,s=Gr({className:t==null?void 0:t.cx("slider-track"),"data-orientation":n==null?void 0:n.props.orientation,"data-channel":n==null?void 0:n.props.channel},t==null?void 0:t.ptm("slider-track"),o("root"));return Ft.createElement($r,{instance:e,attrs:s,children:r.children})}});import{Component as Tr}from"@primereact/core/component";import{mergeProps as Mr}from"@primeuix/utils";import*as Rt from"react";var vt={as:"div"};var y=l({name:"ColorPickerTransparencyGrid",defaultProps:vt,setup(){return{colorpicker:c()}},render(e){let{props:r,ptmi:o,colorpicker:t}=e,n=Mr({className:t==null?void 0:t.cx("transparency-grid")},t==null?void 0:t.ptm("transparency-grid"),o("root"));return Rt.createElement(Tr,{instance:e,attrs:n,children:r.children})}});import*as Bt from"@primereact/headless/colorpicker/slider";var Ht=d(u({},Bt.defaultProps),{as:"div"});var $t=l({name:"ColorPickerSlider",defaultProps:Ht,setup(e){let r=c(),o=Vr(d(u({},e.inProps),{context:r}));return d(u({},o),{colorpicker:r})},render(e){var m;let{props:r,ptmi:o,colorpicker:t,handleSliderPointerDown:n,handleSliderPointerMove:s,handleSliderPointerUp:i,sliderStyle:a}=e,p=Lr({className:t==null?void 0:t.cx("slider",{orientation:r.orientation}),onPointerDown:n,onPointerMove:s,onPointerUp:i,style:u(u({},a),t==null?void 0:t.sx("slider")),"data-orientation":r.orientation,"data-channel":r.channel},t==null?void 0:t.ptm("slider"),o("root"));return x.createElement(yt,{value:e},x.createElement(Er,{instance:e,attrs:p,children:(m=r.children)!=null?m:x.createElement(x.Fragment,null,x.createElement(y,null),x.createElement(E,null),x.createElement(M,null))}))}});import{Component as Or}from"@primereact/core/component";import{mergeProps as Kr}from"@primeuix/utils";import*as S from"react";import{Component as Dr}from"@primereact/core/component";import{mergeProps as Ar}from"@primeuix/utils";import*as Tt from"react";var Gt={as:"div"};var V=l({name:"ColorPickerSwatchBackground",defaultProps:Gt,setup(){return{colorpicker:c()}},render(e){let{props:r,ptmi:o,colorpicker:t}=e,n=Ar({className:t==null?void 0:t.cx("swatchBackground")},t==null?void 0:t.ptm("swatchBackground"),o("root"));return Tt.createElement(Dr,{instance:e,attrs:n,children:r.children})}});var Mt={as:"div"};var Et=l({name:"ColorPickerSwatch",defaultProps:Mt,setup(){return{colorpicker:c()}},render(e){var s;let{props:r,ptmi:o,colorpicker:t}=e,n=Kr({className:t==null?void 0:t.cx("swatch"),style:u(u({},t==null?void 0:t.swatchStyles),t==null?void 0:t.sx("swatch"))},t==null?void 0:t.ptm("swatch"),o("root"));return S.createElement(Or,{instance:e,attrs:n,children:(s=r.children)!=null?s:S.createElement(S.Fragment,null,S.createElement(y,null),S.createElement(V,null))})}});var ga=l({name:"ColorPicker",defaultProps:Y,styles:Xr,setup(e){return zr(e.inProps)},render(e){let{props:r,ptmi:o}=e,t=Jr(o("root"));return F.createElement(W,{value:e},F.createElement(Ur,{instance:e,attrs:t,children:r.children,as:F.Fragment}))},components:{Area:ot,AreaBackground:B,AreaThumb:H,Slider:$t,SliderThumb:M,SliderTrack:E,TransparencyGrid:y,Swatch:Et,SwatchBackground:V,EyeDropper:mt,Input:wt}});var jr=/hsb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/,qr=/hsl\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsla\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/,Wr=/^#?([a-fA-F0-9]{3,8})$/,Qr=/^rgba?\(\s*([^)]+)\s*\)$/,Yr=/oklch\(\s*([\d.]+)%?\s+([\d.]+)\s+([\d.]+)(deg)?(?:\s*\/\s*([\d.]+))?\)/i;function C(e,r,o){return Math.min(Math.max(e,r),o)}var I=(e,r)=>[e[0]*r[0]+e[1]*r[1]+e[2]*r[2],e[3]*r[0]+e[4]*r[1]+e[5]*r[2],e[6]*r[0]+e[7]*r[1]+e[8]*r[2]];function Zr(e,r,o,t){let s=C(e,r,o)-r,i=Math.round(s/t),a=r+i*t,p=(t.toString().split(".")[1]||"").length;return parseFloat(a.toFixed(p))}var k=class{getChannelValue(r){if(r in this)return this[r];throw new Error(`Channel ${r} not found`)}withChannelValue(r,o){let{min:t,max:n}=this.getChannelRange(r);if(r in this){let s=this.clone();return s[r]=C(o,t,n),s}throw new Error(`Channel ${r} not found`)}getSpaceAxes(r){let{xChannel:o,yChannel:t}=r;if(o===t)throw new Error("xChannel and yChannel cannot be the same");let n=this.getChannels().find(s=>s!==o&&s!==t);if(!n)throw new Error("zChannel not found");return{xChannel:o,yChannel:t,zChannel:n}}incChannelValue(r,o){let{min:t,max:n,step:s}=this.getChannelRange(r),i=Zr(C(this.getChannelValue(r)+o,t,n),t,n,s);return this.withChannelValue(r,i)}decChannelValue(r,o){return this.incChannelValue(r,-o)}},v=class e extends k{constructor(r,o,t,n){super(),this.hue=r,this.saturation=o,this.brightness=t,this.alpha=n}static parse(r){var a;let o=r.match(jr);if(!o)return;let[t,n,s,i]=((a=o[1])!=null?a:o[2]).split(",").map(p=>Number(p.trim().replace("%","")));return new e(t%360,C(n,0,100),C(s,0,100),C(i!=null?i:1,0,1))}toRGB(){let r=this.hue,o=this.saturation/100,t=this.brightness/100;function n(i){let a=(i+r/60)%6;return t-t*o*Math.max(0,Math.min(a,4-a,1))}let s=255;return new N(Math.round(n(5)*s),Math.round(n(3)*s),Math.round(n(1)*s),Number(this.alpha.toFixed(2)))}toHSL(){let r=this.hue,o=this.saturation/100,t=this.brightness/100,n=t*(1-o/2);return n===0||n===1?o=0:o=(t-n)/Math.min(n,1-n),new R(Number(r.toFixed(2)),Number((o*100).toFixed(2)),Number((n*100).toFixed(2)),Number(this.alpha.toFixed(2)))}toFormat(r){switch(r){case"hsba":return this;case"rgba":return this.toRGB();case"hsla":return this.toHSL();case"oklcha":return this.toRGB().toFormat("oklcha");default:throw new Error(`Invalid format: ${r}`)}}toString(r){switch(r){case"css":return this.toHSL().toString("css");case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsb":return`hsb(${this.hue}, ${this.saturation.toFixed(2)}%, ${this.brightness.toFixed(2)}%)`;case"hsba":return`hsba(${this.hue}, ${this.saturation.toFixed(2)}%, ${this.brightness.toFixed(2)}%, ${this.alpha})`;case"hsl":return this.toHSL().toString("hsl");case"rgb":return this.toRGB().toString("rgb");case"oklch":return this.toRGB().toFormat("oklcha").toString("oklch");default:return this.toFormat(r).toString(r)}}toJSON(){return{hue:this.hue,saturation:this.saturation,brightness:this.brightness,alpha:this.alpha}}clone(){return new e(this.hue,this.saturation,this.brightness,this.alpha)}getChannelRange(r){switch(r){case"hue":return{min:0,max:360,step:1};case"saturation":case"brightness":return{min:0,max:100,step:1};case"alpha":return{min:0,max:1,step:.01};default:throw new Error("Unknown color channel: "+r)}}getFormat(){return"hsba"}getChannels(){return["hue","saturation","brightness"]}},R=class e extends k{constructor(r,o,t,n){super(),this.hue=r,this.saturation=o,this.lightness=t,this.alpha=n}static parse(r){var a,p;let o=r.match(qr);if(!o)return;let[t,n,s,i]=(p=(a=o[1]||o[2])==null?void 0:a.split(",").map(m=>Number(m.trim().replace("%",""))))!=null?p:[];return new e(t%360,C(n,0,100),C(s,0,100),C(i!=null?i:1,0,1))}toRGB(){let r=this.hue,o=this.saturation/100,t=this.lightness/100;function n(i){let a=(i+r/30)%12,p=o*Math.min(t,1-t);return t-p*Math.max(-1,Math.min(a-3,9-a,1))}let s=255;return new N(Math.round(n(0)*s),Math.round(n(8)*s),Math.round(n(4)*s),Number(this.alpha.toFixed(2)))}toHSB(){let r=this.hue,o=this.saturation/100,t=this.lightness/100,n=t+o*Math.min(t,1-t);return n===0?o=0:o=2*(1-t/n),new v(Number(r.toFixed(2)),Number((o*100).toFixed(2)),Number((n*100).toFixed(2)),Number(this.alpha.toFixed(2)))}toFormat(r){switch(r){case"hsla":return this;case"rgba":return this.toRGB();case"hsba":return this.toHSB();case"oklcha":return this.toRGB().toFormat("oklcha");default:throw new Error(`Invalid format: ${r}`)}}toString(r){switch(r){case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsl":return`hsl(${this.hue}, ${this.saturation.toFixed(2)}%, ${this.lightness.toFixed(2)}%)`;case"css":case"hsla":return`hsla(${this.hue}, ${this.saturation.toFixed(2)}%, ${this.lightness.toFixed(2)}%, ${this.alpha})`;case"rgb":return this.toRGB().toString("rgb");case"hsb":return this.toHSB().toString("hsb");case"oklch":return this.toRGB().toFormat("oklcha").toString("oklch");default:return this.toFormat(r).toString(r)}}toJSON(){return{hue:this.hue,saturation:this.saturation,lightness:this.lightness,alpha:this.alpha}}clone(){return new e(this.hue,this.saturation,this.lightness,this.alpha)}getChannelRange(r){switch(r){case"hue":return{min:0,max:360,step:1};case"saturation":case"lightness":return{min:0,max:100,step:1};case"alpha":return{min:0,max:1,step:.01};default:throw new Error("Unknown color channel: "+r)}}getFormat(){return"hsla"}getChannels(){return["hue","saturation","lightness"]}},N=class e extends k{constructor(r,o,t,n){super(),this.red=r,this.green=o,this.blue=t,this.alpha=n}static parse(r){var t;if(!r)return;let o=r.trim();return(t=this.parseHexColor(o))!=null?t:this.parseRgbFunction(o)}static parseHexColor(r){let o=r.match(Wr);if(!o)return;let t=o[1];if(t.length<=4&&(t=t.split("").map(p=>p+p).join("")),![6,8].includes(t.length))return;let n=parseInt(t.slice(0,2),16),s=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16),a=t.length===8?parseInt(t.slice(6,8),16)/255:1;return new e(n,s,i,a)}static parseRgbFunction(r){let o=r.match(Qr);if(!(o!=null&&o[1]))return;let[t,n,s,i]=o[1].split(",").map(w=>w.trim()),a=C(Number(t),0,255),p=C(Number(n),0,255),m=C(Number(s),0,255),h=i!==void 0?C(Number(i),0,1):1;if(![a,p,m,h].some(w=>Number.isNaN(w)))return new e(a,p,m,h)}toHSB(){let[o,t,n]=[this.red/255,this.green/255,this.blue/255],s=Math.max(o,t,n),i=Math.min(o,t,n),a=s-i,p=s,m=s===0?0:a/s,h=0;if(a!==0){switch(s){case o:h=(t-n)/a%6;break;case t:h=(n-o)/a+2;break;case n:h=(o-t)/a+4;break}h*=60,h<0&&(h+=360)}return new v(Number(h.toFixed(2)),Number((m*100).toFixed(2)),Number((p*100).toFixed(2)),Number(this.alpha.toFixed(2)))}toHSL(){let[o,t,n]=[this.red/255,this.green/255,this.blue/255],s=Math.max(o,t,n),i=Math.min(o,t,n),a=(s+i)/2,p=s-i,m=0,h=-1;if(p!==0){switch(s){case o:m=(t-n)/p%6;break;case t:m=(n-o)/p+2;break;case n:m=(o-t)/p+4;break}m*=60,m<0&&(m+=360)}return a===0||a===1?h=0:h=p/(1-Math.abs(2*s-p-1)),new R(Number(m.toFixed(2)),Number((h*100).toFixed(2)),Number((a*100).toFixed(2)),Number(this.alpha.toFixed(2)))}toOKLCH(){let o=[this.red/255,this.green/255,this.blue/255].map(b=>Math.abs(b)<=.04045?b/12.92:(b<0?-1:1)*((Math.abs(b)+.055)/1.055)**2.4),t=I([.41239079926595934,.357584339383878,.1804807884018343,.21263900587151027,.715168678767756,.07219231536073371,.01933081871559182,.11919477979462598,.9505321522496607],o),s=I([.819022437996703,.3619062600528904,-.1288737815209879,.0329836539323885,.9292868615863434,.0361446663506424,.0481771893596242,.2642395317527308,.6335478284694309],t).map(b=>Math.cbrt(b)),[i,a,p]=I([.210454268309314,.7936177747023054,-.0040720430116193,1.9779985324311684,-2.42859224204858,.450593709617411,.0259040424655478,.7827717124575296,-.8086757549230774],s),m=Math.sqrt(a**2+p**2),h=Math.abs(a)<2e-4&&Math.abs(p)<2e-4?NaN:(Math.atan2(p,a)*180/Math.PI%360+360)%360,w=Number(Math.min(1,Math.max(0,i)).toFixed(4)),f=Number(m.toFixed(4)),g=Number.isNaN(h)?NaN:Number(h.toFixed(2));return new X(w,f,g,Number(this.alpha.toFixed(2)))}toHexInt(){return this.red<<16|this.green<<8|this.blue}toFormat(r){switch(r){case"rgba":return this;case"hsla":return this.toHSL();case"hsba":return this.toHSB();case"oklcha":return this.toOKLCH();default:throw new Error(`Invalid format: ${r}`)}}toString(r){switch(r){case"hex":return`#${this.red.toString(16).padStart(2,"0")}${this.green.toString(16).padStart(2,"0")}${this.blue.toString(16).padStart(2,"0")}`;case"hexa":return`#${this.red.toString(16).padStart(2,"0")}${this.green.toString(16).padStart(2,"0")}${this.blue.toString(16).padStart(2,"0")}${Math.round(this.alpha*255).toString(16).padStart(2,"0")}`;case"rgb":return`rgb(${this.red}, ${this.green}, ${this.blue})`;case"rgba":case"css":return`rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;case"hsl":return this.toHSL().toString("hsl");case"hsb":return this.toHSB().toString("hsb");case"oklch":return this.toOKLCH().toString("oklch");default:return this.toFormat(r).toString(r)}}toJSON(){return{red:this.red,green:this.green,blue:this.blue,alpha:this.alpha}}clone(){return new e(this.red,this.green,this.blue,this.alpha)}getChannelRange(r){switch(r){case"red":case"green":case"blue":return{min:0,max:255,step:1};case"alpha":return{min:0,max:1,step:.01};default:throw new Error("Unknown color channel: "+r)}}getFormat(){return"rgba"}getChannels(){return["red","green","blue"]}},X=class e extends k{constructor(r,o,t,n){super(),this.L=r,this.C=o,this.H=t,this.alpha=n}static parse(r){if(!r)return;let o=r.trim().match(Yr);if(!o)return;let t=Number(o[1])/100,n=Number(o[2]),s=Number(o[3]),i=o[5]!==void 0?Number(o[5]):1;return new e(t,n,s,i)}toRGB(){let r=this.L,o=Number.isNaN(this.H)?0:this.C*Math.cos(this.H*Math.PI/180),t=Number.isNaN(this.H)?0:this.C*Math.sin(this.H*Math.PI/180),s=I([1,.3963377774,.2158037573,1,-.1055613458,-.0638541728,1,-.0894841775,-1.291485548],[r,o,t]).map(h=>h**3),i=I([1.2268798758,-.5578149945,.2813910457,-.0405757452,1.1122868033,-.0717110581,-.0763729367,-.4214933324,1.5869240198],s),[a,p,m]=I([3.240969942,-1.537383178,-.49861076,-.969243636,1.875967502,.041555057,.05563008,-.203976959,1.056971514],i);return[a,p,m]=[a,p,m].map(h=>Math.abs(h)>.0031308?(h<0?-1:1)*(1.055*Math.abs(h)**(1/2.4)-.055):12.92*h),new N(Math.round(C(a,0,1)*255),Math.round(C(p,0,1)*255),Math.round(C(m,0,1)*255),Number(this.alpha.toFixed(2)))}toJSON(){return{L:this.L,C:this.C,H:this.H,alpha:this.alpha}}clone(){return new e(this.L,this.C,this.H,this.alpha)}toFormat(r){switch(r){case"oklcha":return this;case"rgba":return this.toRGB();case"hsla":return this.toRGB().toFormat("hsla");case"hsba":return this.toRGB().toFormat("hsba");default:throw new Error(`Invalid format: ${r}`)}}toString(r){switch(r){case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"oklch":{let o=Number.isNaN(this.L)?0:Number((this.L*100).toFixed(2)),t=Number.isNaN(this.C)?0:Number(this.C.toFixed(4)),n=Number.isNaN(this.H)?0:Number(this.H.toFixed(2));return`oklch(${o}% ${t} ${n})`}case"oklcha":case"css":{let o=Number.isNaN(this.L)?0:Number((this.L*100).toFixed(2)),t=Number.isNaN(this.C)?0:Number(this.C.toFixed(4)),n=Number.isNaN(this.H)?0:Number(this.H.toFixed(2)),s=Number.isNaN(this.alpha)?1:Number(this.alpha.toFixed(2));return`oklch(${o}% ${t} ${n} / ${s})`}case"hsl":return this.toRGB().toString("hsl");case"hsb":return this.toRGB().toString("hsb");case"rgb":return this.toRGB().toString("rgb");default:return this.toFormat(r).toString(r)}}getChannelRange(r){switch(r){case"L":return{min:0,max:1,step:.01};case"C":return{min:0,max:.4,step:.01};case"H":return{min:0,max:360,step:1};case"alpha":return{min:0,max:1,step:.01};default:throw new Error("Unknown color channel: "+r)}}getFormat(){return"oklcha"}getChannels(){return["L","C","H"]}},L=e=>{var o,t,n;let r=(n=(t=(o=N.parse(e))!=null?o:R.parse(e))!=null?t:v.parse(e))!=null?n:void 0;if(!r)throw new Error(`Invalid color: ${e}`);return r};function Vt(e,r,o="hsba"){let t=e.getFormat()==="hsla";switch(r){case"hex":return e.getChannelValue("alpha")<e.getChannelRange("alpha").max?e.toString("hexa"):e.toString("hex");case"css":return e.toFormat(o).toString("css");case"red":case"green":case"blue":return e.toFormat("rgba").getChannelValue(r).toString();case"hue":return e.toFormat(t?"hsla":"hsba").getChannelValue("hue").toString();case"saturation":return e.toFormat(t?"hsla":"hsba").getChannelValue("saturation").toString();case"lightness":return e.toFormat("hsla").getChannelValue("lightness").toString();case"brightness":return e.toFormat("hsba").getChannelValue("brightness").toString();case"C":return e.toFormat("oklcha").getChannelValue("C").toString();case"H":return e.toFormat("oklcha").getChannelValue("H").toString();case"L":return e.toFormat("oklcha").getChannelValue("L").toString();default:return e.getChannelValue(r).toString()}}function Lt(e,r="hex"){switch(r){case"hex":return{min:L("#000000").toHexInt(),max:L("#FFFFFF").toHexInt(),step:1};case"css":return;case"red":case"green":case"blue":return e.toFormat("rgba").getChannelRange(r);case"hue":case"lightness":case"saturation":return e.toFormat("hsla").getChannelRange(r);case"brightness":return e.toFormat("hsba").getChannelRange(r);case"L":case"C":case"H":return e.toFormat("oklcha").getChannelRange(r);default:return e.getChannelRange(r)}}var Dt={channel:"hex"};var te=/^[0-9a-fA-F]{3,8}$/;function re(e){return te.test(e)}function ee(e){return e.startsWith("#")?e:re(e)?`#${e}`:e}var Ra=_r({name:"useColorPickerInput",defaultProps:Dt,setup({props:e}){let{channel:r="hex"}=e,o=c(),t=o==null?void 0:o.state.value,n=(o==null?void 0:o.props.format)||"hsba",s=Lt(t,r),i=Vt(t,r,n),a={},p=r==="hex"||r==="css",m=f=>{if(o!=null&&o.props.disabled)return;let g;if(p)try{g=L(r==="hex"?ee(String(f)):String(f))}catch(b){g=t}else{let b=t;r!=="alpha"&&(b=b.toFormat(n));let J=Number.parseFloat(String(f)),At=Number.isNaN(J)?b.getChannelValue(r):J;g=b.withChannelValue(r,At)}o==null||o.syncChannelInputs(g),o==null||o.setValue([g,{color:g.toString(o.props.format||"css"),value:g}])};return{state:a,channelValue:i,channelRange:s,type:p?"text":"number",handleBlur:f=>{let g=p?f.currentTarget.value:f.currentTarget.valueAsNumber;m(g)},handleKeyDown:f=>{if(!f.defaultPrevented&&f.key==="Enter"){let g=p?f.currentTarget.value:f.currentTarget.valueAsNumber;m(g),f.preventDefault()}}}}});export{Dt as defaultProps,re as isValidHex,ee as prefixHex,Ra as useColorPickerInput};
2
+ //# sourceMappingURL=index.mjs.map