@shoplflow/base 0.5.0 → 0.6.0
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/dist/components/Chips/ChipButton/ChipButton.d.ts +3 -0
- package/dist/components/Chips/ChipButton/ChipButton.styled.d.ts +8 -0
- package/dist/components/Chips/ChipButton/ChipButton.types.d.ts +16 -0
- package/dist/components/Chips/ChipButton/index.d.ts +3 -0
- package/dist/components/Chips/ChipToggle/ChipToggle.d.ts +3 -0
- package/dist/components/Chips/ChipToggle/ChipToggle.styled.d.ts +8 -0
- package/dist/components/Chips/ChipToggle/ChipToggle.types.d.ts +16 -0
- package/dist/components/Chips/ChipToggle/index.d.ts +3 -0
- package/dist/components/Chips/index.d.ts +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/global.css +1 -0
- package/dist/hooks/useOnToggle.d.ts +11 -0
- package/dist/index.cjs +97 -31
- package/dist/index.mjs +97 -31
- package/dist/styles/tokens.d.ts +1 -0
- package/dist/styles/utils/getDisabledStyle.d.ts +1 -0
- package/dist/utils/getNextColor.d.ts +11 -0
- package/dist/utils/type/ComponentProps.d.ts +47 -4
- package/package.json +6 -4
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TypographyTokens } from '../../../styles';
|
|
3
|
+
import type { ChipButtonProps } from './ChipButton.types';
|
|
4
|
+
export declare const getLineTypographyBySizeVar: (sizeVar: ChipButtonProps['sizeVar']) => TypographyTokens;
|
|
5
|
+
export declare const StyledChipButton: import("@emotion/styled").StyledComponent<{
|
|
6
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
7
|
+
as?: import("react").ElementType<any> | undefined;
|
|
8
|
+
} & ChipButtonProps, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ColorTokenProps, LeftAndRightElementProps, SizeVariantProps, StyleVariantProps, TextProps, DisableProps, BackgroundColorProps } from '../../../utils/type/ComponentProps';
|
|
2
|
+
import type { $Values } from '@shoplflow/utils';
|
|
3
|
+
import type { HTMLAttributes } from 'react';
|
|
4
|
+
export declare const ChipButtonStyleVariants: {
|
|
5
|
+
readonly LINE: "LINE";
|
|
6
|
+
};
|
|
7
|
+
export declare const ChipButtonSizeVariants: {
|
|
8
|
+
readonly S: "S";
|
|
9
|
+
readonly XS: "XS";
|
|
10
|
+
};
|
|
11
|
+
export type ChipButtonStyleVariantType = $Values<typeof ChipButtonStyleVariants>;
|
|
12
|
+
export type ChipButtonSizeVariantType = $Values<typeof ChipButtonSizeVariants>;
|
|
13
|
+
export interface ChipButtonProps extends ChipButtonOptionProps, Omit<HTMLAttributes<HTMLButtonElement>, 'color'>, TextProps, DisableProps, LeftAndRightElementProps, SizeVariantProps<ChipButtonSizeVariantType>, StyleVariantProps<ChipButtonStyleVariantType>, ColorTokenProps, BackgroundColorProps {
|
|
14
|
+
}
|
|
15
|
+
export interface ChipButtonOptionProps {
|
|
16
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ChipToggleProps } from './ChipToggle.types';
|
|
2
|
+
declare const ChipToggle: ({ text, isSelected, defaultSelected, color, styleVar, sizeVar, leftSource, rightSource, onClick, disabled, ...rest }: ChipToggleProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
|
|
3
|
+
export default ChipToggle;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ChipToggleProps } from './ChipToggle.types';
|
|
3
|
+
import type { TypographyTokens } from '../../../styles';
|
|
4
|
+
export declare const getLineTypographyBySizeVar: (sizeVar: ChipToggleProps['sizeVar']) => TypographyTokens;
|
|
5
|
+
export declare const StyledChip: import("@emotion/styled").StyledComponent<{
|
|
6
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
7
|
+
as?: import("react").ElementType<any> | undefined;
|
|
8
|
+
} & ChipToggleProps, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { $Values } from '../../../utils/type/$values';
|
|
2
|
+
import type { ColorTokenProps, SizeVariantProps, StyleVariantProps, LeftAndRightElementProps, TextProps, SelectedProps, RadiusBooleanProps, DefaultSelectedProps, DisableProps } from '../../../utils/type/ComponentProps';
|
|
3
|
+
import type { HTMLAttributes } from 'react';
|
|
4
|
+
export declare const ChipToggleStyleVariants: {
|
|
5
|
+
readonly SOLID: "SOLID";
|
|
6
|
+
};
|
|
7
|
+
export declare const ChipToggleSizeVariants: {
|
|
8
|
+
readonly S: "S";
|
|
9
|
+
readonly XS: "XS";
|
|
10
|
+
};
|
|
11
|
+
export type ChipToggleStyleVariantType = $Values<typeof ChipToggleStyleVariants>;
|
|
12
|
+
export type ChipToggleSizeVariantType = $Values<typeof ChipToggleSizeVariants>;
|
|
13
|
+
export interface ChipToggleProps extends ChipToggleOptionProps, SelectedProps, DefaultSelectedProps, ColorTokenProps, StyleVariantProps<ChipToggleStyleVariantType>, SizeVariantProps<ChipToggleSizeVariantType>, LeftAndRightElementProps, RadiusBooleanProps, TextProps, DisableProps, Omit<HTMLAttributes<HTMLButtonElement>, 'color'> {
|
|
14
|
+
}
|
|
15
|
+
export interface ChipToggleOptionProps {
|
|
16
|
+
}
|
package/dist/global.css
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* toggle 기능을 추상화한 hook입니다.
|
|
3
|
+
* selected, defaultSelected를 받아서 토글을 관리하는 hook입니다.
|
|
4
|
+
* selected가 있으면 controlled, 없으면 uncontrolled로 동작합니다.
|
|
5
|
+
* defaultSelected가 있으면 초기값으로 설정됩니다.
|
|
6
|
+
* @param {boolean} selected
|
|
7
|
+
* @param {boolean} defaultSelected
|
|
8
|
+
* @return {[boolean, (() => void)]}
|
|
9
|
+
*/
|
|
10
|
+
export type UseOnToggle = (selected?: boolean, defaultSelected?: boolean) => [boolean, () => void];
|
|
11
|
+
export declare const useOnToggle: UseOnToggle;
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var oe=Object.create;var O=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var re=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var ae=(o,t)=>{for(var e in t)O(o,e,{get:t[e],enumerable:!0})},io=(o,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of te(t))!ne.call(o,r)&&r!==e&&O(o,r,{get:()=>t[r],enumerable:!(a=ee(t,r))||a.enumerable});return o};var c=(o,t,e)=>(e=o!=null?oe(re(o)):{},io(t||!o||!o.__esModule?O(e,"default",{value:o,enumerable:!0}):e,o)),ie=o=>io(O({},"__esModule",{value:!0}),o);var dr={};ae(dr,{ChipButton:()=>Qo,ChipButtonSizeVariants:()=>no,ChipButtonStyleVariants:()=>ro,ChipToggle:()=>Zo,ChipToggleSizeVariants:()=>nr,ChipToggleStyleVariants:()=>J,MODAL_BODY_KEY:()=>q,MODAL_FOOTER_KEY:()=>w,MODAL_HEADER_KEY:()=>B,Modal:()=>rr,ModalProvider:()=>H,ModalSize:()=>Oo,MotionStack:()=>U,ShoplflowProvider:()=>To,Stack:()=>ko,StyledChip:()=>Q,StyledChipButton:()=>to,StyledStack:()=>K,Text:()=>M,borderRadiusTokens:()=>f,boxShadowTokens:()=>z,colorTokens:()=>i,fontWeightTokens:()=>So,spacingTokens:()=>R,typographyTokens:()=>bo,useDomain:()=>W,useHandleModal:()=>pe,useModalStore:()=>g,useModalValue:()=>se,useOutsideClick:()=>so,useResizeObserver:()=>Y});module.exports=ie(dr);var V=c(require("react"),1);var P=require("react"),W=({domain:o="SHOPL"})=>{let[t,e]=(0,P.useState)(void 0);(0,P.useEffect)(()=>{o&&e(o)},[o]),(0,P.useEffect)(()=>{t&&(document.documentElement.dataset.shoplflow=t?.toLowerCase())},[t])};var S=c(require("react"),1);var po=require("zustand"),g=(0,po.create)(o=>({modal:[],addModal:(t,e)=>o(a=>({modal:[...a.modal,{component:t,id:e}]})),removeModal:t=>{let{id:e,deps:a=1}=t||{id:void 0,deps:0},r=!!(e&&String(a)),s=!!e,l=!e&&!a,p=!!String(a)&&!e;if(r)throw new Error("id\uC640 deps\uB294 \uB3D9\uC2DC\uC5D0 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");if(s){o(n=>({modal:[...n.modal.filter(m=>m.id!==e)]}));return}if(l||a===1){o(n=>({modal:[...n.modal.slice(0,-1)]}));return}if(p){o(n=>({modal:[...n.modal.slice(0,-a+1)]}));return}}}));var pe=()=>{let o=g(e=>e.addModal),t=g(e=>e.removeModal);return{addModal:o,removeModal:t}};var se=()=>({modal:g(t=>t.modal)});var T=require("react"),so=(o,t)=>{let e=t??(0,T.useRef)(null),a=(0,T.useCallback)(r=>{e.current?.parentNode&&!e.current?.contains(r.target)&&o(r.target)},[e,o]);return(0,T.useEffect)(()=>{let r=e.current?.parentNode;if(r)return r.addEventListener("click",a),()=>{r.removeEventListener("click",a)}},[e,a]),{ref:e}},lo=so;var D=require("react"),Y=(o,t={trackWidth:!0,trackHeight:!0})=>{let[e,a]=(0,D.useState)({width:0,height:0});return(0,D.useEffect)(()=>{let r=new ResizeObserver(s=>{s.forEach(l=>{if(l.target===o){let{width:p,height:n}=l.contentRect,d={...e};t.trackWidth&&p!==e.width&&(d.width=p),t.trackHeight&&n!==e.height&&(d.height=n),(d.width!==e.width||d.height!==e.height)&&a(d)}})});return r.observe(o),()=>{r.disconnect()}},[o,t.trackWidth,t.trackHeight,e]),e};var yo=c(require("react"),1);var co={initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}}};var mo=c(require("@emotion/styled"),1),fo=require("framer-motion"),uo=(0,mo.default)(fo.motion.div)`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
width: 100%;
|
|
10
10
|
height: 100%;
|
|
11
11
|
background: rgba(51, 51, 51, 0.6);
|
|
12
|
-
`;var
|
|
12
|
+
`;var le=({children:o})=>yo.default.createElement(uo,{variants:co,initial:"initial",animate:"animate",exit:"exit"},o),go=le;var ho=require("react-dom"),L=require("framer-motion"),xo=c(require("@emotion/styled"),1),de=(0,xo.default)(L.motion.div)`
|
|
13
13
|
position: relative;
|
|
14
14
|
display: flex;
|
|
15
15
|
align-items: center;
|
|
@@ -19,88 +19,88 @@
|
|
|
19
19
|
padding: 32px 20px;
|
|
20
20
|
width: 100%;
|
|
21
21
|
height: 100%;
|
|
22
|
-
`,
|
|
22
|
+
`,ce=()=>{let o=g(t=>t.modal);return S.default.createElement(S.default.Fragment,null,(0,ho.createPortal)(S.default.createElement(L.AnimatePresence,null,o.map((t,e)=>S.default.createElement(go,{key:e},S.default.createElement(de,null,t.component)))),document.body))},H=ce;var me=({children:o,domain:t="SHOPL"})=>(W({domain:t}),V.default.createElement(V.default.Fragment,null,V.default.createElement(H,null),o)),To=me;var fe="var(--font-weight-regular)",ue="var(--font-weight-medium)",ye="var(--font-weight-bold)",So={fontWeightRegular:fe,fontWeightMedium:ue,fontWeightBold:ye},ge="var(--border-radius04)",he="var(--border-radius06)",xe="var(--border-radius08)",Te="var(--border-radius12)",Se="var(--border-radius16)",be="var(--border-radius20)",f={borderRadius04:ge,borderRadius06:he,borderRadius08:xe,borderRadius12:Te,borderRadius16:Se,borderRadius20:be},Me="var(--coolgray300)",ke="var(--coolgray200)",ve="var(--coolgray100)",Ce="var(--coolgray50)",Pe="var(--navy400)",_e="var(--navy300)",Be="var(--neutral0)",we="var(--neutral100)",Ee="var(--neutral150)",$e="var(--neutral200)",Oe="var(--neutral300)",De="var(--neutral350)",Le="var(--neutral400)",He="var(--neutral500)",Ve="var(--neutral600)",Re="var(--neutral700)",ze="var(--neutral400_5)",Ae="var(--red300)",Ne="var(--red200)",Xe="var(--red100)",Fe="var(--ocean300)",Ie="var(--ocean200)",We="var(--ocean100)",Ye="var(--purple400)",Ke="var(--purple300)",je="var(--purple100)",Ue="var(--yellow300)",Ze="var(--yellow200)",Ge="var(--yellow100)",qe="var(--green300)",Je="var(--green200)",Qe="var(--green100)",ot="var(--shopl400)",et="var(--shopl300)",tt="var(--shopl200)",rt="var(--shopl150)",nt="var(--shopl100)",at="var(--hada400)",it="var(--hada300)",pt="var(--hada200)",st="var(--hada150)",lt="var(--hada100)",dt="var(--background)",ct="var(--primary100)",mt="var(--primary150)",ft="var(--primary200)",ut="var(--primary300)",yt="var(--primary400)",i={coolgray300:Me,coolgray200:ke,coolgray100:ve,coolgray50:Ce,navy400:Pe,navy300:_e,neutral0:Be,neutral100:we,neutral150:Ee,neutral200:$e,neutral300:Oe,neutral350:De,neutral400:Le,neutral500:He,neutral600:Ve,neutral700:Re,neutral400_5:ze,red300:Ae,red200:Ne,red100:Xe,ocean300:Fe,ocean200:Ie,ocean100:We,purple400:Ye,purple300:Ke,purple100:je,yellow300:Ue,yellow200:Ze,yellow100:Ge,green300:qe,green200:Je,green100:Qe,shopl400:ot,shopl300:et,shopl200:tt,shopl150:rt,shopl100:nt,hada400:at,hada300:it,hada200:pt,hada150:st,hada100:lt,background:dt,primary100:ct,primary150:mt,primary200:ft,primary300:ut,primary400:yt},gt="var(--spacing04)",ht="var(--spacing06)",xt="var(--spacing08)",Tt="var(--spacing12)",St="var(--spacing16)",bt="var(--spacing20)",Mt="var(--spacing24)",kt="var(--spacing30)",vt="var(--spacing32)",Ct="var(--spacing40)",R={spacing04:gt,spacing06:ht,spacing08:xt,spacing12:Tt,spacing16:St,spacing20:bt,spacing24:Mt,spacing30:kt,spacing32:vt,spacing40:Ct},Pt="var(--dropShadow)",z={dropShadow:Pt},_t=".heading1_700",Bt=".heading1_400",wt=".heading2_700",Et=".heading2_400",$t=".heading3_700",Ot=".heading3_400",Dt=".title1_700",Lt=".title1_400",Ht=".title2_700",Vt=".title2_500",Rt=".title2_400",zt=".body1_700",At=".body1_500",Nt=".body1_400",Xt=".body2_700",Ft=".body2_500",It=".body2_400",Wt=".body3_400",Yt=".body3_500",Kt=".caption_400",bo={heading1_700:_t,heading1_400:Bt,heading2_700:wt,heading2_400:Et,heading3_700:$t,heading3_400:Ot,title1_700:Dt,title1_400:Lt,title2_700:Ht,title2_500:Vt,title2_400:Rt,body1_700:zt,body1_500:At,body1_400:Nt,body2_700:Xt,body2_500:Ft,body2_400:It,body3_400:Wt,body3_500:Yt,caption_400:Kt};var A=c(require("react"),1),N=require("framer-motion");var Mo=c(require("@emotion/styled"),1);var K=Mo.default.div`
|
|
23
23
|
display: flex;
|
|
24
24
|
width: ${({width:o})=>o};
|
|
25
25
|
height: ${({height:o})=>o};
|
|
26
26
|
flex-direction: ${({direction:o})=>o};
|
|
27
27
|
align-items: ${({align:o})=>o};
|
|
28
28
|
justify-content: ${({justify:o})=>o};
|
|
29
|
-
gap: ${({spacing:o})=>o&&
|
|
29
|
+
gap: ${({spacing:o})=>o&&R[o]};
|
|
30
30
|
flex-wrap: ${({flexWrap:o})=>o};
|
|
31
31
|
flex: ${({flex:o})=>o};
|
|
32
|
-
background: ${({background:o})=>o?
|
|
33
|
-
border-radius: ${({radius:o})=>o&&
|
|
32
|
+
background: ${({background:o})=>o?i[o]:"transparent"};
|
|
33
|
+
border-radius: ${({radius:o})=>o&&f[o]};
|
|
34
34
|
animation: 0.2s all ease-in-out;
|
|
35
|
-
`;var
|
|
35
|
+
`;var j=o=>(0,A.forwardRef)(function({as:e="div",spacing:a=o?.spacing??"spacing08",direction:r=o?.direction??"column",align:s=o?.align??"flex-start",justify:l=o?.justify??"flex-start",width:p=o?.width??"initial",height:n=o?.height??"initial",flexWrap:d=o?.flexWrap??"initial",flex:m=o?.flex??"initial",radius:y=o?.radius,background:v=o?.background,...C},x){return A.default.createElement(K,{as:e,spacing:a,ref:x,direction:r,align:s,justify:l,width:p,height:n,flexWrap:d,flex:m,background:v,radius:y,...C},C.children)}),b=j();b.Vertical=j({direction:"column"});b.Horizontal=j({direction:"row"});var U=(0,N.motion)(b);U.Vertical=(0,N.motion)(b.Vertical);U.Horizontal=(0,N.motion)(b.Horizontal);var ko=b;var X=c(require("react"),1);var _=require("@emotion/react"),vo=c(require("@emotion/styled"),1);var jt=o=>_.css`
|
|
36
36
|
display: -webkit-box;
|
|
37
37
|
line-clamp: ${o};
|
|
38
38
|
-webkit-line-clamp: ${o};
|
|
39
39
|
-webkit-box-orient: vertical;
|
|
40
40
|
overflow: hidden;
|
|
41
41
|
text-overflow: ellipsis;
|
|
42
|
-
`,
|
|
42
|
+
`,Co=vo.default.span`
|
|
43
43
|
display: ${({display:o})=>o&&o};
|
|
44
44
|
align-items: center;
|
|
45
|
-
color: ${({color:o})=>o&&
|
|
46
|
-
${({lineClamp:o})=>o&&
|
|
45
|
+
color: ${({color:o})=>o&&i[o]};
|
|
46
|
+
${({lineClamp:o})=>o&&jt(o)};
|
|
47
47
|
text-align: ${({textAlign:o})=>o&&o};
|
|
48
48
|
white-space: ${({whiteSpace:o})=>o&&o};
|
|
49
|
-
${({textDecorations:o})=>o&&
|
|
49
|
+
${({textDecorations:o})=>o&&_.css`
|
|
50
50
|
text-decoration: ${o};
|
|
51
51
|
`};
|
|
52
|
-
${({opacity:o})=>o&&
|
|
52
|
+
${({opacity:o})=>o&&_.css`
|
|
53
53
|
opacity: ${o};
|
|
54
54
|
`}
|
|
55
|
-
${({wordBreak:o})=>o&&
|
|
55
|
+
${({wordBreak:o})=>o&&_.css`
|
|
56
56
|
word-break: ${o};
|
|
57
57
|
`};
|
|
58
|
-
`;var
|
|
58
|
+
`;var Ut=(0,X.forwardRef)(({children:o,typography:t="body1_400",whiteSpace:e,color:a="neutral700",display:r="inline-block",textAlign:s="inherit",className:l,...p},n)=>X.default.createElement(Co,{ref:n,whiteSpace:e,className:l?`${t} ${l}`:t,color:a,display:r,textAlign:s,...p},o)),M=Ut;var u=c(require("react"),1);var k=c(require("@emotion/styled"),1),Z=require("@emotion/react");var Zt=400,Gt=500,qt=560,Po=640,Jt=768,Qt=1040,or=1280,G=o=>{switch(o){case"XXS":return Zt;case"XS":return Gt;case"S":return qt;case"M":return Po;case"L":return Jt;case"XL":return Qt;case"XXL":return or;default:return Po}},er=o=>o?Z.css`
|
|
59
59
|
padding-top: 16px;
|
|
60
60
|
padding-bottom: 24px;
|
|
61
|
-
`:
|
|
61
|
+
`:Z.css`
|
|
62
62
|
padding-top: 24px;
|
|
63
63
|
padding-bottom: 24px;
|
|
64
|
-
`,
|
|
64
|
+
`,_o=k.default.div`
|
|
65
65
|
display: flex;
|
|
66
66
|
flex-direction: column;
|
|
67
|
-
border-radius: ${
|
|
68
|
-
background: ${
|
|
69
|
-
box-shadow: ${
|
|
67
|
+
border-radius: ${f.borderRadius08};
|
|
68
|
+
background: ${i.neutral0};
|
|
69
|
+
box-shadow: ${z.dropShadow};
|
|
70
70
|
overflow: hidden;
|
|
71
71
|
flex-grow: 1;
|
|
72
72
|
height: initial;
|
|
73
73
|
height: ${({height:o})=>o}px;
|
|
74
74
|
max-height: 1200px;
|
|
75
|
-
width: ${({sizeVar:o})=>
|
|
76
|
-
max-width: ${({sizeVar:o})=>
|
|
77
|
-
`,
|
|
75
|
+
width: ${({sizeVar:o})=>G(o)}px;
|
|
76
|
+
max-width: ${({sizeVar:o})=>G(o)}px;
|
|
77
|
+
`,Bo=k.default.div`
|
|
78
78
|
display: flex;
|
|
79
79
|
width: 100%;
|
|
80
80
|
justify-content: space-between;
|
|
81
81
|
align-items: center;
|
|
82
82
|
padding: 12px 16px 12px 24px;
|
|
83
83
|
gap: 10px;
|
|
84
|
-
`,
|
|
84
|
+
`,wo=k.default.div`
|
|
85
85
|
display: flex;
|
|
86
86
|
width: 100%;
|
|
87
87
|
height: 100%;
|
|
88
88
|
overflow: hidden;
|
|
89
89
|
flex-direction: column;
|
|
90
|
-
background: ${
|
|
90
|
+
background: ${i.neutral0};
|
|
91
91
|
min-height: ${({height:o})=>o};
|
|
92
92
|
flex: 1;
|
|
93
|
-
${({isIncludeHeader:o})
|
|
94
|
-
`,
|
|
93
|
+
${({isIncludeHeader:o})=>er(o)}
|
|
94
|
+
`,Eo=k.default.div`
|
|
95
95
|
display: flex;
|
|
96
96
|
flex-direction: column;
|
|
97
97
|
width: 100%;
|
|
98
|
-
max-width: ${({sizeVar:o})=>
|
|
98
|
+
max-width: ${({sizeVar:o})=>G(o)}px;
|
|
99
99
|
box-sizing: border-box;
|
|
100
100
|
padding: 0 24px;
|
|
101
101
|
overflow: hidden;
|
|
102
|
-
background: ${
|
|
103
|
-
|
|
102
|
+
background: ${i.neutral0};
|
|
103
|
+
`,$o=k.default.div`
|
|
104
104
|
display: flex;
|
|
105
105
|
width: 100%;
|
|
106
106
|
flex-direction: row;
|
|
@@ -108,5 +108,71 @@
|
|
|
108
108
|
justify-content: flex-end;
|
|
109
109
|
padding: 16px 24px;
|
|
110
110
|
gap: 12px;
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
border-top: 1px solid ${i.neutral300};
|
|
112
|
+
background: ${i.neutral0};
|
|
113
|
+
`;var Oo=(p=>(p.XXS="XXS",p.XS="XS",p.S="S",p.M="M",p.L="L",p.XL="XL",p.XXL="XXL",p))(Oo||{}),B=Symbol("MODAL_HEADER"),q=Symbol("MODAL_BODY"),w=Symbol("MODAL_FOOTER");var Do=function(){};var tr=({children:o,outsideClick:t=Do,...e})=>{let a=u.default.useRef(null);lo(t,a);let r=u.default.Children.toArray(o),s=r.find(n=>{if(!u.default.isValidElement(n)||n.type[B])return n}),l=r.find(n=>{if(!u.default.isValidElement(n)||n.type[w])return n}),p=u.Children.map(r,n=>u.default.isValidElement(n)?u.default.cloneElement(n,{isIncludeHeader:!!s,isIncludeFooter:!!l,sizeVar:e.sizeVar,height:e.height}):n);return u.default.createElement(_o,{ref:a,...e},p)},Lo=tr;var Ho=c(require("react"),1);var Vo=({children:o})=>Ho.default.createElement($o,null,o);Vo[w]=!0;var Ro=Vo;var h=c(require("react"),1);var zo=c(require("react-custom-scrollbars-2"),1);var Ao=({children:o,isIncludeHeader:t=!1,isIncludeFooter:e=!1,sizeVar:a,height:r})=>{let{height:s}=Y(document.body,{trackHeight:!0}),l=64,p=64,n=64,d=(0,h.useCallback)(()=>{let x=0;return t&&(x+=l),e&&(x+=p),x},[e,t]),m=(0,h.useMemo)(()=>d(),[d]),y=()=>r?r-m:"100%",v=s-n-m,C=1200-n-m;return h.default.createElement(wo,{isIncludeHeader:t,height:y()},h.default.createElement(zo.default,{id:"scrollbar",autoHeight:!r,autoHeightMin:y(),autoHeightMax:s>1200?C:v,autoHide:!0,autoHideTimeout:1e3,autoHideDuration:200,style:{height:"100%",overflow:"hidden"}},h.default.createElement(Eo,{isIncludeHeader:t,sizeVar:a},o)))};Ao[q]=!0;var No=Ao;var Xo=c(require("react"),1);var Fo=({children:o})=>Xo.default.createElement(Bo,null,o);Fo[B]=!0;var Io=Fo;var rr={Container:Lo,Header:Io,Body:No,Footer:Ro};var oo=c(require("react"),1);var E=require("react"),Wo=(o,t)=>{let[e,a]=(0,E.useState)(!1),r=o!==void 0,s=()=>{!r&&a(l=>!l)};return(0,E.useEffect)(()=>{r&&a(o)},[r,o]),(0,E.useEffect)(()=>{t&&a(t)},[t,r]),[e,s]};var J={SOLID:"SOLID"},nr={S:"S",XS:"XS"};var Ko=c(require("@emotion/styled"),1),I=require("@emotion/react");var Yo=require("@emotion/react"),F=o=>{if(o)return Yo.css`
|
|
114
|
+
opacity: 50%;
|
|
115
|
+
cursor: not-allowed;
|
|
116
|
+
`};var jo=o=>{switch(o){case"XS":return"body3_400";case"S":return"body2_400";default:return"body2_400"}},ar=({isSelected:o,color:t,radius:e})=>I.css`
|
|
117
|
+
padding: 7px 12px;
|
|
118
|
+
gap: 4px;
|
|
119
|
+
background: ${i.neutral150};
|
|
120
|
+
border-radius: ${f.borderRadius06};
|
|
121
|
+
& > span {
|
|
122
|
+
color: ${i.neutral400};
|
|
123
|
+
}
|
|
124
|
+
&:hover {
|
|
125
|
+
background: ${i.neutral200};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
${e&&I.css`
|
|
129
|
+
border-radius: ${f.borderRadius16};
|
|
130
|
+
`};
|
|
131
|
+
${o&&I.css`
|
|
132
|
+
background: ${i[t]};
|
|
133
|
+
& > span {
|
|
134
|
+
color: ${i.neutral0};
|
|
135
|
+
}
|
|
136
|
+
&:hover {
|
|
137
|
+
background: ${i[t]};
|
|
138
|
+
}
|
|
139
|
+
`};
|
|
140
|
+
`,Q=Ko.default.button`
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: center;
|
|
143
|
+
justify-content: center;
|
|
144
|
+
border: none;
|
|
145
|
+
width: fit-content;
|
|
146
|
+
user-select: none;
|
|
147
|
+
cursor: pointer;
|
|
148
|
+
${o=>o.styleVar==="SOLID"&&ar(o)};
|
|
149
|
+
${({disabled:o})=>F(o)};
|
|
150
|
+
`;var Uo=require("@shoplflow/utils"),ir=({text:o,isSelected:t,defaultSelected:e,color:a="neutral600",styleVar:r=J.SOLID,sizeVar:s,leftSource:l,rightSource:p,onClick:n=Uo.noop,disabled:d=!1,...m})=>{let[y,v]=Wo(t,e);return oo.default.createElement(Q,{...m,color:a,isSelected:y,styleVar:r,sizeVar:s,onClick:x=>{!d&&v(),!d&&n&&n(x)},disabled:d},l,oo.default.createElement(M,{typography:jo(s)},o),p)},Zo=ir;var ao=c(require("react"),1);var Go=c(require("@emotion/styled"),1),$=require("@emotion/react");var eo=(o,t=1)=>{let e=o.replace(/[0-9]|_/g,""),a=o.replace(/[a-z]|_/g,""),r=Number(a)+100*t,s=`${e}${r}`,l=Object.keys(i).filter(m=>m.includes(e)).sort((m,y)=>Number(m.replace(/[a-z]|_/g,""))-Number(y.replace(/[a-z]|_/g,""))),n=Object.keys(i).find(m=>m===s),d=l[l.length-1];return n||d};var qo=o=>{switch(o){case"XS":return"caption_400";case"S":return"body3_400";default:return"body3_400"}},pr=({color:o})=>$.css`
|
|
151
|
+
background: ${i.neutral0};
|
|
152
|
+
border: 1px solid ${i[o]};
|
|
153
|
+
border-radius: ${f.borderRadius20};
|
|
154
|
+
&:hover {
|
|
155
|
+
border: 1px solid ${i[eo(o,2)]};
|
|
156
|
+
}
|
|
157
|
+
& > span {
|
|
158
|
+
color: ${i[eo(o,4)]};
|
|
159
|
+
}
|
|
160
|
+
`,sr=o=>{switch(o){case"XS":return $.css`
|
|
161
|
+
padding: 4px 8px;
|
|
162
|
+
`;case"S":return $.css`
|
|
163
|
+
padding: 7px 12px;
|
|
164
|
+
`;default:return $.css`
|
|
165
|
+
padding: 7px 12px;
|
|
166
|
+
`}},to=Go.default.button`
|
|
167
|
+
display: flex;
|
|
168
|
+
align-items: center;
|
|
169
|
+
justify-content: center;
|
|
170
|
+
border: none;
|
|
171
|
+
width: fit-content;
|
|
172
|
+
gap: 4px;
|
|
173
|
+
cursor: pointer;
|
|
174
|
+
background: ${({background:o})=>o&&i[o]};
|
|
175
|
+
${({sizeVar:o})=>sr(o)};
|
|
176
|
+
${o=>o.styleVar==="LINE"&&pr(o)};
|
|
177
|
+
${({disabled:o})=>F(o)};
|
|
178
|
+
`;var Jo=require("@shoplflow/utils");var ro={LINE:"LINE"},no={S:"S",XS:"XS"};var lr=({styleVar:o=ro.LINE,color:t="neutral200",sizeVar:e=no.S,text:a,onClick:r=Jo.noop,disabled:s=!1,...l})=>ao.default.createElement(to,{styleVar:o,color:t,...l,onClick:n=>{!s&&r(n)},disabled:s},ao.default.createElement(M,{typography:qo(e)},a)),Qo=lr;0&&(module.exports={ChipButton,ChipButtonSizeVariants,ChipButtonStyleVariants,ChipToggle,ChipToggleSizeVariants,ChipToggleStyleVariants,MODAL_BODY_KEY,MODAL_FOOTER_KEY,MODAL_HEADER_KEY,Modal,ModalProvider,ModalSize,MotionStack,ShoplflowProvider,Stack,StyledChip,StyledChipButton,StyledStack,Text,borderRadiusTokens,boxShadowTokens,colorTokens,fontWeightTokens,spacingTokens,typographyTokens,useDomain,useHandleModal,useModalStore,useModalValue,useOutsideClick,useResizeObserver});
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useEffect as
|
|
1
|
+
import w from"react";import{useEffect as z,useState as Mo}from"react";var A=({domain:o="SHOPL"})=>{let[t,e]=Mo(void 0);z(()=>{o&&e(o)},[o]),z(()=>{t&&(document.documentElement.dataset.shoplflow=t?.toLowerCase())},[t])};import S from"react";import{create as ko}from"zustand";var y=ko(o=>({modal:[],addModal:(t,e)=>o(a=>({modal:[...a.modal,{component:t,id:e}]})),removeModal:t=>{let{id:e,deps:a=1}=t||{id:void 0,deps:0},n=!!(e&&String(a)),s=!!e,l=!e&&!a,p=!!String(a)&&!e;if(n)throw new Error("id\uC640 deps\uB294 \uB3D9\uC2DC\uC5D0 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");if(s){o(r=>({modal:[...r.modal.filter(c=>c.id!==e)]}));return}if(l||a===1){o(r=>({modal:[...r.modal.slice(0,-1)]}));return}if(p){o(r=>({modal:[...r.modal.slice(0,-a+1)]}));return}}}));var mr=()=>{let o=y(e=>e.addModal),t=y(e=>e.removeModal);return{addModal:o,removeModal:t}};var yr=()=>({modal:y(t=>t.modal)});import{useCallback as vo,useEffect as Co,useRef as Po}from"react";var _o=(o,t)=>{let e=t??Po(null),a=vo(n=>{e.current?.parentNode&&!e.current?.contains(n.target)&&o(n.target)},[e,o]);return Co(()=>{let n=e.current?.parentNode;if(n)return n.addEventListener("click",a),()=>{n.removeEventListener("click",a)}},[e,a]),{ref:e}},N=_o;import{useEffect as Bo,useState as wo}from"react";var X=(o,t={trackWidth:!0,trackHeight:!0})=>{let[e,a]=wo({width:0,height:0});return Bo(()=>{let n=new ResizeObserver(s=>{s.forEach(l=>{if(l.target===o){let{width:p,height:r}=l.contentRect,d={...e};t.trackWidth&&p!==e.width&&(d.width=p),t.trackHeight&&r!==e.height&&(d.height=r),(d.width!==e.width||d.height!==e.height)&&a(d)}})});return n.observe(o),()=>{n.disconnect()}},[o,t.trackWidth,t.trackHeight,e]),e};import Oo from"react";var F={initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}}};import Eo from"@emotion/styled";import{motion as $o}from"framer-motion";var I=Eo($o.div)`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
@@ -9,7 +9,7 @@ import{useEffect as E,useState as no}from"react";var O=({domain:o="SHOPL"})=>{le
|
|
|
9
9
|
width: 100%;
|
|
10
10
|
height: 100%;
|
|
11
11
|
background: rgba(51, 51, 51, 0.6);
|
|
12
|
-
`;
|
|
12
|
+
`;var Do=({children:o})=>Oo.createElement(I,{variants:F,initial:"initial",animate:"animate",exit:"exit"},o),W=Do;import{createPortal as Lo}from"react-dom";import{AnimatePresence as Ho,motion as Vo}from"framer-motion";import Ro from"@emotion/styled";var zo=Ro(Vo.div)`
|
|
13
13
|
position: relative;
|
|
14
14
|
display: flex;
|
|
15
15
|
align-items: center;
|
|
@@ -19,88 +19,88 @@ import{useEffect as E,useState as no}from"react";var O=({domain:o="SHOPL"})=>{le
|
|
|
19
19
|
padding: 32px 20px;
|
|
20
20
|
width: 100%;
|
|
21
21
|
height: 100%;
|
|
22
|
-
`,
|
|
22
|
+
`,Ao=()=>{let o=y(t=>t.modal);return S.createElement(S.Fragment,null,Lo(S.createElement(Ho,null,o.map((t,e)=>S.createElement(W,{key:e},S.createElement(zo,null,t.component)))),document.body))},B=Ao;var No=({children:o,domain:t="SHOPL"})=>(A({domain:t}),w.createElement(w.Fragment,null,w.createElement(B,null),o)),Xo=No;var Fo="var(--font-weight-regular)",Io="var(--font-weight-medium)",Wo="var(--font-weight-bold)",Yo={fontWeightRegular:Fo,fontWeightMedium:Io,fontWeightBold:Wo},Ko="var(--border-radius04)",jo="var(--border-radius06)",Uo="var(--border-radius08)",Zo="var(--border-radius12)",Go="var(--border-radius16)",qo="var(--border-radius20)",m={borderRadius04:Ko,borderRadius06:jo,borderRadius08:Uo,borderRadius12:Zo,borderRadius16:Go,borderRadius20:qo},Jo="var(--coolgray300)",Qo="var(--coolgray200)",oe="var(--coolgray100)",ee="var(--coolgray50)",te="var(--navy400)",re="var(--navy300)",ne="var(--neutral0)",ae="var(--neutral100)",ie="var(--neutral150)",pe="var(--neutral200)",se="var(--neutral300)",le="var(--neutral350)",de="var(--neutral400)",ce="var(--neutral500)",me="var(--neutral600)",fe="var(--neutral700)",ue="var(--neutral400_5)",ye="var(--red300)",ge="var(--red200)",he="var(--red100)",xe="var(--ocean300)",Te="var(--ocean200)",Se="var(--ocean100)",be="var(--purple400)",Me="var(--purple300)",ke="var(--purple100)",ve="var(--yellow300)",Ce="var(--yellow200)",Pe="var(--yellow100)",_e="var(--green300)",Be="var(--green200)",we="var(--green100)",Ee="var(--shopl400)",$e="var(--shopl300)",Oe="var(--shopl200)",De="var(--shopl150)",Le="var(--shopl100)",He="var(--hada400)",Ve="var(--hada300)",Re="var(--hada200)",ze="var(--hada150)",Ae="var(--hada100)",Ne="var(--background)",Xe="var(--primary100)",Fe="var(--primary150)",Ie="var(--primary200)",We="var(--primary300)",Ye="var(--primary400)",i={coolgray300:Jo,coolgray200:Qo,coolgray100:oe,coolgray50:ee,navy400:te,navy300:re,neutral0:ne,neutral100:ae,neutral150:ie,neutral200:pe,neutral300:se,neutral350:le,neutral400:de,neutral500:ce,neutral600:me,neutral700:fe,neutral400_5:ue,red300:ye,red200:ge,red100:he,ocean300:xe,ocean200:Te,ocean100:Se,purple400:be,purple300:Me,purple100:ke,yellow300:ve,yellow200:Ce,yellow100:Pe,green300:_e,green200:Be,green100:we,shopl400:Ee,shopl300:$e,shopl200:Oe,shopl150:De,shopl100:Le,hada400:He,hada300:Ve,hada200:Re,hada150:ze,hada100:Ae,background:Ne,primary100:Xe,primary150:Fe,primary200:Ie,primary300:We,primary400:Ye},Ke="var(--spacing04)",je="var(--spacing06)",Ue="var(--spacing08)",Ze="var(--spacing12)",Ge="var(--spacing16)",qe="var(--spacing20)",Je="var(--spacing24)",Qe="var(--spacing30)",ot="var(--spacing32)",et="var(--spacing40)",E={spacing04:Ke,spacing06:je,spacing08:Ue,spacing12:Ze,spacing16:Ge,spacing20:qe,spacing24:Je,spacing30:Qe,spacing32:ot,spacing40:et},tt="var(--dropShadow)",$={dropShadow:tt},rt=".heading1_700",nt=".heading1_400",at=".heading2_700",it=".heading2_400",pt=".heading3_700",st=".heading3_400",lt=".title1_700",dt=".title1_400",ct=".title2_700",mt=".title2_500",ft=".title2_400",ut=".body1_700",yt=".body1_500",gt=".body1_400",ht=".body2_700",xt=".body2_500",Tt=".body2_400",St=".body3_400",bt=".body3_500",Mt=".caption_400",kt={heading1_700:rt,heading1_400:nt,heading2_700:at,heading2_400:it,heading3_700:pt,heading3_400:st,title1_700:lt,title1_400:dt,title2_700:ct,title2_500:mt,title2_400:ft,body1_700:ut,body1_500:yt,body1_400:gt,body2_700:ht,body2_500:xt,body2_400:Tt,body3_400:St,body3_500:bt,caption_400:Mt};import Ct,{forwardRef as Pt}from"react";import{motion as O}from"framer-motion";import vt from"@emotion/styled";var Y=vt.div`
|
|
23
23
|
display: flex;
|
|
24
24
|
width: ${({width:o})=>o};
|
|
25
25
|
height: ${({height:o})=>o};
|
|
26
26
|
flex-direction: ${({direction:o})=>o};
|
|
27
27
|
align-items: ${({align:o})=>o};
|
|
28
28
|
justify-content: ${({justify:o})=>o};
|
|
29
|
-
gap: ${({spacing:o})=>o&&
|
|
29
|
+
gap: ${({spacing:o})=>o&&E[o]};
|
|
30
30
|
flex-wrap: ${({flexWrap:o})=>o};
|
|
31
31
|
flex: ${({flex:o})=>o};
|
|
32
|
-
background: ${({background:o})=>o?
|
|
33
|
-
border-radius: ${({radius:o})=>o&&
|
|
32
|
+
background: ${({background:o})=>o?i[o]:"transparent"};
|
|
33
|
+
border-radius: ${({radius:o})=>o&&m[o]};
|
|
34
34
|
animation: 0.2s all ease-in-out;
|
|
35
|
-
`;
|
|
35
|
+
`;var D=o=>Pt(function({as:e="div",spacing:a=o?.spacing??"spacing08",direction:n=o?.direction??"column",align:s=o?.align??"flex-start",justify:l=o?.justify??"flex-start",width:p=o?.width??"initial",height:r=o?.height??"initial",flexWrap:d=o?.flexWrap??"initial",flex:c=o?.flex??"initial",radius:f=o?.radius,background:x=o?.background,...T},u){return Ct.createElement(Y,{as:e,spacing:a,ref:u,direction:n,align:s,justify:l,width:p,height:r,flexWrap:d,flex:c,background:x,radius:f,...T},T.children)}),h=D();h.Vertical=D({direction:"column"});h.Horizontal=D({direction:"row"});var K=O(h);K.Vertical=O(h.Vertical);K.Horizontal=O(h.Horizontal);var _t=h;import Et,{forwardRef as $t}from"react";import{css as k}from"@emotion/react";import Bt from"@emotion/styled";var wt=o=>k`
|
|
36
36
|
display: -webkit-box;
|
|
37
37
|
line-clamp: ${o};
|
|
38
38
|
-webkit-line-clamp: ${o};
|
|
39
39
|
-webkit-box-orient: vertical;
|
|
40
40
|
overflow: hidden;
|
|
41
41
|
text-overflow: ellipsis;
|
|
42
|
-
`,
|
|
42
|
+
`,j=Bt.span`
|
|
43
43
|
display: ${({display:o})=>o&&o};
|
|
44
44
|
align-items: center;
|
|
45
|
-
color: ${({color:o})=>o&&
|
|
46
|
-
${({lineClamp:o})=>o&&
|
|
45
|
+
color: ${({color:o})=>o&&i[o]};
|
|
46
|
+
${({lineClamp:o})=>o&&wt(o)};
|
|
47
47
|
text-align: ${({textAlign:o})=>o&&o};
|
|
48
48
|
white-space: ${({whiteSpace:o})=>o&&o};
|
|
49
|
-
${({textDecorations:o})=>o&&
|
|
49
|
+
${({textDecorations:o})=>o&&k`
|
|
50
50
|
text-decoration: ${o};
|
|
51
51
|
`};
|
|
52
|
-
${({opacity:o})=>o&&
|
|
52
|
+
${({opacity:o})=>o&&k`
|
|
53
53
|
opacity: ${o};
|
|
54
54
|
`}
|
|
55
|
-
${({wordBreak:o})=>o&&
|
|
55
|
+
${({wordBreak:o})=>o&&k`
|
|
56
56
|
word-break: ${o};
|
|
57
57
|
`};
|
|
58
|
-
`;
|
|
58
|
+
`;var Ot=$t(({children:o,typography:t="body1_400",whiteSpace:e,color:a="neutral700",display:n="inline-block",textAlign:s="inherit",className:l,...p},r)=>Et.createElement(j,{ref:r,whiteSpace:e,className:l?`${t} ${l}`:t,color:a,display:n,textAlign:s,...p},o)),b=Ot;import g,{Children as Xt}from"react";import M from"@emotion/styled";import{css as U}from"@emotion/react";var Dt=400,Lt=500,Ht=560,Z=640,Vt=768,Rt=1040,zt=1280,L=o=>{switch(o){case"XXS":return Dt;case"XS":return Lt;case"S":return Ht;case"M":return Z;case"L":return Vt;case"XL":return Rt;case"XXL":return zt;default:return Z}},At=o=>o?U`
|
|
59
59
|
padding-top: 16px;
|
|
60
60
|
padding-bottom: 24px;
|
|
61
|
-
`:
|
|
61
|
+
`:U`
|
|
62
62
|
padding-top: 24px;
|
|
63
63
|
padding-bottom: 24px;
|
|
64
|
-
`,
|
|
64
|
+
`,G=M.div`
|
|
65
65
|
display: flex;
|
|
66
66
|
flex-direction: column;
|
|
67
|
-
border-radius: ${
|
|
68
|
-
background: ${
|
|
69
|
-
box-shadow: ${
|
|
67
|
+
border-radius: ${m.borderRadius08};
|
|
68
|
+
background: ${i.neutral0};
|
|
69
|
+
box-shadow: ${$.dropShadow};
|
|
70
70
|
overflow: hidden;
|
|
71
71
|
flex-grow: 1;
|
|
72
72
|
height: initial;
|
|
73
73
|
height: ${({height:o})=>o}px;
|
|
74
74
|
max-height: 1200px;
|
|
75
|
-
width: ${({sizeVar:o})=>
|
|
76
|
-
max-width: ${({sizeVar:o})=>
|
|
77
|
-
`,
|
|
75
|
+
width: ${({sizeVar:o})=>L(o)}px;
|
|
76
|
+
max-width: ${({sizeVar:o})=>L(o)}px;
|
|
77
|
+
`,q=M.div`
|
|
78
78
|
display: flex;
|
|
79
79
|
width: 100%;
|
|
80
80
|
justify-content: space-between;
|
|
81
81
|
align-items: center;
|
|
82
82
|
padding: 12px 16px 12px 24px;
|
|
83
83
|
gap: 10px;
|
|
84
|
-
`,
|
|
84
|
+
`,J=M.div`
|
|
85
85
|
display: flex;
|
|
86
86
|
width: 100%;
|
|
87
87
|
height: 100%;
|
|
88
88
|
overflow: hidden;
|
|
89
89
|
flex-direction: column;
|
|
90
|
-
background: ${
|
|
90
|
+
background: ${i.neutral0};
|
|
91
91
|
min-height: ${({height:o})=>o};
|
|
92
92
|
flex: 1;
|
|
93
|
-
${({isIncludeHeader:o})=>
|
|
94
|
-
`,
|
|
93
|
+
${({isIncludeHeader:o})=>At(o)}
|
|
94
|
+
`,Q=M.div`
|
|
95
95
|
display: flex;
|
|
96
96
|
flex-direction: column;
|
|
97
97
|
width: 100%;
|
|
98
|
-
max-width: ${({sizeVar:o})=>
|
|
98
|
+
max-width: ${({sizeVar:o})=>L(o)}px;
|
|
99
99
|
box-sizing: border-box;
|
|
100
100
|
padding: 0 24px;
|
|
101
101
|
overflow: hidden;
|
|
102
|
-
background: ${
|
|
103
|
-
`,
|
|
102
|
+
background: ${i.neutral0};
|
|
103
|
+
`,oo=M.div`
|
|
104
104
|
display: flex;
|
|
105
105
|
width: 100%;
|
|
106
106
|
flex-direction: row;
|
|
@@ -108,5 +108,71 @@ import{useEffect as E,useState as no}from"react";var O=({domain:o="SHOPL"})=>{le
|
|
|
108
108
|
justify-content: flex-end;
|
|
109
109
|
padding: 16px 24px;
|
|
110
110
|
gap: 12px;
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
border-top: 1px solid ${i.neutral300};
|
|
112
|
+
background: ${i.neutral0};
|
|
113
|
+
`;var Nt=(p=>(p.XXS="XXS",p.XS="XS",p.S="S",p.M="M",p.L="L",p.XL="XL",p.XXL="XXL",p))(Nt||{}),v=Symbol("MODAL_HEADER"),eo=Symbol("MODAL_BODY"),C=Symbol("MODAL_FOOTER");var to=function(){};var Ft=({children:o,outsideClick:t=to,...e})=>{let a=g.useRef(null);N(t,a);let n=g.Children.toArray(o),s=n.find(r=>{if(!g.isValidElement(r)||r.type[v])return r}),l=n.find(r=>{if(!g.isValidElement(r)||r.type[C])return r}),p=Xt.map(n,r=>g.isValidElement(r)?g.cloneElement(r,{isIncludeHeader:!!s,isIncludeFooter:!!l,sizeVar:e.sizeVar,height:e.height}):r);return g.createElement(G,{ref:a,...e},p)},ro=Ft;import It from"react";var no=({children:o})=>It.createElement(oo,null,o);no[C]=!0;var ao=no;import H,{useCallback as Wt,useMemo as Yt}from"react";import Kt from"react-custom-scrollbars-2";var io=({children:o,isIncludeHeader:t=!1,isIncludeFooter:e=!1,sizeVar:a,height:n})=>{let{height:s}=X(document.body,{trackHeight:!0}),l=64,p=64,r=64,d=Wt(()=>{let u=0;return t&&(u+=l),e&&(u+=p),u},[e,t]),c=Yt(()=>d(),[d]),f=()=>n?n-c:"100%",x=s-r-c,T=1200-r-c;return H.createElement(J,{isIncludeHeader:t,height:f()},H.createElement(Kt,{id:"scrollbar",autoHeight:!n,autoHeightMin:f(),autoHeightMax:s>1200?T:x,autoHide:!0,autoHideTimeout:1e3,autoHideDuration:200,style:{height:"100%",overflow:"hidden"}},H.createElement(Q,{isIncludeHeader:t,sizeVar:a},o)))};io[eo]=!0;var po=io;import jt from"react";var so=({children:o})=>jt.createElement(q,null,o);so[v]=!0;var lo=so;var Qn={Container:ro,Header:lo,Body:po,Footer:ao};import go from"react";import{useEffect as co,useState as Ut}from"react";var mo=(o,t)=>{let[e,a]=Ut(!1),n=o!==void 0,s=()=>{!n&&a(l=>!l)};return co(()=>{n&&a(o)},[n,o]),co(()=>{t&&a(t)},[t,n]),[e,s]};var fo={SOLID:"SOLID"},ia={S:"S",XS:"XS"};import Gt from"@emotion/styled";import{css as V}from"@emotion/react";import{css as Zt}from"@emotion/react";var P=o=>{if(o)return Zt`
|
|
114
|
+
opacity: 50%;
|
|
115
|
+
cursor: not-allowed;
|
|
116
|
+
`};var uo=o=>{switch(o){case"XS":return"body3_400";case"S":return"body2_400";default:return"body2_400"}},qt=({isSelected:o,color:t,radius:e})=>V`
|
|
117
|
+
padding: 7px 12px;
|
|
118
|
+
gap: 4px;
|
|
119
|
+
background: ${i.neutral150};
|
|
120
|
+
border-radius: ${m.borderRadius06};
|
|
121
|
+
& > span {
|
|
122
|
+
color: ${i.neutral400};
|
|
123
|
+
}
|
|
124
|
+
&:hover {
|
|
125
|
+
background: ${i.neutral200};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
${e&&V`
|
|
129
|
+
border-radius: ${m.borderRadius16};
|
|
130
|
+
`};
|
|
131
|
+
${o&&V`
|
|
132
|
+
background: ${i[t]};
|
|
133
|
+
& > span {
|
|
134
|
+
color: ${i.neutral0};
|
|
135
|
+
}
|
|
136
|
+
&:hover {
|
|
137
|
+
background: ${i[t]};
|
|
138
|
+
}
|
|
139
|
+
`};
|
|
140
|
+
`,yo=Gt.button`
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: center;
|
|
143
|
+
justify-content: center;
|
|
144
|
+
border: none;
|
|
145
|
+
width: fit-content;
|
|
146
|
+
user-select: none;
|
|
147
|
+
cursor: pointer;
|
|
148
|
+
${o=>o.styleVar==="SOLID"&&qt(o)};
|
|
149
|
+
${({disabled:o})=>P(o)};
|
|
150
|
+
`;import{noop as Jt}from"@shoplflow/utils";var Qt=({text:o,isSelected:t,defaultSelected:e,color:a="neutral600",styleVar:n=fo.SOLID,sizeVar:s,leftSource:l,rightSource:p,onClick:r=Jt,disabled:d=!1,...c})=>{let[f,x]=mo(t,e);return go.createElement(yo,{...c,color:a,isSelected:f,styleVar:n,sizeVar:s,onClick:u=>{!d&&x(),!d&&r&&r(u)},disabled:d},l,go.createElement(b,{typography:uo(s)},o),p)},or=Qt;import bo from"react";import er from"@emotion/styled";import{css as _}from"@emotion/react";var R=(o,t=1)=>{let e=o.replace(/[0-9]|_/g,""),a=o.replace(/[a-z]|_/g,""),n=Number(a)+100*t,s=`${e}${n}`,l=Object.keys(i).filter(c=>c.includes(e)).sort((c,f)=>Number(c.replace(/[a-z]|_/g,""))-Number(f.replace(/[a-z]|_/g,""))),r=Object.keys(i).find(c=>c===s),d=l[l.length-1];return r||d};var ho=o=>{switch(o){case"XS":return"caption_400";case"S":return"body3_400";default:return"body3_400"}},tr=({color:o})=>_`
|
|
151
|
+
background: ${i.neutral0};
|
|
152
|
+
border: 1px solid ${i[o]};
|
|
153
|
+
border-radius: ${m.borderRadius20};
|
|
154
|
+
&:hover {
|
|
155
|
+
border: 1px solid ${i[R(o,2)]};
|
|
156
|
+
}
|
|
157
|
+
& > span {
|
|
158
|
+
color: ${i[R(o,4)]};
|
|
159
|
+
}
|
|
160
|
+
`,rr=o=>{switch(o){case"XS":return _`
|
|
161
|
+
padding: 4px 8px;
|
|
162
|
+
`;case"S":return _`
|
|
163
|
+
padding: 7px 12px;
|
|
164
|
+
`;default:return _`
|
|
165
|
+
padding: 7px 12px;
|
|
166
|
+
`}},xo=er.button`
|
|
167
|
+
display: flex;
|
|
168
|
+
align-items: center;
|
|
169
|
+
justify-content: center;
|
|
170
|
+
border: none;
|
|
171
|
+
width: fit-content;
|
|
172
|
+
gap: 4px;
|
|
173
|
+
cursor: pointer;
|
|
174
|
+
background: ${({background:o})=>o&&i[o]};
|
|
175
|
+
${({sizeVar:o})=>rr(o)};
|
|
176
|
+
${o=>o.styleVar==="LINE"&&tr(o)};
|
|
177
|
+
${({disabled:o})=>P(o)};
|
|
178
|
+
`;import{noop as nr}from"@shoplflow/utils";var To={LINE:"LINE"},So={S:"S",XS:"XS"};var ar=({styleVar:o=To.LINE,color:t="neutral200",sizeVar:e=So.S,text:a,onClick:n=nr,disabled:s=!1,...l})=>bo.createElement(xo,{styleVar:o,color:t,...l,onClick:r=>{!s&&n(r)},disabled:s},bo.createElement(b,{typography:ho(e)},a)),ir=ar;export{ir as ChipButton,So as ChipButtonSizeVariants,To as ChipButtonStyleVariants,or as ChipToggle,ia as ChipToggleSizeVariants,fo as ChipToggleStyleVariants,eo as MODAL_BODY_KEY,C as MODAL_FOOTER_KEY,v as MODAL_HEADER_KEY,Qn as Modal,B as ModalProvider,Nt as ModalSize,K as MotionStack,Xo as ShoplflowProvider,_t as Stack,yo as StyledChip,xo as StyledChipButton,Y as StyledStack,b as Text,m as borderRadiusTokens,$ as boxShadowTokens,i as colorTokens,Yo as fontWeightTokens,E as spacingTokens,kt as typographyTokens,A as useDomain,mr as useHandleModal,y as useModalStore,yr as useModalValue,_o as useOutsideClick,X as useResizeObserver};
|
package/dist/styles/tokens.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getDisabledStyle: (disabled?: boolean) => import("@emotion/react").SerializedStyles | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ColorTokens } from '../styles';
|
|
2
|
+
/**
|
|
3
|
+
* 인자로 받은 색상의 다음 색상을 반환합니다.
|
|
4
|
+
* step을 통해 다음 색상의 단계를 설정할 수 있습니다.
|
|
5
|
+
* 만약 다음 색상이 없다면 가장 높은 단계의 색상을 반환합니다.
|
|
6
|
+
* 100단위만 반환하며 50, _5와 같이 예외적인 색상은 반환하지 않습니다.
|
|
7
|
+
* @param {ColorTokens} color
|
|
8
|
+
* @param {number} step
|
|
9
|
+
* @return {ColorTokens}
|
|
10
|
+
*/
|
|
11
|
+
export declare const getNextColor: (color: ColorTokens, step?: number) => ColorTokens;
|
|
@@ -1,8 +1,50 @@
|
|
|
1
1
|
import type { ComponentPropsWithoutRef, ElementType, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import type React from 'react';
|
|
3
|
-
import type { ColorTokens } from '../../styles';
|
|
3
|
+
import type { BorderRadiusTokens, ColorTokens } from '../../styles';
|
|
4
|
+
/**
|
|
5
|
+
* HTML 태그에 대한 타입
|
|
6
|
+
*/
|
|
4
7
|
export type StringElementType = ElementType & string;
|
|
8
|
+
/**
|
|
9
|
+
* Ref를 제외한 HTMLProps를 반환합니다.
|
|
10
|
+
* Generic으로 HTML 태그를 받습니다.
|
|
11
|
+
*/
|
|
5
12
|
export type HTMLPropsWithOutRef<T extends StringElementType> = ComponentPropsWithoutRef<T>;
|
|
13
|
+
export interface DisableProps {
|
|
14
|
+
/**
|
|
15
|
+
* 비활성화 여부를 설정합니다.
|
|
16
|
+
*/
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface SelectedProps {
|
|
20
|
+
/**
|
|
21
|
+
* 선택 여부를 설정합니다.
|
|
22
|
+
*/
|
|
23
|
+
isSelected?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface DefaultSelectedProps {
|
|
26
|
+
/**
|
|
27
|
+
* 기본 선택 여부를 설정합니다.
|
|
28
|
+
*
|
|
29
|
+
* SelectedProps보다 우선적으로 적용됩니다.
|
|
30
|
+
*/
|
|
31
|
+
defaultSelected?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* RadiusBooleanProps는 RadiusProps와 함께 사용할 수 없습니다.
|
|
35
|
+
*/
|
|
36
|
+
export interface RadiusBooleanProps {
|
|
37
|
+
/**
|
|
38
|
+
* Radius를 토글할 수 있는 옵션입니다.
|
|
39
|
+
*/
|
|
40
|
+
radius?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface RadiusProps {
|
|
43
|
+
/**
|
|
44
|
+
* Radius를 설정합니다.
|
|
45
|
+
*/
|
|
46
|
+
radius?: BorderRadiusTokens;
|
|
47
|
+
}
|
|
6
48
|
export type RenderConfigProps = {
|
|
7
49
|
/**
|
|
8
50
|
* 랜더하려고 하는 HTML tag로 변환할 수 있습니다.
|
|
@@ -31,15 +73,16 @@ export interface ChildrenProps<Children = React.ReactNode> {
|
|
|
31
73
|
*/
|
|
32
74
|
children?: Children;
|
|
33
75
|
}
|
|
34
|
-
export interface
|
|
76
|
+
export interface TextProps {
|
|
35
77
|
/**
|
|
36
|
-
*
|
|
78
|
+
* 텍스트를 설정합니다.
|
|
37
79
|
*/
|
|
38
|
-
|
|
80
|
+
text?: string;
|
|
39
81
|
}
|
|
40
82
|
export interface ColorTokenProps {
|
|
41
83
|
/**
|
|
42
84
|
* 텍스트 혹은 아이콘의 색상을 설정합니다.
|
|
85
|
+
* styleVar이 있는 경우 메인색상을 설정합니다.
|
|
43
86
|
*/
|
|
44
87
|
color?: ColorTokens;
|
|
45
88
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shoplflow/base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
"@storybook/addon-links": "^7.4.1",
|
|
44
44
|
"@storybook/addon-mdx-gfm": "^7.4.1",
|
|
45
45
|
"@storybook/addon-measure": "^7.4.1",
|
|
46
|
-
"@storybook/addon-onboarding": "^1.0.8",
|
|
47
46
|
"@storybook/addon-outline": "^7.4.1",
|
|
48
47
|
"@storybook/addon-toolbars": "^7.4.1",
|
|
49
48
|
"@storybook/addon-viewport": "^7.4.1",
|
|
@@ -73,14 +72,17 @@
|
|
|
73
72
|
]
|
|
74
73
|
},
|
|
75
74
|
"dependencies": {
|
|
75
|
+
"classnames": "^2.3.2",
|
|
76
76
|
"framer-motion": "^9.1.7",
|
|
77
77
|
"react-custom-scrollbars-2": "^4.5.0",
|
|
78
|
-
"zustand": "^4.4.1"
|
|
78
|
+
"zustand": "^4.4.1",
|
|
79
|
+
"@shoplflow/utils": "^0.1.0"
|
|
79
80
|
},
|
|
80
81
|
"scripts": {
|
|
81
|
-
"build:tokens": "node scripts/generate-tokens.cjs",
|
|
82
82
|
"type-check": "tsc --noEmit || true",
|
|
83
|
+
"build:tokens": "node scripts/generate-tokens.cjs",
|
|
83
84
|
"build:package": "node build.js",
|
|
85
|
+
"build:component": "scripts/generate-component.sh",
|
|
84
86
|
"build:storybook": "storybook build",
|
|
85
87
|
"build": "pnpm run build:package && pnpm run build:storybook",
|
|
86
88
|
"dev:stories": "storybook dev -p 6007",
|