@widergy/energy-ui 3.187.0 → 3.187.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [3.187.1](https://github.com/widergy/energy-ui/compare/v3.187.0...v3.187.1) (2026-09-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* minor datepicker visual fix ([#866](https://github.com/widergy/energy-ui/issues/866)) ([3a99556](https://github.com/widergy/energy-ui/commit/3a99556a1cc25f2521b80800734582c09b930e9d))
|
|
7
|
+
|
|
1
8
|
# [3.187.0](https://github.com/widergy/energy-ui/compare/v3.186.1...v3.187.0) (2026-09-16)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=_interopRequireWildcard(require("react")),_Popover=_interopRequireDefault(require("@material-ui/core/Popover")),_dayjs=_interopRequireDefault(require("dayjs")),_customParseFormat=_interopRequireDefault(require("dayjs/plugin/customParseFormat")),_propTypes=require("prop-types"),_UTBaseInputField=_interopRequireDefault(require("../../../UTBaseInputField")),_UTButton=_interopRequireDefault(require("../../../UTButton")),_UTFieldLabel=_interopRequireDefault(require("../../../UTFieldLabel")),_UTLabel=_interopRequireDefault(require("../../../UTLabel")),_UTValidation=_interopRequireDefault(require("../../../UTValidation")),_constants=require("../../../UTBaseInputField/constants"),_Calendar=_interopRequireDefault(require("./components/Calendar")),_stylesModule=_interopRequireDefault(require("./styles.module.scss")),_constants2=require("./constants"),_utils=require("./utils");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var a=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var n,l,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(n=t?r:a){if(n.has(e))return n.get(e);n.set(e,s)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((l=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(l.get||l.set)?n(s,t,l):s[t]=e[t]);return s})(e,t)}function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)({}).hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},_extends.apply(null,arguments)}_dayjs.default.extend(_customParseFormat.default);const CALENDAR_PAPER_PROPS={className:_stylesModule.default.calendarPaper,onMouseDown:e=>e.preventDefault()},UTDatePicker=e=>{let{classNames:t={},CustomIcon:a,dataTestId:r,disabled:n,error:l="",helpText:s,onChange:o=()=>{},placeholder:i,popoverProps:u,range:c,readOnly:_=!1,required:d,size:p=_constants2.DEFAULT_PROPS.size,title:f,value:T="",variant:m=_constants2.DEFAULT_PROPS.variant}=e;const{maxDate:y,minDate:v}=c||{},[P,U]=(0,_react.useState)(null),[E,D]=(0,_react.useState)(!1),[A,g]=(0,_react.useState)(""),[L,O]=(0,_react.useState)(!1),[h,M]=(0,_react.useState)(!1),q=(0,_react.useRef)(null),R=(0,_react.useRef)(null);(0,_react.useEffect)(()=>{D(!1),g(""),M(!1),!T&&null!=P&&P.isValid()?U(null):(0,_utils.dateMatchesFormat)(T,_constants2.OUTPUT_LABEL_MASK)?U((0,_dayjs.default)(T,_constants2.OUTPUT_LABEL_MASK)):U(null)},[T]);const S=()=>{var e;n||_||(O(!0),null===(e=R.current)||void 0===e||e.focus())},b=E?A:null!=P&&P.isValid()?P.format(_constants2.OUTPUT_LABEL_MASK):"",F=!!l||h,B=null==P?void 0:P.isValid(),x=i||_constants2.DEFAULT_PLACEHOLDER,j=F&&!n,I=(B||E)&&!n&&!_,C
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=_interopRequireWildcard(require("react")),_Popover=_interopRequireDefault(require("@material-ui/core/Popover")),_dayjs=_interopRequireDefault(require("dayjs")),_customParseFormat=_interopRequireDefault(require("dayjs/plugin/customParseFormat")),_propTypes=require("prop-types"),_UTBaseInputField=_interopRequireDefault(require("../../../UTBaseInputField")),_UTButton=_interopRequireDefault(require("../../../UTButton")),_UTFieldLabel=_interopRequireDefault(require("../../../UTFieldLabel")),_UTLabel=_interopRequireDefault(require("../../../UTLabel")),_UTValidation=_interopRequireDefault(require("../../../UTValidation")),_constants=require("../../../UTBaseInputField/constants"),_Calendar=_interopRequireDefault(require("./components/Calendar")),_stylesModule=_interopRequireDefault(require("./styles.module.scss")),_constants2=require("./constants"),_utils=require("./utils");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var a=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var n,l,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(n=t?r:a){if(n.has(e))return n.get(e);n.set(e,s)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((l=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(l.get||l.set)?n(s,t,l):s[t]=e[t]);return s})(e,t)}function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)({}).hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},_extends.apply(null,arguments)}_dayjs.default.extend(_customParseFormat.default);const CALENDAR_PAPER_PROPS={className:_stylesModule.default.calendarPaper,onMouseDown:e=>e.preventDefault()},UTDatePicker=e=>{let{classNames:t={},CustomIcon:a,dataTestId:r,disabled:n,error:l="",helpText:s,onChange:o=()=>{},placeholder:i,popoverProps:u,range:c,readOnly:_=!1,required:d,size:p=_constants2.DEFAULT_PROPS.size,title:f,value:T="",variant:m=_constants2.DEFAULT_PROPS.variant}=e;const{maxDate:y,minDate:v}=c||{},[P,U]=(0,_react.useState)(null),[E,D]=(0,_react.useState)(!1),[A,g]=(0,_react.useState)(""),[L,O]=(0,_react.useState)(!1),[h,M]=(0,_react.useState)(!1),q=(0,_react.useRef)(null),R=(0,_react.useRef)(null);(0,_react.useEffect)(()=>{D(!1),g(""),M(!1),!T&&null!=P&&P.isValid()?U(null):(0,_utils.dateMatchesFormat)(T,_constants2.OUTPUT_LABEL_MASK)?U((0,_dayjs.default)(T,_constants2.OUTPUT_LABEL_MASK)):U(null)},[T]);const S=()=>{var e;n||_||(O(!0),null===(e=R.current)||void 0===e||e.focus())},b=E?A:null!=P&&P.isValid()?P.format(_constants2.OUTPUT_LABEL_MASK):"",F=!!l||h,B=null==P?void 0:P.isValid(),x=i||_constants2.DEFAULT_PLACEHOLDER,j=F&&!n,I=(B||E)&&!n&&!_,C=l||(h?_constants2.TYPING_ERROR_MESSAGE:""),N="picker"===m,k=j?[{name:_constants.COMPONENT_KEYS.ICON,props:{showOnlyOnError:!0}}]:[],w={colorTheme:F?"error":L?"primary":"gray",Icon:a||"IconCalendarEvent"},K=_?void 0:_react.default.createElement("div",{className:_stylesModule.default.endAdornments},_react.default.createElement(_UTButton.default,_extends({},I?{colorTheme:"dark",Icon:"IconX"}:w,{classNames:{root:_stylesModule.default.calendarButton},disabled:n,onClick:I?e=>{e.stopPropagation(),U(null),D(!1),g(""),M(!1),o("")}:S,size:"small",variant:"text"})));return _react.default.createElement(_react.default.Fragment,null,_react.default.createElement("div",{className:_stylesModule.default.root},f&&_react.default.createElement(_UTFieldLabel.default,{className:null==t?void 0:t.upperTitle,required:d,withMarkdown:!0},f),_react.default.createElement("div",{ref:q},_react.default.createElement(_UTBaseInputField.default,{alwaysShowPlaceholder:!0,classNames:t,dataTestId:r,inputRef:R,disabled:n,error:F,readOnly:_,inputSize:"sm"===p?"small":void 0,variant:N?"transparent":void 0,leftAdornments:k,maxLength:10,muiProps:{InputProps:{endAdornment:K},onChange:e=>{var t,a;const r=(e=>{const t=e.replace(/\D/g,"").slice(0,8);return t.length<=2?t:t.length<=4?"".concat(t.slice(0,2),"/").concat(t.slice(2)):"".concat(t.slice(0,2),"/").concat(t.slice(2,4),"/").concat(t.slice(4))})(E?e.target.value:null!==(t=null===(a=e.nativeEvent)||void 0===a?void 0:a.data)&&void 0!==t?t:"");g(r),D(!0);if(8===r.replace(/\D/g,"").length){const e=(0,_utils.dateMatchesFormat)(r,_constants2.OUTPUT_LABEL_MASK)&&(0,_dayjs.default)(r,_constants2.OUTPUT_LABEL_MASK).isValid();M(!e),e&&U((0,_dayjs.default)(r,_constants2.OUTPUT_LABEL_MASK))}else M(!1)},fullWidth:!0},onBlur:e=>{var t;if((null===(t=q.current)||void 0===t||!t.contains(e.relatedTarget))&&(O(!1),M(!1),E)){if(D(!1),g(""),!A)return U(null),void o("");if((0,_utils.dateMatchesFormat)(A,_constants2.OUTPUT_LABEL_MASK)){const e=(0,_dayjs.default)(A,_constants2.OUTPUT_LABEL_MASK);if(e.isValid()){const t=(0,_utils.getFinalDate)({date:e,maxDate:y,minDate:v});return U(t),void o(t.format(_constants2.OUTPUT_LABEL_MASK))}}U(null),o("")}},onFocus:S,placeholder:x,value:b})),s&&_react.default.createElement(_UTLabel.default,{colorTheme:"gray",variant:"small",withMarkdown:!0},s),"select"===m&&C&&_react.default.createElement(_UTValidation.default,{dataTestId:r?"".concat(r,".errorMessage"):void 0,validationData:[{items:[{status:"error",text:C}]}]})),_react.default.createElement(_Popover.default,_extends({anchorEl:q.current,anchorOrigin:{horizontal:"left",vertical:"bottom"},disableAutoFocus:!0,disableEnforceFocus:!0,disableRestoreFocus:!0,onClose:()=>{O(!1),M(!1),E&&(D(!1),g(""),T&&(0,_utils.dateMatchesFormat)(T,_constants2.OUTPUT_LABEL_MASK)?U((0,_dayjs.default)(T,_constants2.OUTPUT_LABEL_MASK)):U(null))},open:L,PaperProps:CALENDAR_PAPER_PROPS,transformOrigin:{horizontal:"left",vertical:"top"}},u),_react.default.createElement(_Calendar.default,{maxDate:y,minDate:v,onDaySelect:e=>{const t=(0,_utils.getFinalDate)({date:e,maxDate:y,minDate:v});U(t),D(!1),g(""),M(!1),t.isValid()?o(t.format(_constants2.OUTPUT_LABEL_MASK)):o(""),O(!1)},pickedDate:P})))};UTDatePicker.propTypes={classNames:_propTypes.object,CustomIcon:_propTypes.elementType,dataTestId:_propTypes.string,disabled:_propTypes.bool,error:_propTypes.string,helpText:_propTypes.string,onChange:_propTypes.func,placeholder:_propTypes.string,popoverProps:_propTypes.object,range:(0,_propTypes.shape)({maxDate:_propTypes.string,minDate:_propTypes.string}),readOnly:_propTypes.bool,required:_propTypes.bool,size:_propTypes.string,title:_propTypes.string,value:_propTypes.string,variant:(0,_propTypes.oneOf)(["select","picker"])};var _default=exports.default=UTDatePicker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)({}).hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},_extends.apply(null,arguments)}import React,{useRef,useState,useEffect}from"react";import Popover from"@material-ui/core/Popover";import dayjs from"dayjs";import customParseFormat from"dayjs/plugin/customParseFormat";import{bool,elementType,func,object,shape,string,oneOf}from"prop-types";import UTBaseInputField from"../../../UTBaseInputField";import UTButton from"../../../UTButton";import UTFieldLabel from"../../../UTFieldLabel";import UTLabel from"../../../UTLabel";import UTValidation from"../../../UTValidation";import{COMPONENT_KEYS}from"../../../UTBaseInputField/constants";import Calendar from"./components/Calendar";import styles from"./styles.module.scss";import{DEFAULT_PROPS,DEFAULT_PLACEHOLDER,OUTPUT_LABEL_MASK,TYPING_ERROR_MESSAGE}from"./constants";import{dateMatchesFormat,getFinalDate}from"./utils";dayjs.extend(customParseFormat);const CALENDAR_PAPER_PROPS={className:styles.calendarPaper,onMouseDown:e=>e.preventDefault()},UTDatePicker=e=>{let{classNames:t={},CustomIcon:a,dataTestId:r,disabled:o,error:n="",helpText:l,onChange:s=()=>{},placeholder:i,popoverProps:c,range:d,readOnly:m=!1,required:u,size:p=DEFAULT_PROPS.size,title:T,value:E="",variant:P=DEFAULT_PROPS.variant}=e;const{maxDate:U,minDate:f}=d||{},[_,A]=useState(null),[v,L]=useState(!1),[O,g]=useState(""),[R,h]=useState(!1),[S,D]=useState(!1),y=useRef(null),F=useRef(null);useEffect(()=>{L(!1),g(""),D(!1),!E&&null!=_&&_.isValid()?A(null):dateMatchesFormat(E,OUTPUT_LABEL_MASK)?A(dayjs(E,OUTPUT_LABEL_MASK)):A(null)},[E]);const M=()=>{var e;o||m||(h(!0),null===(e=F.current)||void 0===e||e.focus())},b=v?O:null!=_&&_.isValid()?_.format(OUTPUT_LABEL_MASK):"",B=!!n||S,C=null==_?void 0:_.isValid(),I=i||DEFAULT_PLACEHOLDER,x=(C||v)&&!o&&!m,N
|
|
1
|
+
function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)({}).hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},_extends.apply(null,arguments)}import React,{useRef,useState,useEffect}from"react";import Popover from"@material-ui/core/Popover";import dayjs from"dayjs";import customParseFormat from"dayjs/plugin/customParseFormat";import{bool,elementType,func,object,shape,string,oneOf}from"prop-types";import UTBaseInputField from"../../../UTBaseInputField";import UTButton from"../../../UTButton";import UTFieldLabel from"../../../UTFieldLabel";import UTLabel from"../../../UTLabel";import UTValidation from"../../../UTValidation";import{COMPONENT_KEYS}from"../../../UTBaseInputField/constants";import Calendar from"./components/Calendar";import styles from"./styles.module.scss";import{DEFAULT_PROPS,DEFAULT_PLACEHOLDER,OUTPUT_LABEL_MASK,TYPING_ERROR_MESSAGE}from"./constants";import{dateMatchesFormat,getFinalDate}from"./utils";dayjs.extend(customParseFormat);const CALENDAR_PAPER_PROPS={className:styles.calendarPaper,onMouseDown:e=>e.preventDefault()},UTDatePicker=e=>{let{classNames:t={},CustomIcon:a,dataTestId:r,disabled:o,error:n="",helpText:l,onChange:s=()=>{},placeholder:i,popoverProps:c,range:d,readOnly:m=!1,required:u,size:p=DEFAULT_PROPS.size,title:T,value:E="",variant:P=DEFAULT_PROPS.variant}=e;const{maxDate:U,minDate:f}=d||{},[_,A]=useState(null),[v,L]=useState(!1),[O,g]=useState(""),[R,h]=useState(!1),[S,D]=useState(!1),y=useRef(null),F=useRef(null);useEffect(()=>{L(!1),g(""),D(!1),!E&&null!=_&&_.isValid()?A(null):dateMatchesFormat(E,OUTPUT_LABEL_MASK)?A(dayjs(E,OUTPUT_LABEL_MASK)):A(null)},[E]);const M=()=>{var e;o||m||(h(!0),null===(e=F.current)||void 0===e||e.focus())},b=v?O:null!=_&&_.isValid()?_.format(OUTPUT_LABEL_MASK):"",B=!!n||S,C=null==_?void 0:_.isValid(),I=i||DEFAULT_PLACEHOLDER,x=(C||v)&&!o&&!m,N=n||(S?TYPING_ERROR_MESSAGE:""),K="picker"===P,j=B&&!o?[{name:COMPONENT_KEYS.ICON,props:{showOnlyOnError:!0}}]:[],k={colorTheme:B?"error":R?"primary":"gray",Icon:a||"IconCalendarEvent"},w=m?void 0:React.createElement("div",{className:styles.endAdornments},React.createElement(UTButton,_extends({},x?{colorTheme:"dark",Icon:"IconX"}:k,{classNames:{root:styles.calendarButton},disabled:o,onClick:x?e=>{e.stopPropagation(),A(null),L(!1),g(""),D(!1),s("")}:M,size:"small",variant:"text"})));return React.createElement(React.Fragment,null,React.createElement("div",{className:styles.root},T&&React.createElement(UTFieldLabel,{className:null==t?void 0:t.upperTitle,required:u,withMarkdown:!0},T),React.createElement("div",{ref:y},React.createElement(UTBaseInputField,{alwaysShowPlaceholder:!0,classNames:t,dataTestId:r,inputRef:F,disabled:o,error:B,readOnly:m,inputSize:"sm"===p?"small":void 0,variant:K?"transparent":void 0,leftAdornments:j,maxLength:10,muiProps:{InputProps:{endAdornment:w},onChange:e=>{var t,a;const r=(e=>{const t=e.replace(/\D/g,"").slice(0,8);return t.length<=2?t:t.length<=4?"".concat(t.slice(0,2),"/").concat(t.slice(2)):"".concat(t.slice(0,2),"/").concat(t.slice(2,4),"/").concat(t.slice(4))})(v?e.target.value:null!==(t=null===(a=e.nativeEvent)||void 0===a?void 0:a.data)&&void 0!==t?t:"");g(r),L(!0);if(8===r.replace(/\D/g,"").length){const e=dateMatchesFormat(r,OUTPUT_LABEL_MASK)&&dayjs(r,OUTPUT_LABEL_MASK).isValid();D(!e),e&&A(dayjs(r,OUTPUT_LABEL_MASK))}else D(!1)},fullWidth:!0},onBlur:e=>{var t;if((null===(t=y.current)||void 0===t||!t.contains(e.relatedTarget))&&(h(!1),D(!1),v)){if(L(!1),g(""),!O)return A(null),void s("");if(dateMatchesFormat(O,OUTPUT_LABEL_MASK)){const e=dayjs(O,OUTPUT_LABEL_MASK);if(e.isValid()){const t=getFinalDate({date:e,maxDate:U,minDate:f});return A(t),void s(t.format(OUTPUT_LABEL_MASK))}}A(null),s("")}},onFocus:M,placeholder:I,value:b})),l&&React.createElement(UTLabel,{colorTheme:"gray",variant:"small",withMarkdown:!0},l),"select"===P&&N&&React.createElement(UTValidation,{dataTestId:r?"".concat(r,".errorMessage"):void 0,validationData:[{items:[{status:"error",text:N}]}]})),React.createElement(Popover,_extends({anchorEl:y.current,anchorOrigin:{horizontal:"left",vertical:"bottom"},disableAutoFocus:!0,disableEnforceFocus:!0,disableRestoreFocus:!0,onClose:()=>{h(!1),D(!1),v&&(L(!1),g(""),E&&dateMatchesFormat(E,OUTPUT_LABEL_MASK)?A(dayjs(E,OUTPUT_LABEL_MASK)):A(null))},open:R,PaperProps:CALENDAR_PAPER_PROPS,transformOrigin:{horizontal:"left",vertical:"top"}},c),React.createElement(Calendar,{maxDate:U,minDate:f,onDaySelect:e=>{const t=getFinalDate({date:e,maxDate:U,minDate:f});A(t),L(!1),g(""),D(!1),t.isValid()?s(t.format(OUTPUT_LABEL_MASK)):s(""),h(!1)},pickedDate:_})))};UTDatePicker.propTypes={classNames:object,CustomIcon:elementType,dataTestId:string,disabled:bool,error:string,helpText:string,onChange:func,placeholder:string,popoverProps:object,range:shape({maxDate:string,minDate:string}),readOnly:bool,required:bool,size:string,title:string,value:string,variant:oneOf(["select","picker"])};export default UTDatePicker;
|