@jenesei-software/jenesei-kit-react 1.3.15 → 1.3.17
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-Bopd6mWj.cjs +2 -0
- package/build/area-Bopd6mWj.cjs.map +1 -0
- package/build/{area-DEwj0-O3.js → area-Cvp3eBBo.js} +4 -4
- package/build/area-Cvp3eBBo.js.map +1 -0
- package/build/{area-DphBWq86.cjs → area-DqLK4RX5.cjs} +4 -4
- package/build/{area-DphBWq86.cjs.map → area-DqLK4RX5.cjs.map} +1 -1
- 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/build-info.txt +3 -3
- package/build/{component-DkEqMT7w.cjs → component-5o60aes-.cjs} +2 -2
- package/build/{component-DkEqMT7w.cjs.map → component-5o60aes-.cjs.map} +1 -1
- package/build/{component-CLqcB5mM.cjs → component-6hRanOkU.cjs} +2 -2
- package/build/{component-CLqcB5mM.cjs.map → component-6hRanOkU.cjs.map} +1 -1
- package/build/{component-CPzlyKwR.js → component-B80It4vM.js} +3 -3
- package/build/{component-CPzlyKwR.js.map → component-B80It4vM.js.map} +1 -1
- package/build/component-BfppCwz9.cjs +88 -0
- package/build/component-BfppCwz9.cjs.map +1 -0
- package/build/{component--jGdo2yq.cjs → component-Bj7sLW9s.cjs} +2 -2
- package/build/{component--jGdo2yq.cjs.map → component-Bj7sLW9s.cjs.map} +1 -1
- package/build/{component-BkYIZFlr.cjs → component-BxetIWe6.cjs} +6 -6
- package/build/{component-BkYIZFlr.cjs.map → component-BxetIWe6.cjs.map} +1 -1
- package/build/{component-DaXKDHnc.js → component-CKBpm4U4.js} +3 -3
- package/build/{component-DaXKDHnc.js.map → component-CKBpm4U4.js.map} +1 -1
- package/build/{component-CFKFLOAw.js → component-ClnOIQaN.js} +2 -2
- package/build/{component-CFKFLOAw.js.map → component-ClnOIQaN.js.map} +1 -1
- package/build/component-accordion.cjs.js +1 -1
- package/build/component-accordion.d.ts +5 -19
- package/build/component-accordion.es.js +1 -1
- package/build/{component-B9dFCQcm.cjs → component-b4tMFkpE.cjs} +2 -2
- package/build/{component-B9dFCQcm.cjs.map → component-b4tMFkpE.cjs.map} +1 -1
- package/build/component-button-group.cjs.js +1 -1
- package/build/component-button-group.d.ts +23 -186
- package/build/component-button-group.es.js +1 -1
- package/build/component-button.cjs.js +1 -1
- package/build/component-button.d.ts +26 -206
- package/build/component-button.es.js +4 -6
- package/build/component-checkbox-group.cjs.js +1 -1
- package/build/component-checkbox-group.d.ts +26 -170
- package/build/component-checkbox-group.es.js +1 -1
- package/build/component-checkbox.cjs.js +1 -1
- package/build/component-checkbox.d.ts +26 -193
- package/build/component-checkbox.es.js +2 -3
- package/build/component-date-picker.cjs.js +1 -1
- package/build/component-date-picker.d.ts +27 -190
- package/build/component-date-picker.es.js +1 -1
- package/build/{component-BFOHa1GY.js → component-eqTj4VVc.js} +2 -2
- package/build/{component-BFOHa1GY.js.map → component-eqTj4VVc.js.map} +1 -1
- package/build/component-icon.cjs.js +1 -1
- package/build/component-icon.d.ts +45 -166
- package/build/component-icon.es.js +5 -9
- package/build/component-icon.es.js.map +1 -1
- package/build/component-image-button.cjs.js +1 -1
- package/build/component-image-button.d.ts +23 -186
- package/build/component-image-button.es.js +1 -1
- package/build/component-image-select.cjs.js +1 -1
- package/build/component-image-select.d.ts +23 -186
- package/build/component-image-select.es.js +1 -1
- package/build/component-image-slider.cjs.js +1 -1
- package/build/component-image-slider.es.js +1 -1
- package/build/component-image.cjs.js +1 -1
- package/build/component-input-otp.cjs.js +1 -1
- package/build/component-input-otp.es.js +1 -1
- package/build/component-input.cjs.js +1 -1
- package/build/component-input.d.ts +1 -1
- package/build/component-input.es.js +2 -2
- package/build/{component-CeuA5Ry0.js → component-jPLOz52P.js} +51 -126
- package/build/component-jPLOz52P.js.map +1 -0
- package/build/component-map.cjs.js +1 -1
- package/build/component-map.es.js +1 -1
- package/build/component-pagination.cjs.js +1 -1
- package/build/component-pagination.d.ts +23 -186
- package/build/component-pagination.es.js +1 -1
- package/build/component-range.cjs.js +1 -1
- package/build/component-range.es.js +1 -1
- package/build/component-ripple.cjs.js +1 -1
- package/build/component-select.cjs.js +1 -1
- package/build/component-select.d.ts +2 -17
- 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 +1 -1
- 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.components-JtwTIPAB.cjs → component.components-BZX00SGG.cjs} +2 -2
- package/build/{component.components-JtwTIPAB.cjs.map → component.components-BZX00SGG.cjs.map} +1 -1
- package/build/{component.components-B2-Gqe0K.js → component.components-C9TkSqTp.js} +5 -5
- package/build/{component.components-B2-Gqe0K.js.map → component.components-C9TkSqTp.js.map} +1 -1
- package/build/{component.constants-DxcsPL8D.cjs → component.constants-B-ZMDpFv.cjs} +2 -2
- package/build/{component.constants-DxcsPL8D.cjs.map → component.constants-B-ZMDpFv.cjs.map} +1 -1
- package/build/{component.constants-CpnBclql.js → component.constants-C8li5_tq.js} +2 -2
- package/build/{component.constants-CpnBclql.js.map → component.constants-C8li5_tq.js.map} +1 -1
- package/build/{component.constants-Cwl6tQFq.js → component.constants-CnMky3Ym.js} +8 -8
- package/build/component.constants-CnMky3Ym.js.map +1 -0
- package/build/component.constants-Dg6JcWmd.cjs +22 -0
- package/build/component.constants-Dg6JcWmd.cjs.map +1 -0
- package/build/{component.styles-Dz33wmri.js → component.styles-0apMzB81.js} +9 -31
- package/build/component.styles-0apMzB81.js.map +1 -0
- package/build/{component.styles-BDKsgd6y.js → component.styles-AEJ_tw7Y.js} +5 -5
- package/build/{component.styles-BDKsgd6y.js.map → component.styles-AEJ_tw7Y.js.map} +1 -1
- package/build/{component.styles-BELwxHxh.cjs → component.styles-BO8xaSCQ.cjs} +2 -2
- package/build/{component.styles-BELwxHxh.cjs.map → component.styles-BO8xaSCQ.cjs.map} +1 -1
- package/build/component.styles-BVQQkX5c.cjs +57 -0
- package/build/component.styles-BVQQkX5c.cjs.map +1 -0
- package/build/component.styles-BYG4iVCR.cjs +10 -0
- package/build/{component.styles-CUCjXD3k.cjs.map → component.styles-BYG4iVCR.cjs.map} +1 -1
- package/build/{component.styles-B4ZjkzIF.cjs → component.styles-BZ9QLlOU.cjs} +2 -2
- package/build/{component.styles-B4ZjkzIF.cjs.map → component.styles-BZ9QLlOU.cjs.map} +1 -1
- package/build/component.styles-BviHtzJH.cjs +22 -0
- package/build/component.styles-BviHtzJH.cjs.map +1 -0
- package/build/{component.styles-ZU_GyVub.cjs → component.styles-C8ONgWei.cjs} +2 -2
- package/build/{component.styles-ZU_GyVub.cjs.map → component.styles-C8ONgWei.cjs.map} +1 -1
- package/build/{component.styles-CJC0h3Ed.js → component.styles-CHqowxsZ.js} +5 -5
- package/build/component.styles-CHqowxsZ.js.map +1 -0
- package/build/component.styles-CXyyc0xg.cjs +32 -0
- package/build/{component.styles-Py-IeQ2q.cjs.map → component.styles-CXyyc0xg.cjs.map} +1 -1
- package/build/component.styles-CtZeOnGH.js +120 -0
- package/build/component.styles-CtZeOnGH.js.map +1 -0
- package/build/{component.styles-B9jJFDUk.js → component.styles-CwTYpBx_.js} +6 -6
- package/build/{component.styles-B9jJFDUk.js.map → component.styles-CwTYpBx_.js.map} +1 -1
- package/build/{component.styles-CEDSDKXy.cjs → component.styles-CxlbZwr4.cjs} +2 -2
- package/build/{component.styles-CEDSDKXy.cjs.map → component.styles-CxlbZwr4.cjs.map} +1 -1
- package/build/{component.styles-COwP0J6t.cjs → component.styles-CyCy2ymw.cjs} +2 -2
- package/build/{component.styles-COwP0J6t.cjs.map → component.styles-CyCy2ymw.cjs.map} +1 -1
- package/build/{component.styles-B0FFHGeN.js → component.styles-DWDGLfbF.js} +3 -3
- package/build/{component.styles-B0FFHGeN.js.map → component.styles-DWDGLfbF.js.map} +1 -1
- package/build/{component.styles-BbwS_Ekx.js → component.styles-DqJURuJl.js} +3 -3
- package/build/{component.styles-BbwS_Ekx.js.map → component.styles-DqJURuJl.js.map} +1 -1
- package/build/{component.styles-CsB9986a.cjs → component.styles-FMHm5NHm.cjs} +2 -2
- package/build/{component.styles-CsB9986a.cjs.map → component.styles-FMHm5NHm.cjs.map} +1 -1
- package/build/{component.styles-BeRVOt5T.cjs → component.styles-Hx-MJSWX.cjs} +2 -2
- package/build/{component.styles-BeRVOt5T.cjs.map → component.styles-Hx-MJSWX.cjs.map} +1 -1
- package/build/{component.styles-BGYbrzvh.js → component.styles-KBaixm0o.js} +2 -2
- package/build/{component.styles-BGYbrzvh.js.map → component.styles-KBaixm0o.js.map} +1 -1
- package/build/{component.styles-Czdj4SAF.js → component.styles-SZTM0cRW.js} +7 -7
- package/build/{component.styles-Czdj4SAF.js.map → component.styles-SZTM0cRW.js.map} +1 -1
- package/build/{component.styles-gZHy-64x.cjs → component.styles-_keFf_Qj.cjs} +2 -2
- package/build/{component.styles-gZHy-64x.cjs.map → component.styles-_keFf_Qj.cjs.map} +1 -1
- package/build/{component.styles-VrNFgg1_.js → component.styles-cMafDDpP.js} +3 -3
- package/build/{component.styles-VrNFgg1_.js.map → component.styles-cMafDDpP.js.map} +1 -1
- package/build/{component.styles-CxPmtiIy.js → component.styles-euSUJAiA.js} +3 -3
- package/build/{component.styles-CxPmtiIy.js.map → component.styles-euSUJAiA.js.map} +1 -1
- package/build/{component.types-DaiIANRt.cjs → component.types-B7jDbV2B.cjs} +18 -11
- package/build/component.types-B7jDbV2B.cjs.map +1 -0
- package/build/{component.types-B2YOqKzt.js → component.types-p7CYQCe5.js} +20 -10
- package/build/component.types-p7CYQCe5.js.map +1 -0
- package/build/context-app.cjs.js +1 -1
- package/build/context-app.es.js +1 -1
- package/build/context-sonner.cjs.js +1 -1
- package/build/context-sonner.d.ts +71 -100
- package/build/context-sonner.es.js +1 -1
- package/build/{context.constants-C4xdihsb.js → context.constants-Cio0nsYA.js} +7 -6
- package/build/context.constants-Cio0nsYA.js.map +1 -0
- package/build/{context.constants-D0P7bVk9.cjs → context.constants-y9s5VGN2.cjs} +4 -3
- package/build/context.constants-y9s5VGN2.cjs.map +1 -0
- package/build/{context.hooks-Cmgo0uqV.js → context.hooks-BIIK-2HN.js} +3 -3
- package/build/{context.hooks-Cmgo0uqV.js.map → context.hooks-BIIK-2HN.js.map} +1 -1
- package/build/{context.hooks-XBiTuVyt.cjs → context.hooks-DNnrgKb0.cjs} +3 -3
- package/build/{context.hooks-XBiTuVyt.cjs.map → context.hooks-DNnrgKb0.cjs.map} +1 -1
- package/build/{floating-ui.react--v70Xky9.cjs → floating-ui.react-DZzvtpim.cjs} +2 -2
- package/build/{floating-ui.react--v70Xky9.cjs.map → floating-ui.react-DZzvtpim.cjs.map} +1 -1
- package/build/index.cjs.js +1 -1
- package/build/index.d.ts +97 -256
- package/build/index.es.js +140 -141
- package/build/index.es.js.map +1 -1
- package/build/{style-uVTmdhsH.js → style-BzxSHZDV.js} +2 -2
- package/build/{style-uVTmdhsH.js.map → style-BzxSHZDV.js.map} +1 -1
- package/build/{style-D3Lbn1EL.cjs → style-D8DUzG0C.cjs} +2 -2
- package/build/{style-D3Lbn1EL.cjs.map → style-D8DUzG0C.cjs.map} +1 -1
- 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.d.ts +29 -0
- package/build/style-theme.es.js +8 -2
- package/build/{theme.global-BgERDJ4e.js → theme.global-BzunMIsv.js} +132 -2
- package/build/theme.global-BzunMIsv.js.map +1 -0
- package/build/theme.global-D67h5YeA.cjs +173 -0
- package/build/theme.global-D67h5YeA.cjs.map +1 -0
- package/build/{use-DWNgOa9w.cjs → use-BLwltPMc.cjs} +2 -2
- package/build/{use-DWNgOa9w.cjs.map → use-BLwltPMc.cjs.map} +1 -1
- package/build/{use-CuHzkWqv.js → use-CnGHh8iL.js} +5 -5
- package/build/{use-CuHzkWqv.js.map → use-CnGHh8iL.js.map} +1 -1
- package/package.json +1 -1
- package/build/area-CZkDIeGx.cjs +0 -2
- package/build/area-CZkDIeGx.cjs.map +0 -1
- package/build/area-DEwj0-O3.js.map +0 -1
- package/build/component-BLWcOf3A.cjs +0 -90
- package/build/component-BLWcOf3A.cjs.map +0 -1
- package/build/component-CeuA5Ry0.js.map +0 -1
- package/build/component.constants-Cwl6tQFq.js.map +0 -1
- package/build/component.constants-D15Kt1bW.cjs +0 -22
- package/build/component.constants-D15Kt1bW.cjs.map +0 -1
- package/build/component.styles-BKnUDWqO.cjs +0 -22
- package/build/component.styles-BKnUDWqO.cjs.map +0 -1
- package/build/component.styles-CJC0h3Ed.js.map +0 -1
- package/build/component.styles-CUCjXD3k.cjs +0 -10
- package/build/component.styles-DS0ofW1Y.js +0 -2193
- package/build/component.styles-DS0ofW1Y.js.map +0 -1
- package/build/component.styles-DhXp_cmE.cjs +0 -73
- package/build/component.styles-DhXp_cmE.cjs.map +0 -1
- package/build/component.styles-Dz33wmri.js.map +0 -1
- package/build/component.styles-Py-IeQ2q.cjs +0 -32
- package/build/component.types-B2YOqKzt.js.map +0 -1
- package/build/component.types-BBQ18Npa.js +0 -143
- package/build/component.types-BBQ18Npa.js.map +0 -1
- package/build/component.types-DaiIANRt.cjs.map +0 -1
- package/build/component.types-DraGq1j_.cjs +0 -2
- package/build/component.types-DraGq1j_.cjs.map +0 -1
- package/build/context.constants-C4xdihsb.js.map +0 -1
- package/build/context.constants-D0P7bVk9.cjs.map +0 -1
- package/build/theme.global-BgERDJ4e.js.map +0 -1
- package/build/theme.global-CcoD5bPP.cjs +0 -173
- package/build/theme.global-CcoD5bPP.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.styles-0apMzB81.js","sources":["../src/components/checkbox/component.tsx","../src/components/checkbox/component.styles.ts"],"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 size: props.font?.size ?? KEY_SIZE_DATA[props.size].font,\n weight: props.font?.weight ?? 700,\n family: props.font?.family ?? theme.font.family,\n height: props.font?.height,\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","import { addSXTypography } from '@local/components/typography';\nimport { addDisabled, addFont, addOutline, addTransition } from '@local/styles/add';\nimport { addError } from '@local/styles/error';\nimport { addSX } from '@local/styles/sx';\nimport { IThemeSizePropertyDefault, KEY_SIZE_DATA } from '@local/theme';\n\nimport styled, { css } from 'styled-components';\n\nimport { addRippleDefault } from '../ripple';\nimport { StyledCheckboxProps } from '.';\n\n/****************************************** Size *************************************************/\nexport const CheckboxSize = css<StyledCheckboxProps>`\n ${(props) => CheckboxSizeConstructor({ ...KEY_SIZE_DATA[props.$size], isWidthAsHeight: props.$isWidthAsHeight })};\n`;\nexport const CheckboxSizeConstructor = (\n props: IThemeSizePropertyDefault & {\n isWidthAsHeight?: boolean;\n },\n) => css`\n height: ${props.height}px;\n min-height: ${props.height}px;\n border-radius: ${props.radius}px;\n gap: ${props.padding - 2}px;\n padding: ${props.padding - 4}px;\n ${\n props.isWidthAsHeight &&\n css`\n width: ${props.height}px;\n min-width: ${props.height}px;\n padding: 0px;\n `\n };\n`;\n\n/****************************************** Genre *************************************************/\nexport const CheckboxGenre = css<StyledCheckboxProps>`\n ${(props) => css`\n background: ${props.theme.colors.checkbox[props.$genre].background.rest};\n border-color: ${props.theme.colors.checkbox[props.$genre].border.rest};\n color: ${props.theme.colors.checkbox[props.$genre].color.rest};\n &:hover {\n background: ${props.theme.colors.checkbox[props.$genre].background.hover};\n border-color: ${props.theme.colors.checkbox[props.$genre].border.hover};\n color: ${props.theme.colors.checkbox[props.$genre].color.hover};\n }\n `};\n`;\n\n/****************************************** Disabled *************************************************/\nconst addCheckboxDisabled = css<StyledCheckboxProps>`\n ${addDisabled};\n ${(props) =>\n props.$isDisabled\n ? css`\n background: ${props.theme.colors.checkbox[props.$genre].background.rest} !important;\n border-color: ${props.theme.colors.checkbox[props.$genre].border.rest} !important;\n color: ${props.theme.colors.checkbox[props.$genre].color.rest} !important;\n `\n : ''}\n`;\n\n/****************************************** HiddenBorder *************************************************/\nconst CheckboxHiddenBorder = css<StyledCheckboxProps>`\n ${(props) =>\n props.$isHiddenBorder &&\n css`\n border-color: transparent !important;\n `}\n`;\n\n/****************************************** Default *************************************************/\nexport const CheckboxWrapper = styled.button<StyledCheckboxProps>`\n display: flex;\n align-items: center;\n justify-content: flex-start;\n border: 1px solid transparent;\n user-select: none;\n cursor: pointer;\n background-color: ${(props) => props.$isNotBackground && 'transparent'};\n\n ${addRippleDefault};\n ${addTransition};\n ${CheckboxGenre};\n ${CheckboxHiddenBorder};\n ${CheckboxSize};\n ${addCheckboxDisabled}\n ${addOutline};\n ${addFont};\n ${addError};\n ${addSXTypography};\n ${addSX};\n`;\n"],"names":["_a","jsxs","Fragment","jsx"],"mappings":";;;;;;;;;;;AAUO,MAAM,WAA8B,CAAC,UAAU;;AACpD,QAAM,gBAAgB;AAAA,IACpB,CAAC,YAAqB;;AACpB,OAAAA,MAAA,MAAM,aAAN,gBAAAA,IAAA,YAAiB;AAAA,IAAO;AAAA,IAE1B,CAAC,MAAM,QAAQ;AAAA,EAAA;AAEjB,QAAM,QAAQ,SAAA;AACd,QAAM,WAAW;AAAA,IACf,MACEC,kCAAAA,KAAAC,4BAAA,EACE,UAAA;AAAA,MAAAC,kCAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACE,GAAI,MAAM,UAAU,MAAM,KAAK,OAAO,MAAM,KAAK;AAAA,UAClD,OAAO,MAAM,UAAU,MAAM,KAAK,OAAO,MAAM,KAAK,OAAO,QAAQ,MAAM;AAAA,QAAA;AAAA,MAAA;AAAA,MAE1E,MAAM,YAAY,MAAM;AAAA,IAAA,GAC3B;AAAA,IAEF,CAAC,MAAM,SAAS,MAAM,UAAU,MAAM,MAAM,MAAM,IAAI;AAAA,EAAA;AAExD,QAAM,yDAAoB,MAAA,EAAK,MAAM,MAAM,MAAM,MAAK,WAAU,MAAK,OAAA,CAAO;AAE5E,SACEF,kCAAAA,KAAAC,4BAA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,OAAO,IAAI;AAAA,mBAC5D,MAAM,MAAM,OAAO,SAAS,MAAM,MAAM,EAAE,MAAM,IAAI;AAAA,YAE/D,EAAE;AAAA;AAIV,MAAM,uBAAuB;AAAA,IACzB,CAAC,UACD,MAAM,mBACN;AAAA;AAAA,KAEC;AAAA;AAIE,MAAM,kBAAkB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAOhB,CAAC,UAAU,MAAM,oBAAoB,aAAa;AAAA;AAAA,IAEpE,gBAAgB;AAAA,IAChB,aAAa;AAAA,IACb,aAAa;AAAA,IACb,oBAAoB;AAAA,IACpB,YAAY;AAAA,IACZ,mBAAmB;AAAA,IACnB,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,eAAe;AAAA,IACf,KAAK;AAAA;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "./jsx-runtime-BrDlu8eK.js";
|
|
2
|
-
import { b as ErrorMessage } from "./style-
|
|
2
|
+
import { b as ErrorMessage } from "./style-BzxSHZDV.js";
|
|
3
3
|
import { useState, useRef, useCallback } from "react";
|
|
4
|
-
import { I as Input } from "./component-
|
|
5
|
-
import "./component.styles-
|
|
4
|
+
import { I as Input } from "./component-CKBpm4U4.js";
|
|
5
|
+
import "./component.styles-DqJURuJl.js";
|
|
6
6
|
import styled, { css } from "styled-components";
|
|
7
7
|
import { a as addSX } from "./style-plT9Ah7t.js";
|
|
8
|
-
import { K as KEY_SIZE_DATA } from "./theme.global-
|
|
8
|
+
import { K as KEY_SIZE_DATA } from "./theme.global-BzunMIsv.js";
|
|
9
9
|
const InputOTP = (props) => {
|
|
10
10
|
var _a;
|
|
11
11
|
const [otp, setOtp] = useState(new Array(props.length).fill(""));
|
|
@@ -188,4 +188,4 @@ export {
|
|
|
188
188
|
InputOTPSizeConstructor as b,
|
|
189
189
|
InputOTPWrapper as c
|
|
190
190
|
};
|
|
191
|
-
//# sourceMappingURL=component.styles-
|
|
191
|
+
//# sourceMappingURL=component.styles-AEJ_tw7Y.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.styles-BDKsgd6y.js","sources":["../src/components/input-otp/component.tsx","../src/components/input-otp/component.styles.ts"],"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","import styled, { css } from 'styled-components';\n\nimport { addSX } from '@local/styles/sx';\nimport { IThemeSizePropertyDefault, KEY_SIZE_DATA } from '@local/theme';\n\nimport { InputOTPWrapperProps } from '.';\n\n/****************************************** Size *************************************************/\nexport const InputOTPSize = css<InputOTPWrapperProps>`\n ${(props) => InputOTPSizeConstructor({ ...KEY_SIZE_DATA[props.$size], ...props })};\n`;\nexport const InputOTPSizeConstructor = (props: IThemeSizePropertyDefault & InputOTPWrapperProps) => css`\n gap: ${props.padding - 2}px;\n width: 100%;\n`;\n\nexport const InputOTPWrapper = styled.div<InputOTPWrapperProps>`\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n ${InputOTPSize};\n ${addSX};\n`;\n"],"names":["_a","_b","jsxs","Fragment","jsx"],"mappings":";;;;;;;;AAOO,MAAM,WAAW,CAAC,UAAyB;;AAChD,QAAM,CAAC,KAAK,MAAM,IAAI,SAAmB,IAAI,MAAM,MAAM,MAAM,EAAE,KAAK,EAAE,CAAC;AACzE,QAAM,YAAY,OAAoC,EAAE;AACxD,QAAM,aAAa,OAA8B,IAAI;AAErD,QAAM,cAAc;AAAA,IAClB,CAAC,OAAe,MAAwC;AACtD,QAAE,eAAA;AAEF,YAAM,YAAY,EAAE,cAAc,QAAQ,MAAM;AAChD,YAAM,SAAS,UAAU,QAAQ,OAAO,EAAE,EAAE,MAAM,EAAE;AAEpD,UAAI,CAAC,OAAO,OAAQ;AAEpB,aAAO,CAAC,YAAY;;AAClB,cAAM,SAAS,CAAC,GAAG,OAAO;AAC1B,YAAI,eAAe;A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O,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;AC/KO,MAAM,eAAe;AAAA,IACxB,CAAC,UAAU,wBAAwB,EAAE,GAAG,cAAc,MAAM,KAAK,GAAG,GAAG,MAAA,CAAO,CAAC;AAAA;AAE5E,MAAM,0BAA0B,CAAC,UAA4D;AAAA,SAC3F,MAAM,UAAU,CAAC;AAAA;AAAA;AAInB,MAAM,kBAAkB,OAAO;AAAA;AAAA;AAAA;AAAA,IAIlC,YAAY;AAAA,IACZ,KAAK;AAAA;"}
|
|
1
|
+
{"version":3,"file":"component.styles-AEJ_tw7Y.js","sources":["../src/components/input-otp/component.tsx","../src/components/input-otp/component.styles.ts"],"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","import styled, { css } from 'styled-components';\n\nimport { addSX } from '@local/styles/sx';\nimport { IThemeSizePropertyDefault, KEY_SIZE_DATA } from '@local/theme';\n\nimport { InputOTPWrapperProps } from '.';\n\n/****************************************** Size *************************************************/\nexport const InputOTPSize = css<InputOTPWrapperProps>`\n ${(props) => InputOTPSizeConstructor({ ...KEY_SIZE_DATA[props.$size], ...props })};\n`;\nexport const InputOTPSizeConstructor = (props: IThemeSizePropertyDefault & InputOTPWrapperProps) => css`\n gap: ${props.padding - 2}px;\n width: 100%;\n`;\n\nexport const InputOTPWrapper = styled.div<InputOTPWrapperProps>`\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n ${InputOTPSize};\n ${addSX};\n`;\n"],"names":["_a","_b","jsxs","Fragment","jsx"],"mappings":";;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;AAAA,YAClB,KAAK,CAAC,OAAO;AACX,wBAAU,QAAQ,KAAK,IAAI;AAAA,YAAA;AAAA,YAE7B,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;AC/KO,MAAM,eAAe;AAAA,IACxB,CAAC,UAAU,wBAAwB,EAAE,GAAG,cAAc,MAAM,KAAK,GAAG,GAAG,MAAA,CAAO,CAAC;AAAA;AAE5E,MAAM,0BAA0B,CAAC,UAA4D;AAAA,SAC3F,MAAM,UAAU,CAAC;AAAA;AAAA;AAInB,MAAM,kBAAkB,OAAO;AAAA;AAAA;AAAA;AAAA,IAIlC,YAAY;AAAA,IACZ,KAAK;AAAA;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("./jsx-runtime-BcGej2Kr.cjs"),r=require("./theme.global-
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BcGej2Kr.cjs"),r=require("./theme.global-D67h5YeA.cjs"),o=require("react"),t=require("./style-Df37KnoJ.cjs"),s=require("./style-D8DUzG0C.cjs"),i=require("framer-motion"),n=require("styled-components"),a=n.css`
|
|
2
2
|
${e=>n.css`
|
|
3
3
|
height: ${r.KEY_SIZE_DATA_TOGGLE[e.$size].height}px;
|
|
4
4
|
width: ${r.KEY_SIZE_DATA_TOGGLE[e.$size].width}px;
|
|
@@ -62,4 +62,4 @@
|
|
|
62
62
|
}
|
|
63
63
|
`}
|
|
64
64
|
`;exports.Toggle=t=>{const s=o.useMemo(()=>({tap:{width:r.KEY_SIZE_DATA_TOGGLE[t.size].thumb+4,translateX:t.value?r.KEY_SIZE_DATA_TOGGLE[t.size].width-r.KEY_SIZE_DATA_TOGGLE[t.size].thumb-3*r.KEY_SIZE_DATA_TOGGLE[t.size].padding-4:0,transition:{duration:.05}},checked:{translateX:r.KEY_SIZE_DATA_TOGGLE[t.size].width-r.KEY_SIZE_DATA_TOGGLE[t.size].thumb-3*r.KEY_SIZE_DATA_TOGGLE[t.size].padding,transition:{ease:"circInOut",duration:.05}},unchecked:{translateX:0,transition:{ease:"circInOut",duration:.05}}}),[t.size,t.value]);return e.jsxRuntimeExports.jsx(c,{$genre:t.genre,$isDisabled:t.isDisabled,$isDisabledOutline:t.isDisabled??t.isDisabledOutline,$isOutlineBoxShadow:t.isOutlineBoxShadow,$isReadOnly:t.isReadOnly,$value:t.value,$size:t.size,$error:t.error,tabIndex:0,onClick:()=>{var e;return null==(e=t.onChange)?void 0:e.call(t,!t.value)},whileTap:"tap",animate:t.value?"checked":"unchecked",onKeyDown:e=>{var r;"Enter"===e.key&&(null==(r=t.onChange)||r.call(t,!t.value))},children:e.jsxRuntimeExports.jsx(d,{variants:s,$genre:t.genre,$isDisabled:t.isDisabled,$value:t.value,$size:t.size,$error:t.error})})},exports.ToggleCenter=d,exports.ToggleWrapper=c;
|
|
65
|
-
//# sourceMappingURL=component.styles-
|
|
65
|
+
//# sourceMappingURL=component.styles-BO8xaSCQ.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.styles-
|
|
1
|
+
{"version":3,"file":"component.styles-BO8xaSCQ.cjs","sources":["../src/components/toggle/component.styles.ts","../src/components/toggle/component.tsx"],"sourcesContent":["import { addDisabled, addOutline, addTransition } from '@local/styles/add';\nimport { addError } from '@local/styles/error';\nimport { KEY_SIZE_DATA_TOGGLE } from '@local/theme';\n\nimport { motion } from 'framer-motion';\nimport styled, { css } from 'styled-components';\n\nimport { StyledToggleProps } from '.';\n\n/****************************************** Add *************************************************/\nconst addToggleWrapperSize = css<StyledToggleProps>`\n ${(props) => css`\n height: ${KEY_SIZE_DATA_TOGGLE[props.$size].height}px;\n width: ${KEY_SIZE_DATA_TOGGLE[props.$size].width}px;\n padding: ${KEY_SIZE_DATA_TOGGLE[props.$size].padding}px;\n border-radius: 100px;\n `};\n`;\n\nconst addToggleCenterSize = css<StyledToggleProps>`\n ${(props) => css`\n height: ${KEY_SIZE_DATA_TOGGLE[props.$size].thumb}px;\n width: ${KEY_SIZE_DATA_TOGGLE[props.$size].thumb}px;\n border-radius: 100px;\n `}\n`;\n/****************************************** Standard *************************************************/\nexport const ToggleWrapper = styled(motion.div)<StyledToggleProps>`\n cursor: pointer;\n border: 1px solid transparent;\n\n display: flex;\n align-items: center;\n\n ${addToggleWrapperSize};\n ${addTransition};\n ${addOutline};\n ${addDisabled};\n\n ${(props) =>\n props.$value\n ? css`\n background: ${props.theme.colors.toggle[props.$genre].active.rest.track};\n border-color: ${props.theme.colors.toggle[props.$genre].active.rest.border};\n justify-content: flex-start;\n &:hover {\n background: ${props.theme.colors.toggle[props.$genre].active.hover.track};\n border-color: ${props.theme.colors.toggle[props.$genre].active.hover.border};\n }\n `\n : css`\n background: ${props.theme.colors.toggle[props.$genre].unActive.rest.track};\n border-color: ${props.theme.colors.toggle[props.$genre].unActive.rest.border};\n justify-content: flex-start;\n &:hover {\n background: ${props.theme.colors.toggle[props.$genre].unActive.hover.track};\n border-color: ${props.theme.colors.toggle[props.$genre].unActive.hover.border};\n }\n `};\n\n ${addError};\n`;\n\nexport const ToggleCenter = styled(motion.div)<StyledToggleProps>`\n ${addToggleCenterSize};\n ${addTransition};\n\n ${(props) =>\n props.$value\n ? css`\n background: ${props.theme.colors.toggle[props.$genre].active.rest.thumb};\n box-shadow: ${props.theme.colors.toggle[props.$genre].active.rest.thumbBoxShadow};\n &:hover {\n background: ${props.theme.colors.toggle[props.$genre].active.hover.thumb};\n box-shadow: ${props.theme.colors.toggle[props.$genre].active.hover.thumbBoxShadow};\n }\n `\n : css`\n background: ${props.theme.colors.toggle[props.$genre].unActive.rest.thumb};\n box-shadow: ${props.theme.colors.toggle[props.$genre].unActive.rest.thumbBoxShadow};\n &:hover {\n background: ${props.theme.colors.toggle[props.$genre].unActive.hover.thumb};\n box-shadow: ${props.theme.colors.toggle[props.$genre].unActive.hover.thumbBoxShadow};\n }\n `}\n`;\n","import { KEY_SIZE_DATA_TOGGLE } from '@local/theme';\n\nimport { useMemo } from 'react';\n\nimport { ToggleCenter, ToggleProps, ToggleWrapper } from '.';\n\nexport const Toggle = (props: ToggleProps) => {\n const toggleVariants = useMemo(\n () => ({\n tap: {\n width: KEY_SIZE_DATA_TOGGLE[props.size].thumb + 4,\n translateX: props.value\n ? KEY_SIZE_DATA_TOGGLE[props.size].width -\n KEY_SIZE_DATA_TOGGLE[props.size].thumb -\n KEY_SIZE_DATA_TOGGLE[props.size].padding * 3 -\n 4\n : 0,\n transition: {\n duration: 0.05,\n },\n },\n checked: {\n translateX:\n KEY_SIZE_DATA_TOGGLE[props.size].width -\n KEY_SIZE_DATA_TOGGLE[props.size].thumb -\n KEY_SIZE_DATA_TOGGLE[props.size].padding * 3,\n transition: { ease: 'circInOut', duration: 0.05 },\n },\n unchecked: {\n translateX: 0,\n transition: { ease: 'circInOut', duration: 0.05 },\n },\n }),\n [props.size, props.value],\n );\n\n return (\n <ToggleWrapper\n $genre={props.genre}\n $isDisabled={props.isDisabled}\n $isDisabledOutline={props.isDisabled ?? props.isDisabledOutline}\n $isOutlineBoxShadow={props.isOutlineBoxShadow}\n $isReadOnly={props.isReadOnly}\n $value={props.value}\n $size={props.size}\n $error={props.error}\n tabIndex={0}\n onClick={() => props.onChange?.(!props.value)}\n whileTap='tap'\n animate={props.value ? 'checked' : 'unchecked'}\n onKeyDown={(e) => {\n if (e.key === 'Enter') props.onChange?.(!props.value);\n }}\n >\n <ToggleCenter\n variants={toggleVariants}\n $genre={props.genre}\n $isDisabled={props.isDisabled}\n $value={props.value}\n $size={props.size}\n $error={props.error}\n />\n </ToggleWrapper>\n );\n};\n"],"names":["addToggleWrapperSize","css","props","KEY_SIZE_DATA_TOGGLE","$size","height","width","padding","addToggleCenterSize","thumb","ToggleWrapper","styled","motion","div","addTransition","addOutline","addDisabled","$value","theme","colors","toggle","$genre","active","rest","track","border","hover","unActive","addError","ToggleCenter","thumbBoxShadow","toggleVariants","useMemo","tap","size","translateX","value","transition","duration","checked","ease","unchecked","jsx","genre","$isDisabled","isDisabled","$isDisabledOutline","isDisabledOutline","$isOutlineBoxShadow","isOutlineBoxShadow","$isReadOnly","isReadOnly","$error","error","tabIndex","onClick","_a","onChange","call","whileTap","animate","onKeyDown","e","key","children","variants"],"mappings":"qPAUMA,EAAuBC,EAAAA,GAAAA;IACxBC,GAAUD,EAAAA,GAAAA;cACDE,uBAAqBD,EAAME,OAAOC;aACnCF,uBAAqBD,EAAME,OAAOE;eAChCH,uBAAqBD,EAAME,OAAOG;;;EAK3CC,EAAsBP,EAAAA,GAAAA;IACvBC,GAAUD,EAAAA,GAAAA;YACHE,uBAAqBD,EAAME,OAAOK;WACnCN,uBAAqBD,EAAME,OAAOK;;;EAKhCC,EAAgBC,EAAOC,EAAAA,OAAOC,IAAG;;;;;;;IAO1Cb;IACAc;IACAC;IACAC;;IAECd,GACDA,EAAMe,OACFhB,EAAAA,GAAAA;wBACgBC,EAAMgB,MAAMC,OAAOC,OAAOlB,EAAMmB,QAAQC,OAAOC,KAAKC;0BAClDtB,EAAMgB,MAAMC,OAAOC,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
|
1
|
+
"use strict";const e=require("./jsx-runtime-BcGej2Kr.cjs"),r=require("./style-D8DUzG0C.cjs"),s=require("./theme.global-D67h5YeA.cjs"),o=require("react"),i=require("styled-components"),t=require("./component.styles-BviHtzJH.cjs"),n=require("./component.styles-Dpg-__rn.cjs"),c=require("./component-6hRanOkU.cjs"),d=require("./component-BxetIWe6.cjs"),l=require("./style-Df37KnoJ.cjs"),a=require("./style-fRZ6xrVp.cjs"),h=i.css`
|
|
2
|
+
${e=>x({...s.KEY_SIZE_DATA[e.$size],isWidthAsHeight:e.$isWidthAsHeight})};
|
|
3
|
+
`,x=e=>i.css`
|
|
4
|
+
height: ${e.height}px;
|
|
5
|
+
min-height: ${e.height}px;
|
|
6
|
+
border-radius: ${e.radius}px;
|
|
7
|
+
gap: ${e.padding-2}px;
|
|
8
|
+
padding: ${e.padding-4}px;
|
|
9
|
+
${e.isWidthAsHeight&&i.css`
|
|
10
|
+
width: ${e.height}px;
|
|
11
|
+
min-width: ${e.height}px;
|
|
12
|
+
padding: 0px;
|
|
13
|
+
`};
|
|
14
|
+
`,u=i.css`
|
|
15
|
+
${e=>i.css`
|
|
16
|
+
background: ${e.theme.colors.checkbox[e.$genre].background.rest};
|
|
17
|
+
border-color: ${e.theme.colors.checkbox[e.$genre].border.rest};
|
|
18
|
+
color: ${e.theme.colors.checkbox[e.$genre].color.rest};
|
|
19
|
+
&:hover {
|
|
20
|
+
background: ${e.theme.colors.checkbox[e.$genre].background.hover};
|
|
21
|
+
border-color: ${e.theme.colors.checkbox[e.$genre].border.hover};
|
|
22
|
+
color: ${e.theme.colors.checkbox[e.$genre].color.hover};
|
|
23
|
+
}
|
|
24
|
+
`};
|
|
25
|
+
`,$=i.css`
|
|
26
|
+
${l.addDisabled};
|
|
27
|
+
${e=>e.$isDisabled?i.css`
|
|
28
|
+
background: ${e.theme.colors.checkbox[e.$genre].background.rest} !important;
|
|
29
|
+
border-color: ${e.theme.colors.checkbox[e.$genre].border.rest} !important;
|
|
30
|
+
color: ${e.theme.colors.checkbox[e.$genre].color.rest} !important;
|
|
31
|
+
`:""}
|
|
32
|
+
`,p=i.css`
|
|
33
|
+
${e=>e.$isHiddenBorder&&i.css`
|
|
34
|
+
border-color: transparent !important;
|
|
35
|
+
`}
|
|
36
|
+
`,g=i.button`
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: flex-start;
|
|
40
|
+
border: 1px solid transparent;
|
|
41
|
+
user-select: none;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
background-color: ${e=>e.$isNotBackground&&"transparent"};
|
|
44
|
+
|
|
45
|
+
${n.addRippleDefault};
|
|
46
|
+
${l.addTransition};
|
|
47
|
+
${u};
|
|
48
|
+
${p};
|
|
49
|
+
${h};
|
|
50
|
+
${$}
|
|
51
|
+
${l.addOutline};
|
|
52
|
+
${l.addFont};
|
|
53
|
+
${r.addError};
|
|
54
|
+
${d.addSXTypography};
|
|
55
|
+
${a.addSX};
|
|
56
|
+
`;exports.Checkbox=n=>{var d,l,a,h,x;const u=o.useCallback(e=>{var r;null==(r=n.onChange)||r.call(n,e)},[n.onChange]),$=i.useTheme(),p=o.useMemo(()=>e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(t.Icon,{...n.checked?n.view.true:n.view.false,size:(n.checked?n.view.true:n.view.false).size??n.size}),n.children&&n.children]}),[n.checked,n.children,n.size,n.view]),b=e.jsxRuntimeExports.jsx(t.Icon,{size:n.size,type:"loading",name:"Line"});return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(g,{type:"button",$genre:n.genre,$error:n.error,$view:n.view,$font:{size:(null==(d=n.font)?void 0:d.size)??s.KEY_SIZE_DATA[n.size].font,weight:(null==(l=n.font)?void 0:l.weight)??700,family:(null==(a=n.font)?void 0:a.family)??$.font.family,height:null==(h=n.font)?void 0:h.height},$checked:n.checked,$isWidthAsHeight:n.isWidthAsHeight,$size:n.size,$isDisabled:n.isDisabled,$isHiddenBorder:n.isHiddenBorder,$isNotBackground:n.isNotBackground,$sx:n.sx,$sxTypography:n.sxTypography,$isDisabledOutline:n.isDisabled??n.isDisabledOutline,$isOutlineBoxShadow:n.isOutlineBoxShadow,$isReadOnly:n.isReadOnly,disabled:n.isDisabled,tabIndex:0,onClick:()=>!n.isDisabled&&u(!n.checked),children:[e.jsxRuntimeExports.jsx(c.Ripple,{color:$.colors.checkbox[n.genre].color.rest,isDisabled:n.isDisabled}),n.isOnlyLoading?n.isLoading?b:p:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[p,n.isLoading&&b]})]}),(null==n?void 0:n.error)?e.jsxRuntimeExports.jsx(r.ErrorMessage,{...n.error,size:(null==n?void 0:n.error.size)??n.size,font:{size:12,weight:400,family:(null==(x=n.font)?void 0:x.family)??$.font.family}}):null]})},exports.CheckboxGenre=u,exports.CheckboxSize=h,exports.CheckboxSizeConstructor=x,exports.CheckboxWrapper=g;
|
|
57
|
+
//# sourceMappingURL=component.styles-BVQQkX5c.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.styles-BVQQkX5c.cjs","sources":["../src/components/checkbox/component.styles.ts","../src/components/checkbox/component.tsx"],"sourcesContent":["import { addSXTypography } from '@local/components/typography';\nimport { addDisabled, addFont, addOutline, addTransition } from '@local/styles/add';\nimport { addError } from '@local/styles/error';\nimport { addSX } from '@local/styles/sx';\nimport { IThemeSizePropertyDefault, KEY_SIZE_DATA } from '@local/theme';\n\nimport styled, { css } from 'styled-components';\n\nimport { addRippleDefault } from '../ripple';\nimport { StyledCheckboxProps } from '.';\n\n/****************************************** Size *************************************************/\nexport const CheckboxSize = css<StyledCheckboxProps>`\n ${(props) => CheckboxSizeConstructor({ ...KEY_SIZE_DATA[props.$size], isWidthAsHeight: props.$isWidthAsHeight })};\n`;\nexport const CheckboxSizeConstructor = (\n props: IThemeSizePropertyDefault & {\n isWidthAsHeight?: boolean;\n },\n) => css`\n height: ${props.height}px;\n min-height: ${props.height}px;\n border-radius: ${props.radius}px;\n gap: ${props.padding - 2}px;\n padding: ${props.padding - 4}px;\n ${\n props.isWidthAsHeight &&\n css`\n width: ${props.height}px;\n min-width: ${props.height}px;\n padding: 0px;\n `\n };\n`;\n\n/****************************************** Genre *************************************************/\nexport const CheckboxGenre = css<StyledCheckboxProps>`\n ${(props) => css`\n background: ${props.theme.colors.checkbox[props.$genre].background.rest};\n border-color: ${props.theme.colors.checkbox[props.$genre].border.rest};\n color: ${props.theme.colors.checkbox[props.$genre].color.rest};\n &:hover {\n background: ${props.theme.colors.checkbox[props.$genre].background.hover};\n border-color: ${props.theme.colors.checkbox[props.$genre].border.hover};\n color: ${props.theme.colors.checkbox[props.$genre].color.hover};\n }\n `};\n`;\n\n/****************************************** Disabled *************************************************/\nconst addCheckboxDisabled = css<StyledCheckboxProps>`\n ${addDisabled};\n ${(props) =>\n props.$isDisabled\n ? css`\n background: ${props.theme.colors.checkbox[props.$genre].background.rest} !important;\n border-color: ${props.theme.colors.checkbox[props.$genre].border.rest} !important;\n color: ${props.theme.colors.checkbox[props.$genre].color.rest} !important;\n `\n : ''}\n`;\n\n/****************************************** HiddenBorder *************************************************/\nconst CheckboxHiddenBorder = css<StyledCheckboxProps>`\n ${(props) =>\n props.$isHiddenBorder &&\n css`\n border-color: transparent !important;\n `}\n`;\n\n/****************************************** Default *************************************************/\nexport const CheckboxWrapper = styled.button<StyledCheckboxProps>`\n display: flex;\n align-items: center;\n justify-content: flex-start;\n border: 1px solid transparent;\n user-select: none;\n cursor: pointer;\n background-color: ${(props) => props.$isNotBackground && 'transparent'};\n\n ${addRippleDefault};\n ${addTransition};\n ${CheckboxGenre};\n ${CheckboxHiddenBorder};\n ${CheckboxSize};\n ${addCheckboxDisabled}\n ${addOutline};\n ${addFont};\n ${addError};\n ${addSXTypography};\n ${addSX};\n`;\n","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 size: props.font?.size ?? KEY_SIZE_DATA[props.size].font,\n weight: props.font?.weight ?? 700,\n family: props.font?.family ?? theme.font.family,\n height: props.font?.height,\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":["CheckboxSize","css","props","CheckboxSizeConstructor","KEY_SIZE_DATA","$size","isWidthAsHeight","$isWidthAsHeight","height","radius","padding","CheckboxGenre","theme","colors","checkbox","$genre","background","rest","border","color","hover","addCheckboxDisabled","addDisabled","$isDisabled","CheckboxHiddenBorder","$isHiddenBorder","CheckboxWrapper","styled","button","$isNotBackground","addRippleDefault","addTransition","addOutline","addFont","addError","addSXTypography","addSX","handleOnClick","useCallback","checked","_a","onChange","call","useTheme","children","useMemo","jsxs","Fragment","jsx","Icon","view","true","false","size","LoadingComponent","type","name","genre","$error","error","$view","$font","font","weight","_b","family","_c","_d","$checked","isDisabled","isHiddenBorder","isNotBackground","$sx","sx","$sxTypography","sxTypography","$isDisabledOutline","isDisabledOutline","$isOutlineBoxShadow","isOutlineBoxShadow","$isReadOnly","isReadOnly","disabled","tabIndex","onClick","Ripple","isOnlyLoading","isLoading","ErrorMessage","_e"],"mappings":"kaAYaA,EAAeC,EAAAA,GAAAA;IACvBC,GAAUC,EAAwB,IAAKC,EAAAA,cAAcF,EAAMG,OAAQC,gBAAiBJ,EAAMK;EAElFJ,EACXD,GAGGD,EAAAA,GAAAA;YACOC,EAAMM;gBACFN,EAAMM;mBACHN,EAAMO;SAChBP,EAAMQ,QAAU;aACZR,EAAMQ,QAAU;IAEzBR,EAAMI,iBACNL,EAAAA,GAAAA;aACSC,EAAMM;iBACFN,EAAMM;;;EAOVG,EAAgBV,EAAAA,GAAAA;IACxBC,GAAUD,EAAAA,GAAAA;kBACGC,EAAMU,MAAMC,OAAOC,SAASZ,EAAMa,QAAQC,WAAWC;oBACnDf,EAAMU,MAAMC,OAAOC,SAASZ,EAAMa,QAAQG,OAAOD;aACxDf,EAAMU,MAAMC,OAAOC,SAASZ,EAAMa,QAAQI,MAAMF;;oBAEzCf,EAAMU,MAAMC,OAAOC,SAASZ,EAAMa,QAAQC,WAAWI;sBACnDlB,EAAMU,MAAMC,OAAOC,S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AMmD,KACjCS,KAAM,CACJT,KAAM,GACNU,OAAQ,IACRE,QAAQ,OAAAwB,EAAAvF,EAAM4D,WAAN,EAAA2B,EAAYxB,SAAUrD,EAAMkD,KAAKG,UAG3C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BcGej2Kr.cjs"),t=require("./area-DqLK4RX5.cjs"),r=require("./component-GKvpOWlO.cjs"),s=require("react"),n=require("styled-components"),o=require("./style-Df37KnoJ.cjs"),i=require("./style-fRZ6xrVp.cjs"),a=n.img`
|
|
2
|
+
position: absolute;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
object-fit: cover;
|
|
6
|
+
opacity: ${e=>e.$isPending?0:1};
|
|
7
|
+
${o.addTransition};
|
|
8
|
+
${i.addSX};
|
|
9
|
+
`;exports.Image=o=>{const[i,c]=s.useState(!0),[l,u]=s.useState(!1);s.useEffect(()=>{if(!o.src)return;const e=new window.Image;return e.onload=()=>{c(!1),u(!1)},e.onerror=()=>{c(!1),u(!0)},e.src=o.src,e.complete&&(e.naturalWidth>0?(c(!1),u(!1)):(c(!1),u(!0))),()=>{e.onload=null,e.onerror=null,c(!0),u(!1)}},[o.src]);const d=n.useTheme(),{default:x,...g}=(null==o?void 0:o.sxStack)?"function"==typeof(null==o?void 0:o.sxStack)?o.sxStack(d):o.sxStack:{};return e.jsxRuntimeExports.jsxs(r.Stack,{sx:{default:{position:"relative",overflow:"hidden",...o.isShowBeforeImage?{"&::before":{width:"100%",height:"100%",content:'""',position:"absolute",inset:0,backgroundImage:`url(${o.src})`,backgroundRepeat:"no-repeat",backgroundSize:"cover",backgroundPosition:"center",filter:"blur(20px)",transform:"scale(1.1)",zIndex:0}}:{},...x},...g},children:[l?null:o.componentLoading||i?e.jsxRuntimeExports.jsx(t.Skeleton,{visible:!0,sx:{default:{width:"100%",height:"100%"}}}):null,!l&&e.jsxRuntimeExports.jsx(a,{loading:"lazy",$isPending:i,src:o.src,alt:o.alt,$sx:o.sxImage}),l&&o.componentFallback||null]})},exports.ImageIMG=a;
|
|
10
|
+
//# sourceMappingURL=component.styles-BYG4iVCR.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.styles-
|
|
1
|
+
{"version":3,"file":"component.styles-BYG4iVCR.cjs","sources":["../src/components/image/component.styles.tsx","../src/components/image/component.tsx"],"sourcesContent":["import { addTransition } from '@local/styles/add';\nimport { addSX } from '@local/styles/sx';\n\nimport styled from 'styled-components';\n\nimport { ImageIMGProps } from '.';\n\nexport const ImageIMG = styled.img<ImageIMGProps>`\n position: absolute;\n width: 100%;\n height: 100%;\n object-fit: cover;\n opacity: ${(props) => (props.$isPending ? 0 : 1)};\n ${addTransition};\n ${addSX};\n`;\n","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":["ImageIMG","styled","img","props","$isPending","addTransition","addSX","isPending","setIsPending","useState","isError","setIsError","useEffect","src","window","Image","onload","onerror","complete","naturalWidth","theme","useTheme","default","defaultSx","rest","sxStack","jsxs","Stack","sx","position","overflow","isShowBeforeImage","width","height","content","inset","backgroundImage","backgroundRepeat","backgroundSize","backgroundPosition","filter","transform","zIndex","children","componentLoading","jsx","Skeleton","visible","loading","alt","$sx","sxImage","componentFallback"],"mappings":"wPAOaA,EAAWC,EAAOC,GAAA;;;;;aAKjBC,GAAWA,EAAMC,WAAa,EAAI;IAC5CC;IACAC;gBCNkCH,IACpC,MAAOI,EAAWC,GAAgBC,EAAAA,UAAS,IACpCC,EAASC,GAAcF,EAAAA,UAAS,GAEvCG,EAAAA,UAAU,KACR,IAAKT,EAAMU,IAAK,OAEhB,MAAMX,EAAM,IAAKY,OAAOC,MAwBxB,OAtBAb,EAAIc,OAAS,KACXR,GAAa,GACbG,GAAW,IAGbT,EAAIe,QAAU,KACZT,GAAa,GACbG,GAAW,IAGbT,EAAIW,IAAMV,EAAMU,IAEZX,EAAIgB,WACFhB,EAAIiB,aAAe,GACrBX,GAAa,GACbG,GAAW,KAEXH,GAAa,GACbG,GAAW,KAIR,KACLT,EAAIc,OAAS,KACbd,EAAIe,QAAU,KACdT,GAAa,GACbG,GAAW,KAEZ,CAACR,EAAMU,MACV,MAAMO,EAAQC,EAAAA,YACNC,QAASC,KAAcC,UAASrB,WAAOsB,SACjB,mBAAnB,MAAAtB,OAAA,EAAAA,EAAOsB,SACZtB,EAAMsB,QAAQL,GACdjB,EAAMsB,QACR,CAAA,EAEJ,SACEC,kBAAAA,KAACC,EAAAA,MAAA,CACCC,GAAI,CACFN,QAAS,CACPO,SAAU,WACVC,SAAU,YACN3B,EAAM4B,kBACN,CACE,YAAa,CACXC,MAAO,OACPC,OAAQ,OACRC,QAAS,KACTL,SAAU,WACVM,MAAO,EACPC,gBAAiB,OAAOjC,EAAMU,OAC9BwB,iBAAkB,YAClBC,eAAgB,QAChBC,mBAAoB,SACpBC,OAAQ,aACRC,UAAW,aACXC,OAAQ,IAGZ,CAAA,KACDnB,MAEFC,GAGJmB,SAAA,CAACjC,EAYE,KAXFP,EAAMyC,kBAAoBrC,IACxBsC,kBAAAA,IAACC,EAAAA,SAAA,CACCC,SAAO,EACPnB,GAAI,CACFN,QAAS,CACPU,MAAO,OACPC,OAAQ,WAIZ,MAEJvB,GACAmC,EAAAA,kBAAAA,IAAC7C,EAAA,CAASgD,QAAQ,OAAO5C,WAAYG,EAAWM,IAAKV,EAAMU,IAAKoC,IAAK9C,EAAM8C,IAAKC,IAAK/C,EAAMgD,UAE5FzC,GAAUP,EAAMiD,mBAA4B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("./jsx-runtime-BcGej2Kr.cjs"),t=require("./consts.cjs.js"),s=require("./use-
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BcGej2Kr.cjs"),t=require("./consts.cjs.js"),s=require("./use-BLwltPMc.cjs"),i=require("./component-BfppCwz9.cjs"),r=require("./component.styles-BYG4iVCR.cjs"),o=require("./component-GKvpOWlO.cjs"),n=require("styled-components"),a=require("./component-BxetIWe6.cjs"),l=require("./context.constants-BLQ_1jZI.cjs"),d=require("./theme.global-D67h5YeA.cjs"),u=require("react"),c=require("./style-D8DUzG0C.cjs"),g=require("framer-motion"),p=require("./style-fRZ6xrVp.cjs"),m=n.css`
|
|
2
2
|
${e=>n.css`
|
|
3
3
|
background: ${e.theme.colors.imageSelect[e.$genre].background.rest};
|
|
4
4
|
color: ${e.theme.colors.imageSelect[e.$genre].color.rest};
|
|
@@ -36,4 +36,4 @@
|
|
|
36
36
|
${m}
|
|
37
37
|
${x}
|
|
38
38
|
`;exports.ImageSelect=p=>{const{onChange:m}=p,x=u.useMemo(()=>d.KEY_SIZE_DATA[p.size],[p.size]),[h,f]=u.useState(p.images||[]),[j,v]=u.useState(!1),y=u.useRef(null),$=n.useTheme(),E=u.useCallback(e=>{e&&f(t=>{const s=e.map((e,s)=>({...e,index:t.length+s})),i=[...t,...s];return null==m||m(i),i})},[m]),z=()=>{var e;null==(e=y.current)||e.click()},{handleAddFiles:R}=s.useImageCrop({onSave:E,locale:p.locale,dialog:{button:{genre:p.propsButton.default.genre,size:p.propsButton.default.size},buttonDelete:{genre:p.propsButton.delete.genre,size:p.propsButton.delete.size}},imageSettings:{maxSize:p.imageSettings.maxSize,maxCount:p.imageSettings.maxCount-h.length,aspect:p.imageSettings.aspect},refInput:y}),{handleAdd:k}=(t=>{const s=u.useMemo(()=>d.KEY_SIZE_DATA[t.size],[t.size]),n=u.useMemo(()=>`${s.radius}px`,[s.radius]),{add:c}=l.useDialog({br:n,propsDialog:{borderRadius:n,padding:"0",background:"whiteStandard"}});return{handleAdd:u.useCallback(s=>{c({content:(n,l)=>e.jsxRuntimeExports.jsxs(o.Stack,{sx:{default:{position:"relative",overflow:"hidden",aspectRatio:2*t.imageSettings.aspect+" / 2",width:"auto",maxWidth:"70dvw",height:"85dvh",borderRadius:null==n?void 0:n.br},tablet:{maxWidth:"95dvw"}},children:[e.jsxRuntimeExports.jsx(r.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:null==s?void 0:s.imageSrc,src:null==s?void 0:s.imageSrc,componentFallback:e.jsxRuntimeExports.jsx(a.Typography,{sx:{default:{variant:"h6"}},children:t.locale.imageFallback})}),e.jsxRuntimeExports.jsx(i.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==l?void 0:l()})]})})},[c,t.imageSettings.aspect,t.locale.imageFallback])}})({size:p.size,locale:p.locale,imageSettings:p.imageSettings,genre:p.genre});return u.useEffect(()=>{f(p.images||[])},[p.images]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(S,{$genre:p.genre,$size:p.size,id:p.id,$sx:p.sx,$error:p.error,children:[e.jsxRuntimeExports.jsxs(b,{onDrop:e=>{(e=>{var t;e.preventDefault(),(null==(t=e.dataTransfer.files)?void 0:t.length)&&R(e.dataTransfer.files)})(e),v(!1)},onDragOver:e=>e.preventDefault(),onDragEnter:()=>v(!0),onDragLeave:()=>v(!1),animate:{borderColor:j?$.colors.imageSelect[p.genre].border.hover:$.colors.imageSelect[p.genre].border.rest},transition:{duration:.3},$genre:p.genre,$size:p.size,children:[e.jsxRuntimeExports.jsxs(g.motion.div,{transition:{layout:{duration:.3,ease:"easeInOut",type:"spring"}},layout:!0,style:{display:"flex",flexWrap:"wrap",gap:x.padding-2+"px"},children:[h.map(t=>t.url&&e.jsxRuntimeExports.jsxs(g.motion.div,{style:{position:"relative",width:`${p.imageSettings.width}px`,height:`${p.imageSettings.height}px`,userSelect:"none",overflow:"hidden",borderRadius:`${x.radius}px`,flexGrow:1},layout:!0,transition:{layout:{duration:.3,ease:"easeInOut",type:"spring"}},children:[e.jsxRuntimeExports.jsx(r.Image,{sxStack:e=>({default:{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",backgroundColor:e.palette.black10,position:"absolute",pointerEvents:"none"}}),isShowBeforeImage:p.isContain,sxImage:{default:{objectFit:p.isContain?"contain":"cover"}},alt:t.name||"image",src:t.url,componentFallback:e.jsxRuntimeExports.jsx(a.Typography,{sx:{default:{variant:"h6"}},children:p.locale.imageFallback})}),e.jsxRuntimeExports.jsx(i.Button,{sx:{default:{position:"absolute",top:5,right:5}},genre:p.genre,size:"small",icons:[{type:"id",name:"Close"}],isWidthAsHeight:!0,isHiddenBorder:!0,isRadius:!0,onClick:()=>{return e=t.id,void f(t=>{const s=t.filter(t=>t.id!==e);return null==m||m(s),s});var e}}),e.jsxRuntimeExports.jsx(i.Button,{sx:{default:{position:"absolute",bottom:5,right:5}},genre:p.genre,size:"small",icons:[{type:"id",name:"Activity"}],isWidthAsHeight:!0,isHiddenBorder:!0,isRadius:!0,onClick:()=>t.url&&k({id:t.id,imageSrc:t.url})})]},t.id)),0===h.length?e.jsxRuntimeExports.jsx("div",{onClick:z,style:{position:"relative",width:`${p.imageSettings.width}px`,height:`${p.imageSettings.height}px`,userSelect:"none",overflow:"hidden",borderRadius:`${x.radius}px`,flexGrow:1,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center",cursor:"pointer"},children:e.jsxRuntimeExports.jsx(a.Typography,{style:{color:$.colors.imageSelect[p.genre].color.rest},sx:{default:{}},children:p.locale.dragAndDrop})},"empty"):null]}),e.jsxRuntimeExports.jsx("input",{ref:y,type:"file",accept:t.ImageSupportedFormatsForInput,multiple:!0,style:{display:"none"},onChange:e=>{e.target.files&&R(e.target.files)}})]}),e.jsxRuntimeExports.jsxs(o.Stack,{sx:{default:{flexGrow:1,gap:x.padding-2+"px"}},children:[e.jsxRuntimeExports.jsx(i.Button,{type:"button",genre:p.genre,size:p.size,sx:{default:{flexGrow:3}},isRadius:!0,onClick:z,children:p.locale.buttonAdd}),e.jsxRuntimeExports.jsx(i.Button,{isRadius:!0,type:"button",sx:{default:{flexGrow:1}},onClick:()=>{f(p.defaultImages||[]),null==m||m(p.defaultImages||[])},genre:p.genre,size:p.size,children:p.locale.buttonReset})]})]}),(null==p?void 0:p.error)?e.jsxRuntimeExports.jsx(c.ErrorMessage,{...p.error,size:(null==p?void 0:p.error.size)??p.size,font:{size:12,weight:400,family:$.font.family}}):null]})},exports.ImageSelectListSize=x,exports.ImageSelectListSizeConstructor=h,exports.ImageSelectListWrapper=b,exports.ImageSelectSize=f,exports.ImageSelectSizeConstructor=j,exports.ImageSelectWrapper=S;
|
|
39
|
-
//# sourceMappingURL=component.styles-
|
|
39
|
+
//# sourceMappingURL=component.styles-BZ9QLlOU.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.styles-B4ZjkzIF.cjs","sources":["../src/components/image-select/component.styles.ts","../src/components/image-select/component.tsx","../src/hooks/use-image-view/use.tsx"],"sourcesContent":["import { motion } from 'framer-motion';\nimport styled, { css } from 'styled-components';\n\nimport { addError } from '@local/styles/error';\nimport { addSX } from '@local/styles/sx';\nimport { IThemeSizePropertyDefault, KEY_SIZE_DATA } from '@local/theme';\n\nimport { ImageSelectWrapperProps } from '.';\n\nconst ImageSelectListGenre = css<ImageSelectWrapperProps>`\n ${(props) => css`\n background: ${props.theme.colors.imageSelect[props.$genre].background.rest};\n color: ${props.theme.colors.imageSelect[props.$genre].color.rest};\n &:active {\n background: ${props.theme.colors.imageSelect[props.$genre].background.rest};\n color: ${props.theme.colors.imageSelect[props.$genre].color.rest};\n }\n &:focus-visible {\n background: ${props.theme.colors.imageSelect[props.$genre].background.rest};\n color: ${props.theme.colors.imageSelect[props.$genre].color.rest};\n }\n `};\n`;\n/****************************************** Size *************************************************/\nexport const ImageSelectListSize = css<ImageSelectWrapperProps>`\n ${(props) => ImageSelectListSizeConstructor(KEY_SIZE_DATA[props.$size])};\n`;\nexport const ImageSelectListSizeConstructor = (props: IThemeSizePropertyDefault) => css`\n padding: ${props.padding}px;\n border-radius: ${props.radius}px;\n`;\nexport const ImageSelectSize = css<ImageSelectWrapperProps>`\n ${(props) => ImageSelectSizeConstructor(KEY_SIZE_DATA[props.$size])};\n`;\nexport const ImageSelectSizeConstructor = (props: IThemeSizePropertyDefault) => css`\n gap: ${props.padding - 2}px;\n`;\nexport const ImageSelectWrapper = styled.div<ImageSelectWrapperProps>`\n display: flex;\n flex-direction: column;\n width: 100%;\n ${ImageSelectSize};\n ${addError};\n ${addSX};\n`;\nexport const ImageSelectListWrapper = styled(motion.div)<ImageSelectWrapperProps>`\n border: 2px dashed;\n\n display: flex;\n flex-direction: column;\n width: 100%;\n ${ImageSelectListGenre}\n ${ImageSelectListSize}\n`;\n","import { ImageSupportedFormatsForInput } 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={ImageSupportedFormatsForInput}\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":["ImageSelectListGenre","css","props","theme","colors","imageSelect","$genre","background","rest","color","ImageSelectListSize","ImageSelectListSizeConstructor","KEY_SIZE_DATA","$size","padding","radius","ImageSelectSize","ImageSelectSizeConstructor","ImageSelectWrapper","styled","div","addError","addSX","ImageSelectListWrapper","motion","onChange","size","useMemo","images","setImages","useState","isDraggingOver","setIsDraggingOver","refInput","useRef","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","add","useDialog","propsDialog","borderRadius","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","id","$sx","$error","error","onDrop","e","preventDefault","dataTransfer","handleDrop","onDragOver","onDragEnter","onDragLeave","animate","borderColor","border","hover","transition","duration","layout","ease","style","display","flexWrap","gap","img","url","userSelect","flexGrow","isContain","top","handleDelete","filter","textAlign","cursor","dragAndDrop","ref","accept","ImageSupportedFormatsForInput","multiple","target","buttonAdd","defaultImages","buttonReset","ErrorMessage","font","weight","family"],"mappings":"+fASMA,EAAuBC,EAAAA,GAAAA;IACxBC,GAAUD,EAAAA,GAAAA;kBACGC,EAAMC,MAAMC,OAAOC,YAAYH,EAAMI,QAAQC,WAAWC;aAC7DN,EAAMC,MAAMC,OAAOC,YAAYH,EAAMI,QAAQG,MAAMD;;oBAE5CN,EAAMC,MAAMC,OAAOC,YAAYH,EAAMI,QAAQC,WAAWC;eAC7DN,EAAMC,MAAMC,OAAOC,YAAYH,EAAMI,QAAQG,MAAMD;;;oBAG9CN,EAAMC,MAAMC,OAAOC,YAAYH,EAAMI,QAAQC,WAAWC;eAC7DN,EAAMC,MAAMC,OAAOC,YAAYH,EAAMI,QAAQG,MAAMD;;;EAKrDE,EAAsBT,EAAAA,GAAAA;IAC9BC,GAAUS,EAA+BC,EAAAA,cAAcV,EAAMW;EAErDF,EAAkCT,GAAqCD,EAAAA,GAAAA;aACvEC,EAAMY;mBACAZ,EAAMa;EAEZC,EAAkBf,EAAAA,GAAAA;IAC1BC,GAAUe,EAA2BL,EAAAA,cAAcV,EAAMW;EAEjDI,EAA8Bf,GAAqCD,EAAAA,GAAAA;SACvEC,EAAMY,QAAU;EAEZI,EAAqBC,EAAOC,GAAA;;;;IAIrCJ;IACAK;IACAC;EAESC,EAAyBJ,EAAOK,EAAAA,OAAOJ,IAAG;;;;;;IAMnDpB;IACAU;sBCpCwBR,IAC1B,MAAMuB,SAAEA,GAAavB,EAEfwB,EAAOC,UAAQ,IAAMf,gBAAcV,EAAMwB,MAAO,CAACxB,EAAMwB,QAEtDE,EAAQC,GAAaC,EAAAA,SAAiC5B,EAA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AAAA,IAAC2E,EAAAA,aAAA,IACKjK,EAAMyH,MACVjG,MAAM,MAAAxB,OAAA,EAAAA,EAAOyH,MAAMjG,OAAQxB,EAAMwB,KACjC0I,KAAM,CACJ1I,KAAM,GACN2I,OAAQ,IACRC,OAAQnK,EAAMiK,KAAKE,UAGrB"}
|
|
1
|
+
{"version":3,"file":"component.styles-BZ9QLlOU.cjs","sources":["../src/components/image-select/component.styles.ts","../src/components/image-select/component.tsx","../src/hooks/use-image-view/use.tsx"],"sourcesContent":["import { motion } from 'framer-motion';\nimport styled, { css } from 'styled-components';\n\nimport { addError } from '@local/styles/error';\nimport { addSX } from '@local/styles/sx';\nimport { IThemeSizePropertyDefault, KEY_SIZE_DATA } from '@local/theme';\n\nimport { ImageSelectWrapperProps } from '.';\n\nconst ImageSelectListGenre = css<ImageSelectWrapperProps>`\n ${(props) => css`\n background: ${props.theme.colors.imageSelect[props.$genre].background.rest};\n color: ${props.theme.colors.imageSelect[props.$genre].color.rest};\n &:active {\n background: ${props.theme.colors.imageSelect[props.$genre].background.rest};\n color: ${props.theme.colors.imageSelect[props.$genre].color.rest};\n }\n &:focus-visible {\n background: ${props.theme.colors.imageSelect[props.$genre].background.rest};\n color: ${props.theme.colors.imageSelect[props.$genre].color.rest};\n }\n `};\n`;\n/****************************************** Size *************************************************/\nexport const ImageSelectListSize = css<ImageSelectWrapperProps>`\n ${(props) => ImageSelectListSizeConstructor(KEY_SIZE_DATA[props.$size])};\n`;\nexport const ImageSelectListSizeConstructor = (props: IThemeSizePropertyDefault) => css`\n padding: ${props.padding}px;\n border-radius: ${props.radius}px;\n`;\nexport const ImageSelectSize = css<ImageSelectWrapperProps>`\n ${(props) => ImageSelectSizeConstructor(KEY_SIZE_DATA[props.$size])};\n`;\nexport const ImageSelectSizeConstructor = (props: IThemeSizePropertyDefault) => css`\n gap: ${props.padding - 2}px;\n`;\nexport const ImageSelectWrapper = styled.div<ImageSelectWrapperProps>`\n display: flex;\n flex-direction: column;\n width: 100%;\n ${ImageSelectSize};\n ${addError};\n ${addSX};\n`;\nexport const ImageSelectListWrapper = styled(motion.div)<ImageSelectWrapperProps>`\n border: 2px dashed;\n\n display: flex;\n flex-direction: column;\n width: 100%;\n ${ImageSelectListGenre}\n ${ImageSelectListSize}\n`;\n","import { ImageSupportedFormatsForInput } 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={ImageSupportedFormatsForInput}\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":["ImageSelectListGenre","css","props","theme","colors","imageSelect","$genre","background","rest","color","ImageSelectListSize","ImageSelectListSizeConstructor","KEY_SIZE_DATA","$size","padding","radius","ImageSelectSize","ImageSelectSizeConstructor","ImageSelectWrapper","styled","div","addError","addSX","ImageSelectListWrapper","motion","onChange","size","useMemo","images","setImages","useState","isDraggingOver","setIsDraggingOver","refInput","useRef","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","add","useDialog","propsDialog","borderRadius","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","id","$sx","$error","error","onDrop","e","preventDefault","dataTransfer","handleDrop","onDragOver","onDragEnter","onDragLeave","animate","borderColor","border","hover","transition","duration","layout","ease","style","display","flexWrap","gap","img","url","userSelect","flexGrow","isContain","top","handleDelete","filter","textAlign","cursor","dragAndDrop","ref","accept","ImageSupportedFormatsForInput","multiple","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0,0 +1,22 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BcGej2Kr.cjs"),t=require("react"),o=require("styled-components"),r=require("./style-Df37KnoJ.cjs"),n=require("./style-fRZ6xrVp.cjs"),s=require("./theme.global-D67h5YeA.cjs"),i=r=>{const n=o.useTheme(),s=t.useMemo(()=>n.icon.getIconId({type:r.type,name:r.name}),[r.name,r.type,n.icon.getIconId]);return a(t.useMemo(()=>n.icon.getSpriteUrl({type:r.type}),[r.type,n.icon.getSpriteUrl]))?e.jsxRuntimeExports.jsx(d,{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",$size:r.size,$turn:r.turn,$order:r.order,$color:r.color||void 0,$sx:r.sx,className:r.className,onClick:r.onClick,tabIndex:r.tabIndex,children:e.jsxRuntimeExports.jsx("use",{href:s})}):null};const c=new Map;function a(e){const[o,r]=t.useState(c.has(e));return t.useEffect(()=>{var t;if(o)return;let n=!0;if(!c.has(e)){const t=(async()=>{const t=await fetch(e);if(!t.ok)throw new Error(`Failed to load sprite: ${e}`);const o=await t.text(),r=document.createElement("div");r.style.display="none",r.innerHTML=o,document.body.prepend(r)})();c.set(e,t)}return null==(t=c.get(e))||t.then(()=>{n&&r(!0)}),()=>{n=!1}},[e,o]),o}const d=o.svg`
|
|
2
|
+
color: ${e=>e.$color?e.theme.palette[e.$color]:"inherit"};
|
|
3
|
+
|
|
4
|
+
${e=>o.css`
|
|
5
|
+
height: ${"100%"!==e.$size?`${s.KEY_SIZE_DATA[e.$size].heightIcon}px`:"100%"};
|
|
6
|
+
min-height: ${"100%"!==e.$size?`${s.KEY_SIZE_DATA[e.$size].heightIcon}px`:"100%"};
|
|
7
|
+
|
|
8
|
+
width: ${"100%"!==e.$size?`${s.KEY_SIZE_DATA[e.$size].heightIcon}px`:"100%"};
|
|
9
|
+
min-width: ${"100%"!==e.$size?`${s.KEY_SIZE_DATA[e.$size].heightIcon}px`:"100%"};
|
|
10
|
+
|
|
11
|
+
transform: rotate(${e.$turn||0}deg);
|
|
12
|
+
`}
|
|
13
|
+
${e=>void 0!==e.$order&&o.css`
|
|
14
|
+
order: ${e.$order};
|
|
15
|
+
`};
|
|
16
|
+
${r.addColorTransition};
|
|
17
|
+
& path {
|
|
18
|
+
${r.addColorTransition};
|
|
19
|
+
}
|
|
20
|
+
${n.addSX};
|
|
21
|
+
`;exports.Icon=i,exports.StyledSVG=d,exports.getIconComponents=function(t){var o,r;return null==(r=null==(o=t.icons??[])?void 0:o.filter(e=>!e.isHidden))?void 0:r.map((o,r)=>e.jsxRuntimeExports.jsx(i,{size:(null==o?void 0:o.size)??t.size,...o},`${o.type}-${o.name}-${r}`))},exports.useInjectSprites=function(e){t.useEffect(()=>{const t=[];return e.forEach(async e=>{try{const o=await fetch(e);if(!o.ok)return void console.error(`Failed to load sprite: ${e}`);const r=await o.text(),n=document.createElement("div");n.style.display="none",n.innerHTML=r,document.body.prepend(n),t.push(n)}catch(o){console.error(`Error loading sprite ${e}`,o)}}),()=>{t.forEach(e=>e.remove())}},[e])},exports.useLazyInjectSprite=a;
|
|
22
|
+
//# sourceMappingURL=component.styles-BviHtzJH.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.styles-BviHtzJH.cjs","sources":["../src/components/icon/component.tsx","../src/components/icon/component.functions.tsx","../src/components/icon/component.styles.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { useTheme } from 'styled-components';\n\nimport { IconItemProps, StyledSVG, useLazyInjectSprite } from '.';\n\nexport const Icon = (props: IconItemProps) => {\n const theme = useTheme();\n const iconId = useMemo(\n () => theme.icon.getIconId({ type: props.type, name: props.name }),\n [props.name, props.type, theme.icon.getIconId],\n );\n const spriteUrl = useMemo(() => theme.icon.getSpriteUrl({ type: props.type }), [props.type, theme.icon.getSpriteUrl]);\n const loaded = useLazyInjectSprite(spriteUrl);\n\n if (!loaded) return null;\n\n return (\n <StyledSVG\n width='24'\n height='24'\n viewBox='0 0 24 24'\n xmlns='http://www.w3.org/2000/svg'\n $size={props.size}\n $turn={props.turn}\n $order={props.order}\n $color={props.color || undefined}\n $sx={props.sx}\n className={props.className}\n onClick={props.onClick}\n tabIndex={props.tabIndex}\n >\n <use href={iconId} />\n </StyledSVG>\n );\n};\n","import { useEffect, useState } from 'react';\n\nimport { getIconComponentsProps, Icon } from '.';\n\nexport function getIconComponents(props: getIconComponentsProps) {\n return (props.icons ?? [])\n ?.filter((icon) => !icon.isHidden)\n ?.map((icon, index) => (\n <Icon key={`${icon.type}-${icon.name}-${index}`} size={icon?.size ?? props.size} {...icon} />\n ));\n}\nexport function useInjectSprites(urls: string[]) {\n useEffect(() => {\n const containers: HTMLDivElement[] = [];\n\n urls.forEach(async (url) => {\n try {\n const res = await fetch(url);\n if (!res.ok) {\n console.error(`Failed to load sprite: ${url}`);\n return;\n }\n const text = await res.text();\n\n const div = document.createElement('div');\n div.style.display = 'none';\n div.innerHTML = text;\n\n document.body.prepend(div);\n containers.push(div);\n } catch (err) {\n console.error(`Error loading sprite ${url}`, err);\n }\n });\n\n return () => {\n containers.forEach((div) => div.remove());\n };\n }, [urls]);\n}\n\nconst loadedSprites = new Map<string, Promise<void>>();\nexport function useLazyInjectSprite(url: string) {\n const [loaded, setLoaded] = useState(loadedSprites.has(url));\n\n useEffect(() => {\n if (loaded) return;\n\n let isMounted = true;\n\n if (!loadedSprites.has(url)) {\n const promise = (async () => {\n const res = await fetch(url);\n if (!res.ok) throw new Error(`Failed to load sprite: ${url}`);\n const text = await res.text();\n const div = document.createElement('div');\n div.style.display = 'none';\n div.innerHTML = text;\n document.body.prepend(div);\n })();\n loadedSprites.set(url, promise);\n }\n\n loadedSprites.get(url)?.then(() => {\n if (isMounted) setLoaded(true);\n });\n\n return () => {\n isMounted = false;\n };\n }, [url, loaded]);\n\n return loaded;\n}\n","import { addColorTransition } from '@local/styles/add';\nimport { addSX } from '@local/styles/sx';\nimport { KEY_SIZE_DATA } from '@local/theme';\n\nimport styled, { css } from 'styled-components';\n\nimport { StyledIconItemProps } from '.';\n\nexport const StyledSVG = styled.svg<StyledIconItemProps>`\n color: ${(props) => (props.$color ? props.theme.palette[props.$color] : 'inherit')};\n\n ${(props) => css`\n height: ${props.$size !== '100%' ? `${KEY_SIZE_DATA[props.$size].heightIcon}px` : '100%'};\n min-height: ${props.$size !== '100%' ? `${KEY_SIZE_DATA[props.$size].heightIcon}px` : '100%'};\n\n width: ${props.$size !== '100%' ? `${KEY_SIZE_DATA[props.$size].heightIcon}px` : '100%'};\n min-width: ${props.$size !== '100%' ? `${KEY_SIZE_DATA[props.$size].heightIcon}px` : '100%'};\n\n transform: rotate(${props.$turn || 0}deg);\n `}\n ${(props) =>\n props.$order !== undefined &&\n css`\n order: ${props.$order};\n `};\n ${addColorTransition};\n & path {\n ${addColorTransition};\n }\n ${addSX};\n`;\n"],"names":["Icon","props","theme","useTheme","iconId","useMemo","icon","getIconId","type","name","useLazyInjectSprite","getSpriteUrl","jsx","StyledSVG","width","height","viewBox","xmlns","$size","size","$turn","turn","$order","order","$color","color","$sx","sx","className","onClick","tabIndex","children","href","loadedSprites","Map","url","loaded","setLoaded","useState","has","useEffect","isMounted","promise","res","fetch","ok","Error","text","div","document","createElement","style","display","innerHTML","body","prepend","set","_a","get","then","styled","svg","palette","css","KEY_SIZE_DATA","heightIcon","addColorTransition","addSX","_b","icons","filter","isHidden","map","index","urls","containers","forEach","async","console","error","push","err","remove"],"mappings":"0NAKaA,EAAQC,IACnB,MAAMC,EAAQC,EAAAA,WACRC,EAASC,EAAAA,QACb,IAAMH,EAAMI,KAAKC,UAAU,CAAEC,KAAMP,EAAMO,KAAMC,KAAMR,EAAMQ,OAC3D,CAACR,EAAMQ,KAAMR,EAAMO,KAAMN,EAAMI,KAAKC,YAKtC,OAFeG,EADGL,EAAAA,QAAQ,IAAMH,EAAMI,KAAKK,aAAa,CAAEH,KAAMP,EAAMO,OAAS,CAACP,EAAMO,KAAMN,EAAMI,KAAKK,kBAMrGC,kBAAAA,IAACC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;;aAE7D,SAAhBhE,EAAMiB,MAAmB,GAAG8C,EAAAA,cAAc/D,EAAMiB,OAAO+C,eAAiB;iBACpD,SAAhBhE,EAAMiB,MAAmB,GAAG8C,EAAAA,cAAc/D,EAAMiB,OAAO+C,eAAiB;;wBAEjEhE,EAAMmB,OAAS;;IAElCnB,QACgB,IAAjBA,EAAMqB,QACNyC,EAAAA,GAAAA;eACW9D,EAAMqB;;IAEjB4C;;MAEEA;;IAEFC;+DDzBG,SAA2BlE,WAChC,OAAQ,OAAAmE,EAAA,WAAMC,OAAS,SAAf,EAAAZ,EACJa,OAAQhE,IAAUA,EAAKiE,gBADnB,EAAAH,EAEJI,IAAI,CAAClE,EAAMmE,IACX7D,EAAAA,kBAAAA,IAACZ,EAAA,CAAgDmB,MAAM,MAAAb,OAAA,EAAAA,EAAMa,OAAQlB,EAAMkB,QAAUb,GAA1E,GAAGA,EAAKE,QAAQF,EAAKG,QAAQgE,KAE9C,2BACO,SAA0BC,GAC/BlC,EAAAA,UAAU,KACR,MAAMmC,EAA+B,GAsBrC,OApBAD,EAAKE,QAAQC,MAAO1C,IAClB,IACE,MAAMQ,QAAYC,MAAMT,GACxB,IAAKQ,EAAIE,GAEP,YADAiC,QAAQC,MAAM,0BAA0B5C,KAG1C,MAAMY,QAAaJ,EAAII,OAEjBC,EAAMC,SAASC,cAAc,OACnCF,EAAIG,MAAMC,QAAU,OACpBJ,EAAIK,UAAYN,EAEhBE,SAASK,KAAKC,QAAQP,GACtB2B,EAAWK,KAAKhC,EAAG,OACZiC,GACPH,QAAQC,MAAM,wBAAwB5C,IAAO8C,EAAG,IAI7C,KACLN,EAAWC,QAAS5B,GAAQA,EAAIkC,YAEjC,CAACR,GACN"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("./jsx-runtime-BcGej2Kr.cjs"),r=require("react"),n=require("styled-components"),t=require("./style-
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BcGej2Kr.cjs"),r=require("react"),n=require("styled-components"),t=require("./style-D8DUzG0C.cjs"),o=require("./style-fRZ6xrVp.cjs"),a=n.div`
|
|
2
2
|
position: relative;
|
|
3
3
|
display: flex;
|
|
4
4
|
width: 100%;
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
`;exports.Range=t=>{const{onChange:o}=t,u=r.useCallback((e,r)=>{const n=[...t.values];n[e]=Math.min(t.max,Math.max(t.min,r)),o(n.sort((e,r)=>e-r))},[o,t.max,t.min,t.values]),l=r.useCallback(e=>(e-t.min)/(t.max-t.min)*100,[t.max,t.min]),p=r.useMemo(()=>t.values.map(e=>l(e)),[l,t.values]),d=n.useTheme(),g=d.colors.range[t.genre].track.background.rest,m=d.colors.range[t.genre].track.gradient.rest,c=d.colors.range[t.genre].thumb.border.rest,x=d.colors.range[t.genre].thumb.background.rest,$=r.useMemo(()=>p.map((e,r)=>{const n=0===r,t=r===p.length-1;return n?`${g} 0%, ${g} ${e}%, ${m} ${e}%`:t?`${m} ${e}%, ${g} ${e}%, ${g} 100%`:`${m} ${e}%`}).join(", "),[m,g,p]),h=r.useMemo(()=>`linear-gradient(to right, ${$})`,[$]);return e.jsxRuntimeExports.jsxs(a,{$size:t.size,$sx:t.sx,$error:t.error,onBlur:t.onBlur,children:[t.values.map((r,n)=>e.jsxRuntimeExports.jsx(i,{type:"range",$size:t.size,$genre:t.genre,min:t.min,max:t.max,step:t.step,value:r,onChange:e=>u(n,parseFloat(e.target.value)),style:{zIndex:100+n},$colorBackground:x,$colorBorder:c},n)),e.jsxRuntimeExports.jsx(s,{$size:t.size,$genre:t.genre,style:{background:h}})]})},exports.RangeThumb=i,exports.RangeTrack=s,exports.RangeWrapper=a;
|
|
47
|
-
//# sourceMappingURL=component.styles-
|
|
47
|
+
//# sourceMappingURL=component.styles-C8ONgWei.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.styles-
|
|
1
|
+
{"version":3,"file":"component.styles-C8ONgWei.cjs","sources":["../src/components/range/component.styles.ts","../src/components/range/component.tsx"],"sourcesContent":["import styled from 'styled-components';\n\nimport { addError } from '@local/styles/error';\nimport { addSX } from '@local/styles/sx';\n\nimport { RangeComponentProps, RangeThumbProps, RangeWrapperProps } from '.';\n\nexport const RangeWrapper = styled.div<RangeWrapperProps>`\n position: relative;\n display: flex;\n width: 100%;\n box-sizing: border-box;\n align-items: center;\n height: 20px;\n ${addError};\n ${addSX};\n`;\n\nexport const RangeTrack = styled.div<RangeComponentProps>`\n position: absolute;\n height: 3px;\n width: 100%;\n padding: 0px 10px;\n border-radius: 2px;\n`;\nexport const RangeThumb = styled.input<RangeThumbProps>`\n position: absolute;\n width: 100%;\n outline: none !important;\n pointer-events: none;\n appearance: none;\n -webkit-appearance: none;\n background: transparent;\n left: 0;\n margin: 0;\n &::-webkit-slider-thumb {\n pointer-events: all;\n width: 16px;\n height: 16px;\n margin: 0;\n padding: 0;\n border-radius: 50%;\n background: ${(props) => props.$colorBackground};\n border: 3px ${(props) => props.$colorBorder} solid;\n cursor: pointer;\n -webkit-appearance: none;\n margin-top: 0px;\n transition:\n transform ${(props) => props.theme.transition.default},\n color ${(props) => props.theme.transition.default},\n background-color ${(props) => props.theme.transition.default};\n &:hover {\n transform: scale(1.2);\n }\n }\n`;\n","import { useCallback, useMemo } from 'react';\nimport { useTheme } from 'styled-components';\n\nimport { RangeProps, RangeThumb, RangeTrack, RangeWrapper } from '.';\n\nexport const Range = (props: RangeProps) => {\n const { onChange } = props;\n const handleChange = useCallback(\n (index: number, newValue: number) => {\n const newValues = [...props.values];\n newValues[index] = Math.min(props.max, Math.max(props.min, newValue));\n onChange(newValues.sort((a, b) => a - b));\n },\n [onChange, props.max, props.min, props.values],\n );\n const getThumbPositionPercent = useCallback(\n (val: number) => ((val - props.min) / (props.max - props.min)) * 100,\n [props.max, props.min],\n );\n const positions = useMemo(\n () => props.values.map((val) => getThumbPositionPercent(val)),\n [getThumbPositionPercent, props.values],\n );\n const theme = useTheme();\n\n const colorTrackBackground = theme.colors.range[props.genre].track.background.rest;\n const colorTrackGradient = theme.colors.range[props.genre].track.gradient.rest;\n const colorThumbBorder = theme.colors.range[props.genre].thumb.border.rest;\n const colorThumbBackground = theme.colors.range[props.genre].thumb.background.rest;\n\n const trackGradient = useMemo(\n () =>\n positions\n .map((position, idx) => {\n const isFirst = idx === 0;\n const isLast = idx === positions.length - 1;\n\n if (isFirst)\n return `${colorTrackBackground} 0%, ${colorTrackBackground} ${position}%, ${colorTrackGradient} ${position}%`;\n if (isLast)\n return `${colorTrackGradient} ${position}%, ${colorTrackBackground} ${position}%, ${colorTrackBackground} 100%`;\n return `${colorTrackGradient} ${position}%`;\n })\n .join(', '),\n [colorTrackGradient, colorTrackBackground, positions],\n );\n const gradient = useMemo(() => `linear-gradient(to right, ${trackGradient})`, [trackGradient]);\n\n return (\n <RangeWrapper $size={props.size} $sx={props.sx} $error={props.error} onBlur={props.onBlur}>\n {props.values.map((val, idx) => (\n <RangeThumb\n key={idx}\n type='range'\n $size={props.size}\n $genre={props.genre}\n min={props.min}\n max={props.max}\n step={props.step}\n value={val}\n onChange={(e) => handleChange(idx, parseFloat(e.target.value))}\n style={{ zIndex: 100 + idx }}\n $colorBackground={colorThumbBackground}\n $colorBorder={colorThumbBorder}\n />\n ))}\n <RangeTrack\n $size={props.size}\n $genre={props.genre}\n style={{\n background: gradient,\n }}\n />\n </RangeWrapper>\n );\n};\n"],"names":["RangeWrapper","styled","div","addError","addSX","RangeTrack","RangeThumb","input","props","$colorBackground","$colorBorder","theme","transition","default","onChange","handleChange","useCallback","index","newValue","newValues","values","Math","min","max","sort","a","b","getThumbPositionPercent","val","positions","useMemo","map","useTheme","colorTrackBackground","colors","range","genre","track","background","rest","colorTrackGradient","gradient","colorThumbBorder","thumb","border","colorThumbBackground","trackGradient","position","idx","isFirst","isLast","length","join","jsxs","$size","size","$sx","sx","$error","error","onBlur","children","jsx","type","$genre","step","value","e","parseFloat","target","style","zIndex"],"mappings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EAASF,IAAQnB,EAAUsB,OAAS,EAE1C,OAAIF,EACK,GAAGhB,SAA4BA,KAAwBc,OAAcP,KAAsBO,KAChGG,EACK,GAAGV,KAAsBO,OAAcd,KAAwBc,OAAcd,SAC/E,GAAGO,KAAsBO,OAEjCK,KAAK,MACV,CAACZ,EAAoBP,EAAsBJ,IAEvCY,EAAWX,EAAAA,QAAQ,IAAM,6BAA6BgB,KAAkB,CAACA,IAE/E,SACEO,kBAAAA,KAACrD,EAAA,CAAasD,MAAO9C,EAAM+C,KAAMC,IAAKhD,EAAMiD,GAAIC,OAAQlD,EAAMmD,MAAOC,OAAQpD,EAAMoD,OAChFC,SAAA,CAAArD,EAAMY,OAAOW,IAAI,CAACH,EAAKoB,MACtBc,kBAAAA,IAACxD,EAAA,CAECyD,KAAK,QACLT,MAAO9C,EAAM+C,KACbS,OAAQxD,EAAM4B,MACdd,IAAKd,EAAMc,IACXC,IAAKf,EAAMe,IACX0C,KAAMzD,EAAMyD,KACZC,MAAOtC,EACPd,SAAWqD,GAAMpD,EAAaiC,EAAKoB,WAAWD,EAAEE,OAAOH,QACvDI,MAAO,CAAEC,OAAQ,IAAMvB,GACvBvC,iBAAkBoC,EAClBnC,aAAcgC,GAXTM,MAcTc,kBAAAA,IAACzD,EAAA,CACCiD,MAAO9C,EAAM+C,KACbS,OAAQxD,EAAM4B,MACdkC,MAAO,CACLhC,WAAYG"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "./jsx-runtime-BrDlu8eK.js";
|
|
2
|
-
import { useCallback } from "react";
|
|
3
2
|
import { b as Stack } from "./component-mzzOCXSx.js";
|
|
4
|
-
import
|
|
5
|
-
import { I as Icon } from "./component.styles-
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
import { I as Icon } from "./component.styles-CtZeOnGH.js";
|
|
6
5
|
import { b as addTransition } from "./style-RL73t3JD.js";
|
|
6
|
+
import styled, { css } from "styled-components";
|
|
7
7
|
const Accordion = (props) => {
|
|
8
8
|
const onClickSummary = useCallback(() => {
|
|
9
9
|
if (props.onClickSummary) props.onClickSummary();
|
|
@@ -26,7 +26,7 @@ const Accordion = (props) => {
|
|
|
26
26
|
$expanded: props.expanded,
|
|
27
27
|
onClick: onClickIcon,
|
|
28
28
|
name: "Arrow1",
|
|
29
|
-
|
|
29
|
+
color: "black100",
|
|
30
30
|
type: "id",
|
|
31
31
|
size: "large"
|
|
32
32
|
}
|
|
@@ -78,4 +78,4 @@ export {
|
|
|
78
78
|
AccordionDetails as d,
|
|
79
79
|
AccordionStyledIcon as e
|
|
80
80
|
};
|
|
81
|
-
//# sourceMappingURL=component.styles-
|
|
81
|
+
//# sourceMappingURL=component.styles-CHqowxsZ.js.map
|