primereact 9.2.1 → 9.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ripple/ripple.js CHANGED
@@ -64,11 +64,7 @@ this.primereact.ripple = (function (exports, React, PrimeReact, hooks, utils) {
64
64
  return;
65
65
  }
66
66
  utils.DomHandler.removeClass(inkRef.current, 'p-ink-active');
67
- if (!utils.DomHandler.getHeight(inkRef.current) && !utils.DomHandler.getWidth(inkRef.current)) {
68
- var d = Math.max(utils.DomHandler.getOuterWidth(targetRef.current), utils.DomHandler.getOuterHeight(targetRef.current));
69
- inkRef.current.style.height = d + 'px';
70
- inkRef.current.style.width = d + 'px';
71
- }
67
+ setDimensions();
72
68
  inkRef.current.style.top = offsetY + 'px';
73
69
  inkRef.current.style.left = offsetX + 'px';
74
70
  utils.DomHandler.addClass(inkRef.current, 'p-ink-active');
@@ -76,15 +72,24 @@ this.primereact.ripple = (function (exports, React, PrimeReact, hooks, utils) {
76
72
  var onAnimationEnd = function onAnimationEnd(event) {
77
73
  utils.DomHandler.removeClass(event.currentTarget, 'p-ink-active');
78
74
  };
75
+ var setDimensions = function setDimensions() {
76
+ if (inkRef.current && !utils.DomHandler.getHeight(inkRef.current) && !utils.DomHandler.getWidth(inkRef.current)) {
77
+ var d = Math.max(utils.DomHandler.getOuterWidth(targetRef.current), utils.DomHandler.getOuterHeight(targetRef.current));
78
+ inkRef.current.style.height = d + 'px';
79
+ inkRef.current.style.width = d + 'px';
80
+ }
81
+ };
79
82
  hooks.useMountEffect(function () {
80
83
  if (inkRef.current) {
81
84
  targetRef.current = getTarget();
85
+ setDimensions();
82
86
  bindEvents();
83
87
  }
84
88
  });
85
89
  hooks.useUpdateEffect(function () {
86
90
  if (inkRef.current && !targetRef.current) {
87
91
  targetRef.current = getTarget();
92
+ setDimensions();
88
93
  bindEvents();
89
94
  }
90
95
  });
@@ -1 +1 @@
1
- this.primereact=this.primereact||{},this.primereact.ripple=function(e,t,r,n,u){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=o(t),i=c(r),l=a.memo(a.forwardRef((function(){var e=a.useRef(null),t=a.useRef(null),r=function(){return e.current&&e.current.parentElement},c=function(){t.current&&(t.current.addEventListener("mousedown",l),u.DomHandler.isTouchDevice()&&t.current.addEventListener("touchstart",o))},o=function(r){var n=u.DomHandler.getOffset(t.current),c=r.targetTouches[0].pageX-n.left+document.body.scrollTop-u.DomHandler.getWidth(e.current)/2,o=r.targetTouches[0].pageY-n.top+document.body.scrollLeft-u.DomHandler.getHeight(e.current)/2;d(c,o)},l=function(r){if(!u.DomHandler.isTouchDevice()){var n=u.DomHandler.getOffset(t.current),c=r.pageX-n.left+document.body.scrollTop-u.DomHandler.getWidth(e.current)/2,o=r.pageY-n.top+document.body.scrollLeft-u.DomHandler.getHeight(e.current)/2;d(c,o)}},d=function(r,n){if(e.current&&"none"!==getComputedStyle(e.current,null).display){if(u.DomHandler.removeClass(e.current,"p-ink-active"),!u.DomHandler.getHeight(e.current)&&!u.DomHandler.getWidth(e.current)){var c=Math.max(u.DomHandler.getOuterWidth(t.current),u.DomHandler.getOuterHeight(t.current));e.current.style.height=c+"px",e.current.style.width=c+"px"}e.current.style.top=n+"px",e.current.style.left=r+"px",u.DomHandler.addClass(e.current,"p-ink-active")}};return n.useMountEffect((function(){e.current&&(t.current=r(),c())})),n.useUpdateEffect((function(){e.current&&!t.current&&(t.current=r(),c())})),n.useUnmountEffect((function(){e.current&&(t.current=null,t.current&&(t.current.removeEventListener("mousedown",l),u.DomHandler.isTouchDevice()&&t.current.removeEventListener("touchstart",o)))})),i.default.ripple?a.createElement("span",{role:"presentation",ref:e,className:"p-ink",onAnimationEnd:function(e){u.DomHandler.removeClass(e.currentTarget,"p-ink-active")}}):null})));return l.displayName="Ripple",e.Ripple=l,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.hooks,primereact.utils);
1
+ this.primereact=this.primereact||{},this.primereact.ripple=function(e,t,r,n,u){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=o(t),i=c(r),l=a.memo(a.forwardRef((function(){var e=a.useRef(null),t=a.useRef(null),r=function(){return e.current&&e.current.parentElement},c=function(){t.current&&(t.current.addEventListener("mousedown",l),u.DomHandler.isTouchDevice()&&t.current.addEventListener("touchstart",o))},o=function(r){var n=u.DomHandler.getOffset(t.current),c=r.targetTouches[0].pageX-n.left+document.body.scrollTop-u.DomHandler.getWidth(e.current)/2,o=r.targetTouches[0].pageY-n.top+document.body.scrollLeft-u.DomHandler.getHeight(e.current)/2;d(c,o)},l=function(r){if(!u.DomHandler.isTouchDevice()){var n=u.DomHandler.getOffset(t.current),c=r.pageX-n.left+document.body.scrollTop-u.DomHandler.getWidth(e.current)/2,o=r.pageY-n.top+document.body.scrollLeft-u.DomHandler.getHeight(e.current)/2;d(c,o)}},d=function(t,r){e.current&&"none"!==getComputedStyle(e.current,null).display&&(u.DomHandler.removeClass(e.current,"p-ink-active"),s(),e.current.style.top=r+"px",e.current.style.left=t+"px",u.DomHandler.addClass(e.current,"p-ink-active"))},s=function(){if(e.current&&!u.DomHandler.getHeight(e.current)&&!u.DomHandler.getWidth(e.current)){var r=Math.max(u.DomHandler.getOuterWidth(t.current),u.DomHandler.getOuterHeight(t.current));e.current.style.height=r+"px",e.current.style.width=r+"px"}};return n.useMountEffect((function(){e.current&&(t.current=r(),s(),c())})),n.useUpdateEffect((function(){e.current&&!t.current&&(t.current=r(),s(),c())})),n.useUnmountEffect((function(){e.current&&(t.current=null,t.current&&(t.current.removeEventListener("mousedown",l),u.DomHandler.isTouchDevice()&&t.current.removeEventListener("touchstart",o)))})),i.default.ripple?a.createElement("span",{role:"presentation",ref:e,className:"p-ink",onAnimationEnd:function(e){u.DomHandler.removeClass(e.currentTarget,"p-ink-active")}}):null})));return l.displayName="Ripple",e.Ripple=l,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.hooks,primereact.utils);
@@ -1 +1 @@
1
- .p-sidebar-mask{position:fixed;top:0;left:0;width:100%;height:100%;display:none;justify-content:center;align-items:center;pointer-events:none;background-color:transparent;transition-property:background-color}.p-sidebar-visible{display:flex}.p-sidebar-mask.p-component-overlay{pointer-events:auto}.p-sidebar{display:flex;flex-direction:column;pointer-events:auto;transform:translate3d(0,0,0);position:relative}.p-sidebar:not([class*="p-sidebar-"]){display:none}.p-sidebar-content{overflow-y:auto;flex-grow:1}.p-sidebar-header{display:flex;align-items:center;justify-content:flex-end;flex-shrink:0}.p-sidebar-icon{display:flex;align-items:center;justify-content:center;overflow:hidden;position:relative}.p-sidebar-full .p-sidebar{transition:none;transform:none;width:100vw !important;height:100vh !important;max-height:100%;top:0 !important;left:0 !important}.p-sidebar-top .p-sidebar-enter,.p-sidebar-top .p-sidebar-exit-active{transform:translate3d(0,-100%,0)}.p-sidebar-bottom .p-sidebar-enter,.p-sidebar-bottom .p-sidebar-exit-active{transform:translate3d(0,100%,0)}.p-sidebar-left .p-sidebar-enter,.p-sidebar-left .p-sidebar-exit-active{transform:translate3d(-100%,0,0)}.p-sidebar-right .p-sidebar-enter,.p-sidebar-right .p-sidebar-exit-active{transform:translate3d(100%,0,0)}.p-sidebar-top .p-sidebar-enter-active,.p-sidebar-bottom .p-sidebar-enter-active,.p-sidebar-left .p-sidebar-enter-active,.p-sidebar-right .p-sidebar-enter-active{transform:translate3d(0,0,0);transition:all .3s}.p-sidebar-top .p-sidebar-enter-done,.p-sidebar-bottom .p-sidebar-enter-done,.p-sidebar-left .p-sidebar-enter-done,.p-sidebar-right .p-sidebar-enter-done{transform:none}.p-sidebar-top .p-sidebar-exit-active,.p-sidebar-bottom .p-sidebar-exit-active,.p-sidebar-left .p-sidebar-exit-active,.p-sidebar-right .p-sidebar-exit-active{transition:all .3s}.p-sidebar-full .p-sidebar-enter{opacity:0;transform:scale(0.5)}.p-sidebar-full .p-sidebar-enter-active{opacity:1;transform:scale(1);transition:all .15s cubic-bezier(0,0,0.2,1)}.p-sidebar-full .p-sidebar-enter-done{transform:none}.p-sidebar-full .p-sidebar-exit-active{opacity:0;transform:scale(0.5);transition:all .15s cubic-bezier(0.4,0.0,0.2,1)}.p-sidebar-left{justify-content:flex-start}.p-sidebar-right{justify-content:flex-end}.p-sidebar-top{align-items:flex-start}.p-sidebar-bottom{align-items:flex-end}.p-sidebar-left .p-sidebar{width:20rem;height:100%}.p-sidebar-right .p-sidebar{width:20rem;height:100%}.p-sidebar-top .p-sidebar{height:10rem;width:100%}.p-sidebar-bottom .p-sidebar{height:10rem;width:100%}.p-sidebar-left .p-sidebar-sm,.p-sidebar-right .p-sidebar-sm{width:20rem}.p-sidebar-left .p-sidebar-md,.p-sidebar-right .p-sidebar-md{width:40rem}.p-sidebar-left .p-sidebar-lg,.p-sidebar-right .p-sidebar-lg{width:60rem}.p-sidebar-top .p-sidebar-sm,.p-sidebar-bottom .p-sidebar-sm{height:10rem}.p-sidebar-top .p-sidebar-md,.p-sidebar-bottom .p-sidebar-md{height:20rem}.p-sidebar-top .p-sidebar-lg,.p-sidebar-bottom .p-sidebar-lg{height:30rem}.p-sidebar-left .p-sidebar-view,.p-sidebar-right .p-sidebar-view,.p-sidebar-top .p-sidebar-view,.p-sidebar-bottom .p-sidebar-view{width:100%;height:100%}.p-sidebar-left .p-sidebar-content,.p-sidebar-right .p-sidebar-content,.p-sidebar-top .p-sidebar-content,.p-sidebar-bottom .p-sidebar-content{width:100%;height:100%}@media screen and (max-width:64em){.p-sidebar-left .p-sidebar-lg,.p-sidebar-left .p-sidebar-md,.p-sidebar-right .p-sidebar-lg,.p-sidebar-right .p-sidebar-md{width:20rem}}
1
+ .p-sidebar-mask{position:fixed;top:0;left:0;width:100%;height:100%;display:none;justify-content:center;align-items:center;pointer-events:none;background-color:transparent;transition-property:background-color}.p-sidebar-visible{display:flex}.p-sidebar-mask.p-component-overlay{pointer-events:auto}.p-sidebar{display:flex;flex-direction:column;pointer-events:auto;transform:translate3d(0,0,0);position:relative}.p-sidebar-content{overflow-y:auto;flex-grow:1}.p-sidebar-header{display:flex;align-items:center;justify-content:flex-end;flex-shrink:0}.p-sidebar-icon{display:flex;align-items:center;justify-content:center;overflow:hidden;position:relative}.p-sidebar-full .p-sidebar{transition:none;transform:none;width:100vw !important;height:100vh !important;max-height:100%;top:0 !important;left:0 !important}.p-sidebar-top .p-sidebar-enter,.p-sidebar-top .p-sidebar-exit-active{transform:translate3d(0,-100%,0)}.p-sidebar-bottom .p-sidebar-enter,.p-sidebar-bottom .p-sidebar-exit-active{transform:translate3d(0,100%,0)}.p-sidebar-left .p-sidebar-enter,.p-sidebar-left .p-sidebar-exit-active{transform:translate3d(-100%,0,0)}.p-sidebar-right .p-sidebar-enter,.p-sidebar-right .p-sidebar-exit-active{transform:translate3d(100%,0,0)}.p-sidebar-top .p-sidebar-enter-active,.p-sidebar-bottom .p-sidebar-enter-active,.p-sidebar-left .p-sidebar-enter-active,.p-sidebar-right .p-sidebar-enter-active{transform:translate3d(0,0,0);transition:all .3s}.p-sidebar-top .p-sidebar-enter-done,.p-sidebar-bottom .p-sidebar-enter-done,.p-sidebar-left .p-sidebar-enter-done,.p-sidebar-right .p-sidebar-enter-done{transform:none}.p-sidebar-top .p-sidebar-exit-active,.p-sidebar-bottom .p-sidebar-exit-active,.p-sidebar-left .p-sidebar-exit-active,.p-sidebar-right .p-sidebar-exit-active{transition:all .3s}.p-sidebar-full .p-sidebar-enter{opacity:0;transform:scale(0.5)}.p-sidebar-full .p-sidebar-enter-active{opacity:1;transform:scale(1);transition:all .15s cubic-bezier(0,0,0.2,1)}.p-sidebar-full .p-sidebar-enter-done{transform:none}.p-sidebar-full .p-sidebar-exit-active{opacity:0;transform:scale(0.5);transition:all .15s cubic-bezier(0.4,0,0.2,1)}.p-sidebar-left{justify-content:flex-start}.p-sidebar-right{justify-content:flex-end}.p-sidebar-top{align-items:flex-start}.p-sidebar-bottom{align-items:flex-end}.p-sidebar-left .p-sidebar{width:20rem;height:100%}.p-sidebar-right .p-sidebar{width:20rem;height:100%}.p-sidebar-top .p-sidebar{height:10rem;width:100%}.p-sidebar-bottom .p-sidebar{height:10rem;width:100%}.p-sidebar-left .p-sidebar-sm,.p-sidebar-right .p-sidebar-sm{width:20rem}.p-sidebar-left .p-sidebar-md,.p-sidebar-right .p-sidebar-md{width:40rem}.p-sidebar-left .p-sidebar-lg,.p-sidebar-right .p-sidebar-lg{width:60rem}.p-sidebar-top .p-sidebar-sm,.p-sidebar-bottom .p-sidebar-sm{height:10rem}.p-sidebar-top .p-sidebar-md,.p-sidebar-bottom .p-sidebar-md{height:20rem}.p-sidebar-top .p-sidebar-lg,.p-sidebar-bottom .p-sidebar-lg{height:30rem}.p-sidebar-left .p-sidebar-view,.p-sidebar-right .p-sidebar-view,.p-sidebar-top .p-sidebar-view,.p-sidebar-bottom .p-sidebar-view{width:100%;height:100%}.p-sidebar-left .p-sidebar-content,.p-sidebar-right .p-sidebar-content,.p-sidebar-top .p-sidebar-content,.p-sidebar-bottom .p-sidebar-content{width:100%;height:100%}@media screen and (max-width:64em){.p-sidebar-left .p-sidebar-lg,.p-sidebar-left .p-sidebar-md,.p-sidebar-right .p-sidebar-lg,.p-sidebar-right .p-sidebar-md{width:20rem}}
@@ -286,9 +286,9 @@ var Slider = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespace.f
286
286
  var newValue = parsedValue;
287
287
  if (props.range) {
288
288
  if (handleIndex.current === 0) {
289
- if (parsedValue < props.min) parsedValue = props.min;else if (parsedValue > value[1]) parsedValue = value[1];
289
+ if (parsedValue < props.min) parsedValue = props.min;else if (parsedValue > props.max) parsedValue = props.max;
290
290
  } else {
291
- if (parsedValue > props.max) parsedValue = props.max;else if (parsedValue < value[0]) parsedValue = value[0];
291
+ if (parsedValue > props.max) parsedValue = props.max;else if (parsedValue < props.min) parsedValue = props.min;
292
292
  }
293
293
  newValue = _toConsumableArray(value);
294
294
  newValue[handleIndex.current] = parsedValue;
@@ -346,12 +346,14 @@ var Slider = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespace.f
346
346
  var handleValueEnd = (value[1] > props.max ? props.max : value[1] - props.min) * 100 / (props.max - props.min);
347
347
  var rangeStartHandle = horizontal ? createHandle(handleValueStart, null, 0) : createHandle(null, handleValueStart, 0);
348
348
  var rangeEndHandle = horizontal ? createHandle(handleValueEnd, null, 1) : createHandle(null, handleValueEnd, 1);
349
+ var rangeSliderWidth = handleValueEnd > handleValueStart ? handleValueEnd - handleValueStart : handleValueStart - handleValueEnd;
350
+ var rangeSliderPosition = handleValueEnd > handleValueStart ? handleValueStart : handleValueEnd;
349
351
  var rangeStyle = horizontal ? {
350
- left: handleValueStart + '%',
351
- width: handleValueEnd - handleValueStart + '%'
352
+ left: rangeSliderPosition + '%',
353
+ width: rangeSliderWidth + '%'
352
354
  } : {
353
- bottom: handleValueStart + '%',
354
- height: handleValueEnd - handleValueStart + '%'
355
+ bottom: rangeSliderPosition + '%',
356
+ height: rangeSliderWidth + '%'
355
357
  };
356
358
  return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("span", {
357
359
  className: "p-slider-range",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=require("primereact/hooks"),r=require("primereact/utils");function t(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}})),n.default=e,Object.freeze(n)}var a=t(e);function i(){return i=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},i.apply(this,arguments)}function l(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}function o(e){if(Array.isArray(e))return l(e)}function u(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function c(e,n){if(e){if("string"==typeof e)return l(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,n):void 0}}function s(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(e){if(Array.isArray(e))return e}function d(e,n){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var t,a,i,l,o=[],u=!0,c=!1;try{if(i=(r=r.call(e)).next,0===n){if(Object(r)!==r)return;u=!1}else for(;!(u=(t=i.call(r)).done)&&(o.push(t.value),o.length!==n);u=!0);}catch(e){c=!0,a=e}finally{try{if(!u&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(c)throw a}}return o}}function m(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function p(e,n){return f(e)||d(e,n)||c(e,n)||m()}var v={defaultProps:{__TYPE:"Slider",id:null,value:null,min:0,max:100,orientation:"horizontal",step:null,range:!1,style:null,className:null,disabled:!1,tabIndex:0,onChange:null,onSlideEnd:null,children:void 0},getProps:function(e){return r.ObjectUtils.getMergedProps(e,v.defaultProps)},getOtherProps:function(e){return r.ObjectUtils.getDiffProps(e,v.defaultProps)}},g=a.memo(a.forwardRef((function(e,t){var l=v.getProps(e),f=a.useRef(null),d=a.useRef(0),m=a.useRef(!1),g=a.useRef(!1),h=a.useRef(0),y=a.useRef(0),b=a.useRef(0),E=a.useRef(0),x=l.range?l.value||[l.min,l.max]:l.value||0,w="horizontal"===l.orientation,O="vertical"===l.orientation,S=p(n.useEventListener({type:"mousemove",listener:function(e){return U(e)}}),2),j=S[0],P=S[1],A=p(n.useEventListener({type:"mouseup",listener:function(e){return k(e)}}),2),R=A[0],D=A[1],I=p(n.useEventListener({type:"touchmove",listener:function(e){return U(e)}}),2),N=I[0],C=I[1],M=p(n.useEventListener({type:"touchend",listener:function(e){return k(e)}}),2),_=M[0],L=M[1],H=function(e,n){K(e,(l.range?x[d.current]:x)+(l.step||1)*n),e.preventDefault()},T=function(e,n){l.disabled||(g.current=!0,W(),m.current=!0,d.current=n)},U=function(e){g.current&&(Y(e),e.preventDefault())},k=function(e){g.current&&(g.current=!1,l.onSlideEnd&&l.onSlideEnd({originalEvent:e,value:l.value}),P(),D(),C(),L())},z=function(e,n){j(),R(),T(0,n)},F=function(e,n){N(),_(),T(0,n)},q=function(e,n){if(!l.disabled){d.current=n;var r=e.key;"ArrowRight"===r||"ArrowUp"===r?H(e,1):"ArrowLeft"!==r&&"ArrowDown"!==r||H(e,-1)}},W=function(){var e=f.current.getBoundingClientRect();h.current=e.left+r.DomHandler.getWindowScrollLeft(),y.current=e.top+r.DomHandler.getWindowScrollTop(),b.current=f.current.offsetWidth,E.current=f.current.offsetHeight},Y=function(e){var n=(w?100*((e.touches?e.touches[0].pageX:e.pageX)-h.current)/b.current:100*(y.current+E.current-(e.touches?e.touches[0].pageY:e.pageY))/E.current)/100*(l.max-l.min)+l.min;if(l.step){var r=l.range?x[d.current]:x,t=n-r;t<0?n=r+Math.ceil(n/l.step-r/l.step)*l.step:t>0&&(n=r+Math.floor(n/l.step-r/l.step)*l.step)}else n=Math.floor(n);return K(e,n)},K=function(e,n){var r,t=parseFloat(n.toFixed(10)),a=t;return l.range?(0===d.current?t<l.min?t=l.min:t>x[1]&&(t=x[1]):t>l.max?t=l.max:t<x[0]&&(t=x[0]),(a=o(r=x)||u(r)||c(r)||s())[d.current]=t,l.onChange&&l.onChange({originalEvent:e,value:a})):(t<l.min?t=l.min:t>l.max&&(t=l.max),a=t,l.onChange&&l.onChange({originalEvent:e,value:a})),a},X=function(e,n,t){var o={transition:g.current?"none":null,left:null!==e&&e+"%",bottom:n&&n+"%"},u=r.classNames("p-slider-handle",{"p-slider-handle-start":0===t,"p-slider-handle-end":1===t,"p-slider-handle-active":d.current===t});return a.createElement("span",i({className:u,style:o,tabIndex:l.tabIndex,role:"slider",onMouseDown:function(e){return z(0,t)},onTouchStart:function(e){return F(0,t)},onKeyDown:function(e){return q(e,t)},"aria-valuemin":l.min,"aria-valuemax":l.max,"aria-valuenow":e||n,"aria-orientation":l.orientation},V))};a.useImperativeHandle(t,(function(){return{props:l,getElement:function(){return f.current}}}));var B,$,G,J,Q=v.getOtherProps(l),V=r.ObjectUtils.reduceKeys(Q,r.DomHandler.ARIA_PROPS),Z=r.classNames("p-slider p-component",l.className,{"p-disabled":l.disabled,"p-slider-horizontal":w,"p-slider-vertical":O}),ee=l.range?(B=100*(x[0]<l.min?l.min:x[0]-l.min)/(l.max-l.min),$=100*(x[1]>l.max?l.max:x[1]-l.min)/(l.max-l.min),G=w?X(B,null,0):X(null,B,0),J=w?X($,null,1):X(null,$,1),a.createElement(a.Fragment,null,a.createElement("span",{className:"p-slider-range",style:w?{left:B+"%",width:$-B+"%"}:{bottom:B+"%",height:$-B+"%"}}),G,J)):function(){var e;e=x<l.min?l.min:x>l.max?l.max:100*(x-l.min)/(l.max-l.min);var n=w?{width:e+"%"}:{height:e+"%"},r=w?X(e,null,null):X(null,e,null);return a.createElement(a.Fragment,null,a.createElement("span",{className:"p-slider-range",style:n}),r)}();return a.createElement("div",i({ref:f,id:l.id,style:l.style,className:Z},Q,{onClick:function(e){if(!l.disabled){if(!m.current){W();var n=Y(e);l.onSlideEnd&&l.onSlideEnd({originalEvent:e,value:n})}m.current=!1}}}),ee)})));g.displayName="Slider",exports.Slider=g;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=require("primereact/hooks"),r=require("primereact/utils");function t(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}})),n.default=e,Object.freeze(n)}var a=t(e);function i(){return i=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},i.apply(this,arguments)}function l(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}function o(e){if(Array.isArray(e))return l(e)}function u(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function c(e,n){if(e){if("string"==typeof e)return l(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,n):void 0}}function s(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(e){if(Array.isArray(e))return e}function m(e,n){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var t,a,i,l,o=[],u=!0,c=!1;try{if(i=(r=r.call(e)).next,0===n){if(Object(r)!==r)return;u=!1}else for(;!(u=(t=i.call(r)).done)&&(o.push(t.value),o.length!==n);u=!0);}catch(e){c=!0,a=e}finally{try{if(!u&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(c)throw a}}return o}}function d(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function p(e,n){return f(e)||m(e,n)||c(e,n)||d()}var v={defaultProps:{__TYPE:"Slider",id:null,value:null,min:0,max:100,orientation:"horizontal",step:null,range:!1,style:null,className:null,disabled:!1,tabIndex:0,onChange:null,onSlideEnd:null,children:void 0},getProps:function(e){return r.ObjectUtils.getMergedProps(e,v.defaultProps)},getOtherProps:function(e){return r.ObjectUtils.getDiffProps(e,v.defaultProps)}},g=a.memo(a.forwardRef((function(e,t){var l=v.getProps(e),f=a.useRef(null),m=a.useRef(0),d=a.useRef(!1),g=a.useRef(!1),h=a.useRef(0),y=a.useRef(0),b=a.useRef(0),x=a.useRef(0),E=l.range?l.value||[l.min,l.max]:l.value||0,w="horizontal"===l.orientation,O="vertical"===l.orientation,S=p(n.useEventListener({type:"mousemove",listener:function(e){return U(e)}}),2),j=S[0],P=S[1],A=p(n.useEventListener({type:"mouseup",listener:function(e){return k(e)}}),2),R=A[0],D=A[1],I=p(n.useEventListener({type:"touchmove",listener:function(e){return U(e)}}),2),N=I[0],C=I[1],M=p(n.useEventListener({type:"touchend",listener:function(e){return k(e)}}),2),_=M[0],L=M[1],H=function(e,n){K(e,(l.range?E[m.current]:E)+(l.step||1)*n),e.preventDefault()},T=function(e,n){l.disabled||(g.current=!0,W(),d.current=!0,m.current=n)},U=function(e){g.current&&(Y(e),e.preventDefault())},k=function(e){g.current&&(g.current=!1,l.onSlideEnd&&l.onSlideEnd({originalEvent:e,value:l.value}),P(),D(),C(),L())},z=function(e,n){j(),R(),T(0,n)},F=function(e,n){N(),_(),T(0,n)},q=function(e,n){if(!l.disabled){m.current=n;var r=e.key;"ArrowRight"===r||"ArrowUp"===r?H(e,1):"ArrowLeft"!==r&&"ArrowDown"!==r||H(e,-1)}},W=function(){var e=f.current.getBoundingClientRect();h.current=e.left+r.DomHandler.getWindowScrollLeft(),y.current=e.top+r.DomHandler.getWindowScrollTop(),b.current=f.current.offsetWidth,x.current=f.current.offsetHeight},Y=function(e){var n=(w?100*((e.touches?e.touches[0].pageX:e.pageX)-h.current)/b.current:100*(y.current+x.current-(e.touches?e.touches[0].pageY:e.pageY))/x.current)/100*(l.max-l.min)+l.min;if(l.step){var r=l.range?E[m.current]:E,t=n-r;t<0?n=r+Math.ceil(n/l.step-r/l.step)*l.step:t>0&&(n=r+Math.floor(n/l.step-r/l.step)*l.step)}else n=Math.floor(n);return K(e,n)},K=function(e,n){var r,t=parseFloat(n.toFixed(10)),a=t;return l.range?(0===m.current?t<l.min?t=l.min:t>l.max&&(t=l.max):t>l.max?t=l.max:t<l.min&&(t=l.min),(a=o(r=E)||u(r)||c(r)||s())[m.current]=t,l.onChange&&l.onChange({originalEvent:e,value:a})):(t<l.min?t=l.min:t>l.max&&(t=l.max),a=t,l.onChange&&l.onChange({originalEvent:e,value:a})),a},X=function(e,n,t){var o={transition:g.current?"none":null,left:null!==e&&e+"%",bottom:n&&n+"%"},u=r.classNames("p-slider-handle",{"p-slider-handle-start":0===t,"p-slider-handle-end":1===t,"p-slider-handle-active":m.current===t});return a.createElement("span",i({className:u,style:o,tabIndex:l.tabIndex,role:"slider",onMouseDown:function(e){return z(0,t)},onTouchStart:function(e){return F(0,t)},onKeyDown:function(e){return q(e,t)},"aria-valuemin":l.min,"aria-valuemax":l.max,"aria-valuenow":e||n,"aria-orientation":l.orientation},ee))};a.useImperativeHandle(t,(function(){return{props:l,getElement:function(){return f.current}}}));var B,$,G,J,Q,V,Z=v.getOtherProps(l),ee=r.ObjectUtils.reduceKeys(Z,r.DomHandler.ARIA_PROPS),ne=r.classNames("p-slider p-component",l.className,{"p-disabled":l.disabled,"p-slider-horizontal":w,"p-slider-vertical":O}),re=l.range?(B=100*(E[0]<l.min?l.min:E[0]-l.min)/(l.max-l.min),$=100*(E[1]>l.max?l.max:E[1]-l.min)/(l.max-l.min),G=w?X(B,null,0):X(null,B,0),J=w?X($,null,1):X(null,$,1),Q=$>B?$-B:B-$,V=$>B?B:$,a.createElement(a.Fragment,null,a.createElement("span",{className:"p-slider-range",style:w?{left:V+"%",width:Q+"%"}:{bottom:V+"%",height:Q+"%"}}),G,J)):function(){var e;e=E<l.min?l.min:E>l.max?l.max:100*(E-l.min)/(l.max-l.min);var n=w?{width:e+"%"}:{height:e+"%"},r=w?X(e,null,null):X(null,e,null);return a.createElement(a.Fragment,null,a.createElement("span",{className:"p-slider-range",style:n}),r)}();return a.createElement("div",i({ref:f,id:l.id,style:l.style,className:ne},Z,{onClick:function(e){if(!l.disabled){if(!d.current){W();var n=Y(e);l.onSlideEnd&&l.onSlideEnd({originalEvent:e,value:n})}d.current=!1}}}),re)})));g.displayName="Slider",exports.Slider=g;
@@ -262,9 +262,9 @@ var Slider = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (in
262
262
  var newValue = parsedValue;
263
263
  if (props.range) {
264
264
  if (handleIndex.current === 0) {
265
- if (parsedValue < props.min) parsedValue = props.min;else if (parsedValue > value[1]) parsedValue = value[1];
265
+ if (parsedValue < props.min) parsedValue = props.min;else if (parsedValue > props.max) parsedValue = props.max;
266
266
  } else {
267
- if (parsedValue > props.max) parsedValue = props.max;else if (parsedValue < value[0]) parsedValue = value[0];
267
+ if (parsedValue > props.max) parsedValue = props.max;else if (parsedValue < props.min) parsedValue = props.min;
268
268
  }
269
269
  newValue = _toConsumableArray(value);
270
270
  newValue[handleIndex.current] = parsedValue;
@@ -322,12 +322,14 @@ var Slider = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (in
322
322
  var handleValueEnd = (value[1] > props.max ? props.max : value[1] - props.min) * 100 / (props.max - props.min);
323
323
  var rangeStartHandle = horizontal ? createHandle(handleValueStart, null, 0) : createHandle(null, handleValueStart, 0);
324
324
  var rangeEndHandle = horizontal ? createHandle(handleValueEnd, null, 1) : createHandle(null, handleValueEnd, 1);
325
+ var rangeSliderWidth = handleValueEnd > handleValueStart ? handleValueEnd - handleValueStart : handleValueStart - handleValueEnd;
326
+ var rangeSliderPosition = handleValueEnd > handleValueStart ? handleValueStart : handleValueEnd;
325
327
  var rangeStyle = horizontal ? {
326
- left: handleValueStart + '%',
327
- width: handleValueEnd - handleValueStart + '%'
328
+ left: rangeSliderPosition + '%',
329
+ width: rangeSliderWidth + '%'
328
330
  } : {
329
- bottom: handleValueStart + '%',
330
- height: handleValueEnd - handleValueStart + '%'
331
+ bottom: rangeSliderPosition + '%',
332
+ height: rangeSliderWidth + '%'
331
333
  };
332
334
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
333
335
  className: "p-slider-range",
@@ -1 +1 @@
1
- import*as e from"react";import{useEventListener as n}from"primereact/hooks";import{ObjectUtils as r,DomHandler as t,classNames as a}from"primereact/utils";function o(){return o=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},o.apply(this,arguments)}function i(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}function l(e){if(Array.isArray(e))return i(e)}function u(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function c(e,n){if(e){if("string"==typeof e)return i(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,n):void 0}}function s(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(e){if(Array.isArray(e))return e}function m(e,n){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var t,a,o,i,l=[],u=!0,c=!1;try{if(o=(r=r.call(e)).next,0===n){if(Object(r)!==r)return;u=!1}else for(;!(u=(t=o.call(r)).done)&&(l.push(t.value),l.length!==n);u=!0);}catch(e){c=!0,a=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw a}}return l}}function d(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function p(e,n){return f(e)||m(e,n)||c(e,n)||d()}var h={defaultProps:{__TYPE:"Slider",id:null,value:null,min:0,max:100,orientation:"horizontal",step:null,range:!1,style:null,className:null,disabled:!1,tabIndex:0,onChange:null,onSlideEnd:null,children:void 0},getProps:function(e){return r.getMergedProps(e,h.defaultProps)},getOtherProps:function(e){return r.getDiffProps(e,h.defaultProps)}},v=e.memo(e.forwardRef((function(i,f){var m=h.getProps(i),d=e.useRef(null),v=e.useRef(0),g=e.useRef(!1),y=e.useRef(!1),b=e.useRef(0),x=e.useRef(0),w=e.useRef(0),E=e.useRef(0),S=m.range?m.value||[m.min,m.max]:m.value||0,A="horizontal"===m.orientation,P="vertical"===m.orientation,R=p(n({type:"mousemove",listener:function(e){return _(e)}}),2),O=R[0],I=R[1],j=p(n({type:"mouseup",listener:function(e){return H(e)}}),2),C=j[0],N=j[1],D=p(n({type:"touchmove",listener:function(e){return _(e)}}),2),M=D[0],T=D[1],F=p(n({type:"touchend",listener:function(e){return H(e)}}),2),k=F[0],z=F[1],W=function(e,n){$(e,(m.range?S[v.current]:S)+(m.step||1)*n),e.preventDefault()},Y=function(e,n){m.disabled||(y.current=!0,X(),g.current=!0,v.current=n)},_=function(e){y.current&&(B(e),e.preventDefault())},H=function(e){y.current&&(y.current=!1,m.onSlideEnd&&m.onSlideEnd({originalEvent:e,value:m.value}),I(),N(),T(),z())},K=function(e,n){O(),C(),Y(0,n)},L=function(e,n){M(),k(),Y(0,n)},U=function(e,n){if(!m.disabled){v.current=n;var r=e.key;"ArrowRight"===r||"ArrowUp"===r?W(e,1):"ArrowLeft"!==r&&"ArrowDown"!==r||W(e,-1)}},X=function(){var e=d.current.getBoundingClientRect();b.current=e.left+t.getWindowScrollLeft(),x.current=e.top+t.getWindowScrollTop(),w.current=d.current.offsetWidth,E.current=d.current.offsetHeight},B=function(e){var n=(A?100*((e.touches?e.touches[0].pageX:e.pageX)-b.current)/w.current:100*(x.current+E.current-(e.touches?e.touches[0].pageY:e.pageY))/E.current)/100*(m.max-m.min)+m.min;if(m.step){var r=m.range?S[v.current]:S,t=n-r;t<0?n=r+Math.ceil(n/m.step-r/m.step)*m.step:t>0&&(n=r+Math.floor(n/m.step-r/m.step)*m.step)}else n=Math.floor(n);return $(e,n)},$=function(e,n){var r,t=parseFloat(n.toFixed(10)),a=t;return m.range?(0===v.current?t<m.min?t=m.min:t>S[1]&&(t=S[1]):t>m.max?t=m.max:t<S[0]&&(t=S[0]),(a=l(r=S)||u(r)||c(r)||s())[v.current]=t,m.onChange&&m.onChange({originalEvent:e,value:a})):(t<m.min?t=m.min:t>m.max&&(t=m.max),a=t,m.onChange&&m.onChange({originalEvent:e,value:a})),a},q=function(n,r,t){var i={transition:y.current?"none":null,left:null!==n&&n+"%",bottom:r&&r+"%"},l=a("p-slider-handle",{"p-slider-handle-start":0===t,"p-slider-handle-end":1===t,"p-slider-handle-active":v.current===t});return e.createElement("span",o({className:l,style:i,tabIndex:m.tabIndex,role:"slider",onMouseDown:function(e){return K(0,t)},onTouchStart:function(e){return L(0,t)},onKeyDown:function(e){return U(e,t)},"aria-valuemin":m.min,"aria-valuemax":m.max,"aria-valuenow":n||r,"aria-orientation":m.orientation},ee))};e.useImperativeHandle(f,(function(){return{props:m,getElement:function(){return d.current}}}));var G,J,Q,V,Z=h.getOtherProps(m),ee=r.reduceKeys(Z,t.ARIA_PROPS),ne=a("p-slider p-component",m.className,{"p-disabled":m.disabled,"p-slider-horizontal":A,"p-slider-vertical":P}),re=m.range?(G=100*(S[0]<m.min?m.min:S[0]-m.min)/(m.max-m.min),J=100*(S[1]>m.max?m.max:S[1]-m.min)/(m.max-m.min),Q=A?q(G,null,0):q(null,G,0),V=A?q(J,null,1):q(null,J,1),e.createElement(e.Fragment,null,e.createElement("span",{className:"p-slider-range",style:A?{left:G+"%",width:J-G+"%"}:{bottom:G+"%",height:J-G+"%"}}),Q,V)):function(){var n;n=S<m.min?m.min:S>m.max?m.max:100*(S-m.min)/(m.max-m.min);var r=A?{width:n+"%"}:{height:n+"%"},t=A?q(n,null,null):q(null,n,null);return e.createElement(e.Fragment,null,e.createElement("span",{className:"p-slider-range",style:r}),t)}();return e.createElement("div",o({ref:d,id:m.id,style:m.style,className:ne},Z,{onClick:function(e){if(!m.disabled){if(!g.current){X();var n=B(e);m.onSlideEnd&&m.onSlideEnd({originalEvent:e,value:n})}g.current=!1}}}),re)})));v.displayName="Slider";export{v as Slider};
1
+ import*as e from"react";import{useEventListener as n}from"primereact/hooks";import{ObjectUtils as r,DomHandler as t,classNames as a}from"primereact/utils";function i(){return i=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},i.apply(this,arguments)}function o(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=new Array(n);r<n;r++)t[r]=e[r];return t}function l(e){if(Array.isArray(e))return o(e)}function u(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function c(e,n){if(e){if("string"==typeof e)return o(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,n):void 0}}function s(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(e){if(Array.isArray(e))return e}function m(e,n){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var t,a,i,o,l=[],u=!0,c=!1;try{if(i=(r=r.call(e)).next,0===n){if(Object(r)!==r)return;u=!1}else for(;!(u=(t=i.call(r)).done)&&(l.push(t.value),l.length!==n);u=!0);}catch(e){c=!0,a=e}finally{try{if(!u&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw a}}return l}}function d(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function p(e,n){return f(e)||m(e,n)||c(e,n)||d()}var h={defaultProps:{__TYPE:"Slider",id:null,value:null,min:0,max:100,orientation:"horizontal",step:null,range:!1,style:null,className:null,disabled:!1,tabIndex:0,onChange:null,onSlideEnd:null,children:void 0},getProps:function(e){return r.getMergedProps(e,h.defaultProps)},getOtherProps:function(e){return r.getDiffProps(e,h.defaultProps)}},v=e.memo(e.forwardRef((function(o,f){var m=h.getProps(o),d=e.useRef(null),v=e.useRef(0),g=e.useRef(!1),y=e.useRef(!1),b=e.useRef(0),x=e.useRef(0),w=e.useRef(0),E=e.useRef(0),S=m.range?m.value||[m.min,m.max]:m.value||0,A="horizontal"===m.orientation,P="vertical"===m.orientation,R=p(n({type:"mousemove",listener:function(e){return _(e)}}),2),O=R[0],I=R[1],j=p(n({type:"mouseup",listener:function(e){return H(e)}}),2),C=j[0],N=j[1],D=p(n({type:"touchmove",listener:function(e){return _(e)}}),2),M=D[0],T=D[1],F=p(n({type:"touchend",listener:function(e){return H(e)}}),2),k=F[0],z=F[1],W=function(e,n){$(e,(m.range?S[v.current]:S)+(m.step||1)*n),e.preventDefault()},Y=function(e,n){m.disabled||(y.current=!0,X(),g.current=!0,v.current=n)},_=function(e){y.current&&(B(e),e.preventDefault())},H=function(e){y.current&&(y.current=!1,m.onSlideEnd&&m.onSlideEnd({originalEvent:e,value:m.value}),I(),N(),T(),z())},K=function(e,n){O(),C(),Y(0,n)},L=function(e,n){M(),k(),Y(0,n)},U=function(e,n){if(!m.disabled){v.current=n;var r=e.key;"ArrowRight"===r||"ArrowUp"===r?W(e,1):"ArrowLeft"!==r&&"ArrowDown"!==r||W(e,-1)}},X=function(){var e=d.current.getBoundingClientRect();b.current=e.left+t.getWindowScrollLeft(),x.current=e.top+t.getWindowScrollTop(),w.current=d.current.offsetWidth,E.current=d.current.offsetHeight},B=function(e){var n=(A?100*((e.touches?e.touches[0].pageX:e.pageX)-b.current)/w.current:100*(x.current+E.current-(e.touches?e.touches[0].pageY:e.pageY))/E.current)/100*(m.max-m.min)+m.min;if(m.step){var r=m.range?S[v.current]:S,t=n-r;t<0?n=r+Math.ceil(n/m.step-r/m.step)*m.step:t>0&&(n=r+Math.floor(n/m.step-r/m.step)*m.step)}else n=Math.floor(n);return $(e,n)},$=function(e,n){var r,t=parseFloat(n.toFixed(10)),a=t;return m.range?(0===v.current?t<m.min?t=m.min:t>m.max&&(t=m.max):t>m.max?t=m.max:t<m.min&&(t=m.min),(a=l(r=S)||u(r)||c(r)||s())[v.current]=t,m.onChange&&m.onChange({originalEvent:e,value:a})):(t<m.min?t=m.min:t>m.max&&(t=m.max),a=t,m.onChange&&m.onChange({originalEvent:e,value:a})),a},q=function(n,r,t){var o={transition:y.current?"none":null,left:null!==n&&n+"%",bottom:r&&r+"%"},l=a("p-slider-handle",{"p-slider-handle-start":0===t,"p-slider-handle-end":1===t,"p-slider-handle-active":v.current===t});return e.createElement("span",i({className:l,style:o,tabIndex:m.tabIndex,role:"slider",onMouseDown:function(e){return K(0,t)},onTouchStart:function(e){return L(0,t)},onKeyDown:function(e){return U(e,t)},"aria-valuemin":m.min,"aria-valuemax":m.max,"aria-valuenow":n||r,"aria-orientation":m.orientation},re))};e.useImperativeHandle(f,(function(){return{props:m,getElement:function(){return d.current}}}));var G,J,Q,V,Z,ee,ne=h.getOtherProps(m),re=r.reduceKeys(ne,t.ARIA_PROPS),te=a("p-slider p-component",m.className,{"p-disabled":m.disabled,"p-slider-horizontal":A,"p-slider-vertical":P}),ae=m.range?(G=100*(S[0]<m.min?m.min:S[0]-m.min)/(m.max-m.min),J=100*(S[1]>m.max?m.max:S[1]-m.min)/(m.max-m.min),Q=A?q(G,null,0):q(null,G,0),V=A?q(J,null,1):q(null,J,1),Z=J>G?J-G:G-J,ee=J>G?G:J,e.createElement(e.Fragment,null,e.createElement("span",{className:"p-slider-range",style:A?{left:ee+"%",width:Z+"%"}:{bottom:ee+"%",height:Z+"%"}}),Q,V)):function(){var n;n=S<m.min?m.min:S>m.max?m.max:100*(S-m.min)/(m.max-m.min);var r=A?{width:n+"%"}:{height:n+"%"},t=A?q(n,null,null):q(null,n,null);return e.createElement(e.Fragment,null,e.createElement("span",{className:"p-slider-range",style:r}),t)}();return e.createElement("div",i({ref:d,id:m.id,style:m.style,className:te},ne,{onClick:function(e){if(!m.disabled){if(!g.current){X();var n=B(e);m.onSlideEnd&&m.onSlideEnd({originalEvent:e,value:n})}g.current=!1}}}),ae)})));v.displayName="Slider";export{v as Slider};
package/slider/slider.js CHANGED
@@ -282,9 +282,9 @@ this.primereact.slider = (function (exports, React, hooks, utils) {
282
282
  var newValue = parsedValue;
283
283
  if (props.range) {
284
284
  if (handleIndex.current === 0) {
285
- if (parsedValue < props.min) parsedValue = props.min;else if (parsedValue > value[1]) parsedValue = value[1];
285
+ if (parsedValue < props.min) parsedValue = props.min;else if (parsedValue > props.max) parsedValue = props.max;
286
286
  } else {
287
- if (parsedValue > props.max) parsedValue = props.max;else if (parsedValue < value[0]) parsedValue = value[0];
287
+ if (parsedValue > props.max) parsedValue = props.max;else if (parsedValue < props.min) parsedValue = props.min;
288
288
  }
289
289
  newValue = _toConsumableArray(value);
290
290
  newValue[handleIndex.current] = parsedValue;
@@ -342,12 +342,14 @@ this.primereact.slider = (function (exports, React, hooks, utils) {
342
342
  var handleValueEnd = (value[1] > props.max ? props.max : value[1] - props.min) * 100 / (props.max - props.min);
343
343
  var rangeStartHandle = horizontal ? createHandle(handleValueStart, null, 0) : createHandle(null, handleValueStart, 0);
344
344
  var rangeEndHandle = horizontal ? createHandle(handleValueEnd, null, 1) : createHandle(null, handleValueEnd, 1);
345
+ var rangeSliderWidth = handleValueEnd > handleValueStart ? handleValueEnd - handleValueStart : handleValueStart - handleValueEnd;
346
+ var rangeSliderPosition = handleValueEnd > handleValueStart ? handleValueStart : handleValueEnd;
345
347
  var rangeStyle = horizontal ? {
346
- left: handleValueStart + '%',
347
- width: handleValueEnd - handleValueStart + '%'
348
+ left: rangeSliderPosition + '%',
349
+ width: rangeSliderWidth + '%'
348
350
  } : {
349
- bottom: handleValueStart + '%',
350
- height: handleValueEnd - handleValueStart + '%'
351
+ bottom: rangeSliderPosition + '%',
352
+ height: rangeSliderWidth + '%'
351
353
  };
352
354
  return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("span", {
353
355
  className: "p-slider-range",
@@ -1 +1 @@
1
- this.primereact=this.primereact||{},this.primereact.slider=function(e,n,t,r){"use strict";function a(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var i=a(n);function l(){return l=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},l.apply(this,arguments)}function o(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function u(e){if(Array.isArray(e))return o(e)}function c(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function s(e,n){if(e){if("string"==typeof e)return o(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?o(e,n):void 0}}function f(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e){if(Array.isArray(e))return e}function m(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,a,i,l,o=[],u=!0,c=!1;try{if(i=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;u=!1}else for(;!(u=(r=i.call(t)).done)&&(o.push(r.value),o.length!==n);u=!0);}catch(e){c=!0,a=e}finally{try{if(!u&&null!=t.return&&(l=t.return(),Object(l)!==l))return}finally{if(c)throw a}}return o}}function p(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(e,n){return d(e)||m(e,n)||s(e,n)||p()}var h={defaultProps:{__TYPE:"Slider",id:null,value:null,min:0,max:100,orientation:"horizontal",step:null,range:!1,style:null,className:null,disabled:!1,tabIndex:0,onChange:null,onSlideEnd:null,children:void 0},getProps:function(e){return r.ObjectUtils.getMergedProps(e,h.defaultProps)},getOtherProps:function(e){return r.ObjectUtils.getDiffProps(e,h.defaultProps)}},g=i.memo(i.forwardRef((function(e,n){var a=h.getProps(e),o=i.useRef(null),d=i.useRef(0),m=i.useRef(!1),p=i.useRef(!1),g=i.useRef(0),y=i.useRef(0),b=i.useRef(0),E=i.useRef(0),w=a.range?a.value||[a.min,a.max]:a.value||0,x="horizontal"===a.orientation,O="vertical"===a.orientation,S=v(t.useEventListener({type:"mousemove",listener:function(e){return U(e)}}),2),j=S[0],P=S[1],A=v(t.useEventListener({type:"mouseup",listener:function(e){return k(e)}}),2),R=A[0],D=A[1],I=v(t.useEventListener({type:"touchmove",listener:function(e){return U(e)}}),2),N=I[0],C=I[1],M=v(t.useEventListener({type:"touchend",listener:function(e){return k(e)}}),2),_=M[0],L=M[1],H=function(e,n){X(e,(a.range?w[d.current]:w)+(a.step||1)*n),e.preventDefault()},T=function(e,n){a.disabled||(p.current=!0,Y(),m.current=!0,d.current=n)},U=function(e){p.current&&(K(e),e.preventDefault())},k=function(e){p.current&&(p.current=!1,a.onSlideEnd&&a.onSlideEnd({originalEvent:e,value:a.value}),P(),D(),C(),L())},z=function(e,n){j(),R(),T(0,n)},F=function(e,n){N(),_(),T(0,n)},W=function(e,n){if(!a.disabled){d.current=n;var t=e.key;"ArrowRight"===t||"ArrowUp"===t?H(e,1):"ArrowLeft"!==t&&"ArrowDown"!==t||H(e,-1)}},Y=function(){var e=o.current.getBoundingClientRect();g.current=e.left+r.DomHandler.getWindowScrollLeft(),y.current=e.top+r.DomHandler.getWindowScrollTop(),b.current=o.current.offsetWidth,E.current=o.current.offsetHeight},K=function(e){var n=(x?100*((e.touches?e.touches[0].pageX:e.pageX)-g.current)/b.current:100*(y.current+E.current-(e.touches?e.touches[0].pageY:e.pageY))/E.current)/100*(a.max-a.min)+a.min;if(a.step){var t=a.range?w[d.current]:w,r=n-t;r<0?n=t+Math.ceil(n/a.step-t/a.step)*a.step:r>0&&(n=t+Math.floor(n/a.step-t/a.step)*a.step)}else n=Math.floor(n);return X(e,n)},X=function(e,n){var t,r=parseFloat(n.toFixed(10)),i=r;return a.range?(0===d.current?r<a.min?r=a.min:r>w[1]&&(r=w[1]):r>a.max?r=a.max:r<w[0]&&(r=w[0]),(i=u(t=w)||c(t)||s(t)||f())[d.current]=r,a.onChange&&a.onChange({originalEvent:e,value:i})):(r<a.min?r=a.min:r>a.max&&(r=a.max),i=r,a.onChange&&a.onChange({originalEvent:e,value:i})),i},B=function(e,n,t){var o={transition:p.current?"none":null,left:null!==e&&e+"%",bottom:n&&n+"%"},u=r.classNames("p-slider-handle",{"p-slider-handle-start":0===t,"p-slider-handle-end":1===t,"p-slider-handle-active":d.current===t});return i.createElement("span",l({className:u,style:o,tabIndex:a.tabIndex,role:"slider",onMouseDown:function(e){return z(0,t)},onTouchStart:function(e){return F(0,t)},onKeyDown:function(e){return W(e,t)},"aria-valuemin":a.min,"aria-valuemax":a.max,"aria-valuenow":e||n,"aria-orientation":a.orientation},V))};i.useImperativeHandle(n,(function(){return{props:a,getElement:function(){return o.current}}}));var $,q,G,J,Q=h.getOtherProps(a),V=r.ObjectUtils.reduceKeys(Q,r.DomHandler.ARIA_PROPS),Z=r.classNames("p-slider p-component",a.className,{"p-disabled":a.disabled,"p-slider-horizontal":x,"p-slider-vertical":O}),ee=a.range?($=100*(w[0]<a.min?a.min:w[0]-a.min)/(a.max-a.min),q=100*(w[1]>a.max?a.max:w[1]-a.min)/(a.max-a.min),G=x?B($,null,0):B(null,$,0),J=x?B(q,null,1):B(null,q,1),i.createElement(i.Fragment,null,i.createElement("span",{className:"p-slider-range",style:x?{left:$+"%",width:q-$+"%"}:{bottom:$+"%",height:q-$+"%"}}),G,J)):function(){var e;e=w<a.min?a.min:w>a.max?a.max:100*(w-a.min)/(a.max-a.min);var n=x?{width:e+"%"}:{height:e+"%"},t=x?B(e,null,null):B(null,e,null);return i.createElement(i.Fragment,null,i.createElement("span",{className:"p-slider-range",style:n}),t)}();return i.createElement("div",l({ref:o,id:a.id,style:a.style,className:Z},Q,{onClick:function(e){if(!a.disabled){if(!m.current){Y();var n=K(e);a.onSlideEnd&&a.onSlideEnd({originalEvent:e,value:n})}m.current=!1}}}),ee)})));return g.displayName="Slider",e.Slider=g,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.hooks,primereact.utils);
1
+ this.primereact=this.primereact||{},this.primereact.slider=function(e,n,t,r){"use strict";function a(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var i=a(n);function l(){return l=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},l.apply(this,arguments)}function o(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function u(e){if(Array.isArray(e))return o(e)}function c(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function s(e,n){if(e){if("string"==typeof e)return o(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?o(e,n):void 0}}function f(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(e){if(Array.isArray(e))return e}function d(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,a,i,l,o=[],u=!0,c=!1;try{if(i=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;u=!1}else for(;!(u=(r=i.call(t)).done)&&(o.push(r.value),o.length!==n);u=!0);}catch(e){c=!0,a=e}finally{try{if(!u&&null!=t.return&&(l=t.return(),Object(l)!==l))return}finally{if(c)throw a}}return o}}function p(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(e,n){return m(e)||d(e,n)||s(e,n)||p()}var h={defaultProps:{__TYPE:"Slider",id:null,value:null,min:0,max:100,orientation:"horizontal",step:null,range:!1,style:null,className:null,disabled:!1,tabIndex:0,onChange:null,onSlideEnd:null,children:void 0},getProps:function(e){return r.ObjectUtils.getMergedProps(e,h.defaultProps)},getOtherProps:function(e){return r.ObjectUtils.getDiffProps(e,h.defaultProps)}},g=i.memo(i.forwardRef((function(e,n){var a=h.getProps(e),o=i.useRef(null),m=i.useRef(0),d=i.useRef(!1),p=i.useRef(!1),g=i.useRef(0),y=i.useRef(0),b=i.useRef(0),E=i.useRef(0),x=a.range?a.value||[a.min,a.max]:a.value||0,w="horizontal"===a.orientation,O="vertical"===a.orientation,S=v(t.useEventListener({type:"mousemove",listener:function(e){return U(e)}}),2),j=S[0],P=S[1],A=v(t.useEventListener({type:"mouseup",listener:function(e){return k(e)}}),2),R=A[0],D=A[1],I=v(t.useEventListener({type:"touchmove",listener:function(e){return U(e)}}),2),N=I[0],C=I[1],M=v(t.useEventListener({type:"touchend",listener:function(e){return k(e)}}),2),_=M[0],L=M[1],H=function(e,n){X(e,(a.range?x[m.current]:x)+(a.step||1)*n),e.preventDefault()},T=function(e,n){a.disabled||(p.current=!0,Y(),d.current=!0,m.current=n)},U=function(e){p.current&&(K(e),e.preventDefault())},k=function(e){p.current&&(p.current=!1,a.onSlideEnd&&a.onSlideEnd({originalEvent:e,value:a.value}),P(),D(),C(),L())},z=function(e,n){j(),R(),T(0,n)},F=function(e,n){N(),_(),T(0,n)},W=function(e,n){if(!a.disabled){m.current=n;var t=e.key;"ArrowRight"===t||"ArrowUp"===t?H(e,1):"ArrowLeft"!==t&&"ArrowDown"!==t||H(e,-1)}},Y=function(){var e=o.current.getBoundingClientRect();g.current=e.left+r.DomHandler.getWindowScrollLeft(),y.current=e.top+r.DomHandler.getWindowScrollTop(),b.current=o.current.offsetWidth,E.current=o.current.offsetHeight},K=function(e){var n=(w?100*((e.touches?e.touches[0].pageX:e.pageX)-g.current)/b.current:100*(y.current+E.current-(e.touches?e.touches[0].pageY:e.pageY))/E.current)/100*(a.max-a.min)+a.min;if(a.step){var t=a.range?x[m.current]:x,r=n-t;r<0?n=t+Math.ceil(n/a.step-t/a.step)*a.step:r>0&&(n=t+Math.floor(n/a.step-t/a.step)*a.step)}else n=Math.floor(n);return X(e,n)},X=function(e,n){var t,r=parseFloat(n.toFixed(10)),i=r;return a.range?(0===m.current?r<a.min?r=a.min:r>a.max&&(r=a.max):r>a.max?r=a.max:r<a.min&&(r=a.min),(i=u(t=x)||c(t)||s(t)||f())[m.current]=r,a.onChange&&a.onChange({originalEvent:e,value:i})):(r<a.min?r=a.min:r>a.max&&(r=a.max),i=r,a.onChange&&a.onChange({originalEvent:e,value:i})),i},B=function(e,n,t){var o={transition:p.current?"none":null,left:null!==e&&e+"%",bottom:n&&n+"%"},u=r.classNames("p-slider-handle",{"p-slider-handle-start":0===t,"p-slider-handle-end":1===t,"p-slider-handle-active":m.current===t});return i.createElement("span",l({className:u,style:o,tabIndex:a.tabIndex,role:"slider",onMouseDown:function(e){return z(0,t)},onTouchStart:function(e){return F(0,t)},onKeyDown:function(e){return W(e,t)},"aria-valuemin":a.min,"aria-valuemax":a.max,"aria-valuenow":e||n,"aria-orientation":a.orientation},ee))};i.useImperativeHandle(n,(function(){return{props:a,getElement:function(){return o.current}}}));var $,q,G,J,Q,V,Z=h.getOtherProps(a),ee=r.ObjectUtils.reduceKeys(Z,r.DomHandler.ARIA_PROPS),ne=r.classNames("p-slider p-component",a.className,{"p-disabled":a.disabled,"p-slider-horizontal":w,"p-slider-vertical":O}),te=a.range?($=100*(x[0]<a.min?a.min:x[0]-a.min)/(a.max-a.min),q=100*(x[1]>a.max?a.max:x[1]-a.min)/(a.max-a.min),G=w?B($,null,0):B(null,$,0),J=w?B(q,null,1):B(null,q,1),Q=q>$?q-$:$-q,V=q>$?$:q,i.createElement(i.Fragment,null,i.createElement("span",{className:"p-slider-range",style:w?{left:V+"%",width:Q+"%"}:{bottom:V+"%",height:Q+"%"}}),G,J)):function(){var e;e=x<a.min?a.min:x>a.max?a.max:100*(x-a.min)/(a.max-a.min);var n=w?{width:e+"%"}:{height:e+"%"},t=w?B(e,null,null):B(null,e,null);return i.createElement(i.Fragment,null,i.createElement("span",{className:"p-slider-range",style:n}),t)}();return i.createElement("div",l({ref:o,id:a.id,style:a.style,className:ne},Z,{onClick:function(e){if(!a.disabled){if(!d.current){Y();var n=K(e);a.onSlideEnd&&a.onSlideEnd({originalEvent:e,value:n})}d.current=!1}}}),te)})));return g.displayName="Slider",e.Slider=g,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.hooks,primereact.utils);
package/tree/tree.d.ts CHANGED
@@ -228,6 +228,10 @@ interface TreeDragDropEvent {
228
228
  * The node that is being dragged.
229
229
  */
230
230
  dragNode: TreeNode;
231
+ /**
232
+ * The node that is being dropped on.
233
+ */
234
+ dropNode: TreeNode;
231
235
  /**
232
236
  * The index of the drop.
233
237
  */
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "React",
3
3
  "name": "PrimeReact",
4
- "version": "9.2.1",
4
+ "version": "9.2.3",
5
5
  "tags": [
6
6
  {
7
7
  "name": "Accordion",