@crystaldesign/diva-core 25.13.0-beta.11 → 25.13.0-beta.12
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/build/esm/{ModalsWrapper-9821fc86.js → ModalsWrapper-50ddd077.js} +1 -1
- package/build/esm/{index-c644a84d.js → index-2a1303a2.js} +4 -4
- package/build/esm/{index-836b85d3.js → index-4165b544.js} +16 -32
- package/build/esm/index.js +1 -1
- package/build/types/core/src/elements/Auth/Register/index.d.ts.map +1 -1
- package/build/umd/124.diva-core.umd.min.js +2 -0
- package/build/umd/124.diva-core.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/145.diva-core.umd.min.js +1 -1
- package/build/umd/373.diva-core.umd.min.js +1 -1
- package/build/umd/985.diva-core.umd.min.js +2 -0
- package/build/umd/985.diva-core.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/diva-core.umd.min.js +1 -1
- package/build/umd/report.html +1 -1
- package/package.json +10 -10
- package/build/umd/860.diva-core.umd.min.js +0 -2
- package/build/umd/860.diva-core.umd.min.js.LICENSE.txt +0 -1
- package/build/umd/940.diva-core.umd.min.js +0 -2
- package/build/umd/940.diva-core.umd.min.js.LICENSE.txt +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crystaldesign/diva-core",
|
|
3
|
-
"version": "25.13.0-beta.
|
|
3
|
+
"version": "25.13.0-beta.12",
|
|
4
4
|
"license": "COMMERCIAL",
|
|
5
5
|
"homepage": "https://www.diva-portal.de",
|
|
6
6
|
"devDependencies": {
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
"react-dom": "18.3.1"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@crystaldesign/basket-handler": "25.13.0-beta.
|
|
16
|
-
"@crystaldesign/basket-model": "25.13.0-beta.
|
|
17
|
-
"@crystaldesign/content-box": "25.13.0-beta.
|
|
18
|
-
"@crystaldesign/diva-utils": "25.13.0-beta.
|
|
19
|
-
"@crystaldesign/forms": "25.13.0-beta.
|
|
20
|
-
"@crystaldesign/grid": "25.13.0-beta.
|
|
21
|
-
"@crystaldesign/media-upload": "25.13.0-beta.
|
|
22
|
-
"@crystaldesign/product-handler": "25.13.0-beta.
|
|
15
|
+
"@crystaldesign/basket-handler": "25.13.0-beta.12",
|
|
16
|
+
"@crystaldesign/basket-model": "25.13.0-beta.12",
|
|
17
|
+
"@crystaldesign/content-box": "25.13.0-beta.12",
|
|
18
|
+
"@crystaldesign/diva-utils": "25.13.0-beta.12",
|
|
19
|
+
"@crystaldesign/forms": "25.13.0-beta.12",
|
|
20
|
+
"@crystaldesign/grid": "25.13.0-beta.12",
|
|
21
|
+
"@crystaldesign/media-upload": "25.13.0-beta.12",
|
|
22
|
+
"@crystaldesign/product-handler": "25.13.0-beta.12",
|
|
23
23
|
"@elastic/apm-rum": "^5.16.1",
|
|
24
24
|
"@elastic/apm-rum-react": "^2.0.2",
|
|
25
25
|
"@emotion/react": "^11.4.1",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
},
|
|
52
52
|
"types": "./build/types/core/src/index.d.ts",
|
|
53
53
|
"module": "build/esm/index.js",
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "9ec06ed0bd06957a70d69827d9db3b1b3b657161"
|
|
55
55
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 860.diva-core.umd.min.js.LICENSE.txt */
|
|
2
|
-
(self.webpackChunkCrystaldesignDivaCore=self.webpackChunkCrystaldesignDivaCore||[]).push([[860],{6437:(e,t,r)=>{"use strict";r.d(t,{Z:()=>a});var o=r(6177),n=r(7514);const a=(0,o.Z)((0,n.jsx)("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack")},6033:(e,t,r)=>{"use strict";r.d(t,{Z:()=>j});var o=r(7363),n=r(7726),a=r(9916),s=r(5689),i=r(7843),l=r(518),c=r(2893),d=r(7249),p=r(2791),u=r(8981),f=r(9173),h=r(4685),m=r(9503);function getAlertUtilityClass(e){return(0,m.ZP)("MuiAlert",e)}const g=(0,h.Z)("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]);var v=r(3697),y=r(6177),w=r(7514);const x=(0,y.Z)((0,w.jsx)("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),C=(0,y.Z)((0,w.jsx)("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),S=(0,y.Z)((0,w.jsx)("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),k=(0,y.Z)((0,w.jsx)("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),b=(0,y.Z)((0,w.jsx)("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),Z=(0,i.ZP)(f.Z,{name:"MuiAlert",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,t[r.variant],t[`${r.variant}${(0,p.Z)(r.color||r.severity)}`]]}})((0,l.Z)((({theme:e})=>{const t="light"===e.palette.mode?s._j:s.$n,r="light"===e.palette.mode?s.$n:s._j;return{...e.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(e.palette).filter((0,u.Z)(["light"])).map((([o])=>({props:{colorSeverity:o,variant:"standard"},style:{color:e.vars?e.vars.palette.Alert[`${o}Color`]:t(e.palette[o].light,.6),backgroundColor:e.vars?e.vars.palette.Alert[`${o}StandardBg`]:r(e.palette[o].light,.9),[`& .${g.icon}`]:e.vars?{color:e.vars.palette.Alert[`${o}IconColor`]}:{color:e.palette[o].main}}}))),...Object.entries(e.palette).filter((0,u.Z)(["light"])).map((([r])=>({props:{colorSeverity:r,variant:"outlined"},style:{color:e.vars?e.vars.palette.Alert[`${r}Color`]:t(e.palette[r].light,.6),border:`1px solid ${(e.vars||e).palette[r].light}`,[`& .${g.icon}`]:e.vars?{color:e.vars.palette.Alert[`${r}IconColor`]}:{color:e.palette[r].main}}}))),...Object.entries(e.palette).filter((0,u.Z)(["dark"])).map((([t])=>({props:{colorSeverity:t,variant:"filled"},style:{fontWeight:e.typography.fontWeightMedium,...e.vars?{color:e.vars.palette.Alert[`${t}FilledColor`],backgroundColor:e.vars.palette.Alert[`${t}FilledBg`]}:{backgroundColor:"dark"===e.palette.mode?e.palette[t].dark:e.palette[t].main,color:e.palette.getContrastText(e.palette[t].main)}}})))]}}))),P=(0,i.ZP)("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(e,t)=>t.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),z=(0,i.ZP)("div",{name:"MuiAlert",slot:"Message",overridesResolver:(e,t)=>t.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),M=(0,i.ZP)("div",{name:"MuiAlert",slot:"Action",overridesResolver:(e,t)=>t.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),A={success:(0,w.jsx)(x,{fontSize:"inherit"}),warning:(0,w.jsx)(C,{fontSize:"inherit"}),error:(0,w.jsx)(S,{fontSize:"inherit"}),info:(0,w.jsx)(k,{fontSize:"inherit"})},j=o.forwardRef((function Alert(e,t){const r=(0,c.i)({props:e,name:"MuiAlert"}),{action:o,children:s,className:i,closeText:l="Close",color:u,components:f={},componentsProps:h={},icon:m,iconMapping:g=A,onClose:y,role:x="alert",severity:C="success",slotProps:S={},slots:k={},variant:j="standard",...F}=r,R={...r,color:u,severity:C,variant:j,colorSeverity:u||C},I=(e=>{const{variant:t,color:r,severity:o,classes:n}=e,s={root:["root",`color${(0,p.Z)(r||o)}`,`${t}${(0,p.Z)(r||o)}`,`${t}`],icon:["icon"],message:["message"],action:["action"]};return(0,a.Z)(s,getAlertUtilityClass,n)})(R),$={slots:{closeButton:f.CloseButton,closeIcon:f.CloseIcon,...k},slotProps:{...h,...S}},[O,E]=(0,d.Z)("root",{ref:t,shouldForwardComponentProp:!0,className:(0,n.Z)(I.root,i),elementType:Z,externalForwardedProps:{...$,...F},ownerState:R,additionalProps:{role:x,elevation:0}}),[B,L]=(0,d.Z)("icon",{className:I.icon,elementType:P,externalForwardedProps:$,ownerState:R}),[T,q]=(0,d.Z)("message",{className:I.message,elementType:z,externalForwardedProps:$,ownerState:R}),[N,H]=(0,d.Z)("action",{className:I.action,elementType:M,externalForwardedProps:$,ownerState:R}),[W,U]=(0,d.Z)("closeButton",{elementType:v.Z,externalForwardedProps:$,ownerState:R}),[V,D]=(0,d.Z)("closeIcon",{elementType:b,externalForwardedProps:$,ownerState:R});return(0,w.jsxs)(O,{...E,children:[!1!==m?(0,w.jsx)(B,{...L,children:m||g[C]||A[C]}):null,(0,w.jsx)(T,{...q,children:s}),null!=o?(0,w.jsx)(N,{...H,children:o}):null,null==o&&y?(0,w.jsx)(N,{...H,children:(0,w.jsx)(W,{size:"small","aria-label":l,title:l,color:"inherit",onClick:y,...U,children:(0,w.jsx)(V,{fontSize:"small",...D})})}):null]})}))},3714:(e,t,r)=>{"use strict";r.d(t,{Z:()=>R});var o=r(7363),n=r(7726),a=r(9916),s=r(5689),i=r(2791),l=r(1684),c=r(7843);const d=function useControlled({controlled:e,default:t,name:r,state:n="value"}){const{current:a}=o.useRef(void 0!==e),[s,i]=o.useState(t);return[a?e:s,o.useCallback((e=>{a||i(e)}),[])]};const p=o.createContext(void 0);var u=r(6882),f=r(4685),h=r(9503);function getSwitchBaseUtilityClass(e){return(0,h.ZP)("PrivateSwitchBase",e)}(0,f.Z)("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);var m=r(7249),g=r(7514);const v=(0,c.ZP)(u.Z)({padding:9,borderRadius:"50%",variants:[{props:{edge:"start",size:"small"},style:{marginLeft:-3}},{props:({edge:e,ownerState:t})=>"start"===e&&"small"!==t.size,style:{marginLeft:-12}},{props:{edge:"end",size:"small"},style:{marginRight:-3}},{props:({edge:e,ownerState:t})=>"end"===e&&"small"!==t.size,style:{marginRight:-12}}]}),y=(0,c.ZP)("input",{shouldForwardProp:l.Z})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),w=o.forwardRef((function SwitchBase(e,t){const{autoFocus:r,checked:n,checkedIcon:s,defaultChecked:l,disabled:c,disableFocusRipple:u=!1,edge:f=!1,icon:h,id:w,inputProps:x,inputRef:C,name:S,onBlur:k,onChange:b,onFocus:Z,readOnly:P,required:z=!1,tabIndex:M,type:A,value:j,slots:F={},slotProps:R={},...I}=e,[$,O]=d({controlled:n,default:Boolean(l),name:"SwitchBase",state:"checked"}),E=function useFormControl(){return o.useContext(p)}();let B=c;E&&void 0===B&&(B=E.disabled);const L="checkbox"===A||"radio"===A,T={...e,checked:$,disabled:B,disableFocusRipple:u,edge:f},q=(e=>{const{classes:t,checked:r,disabled:o,edge:n}=e,s={root:["root",r&&"checked",o&&"disabled",n&&`edge${(0,i.Z)(n)}`],input:["input"]};return(0,a.Z)(s,getSwitchBaseUtilityClass,t)})(T),N={slots:F,slotProps:{input:x,...R}},[H,W]=(0,m.Z)("root",{ref:t,elementType:v,className:q.root,shouldForwardComponentProp:!0,externalForwardedProps:{...N,component:"span",...I},getSlotProps:e=>({...e,onFocus:t=>{e.onFocus?.(t),(e=>{Z&&Z(e),E&&E.onFocus&&E.onFocus(e)})(t)},onBlur:t=>{e.onBlur?.(t),(e=>{k&&k(e),E&&E.onBlur&&E.onBlur(e)})(t)}}),ownerState:T,additionalProps:{centerRipple:!0,focusRipple:!u,disabled:B,role:void 0,tabIndex:null}}),[U,V]=(0,m.Z)("input",{ref:C,elementType:y,className:q.input,externalForwardedProps:N,getSlotProps:e=>({onChange:t=>{e.onChange?.(t),(e=>{if(e.nativeEvent.defaultPrevented)return;const t=e.target.checked;O(t),b&&b(e,t)})(t)}}),ownerState:T,additionalProps:{autoFocus:r,checked:n,defaultChecked:l,disabled:B,id:L?w:void 0,name:S,readOnly:P,required:z,tabIndex:M,type:A,..."checkbox"===A&&void 0===j?{}:{value:j}}});return(0,g.jsxs)(H,{...W,children:[(0,g.jsx)(U,{...V}),$?s:h]})}));var x=r(6177);const C=(0,x.Z)((0,g.jsx)("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),"CheckBoxOutlineBlank"),S=(0,x.Z)((0,g.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckBox"),k=(0,x.Z)((0,g.jsx)("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}),"IndeterminateCheckBox");function getCheckboxUtilityClass(e){return(0,h.ZP)("MuiCheckbox",e)}const b=(0,f.Z)("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]);var Z=r(518),P=r(8981),z=r(2893);function mergeSlotProps(e,t){if(!e)return t;if("function"==typeof e||"function"==typeof t)return r=>{const o="function"==typeof t?t(r):t,a="function"==typeof e?e({...r,...o}):e,s=(0,n.Z)(r?.className,o?.className,a?.className);return{...o,...a,...!!s&&{className:s},...o?.style&&a?.style&&{style:{...o.style,...a.style}},...o?.sx&&a?.sx&&{sx:[...Array.isArray(o.sx)?o.sx:[o.sx],...Array.isArray(a.sx)?a.sx:[a.sx]]}}};const r=t,o=(0,n.Z)(r?.className,e?.className);return{...t,...e,...!!o&&{className:o},...r?.style&&e?.style&&{style:{...r.style,...e.style}},...r?.sx&&e?.sx&&{sx:[...Array.isArray(r.sx)?r.sx:[r.sx],...Array.isArray(e.sx)?e.sx:[e.sx]]}}}const M=(0,c.ZP)(w,{shouldForwardProp:e=>(0,l.Z)(e)||"classes"===e,name:"MuiCheckbox",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.root,r.indeterminate&&t.indeterminate,t[`size${(0,i.Z)(r.size)}`],"default"!==r.color&&t[`color${(0,i.Z)(r.color)}`]]}})((0,Z.Z)((({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:"default",disableRipple:!1},style:{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,s.Fq)(e.palette.action.active,e.palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter((0,P.Z)()).map((([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette[t].mainChannel} / ${e.vars.palette.action.hoverOpacity})`:(0,s.Fq)(e.palette[t].main,e.palette.action.hoverOpacity)}}}))),...Object.entries(e.palette).filter((0,P.Z)()).map((([t])=>({props:{color:t},style:{[`&.${b.checked}, &.${b.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${b.disabled}`]:{color:(e.vars||e).palette.action.disabled}}}))),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}]})))),A=(0,g.jsx)(S,{}),j=(0,g.jsx)(C,{}),F=(0,g.jsx)(k,{}),R=o.forwardRef((function Checkbox(e,t){const r=(0,z.i)({props:e,name:"MuiCheckbox"}),{checkedIcon:s=A,color:l="primary",icon:c=j,indeterminate:d=!1,indeterminateIcon:p=F,inputProps:u,size:f="medium",disableRipple:h=!1,className:v,slots:y={},slotProps:w={},...x}=r,C=d?p:c,S=d?p:s,k={...r,disableRipple:h,color:l,indeterminate:d,size:f},b=(e=>{const{classes:t,indeterminate:r,color:o,size:n}=e,s={root:["root",r&&"indeterminate",`color${(0,i.Z)(o)}`,`size${(0,i.Z)(n)}`]},l=(0,a.Z)(s,getCheckboxUtilityClass,t);return{...t,...l}})(k),Z=w.input??u,[P,R]=(0,m.Z)("root",{ref:t,elementType:M,className:(0,n.Z)(b.root,v),shouldForwardComponentProp:!0,externalForwardedProps:{slots:y,slotProps:w,...x},ownerState:k,additionalProps:{type:"checkbox",icon:o.cloneElement(C,{fontSize:C.props.fontSize??f}),checkedIcon:o.cloneElement(S,{fontSize:S.props.fontSize??f}),disableRipple:h,slots:y,slotProps:{input:mergeSlotProps("function"==typeof Z?Z(k):Z,{"data-indeterminate":d})}}});return(0,g.jsx)(P,{...R,classes:b})}))},8942:(e,t,r)=>{var o=r(5108),n="undefined"!=typeof Element,a="function"==typeof Map,s="function"==typeof Set,i="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function equal(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var r,o,l,c;if(Array.isArray(e)){if((r=e.length)!=t.length)return!1;for(o=r;0!=o--;)if(!equal(e[o],t[o]))return!1;return!0}if(a&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(c=e.entries();!(o=c.next()).done;)if(!t.has(o.value[0]))return!1;for(c=e.entries();!(o=c.next()).done;)if(!equal(o.value[1],t.get(o.value[0])))return!1;return!0}if(s&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(c=e.entries();!(o=c.next()).done;)if(!t.has(o.value[0]))return!1;return!0}if(i&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if((r=e.length)!=t.length)return!1;for(o=r;0!=o--;)if(e[o]!==t[o])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&"function"==typeof e.valueOf&&"function"==typeof t.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&"function"==typeof e.toString&&"function"==typeof t.toString)return e.toString()===t.toString();if((r=(l=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(o=r;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,l[o]))return!1;if(n&&e instanceof Element)return!1;for(o=r;0!=o--;)if(("_owner"!==l[o]&&"__v"!==l[o]&&"__o"!==l[o]||!e.$$typeof)&&!equal(e[l[o]],t[l[o]]))return!1;return!0}return e!=e&&t!=t}e.exports=function isEqual(e,t){try{return equal(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return o.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}},4376:(e,t,r)=>{"use strict";r.d(t,{Z:()=>lib_Snowfall});var o=r(7363),n=r(8942);function random(e,t){const r=Math.random()*(t-e+1)+e;return Number.isInteger(e)&&Number.isInteger(t)?Math.floor(r):r}function lerp(e,t,r){return(1-r)*e+r*t}function getSize(e){return e?{height:e.offsetHeight,width:e.offsetWidth}:{height:0,width:0}}const a=2*Math.PI,s={color:"#dee4fd",radius:[.5,3],speed:[1,3],wind:[-.5,2],changeFrequency:200,rotationSpeed:[-1,1],opacity:[1,1]};class Snowflake{static createSnowflakes(e,t,r){if(!e)return[];const o=[];for(let n=0;n<t;n++)o.push(new Snowflake(e,r));return o}constructor(e,t={}){this.updateConfig(t);const{radius:r,wind:o,speed:n,rotationSpeed:a,opacity:s}=this.config;this.params={x:random(0,e.offsetWidth),y:random(-e.offsetHeight,0),rotation:random(0,360),radius:random(...r),speed:random(...n),wind:random(...o),rotationSpeed:random(...a),nextSpeed:random(...n),nextWind:random(...o),nextRotationSpeed:random(...a),opacity:random(...s)},this.framesSinceLastUpdate=0}selectImage(){this.config.images&&this.config.images.length>0?this.image=function randomElement(e){return e[Math.floor(Math.random()*e.length)]}(this.config.images):this.image=void 0}updateConfig(e){const t=this.config;this.config={...s,...e},this.config.changeFrequency=random(this.config.changeFrequency,1.5*this.config.changeFrequency),this.params&&!n(this.config.radius,null==t?void 0:t.radius)&&(this.params.radius=random(...this.config.radius)),n(this.config.images,null==t?void 0:t.images)||this.selectImage()}updateTargetParams(){this.params.nextSpeed=random(...this.config.speed),this.params.nextWind=random(...this.config.wind),this.image&&(this.params.nextRotationSpeed=random(...this.config.rotationSpeed))}update(e,t,r=1){const{x:o,y:n,rotation:a,rotationSpeed:s,nextRotationSpeed:i,wind:l,speed:c,nextWind:d,nextSpeed:p,radius:u}=this.params;this.params.x=(o+l*r)%(e+2*u),this.params.x>e+u&&(this.params.x=-u),this.params.y=(n+c*r)%(t+2*u),this.params.y>t+u&&(this.params.y=-u),this.image&&(this.params.rotation=(a+s)%360),this.params.speed=lerp(c,p,.01),this.params.wind=lerp(l,d,.01),this.params.rotationSpeed=lerp(s,i,.01),this.framesSinceLastUpdate++>this.config.changeFrequency&&(this.updateTargetParams(),this.framesSinceLastUpdate=0)}getImageOffscreenCanvas(e,t){var r,o;if(e instanceof HTMLImageElement&&e.loading)return e;let n=Snowflake.offscreenCanvases.get(e);if(n||(n={},Snowflake.offscreenCanvases.set(e,n)),!(t in n)){const o=document.createElement("canvas");o.width=t,o.height=t,null===(r=o.getContext("2d"))||void 0===r||r.drawImage(e,0,0,t,t),n[t]=o}return null!==(o=n[t])&&void 0!==o?o:e}drawCircle(e){e.moveTo(this.params.x,this.params.y),e.arc(this.params.x,this.params.y,this.params.radius,0,a)}drawImage(e){const{x:t,y:r,rotation:o,radius:n}=this.params,a=o*Math.PI/180,s=Math.cos(a),i=Math.sin(a);1!==this.params.opacity&&(e.save(),e.globalAlpha=this.params.opacity),e.setTransform(s,i,-i,s,t,r);const l=this.getImageOffscreenCanvas(this.image,n);e.drawImage(l,-n/2,-n/2,n,n),1!==this.params.opacity&&e.restore()}}Snowflake.offscreenCanvases=new WeakMap;const i=Snowflake,l={pointerEvents:"none",backgroundColor:"transparent",position:"absolute",top:0,left:0,width:"100%",height:"100%"};var c,d,__classPrivateFieldGet=function(e,t,r,o){if("a"===r&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?o:"a"===r?o.call(e):o?o.value:t.get(e)},__classPrivateFieldSet=function(e,t,r,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,r):n?n.value=r:t.set(e,r),r};class SnowfallCanvas{get ctx(){return __classPrivateFieldGet(this,c,"f")}get canvas(){return __classPrivateFieldGet(this,d,"f")}set canvas(e){__classPrivateFieldSet(this,d,e,"f"),__classPrivateFieldSet(this,c,e.getContext("2d"),"f")}constructor(e,t){this.lastUpdate=Date.now(),this.snowflakes=[],c.set(this,void 0),d.set(this,void 0),__classPrivateFieldSet(this,d,e,"f"),__classPrivateFieldSet(this,c,e.getContext("2d"),"f"),this.config={snowflakeCount:150,...s,...t},this.snowflakes=[],this.snowflakes=i.createSnowflakes(e,t.snowflakeCount||150,t),this.play()}updateConfig(e){this.config={...this.config,...e};const t=this.config.snowflakeCount-this.snowflakes.length;t>0&&(this.snowflakes=[...this.snowflakes,...i.createSnowflakes(this.canvas,t,e)]),t<0&&(this.snowflakes=this.snowflakes.slice(0,this.config.snowflakeCount));for(const e of this.snowflakes)e.updateConfig(this.config)}render(e=1){const{ctx:t,canvas:r,snowflakes:o}=this;if(!t||!r)return;const{offsetWidth:n,offsetHeight:a}=r;for(const t of o)t.update(n,a,e);if(t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,a),this.config.images&&this.config.images.length>0)for(const e of o)e.drawImage(t);else{t.beginPath();for(const e of o)e.drawCircle(t);t.fillStyle=this.config.color,t.fill()}}loop(){const e=Date.now(),t=Date.now()-this.lastUpdate;this.lastUpdate=e;const r=t/16.666666666666668;this.render(r),this.animationFrame=requestAnimationFrame((()=>this.loop()))}play(){this.loop()}pause(){this.animationFrame&&(cancelAnimationFrame(this.animationFrame),this.animationFrame=void 0)}}c=new WeakMap,d=new WeakMap;function useDeepMemo(e){const[t,r]=(0,o.useState)(e);return function useDeepCompareEffect(e,t){const r=(0,o.useRef)(t);return n(t,r.current)||(r.current=t),(0,o.useEffect)(e,r.current)}((()=>r(e)),[e]),t}const lib_Snowfall=({color:e=s.color,changeFrequency:t=s.changeFrequency,radius:r=s.radius,speed:n=s.speed,wind:a=s.wind,rotationSpeed:i=s.rotationSpeed,opacity:c=s.opacity,snowflakeCount:d=150,images:p,style:u}={})=>{const f=(h=u,(0,o.useMemo)((()=>({...l,...h||{}})),[h]));var h;const m=(0,o.useRef)(null),g=(e=>{const[t,r]=(0,o.useState)(getSize(e.current)),n=(0,o.useCallback)((()=>{e.current&&r(getSize(e.current))}),[e]);return(0,o.useEffect)((()=>{const{ResizeObserver:t}=window;if(e.current){if(n(),"function"==typeof t){const r=new t(n);return r.observe(e.current),()=>r.disconnect()}return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)}}),[e,n]),t})(m),v=useDeepMemo({color:e,changeFrequency:t,radius:r,speed:n,wind:a,rotationSpeed:i,images:p,snowflakeCount:d,opacity:c}),y=(0,o.useRef)(v),w=(0,o.useRef)();return(0,o.useEffect)((()=>(!w.current&&m.current&&(w.current=new SnowfallCanvas(m.current,y.current)),()=>{var e;null===(e=w.current)||void 0===e||e.pause(),w.current=void 0})),[]),(0,o.useEffect)((()=>{w.current&&w.current.updateConfig(v)}),[v]),o.createElement("canvas",{ref:m,height:g.height,width:g.width,style:f,"data-testid":"SnowfallCanvas"})}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! filename:860 */
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 940.diva-core.umd.min.js.LICENSE.txt */
|
|
2
|
-
"use strict";(self.webpackChunkCrystaldesignDivaCore=self.webpackChunkCrystaldesignDivaCore||[]).push([[940],{1679:(n,e,o)=>{o.d(e,{Z:()=>s});var t=o(8081),i=o.n(t),r=o(3645),a=o.n(r)()(i());a.push([n.id,".diva-media-viewer .zoom-controls {\n transform: translateX(-50%);\n left: 50%;\n right: auto;\n right: initial;\n}\n\n.diva-media-viewer .zoom-controls .zoom-out, .diva-media-viewer .zoom-controls .zoom-in {\n border: none;\n background: none;\n width: 28px;\n height: 28px;\n color: #4f4f4f;\n}\n",""]);const s=a},4145:(n,e,o)=>{o.r(e),o.d(e,{default:()=>b});var t=o(3379),i=o.n(t),r=o(7795),a=o.n(r),s=o(569),l=o.n(s),d=o(3565),c=o.n(d),m=o(9216),u=o.n(m),v=o(4589),h=o.n(v),f=o(1679),g={};g.styleTagTransform=h(),g.setAttributes=c(),g.insert=l().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=u();i()(f.Z,g);const b=f.Z&&f.Z.locals?f.Z.locals:void 0}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! filename:940 */
|