{"version":3,"file":"Examples.BWcgAtRm.mjs","names":["useState","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/28rXvpPsrum7FH6cMELS/1jCAazZw1EGHjrG5Nu5D/Utils.js","https:/framer.com/m/framer/utils.js@^0.9.0","https:/framerusercontent.com/modules/RkFVAvXTBNrXvoLg0GIq/OQXwJV9twTyBh0Xs5ETf/Examples.js"],"sourcesContent":["import{useState,useEffect}from\"react\";import{Data,useObserveData}from\"framer\";export function createStore(state1){// Use Data so that a Preview reload resets the state\nconst dataStore=Data({state:Object.freeze({...state1})});// Create a set function that updates the state\nconst setDataStore=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(dataStore.state);}dataStore.state=Object.freeze({...dataStore.state,...newState});};// Store the initial state, copy the object if it's an object\nlet storeState=typeof state1===\"object\"?Object.freeze({...state1}):state1;// Keep a list of all the listeners, in the form of React hook setters\nconst storeSetters=new Set();// Create a set function that updates all the listeners / setters\nconst setStoreState=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(storeState);}storeState=typeof newState===\"object\"?Object.freeze({...storeState,...newState}):newState;// Update all the listeners / setters with the new value\nstoreSetters.forEach(setter=>setter(storeState));};// Create the actual hook based on everything above\nfunction useStore(){// Create the hook we are going to use as a listener\nconst[state,setState]=useState(storeState);// If we unmount the component using this hook, we need to remove the listener\n// @ts-ignore\nuseEffect(()=>{// But right now, we need to add the listener\nstoreSetters.add(setState);return()=>storeSetters.delete(setState);},[]);// If Data context exists, use Data, otherwise use vanilla React state\nif(useObserveData()===true){useObserveData();return[dataStore.state,setDataStore];}else{// Return the state and a function to update the central store\nreturn[state,setStoreState];}}return useStore;}\nexport const __FramerMetadata__ = {\"exports\":{\"createStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./createStore.map","/*\n * createStore (framer/store@1.0.1)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js\"\n","export const centerContent = {\n    display: \"flex\",\n    justifyContent: \"center\",\n    alignItems: \"center\"\n};\nexport const autoSizingText = {\n    width: \"max-content\",\n    wordBreak: \"break-word\",\n    overflowWrap: \"break-word\",\n    overflow: \"hidden\",\n    whiteSpace: \"pre-wrap\",\n    flexShrink: 0\n};\nexport const defaultContainerStyles = {\n    ...centerContent,\n    overflow: \"hidden\"\n};\nexport const containerStyles = defaultContainerStyles;\nexport const randomColor = ()=>\"#\" + Math.floor(Math.random() * 16777215).toString(16)\n;\n\nexport const __FramerMetadata__ = {\"exports\":{\"centerContent\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"containerStyles\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"autoSizingText\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"defaultContainerStyles\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"randomColor\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}}}}\n//# sourceMappingURL=./Utils.map","/*\n * Utils (framer/utils@0.9.0)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/28rXvpPsrum7FH6cMELS/1jCAazZw1EGHjrG5Nu5D/Utils.js\"\n","import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useCallback,useEffect,useMemo}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{randomColor}from\"https://framer.com/m/framer/utils.js@^0.9.0\";// Learn more: https://www.framer.com/docs/guides/overrides/\nconst useStore=createStore({background:\"#0099FF\"});export function withRotate(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,animate:{rotate:90},transition:{duration:2}});};}export function withHover(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,whileHover:{scale:1.05}});};}export function withRandomColor(Component){return props=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{...props,animate:{background:store.background},onClick:()=>{setStore({background:randomColor()});}});};}const checkedCheckboxStyleId=\"framer-with-checked-checkbox-icon-style\";const checkedCheckboxClassName=\"framer-with-checked-checkbox-icon\";const checkmarkSvgDataUrl=\"url(\\\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='white' d='M6.2 11.2 2.9 8l1.4-1.4 1.9 1.9 5.5-5.5L13 4.4z'/%3E%3C/svg%3E\\\")\";const checkedCheckboxStyles=`\n.${checkedCheckboxClassName} {\n    -webkit-appearance: none;\n    appearance: none;\n    position: relative;\n    margin: 0;\n    display: inline-block;\n    vertical-align: middle;\n    background-repeat: no-repeat;\n    background-position: center;\n    background-size: 72% 72%;\n    background-origin: border-box;\n    border: 1px solid #CCCCCC;\n    border-radius: 4px;\n    background-color: #FFFFFF;\n    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;\n}\n\n.${checkedCheckboxClassName}:checked {\n    background-color: #FF1C52;\n    border-color: #FF1C52;\n    background-image: ${checkmarkSvgDataUrl};\n}\n\n.${checkedCheckboxClassName}:focus-visible {\n    outline: 2px solid #FF1C52;\n    outline-offset: 2px;\n}\n\n.${checkedCheckboxClassName}:disabled {\n    cursor: not-allowed;\n    opacity: 0.55;\n}\n`;export function withCheckedCheckboxIcon(Component){return /*#__PURE__*/forwardRef((props,ref)=>{useEffect(()=>{if(typeof document===\"undefined\")return;if(document.getElementById(checkedCheckboxStyleId))return;const styleElement=document.createElement(\"style\");styleElement.id=checkedCheckboxStyleId;styleElement.textContent=checkedCheckboxStyles;document.head.appendChild(styleElement);},[]);const mergedClassName=useMemo(()=>{return[props.className,checkedCheckboxClassName].filter(Boolean).join(\" \");},[props.className]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,className:mergedClassName,style:{...props.style}});});}export function withFourDigitDateYear(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const enforceFourDigitYear=useCallback(input=>{if(!input)return;const currentValue=input.value;if(!currentValue)return;const match=currentValue.match(/^(\\d+)(-\\d{2}-\\d{2})$/);if(!match)return;const[,year,remainder]=match;if(year.length<=4)return;input.value=`${year.slice(0,4)}${remainder}`;},[]);const shouldBlockKey=useCallback(event=>{const input=event?.currentTarget;if(!input)return false;const key=String(event?.key??\"\");const isDigit=/^\\d$/.test(key);if(!isDigit)return false;const value=input.value||\"\";const yearMatch=value.match(/^(\\d+)(?:-|$)/);const existingYearLength=yearMatch?.[1]?.length??0;if(existingYearLength<4)return false;const selectionStart=typeof input.selectionStart===\"number\"?input.selectionStart:null;const selectionEnd=typeof input.selectionEnd===\"number\"?input.selectionEnd:null;if(selectionStart===null||selectionEnd===null)return false;const editingYear=selectionStart<=4;const replacesYearChars=selectionEnd>selectionStart;return editingYear&&!replacesYearChars;},[]);const handleKeyDown=useCallback(event=>{if(shouldBlockKey(event)){event.preventDefault();}props.onKeyDown?.(event);},[props,shouldBlockKey]);const handlePaste=useCallback(event=>{const input=event?.currentTarget;const pastedText=event?.clipboardData?.getData?.(\"text\")??\"\";if(input&&pastedText){const sanitizedText=pastedText.trim();const match=sanitizedText.match(/^(\\d+)(-\\d{2}-\\d{2})$/);if(match&&match[1].length>4){event.preventDefault();input.value=`${match[1].slice(0,4)}${match[2]}`;}}props.onPaste?.(event);},[props]);const handleInput=useCallback(event=>{enforceFourDigitYear(event?.currentTarget);props.onInput?.(event);},[enforceFourDigitYear,props]);const handleChange=useCallback(event=>{enforceFourDigitYear(event?.currentTarget);props.onChange?.(event);},[enforceFourDigitYear,props]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onKeyDown:handleKeyDown,onPaste:handlePaste,onInput:handleInput,onChange:handleChange,style:{...props.style}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withRandomColor\":{\"type\":\"reactHoc\",\"name\":\"withRandomColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRotate\":{\"type\":\"reactHoc\",\"name\":\"withRotate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHover\":{\"type\":\"reactHoc\",\"name\":\"withHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCheckedCheckboxIcon\":{\"type\":\"reactHoc\",\"name\":\"withCheckedCheckboxIcon\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFourDigitDateYear\":{\"type\":\"reactHoc\",\"name\":\"withFourDigitDateYear\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Examples.map"],"mappings":"uMAA8E,SAAgB,EAAY,EAAO,CACjH,IAAM,EAAU,EAAK,CAAC,MAAM,OAAO,OAAO,CAAC,GAAG,CAAM,CAAC,CAAC,CAAC,EACjD,EAAa,GAAU,CAC1B,OAAO,GAAW,aAAY,EAAS,EAAS,EAAU,KAAK,GAAG,EAAU,MAAM,OAAO,OAAO,CAAC,GAAG,EAAU,MAAM,GAAG,CAAQ,CAAC,CAAE,EACjI,EAAW,OAAO,GAAS,SAAS,OAAO,OAAO,CAAC,GAAG,CAAM,CAAC,EAAE,EAC7D,EAAa,IAAI,IACjB,EAAc,GAAU,CAC3B,OAAO,GAAW,aAAY,EAAS,EAAS,CAAU,GAAG,EAAW,OAAO,GAAW,SAAS,OAAO,OAAO,CAAC,GAAG,EAAW,GAAG,CAAQ,CAAC,EAAE,EACjJ,EAAa,QAAQ,GAAQ,EAAO,CAAU,CAAC,CAAE,EACjD,SAAS,GAAU,CACnB,GAAK,CAAC,EAAM,GAAUA,EAAS,CAAU,EAKzC,OAHA,OACA,EAAa,IAAI,CAAQ,MAAY,EAAa,OAAO,CAAQ,GAAI,CAAC,CAAC,EACpE,EAAe,IAAI,IAAM,E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