@jenesei-software/jenesei-kit-react 1.3.36 → 1.3.38
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/area-preview.cjs.js +1 -1
- package/build/area-preview.es.js +1 -1
- package/build/area-skeleton.cjs.js +1 -1
- package/build/area-skeleton.es.js +1 -1
- package/build/build-info.txt +3 -3
- package/build/{component-CwKwQY3p.cjs → component-B0PbrKuJ.cjs} +2 -2
- package/build/{component-CwKwQY3p.cjs.map → component-B0PbrKuJ.cjs.map} +1 -1
- package/build/{component-Dcn4OKm7.js → component-BBrKC5hB.js} +2 -2
- package/build/{component-Dcn4OKm7.js.map → component-BBrKC5hB.js.map} +1 -1
- package/build/{component-CHp7GYey.js → component-BlEglNo9.js} +3 -3
- package/build/{component-CHp7GYey.js.map → component-BlEglNo9.js.map} +1 -1
- package/build/{component-DkO36zGe.cjs → component-CONSm7hH.cjs} +2 -2
- package/build/{component-DkO36zGe.cjs.map → component-CONSm7hH.cjs.map} +1 -1
- package/build/{component-DrO-3u2I.js → component-CPVG0orB.js} +3 -3
- package/build/{component-DrO-3u2I.js.map → component-CPVG0orB.js.map} +1 -1
- package/build/{component-D3jtUpu3.js → component-CTrSBI75.js} +2 -2
- package/build/{component-D3jtUpu3.js.map → component-CTrSBI75.js.map} +1 -1
- package/build/{component-CS0uHwL5.js → component-CWawez-M.js} +110 -99
- package/build/component-CWawez-M.js.map +1 -0
- package/build/{component-C9Uf5Bc0.js → component-CZM5p4mC.js} +2 -2
- package/build/{component-C9Uf5Bc0.js.map → component-CZM5p4mC.js.map} +1 -1
- package/build/{component-C6JGm-CG.js → component-DGpaKn6_.js} +2 -2
- package/build/{component-C6JGm-CG.js.map → component-DGpaKn6_.js.map} +1 -1
- package/build/{component-BWvIUzNG.js → component-DKzHmIUP.js} +2 -2
- package/build/{component-BWvIUzNG.js.map → component-DKzHmIUP.js.map} +1 -1
- package/build/{component-CEZKgFH6.cjs → component-Dkw50gzn.cjs} +2 -2
- package/build/{component-CEZKgFH6.cjs.map → component-Dkw50gzn.cjs.map} +1 -1
- package/build/{component-COXlMHO8.cjs → component-Dy66XPIf.cjs} +2 -2
- package/build/{component-COXlMHO8.cjs.map → component-Dy66XPIf.cjs.map} +1 -1
- package/build/{component-Cao-X0at.cjs → component-DyLdklDO.cjs} +2 -2
- package/build/{component-Cao-X0at.cjs.map → component-DyLdklDO.cjs.map} +1 -1
- package/build/{component-DZbtSeCS.cjs → component-LG-duo2b.cjs} +2 -2
- package/build/{component-DZbtSeCS.cjs.map → component-LG-duo2b.cjs.map} +1 -1
- package/build/{component-BPtJjkt0.cjs → component-PZe4p8qh.cjs} +2 -2
- package/build/{component-BPtJjkt0.cjs.map → component-PZe4p8qh.cjs.map} +1 -1
- package/build/{component-BTPma8cy.js → component-RlcwDmkg.js} +2 -2
- package/build/{component-BTPma8cy.js.map → component-RlcwDmkg.js.map} +1 -1
- package/build/{component-DsLJSX6q.cjs → component-ZdZUAyaP.cjs} +2 -2
- package/build/{component-DsLJSX6q.cjs.map → component-ZdZUAyaP.cjs.map} +1 -1
- package/build/component-accordion.cjs.js +1 -1
- package/build/component-accordion.es.js +2 -2
- package/build/{component-BGAYOt_R.cjs → component-buGvmEo6.cjs} +2 -2
- package/build/{component-BGAYOt_R.cjs.map → component-buGvmEo6.cjs.map} +1 -1
- package/build/component-button-group.cjs.js +1 -1
- package/build/component-button-group.es.js +2 -2
- package/build/component-button.cjs.js +1 -1
- package/build/component-button.es.js +1 -1
- package/build/component-checkbox-group.cjs.js +1 -1
- package/build/component-checkbox-group.es.js +2 -2
- package/build/component-checkbox.cjs.js +1 -1
- package/build/component-checkbox.es.js +2 -2
- package/build/component-date-picker.cjs.js +1 -1
- package/build/component-date-picker.es.js +2 -2
- package/build/component-icon.cjs.js +1 -1
- package/build/component-icon.es.js +1 -1
- package/build/component-image-button.cjs.js +1 -1
- package/build/component-image-button.es.js +1 -1
- package/build/component-image-select.cjs.js +1 -1
- package/build/component-image-select.es.js +2 -2
- package/build/component-image-slider.cjs.js +1 -1
- package/build/component-image-slider.es.js +2 -2
- package/build/component-image.cjs.js +1 -1
- package/build/component-image.es.js +2 -2
- package/build/component-input-otp.cjs.js +1 -1
- package/build/component-input-otp.es.js +2 -2
- package/build/component-input.cjs.js +1 -1
- package/build/component-input.es.js +2 -2
- package/build/component-pagination.cjs.js +1 -1
- package/build/component-pagination.es.js +1 -1
- package/build/component-range.cjs.js +1 -1
- package/build/component-range.es.js +2 -2
- package/build/{component-9fzcSAV7.js → component-sNGsB3JK.js} +2 -2
- package/build/{component-9fzcSAV7.js.map → component-sNGsB3JK.js.map} +1 -1
- package/build/{component-qR0HPUpL.cjs → component-sVzC5XUR.cjs} +2 -2
- package/build/{component-qR0HPUpL.cjs.map → component-sVzC5XUR.cjs.map} +1 -1
- package/build/component-select.cjs.js +1 -1
- package/build/component-select.es.js +1 -1
- package/build/component-textarea.cjs.js +1 -1
- package/build/component-textarea.es.js +1 -1
- package/build/component-toggle.cjs.js +1 -1
- package/build/component-toggle.es.js +2 -2
- package/build/component-tooltip.cjs.js +1 -1
- package/build/component-tooltip.es.js +1 -1
- package/build/component-typography.cjs.js +1 -1
- package/build/component-typography.es.js +1 -1
- package/build/{component-DcOrj2ff.js → component-wOmehMbn.js} +3 -3
- package/build/{component-DcOrj2ff.js.map → component-wOmehMbn.js.map} +1 -1
- package/build/component-zLIAB2HV.cjs +2 -0
- package/build/{component-C8NWMxxo.cjs.map → component-zLIAB2HV.cjs.map} +1 -1
- package/build/{component.constants-DEtpkwiA.js → component.constants-CJcoXCFC.js} +49 -29
- package/build/component.constants-CJcoXCFC.js.map +1 -0
- package/build/{component.constants-D80V6i-m.cjs → component.constants-Ctj7PsM8.cjs} +2 -2
- package/build/{component.constants-D80V6i-m.cjs.map → component.constants-Ctj7PsM8.cjs.map} +1 -1
- package/build/{component.constants-QEk9PcRK.cjs → component.constants-CzKFXlYT.cjs} +2 -2
- package/build/component.constants-CzKFXlYT.cjs.map +1 -0
- package/build/{component.constants-Dulpp7av.js → component.constants-DjzlauTL.js} +2 -2
- package/build/{component.constants-Dulpp7av.js.map → component.constants-DjzlauTL.js.map} +1 -1
- package/build/{component.types-BbfCiww_.js → component.types-CryJGkU7.js} +2 -2
- package/build/{component.types-BbfCiww_.js.map → component.types-CryJGkU7.js.map} +1 -1
- package/build/{component.types-KTSAVZtM.cjs → component.types-Drt-O54w.cjs} +2 -2
- package/build/{component.types-KTSAVZtM.cjs.map → component.types-Drt-O54w.cjs.map} +1 -1
- package/build/consts.cjs.js +1 -1
- package/build/consts.es.js +1 -1
- package/build/context-app.cjs.js +1 -1
- package/build/context-app.es.js +2 -2
- package/build/context-dialog.cjs.js +1 -1
- package/build/context-dialog.d.ts +31 -26
- package/build/context-dialog.es.js +2 -2
- package/build/context-sonner.cjs.js +1 -1
- package/build/context-sonner.es.js +2 -2
- package/build/context.constants-Bzn9Rcey.cjs +32 -0
- package/build/context.constants-Bzn9Rcey.cjs.map +1 -0
- package/build/{context.constants-Bh-ajJM2.js → context.constants-D0UjboYX.js} +3 -3
- package/build/{context.constants-Bh-ajJM2.js.map → context.constants-D0UjboYX.js.map} +1 -1
- package/build/{context.constants-Nfy-8Qzj.js → context.constants-DUVlJghM.js} +51 -29
- package/build/context.constants-DUVlJghM.js.map +1 -0
- package/build/{context.constants-CDgzMcxb.cjs → context.constants-gXk1ewxx.cjs} +2 -2
- package/build/{context.constants-CDgzMcxb.cjs.map → context.constants-gXk1ewxx.cjs.map} +1 -1
- package/build/context.hooks-Bkj1PSKe.cjs +2 -0
- package/build/context.hooks-Bkj1PSKe.cjs.map +1 -0
- package/build/{context.hooks-BG1tp2nc.js → context.hooks-CCLq09Ra.js} +2 -2
- package/build/{context.hooks-BG1tp2nc.js.map → context.hooks-CCLq09Ra.js.map} +1 -1
- package/build/{context.hooks-BpQriPdQ.cjs → context.hooks-CDvi20Bm.cjs} +2 -2
- package/build/{context.hooks-BpQriPdQ.cjs.map → context.hooks-CDvi20Bm.cjs.map} +1 -1
- package/build/{context.hooks-BIfYPHOA.cjs → context.hooks-CUXDpPaG.cjs} +2 -2
- package/build/{context.hooks-BIfYPHOA.cjs.map → context.hooks-CUXDpPaG.cjs.map} +1 -1
- package/build/{context.hooks-Dx80dbrI.js → context.hooks-Djt5R2yX.js} +2 -2
- package/build/{context.hooks-Dx80dbrI.js.map → context.hooks-Djt5R2yX.js.map} +1 -1
- package/build/context.hooks-v8uZ7dfO.js +49 -0
- package/build/context.hooks-v8uZ7dfO.js.map +1 -0
- package/build/hooks-use-deep-compare-memoize.cjs.js +1 -1
- package/build/hooks-use-deep-compare-memoize.d.ts +1 -1
- package/build/hooks-use-deep-compare-memoize.es.js +1 -1
- package/build/index.cjs.js +1 -1
- package/build/index.d.ts +34 -27
- package/build/index.es.js +20 -20
- package/build/style-error.cjs.js +1 -1
- package/build/style-error.es.js +1 -1
- package/build/style-theme.cjs.js +1 -1
- package/build/style-theme.es.js +1 -1
- package/build/use-BNuSnUSV.cjs +16 -0
- package/build/use-BNuSnUSV.cjs.map +1 -0
- package/build/use-C7vngeRk.js +882 -0
- package/build/use-C7vngeRk.js.map +1 -0
- package/build/{use-Cglz8LOj.js → use-D8uozTND.js} +59 -45
- package/build/{use-Cglz8LOj.js.map → use-D8uozTND.js.map} +1 -1
- package/build/use-zW3LuRc_.cjs +2 -0
- package/build/use-zW3LuRc_.cjs.map +1 -0
- package/package.json +3 -1
- package/build/component-C8NWMxxo.cjs +0 -2
- package/build/component-CS0uHwL5.js.map +0 -1
- package/build/component.constants-DEtpkwiA.js.map +0 -1
- package/build/component.constants-QEk9PcRK.cjs.map +0 -1
- package/build/context.constants-BWZS-di6.cjs +0 -32
- package/build/context.constants-BWZS-di6.cjs.map +0 -1
- package/build/context.constants-Nfy-8Qzj.js.map +0 -1
- package/build/context.hooks-C-jAj7Vc.cjs +0 -2
- package/build/context.hooks-C-jAj7Vc.cjs.map +0 -1
- package/build/context.hooks-CxwYYLmV.js +0 -43
- package/build/context.hooks-CxwYYLmV.js.map +0 -1
- package/build/use-C1l0O0Qo.cjs +0 -2
- package/build/use-C1l0O0Qo.cjs.map +0 -1
- package/build/use-DGVoIo0g.cjs +0 -16
- package/build/use-DGVoIo0g.cjs.map +0 -1
- package/build/use-DT0XgvJT.js +0 -25
- package/build/use-DT0XgvJT.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./component-zLIAB2HV.cjs"),t=require("./context.constants-gXk1ewxx.cjs");exports.ImageSelect=e.ImageSelect,exports.ImageSelectListSize=t.ImageSelectListSize,exports.ImageSelectListSizeConstructor=t.ImageSelectListSizeConstructor,exports.ImageSelectListWrapper=t.ImageSelectListWrapper,exports.ImageSelectSize=t.ImageSelectSize,exports.ImageSelectSizeConstructor=t.ImageSelectSizeConstructor,exports.ImageSelectWrapper=t.ImageSelectWrapper;
|
|
2
2
|
//# sourceMappingURL=component-image-select.cjs.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I } from "./component-
|
|
2
|
-
import { Q, R, W, T, U, V } from "./context.constants-
|
|
1
|
+
import { I } from "./component-CWawez-M.js";
|
|
2
|
+
import { Q, R, W, T, U, V } from "./context.constants-D0UjboYX.js";
|
|
3
3
|
export {
|
|
4
4
|
I as ImageSelect,
|
|
5
5
|
Q as ImageSelectListSize,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./context.constants-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./context.constants-gXk1ewxx.cjs"),t=require("./component.constants-CzKFXlYT.cjs");exports.SliderDot=e.SliderDot,exports.SliderImage=e.SliderImage,exports.IMAGES=t.IMAGES,exports.ImageSlider=t.ImageSlider;
|
|
2
2
|
//# sourceMappingURL=component-image-slider.cjs.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Y, X } from "./context.constants-
|
|
2
|
-
import { a, I } from "./component.constants-
|
|
1
|
+
import { Y, X } from "./context.constants-D0UjboYX.js";
|
|
2
|
+
import { a, I } from "./component.constants-CJcoXCFC.js";
|
|
3
3
|
export {
|
|
4
4
|
a as IMAGES,
|
|
5
5
|
I as ImageSlider,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./component-PZe4p8qh.cjs"),t=require("./context.constants-gXk1ewxx.cjs");exports.Image=e.Image,exports.ImageIMG=t.ImageIMG;
|
|
2
2
|
//# sourceMappingURL=component-image.cjs.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./component-B0PbrKuJ.cjs"),e=require("./context.constants-gXk1ewxx.cjs");exports.InputOTP=t.InputOTP,exports.InputOTPSize=e.InputOTPSize,exports.InputOTPSizeConstructor=e.InputOTPSizeConstructor,exports.InputOTPWrapper=e.InputOTPWrapper;
|
|
2
2
|
//# sourceMappingURL=component-input-otp.cjs.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I } from "./component-
|
|
2
|
-
import { aa, ab, ac } from "./context.constants-
|
|
1
|
+
import { I } from "./component-wOmehMbn.js";
|
|
2
|
+
import { aa, ab, ac } from "./context.constants-D0UjboYX.js";
|
|
3
3
|
export {
|
|
4
4
|
I as InputOTP,
|
|
5
5
|
aa as InputOTPSize,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./component-buGvmEo6.cjs"),e=require("./context.constants-gXk1ewxx.cjs");exports.Input=t.Input,exports.formatPhoneNumber=t.formatPhoneNumber,exports.InputPostfixChildren=e.InputPostfixChildren,exports.InputPrefixChildren=e.InputPrefixChildren,exports.InputSize=e.InputSize,exports.InputSizeConstructor=e.InputSizeConstructor,exports.StyledInput=e.StyledInput,exports.StyledInputCSS=e.StyledInputCSS,exports.StyledInputNumeric=e.StyledInputNumeric,exports.StyledInputPattern=e.StyledInputPattern,exports.StyledInputWrapper=e.StyledInputWrapper,exports.StyledMotionInput=e.StyledMotionInput,exports.addInputIsInputEffect=e.addInputIsInputEffect,exports.addInputPlaceholder=e.addInputPlaceholder,exports.addInputPlaceholderNiceNumber=e.addInputPlaceholderNiceNumber;
|
|
2
2
|
//# sourceMappingURL=component-input.cjs.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I, f } from "./component-
|
|
2
|
-
import { a9, a8, a0, a1, a4, a3, a7, a6, Z, a5, a2, _, $ } from "./context.constants-
|
|
1
|
+
import { I, f } from "./component-DGpaKn6_.js";
|
|
2
|
+
import { a9, a8, a0, a1, a4, a3, a7, a6, Z, a5, a2, _, $ } from "./context.constants-D0UjboYX.js";
|
|
3
3
|
export {
|
|
4
4
|
I as Input,
|
|
5
5
|
a9 as InputPostfixChildren,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./component.constants-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./component.constants-Ctj7PsM8.cjs");exports.DEFAULT_COMPONENT_PAGINATION_GAP=t.DEFAULT_COMPONENT_PAGINATION_GAP,exports.Pagination=t.Pagination;
|
|
2
2
|
//# sourceMappingURL=component-pagination.cjs.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./component-ZdZUAyaP.cjs"),r=require("./context.constants-gXk1ewxx.cjs");exports.Range=e.Range,exports.RangeThumb=r.RangeThumb,exports.RangeTrack=r.RangeTrack,exports.RangeWrapper=r.RangeWrapper;
|
|
2
2
|
//# sourceMappingURL=component-range.cjs.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "./jsx-runtime-DZS36FSE.js";
|
|
2
|
-
import { a as Skeleton, O as ImageIMG } from "./context.constants-
|
|
2
|
+
import { a as Skeleton, O as ImageIMG } from "./context.constants-D0UjboYX.js";
|
|
3
3
|
import { b as Stack } from "./component-gcvwlILJ.js";
|
|
4
4
|
import { useState, useEffect } from "react";
|
|
5
5
|
import { useTheme } from "styled-components";
|
|
@@ -85,4 +85,4 @@ const Image = (props) => {
|
|
|
85
85
|
export {
|
|
86
86
|
Image as I
|
|
87
87
|
};
|
|
88
|
-
//# sourceMappingURL=component-
|
|
88
|
+
//# sourceMappingURL=component-sNGsB3JK.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-
|
|
1
|
+
{"version":3,"file":"component-sNGsB3JK.js","sources":["../src/components/image/component.tsx"],"sourcesContent":["import { Skeleton } from '@local/areas/skeleton';\nimport { Stack } from '@local/components/stack';\n\nimport { FC, useEffect, useState } from 'react';\nimport { useTheme } from 'styled-components';\n\nimport { ImageIMG, ImageProps } from '.';\n\nexport const Image: FC<ImageProps> = (props) => {\n const [isPending, setIsPending] = useState(true);\n const [isError, setIsError] = useState(false);\n\n useEffect(() => {\n if (!props.src) return;\n\n const img = new (window.Image as { new (width?: number, height?: number): HTMLImageElement })();\n\n img.onload = () => {\n setIsPending(false);\n setIsError(false);\n };\n\n img.onerror = () => {\n setIsPending(false);\n setIsError(true);\n };\n\n img.src = props.src;\n\n if (img.complete) {\n if (img.naturalWidth > 0) {\n setIsPending(false);\n setIsError(false);\n } else {\n setIsPending(false);\n setIsError(true);\n }\n }\n\n return () => {\n img.onload = null;\n img.onerror = null;\n setIsPending(true);\n setIsError(false);\n };\n }, [props.src]);\n const theme = useTheme();\n const { default: defaultSx, ...rest } = props?.sxStack\n ? typeof props?.sxStack === 'function'\n ? props.sxStack(theme)\n : props.sxStack\n : {};\n\n return (\n <Stack\n sx={{\n default: {\n position: 'relative',\n overflow: 'hidden',\n ...(props.isShowBeforeImage\n ? {\n '&::before': {\n width: '100%',\n height: '100%',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundImage: `url(${props.src})`,\n backgroundRepeat: 'no-repeat',\n backgroundSize: 'cover',\n backgroundPosition: 'center',\n filter: 'blur(20px)',\n transform: 'scale(1.1)',\n zIndex: 0,\n },\n }\n : {}),\n ...defaultSx,\n },\n ...rest,\n }}\n >\n {!isError ? (\n props.componentLoading || isPending ? (\n <Skeleton\n visible\n sx={{\n default: {\n width: '100%',\n height: '100%',\n },\n }}\n />\n ) : null\n ) : null}\n {!isError && (\n <ImageIMG loading='lazy' $isPending={isPending} src={props.src} alt={props.alt} $sx={props.sxImage} />\n )}\n {isError ? props.componentFallback || null : null}\n </Stack>\n );\n};\n"],"names":["jsxs","jsx"],"mappings":";;;;;AAQO,MAAM,QAAwB,CAAC,UAAU;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAC/C,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAE5C,YAAU,MAAM;AACd,QAAI,CAAC,MAAM,IAAK;AAEhB,UAAM,MAAM,IAAK,OAAO,MAAA;AAExB,QAAI,SAAS,MAAM;AACjB,mBAAa,KAAK;AAClB,iBAAW,KAAK;AAAA,IAClB;AAEA,QAAI,UAAU,MAAM;AAClB,mBAAa,KAAK;AAClB,iBAAW,IAAI;AAAA,IACjB;AAEA,QAAI,MAAM,MAAM;AAEhB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,UAAA,EAAS,SAAQ,QAAO,YAAY,WAAW,KAAK,MAAM,KAAK,KAAK,MAAM,KAAK,KAAK,MAAM,SAAS;AAAA,QAErG,UAAU,MAAM,qBAAqB,OAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGnD;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("./jsx-runtime-C6yv_9g1.cjs"),s=require("./context.constants-
|
|
2
|
-
//# sourceMappingURL=component-
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-C6yv_9g1.cjs"),s=require("./context.constants-gXk1ewxx.cjs"),i=require("react"),n=require("styled-components");require("./component.styles-BX2Aiqp_.cjs");const r=require("./component-DqV_-YxZ.cjs");exports.Checkbox=o=>{var t,l,d;const c=i.useCallback(e=>{var s;null==(s=o.onChange)||s.call(o,e)},[o.onChange]),a=n.useTheme(),x=i.useMemo(()=>e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(s.Icon,{...o.checked?o.view.true:o.view.false,size:(o.checked?o.view.true:o.view.false).size??o.size}),o.children&&o.children]}),[o.checked,o.children,o.size,o.view]),u=e.jsxRuntimeExports.jsx(s.Icon,{size:o.size,type:"loading",name:"Line"});return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(s.CheckboxWrapper,{type:"button",$genre:o.genre,$error:o.error,$view:o.view,$font:{...o.font,size:(null==(t=o.font)?void 0:t.size)??s.KEY_SIZE_DATA[o.size].font,weight:(null==(l=o.font)?void 0:l.weight)??700},$checked:o.checked,$isWidthAsHeight:o.isWidthAsHeight,$size:o.size,$isDisabled:o.isDisabled,$isHiddenBorder:o.isHiddenBorder,$isNotBackground:o.isNotBackground,$sx:o.sx,$sxTypography:o.sxTypography,$isDisabledOutline:o.isDisabled??o.isDisabledOutline,$isOutlineBoxShadow:o.isOutlineBoxShadow,$isReadOnly:o.isReadOnly,disabled:o.isDisabled,tabIndex:0,onClick:()=>!o.isDisabled&&c(!o.checked),children:[e.jsxRuntimeExports.jsx(r.Ripple,{color:a.colors.checkbox[o.genre].color.rest,isDisabled:o.isDisabled}),o.isOnlyLoading?o.isLoading?u:x:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[x,o.isLoading&&u]})]}),(null==o?void 0:o.error)?e.jsxRuntimeExports.jsx(s.ErrorMessage,{...o.error,size:(null==o?void 0:o.error.size)??o.size,font:{size:12,weight:400,family:(null==(d=o.font)?void 0:d.family)??a.font.family}}):null]})};
|
|
2
|
+
//# sourceMappingURL=component-sVzC5XUR.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-
|
|
1
|
+
{"version":3,"file":"component-sVzC5XUR.cjs","sources":["../src/components/checkbox/component.tsx"],"sourcesContent":["import { ErrorMessage } from '@local/styles/error';\nimport { KEY_SIZE_DATA } from '@local/theme';\n\nimport { FC, useCallback, useMemo } from 'react';\nimport { useTheme } from 'styled-components';\n\nimport { Icon } from '../icon';\nimport { Ripple } from '../ripple';\nimport { CheckboxProps, CheckboxWrapper } from '.';\n\nexport const Checkbox: FC<CheckboxProps> = (props) => {\n const handleOnClick = useCallback(\n (checked: boolean) => {\n props.onChange?.(checked);\n },\n [props.onChange],\n );\n const theme = useTheme();\n const children = useMemo(\n () => (\n <>\n <Icon\n {...(props.checked ? props.view.true : props.view.false)}\n size={(props.checked ? props.view.true : props.view.false).size ?? props.size}\n />\n {props.children && props.children}\n </>\n ),\n [props.checked, props.children, props.size, props.view],\n );\n const LoadingComponent = <Icon size={props.size} type='loading' name='Line' />;\n\n return (\n <>\n <CheckboxWrapper\n type='button'\n $genre={props.genre}\n $error={props.error}\n $view={props.view}\n $font={{\n ...props.font,\n size: props.font?.size ?? KEY_SIZE_DATA[props.size].font,\n weight: props.font?.weight ?? 700,\n }}\n $checked={props.checked}\n $isWidthAsHeight={props.isWidthAsHeight}\n $size={props.size}\n $isDisabled={props.isDisabled}\n $isHiddenBorder={props.isHiddenBorder}\n $isNotBackground={props.isNotBackground}\n $sx={props.sx}\n $sxTypography={props.sxTypography}\n $isDisabledOutline={props.isDisabled ?? props.isDisabledOutline}\n $isOutlineBoxShadow={props.isOutlineBoxShadow}\n $isReadOnly={props.isReadOnly}\n disabled={props.isDisabled}\n tabIndex={0}\n onClick={() => !props.isDisabled && handleOnClick(!props.checked)}\n >\n <Ripple color={theme.colors.checkbox[props.genre].color.rest} isDisabled={props.isDisabled} />\n {props.isOnlyLoading ? (\n props.isLoading ? (\n LoadingComponent\n ) : (\n children\n )\n ) : (\n <>\n {children}\n {props.isLoading && LoadingComponent}\n </>\n )}\n </CheckboxWrapper>\n {props?.error ? (\n <ErrorMessage\n {...props.error}\n size={props?.error.size ?? props.size}\n font={{\n size: 12,\n weight: 400,\n family: props.font?.family ?? theme.font.family,\n }}\n />\n ) : null}\n </>\n );\n};\n"],"names":["props","handleOnClick","useCallback","checked","_a","onChange","call","theme","useTheme","children","useMemo","jsxs","Fragment","jsx","Icon","view","true","false","size","LoadingComponent","type","name","CheckboxWrapper","$genre","genre","$error","error","$view","$font","font","KEY_SIZE_DATA","weight","_b","$checked","$isWidthAsHeight","isWidthAsHeight","$size","$isDisabled","isDisabled","$isHiddenBorder","isHiddenBorder","$isNotBackground","isNotBackground","$sx","sx","$sxTypography","sxTypography","$isDisabledOutline","isDisabledOutline","$isOutlineBoxShadow","isOutlineBoxShadow","$isReadOnly","isReadOnly","disabled","tabIndex","onClick","Ripple","color","colors","checkbox","rest","isOnlyLoading","isLoading","ErrorMessage","family","_c"],"mappings":"mQAU4CA,cAC1C,MAAMC,EAAgBC,EAAAA,YACnBC,UACC,OAAAC,EAAAJ,EAAMK,WAAND,EAAAE,KAAAN,EAAiBG,IAEnB,CAACH,EAAMK,WAEHE,EAAQC,EAAAA,WACRC,EAAWC,EAAAA,QACf,MACEC,kBAAAA,KAAAC,6BAAA,CACEH,SAAA,GAAAI,kBAAAA,IAACC,EAAA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M8D,UACJ3C,EAEAV,EAGFE,EAAAA,kBAAAA,KAAAC,6BAAA,CACGH,SAAA,CAAAA,EACAT,EAAM8D,WAAa3C,SAIzB,MAAAnB,OAAA,EAAAA,EAAO0B,OACNb,EAAAA,kBAAAA,IAACkD,EAAAA,aAAA,IACK/D,EAAM0B,MACVR,MAAM,MAAAlB,OAAA,EAAAA,EAAO0B,MAAMR,OAAQlB,EAAMkB,KACjCW,KAAM,CACJX,KAAM,GACNa,OAAQ,IACRiC,QAAQ,OAAAC,EAAAjE,EAAM6B,WAAN,EAAAoC,EAAYD,SAAUzD,EAAMsB,KAAKmC,UAG3C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./context.constants-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./context.constants-gXk1ewxx.cjs");exports.ButtonList=t.ButtonList,exports.ContainerDropdownListOption=t.ContainerDropdownListOption,exports.ContainerSelectListOption=t.ContainerSelectListOption,exports.DropdownList=t.DropdownList,exports.DropdownListOption=t.DropdownListOption,exports.DropdownListOptionIcon=t.DropdownListOptionIcon,exports.DropdownListParent=t.DropdownListParent,exports.Select=t.Select,exports.SelectLanguage=t.SelectLanguage,exports.SelectList=t.SelectList,exports.SelectListOption=t.SelectListOption,exports.SelectMonth=t.SelectMonth,exports.SelectMonths=t.SelectMonths,exports.SelectTextArea=t.SelectTextArea,exports.SelectWrapper=t.SelectWrapper,exports.SelectYear=t.SelectYear;
|
|
2
2
|
//# sourceMappingURL=component-select.cjs.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { at, ah, ai, ap, aq, ar, ao, ag, aj, as, au, ak, al, av, an, am } from "./context.constants-
|
|
1
|
+
import { at, ah, ai, ap, aq, ar, ao, ag, aj, as, au, ak, al, av, an, am } from "./context.constants-D0UjboYX.js";
|
|
2
2
|
export {
|
|
3
3
|
at as ButtonList,
|
|
4
4
|
ah as ContainerDropdownListOption,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./context.constants-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./context.constants-gXk1ewxx.cjs");exports.StyledTextArea=e.StyledTextArea,exports.TextArea=e.TextArea,exports.TextAreaWrapper=e.TextAreaWrapper,exports.addTextArea=e.addTextArea;
|
|
2
2
|
//# sourceMappingURL=component-textarea.cjs.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./component-Dkw50gzn.cjs"),o=require("./context.constants-gXk1ewxx.cjs");exports.Toggle=e.Toggle,exports.ToggleCenter=o.ToggleCenter,exports.ToggleWrapper=o.ToggleWrapper;
|
|
2
2
|
//# sourceMappingURL=component-toggle.cjs.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./context.constants-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./context.constants-gXk1ewxx.cjs");exports.DEFAULT_TOOLTIP_OFFSET_FALLBACK=o.DEFAULT_TOOLTIP_OFFSET_FALLBACK,exports.DEFAULT_TOOLTIP_PLACEMENT_FALLBACK=o.DEFAULT_TOOLTIP_PLACEMENT_FALLBACK,exports.Tooltip=o.Tooltip,exports.TooltipBox=o.TooltipBox,exports.TooltipContainer=o.TooltipContainer,exports.TooltipContent=o.TooltipContent,exports.addTooltipBoxSize=o.addTooltipBoxSize,exports.addTooltipBoxSizeConstructor=o.addTooltipBoxSizeConstructor;
|
|
2
2
|
//# sourceMappingURL=component-tooltip.cjs.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./component.functions-D9ffjEok.cjs"),t=require("./context.constants-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./component.functions-D9ffjEok.cjs"),t=require("./context.constants-gXk1ewxx.cjs");exports.getFontSizeStyles=o.getFontSizeStyles,exports.Title=t.Title,exports.Typography=t.Typography,exports.TypographyLink=t.TypographyLink,exports.TypographyTooltip=t.TypographyTooltip,exports.addSXTypography=t.addSXTypography;
|
|
2
2
|
//# sourceMappingURL=component-typography.cjs.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "./jsx-runtime-DZS36FSE.js";
|
|
2
|
-
import { ac as InputOTPWrapper, bk as ErrorMessage } from "./context.constants-
|
|
2
|
+
import { ac as InputOTPWrapper, bk as ErrorMessage } from "./context.constants-D0UjboYX.js";
|
|
3
3
|
import { useState, useRef, useCallback } from "react";
|
|
4
|
-
import { I as Input } from "./component-
|
|
4
|
+
import { I as Input } from "./component-DGpaKn6_.js";
|
|
5
5
|
const InputOTP = (props) => {
|
|
6
6
|
var _a;
|
|
7
7
|
const [otp, setOtp] = useState(new Array(props.length).fill(""));
|
|
@@ -167,4 +167,4 @@ const InputOTP = (props) => {
|
|
|
167
167
|
export {
|
|
168
168
|
InputOTP as I
|
|
169
169
|
};
|
|
170
|
-
//# sourceMappingURL=component-
|
|
170
|
+
//# sourceMappingURL=component-wOmehMbn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-
|
|
1
|
+
{"version":3,"file":"component-wOmehMbn.js","sources":["../src/components/input-otp/component.tsx"],"sourcesContent":["import { ErrorMessage } from '@local/styles/error';\n\nimport { ClipboardEvent, FocusEvent, KeyboardEvent, useCallback, useRef, useState } from 'react';\n\nimport { Input } from '../input';\nimport { InputOTPProps, InputOTPWrapper } from '.';\n\nexport const InputOTP = (props: InputOTPProps) => {\n const [otp, setOtp] = useState<string[]>(new Array(props.length).fill(''));\n const inputsRef = useRef<(HTMLInputElement | null)[]>([]);\n const wrapperRef = useRef<HTMLDivElement | null>(null);\n\n const handlePaste = useCallback(\n (index: number, e: ClipboardEvent<HTMLInputElement>) => {\n e.preventDefault();\n\n const pasteData = e.clipboardData.getData('Text');\n const digits = pasteData.replace(/\\D/g, '').split('');\n\n if (!digits.length) return;\n\n setOtp((prevOtp) => {\n const newOtp = [...prevOtp];\n let currentIndex = index;\n\n for (let i = 0; i < digits.length && currentIndex < newOtp.length; i++) {\n newOtp[currentIndex] = digits[i];\n currentIndex++;\n }\n\n const joined = newOtp.join('');\n\n props.onChange?.(joined);\n\n if (newOtp.every((char) => char !== '')) {\n props.onComplete?.(joined);\n }\n\n setTimeout(() => {\n const firstEmpty = newOtp.findIndex((char) => char === '');\n if (firstEmpty !== -1) {\n inputsRef.current[firstEmpty]?.focus();\n } else if (currentIndex < newOtp.length) {\n inputsRef.current[currentIndex]?.focus();\n }\n }, 0);\n\n return newOtp;\n });\n },\n [props],\n );\n\n const handleChange = useCallback(\n (index: number, value: string) => {\n if (!/^\\d*$/.test(value)) return;\n\n setOtp((prevOtp) => {\n const newOtp = [...prevOtp];\n newOtp[index] = value.slice(-1);\n\n if (props.onChange) {\n props.onChange(newOtp.join(''));\n }\n\n if (newOtp.every((char) => char !== '')) {\n props.onComplete?.(newOtp.join(''));\n }\n\n if (value && index < prevOtp.length - 1) {\n setTimeout(() => {\n inputsRef.current[index + 1]?.focus();\n }, 0);\n }\n\n return newOtp;\n });\n },\n [props],\n );\n\n const handleKeyDown = (index: number, e: KeyboardEvent<HTMLInputElement>) => {\n const input = inputsRef.current[index];\n\n if (!input) return;\n\n if (e.key === 'ArrowRight') {\n const nextIndex = index < otp.length - 1 ? index + 1 : 0;\n const nextInput = inputsRef.current[nextIndex];\n\n if (nextInput) {\n nextInput.focus();\n setTimeout(() => nextInput.setSelectionRange(0, nextInput.value.length), 0);\n }\n }\n\n if (e.key === 'ArrowLeft') {\n const prevIndex = index > 0 ? index - 1 : otp.length - 1;\n const prevInput = inputsRef.current[prevIndex];\n\n if (prevInput) {\n prevInput.focus();\n setTimeout(() => prevInput.setSelectionRange(0, prevInput.value.length), 0);\n }\n }\n\n if (e.key === 'Backspace') {\n if (input.value) {\n setTimeout(() => input.setSelectionRange(0, input.value.length), 0);\n } else if (index > 0) {\n setTimeout(() => {\n const prevInput = inputsRef.current[index - 1];\n if (prevInput) {\n prevInput.focus();\n prevInput.setSelectionRange(0, prevInput.value.length);\n }\n }, 0);\n }\n }\n };\n\n const handleFocusInput = useCallback((e: FocusEvent<HTMLInputElement>) => {\n setTimeout(() => e.target.setSelectionRange(0, e.target.value.length), 0);\n }, []);\n return (\n <>\n <InputOTPWrapper\n $error={props.error}\n $size={props.size}\n id={props.id}\n ref={wrapperRef}\n onBlur={(e) => {\n setTimeout(() => {\n if (wrapperRef.current && !wrapperRef.current.contains(document.activeElement)) {\n props.onBlur?.(e);\n }\n }, 0);\n }}\n onFocus={(e) => {\n setTimeout(() => {\n if (wrapperRef.current?.contains(document.activeElement)) {\n props.onFocus?.(e);\n }\n }, 0);\n }}\n $sx={props.sx}\n >\n {otp.map((digit, index) => (\n <Input\n isWidthAsHeight\n key={index}\n tabIndex={index + 1}\n ref={(el) => {\n inputsRef.current[index] = el;\n }}\n variety='standard'\n type='text'\n inputMode='numeric'\n maxLength={1}\n value={digit}\n onFocus={handleFocusInput}\n onPaste={(e) => handlePaste(index, e)}\n onChange={(value) => handleChange(index, value)}\n onKeyDown={(e) => handleKeyDown(index, e)}\n genre={props.genre}\n size={props.size}\n font={props.font}\n />\n ))}\n </InputOTPWrapper>\n {props?.error ? (\n <ErrorMessage\n {...props.error}\n size={props?.error.size ?? props.size}\n font={{\n size: 12,\n weight: 400,\n family: props.font?.family,\n }}\n />\n ) : null}\n </>\n );\n};\n"],"names":["_a","_b","jsxs","Fragment","jsx"],"mappings":";;;;AAOO,MAAM,WAAW,CA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AU,QAAQ,KAAK,IAAI;AAAA,YAC7B;AAAA,YACA,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,WAAU;AAAA,YACV,WAAW;AAAA,YACX,OAAO;AAAA,YACP,SAAS;AAAA,YACT,SAAS,CAAC,MAAM,YAAY,OAAO,CAAC;AAAA,YACpC,UAAU,CAAC,UAAU,aAAa,OAAO,KAAK;AAAA,YAC9C,WAAW,CAAC,MAAM,cAAc,OAAO,CAAC;AAAA,YACxC,OAAO,MAAM;AAAA,YACb,MAAM,MAAM;AAAA,YACZ,MAAM,MAAM;AAAA,UAAA;AAAA,UAhBP;AAAA,QAAA,CAkBR;AAAA,MAAA;AAAA,IAAA;AAAA,KAEF,+BAAO,SACNA,kCAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAG,MAAM;AAAA,QACV,OAAM,+BAAO,MAAM,SAAQ,MAAM;AAAA,QACjC,MAAM;AAAA,UACJ,MAAM;AAAA,UACN,QAAQ;AAAA,UACR,SAAQ,WAAM,SAAN,mBAAY;AAAA,QAAA;AAAA,MACtB;AAAA,IAAA,IAEA;AAAA,EAAA,GACN;AAEJ;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-C6yv_9g1.cjs"),t=require("./consts.cjs.js"),i=require("./use-BNuSnUSV.cjs"),s=require("./context.constants-gXk1ewxx.cjs"),n=require("./component-PZe4p8qh.cjs"),r=require("./component-CoOTSdM5.cjs"),o=require("styled-components");require("./context.constants-Bzn9Rcey.cjs");const a=require("./context.hooks-Bkj1PSKe.cjs"),l=require("react"),u=require("framer-motion");exports.ImageSelect=d=>{const{onChange:g}=d,c=l.useMemo(()=>s.KEY_SIZE_DATA[d.size],[d.size]),[p,x]=l.useState(d.images||[]),[m,h]=l.useState(!1),j=l.useRef(null),f=o.useTheme(),S=l.useCallback(e=>{e&&x(t=>{const i=e.map((e,i)=>({...e,index:t.length+i})),s=[...t,...i];return null==g||g(s),s})},[g]),b=()=>{var e;null==(e=j.current)||e.click()},{handleAddFiles:R}=i.useImageCrop({onSave:S,locale:d.locale,dialog:{button:{genre:d.propsButton.default.genre,size:d.propsButton.default.size},buttonDelete:{genre:d.propsButton.delete.genre,size:d.propsButton.delete.size}},imageSettings:{maxSize:d.imageSettings.maxSize,maxCount:d.imageSettings.maxCount-p.length,aspect:d.imageSettings.aspect},refInput:j}),{handleAdd:v}=(t=>{const i=l.useMemo(()=>s.KEY_SIZE_DATA[t.size],[t.size]),o=l.useMemo(()=>`${i.radius}px`,[i.radius]),[u,d]=l.useState(null),g=l.useMemo(()=>({propsCustom:{image:u,br:o},propsDialog:{borderRadius:o,padding:"0",background:"whiteStandard"},onRemove(){d(null)},content:(i,o,a)=>e.jsxRuntimeExports.jsxs(r.Stack,{sx:{default:{position:"relative",overflow:"hidden",aspectRatio:2*t.imageSettings.aspect+" / 2",width:"auto",maxWidth:"70dvw",height:"85dvh",borderRadius:null==a?void 0:a.br},tablet:{maxWidth:"95dvw"}},children:[(null==a?void 0:a.image)?e.jsxRuntimeExports.jsx(n.Image,{sxStack:e=>({default:{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",backgroundColor:e.palette.black10,position:"absolute",pointerEvents:"none"}}),isShowBeforeImage:!0,sxImage:{default:{objectFit:"contain"}},alt:a.image.imageSrc,src:a.image.imageSrc,componentFallback:e.jsxRuntimeExports.jsx(s.Typography,{sx:{default:{variant:"h6"}},children:t.locale.imageFallback})}):null,e.jsxRuntimeExports.jsx(s.Button,{sx:{default:{position:"absolute",bottom:15,right:15}},genre:"realebail-white",size:"small",icons:[{type:"id",name:"Arrow4"}],isWidthAsHeight:!0,isHiddenBorder:!0,isRadius:!0,onClick:()=>null==i?void 0:i()})]})}),[o,t.imageSettings.aspect,t.locale.imageFallback,u]),{add:c}=a.useDialog(g);return{handleAdd:l.useCallback(e=>{d(e),c()},[c])}})({size:d.size,locale:d.locale,imageSettings:d.imageSettings,genre:d.genre});return l.useEffect(()=>{x(d.images||[])},[d.images]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(s.ImageSelectWrapper,{$genre:d.genre,$size:d.size,id:d.id,$sx:d.sx,$error:d.error,children:[e.jsxRuntimeExports.jsxs(s.ImageSelectListWrapper,{onDrop:e=>{(e=>{var t;e.preventDefault(),(null==(t=e.dataTransfer.files)?void 0:t.length)&&R(e.dataTransfer.files)})(e),h(!1)},onDragOver:e=>e.preventDefault(),onDragEnter:()=>h(!0),onDragLeave:()=>h(!1),animate:{borderColor:m?f.colors.imageSelect[d.genre].border.hover:f.colors.imageSelect[d.genre].border.rest},transition:{duration:.3},$genre:d.genre,$size:d.size,children:[e.jsxRuntimeExports.jsxs(u.motion.div,{transition:{layout:{duration:.3,ease:"easeInOut",type:"spring"}},layout:!0,style:{display:"flex",flexWrap:"wrap",gap:c.padding-2+"px"},children:[p.map(t=>t.url&&e.jsxRuntimeExports.jsxs(u.motion.div,{style:{position:"relative",width:`${d.imageSettings.width}px`,height:`${d.imageSettings.height}px`,userSelect:"none",overflow:"hidden",borderRadius:`${c.radius}px`,flexGrow:1},layout:!0,transition:{layout:{duration:.3,ease:"easeInOut",type:"spring"}},children:[e.jsxRuntimeExports.jsx(n.Image,{sxStack:e=>({default:{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",backgroundColor:e.palette.black10,position:"absolute",pointerEvents:"none"}}),isShowBeforeImage:d.isContain,sxImage:{default:{objectFit:d.isContain?"contain":"cover"}},alt:t.name||"image",src:t.url,componentFallback:e.jsxRuntimeExports.jsx(s.Typography,{sx:{default:{variant:"h6"}},children:d.locale.imageFallback})}),e.jsxRuntimeExports.jsx(s.Button,{sx:{default:{position:"absolute",top:5,right:5}},genre:d.genre,size:"small",icons:[{type:"id",name:"Close"}],isWidthAsHeight:!0,isHiddenBorder:!0,isRadius:!0,onClick:()=>{return e=t.id,void x(t=>{const i=t.filter(t=>t.id!==e);return null==g||g(i),i});var e}}),e.jsxRuntimeExports.jsx(s.Button,{sx:{default:{position:"absolute",bottom:5,right:5}},genre:d.genre,size:"small",icons:[{type:"id",name:"Activity"}],isWidthAsHeight:!0,isHiddenBorder:!0,isRadius:!0,onClick:()=>t.url&&v({id:t.id,imageSrc:t.url})})]},t.id)),0===p.length?e.jsxRuntimeExports.jsx("div",{onClick:b,style:{position:"relative",width:`${d.imageSettings.width}px`,height:`${d.imageSettings.height}px`,userSelect:"none",overflow:"hidden",borderRadius:`${c.radius}px`,flexGrow:1,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center",cursor:"pointer"},children:e.jsxRuntimeExports.jsx(s.Typography,{style:{color:f.colors.imageSelect[d.genre].color.rest},sx:{default:{}},children:d.locale.dragAndDrop})},"empty"):null]}),e.jsxRuntimeExports.jsx("input",{ref:j,type:"file",accept:t.LIST_IMAGE_SUPPORTED_FORMAT_FOR_INPUT,multiple:!0,style:{display:"none"},onChange:e=>{e.target.files&&R(e.target.files)}})]}),e.jsxRuntimeExports.jsxs(r.Stack,{sx:{default:{flexGrow:1,gap:c.padding-2+"px"}},children:[e.jsxRuntimeExports.jsx(s.Button,{type:"button",genre:d.genre,size:d.size,sx:{default:{flexGrow:3}},isRadius:!0,onClick:b,children:d.locale.buttonAdd}),e.jsxRuntimeExports.jsx(s.Button,{isRadius:!0,type:"button",sx:{default:{flexGrow:1}},onClick:()=>{x(d.defaultImages||[]),null==g||g(d.defaultImages||[])},genre:d.genre,size:d.size,children:d.locale.buttonReset})]})]}),(null==d?void 0:d.error)?e.jsxRuntimeExports.jsx(s.ErrorMessage,{...d.error,size:(null==d?void 0:d.error.size)??d.size,font:{size:12,weight:400,family:f.font.family}}):null]})};
|
|
2
|
+
//# sourceMappingURL=component-zLIAB2HV.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-C8NWMxxo.cjs","sources":["../src/components/image-select/component.tsx","../src/hooks/use-image-view/use.tsx"],"sourcesContent":["import { LIST_IMAGE_SUPPORTED_FORMAT_FOR_INPUT } from '@local/consts';\nimport { useImageCrop } from '@local/hooks/use-image-crop';\nimport { useImageView } from '@local/hooks/use-image-view';\nimport { ErrorMessage } from '@local/styles/error';\nimport { KEY_SIZE_DATA } from '@local/theme';\n\nimport { motion } from 'framer-motion';\nimport { DragEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useTheme } from 'styled-components';\n\nimport { Button } from '../button';\nimport { Image } from '../image';\nimport { Stack } from '../stack';\nimport { Typography } from '../typography';\nimport { ImageSelectItemProps, ImageSelectListWrapper, ImageSelectProps, ImageSelectWrapper } from '.';\n\nexport const ImageSelect = (props: ImageSelectProps) => {\n const { onChange } = props;\n\n const size = useMemo(() => KEY_SIZE_DATA[props.size], [props.size]);\n\n const [images, setImages] = useState<ImageSelectItemProps[]>(props.images || []);\n\n const [isDraggingOver, setIsDraggingOver] = useState(false);\n\n const refInput = useRef<HTMLInputElement | null>(null);\n\n const theme = useTheme();\n\n const handleDrop = (e: DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n if (e.dataTransfer.files?.length) {\n handleAddFilesCrop(e.dataTransfer.files);\n }\n };\n\n const handleDelete = (id: number) => {\n setImages((prev) => {\n const finalImages = prev.filter((img) => img.id !== id);\n onChange?.(finalImages);\n return finalImages;\n });\n };\n\n const handleOnSave = useCallback(\n (files: ImageSelectItemProps[] | null) => {\n if (files) {\n setImages((prev) => {\n const newImages = files.map((file, idx) => ({\n ...file,\n index: prev.length + idx,\n }));\n const finalImages = [...prev, ...newImages];\n onChange?.(finalImages);\n return finalImages;\n });\n }\n },\n [onChange],\n );\n\n const openFileDialog = () => {\n refInput.current?.click();\n };\n\n const resetImages = () => {\n setImages(props.defaultImages || []);\n onChange?.(props.defaultImages || []);\n };\n\n const { handleAddFiles: handleAddFilesCrop } = useImageCrop({\n onSave: handleOnSave,\n locale: props.locale,\n dialog: {\n button: {\n genre: props.propsButton.default.genre,\n size: props.propsButton.default.size,\n },\n buttonDelete: {\n genre: props.propsButton.delete.genre,\n size: props.propsButton.delete.size,\n },\n },\n imageSettings: {\n maxSize: props.imageSettings.maxSize,\n maxCount: props.imageSettings.maxCount - images.length,\n aspect: props.imageSettings.aspect,\n },\n refInput: refInput,\n });\n\n const { handleAdd } = useImageView({\n size: props.size,\n locale: props.locale,\n imageSettings: props.imageSettings,\n genre: props.genre,\n });\n\n useEffect(() => {\n setImages(props.images || []);\n }, [props.images]);\n\n return (\n <>\n <ImageSelectWrapper $genre={props.genre} $size={props.size} id={props.id} $sx={props.sx} $error={props.error}>\n <ImageSelectListWrapper\n onDrop={(e) => {\n handleDrop(e);\n setIsDraggingOver(false);\n }}\n onDragOver={(e) => e.preventDefault()}\n onDragEnter={() => setIsDraggingOver(true)}\n onDragLeave={() => setIsDraggingOver(false)}\n animate={{\n borderColor: isDraggingOver\n ? theme.colors.imageSelect[props.genre].border.hover\n : theme.colors.imageSelect[props.genre].border.rest,\n }}\n transition={{ duration: 0.3 }}\n $genre={props.genre}\n $size={props.size}\n >\n <motion.div\n transition={{\n layout: {\n duration: 0.3,\n ease: 'easeInOut',\n type: 'spring',\n },\n }}\n layout\n style={{ display: 'flex', flexWrap: 'wrap', gap: `${size.padding - 2}px` }}\n >\n {images.map(\n (img) =>\n img.url && (\n <motion.div\n key={img.id}\n style={{\n position: 'relative',\n width: `${props.imageSettings.width}px`,\n height: `${props.imageSettings.height}px`,\n userSelect: 'none',\n overflow: 'hidden',\n borderRadius: `${size.radius}px`,\n flexGrow: 1,\n }}\n layout\n transition={{\n layout: {\n duration: 0.3,\n ease: 'easeInOut',\n type: 'spring',\n },\n }}\n >\n <Image\n sxStack={(theme) => ({\n default: {\n width: '100%',\n height: '100%',\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: theme.palette.black10,\n position: 'absolute',\n pointerEvents: 'none',\n },\n })}\n isShowBeforeImage={props.isContain}\n sxImage={{\n default: {\n objectFit: props.isContain ? 'contain' : 'cover',\n },\n }}\n alt={img.name || 'image'}\n src={img.url}\n componentFallback={\n <Typography\n sx={{\n default: {\n variant: 'h6',\n },\n }}\n >\n {props.locale.imageFallback}\n </Typography>\n }\n />\n <Button\n sx={{\n default: {\n position: 'absolute',\n top: 5,\n right: 5,\n },\n }}\n genre={props.genre}\n size='small'\n icons={[\n {\n type: 'id',\n name: 'Close',\n },\n ]}\n isWidthAsHeight\n isHiddenBorder\n isRadius\n onClick={() => handleDelete(img.id)}\n />\n <Button\n sx={{\n default: {\n position: 'absolute',\n bottom: 5,\n right: 5,\n },\n }}\n genre={props.genre}\n size='small'\n icons={[\n {\n type: 'id',\n name: 'Activity',\n },\n ]}\n isWidthAsHeight\n isHiddenBorder\n isRadius\n onClick={() => img.url && handleAdd({ id: img.id, imageSrc: img.url })}\n />\n </motion.div>\n ),\n )}\n {images.length === 0 ? (\n <div\n onClick={openFileDialog}\n key='empty'\n style={{\n position: 'relative',\n width: `${props.imageSettings.width}px`,\n height: `${props.imageSettings.height}px`,\n userSelect: 'none',\n overflow: 'hidden',\n borderRadius: `${size.radius}px`,\n flexGrow: 1,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n textAlign: 'center',\n cursor: 'pointer',\n }}\n >\n <Typography\n style={{\n color: theme.colors.imageSelect[props.genre].color.rest,\n }}\n sx={{\n default: {},\n }}\n >\n {props.locale.dragAndDrop}\n </Typography>\n </div>\n ) : null}\n </motion.div>\n\n <input\n ref={refInput}\n type='file'\n accept={LIST_IMAGE_SUPPORTED_FORMAT_FOR_INPUT}\n multiple\n style={{ display: 'none' }}\n onChange={(e) => {\n if (e.target.files) handleAddFilesCrop(e.target.files);\n }}\n />\n </ImageSelectListWrapper>\n <Stack sx={{ default: { flexGrow: 1, gap: `${size.padding - 2}px` } }}>\n <Button\n type='button'\n genre={props.genre}\n size={props.size}\n sx={{\n default: {\n flexGrow: 3,\n },\n }}\n isRadius\n onClick={openFileDialog}\n >\n {props.locale.buttonAdd}\n </Button>\n <Button\n isRadius\n type='button'\n sx={{\n default: {\n flexGrow: 1,\n },\n }}\n onClick={resetImages}\n genre={props.genre}\n size={props.size}\n >\n {props.locale.buttonReset}\n </Button>\n </Stack>\n </ImageSelectWrapper>\n {props?.error ? (\n <ErrorMessage\n {...props.error}\n size={props?.error.size ?? props.size}\n font={{\n size: 12,\n weight: 400,\n family: theme.font.family,\n }}\n />\n ) : null}\n </>\n );\n};\n","import { Button } from '@local/components/button';\nimport { Image } from '@local/components/image';\nimport { SliderImageProps } from '@local/components/image-slider';\nimport { Stack } from '@local/components/stack';\nimport { Typography } from '@local/components/typography';\nimport { useDialog } from '@local/contexts/context-dialog';\nimport { KEY_SIZE_DATA } from '@local/theme';\n\nimport { useCallback, useMemo } from 'react';\n\nimport { useImageViewProps } from '.';\n\nexport const useImageView = (props: useImageViewProps) => {\n const size = useMemo(() => KEY_SIZE_DATA[props.size], [props.size]);\n const br = useMemo(() => `${size.radius}px`, [size.radius]);\n\n const { add } = useDialog<{\n br?: string;\n }>({\n br: br,\n propsDialog: {\n borderRadius: br,\n padding: '0',\n background: 'whiteStandard',\n },\n });\n const handleAdd = useCallback(\n (image: SliderImageProps) => {\n add({\n content: (params, remove) => (\n <Stack\n sx={{\n default: {\n position: 'relative',\n overflow: 'hidden',\n aspectRatio: `${props.imageSettings.aspect * 2} / 2`,\n width: 'auto',\n maxWidth: '70dvw',\n height: '85dvh',\n borderRadius: params?.br,\n },\n tablet: {\n maxWidth: '95dvw',\n },\n }}\n >\n <Image\n sxStack={(theme) => ({\n default: {\n width: '100%',\n height: '100%',\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: theme.palette.black10,\n position: 'absolute',\n pointerEvents: 'none',\n },\n })}\n isShowBeforeImage\n sxImage={{\n default: {\n objectFit: 'contain',\n },\n }}\n alt={image?.imageSrc}\n src={image?.imageSrc}\n componentFallback={\n <Typography\n sx={{\n default: {\n variant: 'h6',\n },\n }}\n >\n {props.locale.imageFallback}\n </Typography>\n }\n />\n <Button\n sx={{\n default: {\n position: 'absolute',\n bottom: 15,\n right: 15,\n },\n }}\n genre='realebail-white'\n size='small'\n icons={[\n {\n type: 'id',\n name: 'Arrow4',\n },\n ]}\n isWidthAsHeight\n isHiddenBorder\n isRadius\n onClick={() => remove?.()}\n />\n </Stack>\n ),\n });\n },\n [add, props.imageSettings.aspect, props.locale.imageFallback],\n );\n return { handleAdd };\n};\n"],"names":["props","onChange","size","useMemo","KEY_SIZE_DATA","images","setImages","useState","isDraggingOver","setIsDraggingOver","refInput","useRef","theme","useTheme","handleOnSave","useCallback","files","prev","newImages","map","file","idx","index","length","finalImages","openFileDialog","_a","current","click","handleAddFiles","handleAddFilesCrop","useImageCrop","onSave","locale","dialog","button","genre","propsButton","default","buttonDelete","delete","imageSettings","maxSize","maxCount","aspect","handleAdd","br","radius","add","useDialog","propsDialog","borderRadius","padding","background","image","content","params","remove","jsxs","Stack","sx","position","overflow","aspectRatio","width","maxWidth","height","tablet","children","jsx","Image","sxStack","alignItems","justifyContent","backgroundColor","palette","black10","pointerEvents","isShowBeforeImage","sxImage","objectFit","alt","imageSrc","src","componentFallback","Typography","variant","imageFallback","Button","bottom","right","icons","type","name","isWidthAsHeight","isHiddenBorder","isRadius","onClick","useImageView","useEffect","Fragment","ImageSelectWrapper","$genre","$size","id","$sx","$error","error","ImageSelectListWrapper","onDrop","e","preventDefault","dataTransfer","handleDrop","onDragOver","onDragEnter","onDragLeave","animate","borderColor","colors","imageSelect","border","hover","rest","transition","duration","motion","div","layout","ease","style","display","flexWrap","gap","img","url","userSelect","flexGrow","isContain","top","handleDelete","filter","textAlign","cursor","color","dragAndDrop","ref","accept","LIST_IMAGE_SUPPORTED_FORMAT_FOR_INPUT","multiple","target","buttonAdd","defaultImages","buttonReset","ErrorMessage","font","weight","family"],"mappings":"+aAgB4BA,IAC1B,MAAMC,SAAEA,GAAaD,EAEfE,EAAOC,UAAQ,IAAMC,gBAAcJ,EAAME,MAAO,CAACF,EAAME,QAEtDG,EAAQC,GAAaC,EAAAA,SAAiCP,EAAMK,QAAU,KAEtEG,EAAgBC,GAAqBF,EAA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AAM,MAAAF,OAAA,EAAAA,EAAO2G,MAAMzG,OAAQF,EAAME,KACjCyJ,KAAM,CACJzJ,KAAM,GACN0J,OAAQ,IACRC,OAAQjJ,EAAM+I,KAAKE,UAGrB"}
|
|
1
|
+
{"version":3,"file":"component-zLIAB2HV.cjs","sources":["../src/components/image-select/component.tsx","../src/hooks/use-image-view/use.tsx"],"sourcesContent":["import { LIST_IMAGE_SUPPORTED_FORMAT_FOR_INPUT } from '@local/consts';\nimport { useImageCrop } from '@local/hooks/use-image-crop';\nimport { useImageView } from '@local/hooks/use-image-view';\nimport { ErrorMessage } from '@local/styles/error';\nimport { KEY_SIZE_DATA } from '@local/theme';\n\nimport { motion } from 'framer-motion';\nimport { DragEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useTheme } from 'styled-components';\n\nimport { Button } from '../button';\nimport { Image } from '../image';\nimport { Stack } from '../stack';\nimport { Typography } from '../typography';\nimport { ImageSelectItemProps, ImageSelectListWrapper, ImageSelectProps, ImageSelectWrapper } from '.';\n\nexport const ImageSelect = (props: ImageSelectProps) => {\n const { onChange } = props;\n\n const size = useMemo(() => KEY_SIZE_DATA[props.size], [props.size]);\n\n const [images, setImages] = useState<ImageSelectItemProps[]>(props.images || []);\n\n const [isDraggingOver, setIsDraggingOver] = useState(false);\n\n const refInput = useRef<HTMLInputElement | null>(null);\n\n const theme = useTheme();\n\n const handleDrop = (e: DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n if (e.dataTransfer.files?.length) {\n handleAddFilesCrop(e.dataTransfer.files);\n }\n };\n\n const handleDelete = (id: number) => {\n setImages((prev) => {\n const finalImages = prev.filter((img) => img.id !== id);\n onChange?.(finalImages);\n return finalImages;\n });\n };\n\n const handleOnSave = useCallback(\n (files: ImageSelectItemProps[] | null) => {\n if (files) {\n setImages((prev) => {\n const newImages = files.map((file, idx) => ({\n ...file,\n index: prev.length + idx,\n }));\n const finalImages = [...prev, ...newImages];\n onChange?.(finalImages);\n return finalImages;\n });\n }\n },\n [onChange],\n );\n\n const openFileDialog = () => {\n refInput.current?.click();\n };\n\n const resetImages = () => {\n setImages(props.defaultImages || []);\n onChange?.(props.defaultImages || []);\n };\n\n const { handleAddFiles: handleAddFilesCrop } = useImageCrop({\n onSave: handleOnSave,\n locale: props.locale,\n dialog: {\n button: {\n genre: props.propsButton.default.genre,\n size: props.propsButton.default.size,\n },\n buttonDelete: {\n genre: props.propsButton.delete.genre,\n size: props.propsButton.delete.size,\n },\n },\n imageSettings: {\n maxSize: props.imageSettings.maxSize,\n maxCount: props.imageSettings.maxCount - images.length,\n aspect: props.imageSettings.aspect,\n },\n refInput: refInput,\n });\n\n const { handleAdd } = useImageView({\n size: props.size,\n locale: props.locale,\n imageSettings: props.imageSettings,\n genre: props.genre,\n });\n\n useEffect(() => {\n setImages(props.images || []);\n }, [props.images]);\n\n return (\n <>\n <ImageSelectWrapper $genre={props.genre} $size={props.size} id={props.id} $sx={props.sx} $error={props.error}>\n <ImageSelectListWrapper\n onDrop={(e) => {\n handleDrop(e);\n setIsDraggingOver(false);\n }}\n onDragOver={(e) => e.preventDefault()}\n onDragEnter={() => setIsDraggingOver(true)}\n onDragLeave={() => setIsDraggingOver(false)}\n animate={{\n borderColor: isDraggingOver\n ? theme.colors.imageSelect[props.genre].border.hover\n : theme.colors.imageSelect[props.genre].border.rest,\n }}\n transition={{ duration: 0.3 }}\n $genre={props.genre}\n $size={props.size}\n >\n <motion.div\n transition={{\n layout: {\n duration: 0.3,\n ease: 'easeInOut',\n type: 'spring',\n },\n }}\n layout\n style={{ display: 'flex', flexWrap: 'wrap', gap: `${size.padding - 2}px` }}\n >\n {images.map(\n (img) =>\n img.url && (\n <motion.div\n key={img.id}\n style={{\n position: 'relative',\n width: `${props.imageSettings.width}px`,\n height: `${props.imageSettings.height}px`,\n userSelect: 'none',\n overflow: 'hidden',\n borderRadius: `${size.radius}px`,\n flexGrow: 1,\n }}\n layout\n transition={{\n layout: {\n duration: 0.3,\n ease: 'easeInOut',\n type: 'spring',\n },\n }}\n >\n <Image\n sxStack={(theme) => ({\n default: {\n width: '100%',\n height: '100%',\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: theme.palette.black10,\n position: 'absolute',\n pointerEvents: 'none',\n },\n })}\n isShowBeforeImage={props.isContain}\n sxImage={{\n default: {\n objectFit: props.isContain ? 'contain' : 'cover',\n },\n }}\n alt={img.name || 'image'}\n src={img.url}\n componentFallback={\n <Typography\n sx={{\n default: {\n variant: 'h6',\n },\n }}\n >\n {props.locale.imageFallback}\n </Typography>\n }\n />\n <Button\n sx={{\n default: {\n position: 'absolute',\n top: 5,\n right: 5,\n },\n }}\n genre={props.genre}\n size='small'\n icons={[\n {\n type: 'id',\n name: 'Close',\n },\n ]}\n isWidthAsHeight\n isHiddenBorder\n isRadius\n onClick={() => handleDelete(img.id)}\n />\n <Button\n sx={{\n default: {\n position: 'absolute',\n bottom: 5,\n right: 5,\n },\n }}\n genre={props.genre}\n size='small'\n icons={[\n {\n type: 'id',\n name: 'Activity',\n },\n ]}\n isWidthAsHeight\n isHiddenBorder\n isRadius\n onClick={() => img.url && handleAdd({ id: img.id, imageSrc: img.url })}\n />\n </motion.div>\n ),\n )}\n {images.length === 0 ? (\n <div\n onClick={openFileDialog}\n key='empty'\n style={{\n position: 'relative',\n width: `${props.imageSettings.width}px`,\n height: `${props.imageSettings.height}px`,\n userSelect: 'none',\n overflow: 'hidden',\n borderRadius: `${size.radius}px`,\n flexGrow: 1,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n textAlign: 'center',\n cursor: 'pointer',\n }}\n >\n <Typography\n style={{\n color: theme.colors.imageSelect[props.genre].color.rest,\n }}\n sx={{\n default: {},\n }}\n >\n {props.locale.dragAndDrop}\n </Typography>\n </div>\n ) : null}\n </motion.div>\n\n <input\n ref={refInput}\n type='file'\n accept={LIST_IMAGE_SUPPORTED_FORMAT_FOR_INPUT}\n multiple\n style={{ display: 'none' }}\n onChange={(e) => {\n if (e.target.files) handleAddFilesCrop(e.target.files);\n }}\n />\n </ImageSelectListWrapper>\n <Stack sx={{ default: { flexGrow: 1, gap: `${size.padding - 2}px` } }}>\n <Button\n type='button'\n genre={props.genre}\n size={props.size}\n sx={{\n default: {\n flexGrow: 3,\n },\n }}\n isRadius\n onClick={openFileDialog}\n >\n {props.locale.buttonAdd}\n </Button>\n <Button\n isRadius\n type='button'\n sx={{\n default: {\n flexGrow: 1,\n },\n }}\n onClick={resetImages}\n genre={props.genre}\n size={props.size}\n >\n {props.locale.buttonReset}\n </Button>\n </Stack>\n </ImageSelectWrapper>\n {props?.error ? (\n <ErrorMessage\n {...props.error}\n size={props?.error.size ?? props.size}\n font={{\n size: 12,\n weight: 400,\n family: theme.font.family,\n }}\n />\n ) : null}\n </>\n );\n};\n","import { Button } from '@local/components/button';\nimport { Image } from '@local/components/image';\nimport { SliderImageProps } from '@local/components/image-slider';\nimport { Stack } from '@local/components/stack';\nimport { Typography } from '@local/components/typography';\nimport { useDialog, useDialogProps } from '@local/contexts/context-dialog';\nimport { KEY_SIZE_DATA } from '@local/theme';\n\nimport { useCallback, useMemo, useState } from 'react';\n\nimport { useImageViewProps } from '.';\n\nexport const useImageView = (props: useImageViewProps) => {\n const size = useMemo(() => KEY_SIZE_DATA[props.size], [props.size]);\n const br = useMemo(() => `${size.radius}px`, [size.radius]);\n const [image, setImage] = useState<SliderImageProps | null>(null);\n const propsDialog: useDialogProps<{ br?: string; image: SliderImageProps | null }> = useMemo(\n () => ({\n propsCustom: {\n image: image,\n br: br,\n },\n propsDialog: {\n borderRadius: br,\n padding: '0',\n background: 'whiteStandard',\n },\n onRemove() {\n setImage(null);\n },\n content: (remove, _isAnimating, params) => (\n <Stack\n sx={{\n default: {\n position: 'relative',\n overflow: 'hidden',\n aspectRatio: `${props.imageSettings.aspect * 2} / 2`,\n width: 'auto',\n maxWidth: '70dvw',\n height: '85dvh',\n borderRadius: params?.br,\n },\n tablet: {\n maxWidth: '95dvw',\n },\n }}\n >\n {params?.image ? (\n <Image\n sxStack={(theme) => ({\n default: {\n width: '100%',\n height: '100%',\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: theme.palette.black10,\n position: 'absolute',\n pointerEvents: 'none',\n },\n })}\n isShowBeforeImage\n sxImage={{\n default: {\n objectFit: 'contain',\n },\n }}\n alt={params.image.imageSrc}\n src={params.image.imageSrc}\n componentFallback={\n <Typography\n sx={{\n default: {\n variant: 'h6',\n },\n }}\n >\n {props.locale.imageFallback}\n </Typography>\n }\n />\n ) : null}\n <Button\n sx={{\n default: {\n position: 'absolute',\n bottom: 15,\n right: 15,\n },\n }}\n genre='realebail-white'\n size='small'\n icons={[\n {\n type: 'id',\n name: 'Arrow4',\n },\n ]}\n isWidthAsHeight\n isHiddenBorder\n isRadius\n onClick={() => remove?.()}\n />\n </Stack>\n ),\n }),\n [br, props.imageSettings.aspect, props.locale.imageFallback, image],\n );\n const { add } = useDialog<{\n br?: string;\n image: SliderImageProps | null;\n }>(propsDialog);\n const handleAdd = useCallback(\n (image: SliderImageProps) => {\n setImage(image);\n add();\n },\n [add],\n );\n return { handleAdd };\n};\n"],"names":["props","onChange","size","useMemo","KEY_SIZE_DATA","images","setImages","useState","isDraggingOver","setIsDraggingOver","refInput","useRef","theme","useTheme","handleOnSave","useCallback","files","prev","newImages","map","file","idx","index","length","finalImages","openFileDialog","_a","current","click","handleAddFiles","handleAddFilesCrop","useImageCrop","onSave","locale","dialog","button","genre","propsButton","default","buttonDelete","delete","imageSettings","maxSize","maxCount","aspect","handleAdd","br","radius","image","setImage","propsDialog","propsCustom","borderRadius","padding","background","onRemove","content","remove","_isAnimating","params","jsxs","Stack","sx","position","overflow","aspectRatio","width","maxWidth","height","tablet","children","jsx","Image","sxStack","alignItems","justifyContent","backgroundColor","palette","black10","pointerEvents","isShowBeforeImage","sxImage","objectFit","alt","imageSrc","src","componentFallback","Typography","variant","imageFallback","Button","bottom","right","icons","type","name","isWidthAsHeight","isHiddenBorder","isRadius","onClick","add","useDialog","useImageView","useEffect","Fragment","ImageSelectWrapper","$genre","$size","id","$sx","$error","error","ImageSelectListWrapper","onDrop","e","preventDefault","dataTransfer","handleDrop","onDragOver","onDragEnter","onDragLeave","animate","borderColor","colors","imageSelect","border","hover","rest","transition","duration","motion","div","layout","ease","style","display","flexWrap","gap","img","url","userSelect","flexGrow","isContain","top","handleDelete","filter","textAlign","cursor","color","dragAndDrop","ref","accept","LIST_IMAGE_SUPPORTED_FORMAT_FOR_INPUT","multiple","target","buttonAdd","defaultImages","buttonReset","ErrorMessage","font","weight","family"],"mappings":"+aAgB4BA,IAC1B,MAAMC,SAAEA,GAAaD,EAEfE,EAAOC,UAAQ,IAAMC,gBAAcJ,EAAME,MAAO,CAACF,EAAME,QAEtDG,EAAQC,GAAaC,EAAAA,SAAiCP,EAAMK,QAAU,KAEtEG,EAAgBC,GAAqBF,EAAAA,UAAS,GAE/CG,EAAWC,EAAAA,OAAgC,MAE3CC,EAAQC,EAAAA,WAiBRC,EAAeC,EAAAA,YAClBC,IACKA,GACFV,EAAWW,IACT,MAAMC,EAAYF,EAAMG,IAAI,CAACC,EAAMC,KAAA,IAC9BD,EACHE,MAAOL,EAAKM,OAASF,KAEjBG,EAAc,IAAIP,KAASC,GAEjC,OADA,MAAAjB,GAAAA,EAAWuB,GACJA,KAIb,CAACvB,IAGGwB,EAAiB,WACrB,OAAAC,EAAAhB,EAASiB,UAATD,EAAkBE,UAQZC,eAAgBC,GAAuBC,eAAa,CAC1DC,OAAQlB,EACRmB,OAAQjC,EAAMiC,OACdC,OAAQ,CACNC,OAAQ,CACNC,MAAOpC,EAAMqC,YAAYC,QAAQF,MACjClC,KAAMF,EAAMqC,YAAYC,QAAQpC,MAElCqC,aAAc,CACZH,MAAOpC,EAAMqC,YAAYG,OAAOJ,MAChClC,KAAMF,EAAMqC,YAAYG,OAAOtC,OAGnCuC,cAAe,CACbC,QAAS1C,EAAMyC,cAAcC,QAC7BC,SAAU3C,EAAMyC,cAAcE,SAAWtC,EAAOkB,OAChDq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mBoF,EAAEwC,OAAO1I,aAItD4C,EAAAA,kBAAAA,KAACC,EAAAA,MAAA,CAAMC,GAAI,CAAExB,QAAS,CAAEuG,SAAU,EAAGJ,IAAQvI,EAAKmD,QAAU,EAAlB,OACxCiB,SAAA,GAAAC,kBAAAA,IAACmB,EAAAA,OAAA,CACCI,KAAK,SACL1D,MAAOpC,EAAMoC,MACblC,KAAMF,EAAME,KACZ4D,GAAI,CACFxB,QAAS,CACPuG,SAAU,IAGd3C,UAAQ,EACRC,QAAS1E,EAER6C,WAAMrC,OAAO0H,cAEhBpF,kBAAAA,IAACmB,EAAAA,OAAA,CACCQ,UAAQ,EACRJ,KAAK,SACLhC,GAAI,CACFxB,QAAS,CACPuG,SAAU,IAGd1C,QA3OU,KAClB7F,EAAUN,EAAM4J,eAAiB,IACjC,MAAA3J,GAAAA,EAAWD,EAAM4J,eAAiB,KA0O1BxH,MAAOpC,EAAMoC,MACblC,KAAMF,EAAME,KAEXoE,WAAMrC,OAAO4H,qBAInB,MAAA7J,OAAA,EAAAA,EAAO+G,OACNxC,EAAAA,kBAAAA,IAACuF,EAAAA,aAAA,IACK9J,EAAM+G,MACV7G,MAAM,MAAAF,OAAA,EAAAA,EAAO+G,MAAM7G,OAAQF,EAAME,KACjC6J,KAAM,CACJ7J,KAAM,GACN8J,OAAQ,IACRC,OAAQrJ,EAAMmJ,KAAKE,UAGrB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "./jsx-runtime-DZS36FSE.js";
|
|
2
|
-
import { bo as KEY_SIZE_DATA, X as SliderImage, aM as Typography, B as Button, Y as SliderDot, I as Icon } from "./context.constants-
|
|
3
|
-
import { I as Image } from "./component-
|
|
2
|
+
import { bo as KEY_SIZE_DATA, X as SliderImage, aM as Typography, B as Button, Y as SliderDot, I as Icon } from "./context.constants-D0UjboYX.js";
|
|
3
|
+
import { I as Image } from "./component-sNGsB3JK.js";
|
|
4
4
|
import { b as Stack, c as StackMotion } from "./component-gcvwlILJ.js";
|
|
5
5
|
import "styled-components";
|
|
6
|
-
import "./context.constants-
|
|
7
|
-
import { a as useDialog } from "./context.hooks-
|
|
6
|
+
import "./context.constants-DUVlJghM.js";
|
|
7
|
+
import { a as useDialog } from "./context.hooks-v8uZ7dfO.js";
|
|
8
8
|
import { AnimatePresence } from "framer-motion";
|
|
9
9
|
import { useMemo, useState, useCallback, useEffect } from "react";
|
|
10
10
|
const useImageSlider = (props) => {
|
|
@@ -54,31 +54,51 @@ const useImageSlider = (props) => {
|
|
|
54
54
|
useEffect(() => {
|
|
55
55
|
if (activeImageId) onIndexChange == null ? void 0 : onIndexChange(activeImageId);
|
|
56
56
|
}, [activeImageId, onIndexChange]);
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
57
|
+
const propsDialog = useMemo(
|
|
58
|
+
() => ({
|
|
59
|
+
propsCustom: {
|
|
60
|
+
br,
|
|
61
|
+
dragEndHandler,
|
|
62
|
+
images,
|
|
63
|
+
children: props.children,
|
|
64
|
+
activeImageIndex,
|
|
65
|
+
activeImageId,
|
|
66
|
+
swipeToImage,
|
|
67
|
+
skipToImage,
|
|
68
|
+
direction,
|
|
69
|
+
aspect: props.imageSettings.aspect,
|
|
70
|
+
genre: props.genre,
|
|
71
|
+
size: props.size,
|
|
72
|
+
failedToLoad: props.locales.failedToLoad,
|
|
73
|
+
isLengthOne
|
|
74
|
+
},
|
|
75
|
+
propsDialog: {
|
|
76
|
+
borderRadius: br,
|
|
77
|
+
padding: "0",
|
|
78
|
+
background: "whiteStandard"
|
|
79
|
+
},
|
|
80
|
+
content: (remove, _isAnimating, params) => /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentHandleAdd, { params, remove })
|
|
81
|
+
}),
|
|
82
|
+
[
|
|
83
|
+
br,
|
|
84
|
+
images,
|
|
85
|
+
activeImageId,
|
|
86
|
+
activeImageIndex,
|
|
87
|
+
direction,
|
|
88
|
+
dragEndHandler,
|
|
89
|
+
isLengthOne,
|
|
90
|
+
props.children,
|
|
91
|
+
props.genre,
|
|
92
|
+
props.imageSettings.aspect,
|
|
93
|
+
props.locales.failedToLoad,
|
|
94
|
+
props.size,
|
|
95
|
+
skipToImage,
|
|
96
|
+
swipeToImage
|
|
97
|
+
]
|
|
98
|
+
);
|
|
99
|
+
const { add } = useDialog(propsDialog);
|
|
78
100
|
const handleAdd = useCallback(() => {
|
|
79
|
-
add(
|
|
80
|
-
content: (params, remove) => /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentHandleAdd, { params, remove })
|
|
81
|
-
});
|
|
101
|
+
add();
|
|
82
102
|
}, [add]);
|
|
83
103
|
return {
|
|
84
104
|
isLengthZero,
|
|
@@ -734,4 +754,4 @@ export {
|
|
|
734
754
|
ImageSlider as I,
|
|
735
755
|
IMAGES as a
|
|
736
756
|
};
|
|
737
|
-
//# sourceMappingURL=component.constants-
|
|
757
|
+
//# sourceMappingURL=component.constants-CJcoXCFC.js.map
|