@mtes-mct/monitor-ui 7.0.0 → 7.2.0
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 +17 -0
- package/README.md +1 -0
- package/components/Notifier/NotificationEvent.d.ts +9 -0
- package/components/Notifier/index.d.ts +6 -0
- package/index.d.ts +5 -0
- package/index.js +91 -19
- package/index.js.map +1 -1
- package/package.json +4 -3
- package/utils/getPseudoRandomString.d.ts +1 -1
- package/utils/logSoftError.d.ts +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
# [7.1.0](https://github.com/MTES-MCT/monitor-ui/compare/v7.0.0...v7.1.0) (2023-05-30)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **elements:** expose FieldError ([1e8efa9](https://github.com/MTES-MCT/monitor-ui/commit/1e8efa9c82812442d532cfce2b8837716570e78a))
|
|
7
|
+
|
|
8
|
+
# [7.0.0](https://github.com/MTES-MCT/monitor-ui/compare/v6.6.0...v7.0.0) (2023-05-29)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
* fix(fields)!: move style prop passing to container level ([3d727a1](https://github.com/MTES-MCT/monitor-ui/commit/3d727a17b49898f268c7e7b8405ba60c65211a30))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* Fields `style` & `className` props are now passed to the container.
|
|
17
|
+
|
|
1
18
|
# [6.6.0](https://github.com/MTES-MCT/monitor-ui/compare/v6.5.2...v6.6.0) (2023-05-28)
|
|
2
19
|
|
|
3
20
|
|
package/README.md
CHANGED
|
@@ -31,6 +31,7 @@ import { createGlobalStyle, ThemeProvider } from 'styled-components'
|
|
|
31
31
|
|
|
32
32
|
const UntypedThemeProvider = ThemeProvider as any
|
|
33
33
|
|
|
34
|
+
import 'react-toastify/dist/ReactToastify.css'
|
|
34
35
|
import 'rsuite/dist/rsuite.css'
|
|
35
36
|
import '@mtes-mct/monitor-ui/assets/stylesheets/rsuite-override.css'
|
|
36
37
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TypeOptions } from 'react-toastify';
|
|
2
|
+
export type NotificationEventDetail = {
|
|
3
|
+
isSideWindowError: boolean;
|
|
4
|
+
message: string;
|
|
5
|
+
type: TypeOptions;
|
|
6
|
+
};
|
|
7
|
+
export declare class NotificationEvent extends CustomEvent<NotificationEventDetail> {
|
|
8
|
+
constructor(message: string, type: TypeOptions, isSideWindowError?: boolean);
|
|
9
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -13,10 +13,12 @@ export { ThemeProvider } from './ThemeProvider';
|
|
|
13
13
|
export { Dialog } from './components/Dialog';
|
|
14
14
|
export { Dropdown } from './components/Dropdown';
|
|
15
15
|
export { NewWindow } from './components/NewWindow';
|
|
16
|
+
export { NotificationEvent, Notifier } from './components/Notifier';
|
|
16
17
|
export { SingleTag } from './components/SingleTag';
|
|
17
18
|
export { Button } from './elements/Button';
|
|
18
19
|
export { Field } from './elements/Field';
|
|
19
20
|
export { Fieldset } from './elements/Fieldset';
|
|
21
|
+
export { FieldError } from './elements/FieldError';
|
|
20
22
|
export { IconButton } from './elements/IconButton';
|
|
21
23
|
export { Label } from './elements/Label';
|
|
22
24
|
export { Legend } from './elements/Legend';
|
|
@@ -63,16 +65,19 @@ export { getLocalizedDayjs } from './utils/getLocalizedDayjs';
|
|
|
63
65
|
export { getPseudoRandomString } from './utils/getPseudoRandomString';
|
|
64
66
|
export { getUtcizedDayjs } from './utils/getUtcizedDayjs';
|
|
65
67
|
export { isNumeric } from './utils/isNumeric';
|
|
68
|
+
export { logSoftError } from './utils/logSoftError';
|
|
66
69
|
export { stopMouseEventPropagation } from './utils/stopMouseEventPropagation';
|
|
67
70
|
export type { PartialTheme, Theme } from './theme';
|
|
68
71
|
export type { Coordinates, DateAsStringRange, DateRange, Defined, IconProps, Option, OptionValueType, Undefine } from './types';
|
|
69
72
|
export type { DialogProps } from './components/Dialog';
|
|
70
73
|
export type { DropdownProps, DropdownItemProps } from './components/Dropdown';
|
|
71
74
|
export type { NewWindowProps } from './components/NewWindow';
|
|
75
|
+
export type { NotifierProps } from './components/Notifier';
|
|
72
76
|
export type { SingleTagProps } from './components/SingleTag';
|
|
73
77
|
export type { ButtonProps } from './elements/Button';
|
|
74
78
|
export type { FieldProps } from './elements/Field';
|
|
75
79
|
export type { FieldsetProps } from './elements/Fieldset';
|
|
80
|
+
export type { FieldErrorProps } from './elements/FieldError';
|
|
76
81
|
export type { IconButtonProps } from './elements/IconButton';
|
|
77
82
|
export type { LabelProps } from './elements/Label';
|
|
78
83
|
export type { LegendProps } from './elements/Legend';
|
package/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import styled, { createGlobalStyle, ThemeProvider as ThemeProvider$1, css } from 'styled-components';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import
|
|
3
|
+
import t, { useMemo, PureComponent, forwardRef, useEffect, useReducer, useState, useRef, isValidElement, cloneElement, useLayoutEffect, useCallback, useImperativeHandle, createContext, useContext } from 'react';
|
|
4
4
|
import { Dropdown as Dropdown$1, AutoComplete, Checkbox as Checkbox$1, DatePicker as DatePicker$1, DateRangePicker as DateRangePicker$1, TagPicker, Radio, Input, SelectPicker } from 'rsuite';
|
|
5
5
|
import ReactDOM from 'react-dom';
|
|
6
6
|
import { useField, useFormikContext } from 'formik';
|
|
7
|
+
import { captureMessage } from '@sentry/react';
|
|
7
8
|
|
|
8
9
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
9
10
|
|
|
@@ -2593,6 +2594,52 @@ function toWindowFeatures(features) {
|
|
|
2593
2594
|
.join(',');
|
|
2594
2595
|
}
|
|
2595
2596
|
|
|
2597
|
+
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
2598
|
+
|
|
2599
|
+
const u=t=>"number"==typeof t&&!isNaN(t),d=t=>"string"==typeof t,p=t=>"function"==typeof t,m=t=>d(t)||p(t)?t:null,f=t=>isValidElement(t)||d(t)||p(t)||u(t);function g(t,e,n){void 0===n&&(n=300);const{scrollHeight:o,style:s}=t;requestAnimationFrame(()=>{s.minHeight="initial",s.height=o+"px",s.transition=`all ${n}ms`,requestAnimationFrame(()=>{s.height="0",s.padding="0",s.margin="0",setTimeout(e,n);});});}function h(e){let{enter:a,exit:r,appendPosition:i=!1,collapse:l=!0,collapseDuration:c=300}=e;return function(e){let{children:u,position:d,preventExitTransition:p,done:m,nodeRef:f,isIn:h}=e;const y=i?`${a}--${d}`:a,v=i?`${r}--${d}`:r,T=useRef(0);return useLayoutEffect(()=>{const t=f.current,e=y.split(" "),n=o=>{o.target===f.current&&(t.dispatchEvent(new Event("d")),t.removeEventListener("animationend",n),t.removeEventListener("animationcancel",n),0===T.current&&"animationcancel"!==o.type&&t.classList.remove(...e));};t.classList.add(...e),t.addEventListener("animationend",n),t.addEventListener("animationcancel",n);},[]),useEffect(()=>{const t=f.current,e=()=>{t.removeEventListener("animationend",e),l?g(t,m,c):m();};h||(p?e():(T.current=1,t.className+=` ${v}`,t.addEventListener("animationend",e)));},[h]),t.createElement(t.Fragment,null,u)}}function y(t,e){return null!=t?{content:t.content,containerId:t.props.containerId,id:t.props.toastId,theme:t.props.theme,type:t.props.type,data:t.props.data||{},isLoading:t.props.isLoading,icon:t.props.icon,status:e}:{}}const v={list:new Map,emitQueue:new Map,on(t,e){return this.list.has(t)||this.list.set(t,[]),this.list.get(t).push(e),this},off(t,e){if(e){const n=this.list.get(t).filter(t=>t!==e);return this.list.set(t,n),this}return this.list.delete(t),this},cancelEmit(t){const e=this.emitQueue.get(t);return e&&(e.forEach(clearTimeout),this.emitQueue.delete(t)),this},emit(t){this.list.has(t)&&this.list.get(t).forEach(e=>{const n=setTimeout(()=>{e(...[].slice.call(arguments,1));},0);this.emitQueue.has(t)||this.emitQueue.set(t,[]),this.emitQueue.get(t).push(n);});}},T=e=>{let{theme:n,type:o,...s}=e;return t.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"colored"===n?"currentColor":`var(--toastify-icon-color-${o})`,...s})},E={info:function(e){return t.createElement(T,{...e},t.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return t.createElement(T,{...e},t.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return t.createElement(T,{...e},t.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return t.createElement(T,{...e},t.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return t.createElement("div",{className:"Toastify__spinner"})}};function C(t){const[,o]=useReducer(t=>t+1,0),[l,c]=useState([]),g=useRef(null),h=useRef(new Map).current,T=t=>-1!==l.indexOf(t),C=useRef({toastKey:1,displayedToast:0,count:0,queue:[],props:t,containerId:null,isToastActive:T,getToast:t=>h.get(t)}).current;function b(t){let{containerId:e}=t;const{limit:n}=C.props;!n||e&&C.containerId!==e||(C.count-=C.queue.length,C.queue=[]);}function I(t){c(e=>null==t?[]:e.filter(e=>e!==t));}function _(){const{toastContent:t,toastProps:e,staleId:n}=C.queue.shift();O(t,e,n);}function L(t,n){let{delay:s,staleId:r,...i}=n;if(!f(t)||function(t){return !g.current||C.props.enableMultiContainer&&t.containerId!==C.props.containerId||h.has(t.toastId)&&null==t.updateId}(i))return;const{toastId:l,updateId:c,data:T}=i,{props:b}=C,L=()=>I(l),N=null==c;N&&C.count++;const M={...b,style:b.toastStyle,key:C.toastKey++,...Object.fromEntries(Object.entries(i).filter(t=>{let[e,n]=t;return null!=n})),toastId:l,updateId:c,data:T,closeToast:L,isIn:!1,className:m(i.className||b.toastClassName),bodyClassName:m(i.bodyClassName||b.bodyClassName),progressClassName:m(i.progressClassName||b.progressClassName),autoClose:!i.isLoading&&(R=i.autoClose,w=b.autoClose,!1===R||u(R)&&R>0?R:w),deleteToast(){const t=y(h.get(l),"removed");h.delete(l),v.emit(4,t);const e=C.queue.length;if(C.count=null==l?C.count-C.displayedToast:C.count-1,C.count<0&&(C.count=0),e>0){const t=null==l?C.props.limit:1;if(1===e||1===t)C.displayedToast++,_();else {const n=t>e?e:t;C.displayedToast=n;for(let t=0;t<n;t++)_();}}else o();}};var R,w;M.iconOut=function(t){let{theme:n,type:o,isLoading:s,icon:r}=t,i=null;const l={theme:n,type:o};return !1===r||(p(r)?i=r(l):isValidElement(r)?i=cloneElement(r,l):d(r)||u(r)?i=r:s?i=E.spinner():(t=>t in E)(o)&&(i=E[o](l))),i}(M),p(i.onOpen)&&(M.onOpen=i.onOpen),p(i.onClose)&&(M.onClose=i.onClose),M.closeButton=b.closeButton,!1===i.closeButton||f(i.closeButton)?M.closeButton=i.closeButton:!0===i.closeButton&&(M.closeButton=!f(b.closeButton)||b.closeButton);let x=t;isValidElement(t)&&!d(t.type)?x=cloneElement(t,{closeToast:L,toastProps:M,data:T}):p(t)&&(x=t({closeToast:L,toastProps:M,data:T})),b.limit&&b.limit>0&&C.count>b.limit&&N?C.queue.push({toastContent:x,toastProps:M,staleId:r}):u(s)?setTimeout(()=>{O(x,M,r);},s):O(x,M,r);}function O(t,e,n){const{toastId:o}=e;n&&h.delete(n);const s={content:t,props:e};h.set(o,s),c(t=>[...t,o].filter(t=>t!==n)),v.emit(4,y(s,null==s.props.updateId?"added":"updated"));}return useEffect(()=>(C.containerId=t.containerId,v.cancelEmit(3).on(0,L).on(1,t=>g.current&&I(t)).on(5,b).emit(2,C),()=>{h.clear(),v.emit(3,C);}),[]),useEffect(()=>{C.props=t,C.isToastActive=T,C.displayedToast=l.length;}),{getToastToRender:function(e){const n=new Map,o=Array.from(h.values());return t.newestOnTop&&o.reverse(),o.forEach(t=>{const{position:e}=t.props;n.has(e)||n.set(e,[]),n.get(e).push(t);}),Array.from(n,t=>e(t[0],t[1]))},containerRef:g,isToastActive:T}}function b(t){return t.targetTouches&&t.targetTouches.length>=1?t.targetTouches[0].clientX:t.clientX}function I(t){return t.targetTouches&&t.targetTouches.length>=1?t.targetTouches[0].clientY:t.clientY}function _$1(t){const[o,a]=useState(!1),[r,l]=useState(!1),c=useRef(null),u=useRef({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,d=useRef(t),{autoClose:m,pauseOnHover:f,closeToast:g,onClick:h,closeOnClick:y}=t;function v(e){if(t.draggable){"touchstart"===e.nativeEvent.type&&e.nativeEvent.preventDefault(),u.didMove=!1,document.addEventListener("mousemove",_),document.addEventListener("mouseup",L),document.addEventListener("touchmove",_),document.addEventListener("touchend",L);const n=c.current;u.canCloseOnClick=!0,u.canDrag=!0,u.boundingRect=n.getBoundingClientRect(),n.style.transition="",u.x=b(e.nativeEvent),u.y=I(e.nativeEvent),"x"===t.draggableDirection?(u.start=u.x,u.removalDistance=n.offsetWidth*(t.draggablePercent/100)):(u.start=u.y,u.removalDistance=n.offsetHeight*(80===t.draggablePercent?1.5*t.draggablePercent:t.draggablePercent/100));}}function T(e){if(u.boundingRect){const{top:n,bottom:o,left:s,right:a}=u.boundingRect;"touchend"!==e.nativeEvent.type&&t.pauseOnHover&&u.x>=s&&u.x<=a&&u.y>=n&&u.y<=o?C():E();}}function E(){a(!0);}function C(){a(!1);}function _(e){const n=c.current;u.canDrag&&n&&(u.didMove=!0,o&&C(),u.x=b(e),u.y=I(e),u.delta="x"===t.draggableDirection?u.x-u.start:u.y-u.start,u.start!==u.x&&(u.canCloseOnClick=!1),n.style.transform=`translate${t.draggableDirection}(${u.delta}px)`,n.style.opacity=""+(1-Math.abs(u.delta/u.removalDistance)));}function L(){document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",L),document.removeEventListener("touchmove",_),document.removeEventListener("touchend",L);const e=c.current;if(u.canDrag&&u.didMove&&e){if(u.canDrag=!1,Math.abs(u.delta)>u.removalDistance)return l(!0),void t.closeToast();e.style.transition="transform 0.2s, opacity 0.2s",e.style.transform=`translate${t.draggableDirection}(0)`,e.style.opacity="1";}}useEffect(()=>{d.current=t;}),useEffect(()=>(c.current&&c.current.addEventListener("d",E,{once:!0}),p(t.onOpen)&&t.onOpen(isValidElement(t.children)&&t.children.props),()=>{const t=d.current;p(t.onClose)&&t.onClose(isValidElement(t.children)&&t.children.props);}),[]),useEffect(()=>(t.pauseOnFocusLoss&&(document.hasFocus()||C(),window.addEventListener("focus",E),window.addEventListener("blur",C)),()=>{t.pauseOnFocusLoss&&(window.removeEventListener("focus",E),window.removeEventListener("blur",C));}),[t.pauseOnFocusLoss]);const O={onMouseDown:v,onTouchStart:v,onMouseUp:T,onTouchEnd:T};return m&&f&&(O.onMouseEnter=C,O.onMouseLeave=E),y&&(O.onClick=t=>{h&&h(t),u.canCloseOnClick&&g();}),{playToast:E,pauseToast:C,isRunning:o,preventExitTransition:r,toastRef:c,eventHandlers:O}}function L(e){let{closeToast:n,theme:o,ariaLabel:s="close"}=e;return t.createElement("button",{className:`Toastify__close-button Toastify__close-button--${o}`,type:"button",onClick:t=>{t.stopPropagation(),n(t);},"aria-label":s},t.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},t.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function O(e){let{delay:n,isRunning:o,closeToast:s,type:a="default",hide:r,className:i,style:l,controlledProgress:u,progress:d,rtl:m,isIn:f,theme:g}=e;const h=r||u&&0===d,y={...l,animationDuration:`${n}ms`,animationPlayState:o?"running":"paused",opacity:h?0:1};u&&(y.transform=`scaleX(${d})`);const v=clsx("Toastify__progress-bar",u?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${g}`,`Toastify__progress-bar--${a}`,{"Toastify__progress-bar--rtl":m}),T=p(i)?i({rtl:m,type:a,defaultClassName:v}):clsx(v,i);return t.createElement("div",{role:"progressbar","aria-hidden":h?"true":"false","aria-label":"notification timer",className:T,style:y,[u&&d>=1?"onTransitionEnd":"onAnimationEnd"]:u&&d<1?null:()=>{f&&s();}})}const N=n=>{const{isRunning:o,preventExitTransition:s,toastRef:r,eventHandlers:i}=_$1(n),{closeButton:l,children:u,autoClose:d,onClick:m,type:f,hideProgressBar:g,closeToast:h,transition:y,position:v,className:T,style:E,bodyClassName:C,bodyStyle:b,progressClassName:I,progressStyle:N,updateId:M,role:R,progress:w,rtl:x,toastId:$,deleteToast:k,isIn:P,isLoading:B,iconOut:D,closeOnClick:A,theme:z}=n,F=clsx("Toastify__toast",`Toastify__toast-theme--${z}`,`Toastify__toast--${f}`,{"Toastify__toast--rtl":x},{"Toastify__toast--close-on-click":A}),H=p(T)?T({rtl:x,position:v,type:f,defaultClassName:F}):clsx(F,T),S=!!w||!d,q={closeToast:h,type:f,theme:z};let Q=null;return !1===l||(Q=p(l)?l(q):isValidElement(l)?cloneElement(l,q):L(q)),t.createElement(y,{isIn:P,done:k,position:v,preventExitTransition:s,nodeRef:r},t.createElement("div",{id:$,onClick:m,className:H,...i,style:E,ref:r},t.createElement("div",{...P&&{role:R},className:p(C)?C({type:f}):clsx("Toastify__toast-body",C),style:b},null!=D&&t.createElement("div",{className:clsx("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!B})},D),t.createElement("div",null,u)),Q,t.createElement(O,{...M&&!S?{key:`pb-${M}`}:{},rtl:x,theme:z,delay:d,isRunning:o,isIn:P,closeToast:h,hide:g,type:f,style:N,className:I,controlledProgress:S,progress:w||0})))},M=function(t,e){return void 0===e&&(e=!1),{enter:`Toastify--animate Toastify__${t}-enter`,exit:`Toastify--animate Toastify__${t}-exit`,appendPosition:e}},R=h(M("bounce",!0));h(M("slide",!0));h(M("zoom"));h(M("flip"));const k=forwardRef((e,n)=>{const{getToastToRender:o,containerRef:a,isToastActive:r}=C(e),{className:i,style:l,rtl:u,containerId:d}=e;function f(t){const e=clsx("Toastify__toast-container",`Toastify__toast-container--${t}`,{"Toastify__toast-container--rtl":u});return p(i)?i({position:t,rtl:u,defaultClassName:e}):clsx(e,m(i))}return useEffect(()=>{n&&(n.current=a.current);},[]),t.createElement("div",{ref:a,className:"Toastify",id:d},o((e,n)=>{const o=n.length?{...l}:{...l,pointerEvents:"none"};return t.createElement("div",{className:f(e),style:o,key:`container-${e}`},n.map((e,o)=>{let{content:s,props:a}=e;return t.createElement(N,{...a,isIn:r(a.toastId),style:{...a.style,"--nth":o+1,"--len":n.length},key:`toast-${a.key}`},s)}))}))});k.displayName="ToastContainer",k.defaultProps={position:"top-right",transition:R,autoClose:5e3,closeButton:L,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};let P,B=new Map,D=[],A=1;function z(){return ""+A++}function F(t){return t&&(d(t.toastId)||u(t.toastId))?t.toastId:z()}function H(t,e){return B.size>0?v.emit(0,t,e):D.push({content:t,options:e}),e.toastId}function S(t,e){return {...e,type:e&&e.type||t,toastId:F(e)}}function q(t){return (e,n)=>H(e,S(t,n))}function Q(t,e){return H(t,S("default",e))}Q.loading=(t,e)=>H(t,S("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...e})),Q.promise=function(t,e,n){let o,{pending:s,error:a,success:r}=e;s&&(o=d(s)?Q.loading(s,n):Q.loading(s.render,{...n,...s}));const i={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},l=(t,e,s)=>{if(null==e)return void Q.dismiss(o);const a={type:t,...i,...n,data:s},r=d(e)?{render:e}:e;return o?Q.update(o,{...a,...r}):Q(r.render,{...a,...r}),s},c=p(t)?t():t;return c.then(t=>l("success",r,t)).catch(t=>l("error",a,t)),c},Q.success=q("success"),Q.info=q("info"),Q.error=q("error"),Q.warning=q("warning"),Q.warn=Q.warning,Q.dark=(t,e)=>H(t,S("default",{theme:"dark",...e})),Q.dismiss=t=>{B.size>0?v.emit(1,t):D=D.filter(e=>null!=t&&e.options.toastId!==t);},Q.clearWaitingQueue=function(t){return void 0===t&&(t={}),v.emit(5,t)},Q.isActive=t=>{let e=!1;return B.forEach(n=>{n.isToastActive&&n.isToastActive(t)&&(e=!0);}),e},Q.update=function(t,e){void 0===e&&(e={}),setTimeout(()=>{const n=function(t,e){let{containerId:n}=e;const o=B.get(n||P);return o&&o.getToast(t)}(t,e);if(n){const{props:o,content:s}=n,a={delay:100,...o,...e,toastId:e.toastId||t,updateId:z()};a.toastId!==t&&(a.staleId=t);const r=a.render||s;delete a.render,H(r,a);}},0);},Q.done=t=>{Q.update(t,{progress:1});},Q.onChange=t=>(v.on(4,t),()=>{v.off(4,t);}),Q.POSITION={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},Q.TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},v.on(2,t=>{P=t.containerId||t,B.set(P,t),D.forEach(t=>{v.emit(0,t.content,t.options);}),D=[];}).on(3,t=>{B.delete(t.containerId||t),0===B.size&&v.off(0).off(1).off(5);});
|
|
2600
|
+
|
|
2601
|
+
class NotificationEvent extends CustomEvent {
|
|
2602
|
+
constructor(message, type, isSideWindowError = false) {
|
|
2603
|
+
super('NOTIFICATION_EVENT', {
|
|
2604
|
+
detail: {
|
|
2605
|
+
isSideWindowError,
|
|
2606
|
+
message,
|
|
2607
|
+
type
|
|
2608
|
+
}
|
|
2609
|
+
});
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2613
|
+
function Notifier({ isSideWindow = false }) {
|
|
2614
|
+
const push = useCallback((event) => {
|
|
2615
|
+
if (event.detail.isSideWindowError !== isSideWindow) {
|
|
2616
|
+
return;
|
|
2617
|
+
}
|
|
2618
|
+
Q(event.detail.message, {
|
|
2619
|
+
position: Q.POSITION.BOTTOM_RIGHT,
|
|
2620
|
+
type: event.detail.type
|
|
2621
|
+
});
|
|
2622
|
+
},
|
|
2623
|
+
// We don't want to depend on `isSideWindow` since it should never change
|
|
2624
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2625
|
+
[]);
|
|
2626
|
+
useEffect(() => {
|
|
2627
|
+
window.document.addEventListener('NOTIFICATION_EVENT', push);
|
|
2628
|
+
return () => {
|
|
2629
|
+
window.document.removeEventListener('NOTIFICATION_EVENT', push);
|
|
2630
|
+
};
|
|
2631
|
+
}, [push]);
|
|
2632
|
+
return (jsx(StyledToastContainer
|
|
2633
|
+
// We may wish to let the user be able to copy the notification message
|
|
2634
|
+
// which is not easy to achieve when the notification is draggable
|
|
2635
|
+
, {
|
|
2636
|
+
// We may wish to let the user be able to copy the notification message
|
|
2637
|
+
// which is not easy to achieve when the notification is draggable
|
|
2638
|
+
draggable: false }));
|
|
2639
|
+
}
|
|
2640
|
+
// TODO Style the notifications with Adeline.
|
|
2641
|
+
const StyledToastContainer = styled(k) ``;
|
|
2642
|
+
|
|
2596
2643
|
const ICON_SIZE = {
|
|
2597
2644
|
[Size.LARGE]: 20,
|
|
2598
2645
|
[Size.NORMAL]: 20,
|
|
@@ -3263,6 +3310,17 @@ const InnerBox = styled.div `
|
|
|
3263
3310
|
`}
|
|
3264
3311
|
`;
|
|
3265
3312
|
|
|
3313
|
+
const FieldError = styled.p.attrs(props => ({
|
|
3314
|
+
className: classnames('Element-FieldError', props.className)
|
|
3315
|
+
})) `
|
|
3316
|
+
color: ${p => p.theme.color.maximumRed};
|
|
3317
|
+
display: ${p => (p.isDisabled ? 'none' : 'block')};
|
|
3318
|
+
font-size: 13px;
|
|
3319
|
+
font-weight: 700;
|
|
3320
|
+
line-height: 1.3846;
|
|
3321
|
+
margin: 4px 0 0 0;
|
|
3322
|
+
`;
|
|
3323
|
+
|
|
3266
3324
|
const Label = styled.label.attrs(props => ({
|
|
3267
3325
|
className: classnames('Element-Label', props.className)
|
|
3268
3326
|
})) `
|
|
@@ -3429,17 +3487,6 @@ const SimpleTable = {
|
|
|
3429
3487
|
Th
|
|
3430
3488
|
};
|
|
3431
3489
|
|
|
3432
|
-
const FieldError = styled.p.attrs(props => ({
|
|
3433
|
-
className: classnames('Element-FieldError', props.className)
|
|
3434
|
-
})) `
|
|
3435
|
-
color: ${p => p.theme.color.maximumRed};
|
|
3436
|
-
display: ${p => (p.isDisabled ? 'none' : 'block')};
|
|
3437
|
-
font-size: 13px;
|
|
3438
|
-
font-weight: 700;
|
|
3439
|
-
line-height: 1.3846;
|
|
3440
|
-
margin: 4px 0 0 0;
|
|
3441
|
-
`;
|
|
3442
|
-
|
|
3443
3490
|
const useClickOutsideEffect = (zoneRefOrzoneRefs, action, baseContainer) => {
|
|
3444
3491
|
const handleClickOutside = useCallback((event) => {
|
|
3445
3492
|
const eventTarget = event.target;
|
|
@@ -20697,7 +20744,11 @@ function useForceUpdate() {
|
|
|
20697
20744
|
return { forceDebouncedUpdate, forceUpdate };
|
|
20698
20745
|
}
|
|
20699
20746
|
|
|
20700
|
-
|
|
20747
|
+
function getPseudoRandomString() {
|
|
20748
|
+
const nowAsString = new Date().toISOString();
|
|
20749
|
+
const token = Math.random().toString(36).slice(2);
|
|
20750
|
+
return `${nowAsString}${token}`;
|
|
20751
|
+
}
|
|
20701
20752
|
|
|
20702
20753
|
function useKey(deps) {
|
|
20703
20754
|
const keyRef = useRef(getPseudoRandomString());
|
|
@@ -31283,7 +31334,7 @@ var CoordinateInput = function CoordinateInput(_ref) {
|
|
|
31283
31334
|
inputRef(innerRef.current);
|
|
31284
31335
|
}
|
|
31285
31336
|
}, [innerRef, inputRef]);
|
|
31286
|
-
return /*#__PURE__*/
|
|
31337
|
+
return /*#__PURE__*/t.createElement("input", _extends({}, props, {
|
|
31287
31338
|
defaultValue: controlledValue,
|
|
31288
31339
|
placeholder: placeholder,
|
|
31289
31340
|
ref: innerRef,
|
|
@@ -33866,7 +33917,7 @@ const MASK_OPTIONS_PROPS_NAMES = MASK_PROPS_NAMES.filter(pName => NON_MASK_OPTIO
|
|
|
33866
33917
|
// 1. seems like it's wrong to have Opts as only mask options. Other component/input props should also be there. Where is "unmask" prop for instance?
|
|
33867
33918
|
// 2. Unmask should be infered from Opts (see https://github.com/uNmAnNeR/imaskjs/issues/554#issuecomment-1114014010)
|
|
33868
33919
|
function IMaskMixin(ComposedComponent) {
|
|
33869
|
-
const MaskedComponent = class extends
|
|
33920
|
+
const MaskedComponent = class extends t.Component {
|
|
33870
33921
|
constructor(props) {
|
|
33871
33922
|
super(props);
|
|
33872
33923
|
this._inputRef = this._inputRef.bind(this);
|
|
@@ -33944,7 +33995,7 @@ function IMaskMixin(ComposedComponent) {
|
|
|
33944
33995
|
if (this.props.onComplete && this.maskRef) this.props.onComplete(this.maskValue, this.maskRef, e);
|
|
33945
33996
|
}
|
|
33946
33997
|
render() {
|
|
33947
|
-
return
|
|
33998
|
+
return t.createElement(ComposedComponent, Object.assign({}, this._extractNonMaskProps(this.props), {
|
|
33948
33999
|
inputRef: this._inputRef
|
|
33949
34000
|
}));
|
|
33950
34001
|
}
|
|
@@ -33952,7 +34003,7 @@ function IMaskMixin(ComposedComponent) {
|
|
|
33952
34003
|
const nestedComponentName = ComposedComponent.displayName || ComposedComponent.name || 'Component';
|
|
33953
34004
|
MaskedComponent.displayName = "IMask(".concat(nestedComponentName, ")");
|
|
33954
34005
|
MaskedComponent.propTypes = MASK_PROPS;
|
|
33955
|
-
return
|
|
34006
|
+
return t.forwardRef((props, ref) => t.createElement(MaskedComponent, Object.assign({}, props, {
|
|
33956
34007
|
ref
|
|
33957
34008
|
})));
|
|
33958
34009
|
}
|
|
@@ -33963,7 +34014,7 @@ const IMaskInput = IMaskMixin(_ref => {
|
|
|
33963
34014
|
inputRef
|
|
33964
34015
|
} = _ref,
|
|
33965
34016
|
props = _objectWithoutPropertiesLoose$1(_ref, _excluded);
|
|
33966
|
-
return
|
|
34017
|
+
return t.createElement('input', Object.assign({}, props, {
|
|
33967
34018
|
ref: inputRef
|
|
33968
34019
|
}));
|
|
33969
34020
|
});
|
|
@@ -35465,5 +35516,26 @@ function useNewWindow() {
|
|
|
35465
35516
|
return contextValue;
|
|
35466
35517
|
}
|
|
35467
35518
|
|
|
35468
|
-
|
|
35519
|
+
/* eslint-disable no-console */
|
|
35520
|
+
function logSoftError({ context = {}, isSideWindowError = false, message, originalError, userMessage }) {
|
|
35521
|
+
console.group(`Soft Error: ${message}`);
|
|
35522
|
+
console.debug('context', context);
|
|
35523
|
+
console.debug('originalError', originalError);
|
|
35524
|
+
console.groupEnd();
|
|
35525
|
+
const extra = originalError
|
|
35526
|
+
? {
|
|
35527
|
+
...context,
|
|
35528
|
+
originalError
|
|
35529
|
+
}
|
|
35530
|
+
: { ...context };
|
|
35531
|
+
captureMessage(message, {
|
|
35532
|
+
extra,
|
|
35533
|
+
level: 'warning'
|
|
35534
|
+
});
|
|
35535
|
+
if (userMessage) {
|
|
35536
|
+
window.document.dispatchEvent(new NotificationEvent(userMessage, 'error', isSideWindowError));
|
|
35537
|
+
}
|
|
35538
|
+
}
|
|
35539
|
+
|
|
35540
|
+
export { Accent, Button, Checkbox, CoordinatesFormat, CoordinatesInput, CustomSearch, DatePicker, DateRangePicker, Dialog, Dropdown, Field$2 as Field, FieldError, Fieldset, FormikCheckbox, FormikCoordinatesInput, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikNumberInput, FormikSearch, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, NewWindow, NewWindowContext, NotificationEvent, Notifier, NumberInput, OPENLAYERS_PROJECTION, OnlyFontGlobalStyle, Search, Select, SimpleTable, SingleTag, Size, THEME, Tag, TagBullet, TagGroup, TextInput, Textarea, ThemeProvider, WSG84_PROJECTION, coordinatesAreDistinct, customDayjs, getCoordinates, getLocalizedDayjs, getPseudoRandomString, getUtcizedDayjs, isNumeric, logSoftError, stopMouseEventPropagation, useClickOutsideEffect, useFieldControl, useForceUpdate, useKey, useNewWindow, usePrevious };
|
|
35469
35541
|
//# sourceMappingURL=index.js.map
|