PromoCursed/node_modules/.cache/babel-loader/4be4558355802d6c7e24139afdac226d9382bc2b34c94fd4441b2fe1d7f85458.json
2024-08-20 23:25:37 +04:00

1 line
8.1 KiB
JSON

{"ast":null,"code":"\"use client\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport raf from \"rc-util/es/raf\";\nimport Input from '../Input';\nconst OTPInput = /*#__PURE__*/React.forwardRef((props, ref) => {\n const {\n value,\n onChange,\n onActiveChange,\n index,\n mask\n } = props,\n restProps = __rest(props, [\"value\", \"onChange\", \"onActiveChange\", \"index\", \"mask\"]);\n const internalValue = value && typeof mask === 'string' ? mask : value;\n const onInternalChange = e => {\n onChange(index, e.target.value);\n };\n // ========================== Ref ===========================\n const inputRef = React.useRef(null);\n React.useImperativeHandle(ref, () => inputRef.current);\n // ========================= Focus ==========================\n const syncSelection = () => {\n raf(() => {\n var _a;\n const inputEle = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.input;\n if (document.activeElement === inputEle && inputEle) {\n inputEle.select();\n }\n });\n };\n // ======================== Keyboard ========================\n const onInternalKeyDown = _ref => {\n let {\n key\n } = _ref;\n if (key === 'ArrowLeft') {\n onActiveChange(index - 1);\n } else if (key === 'ArrowRight') {\n onActiveChange(index + 1);\n }\n syncSelection();\n };\n const onInternalKeyUp = e => {\n if (e.key === 'Backspace' && !value) {\n onActiveChange(index - 1);\n }\n syncSelection();\n };\n // ========================= Render =========================\n return /*#__PURE__*/React.createElement(Input, Object.assign({}, restProps, {\n ref: inputRef,\n value: internalValue,\n onInput: onInternalChange,\n onFocus: syncSelection,\n onKeyDown: onInternalKeyDown,\n onKeyUp: onInternalKeyUp,\n onMouseDown: syncSelection,\n onMouseUp: syncSelection,\n type: mask === true ? 'password' : 'text'\n }));\n});\nexport default OTPInput;","map":{"version":3,"names":["__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","raf","Input","OTPInput","forwardRef","props","ref","value","onChange","onActiveChange","index","mask","restProps","internalValue","onInternalChange","target","inputRef","useRef","useImperativeHandle","current","syncSelection","_a","inputEle","input","document","activeElement","select","onInternalKeyDown","_ref","key","onInternalKeyUp","createElement","assign","onInput","onFocus","onKeyDown","onKeyUp","onMouseDown","onMouseUp","type"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/input/OTP/OTPInput.js"],"sourcesContent":["\"use client\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport raf from \"rc-util/es/raf\";\nimport Input from '../Input';\nconst OTPInput = /*#__PURE__*/React.forwardRef((props, ref) => {\n const {\n value,\n onChange,\n onActiveChange,\n index,\n mask\n } = props,\n restProps = __rest(props, [\"value\", \"onChange\", \"onActiveChange\", \"index\", \"mask\"]);\n const internalValue = value && typeof mask === 'string' ? mask : value;\n const onInternalChange = e => {\n onChange(index, e.target.value);\n };\n // ========================== Ref ===========================\n const inputRef = React.useRef(null);\n React.useImperativeHandle(ref, () => inputRef.current);\n // ========================= Focus ==========================\n const syncSelection = () => {\n raf(() => {\n var _a;\n const inputEle = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.input;\n if (document.activeElement === inputEle && inputEle) {\n inputEle.select();\n }\n });\n };\n // ======================== Keyboard ========================\n const onInternalKeyDown = _ref => {\n let {\n key\n } = _ref;\n if (key === 'ArrowLeft') {\n onActiveChange(index - 1);\n } else if (key === 'ArrowRight') {\n onActiveChange(index + 1);\n }\n syncSelection();\n };\n const onInternalKeyUp = e => {\n if (e.key === 'Backspace' && !value) {\n onActiveChange(index - 1);\n }\n syncSelection();\n };\n // ========================= Render =========================\n return /*#__PURE__*/React.createElement(Input, Object.assign({}, restProps, {\n ref: inputRef,\n value: internalValue,\n onInput: onInternalChange,\n onFocus: syncSelection,\n onKeyDown: onInternalKeyDown,\n onKeyUp: onInternalKeyUp,\n onMouseDown: syncSelection,\n onMouseUp: syncSelection,\n type: mask === true ? 'password' : 'text'\n }));\n});\nexport default OTPInput;"],"mappings":"AAAA,YAAY;;AAEZ,IAAIA,MAAM,GAAG,IAAI,IAAI,IAAI,CAACA,MAAM,IAAI,UAAUC,CAAC,EAAEC,CAAC,EAAE;EAClD,IAAIC,CAAC,GAAG,CAAC,CAAC;EACV,KAAK,IAAIC,CAAC,IAAIH,CAAC,EAAE,IAAII,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACP,CAAC,EAAEG,CAAC,CAAC,IAAIF,CAAC,CAACO,OAAO,CAACL,CAAC,CAAC,GAAG,CAAC,EAAED,CAAC,CAACC,CAAC,CAAC,GAAGH,CAAC,CAACG,CAAC,CAAC;EAChG,IAAIH,CAAC,IAAI,IAAI,IAAI,OAAOI,MAAM,CAACK,qBAAqB,KAAK,UAAU,EAAE,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEP,CAAC,GAAGC,MAAM,CAACK,qBAAqB,CAACT,CAAC,CAAC,EAAEU,CAAC,GAAGP,CAAC,CAACQ,MAAM,EAAED,CAAC,EAAE,EAAE;IAC3I,IAAIT,CAAC,CAACO,OAAO,CAACL,CAAC,CAACO,CAAC,CAAC,CAAC,GAAG,CAAC,IAAIN,MAAM,CAACC,SA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