rte-utils 1.2.26 → 1.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,9 @@
1
1
  import React from "react";
2
2
  import "./Input.css";
3
- interface InputProps {
3
+ interface InputNumberProps {
4
4
  label: string;
5
5
  value?: string;
6
6
  onChange?: (value: string) => void;
7
- type?: "text" | "number";
8
7
  disabled?: boolean;
9
8
  className?: string;
10
9
  required?: boolean;
@@ -17,5 +16,5 @@ interface InputProps {
17
16
  label?: string;
18
17
  };
19
18
  }
20
- export declare const Input: React.FC<InputProps>;
19
+ export declare const InputNumber: React.FC<InputNumberProps>;
21
20
  export {};
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import "./InputNumber.css";
3
+ interface InputNumberProps {
4
+ label: string;
5
+ value?: string;
6
+ onChange?: (value: string) => void;
7
+ disabled?: boolean;
8
+ className?: string;
9
+ required?: boolean;
10
+ min?: {
11
+ value: number;
12
+ label?: string;
13
+ };
14
+ max?: {
15
+ value: number;
16
+ label?: string;
17
+ };
18
+ }
19
+ export declare const InputNumber: React.FC<InputNumberProps>;
20
+ export {};
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react";
2
- import { Input } from "./Input";
3
- declare const meta: Meta<typeof Input>;
2
+ import { InputNumber } from "./InputNumber";
3
+ declare const meta: Meta<typeof InputNumber>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
@@ -14,3 +14,7 @@ export declare const LargeNumbers: Story;
14
14
  export declare const ValidationDemo: Story;
15
15
  export declare const FocusHighlight: Story;
16
16
  export declare const ErrorStyling: Story;
17
+ export declare const ExtremeClamping: Story;
18
+ export declare const DecimalClamping: Story;
19
+ export declare const ZeroRangeClamping: Story;
20
+ export declare const NegativeRangeClamping: Story;
@@ -3,6 +3,6 @@ export { ProductionUnitContainer } from "./ProductionUnitContainer";
3
3
  export { Histogram } from "./Histogram";
4
4
  export { Chip } from "./Chip";
5
5
  export { Switch } from "./Switch";
6
- export { Input } from "./Input";
6
+ export { InputNumber } from "./InputNumber";
7
7
  export { Avatar } from "./Avatar";
8
8
  export { MwhCost } from "./MwhCost";
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsx as t,jsxs as i}from"react/jsx-runtime";import{useState as n,useRef as e,useEffect as a}from"react";var o=function(o){var c=o.label,l=o.value,r=void 0===l?"":l,d=o.onChange,h=o.type,s=void 0===h?"text":h,v=o.disabled,u=void 0!==v&&v,m=o.className,f=void 0===m?"":m,p=o.required,b=void 0!==p&&p,g=o.min,N=void 0===g?{value:0,label:"Pmin"}:g,w=o.max,C=void 0===w?{value:100,label:"Pmax"}:w,x=n(r),L=x[0],R=x[1],y=n(!1),k=y[0],z=y[1],M=n(!1),F=M[0],B=M[1],P=e(null);a(function(){R(r)},[r]);var j=["input-container",k?"input-container--focused":"",k||L.length>0?"input-container--floating":"",u?"input-container--disabled":"",F?"input-container--error":"",f].filter(Boolean).join(" ");return t("div",{className:j,children:i("div",{className:"input-constraints",children:[i("div",{className:"input-min",children:[N.label,t("br",{}),N.value]}),i("div",{className:"input-field",children:[t("input",{ref:P,type:s,value:L,onChange:function(t){var i=t.target.value;if("number"===s&&""!==i){var n=parseFloat(i);if(isNaN(n))B(!1);else{var e=n<N.value||n>C.value;B(e)}}else B(!1);R(i),null==d||d(i)},onFocus:function(){z(!0)},onBlur:function(){if(z(!1),"number"===s&&""!==L){var t=parseFloat(L);if(!isNaN(t)){var i=Math.max(N.value,Math.min(C.value,t));if(i!==t){var n=i.toString();R(n),null==d||d(n)}B(!1)}}},disabled:u,required:b,className:"input-element","aria-label":c,min:"number"===s?N.value:void 0,max:"number"===s?C.value:void 0,step:"number"===s?1:void 0}),i("label",{className:"input-label",children:[c,b&&t("span",{className:"input-required",children:"*"})]})]}),i("div",{className:"input-max",children:[C.label,t("br",{})," ",C.value]})]})})},c=function(i){var n=i.isOff;return t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M9.56529 2.85352C9.66365 2.57607 9.96837 2.43116 10.246 2.5293C13.4295 3.65507 15.3392 6.91015 14.7684 10.2383C14.1974 13.5667 11.3114 16 7.93443 16C4.55739 16 1.67151 13.5667 1.10045 10.2383C0.5296 6.91011 2.4393 3.65504 5.62291 2.5293C5.9005 2.43115 6.20523 2.57605 6.30357 2.85352C6.40176 3.13124 6.2561 3.43599 5.97838 3.53418C3.28438 4.48672 1.669 7.2423 2.1522 10.0586C2.63557 12.8747 5.07706 14.9336 7.93443 14.9336C10.7918 14.9336 13.2333 12.8747 13.7167 10.0586C14.1999 7.24233 12.5844 4.48676 9.89049 3.53418C9.61276 3.43599 9.4671 3.13124 9.56529 2.85352ZM7.93443 0C8.22892 3.10447e-05 8.46754 0.238727 8.46763 0.533203V7.4668C8.46763 7.76135 8.22898 8.00095 7.93443 8.00098C7.63986 8.00098 7.40123 7.76137 7.40123 7.4668V0.533203C7.40132 0.238707 7.63991 0 7.93443 0Z",fill:n?"#999FA1":"#009CDF"})})},l=function(i){var n=i.isOff;return t("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("circle",{cx:"16",cy:"16",r:"16",fill:n?"white":"#009cdf"})})},r=function(e){var a=e.checked,o=void 0!==a&&a,r=e.onChange,d=e.disabled,h=void 0!==d&&d,s=e.showIcon,v=void 0===s||s,u=e.label,m=n(o),f=m[0],p=m[1],b=void 0!==o?o:f,g=["switch",b?"switch--checked":"",h?"switch--disabled":""].filter(Boolean).join(" "),N=["switch-wrapper",b?"switch-wrapper--checked":""].filter(Boolean).join(" ");return t("div",{className:"switch-container",children:i("div",{className:N,children:[v?t("div",{className:"switch-icon",children:t(c,{isOff:!b})}):u?t("div",{className:"switch-label",children:u}):null,t("button",{type:"button",role:"switch","aria-checked":b,className:g,onClick:function(){if(!h){var t=!b;void 0===o&&p(t),null==r||r(t)}},disabled:h,children:t("span",{className:"switch-track",children:t("span",{className:"switch-thumb",children:t(l,{isOff:!b})})})})]})})},d=function(i){var n=i.children,e=i.bgColor,a=i.width,o=["chip-container","full-width"===(void 0===a?"fit-content":a)?"chip-container--full-width":"chip-container--fit-content"].join(" ");return t("div",{className:o,style:{backgroundColor:e},children:t("div",{className:"chip-content",children:t("div",{className:"chip-label",children:n})})})},h=function(i){var n=i.bgColor,e=void 0===n?"#fff":n,a=i.children,o=i.height;return t("div",{className:"production-unit-container-box",style:{backgroundColor:e,height:o},children:a})},s=function(e){var a=e.onChangeInput,c=e.onChangeSwitch,l=e.defaultValue,s=e.defaultChecked,v=void 0!==s&&s,u=e.value,f=e.checked,p=e.unitName,b=void 0===p?"Production Unit":p,g=e.energyCost,N=void 0===g?0:g,w=e.checkedImage,C=e.uncheckedImage,x=e.readonly,L=void 0!==x&&x,R=e.min,y=void 0===R?{value:10,label:"Pmin"}:R,k=e.max,z=void 0===k?{value:100,label:"Pmax"}:k,M=n(v),F=M[0],B=M[1],P=n(l),j=P[0],q=P[1],O=void 0!==f?f:F,A=void 0!==u?u:j;return t(h,{children:i("div",{className:"production-unit-container",children:[i("div",{className:"production-unit-content",children:[t("div",{className:"image-preview-container",children:O?w:C}),i("div",{className:"production-unit-chip",children:[t("div",{className:"production-unit-chip-name",children:b}),t(d,{width:"fit-content",bgColor:"#E1F5FD",children:t(m,{cost:N,textColor:"#005896"})})]}),i("div",{className:"production-unit-switch-container",children:[t(o,{label:"PA",type:"number",onChange:function(t){var i=Number(t);void 0===u&&q(i),a&&a(i)},value:void 0!==A?A.toString():void 0,disabled:!O||L,min:{value:y.value,label:y.label},max:{value:z.value,label:z.label}})," "]})]}),t(r,{checked:O,onChange:function(t){void 0===f&&B(t),c&&c(t)},disabled:L})]})})},v=function(e){var o,c,l,r,d=e.max,h=e.relative,s=e.barHeight,v=void 0===s?103:s,u=e.barWidth,m=void 0===u?32:u,f=e.orientation,p=void 0===f?"vertical":f,b=e.cornerRadius,g=e.children,N=n(0),w=N[0],C=N[1],x=n(0),L=x[0],R=x[1],y=Math.min(h.value/d.value*100,100)/100*v,k=Math.min(h.value/d.value*100,100)/100*m;a(function(){C(0),R(0);var t=Date.now(),i=function(){var n=Date.now()-t,e=Math.min(n/1e3,1),a=1-Math.pow(1-e,4);C(y*a),R(k*a),e<1&&requestAnimationFrame(i)};requestAnimationFrame(i)},[y,k]);var z="horizontal"===p?v:m,M="horizontal"===p?m:v,F="horizontal"===p?v:m,B="horizontal"===p?m:v,P=function(t,i,n,e,a){var o=a.topLeft,c=a.topRight,l=a.bottomLeft,r=a.bottomRight;return"\n M ".concat(t+o," ").concat(i,"\n L ").concat(t+n-c," ").concat(i,"\n Q ").concat(t+n," ").concat(i," ").concat(t+n," ").concat(i+c,"\n L ").concat(t+n," ").concat(i+e-r,"\n Q ").concat(t+n," ").concat(i+e," ").concat(t+n-r," ").concat(i+e,"\n L ").concat(t+l," ").concat(i+e,"\n Q ").concat(t," ").concat(i+e," ").concat(t," ").concat(i+e-l,"\n L ").concat(t," ").concat(i+o,"\n Q ").concat(t," ").concat(i," ").concat(t+o," ").concat(i,"\n Z\n ").trim().replace(/\s+/g," ")},j={topLeft:2,topRight:2,bottomLeft:2,bottomRight:2},q=b?{topLeft:null!==(o=b.topLeft)&&void 0!==o?o:j.topLeft,topRight:null!==(c=b.topRight)&&void 0!==c?c:j.topRight,bottomLeft:null!==(l=b.bottomLeft)&&void 0!==l?l:j.bottomLeft,bottomRight:null!==(r=b.bottomRight)&&void 0!==r?r:j.bottomRight}:j;return t("div",{className:"histogram-container ".concat("horizontal"===p?"histogram-container--horizontal":""),children:i("div",{className:"histogram-content ".concat("horizontal"===p?"histogram-content--horizontal":""),children:[t("div",{className:"histogram-bar",style:{height:"".concat(M,"px"),width:"".concat(z,"px")},children:i("svg",{width:F,height:B,viewBox:"0 0 ".concat(F," ").concat(B),className:"histogram-svg",children:[t("path",{d:P(0,0,F,B,q),fill:d.color,fillOpacity:d.opacity||1}),t("path","vertical"===p?{d:P(0,B-w,F,w,{topLeft:w>=B?q.topLeft:0,topRight:w>=B?q.topRight:0,bottomLeft:q.bottomLeft,bottomRight:q.bottomRight}),fill:h.color}:{d:P(0,0,L,B,{topLeft:q.topLeft,topRight:L>=F?q.topRight:0,bottomLeft:q.bottomLeft,bottomRight:L>=F?q.bottomRight:0}),fill:h.color})]})}),g&&t("div",{className:"histogram-text-container ".concat("horizontal"===p?"histogram-text-container--horizontal":""),children:g})]})})},u=function(i){var n=i.children;return t("div",{className:"avatar-container avatar-container--clickable",children:t("div",{className:"avatar-content",children:n})})},m=function(n){var e=n.cost,a=n.textColor;return i("div",{className:"cost-text-container",children:[t("div",{className:"cost-number",style:{color:a},children:e}),t("div",{className:"cost-unit",style:{color:a},children:"€"}),t("div",{className:"cost-unit-per",style:{color:a},children:"/Mwh"})]})};export{u as Avatar,d as Chip,v as Histogram,o as Input,m as MwhCost,s as ProductionUnit,h as ProductionUnitContainer,r as Switch};
1
+ import{jsx as t,jsxs as i}from"react/jsx-runtime";import{useState as n,useRef as e,useEffect as a}from"react";var o=function(o){var c=o.label,l=o.value,r=void 0===l?"":l,d=o.onChange,h=o.disabled,s=void 0!==h&&h,v=o.className,u=void 0===v?"":v,m=o.required,f=void 0!==m&&m,p=o.min,g=void 0===p?{value:0,label:"Pmin"}:p,b=o.max,N=void 0===b?{value:100,label:"Pmax"}:b,w=n(r),C=w[0],x=w[1],L=n(!1),R=L[0],k=L[1],y=n(!1),z=y[0],F=y[1],M=e(null);a(function(){x(r)},[r]);var B=["input-container",R?"input-container--focused":"",R||C.length>0?"input-container--floating":"",s?"input-container--disabled":"",z?"input-container--error":"",u].filter(Boolean).join(" ");return t("div",{className:B,children:i("div",{className:"input-constraints",children:[i("div",{className:"input-min",children:[g.label,t("br",{}),g.value]}),i("div",{className:"input-field",children:[t("input",{ref:M,type:"number",value:C,onChange:function(t){var i=t.target.value;if(""!==i){var n=parseFloat(i);if(isNaN(n))F(!1);else{var e=n<g.value||n>N.value;F(e)}}else F(!1);x(i),null==d||d(i)},onFocus:function(){k(!0)},onBlur:function(){if(k(!1),""!==C){var t=parseFloat(C);if(!isNaN(t)){var i=Math.max(g.value,Math.min(N.value,t));if(i!==t){var n=i.toString();x(n),null==d||d(n)}F(!1)}}},disabled:s,required:f,className:"input-element","aria-label":c,min:g.value,max:N.value,step:1}),i("label",{className:"input-label",children:[c,f&&t("span",{className:"input-required",children:"*"})]})]}),i("div",{className:"input-max",children:[N.label,t("br",{})," ",N.value]})]})})},c=function(i){var n=i.isOff;return t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M9.56529 2.85352C9.66365 2.57607 9.96837 2.43116 10.246 2.5293C13.4295 3.65507 15.3392 6.91015 14.7684 10.2383C14.1974 13.5667 11.3114 16 7.93443 16C4.55739 16 1.67151 13.5667 1.10045 10.2383C0.5296 6.91011 2.4393 3.65504 5.62291 2.5293C5.9005 2.43115 6.20523 2.57605 6.30357 2.85352C6.40176 3.13124 6.2561 3.43599 5.97838 3.53418C3.28438 4.48672 1.669 7.2423 2.1522 10.0586C2.63557 12.8747 5.07706 14.9336 7.93443 14.9336C10.7918 14.9336 13.2333 12.8747 13.7167 10.0586C14.1999 7.24233 12.5844 4.48676 9.89049 3.53418C9.61276 3.43599 9.4671 3.13124 9.56529 2.85352ZM7.93443 0C8.22892 3.10447e-05 8.46754 0.238727 8.46763 0.533203V7.4668C8.46763 7.76135 8.22898 8.00095 7.93443 8.00098C7.63986 8.00098 7.40123 7.76137 7.40123 7.4668V0.533203C7.40132 0.238707 7.63991 0 7.93443 0Z",fill:n?"#999FA1":"#009CDF"})})},l=function(i){var n=i.isOff;return t("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("circle",{cx:"16",cy:"16",r:"16",fill:n?"white":"#009cdf"})})},r=function(e){var a=e.checked,o=void 0!==a&&a,r=e.onChange,d=e.disabled,h=void 0!==d&&d,s=e.showIcon,v=void 0===s||s,u=e.label,m=n(o),f=m[0],p=m[1],g=void 0!==o?o:f,b=["switch",g?"switch--checked":"",h?"switch--disabled":""].filter(Boolean).join(" "),N=["switch-wrapper",g?"switch-wrapper--checked":""].filter(Boolean).join(" ");return t("div",{className:"switch-container",children:i("div",{className:N,children:[v?t("div",{className:"switch-icon",children:t(c,{isOff:!g})}):u?t("div",{className:"switch-label",children:u}):null,t("button",{type:"button",role:"switch","aria-checked":g,className:b,onClick:function(){if(!h){var t=!g;void 0===o&&p(t),null==r||r(t)}},disabled:h,children:t("span",{className:"switch-track",children:t("span",{className:"switch-thumb",children:t(l,{isOff:!g})})})})]})})},d=function(i){var n=i.children,e=i.bgColor,a=i.width,o=["chip-container","full-width"===(void 0===a?"fit-content":a)?"chip-container--full-width":"chip-container--fit-content"].join(" ");return t("div",{className:o,style:{backgroundColor:e},children:t("div",{className:"chip-content",children:t("div",{className:"chip-label",children:n})})})},h=function(i){var n=i.bgColor,e=void 0===n?"#fff":n,a=i.children,o=i.height;return t("div",{className:"production-unit-container-box",style:{backgroundColor:e,height:o},children:a})},s=function(e){var a=e.onChangeInput,c=e.onChangeSwitch,l=e.defaultValue,s=e.defaultChecked,v=void 0!==s&&s,u=e.value,f=e.checked,p=e.unitName,g=void 0===p?"Production Unit":p,b=e.energyCost,N=void 0===b?0:b,w=e.checkedImage,C=e.uncheckedImage,x=e.readonly,L=void 0!==x&&x,R=e.min,k=void 0===R?{value:10,label:"Pmin"}:R,y=e.max,z=void 0===y?{value:100,label:"Pmax"}:y,F=n(v),M=F[0],B=F[1],P=n(l),j=P[0],q=P[1],O=void 0!==f?f:M,A=void 0!==u?u:j;return t(h,{children:i("div",{className:"production-unit-container",children:[i("div",{className:"production-unit-content",children:[t("div",{className:"image-preview-container",children:O?w:C}),i("div",{className:"production-unit-chip",children:[t("div",{className:"production-unit-chip-name",children:g}),t(d,{width:"fit-content",bgColor:"#E1F5FD",children:t(m,{cost:N,textColor:"#005896"})})]}),i("div",{className:"production-unit-switch-container",children:[t(o,{label:"PA",onChange:function(t){if(""===t)return void 0===u&&q(void 0),void(a&&a(0));var i=parseFloat(t);isNaN(i)||(void 0===u&&q(i),a&&a(i))},value:void 0!==A?A.toString():void 0,disabled:!O||L,min:{value:k.value,label:k.label},max:{value:z.value,label:z.label}})," "]})]}),t(r,{checked:O,onChange:function(t){void 0===f&&B(t),c&&c(t)},disabled:L})]})})},v=function(e){var o,c,l,r,d=e.max,h=e.relative,s=e.barHeight,v=void 0===s?103:s,u=e.barWidth,m=void 0===u?32:u,f=e.orientation,p=void 0===f?"vertical":f,g=e.cornerRadius,b=e.children,N=n(0),w=N[0],C=N[1],x=n(0),L=x[0],R=x[1],k=Math.min(h.value/d.value*100,100)/100*v,y=Math.min(h.value/d.value*100,100)/100*m;a(function(){C(0),R(0);var t=Date.now(),i=function(){var n=Date.now()-t,e=Math.min(n/1e3,1),a=1-Math.pow(1-e,4);C(k*a),R(y*a),e<1&&requestAnimationFrame(i)};requestAnimationFrame(i)},[k,y]);var z="horizontal"===p?v:m,F="horizontal"===p?m:v,M="horizontal"===p?v:m,B="horizontal"===p?m:v,P=function(t,i,n,e,a){var o=a.topLeft,c=a.topRight,l=a.bottomLeft,r=a.bottomRight;return"\n M ".concat(t+o," ").concat(i,"\n L ").concat(t+n-c," ").concat(i,"\n Q ").concat(t+n," ").concat(i," ").concat(t+n," ").concat(i+c,"\n L ").concat(t+n," ").concat(i+e-r,"\n Q ").concat(t+n," ").concat(i+e," ").concat(t+n-r," ").concat(i+e,"\n L ").concat(t+l," ").concat(i+e,"\n Q ").concat(t," ").concat(i+e," ").concat(t," ").concat(i+e-l,"\n L ").concat(t," ").concat(i+o,"\n Q ").concat(t," ").concat(i," ").concat(t+o," ").concat(i,"\n Z\n ").trim().replace(/\s+/g," ")},j={topLeft:2,topRight:2,bottomLeft:2,bottomRight:2},q=g?{topLeft:null!==(o=g.topLeft)&&void 0!==o?o:j.topLeft,topRight:null!==(c=g.topRight)&&void 0!==c?c:j.topRight,bottomLeft:null!==(l=g.bottomLeft)&&void 0!==l?l:j.bottomLeft,bottomRight:null!==(r=g.bottomRight)&&void 0!==r?r:j.bottomRight}:j;return t("div",{className:"histogram-container ".concat("horizontal"===p?"histogram-container--horizontal":""),children:i("div",{className:"histogram-content ".concat("horizontal"===p?"histogram-content--horizontal":""),children:[t("div",{className:"histogram-bar",style:{height:"".concat(F,"px"),width:"".concat(z,"px")},children:i("svg",{width:M,height:B,viewBox:"0 0 ".concat(M," ").concat(B),className:"histogram-svg",children:[t("path",{d:P(0,0,M,B,q),fill:d.color,fillOpacity:d.opacity||1}),t("path","vertical"===p?{d:P(0,B-w,M,w,{topLeft:w>=B?q.topLeft:0,topRight:w>=B?q.topRight:0,bottomLeft:q.bottomLeft,bottomRight:q.bottomRight}),fill:h.color}:{d:P(0,0,L,B,{topLeft:q.topLeft,topRight:L>=M?q.topRight:0,bottomLeft:q.bottomLeft,bottomRight:L>=M?q.bottomRight:0}),fill:h.color})]})}),b&&t("div",{className:"histogram-text-container ".concat("horizontal"===p?"histogram-text-container--horizontal":""),children:b})]})})},u=function(i){var n=i.children;return t("div",{className:"avatar-container avatar-container--clickable",children:t("div",{className:"avatar-content",children:n})})},m=function(n){var e=n.cost,a=n.textColor;return i("div",{className:"cost-text-container",children:[t("div",{className:"cost-number",style:{color:a},children:e}),t("div",{className:"cost-unit",style:{color:a},children:"€"}),t("div",{className:"cost-unit-per",style:{color:a},children:"/Mwh"})]})};export{u as Avatar,d as Chip,v as Histogram,o as InputNumber,m as MwhCost,s as ProductionUnit,h as ProductionUnitContainer,r as Switch};
2
2
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/components/Input.tsx","../src/components/Switch.tsx","../src/components/Chip.tsx","../src/components/ProductionUnitContainer.tsx","../src/components/ProductionUnit.tsx","../src/components/Histogram.tsx","../src/components/Avatar.tsx","../src/components/MwhCost.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect } from \"react\";\nimport \"./Input.css\";\n\ninterface InputProps {\n label: string;\n value?: string;\n onChange?: (value: string) => void;\n type?: \"text\" | \"number\";\n disabled?: boolean;\n className?: string;\n required?: boolean;\n min?: { value: number; label?: string };\n max?: { value: number; label?: string };\n}\n\nexport const Input: React.FC<InputProps> = ({\n label,\n value = \"\",\n onChange,\n type = \"text\",\n disabled = false,\n className = \"\",\n required = false,\n min = { value: 0, label: \"Pmin\" },\n max = { value: 100, label: \"Pmax\" },\n}) => {\n const [internalValue, setInternalValue] = useState(value);\n const [isFocused, setIsFocused] = useState(false);\n const [isOutOfRange, setIsOutOfRange] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n setInternalValue(value);\n }, [value]);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value;\n \n // Check if value is out of range for visual feedback (but don't clamp yet)\n if (type === \"number\" && newValue !== \"\") {\n const numValue = parseFloat(newValue);\n if (!isNaN(numValue)) {\n const outOfRange = numValue < min.value || numValue > max.value;\n setIsOutOfRange(outOfRange);\n } else {\n setIsOutOfRange(false);\n }\n } else {\n setIsOutOfRange(false);\n }\n \n // Allow typing without immediate validation\n // Validation will happen on blur\n setInternalValue(newValue);\n onChange?.(newValue);\n };\n\n const handleFocus = () => {\n setIsFocused(true);\n };\n\n const handleBlur = () => {\n setIsFocused(false);\n\n // Validate and clamp value on blur for number inputs\n if (type === \"number\" && internalValue !== \"\") {\n const numValue = parseFloat(internalValue);\n if (!isNaN(numValue)) {\n const clampedValue = Math.max(min.value, Math.min(max.value, numValue));\n if (clampedValue !== numValue) {\n const clampedString = clampedValue.toString();\n setInternalValue(clampedString);\n onChange?.(clampedString);\n }\n setIsOutOfRange(false); // Reset out-of-range state after clamping\n }\n }\n };\n\n const isLabelFloating = isFocused || internalValue.length > 0;\n\n const containerClasses = [\n \"input-container\",\n isFocused ? \"input-container--focused\" : \"\",\n isLabelFloating ? \"input-container--floating\" : \"\",\n disabled ? \"input-container--disabled\" : \"\",\n isOutOfRange ? \"input-container--error\" : \"\",\n className,\n ]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <div className={containerClasses}>\n <div className=\"input-constraints\">\n <div className=\"input-min\">\n {min.label}\n <br />\n {min.value}\n </div>\n\n <div className=\"input-field\">\n <input\n ref={inputRef}\n type={type}\n value={internalValue}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n disabled={disabled}\n required={required}\n className=\"input-element\"\n aria-label={label}\n min={type === \"number\" ? min.value : undefined}\n max={type === \"number\" ? max.value : undefined}\n step={type === \"number\" ? 1 : undefined}\n />\n <label className=\"input-label\">\n {label}\n {required && <span className=\"input-required\">*</span>}\n </label>\n </div>\n <div className=\"input-max\">\n {max.label}\n <br /> {max.value}\n </div>\n </div>\n </div>\n );\n};\n","import React, { useState } from \"react\";\nimport \"./Switch.css\";\n\ninterface OnProps {\n isOff?: boolean;\n}\nconst ImgOn = ({ isOff }: OnProps) => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M9.56529 2.85352C9.66365 2.57607 9.96837 2.43116 10.246 2.5293C13.4295 3.65507 15.3392 6.91015 14.7684 10.2383C14.1974 13.5667 11.3114 16 7.93443 16C4.55739 16 1.67151 13.5667 1.10045 10.2383C0.5296 6.91011 2.4393 3.65504 5.62291 2.5293C5.9005 2.43115 6.20523 2.57605 6.30357 2.85352C6.40176 3.13124 6.2561 3.43599 5.97838 3.53418C3.28438 4.48672 1.669 7.2423 2.1522 10.0586C2.63557 12.8747 5.07706 14.9336 7.93443 14.9336C10.7918 14.9336 13.2333 12.8747 13.7167 10.0586C14.1999 7.24233 12.5844 4.48676 9.89049 3.53418C9.61276 3.43599 9.4671 3.13124 9.56529 2.85352ZM7.93443 0C8.22892 3.10447e-05 8.46754 0.238727 8.46763 0.533203V7.4668C8.46763 7.76135 8.22898 8.00095 7.93443 8.00098C7.63986 8.00098 7.40123 7.76137 7.40123 7.4668V0.533203C7.40132 0.238707 7.63991 0 7.93443 0Z\"\n fill={isOff ? \"#999FA1\" : \"#009CDF\"}\n />\n </svg>\n);\nconst SwitchThumb = ({ isOff }: OnProps) => (\n <svg\n width=\"32\"\n height=\"32\"\n viewBox=\"0 0 32 32\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"16\" cy=\"16\" r=\"16\" fill={isOff ? \"white\" : \"#009cdf\"} />\n </svg>\n);\n\ninterface SwitchProps {\n checked?: boolean;\n onChange?: (checked: boolean) => void;\n disabled?: boolean;\n showIcon?: boolean;\n label?: string;\n}\n\nexport const Switch: React.FC<SwitchProps> = ({\n checked = false,\n onChange,\n disabled = false,\n showIcon = true,\n label,\n}) => {\n const [internalChecked, setInternalChecked] = useState(checked);\n\n // Use controlled value if provided, otherwise use internal state\n const isChecked = checked !== undefined ? checked : internalChecked;\n\n const handleToggle = () => {\n if (disabled) return;\n\n const newChecked = !isChecked;\n // Only update internal state if uncontrolled\n if (checked === undefined) {\n setInternalChecked(newChecked);\n }\n onChange?.(newChecked);\n };\n\n const switchClasses = [\n \"switch\",\n isChecked ? \"switch--checked\" : \"\",\n disabled ? \"switch--disabled\" : \"\",\n ]\n .filter(Boolean)\n .join(\" \");\n\n const wrapperClasses = [\n \"switch-wrapper\",\n isChecked ? \"switch-wrapper--checked\" : \"\",\n ]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <div className=\"switch-container\">\n <div className={wrapperClasses}>\n {showIcon ? (\n <div className=\"switch-icon\">\n <ImgOn isOff={!isChecked} />\n </div>\n ) : label ? (\n <div className=\"switch-label\">{label}</div>\n ) : null}\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={isChecked}\n className={switchClasses}\n onClick={handleToggle}\n disabled={disabled}\n >\n <span className=\"switch-track\">\n <span className=\"switch-thumb\">\n <SwitchThumb isOff={!isChecked} />\n </span>\n </span>\n </button>\n </div>\n </div>\n );\n};\n","import React from \"react\";\nimport \"./Chip.css\";\n\ninterface ChipProps {\n // Define any props you want to pass to the Chip component\n children: React.ReactNode;\n bgColor?: string;\n width?: \"fit-content\" | \"full-width\";\n}\n\nexport const Chip: React.FC<ChipProps> = ({\n children,\n bgColor,\n width = \"fit-content\",\n}) => {\n const chipClasses = [\n \"chip-container\",\n width === \"full-width\"\n ? \"chip-container--full-width\"\n : \"chip-container--fit-content\",\n ].join(\" \");\n\n return (\n <div className={chipClasses} style={{ backgroundColor: bgColor }}>\n <div className=\"chip-content\">\n <div className=\"chip-label\">{children}</div>\n </div>\n </div>\n );\n};\n","import \"./ProductionUnitContainer.css\";\n\ninterface ProductionUnitContainerProps {\n bgColor?: string;\n children: React.ReactNode;\n height?: string;\n}\nexport const ProductionUnitContainer = ({\n bgColor = \"#fff\",\n children,\n height,\n}: ProductionUnitContainerProps) => {\n return (\n <div\n className=\"production-unit-container-box\"\n style={{ backgroundColor: bgColor, height }}\n >\n {children}\n </div>\n );\n};\n","import { useState } from \"react\";\nimport { Input } from \"./Input\";\nimport { Switch } from \"./Switch\";\nimport \"./ProductionUnit.css\";\nimport { Chip } from \"./Chip\";\nimport { ProductionUnitContainer } from \"./ProductionUnitContainer\";\nimport { MwhCost } from \".\";\n\ntype ProductionUnitLimit = {\n value: number;\n label?: string;\n};\ninterface ProductionUnitProps {\n onChangeInput?: (value: number) => void;\n onChangeSwitch?: (checked: boolean) => void;\n defaultValue?: number;\n defaultChecked?: boolean;\n value?: number;\n checked?: boolean;\n unitName?: string;\n energyCost?: number;\n checkedImage?: React.ReactNode;\n uncheckedImage?: React.ReactNode;\n readonly?: boolean;\n min?: ProductionUnitLimit;\n max?: ProductionUnitLimit;\n}\nexport const ProductionUnit = ({\n onChangeInput,\n onChangeSwitch,\n defaultValue,\n defaultChecked = false,\n value,\n checked,\n unitName = \"Production Unit\",\n energyCost = 0,\n checkedImage,\n uncheckedImage,\n readonly = false,\n min = { value: 10, label: \"Pmin\" },\n max = { value: 100, label: \"Pmax\" },\n}: ProductionUnitProps) => {\n // Internal state management for uncontrolled mode\n const [internalChecked, setInternalChecked] = useState(defaultChecked);\n const [internalValue, setInternalValue] = useState(defaultValue);\n\n // Use controlled props if provided, otherwise use internal state\n const isChecked = checked !== undefined ? checked : internalChecked;\n const currentValue = value !== undefined ? value : internalValue;\n\n const handleSwitchChange = (newChecked: boolean) => {\n // Update internal state only if uncontrolled\n if (checked === undefined) {\n setInternalChecked(newChecked);\n }\n\n // Notify parent component if handler provided\n if (onChangeSwitch) {\n onChangeSwitch(newChecked);\n }\n };\n\n const handleInputChange = (val: string) => {\n const numValue = Number(val);\n // Update internal state only if uncontrolled\n if (value === undefined) {\n setInternalValue(numValue);\n }\n\n // Notify parent component if handler provided\n if (onChangeInput) {\n onChangeInput(numValue);\n }\n };\n\n return (\n <ProductionUnitContainer>\n <div className=\"production-unit-container\">\n <div className=\"production-unit-content\">\n <div className=\"image-preview-container\">\n {isChecked ? checkedImage : uncheckedImage}\n </div>\n <div className=\"production-unit-chip\">\n <div className=\"production-unit-chip-name\">{unitName}</div>\n\n <Chip width=\"fit-content\" bgColor=\"#E1F5FD\">\n <MwhCost cost={energyCost} textColor=\"#005896\" />\n </Chip>\n </div>\n <div className=\"production-unit-switch-container\">\n <Input\n label=\"PA\"\n type=\"number\"\n onChange={handleInputChange}\n value={\n currentValue !== undefined ? currentValue.toString() : undefined\n }\n disabled={!isChecked || readonly}\n min={{ value: min.value, label: min.label }}\n max={{ value: max.value, label: max.label }}\n />{\" \"}\n </div>\n </div>\n\n <Switch\n checked={isChecked}\n onChange={handleSwitchChange}\n disabled={readonly}\n />\n </div>\n </ProductionUnitContainer>\n );\n};\n","import React, { useEffect, useState } from \"react\";\nimport \"./Histogram.css\";\n\ninterface HistogramProps {\n /** Maximum value configuration with value and color */\n max: {\n value: number;\n color: string;\n opacity?: number;\n };\n /** Relative/current value configuration with value and color */\n relative: {\n value: number;\n color: string;\n };\n /** Height of the histogram bar in pixels */\n barHeight?: number;\n /** Width of the histogram bar in pixels */\n barWidth?: number;\n /** Orientation of the histogram - 'vertical' or 'horizontal' */\n orientation?: 'vertical' | 'horizontal';\n /** Corner radius configuration for individual corners */\n cornerRadius?: {\n topLeft?: number;\n topRight?: number;\n bottomLeft?: number;\n bottomRight?: number;\n };\n /** Child components (typically text content) */\n children?: React.ReactNode;\n}\n\nexport const Histogram: React.FC<HistogramProps> = ({\n max,\n relative,\n barHeight = 103,\n barWidth = 32,\n orientation = 'vertical',\n cornerRadius,\n children,\n}) => {\n const [animatedHeight, setAnimatedHeight] = useState(0);\n const [animatedWidth, setAnimatedWidth] = useState(0);\n\n // Calculate target dimensions based on orientation\n const targetHeight = (Math.min((relative.value / max.value) * 100, 100) / 100) * barHeight;\n const targetWidth = (Math.min((relative.value / max.value) * 100, 100) / 100) * barWidth;\n\n // Simple Chart.js-like animation: always animate from 0 to target\n useEffect(() => {\n setAnimatedHeight(0);\n setAnimatedWidth(0);\n \n const startTime = Date.now();\n const duration = 1000;\n\n const animate = () => {\n const elapsed = Date.now() - startTime;\n const progress = Math.min(elapsed / duration, 1);\n\n // Chart.js-like easing (easeOutQuart)\n const easeOutQuart = 1 - Math.pow(1 - progress, 4);\n \n setAnimatedHeight(targetHeight * easeOutQuart);\n setAnimatedWidth(targetWidth * easeOutQuart);\n\n if (progress < 1) {\n requestAnimationFrame(animate);\n }\n };\n\n requestAnimationFrame(animate);\n }, [targetHeight, targetWidth]);\n\n const displayWidth = orientation === 'horizontal' ? barHeight : barWidth;\n const displayHeight = orientation === 'horizontal' ? barWidth : barHeight;\n const svgWidth = orientation === 'horizontal' ? barHeight : barWidth;\n const svgHeight = orientation === 'horizontal' ? barWidth : barHeight;\n\n // Helper function to create rounded rectangle path\n const createRoundedRectPath = (\n x: number,\n y: number,\n width: number,\n height: number,\n radii: { topLeft: number; topRight: number; bottomLeft: number; bottomRight: number }\n ) => {\n const { topLeft, topRight, bottomLeft, bottomRight } = radii;\n \n return `\n M ${x + topLeft} ${y}\n L ${x + width - topRight} ${y}\n Q ${x + width} ${y} ${x + width} ${y + topRight}\n L ${x + width} ${y + height - bottomRight}\n Q ${x + width} ${y + height} ${x + width - bottomRight} ${y + height}\n L ${x + bottomLeft} ${y + height}\n Q ${x} ${y + height} ${x} ${y + height - bottomLeft}\n L ${x} ${y + topLeft}\n Q ${x} ${y} ${x + topLeft} ${y}\n Z\n `.trim().replace(/\\s+/g, ' ');\n };\n\n // Default corner radius values\n const defaultCornerRadius = { topLeft: 2, topRight: 2, bottomLeft: 2, bottomRight: 2 };\n const corners = cornerRadius ? {\n topLeft: cornerRadius.topLeft ?? defaultCornerRadius.topLeft,\n topRight: cornerRadius.topRight ?? defaultCornerRadius.topRight,\n bottomLeft: cornerRadius.bottomLeft ?? defaultCornerRadius.bottomLeft,\n bottomRight: cornerRadius.bottomRight ?? defaultCornerRadius.bottomRight,\n } : defaultCornerRadius;\n\n return (\n <div className={`histogram-container ${orientation === 'horizontal' ? 'histogram-container--horizontal' : ''}`}>\n <div className={`histogram-content ${orientation === 'horizontal' ? 'histogram-content--horizontal' : ''}`}>\n <div \n className=\"histogram-bar\"\n style={{\n height: `${displayHeight}px`,\n width: `${displayWidth}px`\n }}\n >\n <svg\n width={svgWidth}\n height={svgHeight}\n viewBox={`0 0 ${svgWidth} ${svgHeight}`}\n className=\"histogram-svg\"\n >\n {/* Background bar (max value) */}\n <path\n d={createRoundedRectPath(0, 0, svgWidth, svgHeight, corners)}\n fill={max.color}\n fillOpacity={max.opacity || 1}\n />\n {/* Foreground bar (relative value) with animation */}\n {orientation === 'vertical' ? (\n <path\n d={createRoundedRectPath(\n 0,\n svgHeight - animatedHeight,\n svgWidth,\n animatedHeight,\n {\n topLeft: animatedHeight >= svgHeight ? corners.topLeft : 0,\n topRight: animatedHeight >= svgHeight ? corners.topRight : 0,\n bottomLeft: corners.bottomLeft,\n bottomRight: corners.bottomRight,\n }\n )}\n fill={relative.color}\n />\n ) : (\n <path\n d={createRoundedRectPath(\n 0,\n 0,\n animatedWidth,\n svgHeight,\n {\n topLeft: corners.topLeft,\n topRight: animatedWidth >= svgWidth ? corners.topRight : 0,\n bottomLeft: corners.bottomLeft,\n bottomRight: animatedWidth >= svgWidth ? corners.bottomRight : 0,\n }\n )}\n fill={relative.color}\n />\n )}\n </svg>\n </div>\n {children && (\n <div className={`histogram-text-container ${orientation === 'horizontal' ? 'histogram-text-container--horizontal' : ''}`}>\n {children}\n </div>\n )}\n </div>\n </div>\n );\n};\n","import React from \"react\";\nimport \"./Avatar.css\";\n\ninterface AvatarProps {\n children: React.ReactNode;\n}\n\nexport const Avatar: React.FC<AvatarProps> = ({ children }) => {\n return (\n <div className=\"avatar-container avatar-container--clickable\">\n <div className=\"avatar-content\">{children}</div>\n </div>\n );\n};\n","import React from \"react\";\nimport \"./MwhCost.css\";\n\ninterface MwhCostProps {\n cost?: number;\n textColor?: string;\n}\n\nexport const MwhCost: React.FC<MwhCostProps> = ({ cost, textColor }) => {\n return (\n <div className=\"cost-text-container\">\n <div className=\"cost-number\" style={{ color: textColor }}>\n {cost}\n </div>\n <div className=\"cost-unit\" style={{ color: textColor }}>\n €\n </div>\n <div className=\"cost-unit-per\" style={{ color: textColor }}>\n /Mwh\n </div>\n </div>\n );\n};\n"],"names":["Input","_a","label","_b","value","onChange","_c","type","_d","disabled","_e","className","_f","required","_g","min","_h","max","_j","useState","internalValue","setInternalValue","_k","isFocused","setIsFocused","_l","isOutOfRange","setIsOutOfRange","inputRef","useRef","useEffect","containerClasses","length","filter","Boolean","join","_jsx","children","_jsxs","ref","e","newValue","target","numValue","parseFloat","isNaN","outOfRange","onFocus","onBlur","clampedValue","Math","clampedString","toString","undefined","step","ImgOn","isOff","width","height","viewBox","fill","xmlns","d","SwitchThumb","cx","cy","r","Switch","checked","showIcon","internalChecked","setInternalChecked","isChecked","switchClasses","wrapperClasses","role","onClick","newChecked","Chip","bgColor","chipClasses","style","backgroundColor","ProductionUnitContainer","ProductionUnit","onChangeInput","onChangeSwitch","defaultValue","defaultChecked","unitName","energyCost","checkedImage","uncheckedImage","readonly","currentValue","MwhCost","cost","textColor","val","Number","Histogram","relative","barHeight","barWidth","orientation","cornerRadius","animatedHeight","setAnimatedHeight","animatedWidth","setAnimatedWidth","targetHeight","targetWidth","startTime","Date","now","animate","elapsed","progress","easeOutQuart","pow","requestAnimationFrame","displayWidth","displayHeight","svgWidth","svgHeight","createRoundedRectPath","x","y","radii","topLeft","topRight","bottomLeft","bottomRight","concat","trim","replace","defaultCornerRadius","corners","color","fillOpacity","opacity","Avatar"],"mappings":"8GAeO,IAAMA,EAA8B,SAACC,GAC1C,IAAAC,EAAKD,EAAAC,MACLC,EAAUF,EAAAG,MAAVA,OAAQ,IAAAD,EAAA,GAAEA,EACVE,EAAQJ,EAAAI,SACRC,EAAAL,EAAAM,KAAAA,OAAI,IAAAD,EAAG,OAAMA,EACbE,EAAAP,EAAAQ,SAAAA,cAAgBD,EAChBE,EAAAT,EAAAU,UAAAA,OAAY,IAAAD,EAAA,KACZE,EAAAX,EAAAY,SAAAA,OAAW,IAAAD,GAAKA,EAChBE,QAAAC,OAAM,IAAAD,EAAA,CAAEV,MAAO,EAAGF,MAAO,QAAQY,EACjCE,EAAAf,EAAAgB,IAAAA,aAAM,CAAEb,MAAO,IAAKF,MAAO,QAAQc,EAE7BE,EAAoCC,EAASf,GAA5CgB,EAAaF,EAAA,GAAEG,EAAgBH,EAAA,GAChCI,EAA4BH,GAAS,GAApCI,EAASD,EAAA,GAAEE,EAAYF,EAAA,GACxBG,EAAkCN,GAAS,GAA1CO,EAAYD,EAAA,GAAEE,EAAeF,EAAA,GAC9BG,EAAWC,EAAyB,MAE1CC,EAAU,WACRT,EAAiBjB,EACnB,EAAG,CAACA,IAEJ,IA8CM2B,EAAmB,CACvB,kBACAR,EAAY,2BAA6B,GAJnBA,GAAaH,EAAcY,OAAS,EAKxC,4BAA8B,GAChDvB,EAAW,4BAA8B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AAgC,SAAC5I,GAAE,IAAAoC,EAAQpC,EAAAoC,SACtD,OACED,EAAA,MAAA,CAAKzB,UAAU,+CACb0B,SAAAD,EAAA,MAAA,CAAKzB,UAAU,iBAAkB0B,SAAAA,KAGvC,ECLa0D,EAAkC,SAAC9F,OAAE+F,EAAI/F,EAAA+F,KAAEC,EAAShG,EAAAgG,UAC/D,OACE3D,SAAK3B,UAAU,sBACb0B,SAAA,CAAAD,EAAA,MAAA,CAAKzB,UAAU,cAAcsE,MAAO,CAAEyD,MAAOzC,YAC1CD,IAEH5D,EAAA,MAAA,CAAKzB,UAAU,YAAYsE,MAAO,CAAEyD,MAAOzC,GAAW5D,SAAA,MAGtDD,EAAA,MAAA,CAAKzB,UAAU,gBAAgBsE,MAAO,CAAEyD,MAAOzC,GAAW5D,SAAA,WAKhE"}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/components/InputNumber.tsx","../src/components/Switch.tsx","../src/components/Chip.tsx","../src/components/ProductionUnitContainer.tsx","../src/components/ProductionUnit.tsx","../src/components/Histogram.tsx","../src/components/Avatar.tsx","../src/components/MwhCost.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect } from \"react\";\nimport \"./InputNumber.css\";\n\ninterface InputNumberProps {\n label: string;\n value?: string;\n onChange?: (value: string) => void;\n disabled?: boolean;\n className?: string;\n required?: boolean;\n min?: { value: number; label?: string };\n max?: { value: number; label?: string };\n}\n\nexport const InputNumber: React.FC<InputNumberProps> = ({\n label,\n value = \"\",\n onChange,\n disabled = false,\n className = \"\",\n required = false,\n min = { value: 0, label: \"Pmin\" },\n max = { value: 100, label: \"Pmax\" },\n}) => {\n const [internalValue, setInternalValue] = useState(value);\n const [isFocused, setIsFocused] = useState(false);\n const [isOutOfRange, setIsOutOfRange] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n setInternalValue(value);\n }, [value]);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value;\n\n // Check if value is out of range for visual feedback\n if (newValue !== \"\") {\n const numValue = parseFloat(newValue);\n if (!isNaN(numValue)) {\n const outOfRange = numValue < min.value || numValue > max.value;\n setIsOutOfRange(outOfRange);\n } else {\n setIsOutOfRange(false);\n }\n } else {\n setIsOutOfRange(false);\n }\n\n // Allow typing without immediate clamping to enable multi-digit entry\n setInternalValue(newValue);\n onChange?.(newValue);\n };\n const handleFocus = () => {\n setIsFocused(true);\n };\n\n const handleBlur = () => {\n setIsFocused(false);\n\n // Clamp value on blur\n if (internalValue !== \"\") {\n const numValue = parseFloat(internalValue);\n if (!isNaN(numValue)) {\n const clampedValue = Math.max(min.value, Math.min(max.value, numValue));\n if (clampedValue !== numValue) {\n const clampedString = clampedValue.toString();\n setInternalValue(clampedString);\n onChange?.(clampedString);\n }\n setIsOutOfRange(false); // Reset out-of-range state after clamping\n }\n }\n };\n\n const isLabelFloating = isFocused || internalValue.length > 0;\n\n const containerClasses = [\n \"input-container\",\n isFocused ? \"input-container--focused\" : \"\",\n isLabelFloating ? \"input-container--floating\" : \"\",\n disabled ? \"input-container--disabled\" : \"\",\n isOutOfRange ? \"input-container--error\" : \"\",\n className,\n ]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <div className={containerClasses}>\n <div className=\"input-constraints\">\n <div className=\"input-min\">\n {min.label}\n <br />\n {min.value}\n </div>\n\n <div className=\"input-field\">\n <input\n ref={inputRef}\n type=\"number\"\n value={internalValue}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n disabled={disabled}\n required={required}\n className=\"input-element\"\n aria-label={label}\n min={min.value}\n max={max.value}\n step={1}\n />\n <label className=\"input-label\">\n {label}\n {required && <span className=\"input-required\">*</span>}\n </label>\n </div>\n <div className=\"input-max\">\n {max.label}\n <br /> {max.value}\n </div>\n </div>\n </div>\n );\n};\n","import React, { useState } from \"react\";\nimport \"./Switch.css\";\n\ninterface OnProps {\n isOff?: boolean;\n}\nconst ImgOn = ({ isOff }: OnProps) => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M9.56529 2.85352C9.66365 2.57607 9.96837 2.43116 10.246 2.5293C13.4295 3.65507 15.3392 6.91015 14.7684 10.2383C14.1974 13.5667 11.3114 16 7.93443 16C4.55739 16 1.67151 13.5667 1.10045 10.2383C0.5296 6.91011 2.4393 3.65504 5.62291 2.5293C5.9005 2.43115 6.20523 2.57605 6.30357 2.85352C6.40176 3.13124 6.2561 3.43599 5.97838 3.53418C3.28438 4.48672 1.669 7.2423 2.1522 10.0586C2.63557 12.8747 5.07706 14.9336 7.93443 14.9336C10.7918 14.9336 13.2333 12.8747 13.7167 10.0586C14.1999 7.24233 12.5844 4.48676 9.89049 3.53418C9.61276 3.43599 9.4671 3.13124 9.56529 2.85352ZM7.93443 0C8.22892 3.10447e-05 8.46754 0.238727 8.46763 0.533203V7.4668C8.46763 7.76135 8.22898 8.00095 7.93443 8.00098C7.63986 8.00098 7.40123 7.76137 7.40123 7.4668V0.533203C7.40132 0.238707 7.63991 0 7.93443 0Z\"\n fill={isOff ? \"#999FA1\" : \"#009CDF\"}\n />\n </svg>\n);\nconst SwitchThumb = ({ isOff }: OnProps) => (\n <svg\n width=\"32\"\n height=\"32\"\n viewBox=\"0 0 32 32\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"16\" cy=\"16\" r=\"16\" fill={isOff ? \"white\" : \"#009cdf\"} />\n </svg>\n);\n\ninterface SwitchProps {\n checked?: boolean;\n onChange?: (checked: boolean) => void;\n disabled?: boolean;\n showIcon?: boolean;\n label?: string;\n}\n\nexport const Switch: React.FC<SwitchProps> = ({\n checked = false,\n onChange,\n disabled = false,\n showIcon = true,\n label,\n}) => {\n const [internalChecked, setInternalChecked] = useState(checked);\n\n // Use controlled value if provided, otherwise use internal state\n const isChecked = checked !== undefined ? checked : internalChecked;\n\n const handleToggle = () => {\n if (disabled) return;\n\n const newChecked = !isChecked;\n // Only update internal state if uncontrolled\n if (checked === undefined) {\n setInternalChecked(newChecked);\n }\n onChange?.(newChecked);\n };\n\n const switchClasses = [\n \"switch\",\n isChecked ? \"switch--checked\" : \"\",\n disabled ? \"switch--disabled\" : \"\",\n ]\n .filter(Boolean)\n .join(\" \");\n\n const wrapperClasses = [\n \"switch-wrapper\",\n isChecked ? \"switch-wrapper--checked\" : \"\",\n ]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <div className=\"switch-container\">\n <div className={wrapperClasses}>\n {showIcon ? (\n <div className=\"switch-icon\">\n <ImgOn isOff={!isChecked} />\n </div>\n ) : label ? (\n <div className=\"switch-label\">{label}</div>\n ) : null}\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={isChecked}\n className={switchClasses}\n onClick={handleToggle}\n disabled={disabled}\n >\n <span className=\"switch-track\">\n <span className=\"switch-thumb\">\n <SwitchThumb isOff={!isChecked} />\n </span>\n </span>\n </button>\n </div>\n </div>\n );\n};\n","import React from \"react\";\nimport \"./Chip.css\";\n\ninterface ChipProps {\n // Define any props you want to pass to the Chip component\n children: React.ReactNode;\n bgColor?: string;\n width?: \"fit-content\" | \"full-width\";\n}\n\nexport const Chip: React.FC<ChipProps> = ({\n children,\n bgColor,\n width = \"fit-content\",\n}) => {\n const chipClasses = [\n \"chip-container\",\n width === \"full-width\"\n ? \"chip-container--full-width\"\n : \"chip-container--fit-content\",\n ].join(\" \");\n\n return (\n <div className={chipClasses} style={{ backgroundColor: bgColor }}>\n <div className=\"chip-content\">\n <div className=\"chip-label\">{children}</div>\n </div>\n </div>\n );\n};\n","import \"./ProductionUnitContainer.css\";\n\ninterface ProductionUnitContainerProps {\n bgColor?: string;\n children: React.ReactNode;\n height?: string;\n}\nexport const ProductionUnitContainer = ({\n bgColor = \"#fff\",\n children,\n height,\n}: ProductionUnitContainerProps) => {\n return (\n <div\n className=\"production-unit-container-box\"\n style={{ backgroundColor: bgColor, height }}\n >\n {children}\n </div>\n );\n};\n","import { useState } from \"react\";\nimport { InputNumber } from \"./InputNumber\";\nimport { Switch } from \"./Switch\";\nimport \"./ProductionUnit.css\";\nimport { Chip } from \"./Chip\";\nimport { ProductionUnitContainer } from \"./ProductionUnitContainer\";\nimport { MwhCost } from \".\";\n\ntype ProductionUnitLimit = {\n value: number;\n label?: string;\n};\ninterface ProductionUnitProps {\n onChangeInput?: (value: number) => void;\n onChangeSwitch?: (checked: boolean) => void;\n defaultValue?: number;\n defaultChecked?: boolean;\n value?: number;\n checked?: boolean;\n unitName?: string;\n energyCost?: number;\n checkedImage?: React.ReactNode;\n uncheckedImage?: React.ReactNode;\n readonly?: boolean;\n min?: ProductionUnitLimit;\n max?: ProductionUnitLimit;\n}\nexport const ProductionUnit = ({\n onChangeInput,\n onChangeSwitch,\n defaultValue,\n defaultChecked = false,\n value,\n checked,\n unitName = \"Production Unit\",\n energyCost = 0,\n checkedImage,\n uncheckedImage,\n readonly = false,\n min = { value: 10, label: \"Pmin\" },\n max = { value: 100, label: \"Pmax\" },\n}: ProductionUnitProps) => {\n // Internal state management for uncontrolled mode\n const [internalChecked, setInternalChecked] = useState(defaultChecked);\n const [internalValue, setInternalValue] = useState(defaultValue);\n\n // Use controlled props if provided, otherwise use internal state\n const isChecked = checked !== undefined ? checked : internalChecked;\n const currentValue = value !== undefined ? value : internalValue;\n\n const handleSwitchChange = (newChecked: boolean) => {\n // Update internal state only if uncontrolled\n if (checked === undefined) {\n setInternalChecked(newChecked);\n }\n\n // Notify parent component if handler provided\n if (onChangeSwitch) {\n onChangeSwitch(newChecked);\n }\n };\n\n const handleInputChange = (val: string) => {\n // Only convert to number if the string is not empty and is a valid number\n if (val === \"\") {\n // Handle empty string case\n if (value === undefined) {\n setInternalValue(undefined);\n }\n if (onChangeInput) {\n onChangeInput(0); // or whatever default you prefer for empty values\n }\n return;\n }\n\n const numValue = parseFloat(val);\n if (!isNaN(numValue)) {\n // Update internal state only if uncontrolled\n if (value === undefined) {\n setInternalValue(numValue);\n }\n\n // Notify parent component if handler provided\n if (onChangeInput) {\n onChangeInput(numValue);\n }\n }\n };\n\n return (\n <ProductionUnitContainer>\n <div className=\"production-unit-container\">\n <div className=\"production-unit-content\">\n <div className=\"image-preview-container\">\n {isChecked ? checkedImage : uncheckedImage}\n </div>\n <div className=\"production-unit-chip\">\n <div className=\"production-unit-chip-name\">{unitName}</div>\n\n <Chip width=\"fit-content\" bgColor=\"#E1F5FD\">\n <MwhCost cost={energyCost} textColor=\"#005896\" />\n </Chip>\n </div>\n <div className=\"production-unit-switch-container\">\n <InputNumber\n label=\"PA\"\n onChange={handleInputChange}\n value={\n currentValue !== undefined ? currentValue.toString() : undefined\n }\n disabled={!isChecked || readonly}\n min={{ value: min.value, label: min.label }}\n max={{ value: max.value, label: max.label }}\n />{\" \"}\n </div>\n </div>\n\n <Switch\n checked={isChecked}\n onChange={handleSwitchChange}\n disabled={readonly}\n />\n </div>\n </ProductionUnitContainer>\n );\n};\n","import React, { useEffect, useState } from \"react\";\nimport \"./Histogram.css\";\n\ninterface HistogramProps {\n /** Maximum value configuration with value and color */\n max: {\n value: number;\n color: string;\n opacity?: number;\n };\n /** Relative/current value configuration with value and color */\n relative: {\n value: number;\n color: string;\n };\n /** Height of the histogram bar in pixels */\n barHeight?: number;\n /** Width of the histogram bar in pixels */\n barWidth?: number;\n /** Orientation of the histogram - 'vertical' or 'horizontal' */\n orientation?: 'vertical' | 'horizontal';\n /** Corner radius configuration for individual corners */\n cornerRadius?: {\n topLeft?: number;\n topRight?: number;\n bottomLeft?: number;\n bottomRight?: number;\n };\n /** Child components (typically text content) */\n children?: React.ReactNode;\n}\n\nexport const Histogram: React.FC<HistogramProps> = ({\n max,\n relative,\n barHeight = 103,\n barWidth = 32,\n orientation = 'vertical',\n cornerRadius,\n children,\n}) => {\n const [animatedHeight, setAnimatedHeight] = useState(0);\n const [animatedWidth, setAnimatedWidth] = useState(0);\n\n // Calculate target dimensions based on orientation\n const targetHeight = (Math.min((relative.value / max.value) * 100, 100) / 100) * barHeight;\n const targetWidth = (Math.min((relative.value / max.value) * 100, 100) / 100) * barWidth;\n\n // Simple Chart.js-like animation: always animate from 0 to target\n useEffect(() => {\n setAnimatedHeight(0);\n setAnimatedWidth(0);\n \n const startTime = Date.now();\n const duration = 1000;\n\n const animate = () => {\n const elapsed = Date.now() - startTime;\n const progress = Math.min(elapsed / duration, 1);\n\n // Chart.js-like easing (easeOutQuart)\n const easeOutQuart = 1 - Math.pow(1 - progress, 4);\n \n setAnimatedHeight(targetHeight * easeOutQuart);\n setAnimatedWidth(targetWidth * easeOutQuart);\n\n if (progress < 1) {\n requestAnimationFrame(animate);\n }\n };\n\n requestAnimationFrame(animate);\n }, [targetHeight, targetWidth]);\n\n const displayWidth = orientation === 'horizontal' ? barHeight : barWidth;\n const displayHeight = orientation === 'horizontal' ? barWidth : barHeight;\n const svgWidth = orientation === 'horizontal' ? barHeight : barWidth;\n const svgHeight = orientation === 'horizontal' ? barWidth : barHeight;\n\n // Helper function to create rounded rectangle path\n const createRoundedRectPath = (\n x: number,\n y: number,\n width: number,\n height: number,\n radii: { topLeft: number; topRight: number; bottomLeft: number; bottomRight: number }\n ) => {\n const { topLeft, topRight, bottomLeft, bottomRight } = radii;\n \n return `\n M ${x + topLeft} ${y}\n L ${x + width - topRight} ${y}\n Q ${x + width} ${y} ${x + width} ${y + topRight}\n L ${x + width} ${y + height - bottomRight}\n Q ${x + width} ${y + height} ${x + width - bottomRight} ${y + height}\n L ${x + bottomLeft} ${y + height}\n Q ${x} ${y + height} ${x} ${y + height - bottomLeft}\n L ${x} ${y + topLeft}\n Q ${x} ${y} ${x + topLeft} ${y}\n Z\n `.trim().replace(/\\s+/g, ' ');\n };\n\n // Default corner radius values\n const defaultCornerRadius = { topLeft: 2, topRight: 2, bottomLeft: 2, bottomRight: 2 };\n const corners = cornerRadius ? {\n topLeft: cornerRadius.topLeft ?? defaultCornerRadius.topLeft,\n topRight: cornerRadius.topRight ?? defaultCornerRadius.topRight,\n bottomLeft: cornerRadius.bottomLeft ?? defaultCornerRadius.bottomLeft,\n bottomRight: cornerRadius.bottomRight ?? defaultCornerRadius.bottomRight,\n } : defaultCornerRadius;\n\n return (\n <div className={`histogram-container ${orientation === 'horizontal' ? 'histogram-container--horizontal' : ''}`}>\n <div className={`histogram-content ${orientation === 'horizontal' ? 'histogram-content--horizontal' : ''}`}>\n <div \n className=\"histogram-bar\"\n style={{\n height: `${displayHeight}px`,\n width: `${displayWidth}px`\n }}\n >\n <svg\n width={svgWidth}\n height={svgHeight}\n viewBox={`0 0 ${svgWidth} ${svgHeight}`}\n className=\"histogram-svg\"\n >\n {/* Background bar (max value) */}\n <path\n d={createRoundedRectPath(0, 0, svgWidth, svgHeight, corners)}\n fill={max.color}\n fillOpacity={max.opacity || 1}\n />\n {/* Foreground bar (relative value) with animation */}\n {orientation === 'vertical' ? (\n <path\n d={createRoundedRectPath(\n 0,\n svgHeight - animatedHeight,\n svgWidth,\n animatedHeight,\n {\n topLeft: animatedHeight >= svgHeight ? corners.topLeft : 0,\n topRight: animatedHeight >= svgHeight ? corners.topRight : 0,\n bottomLeft: corners.bottomLeft,\n bottomRight: corners.bottomRight,\n }\n )}\n fill={relative.color}\n />\n ) : (\n <path\n d={createRoundedRectPath(\n 0,\n 0,\n animatedWidth,\n svgHeight,\n {\n topLeft: corners.topLeft,\n topRight: animatedWidth >= svgWidth ? corners.topRight : 0,\n bottomLeft: corners.bottomLeft,\n bottomRight: animatedWidth >= svgWidth ? corners.bottomRight : 0,\n }\n )}\n fill={relative.color}\n />\n )}\n </svg>\n </div>\n {children && (\n <div className={`histogram-text-container ${orientation === 'horizontal' ? 'histogram-text-container--horizontal' : ''}`}>\n {children}\n </div>\n )}\n </div>\n </div>\n );\n};\n","import React from \"react\";\nimport \"./Avatar.css\";\n\ninterface AvatarProps {\n children: React.ReactNode;\n}\n\nexport const Avatar: React.FC<AvatarProps> = ({ children }) => {\n return (\n <div className=\"avatar-container avatar-container--clickable\">\n <div className=\"avatar-content\">{children}</div>\n </div>\n );\n};\n","import React from \"react\";\nimport \"./MwhCost.css\";\n\ninterface MwhCostProps {\n cost?: number;\n textColor?: string;\n}\n\nexport const MwhCost: React.FC<MwhCostProps> = ({ cost, textColor }) => {\n return (\n <div className=\"cost-text-container\">\n <div className=\"cost-number\" style={{ color: textColor }}>\n {cost}\n </div>\n <div className=\"cost-unit\" style={{ color: textColor }}>\n €\n </div>\n <div className=\"cost-unit-per\" style={{ color: textColor }}>\n /Mwh\n </div>\n </div>\n );\n};\n"],"names":["InputNumber","_a","label","_b","value","onChange","_c","disabled","_d","className","_e","required","_f","min","_g","max","_h","useState","internalValue","setInternalValue","_j","isFocused","setIsFocused","_k","isOutOfRange","setIsOutOfRange","inputRef","useRef","useEffect","containerClasses","length","filter","Boolean","join","_jsx","children","_jsxs","ref","type","e","newValue","target","numValue","parseFloat","isNaN","outOfRange","onFocus","onBlur","clampedValue","Math","clampedString","toString","step","ImgOn","isOff","width","height","viewBox","fill","xmlns","d","SwitchThumb","cx","cy","r","Switch","checked","showIcon","internalChecked","setInternalChecked","isChecked","undefined","switchClasses","wrapperClasses","role","onClick","newChecked","Chip","bgColor","chipClasses","style","backgroundColor","ProductionUnitContainer","ProductionUnit","onChangeInput","onChangeSwitch","defaultValue","defaultChecked","unitName","energyCost","checkedImage","uncheckedImage","readonly","currentValue","MwhCost","cost","textColor","val","Histogram","relative","barHeight","barWidth","orientation","cornerRadius","animatedHeight","setAnimatedHeight","animatedWidth","setAnimatedWidth","targetHeight","targetWidth","startTime","Date","now","animate","elapsed","progress","easeOutQuart","pow","requestAnimationFrame","displayWidth","displayHeight","svgWidth","svgHeight","createRoundedRectPath","x","y","radii","topLeft","topRight","bottomLeft","bottomRight","concat","trim","replace","defaultCornerRadius","corners","color","fillOpacity","opacity","Avatar"],"mappings":"8GAcO,IAAMA,EAA0C,SAACC,GACtD,IAAAC,EAAKD,EAAAC,MACLC,EAAUF,EAAAG,MAAVA,OAAK,IAAAD,EAAG,GA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E"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var t=require("react/jsx-runtime"),e=require("react"),i=function(i){var n=i.label,a=i.value,o=void 0===a?"":a,c=i.onChange,l=i.type,s=void 0===l?"text":l,r=i.disabled,d=void 0!==r&&r,h=i.className,u=void 0===h?"":h,v=i.required,m=void 0!==v&&v,x=i.min,f=void 0===x?{value:0,label:"Pmin"}:x,p=i.max,b=void 0===p?{value:100,label:"Pmax"}:p,g=e.useState(o),j=g[0],w=g[1],N=e.useState(!1),C=N[0],L=N[1],R=e.useState(!1),y=R[0],k=R[1],S=e.useRef(null);e.useEffect(function(){w(o)},[o]);var M=["input-container",C?"input-container--focused":"",C||j.length>0?"input-container--floating":"",d?"input-container--disabled":"",y?"input-container--error":"",u].filter(Boolean).join(" ");return t.jsx("div",{className:M,children:t.jsxs("div",{className:"input-constraints",children:[t.jsxs("div",{className:"input-min",children:[f.label,t.jsx("br",{}),f.value]}),t.jsxs("div",{className:"input-field",children:[t.jsx("input",{ref:S,type:s,value:j,onChange:function(t){var e=t.target.value;if("number"===s&&""!==e){var i=parseFloat(e);if(isNaN(i))k(!1);else{var n=i<f.value||i>b.value;k(n)}}else k(!1);w(e),null==c||c(e)},onFocus:function(){L(!0)},onBlur:function(){if(L(!1),"number"===s&&""!==j){var t=parseFloat(j);if(!isNaN(t)){var e=Math.max(f.value,Math.min(b.value,t));if(e!==t){var i=e.toString();w(i),null==c||c(i)}k(!1)}}},disabled:d,required:m,className:"input-element","aria-label":n,min:"number"===s?f.value:void 0,max:"number"===s?b.value:void 0,step:"number"===s?1:void 0}),t.jsxs("label",{className:"input-label",children:[n,m&&t.jsx("span",{className:"input-required",children:"*"})]})]}),t.jsxs("div",{className:"input-max",children:[b.label,t.jsx("br",{})," ",b.value]})]})})},n=function(e){var i=e.isOff;return t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M9.56529 2.85352C9.66365 2.57607 9.96837 2.43116 10.246 2.5293C13.4295 3.65507 15.3392 6.91015 14.7684 10.2383C14.1974 13.5667 11.3114 16 7.93443 16C4.55739 16 1.67151 13.5667 1.10045 10.2383C0.5296 6.91011 2.4393 3.65504 5.62291 2.5293C5.9005 2.43115 6.20523 2.57605 6.30357 2.85352C6.40176 3.13124 6.2561 3.43599 5.97838 3.53418C3.28438 4.48672 1.669 7.2423 2.1522 10.0586C2.63557 12.8747 5.07706 14.9336 7.93443 14.9336C10.7918 14.9336 13.2333 12.8747 13.7167 10.0586C14.1999 7.24233 12.5844 4.48676 9.89049 3.53418C9.61276 3.43599 9.4671 3.13124 9.56529 2.85352ZM7.93443 0C8.22892 3.10447e-05 8.46754 0.238727 8.46763 0.533203V7.4668C8.46763 7.76135 8.22898 8.00095 7.93443 8.00098C7.63986 8.00098 7.40123 7.76137 7.40123 7.4668V0.533203C7.40132 0.238707 7.63991 0 7.93443 0Z",fill:i?"#999FA1":"#009CDF"})})},a=function(e){var i=e.isOff;return t.jsx("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("circle",{cx:"16",cy:"16",r:"16",fill:i?"white":"#009cdf"})})},o=function(i){var o=i.checked,c=void 0!==o&&o,l=i.onChange,s=i.disabled,r=void 0!==s&&s,d=i.showIcon,h=void 0===d||d,u=i.label,v=e.useState(c),m=v[0],x=v[1],f=void 0!==c?c:m,p=["switch",f?"switch--checked":"",r?"switch--disabled":""].filter(Boolean).join(" "),b=["switch-wrapper",f?"switch-wrapper--checked":""].filter(Boolean).join(" ");return t.jsx("div",{className:"switch-container",children:t.jsxs("div",{className:b,children:[h?t.jsx("div",{className:"switch-icon",children:t.jsx(n,{isOff:!f})}):u?t.jsx("div",{className:"switch-label",children:u}):null,t.jsx("button",{type:"button",role:"switch","aria-checked":f,className:p,onClick:function(){if(!r){var t=!f;void 0===c&&x(t),null==l||l(t)}},disabled:r,children:t.jsx("span",{className:"switch-track",children:t.jsx("span",{className:"switch-thumb",children:t.jsx(a,{isOff:!f})})})})]})})},c=function(e){var i=e.children,n=e.bgColor,a=e.width,o=["chip-container","full-width"===(void 0===a?"fit-content":a)?"chip-container--full-width":"chip-container--fit-content"].join(" ");return t.jsx("div",{className:o,style:{backgroundColor:n},children:t.jsx("div",{className:"chip-content",children:t.jsx("div",{className:"chip-label",children:i})})})},l=function(e){var i=e.bgColor,n=void 0===i?"#fff":i,a=e.children,o=e.height;return t.jsx("div",{className:"production-unit-container-box",style:{backgroundColor:n,height:o},children:a})},s=function(e){var i=e.cost,n=e.textColor;return t.jsxs("div",{className:"cost-text-container",children:[t.jsx("div",{className:"cost-number",style:{color:n},children:i}),t.jsx("div",{className:"cost-unit",style:{color:n},children:"€"}),t.jsx("div",{className:"cost-unit-per",style:{color:n},children:"/Mwh"})]})};exports.Avatar=function(e){var i=e.children;return t.jsx("div",{className:"avatar-container avatar-container--clickable",children:t.jsx("div",{className:"avatar-content",children:i})})},exports.Chip=c,exports.Histogram=function(i){var n,a,o,c,l=i.max,s=i.relative,r=i.barHeight,d=void 0===r?103:r,h=i.barWidth,u=void 0===h?32:h,v=i.orientation,m=void 0===v?"vertical":v,x=i.cornerRadius,f=i.children,p=e.useState(0),b=p[0],g=p[1],j=e.useState(0),w=j[0],N=j[1],C=Math.min(s.value/l.value*100,100)/100*d,L=Math.min(s.value/l.value*100,100)/100*u;e.useEffect(function(){g(0),N(0);var t=Date.now(),e=function(){var i=Date.now()-t,n=Math.min(i/1e3,1),a=1-Math.pow(1-n,4);g(C*a),N(L*a),n<1&&requestAnimationFrame(e)};requestAnimationFrame(e)},[C,L]);var R="horizontal"===m?d:u,y="horizontal"===m?u:d,k="horizontal"===m?d:u,S="horizontal"===m?u:d,M=function(t,e,i,n,a){var o=a.topLeft,c=a.topRight,l=a.bottomLeft,s=a.bottomRight;return"\n M ".concat(t+o," ").concat(e,"\n L ").concat(t+i-c," ").concat(e,"\n Q ").concat(t+i," ").concat(e," ").concat(t+i," ").concat(e+c,"\n L ").concat(t+i," ").concat(e+n-s,"\n Q ").concat(t+i," ").concat(e+n," ").concat(t+i-s," ").concat(e+n,"\n L ").concat(t+l," ").concat(e+n,"\n Q ").concat(t," ").concat(e+n," ").concat(t," ").concat(e+n-l,"\n L ").concat(t," ").concat(e+o,"\n Q ").concat(t," ").concat(e," ").concat(t+o," ").concat(e,"\n Z\n ").trim().replace(/\s+/g," ")},z={topLeft:2,topRight:2,bottomLeft:2,bottomRight:2},F=x?{topLeft:null!==(n=x.topLeft)&&void 0!==n?n:z.topLeft,topRight:null!==(a=x.topRight)&&void 0!==a?a:z.topRight,bottomLeft:null!==(o=x.bottomLeft)&&void 0!==o?o:z.bottomLeft,bottomRight:null!==(c=x.bottomRight)&&void 0!==c?c:z.bottomRight}:z;return t.jsx("div",{className:"histogram-container ".concat("horizontal"===m?"histogram-container--horizontal":""),children:t.jsxs("div",{className:"histogram-content ".concat("horizontal"===m?"histogram-content--horizontal":""),children:[t.jsx("div",{className:"histogram-bar",style:{height:"".concat(y,"px"),width:"".concat(R,"px")},children:t.jsxs("svg",{width:k,height:S,viewBox:"0 0 ".concat(k," ").concat(S),className:"histogram-svg",children:[t.jsx("path",{d:M(0,0,k,S,F),fill:l.color,fillOpacity:l.opacity||1}),"vertical"===m?t.jsx("path",{d:M(0,S-b,k,b,{topLeft:b>=S?F.topLeft:0,topRight:b>=S?F.topRight:0,bottomLeft:F.bottomLeft,bottomRight:F.bottomRight}),fill:s.color}):t.jsx("path",{d:M(0,0,w,S,{topLeft:F.topLeft,topRight:w>=k?F.topRight:0,bottomLeft:F.bottomLeft,bottomRight:w>=k?F.bottomRight:0}),fill:s.color})]})}),f&&t.jsx("div",{className:"histogram-text-container ".concat("horizontal"===m?"histogram-text-container--horizontal":""),children:f})]})})},exports.Input=i,exports.MwhCost=s,exports.ProductionUnit=function(n){var a=n.onChangeInput,r=n.onChangeSwitch,d=n.defaultValue,h=n.defaultChecked,u=void 0!==h&&h,v=n.value,m=n.checked,x=n.unitName,f=void 0===x?"Production Unit":x,p=n.energyCost,b=void 0===p?0:p,g=n.checkedImage,j=n.uncheckedImage,w=n.readonly,N=void 0!==w&&w,C=n.min,L=void 0===C?{value:10,label:"Pmin"}:C,R=n.max,y=void 0===R?{value:100,label:"Pmax"}:R,k=e.useState(u),S=k[0],M=k[1],z=e.useState(d),F=z[0],P=z[1],q=void 0!==m?m:S,B=void 0!==v?v:F;return t.jsx(l,{children:t.jsxs("div",{className:"production-unit-container",children:[t.jsxs("div",{className:"production-unit-content",children:[t.jsx("div",{className:"image-preview-container",children:q?g:j}),t.jsxs("div",{className:"production-unit-chip",children:[t.jsx("div",{className:"production-unit-chip-name",children:f}),t.jsx(c,{width:"fit-content",bgColor:"#E1F5FD",children:t.jsx(s,{cost:b,textColor:"#005896"})})]}),t.jsxs("div",{className:"production-unit-switch-container",children:[t.jsx(i,{label:"PA",type:"number",onChange:function(t){var e=Number(t);void 0===v&&P(e),a&&a(e)},value:void 0!==B?B.toString():void 0,disabled:!q||N,min:{value:L.value,label:L.label},max:{value:y.value,label:y.label}})," "]})]}),t.jsx(o,{checked:q,onChange:function(t){void 0===m&&M(t),r&&r(t)},disabled:N})]})})},exports.ProductionUnitContainer=l,exports.Switch=o;
1
+ "use strict";var t=require("react/jsx-runtime"),e=require("react"),i=function(i){var n=i.label,a=i.value,o=void 0===a?"":a,c=i.onChange,l=i.disabled,s=void 0!==l&&l,r=i.className,d=void 0===r?"":r,h=i.required,u=void 0!==h&&h,v=i.min,m=void 0===v?{value:0,label:"Pmin"}:v,f=i.max,x=void 0===f?{value:100,label:"Pmax"}:f,p=e.useState(o),g=p[0],b=p[1],j=e.useState(!1),N=j[0],w=j[1],C=e.useState(!1),L=C[0],R=C[1],k=e.useRef(null);e.useEffect(function(){b(o)},[o]);var y=["input-container",N?"input-container--focused":"",N||g.length>0?"input-container--floating":"",s?"input-container--disabled":"",L?"input-container--error":"",d].filter(Boolean).join(" ");return t.jsx("div",{className:y,children:t.jsxs("div",{className:"input-constraints",children:[t.jsxs("div",{className:"input-min",children:[m.label,t.jsx("br",{}),m.value]}),t.jsxs("div",{className:"input-field",children:[t.jsx("input",{ref:k,type:"number",value:g,onChange:function(t){var e=t.target.value;if(""!==e){var i=parseFloat(e);if(isNaN(i))R(!1);else{var n=i<m.value||i>x.value;R(n)}}else R(!1);b(e),null==c||c(e)},onFocus:function(){w(!0)},onBlur:function(){if(w(!1),""!==g){var t=parseFloat(g);if(!isNaN(t)){var e=Math.max(m.value,Math.min(x.value,t));if(e!==t){var i=e.toString();b(i),null==c||c(i)}R(!1)}}},disabled:s,required:u,className:"input-element","aria-label":n,min:m.value,max:x.value,step:1}),t.jsxs("label",{className:"input-label",children:[n,u&&t.jsx("span",{className:"input-required",children:"*"})]})]}),t.jsxs("div",{className:"input-max",children:[x.label,t.jsx("br",{})," ",x.value]})]})})},n=function(e){var i=e.isOff;return t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M9.56529 2.85352C9.66365 2.57607 9.96837 2.43116 10.246 2.5293C13.4295 3.65507 15.3392 6.91015 14.7684 10.2383C14.1974 13.5667 11.3114 16 7.93443 16C4.55739 16 1.67151 13.5667 1.10045 10.2383C0.5296 6.91011 2.4393 3.65504 5.62291 2.5293C5.9005 2.43115 6.20523 2.57605 6.30357 2.85352C6.40176 3.13124 6.2561 3.43599 5.97838 3.53418C3.28438 4.48672 1.669 7.2423 2.1522 10.0586C2.63557 12.8747 5.07706 14.9336 7.93443 14.9336C10.7918 14.9336 13.2333 12.8747 13.7167 10.0586C14.1999 7.24233 12.5844 4.48676 9.89049 3.53418C9.61276 3.43599 9.4671 3.13124 9.56529 2.85352ZM7.93443 0C8.22892 3.10447e-05 8.46754 0.238727 8.46763 0.533203V7.4668C8.46763 7.76135 8.22898 8.00095 7.93443 8.00098C7.63986 8.00098 7.40123 7.76137 7.40123 7.4668V0.533203C7.40132 0.238707 7.63991 0 7.93443 0Z",fill:i?"#999FA1":"#009CDF"})})},a=function(e){var i=e.isOff;return t.jsx("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("circle",{cx:"16",cy:"16",r:"16",fill:i?"white":"#009cdf"})})},o=function(i){var o=i.checked,c=void 0!==o&&o,l=i.onChange,s=i.disabled,r=void 0!==s&&s,d=i.showIcon,h=void 0===d||d,u=i.label,v=e.useState(c),m=v[0],f=v[1],x=void 0!==c?c:m,p=["switch",x?"switch--checked":"",r?"switch--disabled":""].filter(Boolean).join(" "),g=["switch-wrapper",x?"switch-wrapper--checked":""].filter(Boolean).join(" ");return t.jsx("div",{className:"switch-container",children:t.jsxs("div",{className:g,children:[h?t.jsx("div",{className:"switch-icon",children:t.jsx(n,{isOff:!x})}):u?t.jsx("div",{className:"switch-label",children:u}):null,t.jsx("button",{type:"button",role:"switch","aria-checked":x,className:p,onClick:function(){if(!r){var t=!x;void 0===c&&f(t),null==l||l(t)}},disabled:r,children:t.jsx("span",{className:"switch-track",children:t.jsx("span",{className:"switch-thumb",children:t.jsx(a,{isOff:!x})})})})]})})},c=function(e){var i=e.children,n=e.bgColor,a=e.width,o=["chip-container","full-width"===(void 0===a?"fit-content":a)?"chip-container--full-width":"chip-container--fit-content"].join(" ");return t.jsx("div",{className:o,style:{backgroundColor:n},children:t.jsx("div",{className:"chip-content",children:t.jsx("div",{className:"chip-label",children:i})})})},l=function(e){var i=e.bgColor,n=void 0===i?"#fff":i,a=e.children,o=e.height;return t.jsx("div",{className:"production-unit-container-box",style:{backgroundColor:n,height:o},children:a})},s=function(e){var i=e.cost,n=e.textColor;return t.jsxs("div",{className:"cost-text-container",children:[t.jsx("div",{className:"cost-number",style:{color:n},children:i}),t.jsx("div",{className:"cost-unit",style:{color:n},children:"€"}),t.jsx("div",{className:"cost-unit-per",style:{color:n},children:"/Mwh"})]})};exports.Avatar=function(e){var i=e.children;return t.jsx("div",{className:"avatar-container avatar-container--clickable",children:t.jsx("div",{className:"avatar-content",children:i})})},exports.Chip=c,exports.Histogram=function(i){var n,a,o,c,l=i.max,s=i.relative,r=i.barHeight,d=void 0===r?103:r,h=i.barWidth,u=void 0===h?32:h,v=i.orientation,m=void 0===v?"vertical":v,f=i.cornerRadius,x=i.children,p=e.useState(0),g=p[0],b=p[1],j=e.useState(0),N=j[0],w=j[1],C=Math.min(s.value/l.value*100,100)/100*d,L=Math.min(s.value/l.value*100,100)/100*u;e.useEffect(function(){b(0),w(0);var t=Date.now(),e=function(){var i=Date.now()-t,n=Math.min(i/1e3,1),a=1-Math.pow(1-n,4);b(C*a),w(L*a),n<1&&requestAnimationFrame(e)};requestAnimationFrame(e)},[C,L]);var R="horizontal"===m?d:u,k="horizontal"===m?u:d,y="horizontal"===m?d:u,S="horizontal"===m?u:d,M=function(t,e,i,n,a){var o=a.topLeft,c=a.topRight,l=a.bottomLeft,s=a.bottomRight;return"\n M ".concat(t+o," ").concat(e,"\n L ").concat(t+i-c," ").concat(e,"\n Q ").concat(t+i," ").concat(e," ").concat(t+i," ").concat(e+c,"\n L ").concat(t+i," ").concat(e+n-s,"\n Q ").concat(t+i," ").concat(e+n," ").concat(t+i-s," ").concat(e+n,"\n L ").concat(t+l," ").concat(e+n,"\n Q ").concat(t," ").concat(e+n," ").concat(t," ").concat(e+n-l,"\n L ").concat(t," ").concat(e+o,"\n Q ").concat(t," ").concat(e," ").concat(t+o," ").concat(e,"\n Z\n ").trim().replace(/\s+/g," ")},z={topLeft:2,topRight:2,bottomLeft:2,bottomRight:2},F=f?{topLeft:null!==(n=f.topLeft)&&void 0!==n?n:z.topLeft,topRight:null!==(a=f.topRight)&&void 0!==a?a:z.topRight,bottomLeft:null!==(o=f.bottomLeft)&&void 0!==o?o:z.bottomLeft,bottomRight:null!==(c=f.bottomRight)&&void 0!==c?c:z.bottomRight}:z;return t.jsx("div",{className:"histogram-container ".concat("horizontal"===m?"histogram-container--horizontal":""),children:t.jsxs("div",{className:"histogram-content ".concat("horizontal"===m?"histogram-content--horizontal":""),children:[t.jsx("div",{className:"histogram-bar",style:{height:"".concat(k,"px"),width:"".concat(R,"px")},children:t.jsxs("svg",{width:y,height:S,viewBox:"0 0 ".concat(y," ").concat(S),className:"histogram-svg",children:[t.jsx("path",{d:M(0,0,y,S,F),fill:l.color,fillOpacity:l.opacity||1}),"vertical"===m?t.jsx("path",{d:M(0,S-g,y,g,{topLeft:g>=S?F.topLeft:0,topRight:g>=S?F.topRight:0,bottomLeft:F.bottomLeft,bottomRight:F.bottomRight}),fill:s.color}):t.jsx("path",{d:M(0,0,N,S,{topLeft:F.topLeft,topRight:N>=y?F.topRight:0,bottomLeft:F.bottomLeft,bottomRight:N>=y?F.bottomRight:0}),fill:s.color})]})}),x&&t.jsx("div",{className:"histogram-text-container ".concat("horizontal"===m?"histogram-text-container--horizontal":""),children:x})]})})},exports.InputNumber=i,exports.MwhCost=s,exports.ProductionUnit=function(n){var a=n.onChangeInput,r=n.onChangeSwitch,d=n.defaultValue,h=n.defaultChecked,u=void 0!==h&&h,v=n.value,m=n.checked,f=n.unitName,x=void 0===f?"Production Unit":f,p=n.energyCost,g=void 0===p?0:p,b=n.checkedImage,j=n.uncheckedImage,N=n.readonly,w=void 0!==N&&N,C=n.min,L=void 0===C?{value:10,label:"Pmin"}:C,R=n.max,k=void 0===R?{value:100,label:"Pmax"}:R,y=e.useState(u),S=y[0],M=y[1],z=e.useState(d),F=z[0],P=z[1],q=void 0!==m?m:S,B=void 0!==v?v:F;return t.jsx(l,{children:t.jsxs("div",{className:"production-unit-container",children:[t.jsxs("div",{className:"production-unit-content",children:[t.jsx("div",{className:"image-preview-container",children:q?b:j}),t.jsxs("div",{className:"production-unit-chip",children:[t.jsx("div",{className:"production-unit-chip-name",children:x}),t.jsx(c,{width:"fit-content",bgColor:"#E1F5FD",children:t.jsx(s,{cost:g,textColor:"#005896"})})]}),t.jsxs("div",{className:"production-unit-switch-container",children:[t.jsx(i,{label:"PA",onChange:function(t){if(""===t)return void 0===v&&P(void 0),void(a&&a(0));var e=parseFloat(t);isNaN(e)||(void 0===v&&P(e),a&&a(e))},value:void 0!==B?B.toString():void 0,disabled:!q||w,min:{value:L.value,label:L.label},max:{value:k.value,label:k.label}})," "]})]}),t.jsx(o,{checked:q,onChange:function(t){void 0===m&&M(t),r&&r(t)},disabled:w})]})})},exports.ProductionUnitContainer=l,exports.Switch=o;
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/components/Input.tsx","../src/components/Switch.tsx","../src/components/Chip.tsx","../src/components/ProductionUnitContainer.tsx","../src/components/MwhCost.tsx","../src/components/Avatar.tsx","../src/components/Histogram.tsx","../src/components/ProductionUnit.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect } from \"react\";\nimport \"./Input.css\";\n\ninterface InputProps {\n label: string;\n value?: string;\n onChange?: (value: string) => void;\n type?: \"text\" | \"number\";\n disabled?: boolean;\n className?: string;\n required?: boolean;\n min?: { value: number; label?: string };\n max?: { value: number; label?: string };\n}\n\nexport const Input: React.FC<InputProps> = ({\n label,\n value = \"\",\n onChange,\n type = \"text\",\n disabled = false,\n className = \"\",\n required = false,\n min = { value: 0, label: \"Pmin\" },\n max = { value: 100, label: \"Pmax\" },\n}) => {\n const [internalValue, setInternalValue] = useState(value);\n const [isFocused, setIsFocused] = useState(false);\n const [isOutOfRange, setIsOutOfRange] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n setInternalValue(value);\n }, [value]);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value;\n \n // Check if value is out of range for visual feedback (but don't clamp yet)\n if (type === \"number\" && newValue !== \"\") {\n const numValue = parseFloat(newValue);\n if (!isNaN(numValue)) {\n const outOfRange = numValue < min.value || numValue > max.value;\n setIsOutOfRange(outOfRange);\n } else {\n setIsOutOfRange(false);\n }\n } else {\n setIsOutOfRange(false);\n }\n \n // Allow typing without immediate validation\n // Validation will happen on blur\n setInternalValue(newValue);\n onChange?.(newValue);\n };\n\n const handleFocus = () => {\n setIsFocused(true);\n };\n\n const handleBlur = () => {\n setIsFocused(false);\n\n // Validate and clamp value on blur for number inputs\n if (type === \"number\" && internalValue !== \"\") {\n const numValue = parseFloat(internalValue);\n if (!isNaN(numValue)) {\n const clampedValue = Math.max(min.value, Math.min(max.value, numValue));\n if (clampedValue !== numValue) {\n const clampedString = clampedValue.toString();\n setInternalValue(clampedString);\n onChange?.(clampedString);\n }\n setIsOutOfRange(false); // Reset out-of-range state after clamping\n }\n }\n };\n\n const isLabelFloating = isFocused || internalValue.length > 0;\n\n const containerClasses = [\n \"input-container\",\n isFocused ? \"input-container--focused\" : \"\",\n isLabelFloating ? \"input-container--floating\" : \"\",\n disabled ? \"input-container--disabled\" : \"\",\n isOutOfRange ? \"input-container--error\" : \"\",\n className,\n ]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <div className={containerClasses}>\n <div className=\"input-constraints\">\n <div className=\"input-min\">\n {min.label}\n <br />\n {min.value}\n </div>\n\n <div className=\"input-field\">\n <input\n ref={inputRef}\n type={type}\n value={internalValue}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n disabled={disabled}\n required={required}\n className=\"input-element\"\n aria-label={label}\n min={type === \"number\" ? min.value : undefined}\n max={type === \"number\" ? max.value : undefined}\n step={type === \"number\" ? 1 : undefined}\n />\n <label className=\"input-label\">\n {label}\n {required && <span className=\"input-required\">*</span>}\n </label>\n </div>\n <div className=\"input-max\">\n {max.label}\n <br /> {max.value}\n </div>\n </div>\n </div>\n );\n};\n","import React, { useState } from \"react\";\nimport \"./Switch.css\";\n\ninterface OnProps {\n isOff?: boolean;\n}\nconst ImgOn = ({ isOff }: OnProps) => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M9.56529 2.85352C9.66365 2.57607 9.96837 2.43116 10.246 2.5293C13.4295 3.65507 15.3392 6.91015 14.7684 10.2383C14.1974 13.5667 11.3114 16 7.93443 16C4.55739 16 1.67151 13.5667 1.10045 10.2383C0.5296 6.91011 2.4393 3.65504 5.62291 2.5293C5.9005 2.43115 6.20523 2.57605 6.30357 2.85352C6.40176 3.13124 6.2561 3.43599 5.97838 3.53418C3.28438 4.48672 1.669 7.2423 2.1522 10.0586C2.63557 12.8747 5.07706 14.9336 7.93443 14.9336C10.7918 14.9336 13.2333 12.8747 13.7167 10.0586C14.1999 7.24233 12.5844 4.48676 9.89049 3.53418C9.61276 3.43599 9.4671 3.13124 9.56529 2.85352ZM7.93443 0C8.22892 3.10447e-05 8.46754 0.238727 8.46763 0.533203V7.4668C8.46763 7.76135 8.22898 8.00095 7.93443 8.00098C7.63986 8.00098 7.40123 7.76137 7.40123 7.4668V0.533203C7.40132 0.238707 7.63991 0 7.93443 0Z\"\n fill={isOff ? \"#999FA1\" : \"#009CDF\"}\n />\n </svg>\n);\nconst SwitchThumb = ({ isOff }: OnProps) => (\n <svg\n width=\"32\"\n height=\"32\"\n viewBox=\"0 0 32 32\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"16\" cy=\"16\" r=\"16\" fill={isOff ? \"white\" : \"#009cdf\"} />\n </svg>\n);\n\ninterface SwitchProps {\n checked?: boolean;\n onChange?: (checked: boolean) => void;\n disabled?: boolean;\n showIcon?: boolean;\n label?: string;\n}\n\nexport const Switch: React.FC<SwitchProps> = ({\n checked = false,\n onChange,\n disabled = false,\n showIcon = true,\n label,\n}) => {\n const [internalChecked, setInternalChecked] = useState(checked);\n\n // Use controlled value if provided, otherwise use internal state\n const isChecked = checked !== undefined ? checked : internalChecked;\n\n const handleToggle = () => {\n if (disabled) return;\n\n const newChecked = !isChecked;\n // Only update internal state if uncontrolled\n if (checked === undefined) {\n setInternalChecked(newChecked);\n }\n onChange?.(newChecked);\n };\n\n const switchClasses = [\n \"switch\",\n isChecked ? \"switch--checked\" : \"\",\n disabled ? \"switch--disabled\" : \"\",\n ]\n .filter(Boolean)\n .join(\" \");\n\n const wrapperClasses = [\n \"switch-wrapper\",\n isChecked ? \"switch-wrapper--checked\" : \"\",\n ]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <div className=\"switch-container\">\n <div className={wrapperClasses}>\n {showIcon ? (\n <div className=\"switch-icon\">\n <ImgOn isOff={!isChecked} />\n </div>\n ) : label ? (\n <div className=\"switch-label\">{label}</div>\n ) : null}\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={isChecked}\n className={switchClasses}\n onClick={handleToggle}\n disabled={disabled}\n >\n <span className=\"switch-track\">\n <span className=\"switch-thumb\">\n <SwitchThumb isOff={!isChecked} />\n </span>\n </span>\n </button>\n </div>\n </div>\n );\n};\n","import React from \"react\";\nimport \"./Chip.css\";\n\ninterface ChipProps {\n // Define any props you want to pass to the Chip component\n children: React.ReactNode;\n bgColor?: string;\n width?: \"fit-content\" | \"full-width\";\n}\n\nexport const Chip: React.FC<ChipProps> = ({\n children,\n bgColor,\n width = \"fit-content\",\n}) => {\n const chipClasses = [\n \"chip-container\",\n width === \"full-width\"\n ? \"chip-container--full-width\"\n : \"chip-container--fit-content\",\n ].join(\" \");\n\n return (\n <div className={chipClasses} style={{ backgroundColor: bgColor }}>\n <div className=\"chip-content\">\n <div className=\"chip-label\">{children}</div>\n </div>\n </div>\n );\n};\n","import \"./ProductionUnitContainer.css\";\n\ninterface ProductionUnitContainerProps {\n bgColor?: string;\n children: React.ReactNode;\n height?: string;\n}\nexport const ProductionUnitContainer = ({\n bgColor = \"#fff\",\n children,\n height,\n}: ProductionUnitContainerProps) => {\n return (\n <div\n className=\"production-unit-container-box\"\n style={{ backgroundColor: bgColor, height }}\n >\n {children}\n </div>\n );\n};\n","import React from \"react\";\nimport \"./MwhCost.css\";\n\ninterface MwhCostProps {\n cost?: number;\n textColor?: string;\n}\n\nexport const MwhCost: React.FC<MwhCostProps> = ({ cost, textColor }) => {\n return (\n <div className=\"cost-text-container\">\n <div className=\"cost-number\" style={{ color: textColor }}>\n {cost}\n </div>\n <div className=\"cost-unit\" style={{ color: textColor }}>\n €\n </div>\n <div className=\"cost-unit-per\" style={{ color: textColor }}>\n /Mwh\n </div>\n </div>\n );\n};\n","import React from \"react\";\nimport \"./Avatar.css\";\n\ninterface AvatarProps {\n children: React.ReactNode;\n}\n\nexport const Avatar: React.FC<AvatarProps> = ({ children }) => {\n return (\n <div className=\"avatar-container avatar-container--clickable\">\n <div className=\"avatar-content\">{children}</div>\n </div>\n );\n};\n","import React, { useEffect, useState } from \"react\";\nimport \"./Histogram.css\";\n\ninterface HistogramProps {\n /** Maximum value configuration with value and color */\n max: {\n value: number;\n color: string;\n opacity?: number;\n };\n /** Relative/current value configuration with value and color */\n relative: {\n value: number;\n color: string;\n };\n /** Height of the histogram bar in pixels */\n barHeight?: number;\n /** Width of the histogram bar in pixels */\n barWidth?: number;\n /** Orientation of the histogram - 'vertical' or 'horizontal' */\n orientation?: 'vertical' | 'horizontal';\n /** Corner radius configuration for individual corners */\n cornerRadius?: {\n topLeft?: number;\n topRight?: number;\n bottomLeft?: number;\n bottomRight?: number;\n };\n /** Child components (typically text content) */\n children?: React.ReactNode;\n}\n\nexport const Histogram: React.FC<HistogramProps> = ({\n max,\n relative,\n barHeight = 103,\n barWidth = 32,\n orientation = 'vertical',\n cornerRadius,\n children,\n}) => {\n const [animatedHeight, setAnimatedHeight] = useState(0);\n const [animatedWidth, setAnimatedWidth] = useState(0);\n\n // Calculate target dimensions based on orientation\n const targetHeight = (Math.min((relative.value / max.value) * 100, 100) / 100) * barHeight;\n const targetWidth = (Math.min((relative.value / max.value) * 100, 100) / 100) * barWidth;\n\n // Simple Chart.js-like animation: always animate from 0 to target\n useEffect(() => {\n setAnimatedHeight(0);\n setAnimatedWidth(0);\n \n const startTime = Date.now();\n const duration = 1000;\n\n const animate = () => {\n const elapsed = Date.now() - startTime;\n const progress = Math.min(elapsed / duration, 1);\n\n // Chart.js-like easing (easeOutQuart)\n const easeOutQuart = 1 - Math.pow(1 - progress, 4);\n \n setAnimatedHeight(targetHeight * easeOutQuart);\n setAnimatedWidth(targetWidth * easeOutQuart);\n\n if (progress < 1) {\n requestAnimationFrame(animate);\n }\n };\n\n requestAnimationFrame(animate);\n }, [targetHeight, targetWidth]);\n\n const displayWidth = orientation === 'horizontal' ? barHeight : barWidth;\n const displayHeight = orientation === 'horizontal' ? barWidth : barHeight;\n const svgWidth = orientation === 'horizontal' ? barHeight : barWidth;\n const svgHeight = orientation === 'horizontal' ? barWidth : barHeight;\n\n // Helper function to create rounded rectangle path\n const createRoundedRectPath = (\n x: number,\n y: number,\n width: number,\n height: number,\n radii: { topLeft: number; topRight: number; bottomLeft: number; bottomRight: number }\n ) => {\n const { topLeft, topRight, bottomLeft, bottomRight } = radii;\n \n return `\n M ${x + topLeft} ${y}\n L ${x + width - topRight} ${y}\n Q ${x + width} ${y} ${x + width} ${y + topRight}\n L ${x + width} ${y + height - bottomRight}\n Q ${x + width} ${y + height} ${x + width - bottomRight} ${y + height}\n L ${x + bottomLeft} ${y + height}\n Q ${x} ${y + height} ${x} ${y + height - bottomLeft}\n L ${x} ${y + topLeft}\n Q ${x} ${y} ${x + topLeft} ${y}\n Z\n `.trim().replace(/\\s+/g, ' ');\n };\n\n // Default corner radius values\n const defaultCornerRadius = { topLeft: 2, topRight: 2, bottomLeft: 2, bottomRight: 2 };\n const corners = cornerRadius ? {\n topLeft: cornerRadius.topLeft ?? defaultCornerRadius.topLeft,\n topRight: cornerRadius.topRight ?? defaultCornerRadius.topRight,\n bottomLeft: cornerRadius.bottomLeft ?? defaultCornerRadius.bottomLeft,\n bottomRight: cornerRadius.bottomRight ?? defaultCornerRadius.bottomRight,\n } : defaultCornerRadius;\n\n return (\n <div className={`histogram-container ${orientation === 'horizontal' ? 'histogram-container--horizontal' : ''}`}>\n <div className={`histogram-content ${orientation === 'horizontal' ? 'histogram-content--horizontal' : ''}`}>\n <div \n className=\"histogram-bar\"\n style={{\n height: `${displayHeight}px`,\n width: `${displayWidth}px`\n }}\n >\n <svg\n width={svgWidth}\n height={svgHeight}\n viewBox={`0 0 ${svgWidth} ${svgHeight}`}\n className=\"histogram-svg\"\n >\n {/* Background bar (max value) */}\n <path\n d={createRoundedRectPath(0, 0, svgWidth, svgHeight, corners)}\n fill={max.color}\n fillOpacity={max.opacity || 1}\n />\n {/* Foreground bar (relative value) with animation */}\n {orientation === 'vertical' ? (\n <path\n d={createRoundedRectPath(\n 0,\n svgHeight - animatedHeight,\n svgWidth,\n animatedHeight,\n {\n topLeft: animatedHeight >= svgHeight ? corners.topLeft : 0,\n topRight: animatedHeight >= svgHeight ? corners.topRight : 0,\n bottomLeft: corners.bottomLeft,\n bottomRight: corners.bottomRight,\n }\n )}\n fill={relative.color}\n />\n ) : (\n <path\n d={createRoundedRectPath(\n 0,\n 0,\n animatedWidth,\n svgHeight,\n {\n topLeft: corners.topLeft,\n topRight: animatedWidth >= svgWidth ? corners.topRight : 0,\n bottomLeft: corners.bottomLeft,\n bottomRight: animatedWidth >= svgWidth ? corners.bottomRight : 0,\n }\n )}\n fill={relative.color}\n />\n )}\n </svg>\n </div>\n {children && (\n <div className={`histogram-text-container ${orientation === 'horizontal' ? 'histogram-text-container--horizontal' : ''}`}>\n {children}\n </div>\n )}\n </div>\n </div>\n );\n};\n","import { useState } from \"react\";\nimport { Input } from \"./Input\";\nimport { Switch } from \"./Switch\";\nimport \"./ProductionUnit.css\";\nimport { Chip } from \"./Chip\";\nimport { ProductionUnitContainer } from \"./ProductionUnitContainer\";\nimport { MwhCost } from \".\";\n\ntype ProductionUnitLimit = {\n value: number;\n label?: string;\n};\ninterface ProductionUnitProps {\n onChangeInput?: (value: number) => void;\n onChangeSwitch?: (checked: boolean) => void;\n defaultValue?: number;\n defaultChecked?: boolean;\n value?: number;\n checked?: boolean;\n unitName?: string;\n energyCost?: number;\n checkedImage?: React.ReactNode;\n uncheckedImage?: React.ReactNode;\n readonly?: boolean;\n min?: ProductionUnitLimit;\n max?: ProductionUnitLimit;\n}\nexport const ProductionUnit = ({\n onChangeInput,\n onChangeSwitch,\n defaultValue,\n defaultChecked = false,\n value,\n checked,\n unitName = \"Production Unit\",\n energyCost = 0,\n checkedImage,\n uncheckedImage,\n readonly = false,\n min = { value: 10, label: \"Pmin\" },\n max = { value: 100, label: \"Pmax\" },\n}: ProductionUnitProps) => {\n // Internal state management for uncontrolled mode\n const [internalChecked, setInternalChecked] = useState(defaultChecked);\n const [internalValue, setInternalValue] = useState(defaultValue);\n\n // Use controlled props if provided, otherwise use internal state\n const isChecked = checked !== undefined ? checked : internalChecked;\n const currentValue = value !== undefined ? value : internalValue;\n\n const handleSwitchChange = (newChecked: boolean) => {\n // Update internal state only if uncontrolled\n if (checked === undefined) {\n setInternalChecked(newChecked);\n }\n\n // Notify parent component if handler provided\n if (onChangeSwitch) {\n onChangeSwitch(newChecked);\n }\n };\n\n const handleInputChange = (val: string) => {\n const numValue = Number(val);\n // Update internal state only if uncontrolled\n if (value === undefined) {\n setInternalValue(numValue);\n }\n\n // Notify parent component if handler provided\n if (onChangeInput) {\n onChangeInput(numValue);\n }\n };\n\n return (\n <ProductionUnitContainer>\n <div className=\"production-unit-container\">\n <div className=\"production-unit-content\">\n <div className=\"image-preview-container\">\n {isChecked ? checkedImage : uncheckedImage}\n </div>\n <div className=\"production-unit-chip\">\n <div className=\"production-unit-chip-name\">{unitName}</div>\n\n <Chip width=\"fit-content\" bgColor=\"#E1F5FD\">\n <MwhCost cost={energyCost} textColor=\"#005896\" />\n </Chip>\n </div>\n <div className=\"production-unit-switch-container\">\n <Input\n label=\"PA\"\n type=\"number\"\n onChange={handleInputChange}\n value={\n currentValue !== undefined ? currentValue.toString() : undefined\n }\n disabled={!isChecked || readonly}\n min={{ value: min.value, label: min.label }}\n max={{ value: max.value, label: max.label }}\n />{\" \"}\n </div>\n </div>\n\n <Switch\n checked={isChecked}\n onChange={handleSwitchChange}\n disabled={readonly}\n />\n </div>\n </ProductionUnitContainer>\n );\n};\n"],"names":["Input","_a","label","_b","value","onChange","_c","type","_d","disabled","_e","className","_f","required","_g","min","_h","max","_j","useState","internalValue","setInternalValue","_k","isFocused","setIsFocused","_l","isOutOfRange","setIsOutOfRange","inputRef","useRef","useEffect","containerClasses","length","filter","Boolean","join","_jsx","jsx","children","_jsxs","jsxs","ref","e","newValue","target","numValue","parseFloat","isNaN","outOfRange","onFocus","onBlur","clampedValue","Math","clampedString","toString","undefined","step","ImgOn","isOff","width","height","viewBox","fill","xmlns","d","SwitchThumb","cx","cy","r","Switch","checked","showIcon","internalChecked","setInternalChecked","isChecked","switchClasses","wrapperClasses","role","onClick","newChecked","Chip","bgColor","chipClasses","style","backgroundColor","ProductionUnitContainer","MwhCost","cost","textColor","color","relative","barHeight","barWidth","orientation","cornerRadius","animatedHeight","setAnimatedHeight","animatedWidth","setAnimatedWidth","targetHeight","targetWidth","startTime","Date","now","animate","elapsed","progress","easeOutQuart","pow","requestAnimationFrame","displayWidth","displayHeight","svgWidth","svgHeight","createRoundedRectPath","x","y","radii","topLeft","topRight","bottomLeft","bottomRight","concat","trim","replace","defaultCornerRadius","corners","fillOpacity","opacity","onChangeInput","onChangeSwitch","defaultValue","defaultChecked","unitName","energyCost","checkedImage","uncheckedImage","readonly","currentValue","val","Number"],"mappings":"mEAeaA,EAA8B,SAACC,GAC1C,IAAAC,EAAKD,EAAAC,MACLC,EAAUF,EAAAG,MAAVA,OAAQ,IAAAD,EAAA,GAAEA,EACVE,EAAQJ,EAAAI,SACRC,EAAAL,EAAAM,KAAAA,OAAI,IAAAD,EAAG,OAAMA,EACbE,EAAAP,EAAAQ,SAAAA,cAAgBD,EAChBE,EAAAT,EAAAU,UAAAA,OAAY,IAAAD,EAAA,KACZE,EAAAX,EAAAY,SAAAA,OAAW,IAAAD,GAAKA,EAChBE,QAAAC,OAAM,IAAAD,EAAA,CAAEV,MAAO,EAAGF,MAAO,QAAQ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GACFA,EAAenD,EAEnB,EA+CQtE,SAAUgI,QAKpB"}
1
+ {"version":3,"file":"index.js","sources":["../src/components/InputNumber.tsx","../src/components/Switch.tsx","../src/components/Chip.tsx","../src/components/ProductionUnitContainer.tsx","../src/components/MwhCost.tsx","../src/components/Avatar.tsx","../src/components/Histogram.tsx","../src/components/ProductionUnit.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect } from \"react\";\nimport \"./InputNumber.css\";\n\ninterface InputNumberProps {\n label: string;\n value?: string;\n onChange?: (value: string) => void;\n disabled?: boolean;\n className?: string;\n required?: boolean;\n min?: { value: number; label?: string };\n max?: { value: number; label?: string };\n}\n\nexport const InputNumber: React.FC<InputNumberProps> = ({\n label,\n value = \"\",\n onChange,\n disabled = false,\n className = \"\",\n required = false,\n min = { value: 0, label: \"Pmin\" },\n max = { value: 100, label: \"Pmax\" },\n}) => {\n const [internalValue, setInternalValue] = useState(value);\n const [isFocused, setIsFocused] = useState(false);\n const [isOutOfRange, setIsOutOfRange] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n setInternalValue(value);\n }, [value]);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value;\n\n // Check if value is out of range for visual feedback\n if (newValue !== \"\") {\n const numValue = parseFloat(newValue);\n if (!isNaN(numValue)) {\n const outOfRange = numValue < min.value || numValue > max.value;\n setIsOutOfRange(outOfRange);\n } else {\n setIsOutOfRange(false);\n }\n } else {\n setIsOutOfRange(false);\n }\n\n // Allow typing without immediate clamping to enable multi-digit entry\n setInternalValue(newValue);\n onChange?.(newValue);\n };\n const handleFocus = () => {\n setIsFocused(true);\n };\n\n const handleBlur = () => {\n setIsFocused(false);\n\n // Clamp value on blur\n if (internalValue !== \"\") {\n const numValue = parseFloat(internalValue);\n if (!isNaN(numValue)) {\n const clampedValue = Math.max(min.value, Math.min(max.value, numValue));\n if (clampedValue !== numValue) {\n const clampedString = clampedValue.toString();\n setInternalValue(clampedString);\n onChange?.(clampedString);\n }\n setIsOutOfRange(false); // Reset out-of-range state after clamping\n }\n }\n };\n\n const isLabelFloating = isFocused || internalValue.length > 0;\n\n const containerClasses = [\n \"input-container\",\n isFocused ? \"input-container--focused\" : \"\",\n isLabelFloating ? \"input-container--floating\" : \"\",\n disabled ? \"input-container--disabled\" : \"\",\n isOutOfRange ? \"input-container--error\" : \"\",\n className,\n ]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <div className={containerClasses}>\n <div className=\"input-constraints\">\n <div className=\"input-min\">\n {min.label}\n <br />\n {min.value}\n </div>\n\n <div className=\"input-field\">\n <input\n ref={inputRef}\n type=\"number\"\n value={internalValue}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n disabled={disabled}\n required={required}\n className=\"input-element\"\n aria-label={label}\n min={min.value}\n max={max.value}\n step={1}\n />\n <label className=\"input-label\">\n {label}\n {required && <span className=\"input-required\">*</span>}\n </label>\n </div>\n <div className=\"input-max\">\n {max.label}\n <br /> {max.value}\n </div>\n </div>\n </div>\n );\n};\n","import React, { useState } from \"react\";\nimport \"./Switch.css\";\n\ninterface OnProps {\n isOff?: boolean;\n}\nconst ImgOn = ({ isOff }: OnProps) => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M9.56529 2.85352C9.66365 2.57607 9.96837 2.43116 10.246 2.5293C13.4295 3.65507 15.3392 6.91015 14.7684 10.2383C14.1974 13.5667 11.3114 16 7.93443 16C4.55739 16 1.67151 13.5667 1.10045 10.2383C0.5296 6.91011 2.4393 3.65504 5.62291 2.5293C5.9005 2.43115 6.20523 2.57605 6.30357 2.85352C6.40176 3.13124 6.2561 3.43599 5.97838 3.53418C3.28438 4.48672 1.669 7.2423 2.1522 10.0586C2.63557 12.8747 5.07706 14.9336 7.93443 14.9336C10.7918 14.9336 13.2333 12.8747 13.7167 10.0586C14.1999 7.24233 12.5844 4.48676 9.89049 3.53418C9.61276 3.43599 9.4671 3.13124 9.56529 2.85352ZM7.93443 0C8.22892 3.10447e-05 8.46754 0.238727 8.46763 0.533203V7.4668C8.46763 7.76135 8.22898 8.00095 7.93443 8.00098C7.63986 8.00098 7.40123 7.76137 7.40123 7.4668V0.533203C7.40132 0.238707 7.63991 0 7.93443 0Z\"\n fill={isOff ? \"#999FA1\" : \"#009CDF\"}\n />\n </svg>\n);\nconst SwitchThumb = ({ isOff }: OnProps) => (\n <svg\n width=\"32\"\n height=\"32\"\n viewBox=\"0 0 32 32\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle cx=\"16\" cy=\"16\" r=\"16\" fill={isOff ? \"white\" : \"#009cdf\"} />\n </svg>\n);\n\ninterface SwitchProps {\n checked?: boolean;\n onChange?: (checked: boolean) => void;\n disabled?: boolean;\n showIcon?: boolean;\n label?: string;\n}\n\nexport const Switch: React.FC<SwitchProps> = ({\n checked = false,\n onChange,\n disabled = false,\n showIcon = true,\n label,\n}) => {\n const [internalChecked, setInternalChecked] = useState(checked);\n\n // Use controlled value if provided, otherwise use internal state\n const isChecked = checked !== undefined ? checked : internalChecked;\n\n const handleToggle = () => {\n if (disabled) return;\n\n const newChecked = !isChecked;\n // Only update internal state if uncontrolled\n if (checked === undefined) {\n setInternalChecked(newChecked);\n }\n onChange?.(newChecked);\n };\n\n const switchClasses = [\n \"switch\",\n isChecked ? \"switch--checked\" : \"\",\n disabled ? \"switch--disabled\" : \"\",\n ]\n .filter(Boolean)\n .join(\" \");\n\n const wrapperClasses = [\n \"switch-wrapper\",\n isChecked ? \"switch-wrapper--checked\" : \"\",\n ]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <div className=\"switch-container\">\n <div className={wrapperClasses}>\n {showIcon ? (\n <div className=\"switch-icon\">\n <ImgOn isOff={!isChecked} />\n </div>\n ) : label ? (\n <div className=\"switch-label\">{label}</div>\n ) : null}\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={isChecked}\n className={switchClasses}\n onClick={handleToggle}\n disabled={disabled}\n >\n <span className=\"switch-track\">\n <span className=\"switch-thumb\">\n <SwitchThumb isOff={!isChecked} />\n </span>\n </span>\n </button>\n </div>\n </div>\n );\n};\n","import React from \"react\";\nimport \"./Chip.css\";\n\ninterface ChipProps {\n // Define any props you want to pass to the Chip component\n children: React.ReactNode;\n bgColor?: string;\n width?: \"fit-content\" | \"full-width\";\n}\n\nexport const Chip: React.FC<ChipProps> = ({\n children,\n bgColor,\n width = \"fit-content\",\n}) => {\n const chipClasses = [\n \"chip-container\",\n width === \"full-width\"\n ? \"chip-container--full-width\"\n : \"chip-container--fit-content\",\n ].join(\" \");\n\n return (\n <div className={chipClasses} style={{ backgroundColor: bgColor }}>\n <div className=\"chip-content\">\n <div className=\"chip-label\">{children}</div>\n </div>\n </div>\n );\n};\n","import \"./ProductionUnitContainer.css\";\n\ninterface ProductionUnitContainerProps {\n bgColor?: string;\n children: React.ReactNode;\n height?: string;\n}\nexport const ProductionUnitContainer = ({\n bgColor = \"#fff\",\n children,\n height,\n}: ProductionUnitContainerProps) => {\n return (\n <div\n className=\"production-unit-container-box\"\n style={{ backgroundColor: bgColor, height }}\n >\n {children}\n </div>\n );\n};\n","import React from \"react\";\nimport \"./MwhCost.css\";\n\ninterface MwhCostProps {\n cost?: number;\n textColor?: string;\n}\n\nexport const MwhCost: React.FC<MwhCostProps> = ({ cost, textColor }) => {\n return (\n <div className=\"cost-text-container\">\n <div className=\"cost-number\" style={{ color: textColor }}>\n {cost}\n </div>\n <div className=\"cost-unit\" style={{ color: textColor }}>\n €\n </div>\n <div className=\"cost-unit-per\" style={{ color: textColor }}>\n /Mwh\n </div>\n </div>\n );\n};\n","import React from \"react\";\nimport \"./Avatar.css\";\n\ninterface AvatarProps {\n children: React.ReactNode;\n}\n\nexport const Avatar: React.FC<AvatarProps> = ({ children }) => {\n return (\n <div className=\"avatar-container avatar-container--clickable\">\n <div className=\"avatar-content\">{children}</div>\n </div>\n );\n};\n","import React, { useEffect, useState } from \"react\";\nimport \"./Histogram.css\";\n\ninterface HistogramProps {\n /** Maximum value configuration with value and color */\n max: {\n value: number;\n color: string;\n opacity?: number;\n };\n /** Relative/current value configuration with value and color */\n relative: {\n value: number;\n color: string;\n };\n /** Height of the histogram bar in pixels */\n barHeight?: number;\n /** Width of the histogram bar in pixels */\n barWidth?: number;\n /** Orientation of the histogram - 'vertical' or 'horizontal' */\n orientation?: 'vertical' | 'horizontal';\n /** Corner radius configuration for individual corners */\n cornerRadius?: {\n topLeft?: number;\n topRight?: number;\n bottomLeft?: number;\n bottomRight?: number;\n };\n /** Child components (typically text content) */\n children?: React.ReactNode;\n}\n\nexport const Histogram: React.FC<HistogramProps> = ({\n max,\n relative,\n barHeight = 103,\n barWidth = 32,\n orientation = 'vertical',\n cornerRadius,\n children,\n}) => {\n const [animatedHeight, setAnimatedHeight] = useState(0);\n const [animatedWidth, setAnimatedWidth] = useState(0);\n\n // Calculate target dimensions based on orientation\n const targetHeight = (Math.min((relative.value / max.value) * 100, 100) / 100) * barHeight;\n const targetWidth = (Math.min((relative.value / max.value) * 100, 100) / 100) * barWidth;\n\n // Simple Chart.js-like animation: always animate from 0 to target\n useEffect(() => {\n setAnimatedHeight(0);\n setAnimatedWidth(0);\n \n const startTime = Date.now();\n const duration = 1000;\n\n const animate = () => {\n const elapsed = Date.now() - startTime;\n const progress = Math.min(elapsed / duration, 1);\n\n // Chart.js-like easing (easeOutQuart)\n const easeOutQuart = 1 - Math.pow(1 - progress, 4);\n \n setAnimatedHeight(targetHeight * easeOutQuart);\n setAnimatedWidth(targetWidth * easeOutQuart);\n\n if (progress < 1) {\n requestAnimationFrame(animate);\n }\n };\n\n requestAnimationFrame(animate);\n }, [targetHeight, targetWidth]);\n\n const displayWidth = orientation === 'horizontal' ? barHeight : barWidth;\n const displayHeight = orientation === 'horizontal' ? barWidth : barHeight;\n const svgWidth = orientation === 'horizontal' ? barHeight : barWidth;\n const svgHeight = orientation === 'horizontal' ? barWidth : barHeight;\n\n // Helper function to create rounded rectangle path\n const createRoundedRectPath = (\n x: number,\n y: number,\n width: number,\n height: number,\n radii: { topLeft: number; topRight: number; bottomLeft: number; bottomRight: number }\n ) => {\n const { topLeft, topRight, bottomLeft, bottomRight } = radii;\n \n return `\n M ${x + topLeft} ${y}\n L ${x + width - topRight} ${y}\n Q ${x + width} ${y} ${x + width} ${y + topRight}\n L ${x + width} ${y + height - bottomRight}\n Q ${x + width} ${y + height} ${x + width - bottomRight} ${y + height}\n L ${x + bottomLeft} ${y + height}\n Q ${x} ${y + height} ${x} ${y + height - bottomLeft}\n L ${x} ${y + topLeft}\n Q ${x} ${y} ${x + topLeft} ${y}\n Z\n `.trim().replace(/\\s+/g, ' ');\n };\n\n // Default corner radius values\n const defaultCornerRadius = { topLeft: 2, topRight: 2, bottomLeft: 2, bottomRight: 2 };\n const corners = cornerRadius ? {\n topLeft: cornerRadius.topLeft ?? defaultCornerRadius.topLeft,\n topRight: cornerRadius.topRight ?? defaultCornerRadius.topRight,\n bottomLeft: cornerRadius.bottomLeft ?? defaultCornerRadius.bottomLeft,\n bottomRight: cornerRadius.bottomRight ?? defaultCornerRadius.bottomRight,\n } : defaultCornerRadius;\n\n return (\n <div className={`histogram-container ${orientation === 'horizontal' ? 'histogram-container--horizontal' : ''}`}>\n <div className={`histogram-content ${orientation === 'horizontal' ? 'histogram-content--horizontal' : ''}`}>\n <div \n className=\"histogram-bar\"\n style={{\n height: `${displayHeight}px`,\n width: `${displayWidth}px`\n }}\n >\n <svg\n width={svgWidth}\n height={svgHeight}\n viewBox={`0 0 ${svgWidth} ${svgHeight}`}\n className=\"histogram-svg\"\n >\n {/* Background bar (max value) */}\n <path\n d={createRoundedRectPath(0, 0, svgWidth, svgHeight, corners)}\n fill={max.color}\n fillOpacity={max.opacity || 1}\n />\n {/* Foreground bar (relative value) with animation */}\n {orientation === 'vertical' ? (\n <path\n d={createRoundedRectPath(\n 0,\n svgHeight - animatedHeight,\n svgWidth,\n animatedHeight,\n {\n topLeft: animatedHeight >= svgHeight ? corners.topLeft : 0,\n topRight: animatedHeight >= svgHeight ? corners.topRight : 0,\n bottomLeft: corners.bottomLeft,\n bottomRight: corners.bottomRight,\n }\n )}\n fill={relative.color}\n />\n ) : (\n <path\n d={createRoundedRectPath(\n 0,\n 0,\n animatedWidth,\n svgHeight,\n {\n topLeft: corners.topLeft,\n topRight: animatedWidth >= svgWidth ? corners.topRight : 0,\n bottomLeft: corners.bottomLeft,\n bottomRight: animatedWidth >= svgWidth ? corners.bottomRight : 0,\n }\n )}\n fill={relative.color}\n />\n )}\n </svg>\n </div>\n {children && (\n <div className={`histogram-text-container ${orientation === 'horizontal' ? 'histogram-text-container--horizontal' : ''}`}>\n {children}\n </div>\n )}\n </div>\n </div>\n );\n};\n","import { useState } from \"react\";\nimport { InputNumber } from \"./InputNumber\";\nimport { Switch } from \"./Switch\";\nimport \"./ProductionUnit.css\";\nimport { Chip } from \"./Chip\";\nimport { ProductionUnitContainer } from \"./ProductionUnitContainer\";\nimport { MwhCost } from \".\";\n\ntype ProductionUnitLimit = {\n value: number;\n label?: string;\n};\ninterface ProductionUnitProps {\n onChangeInput?: (value: number) => void;\n onChangeSwitch?: (checked: boolean) => void;\n defaultValue?: number;\n defaultChecked?: boolean;\n value?: number;\n checked?: boolean;\n unitName?: string;\n energyCost?: number;\n checkedImage?: React.ReactNode;\n uncheckedImage?: React.ReactNode;\n readonly?: boolean;\n min?: ProductionUnitLimit;\n max?: ProductionUnitLimit;\n}\nexport const ProductionUnit = ({\n onChangeInput,\n onChangeSwitch,\n defaultValue,\n defaultChecked = false,\n value,\n checked,\n unitName = \"Production Unit\",\n energyCost = 0,\n checkedImage,\n uncheckedImage,\n readonly = false,\n min = { value: 10, label: \"Pmin\" },\n max = { value: 100, label: \"Pmax\" },\n}: ProductionUnitProps) => {\n // Internal state management for uncontrolled mode\n const [internalChecked, setInternalChecked] = useState(defaultChecked);\n const [internalValue, setInternalValue] = useState(defaultValue);\n\n // Use controlled props if provided, otherwise use internal state\n const isChecked = checked !== undefined ? checked : internalChecked;\n const currentValue = value !== undefined ? value : internalValue;\n\n const handleSwitchChange = (newChecked: boolean) => {\n // Update internal state only if uncontrolled\n if (checked === undefined) {\n setInternalChecked(newChecked);\n }\n\n // Notify parent component if handler provided\n if (onChangeSwitch) {\n onChangeSwitch(newChecked);\n }\n };\n\n const handleInputChange = (val: string) => {\n // Only convert to number if the string is not empty and is a valid number\n if (val === \"\") {\n // Handle empty string case\n if (value === undefined) {\n setInternalValue(undefined);\n }\n if (onChangeInput) {\n onChangeInput(0); // or whatever default you prefer for empty values\n }\n return;\n }\n\n const numValue = parseFloat(val);\n if (!isNaN(numValue)) {\n // Update internal state only if uncontrolled\n if (value === undefined) {\n setInternalValue(numValue);\n }\n\n // Notify parent component if handler provided\n if (onChangeInput) {\n onChangeInput(numValue);\n }\n }\n };\n\n return (\n <ProductionUnitContainer>\n <div className=\"production-unit-container\">\n <div className=\"production-unit-content\">\n <div className=\"image-preview-container\">\n {isChecked ? checkedImage : uncheckedImage}\n </div>\n <div className=\"production-unit-chip\">\n <div className=\"production-unit-chip-name\">{unitName}</div>\n\n <Chip width=\"fit-content\" bgColor=\"#E1F5FD\">\n <MwhCost cost={energyCost} textColor=\"#005896\" />\n </Chip>\n </div>\n <div className=\"production-unit-switch-container\">\n <InputNumber\n label=\"PA\"\n onChange={handleInputChange}\n value={\n currentValue !== undefined ? currentValue.toString() : undefined\n }\n disabled={!isChecked || readonly}\n min={{ value: min.value, label: min.label }}\n max={{ value: max.value, label: max.label }}\n />{\" \"}\n </div>\n </div>\n\n <Switch\n checked={isChecked}\n onChange={handleSwitchChange}\n disabled={readonly}\n />\n </div>\n </ProductionUnitContainer>\n );\n};\n"],"names":["InputNumber","_a","label","_b","value","onChange","_c","disabled","_d","className","_e","required","_f","min","_g","max","_h","useState","internalValue","setInternalValue","_j","isFocused","setIsFocused","_k","isOutOfRange","setIsOutOfRange","inputRef","useRef","useEffect","containerClasses","length","filter","Boolean","join","_jsx","children","_jsxs","jsxs","jsx","ref","type","e","newValue","target","numValue","parseFloat","isNaN","outOfRange","onFocus","onBlur","clampedValue","Math","clampedString","toString","step","ImgOn","isOff","width","height","viewBox","fill","xmlns","d","SwitchThumb","cx","cy","r","Switch","checked","showIcon","internalChecked","setInternalChecked","isChecked","undefined","switchClasses","wrapperClasses","role","onClick","newChecked","Chip","bgColor","chipClasses","style","backgroundColor","ProductionUnitContainer","MwhCost","cost","textColor","color","relative","barHeight","barWidth","orientation","cornerRadius","animatedHeight","setAnimatedHeight","animatedWidth","setAnimatedWidth","targetHeight","targetWidth","startTime","Date","now","animate","elapsed","progress","easeOutQuart","pow","requestAnimationFrame","displayWidth","displayHeight","svgWidth","svgHeight","createRoundedRectPath","x","y","radii","topLeft","topRight","bottomLeft","bottomRight","concat","trim","replace","defaultCornerRadius","corners","fillOpacity","opacity","onChangeInput","onChangeSwitch","defaultValue","defaultChecked","unitName","energyCost","checkedImage","uncheckedImage","readonly","currentValue","val"],"mappings":"mEAcaA,EAA0C,SAACC,GACtD,IAAAC,EAAKD,EAAAC,MACLC,EAAUF,EAAAG,MAAVA,OAAK,IAAAD,EAAG,GAAEA,EACVE,EAAQJ,EAAAI,SACRC,EAAgBL,EAAAM,SAAhBA,OAAQ,IAAAD,GAAQA,EAChBE,EAAAP,EAAAQ,UAAAA,OAAY,IAAAD,EAAA,GAAEA,EACdE,EAAgBT,EAAAU,SAAhBA,OAAQ,IAAAD,GAAQA,EAChBE,EAAAX,EAAAY,IAAAA,OAAM,IAAAD,EAAA,CAAER,MAAO,EAAGF,MAAO,QAAQU,EACjCE,EAAmCb,EAAAc,IAAnCA,OAAG,IAAAD,EAAG,CAAEV,MAAO,IAAKF,MAAO,QAAQY,EAE7BE,EAAoCC,EAAAA,SAASb,GAA5Cc,EAAaF,EAAA,GAAEG,EAAgBH,EAAA,GAChCI,EAA4BH,EAAAA,UAAS,GAApCI,EAASD,EAAA,GAAEE,EAA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8C,EACC,CAAAjD,SAAAC,EAAAC,KAAA,MAAA,CAAK5B,UAAU,4BACb0B,SAAA,CAAAC,EAAAC,KAAA,MAAA,CAAK5B,UAAU,0BACb0B,SAAA,CAAAD,EAAAA,IAAA,MAAA,CAAKzB,UAAU,0BACZ0B,SAAAqC,EAAY8D,EAAeC,IAE9BnG,EAAAA,YAAK3B,UAAU,uBACb0B,SAAA,CAAAD,EAAAA,IAAA,MAAA,CAAKzB,UAAU,4BAA6B0B,SAAAiG,IAE5ClG,EAAAI,IAACyC,EAAI,CAACtB,MAAM,cAAcuB,QAAQ,UAAS7C,SACzCD,EAAAA,IAACmD,EAAO,CAACC,KAAM+C,EAAY9C,UAAU,iBAGzCnD,EAAAA,KAAK,MAAA,CAAA3B,UAAU,6CACbyB,MAAClC,GACCE,MAAM,KACNG,SA5Cc,SAACqI,GAEzB,GAAY,KAARA,EAQF,YANcjE,IAAVrE,GACFe,OAAiBsD,QAEfuD,GACFA,EAAc,IAKlB,IAAMpF,EAAWC,WAAW6F,GACvB5F,MAAMF,UAEK6B,IAAVrE,GACFe,EAAiByB,GAIfoF,GACFA,EAAcpF,GAGpB,EAoBYxC,WACmBqE,IAAjBgE,EAA6BA,EAAapF,gBAAaoB,EAEzDlE,UAAWiE,GAAagE,EACxB3H,IAAK,CAAET,MAAOS,EAAIT,MAAOF,MAAOW,EAAIX,OACpCa,IAAK,CAAEX,MAAOW,EAAIX,MAAOF,MAAOa,EAAIb,SACnC,UAIPgC,EAAAA,IAACiC,EACC,CAAAC,QAASI,EACTnE,SArEmB,SAACyE,QAEVL,IAAZL,GACFG,EAAmBO,GAIjBmD,GACFA,EAAenD,EAEnB,EA4DQvE,SAAUiI,QAKpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rte-utils",
3
- "version": "1.2.26",
3
+ "version": "1.2.28",
4
4
  "description": "React components library in TypeScript for agigox projects",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",