@vacano/ui 1.12.1 → 1.13.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/README.md +6 -5
- package/dist/ToggleGroup-DCWH4ngK.cjs +1283 -0
- package/dist/ToggleGroup-DCWH4ngK.cjs.map +1 -0
- package/dist/ToggleGroup-DYePk1bM.js +3935 -0
- package/dist/ToggleGroup-DYePk1bM.js.map +1 -0
- package/dist/{X-BIgkmQPR.cjs → X-CI1qRJDP.cjs} +4 -4
- package/dist/X-CI1qRJDP.cjs.map +1 -0
- package/dist/{X-Dyq6IJZW.js → X-Cm-i8Bh7.js} +195 -219
- package/dist/X-Cm-i8Bh7.js.map +1 -0
- package/dist/form.cjs +2 -0
- package/dist/form.cjs.map +1 -0
- package/dist/form.d.ts +540 -0
- package/dist/form.js +428 -0
- package/dist/form.js.map +1 -0
- package/dist/icons.cjs +1 -1
- package/dist/icons.cjs.map +1 -1
- package/dist/icons.js +1253 -1230
- package/dist/icons.js.map +1 -1
- package/dist/index-Abn5L42P.js +42 -0
- package/dist/index-Abn5L42P.js.map +1 -0
- package/dist/index-GSZAZ6Cz.cjs +2 -0
- package/dist/index-GSZAZ6Cz.cjs.map +1 -0
- package/dist/index.cjs +235 -1393
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +126 -43
- package/dist/index.js +1324 -4875
- package/dist/index.js.map +1 -1
- package/dist/{media-CWK1OED-.js → keyboard-D00e_brg.js} +63 -66
- package/dist/keyboard-D00e_brg.js.map +1 -0
- package/dist/{media-BuwIclXE.cjs → keyboard-D8zOi0jU.cjs} +3 -3
- package/dist/keyboard-D8zOi0jU.cjs.map +1 -0
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.ts +38 -0
- package/dist/lib.js +15 -13
- package/dist/lib.js.map +1 -1
- package/package.json +25 -3
- package/dist/X-BIgkmQPR.cjs.map +0 -1
- package/dist/X-Dyq6IJZW.js.map +0 -1
- package/dist/media-BuwIclXE.cjs.map +0 -1
- package/dist/media-CWK1OED-.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./keyboard-D8zOi0jU.cjs"),_=require("./index-GSZAZ6Cz.cjs"),d=require("./X-CI1qRJDP.cjs"),V=require("@emotion/react"),c=require("./ToggleGroup-DCWH4ngK.cjs"),A=require("./tooling-Dflq0Y98.cjs"),u=require("react"),he=require("react-dom"),Be=V.css`
|
|
2
2
|
*,
|
|
3
3
|
*::before,
|
|
4
4
|
*::after {
|
|
@@ -100,374 +100,12 @@
|
|
|
100
100
|
:focus:not(:focus-visible) {
|
|
101
101
|
outline: none;
|
|
102
102
|
}
|
|
103
|
-
`,
|
|
104
|
-
|
|
105
|
-
font-weight: 500;
|
|
106
|
-
color: ${e=>e.$variant==="normal"?t.COLORS.black:t.COLORS.red};
|
|
107
|
-
`,yo=T.newClassNameGetter("field-label"),ne=({children:e,className:r,ref:o,required:n,variant:i="normal",...l})=>e?a.jsxs($o,{...l,ref:o,className:yo("container",r),$variant:i,children:[e," ",n&&"*"]}):null,it={compact:{height:"32px",padding:"0 10px",radius:"14px"},default:{height:"40px",padding:"0 14px",radius:"16px"}},ae={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:{static:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,65)},focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:{static:t.alpha(t.COLORS.red,40),disabled:t.alpha(t.COLORS.red,65)},focus:t.alpha(t.COLORS.red,30)}},Co=s.div`
|
|
108
|
-
position: relative;
|
|
109
|
-
display: grid;
|
|
110
|
-
gap: 2px;
|
|
111
|
-
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
112
|
-
`,mo=s(ne)`
|
|
113
|
-
margin-left: 6px;
|
|
114
|
-
`,wo=s.div`
|
|
115
|
-
position: relative;
|
|
116
|
-
display: flex;
|
|
117
|
-
align-items: center;
|
|
118
|
-
`,vo=s.input`
|
|
119
|
-
flex: 1;
|
|
120
|
-
min-width: 0;
|
|
121
|
-
width: 100%;
|
|
122
|
-
outline: none;
|
|
123
|
-
font-size: 14px;
|
|
124
|
-
font-weight: 500;
|
|
125
|
-
height: ${e=>it[e.$size].height};
|
|
126
|
-
padding: ${e=>it[e.$size].padding};
|
|
127
|
-
padding-right: 40px;
|
|
128
|
-
border-radius: ${e=>it[e.$size].radius};
|
|
129
|
-
|
|
130
|
-
color: ${e=>ae[e.$variant].color.static};
|
|
131
|
-
border: 1px solid ${e=>ae[e.$variant].border.static};
|
|
132
|
-
background-color: ${e=>ae[e.$variant].background.static};
|
|
133
|
-
|
|
134
|
-
&::placeholder {
|
|
135
|
-
color: ${e=>ae[e.$variant].placeholder.static};
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
&:disabled {
|
|
139
|
-
cursor: not-allowed;
|
|
140
|
-
color: ${e=>ae[e.$variant].color.disabled};
|
|
141
|
-
background-color: ${e=>ae[e.$variant].background.disabled};
|
|
142
|
-
border-color: ${e=>ae[e.$variant].border.disabled};
|
|
143
|
-
|
|
144
|
-
&::placeholder {
|
|
145
|
-
color: ${e=>ae[e.$variant].placeholder.disabled};
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
`,Ro=s.div`
|
|
149
|
-
position: absolute;
|
|
150
|
-
right: 12px;
|
|
151
|
-
top: 50%;
|
|
152
|
-
transform: translateY(-50%);
|
|
153
|
-
display: flex;
|
|
154
|
-
align-items: center;
|
|
155
|
-
justify-content: center;
|
|
156
|
-
`,Lo=s.div`
|
|
157
|
-
position: absolute;
|
|
158
|
-
top: 100%;
|
|
159
|
-
left: 0;
|
|
160
|
-
right: 0;
|
|
161
|
-
z-index: 100;
|
|
162
|
-
margin-top: 4px;
|
|
163
|
-
max-height: 240px;
|
|
164
|
-
overflow-y: auto;
|
|
165
|
-
background-color: ${t.COLORS.white};
|
|
166
|
-
border: 1px solid ${t.COLORS.gray};
|
|
167
|
-
border-radius: 12px;
|
|
168
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
169
|
-
opacity: ${({$open:e})=>e?1:0};
|
|
170
|
-
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
171
|
-
transform: ${({$open:e})=>e?"translateY(0)":"translateY(-8px)"};
|
|
172
|
-
transition:
|
|
173
|
-
opacity 0.15s ease,
|
|
174
|
-
transform 0.15s ease,
|
|
175
|
-
visibility 0.15s;
|
|
176
|
-
`,ko=s.div`
|
|
177
|
-
display: flex;
|
|
178
|
-
align-items: center;
|
|
179
|
-
gap: 10px;
|
|
180
|
-
padding: 10px 14px;
|
|
181
|
-
cursor: pointer;
|
|
182
|
-
font-size: 14px;
|
|
183
|
-
font-weight: 500;
|
|
184
|
-
color: ${t.COLORS.black};
|
|
185
|
-
transition: background-color 0.1s ease;
|
|
186
|
-
|
|
187
|
-
&:first-of-type {
|
|
188
|
-
border-radius: 12px 12px 0 0;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
&:last-of-type {
|
|
192
|
-
border-radius: 0 0 12px 12px;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
&:only-child {
|
|
196
|
-
border-radius: 12px;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
&:hover {
|
|
200
|
-
background-color: ${t.alpha(t.COLORS.black,5)};
|
|
201
|
-
}
|
|
202
|
-
`,Eo=s.img`
|
|
203
|
-
width: 24px;
|
|
204
|
-
height: 24px;
|
|
205
|
-
border-radius: 6px;
|
|
206
|
-
object-fit: cover;
|
|
207
|
-
`,jo=s.span`
|
|
208
|
-
flex: 1;
|
|
209
|
-
overflow: hidden;
|
|
210
|
-
text-overflow: ellipsis;
|
|
211
|
-
white-space: nowrap;
|
|
212
|
-
`,Po=s.div`
|
|
213
|
-
padding: 12px 14px;
|
|
214
|
-
font-size: 14px;
|
|
215
|
-
color: ${t.alpha(t.COLORS.black,50)};
|
|
216
|
-
text-align: center;
|
|
217
|
-
`,Dt={xs:{size:"16px",borderWidth:"2px"},sm:{size:"20px",borderWidth:"2px"},md:{size:"32px",borderWidth:"3px"},lg:{size:"48px",borderWidth:"4px"}},_t={track:t.alpha(t.COLORS.black,15),indicator:t.COLORS.black},nt=e=>Dt[e]??Dt.md,zo=oe.keyframes`
|
|
218
|
-
0% {
|
|
219
|
-
transform: rotate(0deg);
|
|
220
|
-
}
|
|
221
|
-
100% {
|
|
222
|
-
transform: rotate(360deg);
|
|
223
|
-
}
|
|
224
|
-
`,No=s.div`
|
|
225
|
-
display: inline-block;
|
|
226
|
-
width: ${e=>nt(e.$size).size};
|
|
227
|
-
height: ${e=>nt(e.$size).size};
|
|
228
|
-
border: ${e=>nt(e.$size).borderWidth} solid ${_t.track};
|
|
229
|
-
border-top-color: ${_t.indicator};
|
|
230
|
-
border-radius: 50%;
|
|
231
|
-
animation: ${zo} 0.8s linear infinite;
|
|
232
|
-
`,To=T.newClassNameGetter("spinner"),Et=({"aria-label":e="Loading",className:r,ref:o,size:n="md",...i})=>a.jsx(No,{...i,ref:o,className:To("container",r),role:"status","aria-label":e,$size:n}),ke=T.newClassNameGetter("autocomplete"),Io=({className:e,classnames:r,disabled:o,fullWidth:n,label:i,ref:l,size:c="default",variant:d="normal",value:u,onChange:h,onSearch:b,debounceMs:f=300,minChars:O=1,noResultsMessage:m="No results found",...S})=>{const[x,y]=p.useState((u==null?void 0:u.value)??""),[$,C]=p.useState([]),[g,k]=p.useState(!1),[N,P]=p.useState(!1),[Y,j]=p.useState(!1),_=p.useRef(null),M=p.useRef(null);p.useEffect(()=>{(u==null?void 0:u.value)!==void 0&&y(u.value)},[u==null?void 0:u.value]);const E=p.useCallback(async z=>{if(z.length<O){C([]),j(!1);return}k(!0),j(!0);try{const B=await b(z);C(B),P(!0)}catch{C([])}finally{k(!1)}},[b,O]),A=p.useCallback(z=>{const B=z.target.value;y(B),h==null||h({value:B,image_url:null}),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{E(B)},f)},[h,E,f]),w=p.useCallback(z=>{y(z.value),C([]),P(!1),j(!1),h==null||h({value:z.value,image_url:z.image_url})},[h]),I=p.useCallback(()=>{setTimeout(()=>{P(!1)},150)},[]),R=p.useCallback(()=>{$.length>0&&P(!0)},[$.length]);return p.useEffect(()=>()=>{M.current&&clearTimeout(M.current)},[]),a.jsxs(Co,{ref:_,className:ke("container",e),$fullWidth:!!n,children:[i&&a.jsx(mo,{variant:d,className:ke("label",r==null?void 0:r.label),children:i}),a.jsxs(wo,{children:[a.jsx(vo,{...S,ref:l,type:"text",value:x,onChange:A,onBlur:I,onFocus:R,disabled:o,$size:c,$variant:d,className:ke("input",r==null?void 0:r.input)}),g&&a.jsx(Ro,{children:a.jsx(Et,{size:"xs"})})]}),a.jsx(Lo,{$open:N&&Y,className:ke("dropdown",r==null?void 0:r.dropdown),children:$.length>0?$.map(z=>a.jsxs(ko,{onClick:()=>w(z),className:ke("item",r==null?void 0:r.item),children:[z.image_url&&a.jsx(Eo,{src:z.image_url,alt:z.value}),a.jsx(jo,{children:z.value})]},z.id)):!g&&a.jsx(Po,{children:m})})]})},Mt={compact:{height:"32px",padding:"0 8px",radius:"12px",iconSize:"16px"},default:{height:"40px",padding:"0 12px",radius:"16px",iconSize:"20px"}},Ft={normal:{background:{static:t.COLORS["steel-blue"],hover:t.alpha(t.COLORS["steel-blue"],90),active:t.alpha(t.COLORS["steel-blue"],80),disabled:t.alpha(t.COLORS["steel-blue"],50)},color:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.COLORS.white},borderColor:{static:"transparent",hover:"transparent",active:"transparent",disabled:"transparent"}},system:{background:{static:t.COLORS.black,hover:t.alpha(t.COLORS.black,90),active:t.alpha(t.COLORS.black,80),disabled:t.alpha(t.COLORS.black,50)},color:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.COLORS.white},borderColor:{static:"transparent",hover:"transparent",active:"transparent",disabled:"transparent"}},success:{background:{static:t.COLORS.green,hover:t.alpha(t.COLORS.green,90),active:t.alpha(t.COLORS.green,80),disabled:t.alpha(t.COLORS.green,50)},color:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.COLORS.white},borderColor:{static:"transparent",hover:"transparent",active:"transparent",disabled:"transparent"}},warning:{background:{static:t.COLORS.yellow,hover:t.alpha(t.COLORS.yellow,90),active:t.alpha(t.COLORS.yellow,80),disabled:t.alpha(t.COLORS.yellow,50)},color:{static:t.COLORS.black,hover:t.COLORS.black,active:t.COLORS.black,disabled:t.COLORS.black},borderColor:{static:"transparent",hover:"transparent",active:"transparent",disabled:"transparent"}},danger:{background:{static:t.COLORS.red,hover:t.alpha(t.COLORS.red,90),active:t.alpha(t.COLORS.red,80),disabled:t.alpha(t.COLORS.red,50)},color:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.COLORS.white},borderColor:{static:"transparent",hover:"transparent",active:"transparent",disabled:"transparent"}},transparent:{background:{static:t.alpha(t.COLORS["iron-grey"],1),hover:t.alpha(t.COLORS["iron-grey"],5),active:t.alpha(t.COLORS["iron-grey"],10),disabled:t.alpha(t.COLORS["iron-grey"],5)},color:{static:t.COLORS.black,hover:t.COLORS.black,active:t.COLORS.black,disabled:t.alpha(t.COLORS.black,30)},borderColor:{static:t.alpha(t.COLORS["iron-grey"],20),hover:t.alpha(t.COLORS["iron-grey"],20),active:t.alpha(t.COLORS["iron-grey"],20),disabled:t.alpha(t.COLORS["iron-grey"],10)}}},J=e=>{const r=Ft[e];return r||Ft.normal},re=e=>{const r=Mt[e];return r||Mt.default},Ao=e=>e?"auto":"fit-content",Do=s.button`
|
|
233
|
-
display: flex;
|
|
234
|
-
gap: 6px;
|
|
235
|
-
text-decoration: none;
|
|
236
|
-
align-items: center;
|
|
237
|
-
justify-content: center;
|
|
238
|
-
width: ${e=>e.$iconOnly?re(e.$size).height:Ao(!!e.$fullWidth)};
|
|
239
|
-
color: ${e=>J(e.$variant).color.static};
|
|
240
|
-
background-color: ${e=>J(e.$variant).background.static};
|
|
241
|
-
height: ${e=>re(e.$size).height};
|
|
242
|
-
padding: ${e=>e.$iconOnly?"0":re(e.$size).padding};
|
|
243
|
-
border-radius: ${e=>re(e.$size).radius};
|
|
244
|
-
border: 1px solid ${e=>J(e.$variant).borderColor.static};
|
|
245
|
-
|
|
246
|
-
&:hover:not(:disabled) {
|
|
247
|
-
color: ${e=>J(e.$variant).color.hover};
|
|
248
|
-
background-color: ${e=>J(e.$variant).background.hover};
|
|
249
|
-
border-color: ${e=>J(e.$variant).borderColor.hover};
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
&:active:not(:disabled) {
|
|
253
|
-
color: ${e=>J(e.$variant).color.active};
|
|
254
|
-
background-color: ${e=>J(e.$variant).background.active};
|
|
255
|
-
border-color: ${e=>J(e.$variant).borderColor.active};
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
&:disabled {
|
|
259
|
-
cursor: not-allowed;
|
|
260
|
-
color: ${e=>J(e.$variant).color.disabled};
|
|
261
|
-
background-color: ${e=>J(e.$variant).background.disabled};
|
|
262
|
-
border-color: ${e=>J(e.$variant).borderColor.disabled};
|
|
263
|
-
}
|
|
264
|
-
`,_o=s.div`
|
|
265
|
-
display: grid;
|
|
266
|
-
place-items: center;
|
|
267
|
-
width: ${e=>re(e.$size).iconSize};
|
|
268
|
-
height: ${e=>re(e.$size).iconSize};
|
|
269
|
-
|
|
270
|
-
& svg {
|
|
271
|
-
width: ${e=>re(e.$size).iconSize};
|
|
272
|
-
height: ${e=>re(e.$size).iconSize};
|
|
273
|
-
}
|
|
274
|
-
`,Mo=s.span`
|
|
275
|
-
font-weight: 600;
|
|
276
|
-
overflow: hidden;
|
|
277
|
-
white-space: nowrap;
|
|
278
|
-
text-overflow: ellipsis;
|
|
279
|
-
`,Fo=s(a.LoaderCircle)`
|
|
280
|
-
width: ${e=>re(e.$size).iconSize};
|
|
281
|
-
height: ${e=>re(e.$size).iconSize};
|
|
282
|
-
animation: ${t.KEYFRAMES.rotate} 0.8s linear infinite;
|
|
283
|
-
`,Bo=s.div`
|
|
284
|
-
display: flex;
|
|
285
|
-
gap: 3px;
|
|
286
|
-
`,Yo=s.span`
|
|
287
|
-
text-align: center;
|
|
288
|
-
display: flex;
|
|
289
|
-
justify-content: center;
|
|
290
|
-
align-items: center;
|
|
291
|
-
font-size: 12px;
|
|
292
|
-
height: 18px;
|
|
293
|
-
min-width: 18px;
|
|
294
|
-
line-height: 1.6;
|
|
295
|
-
padding: 2px 4px;
|
|
296
|
-
border-radius: 4px;
|
|
297
|
-
width: fit-content;
|
|
298
|
-
background-color: ${e=>e.$variant==="light"?t.alpha(t.COLORS.white,25):t.alpha(t.COLORS.black,25)};
|
|
299
|
-
`,Vo=T.newClassNameGetter("key-symbol"),wr=({className:e,ref:r,symbol:o,variant:n="light",...i})=>o?a.jsx(Yo,{...i,ref:r,className:Vo("container",e),$variant:n,children:o}):null,Bt=T.newClassNameGetter("key-bindings"),vr=({className:e,classnames:r,keys:o,ref:n,variant:i,...l})=>{const c=p.useMemo(()=>t.getKeySymbols(o),[o]);return c.length===0?null:a.jsx(Bo,{...l,ref:n,className:Bt("container",e),children:c.map(d=>a.jsx(wr,{symbol:d,className:Bt("item",r==null?void 0:r.item),variant:i},d))})},Yt=T.newClassNameGetter("button"),ge=({children:e,className:r,classnames:o,disabled:n,fullWidth:i,icon:l,loading:c,onClick:d,ref:u=null,keyBindings:h=[],size:b="default",type:f="button",variant:O="normal",...m})=>{const S=p.useRef(null);p.useImperativeHandle(u,()=>S.current,[]),t.useKeyBinding(h,()=>{var y;(y=S.current)==null||y.click()});const x=p.useMemo(()=>{switch(f){case"link":return"button";default:return f}},[f]);return a.jsxs(Do,{...m,onClick:d,ref:S,type:x,disabled:n,className:Yt("container",r),$variant:O,$size:b,$fullWidth:!!i,$iconOnly:!!l&&!(e||(h==null?void 0:h.length)>0),children:[c&&a.jsx(Fo,{$size:b}),l&&!c&&a.jsx(_o,{$size:b,children:l}),e&&a.jsx(Mo,{className:Yt("label",o==null?void 0:o.label),children:e}),a.jsx(vr,{keys:h,variant:O==="system"?"light":"dark"})]})},Ho=s.div`
|
|
300
|
-
background-color: ${t.COLORS.white};
|
|
103
|
+
`,Fe=()=>d.jsx(V.Global,{styles:Be}),Me=c.styled.div`
|
|
104
|
+
background-color: ${a.COLORS.white};
|
|
301
105
|
border-radius: 16px;
|
|
302
|
-
border: ${e=>e.$border?`1px solid ${
|
|
303
|
-
box-shadow: ${e=>e.$shadow?`0 2px 8px ${
|
|
304
|
-
`,
|
|
305
|
-
display: inline-flex;
|
|
306
|
-
align-items: flex-start;
|
|
307
|
-
gap: 8px;
|
|
308
|
-
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
309
|
-
opacity: ${e=>e.$disabled?.5:1};
|
|
310
|
-
`,Uo=s.input`
|
|
311
|
-
position: absolute;
|
|
312
|
-
opacity: 0;
|
|
313
|
-
width: 0;
|
|
314
|
-
height: 0;
|
|
315
|
-
pointer-events: none;
|
|
316
|
-
`,Xo=s.span`
|
|
317
|
-
display: inline-flex;
|
|
318
|
-
align-items: center;
|
|
319
|
-
justify-content: center;
|
|
320
|
-
flex-shrink: 0;
|
|
321
|
-
width: 18px;
|
|
322
|
-
height: 18px;
|
|
323
|
-
border-radius: 6px;
|
|
324
|
-
border: 1.5px solid
|
|
325
|
-
${e=>e.$checked||e.$indeterminate?Ce(e.$variant).box.borderChecked:Ce(e.$variant).box.border};
|
|
326
|
-
background-color: ${e=>e.$checked||e.$indeterminate?Ce(e.$variant).box.backgroundChecked:Ce(e.$variant).box.background};
|
|
327
|
-
transition:
|
|
328
|
-
border-color 0.15s ease,
|
|
329
|
-
background-color 0.15s ease,
|
|
330
|
-
box-shadow 0.15s ease;
|
|
331
|
-
`,qo=s.span`
|
|
332
|
-
display: inline-flex;
|
|
333
|
-
align-items: center;
|
|
334
|
-
justify-content: center;
|
|
335
|
-
color: ${e=>Ce(e.$variant).icon};
|
|
336
|
-
opacity: ${e=>e.$visible?1:0};
|
|
337
|
-
transform: ${e=>e.$visible?"scale(1)":"scale(0.5)"};
|
|
338
|
-
transition:
|
|
339
|
-
opacity 0.15s ease,
|
|
340
|
-
transform 0.15s ease;
|
|
341
|
-
|
|
342
|
-
& svg {
|
|
343
|
-
width: 12px;
|
|
344
|
-
height: 12px;
|
|
345
|
-
}
|
|
346
|
-
`,Zo=s.span`
|
|
347
|
-
font-size: 14px;
|
|
348
|
-
font-weight: 500;
|
|
349
|
-
line-height: 1.4;
|
|
350
|
-
color: ${e=>Ce(e.$variant).label};
|
|
351
|
-
user-select: none;
|
|
352
|
-
|
|
353
|
-
a {
|
|
354
|
-
color: inherit;
|
|
355
|
-
text-decoration: underline;
|
|
356
|
-
cursor: pointer;
|
|
357
|
-
|
|
358
|
-
&:hover {
|
|
359
|
-
text-decoration: none;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
`,Ee=T.newClassNameGetter("checkbox"),tt=({checked:e,className:r,classnames:o,disabled:n,indeterminate:i=!1,label:l,onChange:c,ref:d,variant:u="normal",...h})=>a.jsxs(Ko,{className:Ee("container",r),$disabled:!!n,$variant:u,children:[a.jsx(Uo,{...h,ref:d,type:"checkbox",className:Ee("input",o==null?void 0:o.input),checked:e,disabled:n,onChange:c}),a.jsx(Xo,{className:Ee("box",o==null?void 0:o.box),$checked:e,$indeterminate:i,$variant:u,children:a.jsx(qo,{className:Ee("icon",o==null?void 0:o.icon),$visible:i||e,$variant:u,children:i?a.jsx(a.Minus,{}):a.jsx(a.Check,{})})}),l&&a.jsx(Zo,{className:Ee("label",o==null?void 0:o.label),$variant:u,children:l})]}),Ht={normal:{border:{static:t.alpha(t.COLORS.black,20),hover:t.alpha(t.COLORS.black,40),active:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,10)},borderChecked:t.COLORS.black,background:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.alpha(t.COLORS.black,5)},backgroundChecked:t.alpha(t.COLORS.black,5),focusRing:t.alpha(t.COLORS.black,20),label:{static:t.COLORS.black,hover:t.COLORS.black,active:t.COLORS.black,disabled:t.alpha(t.COLORS.black,40)},description:{static:t.alpha(t.COLORS.black,60),hover:t.alpha(t.COLORS.black,60),active:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,30)}},error:{border:{static:t.COLORS.red,hover:t.COLORS.red,active:t.COLORS.red,disabled:t.alpha(t.COLORS.red,30)},borderChecked:t.COLORS.red,background:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.alpha(t.COLORS.red,5)},backgroundChecked:t.alpha(t.COLORS.red,5),focusRing:t.alpha(t.COLORS.red,20),label:{static:t.COLORS.red,hover:t.COLORS.red,active:t.COLORS.red,disabled:t.alpha(t.COLORS.red,40)},description:{static:t.alpha(t.COLORS.red,70),hover:t.alpha(t.COLORS.red,70),active:t.alpha(t.COLORS.red,70),disabled:t.alpha(t.COLORS.red,40)}}},he=e=>Ht[e]??Ht.normal,Jo=s.label`
|
|
363
|
-
display: grid;
|
|
364
|
-
grid-template-columns: auto 1fr;
|
|
365
|
-
align-items: start;
|
|
366
|
-
gap: 8px;
|
|
367
|
-
padding: 12px;
|
|
368
|
-
background-color: ${e=>{const r=he(e.$variant);return e.$disabled?r.background.disabled:e.$checked?r.backgroundChecked:r.background.static}};
|
|
369
|
-
border: 1px solid
|
|
370
|
-
${e=>{const r=he(e.$variant);return e.$disabled?r.border.disabled:e.$checked?r.borderChecked:r.border.static}};
|
|
371
|
-
border-radius: 12px;
|
|
372
|
-
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
373
|
-
transition:
|
|
374
|
-
border-color 0.15s ease,
|
|
375
|
-
background-color 0.15s ease;
|
|
376
|
-
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
377
|
-
min-width: 0;
|
|
378
|
-
|
|
379
|
-
&:hover:not([data-disabled='true']) {
|
|
380
|
-
border-color: ${e=>{const r=he(e.$variant);return e.$checked?r.borderChecked:r.border.hover}};
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
.vacano_checkbox_container {
|
|
384
|
-
pointer-events: none;
|
|
385
|
-
}
|
|
386
|
-
`,Qo=s.input`
|
|
387
|
-
position: absolute;
|
|
388
|
-
width: 1px;
|
|
389
|
-
height: 1px;
|
|
390
|
-
margin: -1px;
|
|
391
|
-
padding: 0;
|
|
392
|
-
overflow: hidden;
|
|
393
|
-
clip: rect(0, 0, 0, 0);
|
|
394
|
-
white-space: nowrap;
|
|
395
|
-
border: 0;
|
|
396
|
-
`,ei=s.div`
|
|
397
|
-
display: flex;
|
|
398
|
-
flex-direction: column;
|
|
399
|
-
gap: 2px;
|
|
400
|
-
min-width: 0;
|
|
401
|
-
`,ti=s.span`
|
|
402
|
-
font-size: 14px;
|
|
403
|
-
font-weight: 500;
|
|
404
|
-
line-height: 1.4;
|
|
405
|
-
color: ${e=>he(e.$variant).label.static};
|
|
406
|
-
|
|
407
|
-
label[data-disabled='true'] & {
|
|
408
|
-
color: ${e=>he(e.$variant).label.disabled};
|
|
409
|
-
}
|
|
410
|
-
`,ri=s.span`
|
|
411
|
-
font-size: 12px;
|
|
412
|
-
font-weight: 400;
|
|
413
|
-
line-height: 1.4;
|
|
414
|
-
color: ${e=>he(e.$variant).description.static};
|
|
415
|
-
|
|
416
|
-
label[data-disabled='true'] & {
|
|
417
|
-
color: ${e=>he(e.$variant).description.disabled};
|
|
418
|
-
}
|
|
419
|
-
`,Ye=T.newClassNameGetter("checkbox-card"),oi=({checked:e,className:r,classnames:o,description:n,disabled:i,fullWidth:l=!1,label:c,onChange:d,ref:u,variant:h="normal",...b})=>a.jsxs(Jo,{className:Ye("container",r),$checked:e,$disabled:!!i,$fullWidth:l,$variant:h,"data-disabled":i,children:[a.jsx(Qo,{...b,ref:u,type:"checkbox",checked:e,disabled:i,onChange:d}),a.jsx(tt,{className:o==null?void 0:o.checkbox,checked:e,disabled:i,variant:h,onChange:()=>{},tabIndex:-1,"aria-hidden":!0}),a.jsxs(ei,{className:Ye("content",o==null?void 0:o.content),children:[a.jsx(ti,{className:Ye("label",o==null?void 0:o.label),$variant:h,children:c}),n&&a.jsx(ri,{className:Ye("description",o==null?void 0:o.description),$variant:h,children:n})]})]}),Gt={label:{color:t.COLORS.black,disabledColor:t.alpha(t.COLORS.black,40)}},ii=s.div`
|
|
420
|
-
display: flex;
|
|
421
|
-
flex-direction: column;
|
|
422
|
-
gap: 8px;
|
|
423
|
-
`,ni=s.span`
|
|
424
|
-
font-size: 13px;
|
|
425
|
-
font-weight: 500;
|
|
426
|
-
line-height: 1.5;
|
|
427
|
-
color: ${e=>e.$disabled?Gt.label.disabledColor:Gt.label.color};
|
|
428
|
-
margin-bottom: 4px;
|
|
429
|
-
`,ai=s.div`
|
|
430
|
-
display: flex;
|
|
431
|
-
flex-direction: column;
|
|
432
|
-
gap: 12px;
|
|
433
|
-
`,at=T.newClassNameGetter("checkbox-group"),li=({className:e,classnames:r,disabled:o,label:n,onChange:i,options:l,ref:c,value:d,...u})=>{const h=(b,f)=>{i(f?[...d,b]:d.filter(O=>O!==b))};return a.jsxs(ii,{...u,ref:c,className:at("container",e),children:[n&&a.jsx(ni,{className:at("label",r==null?void 0:r.label),$disabled:o,children:n}),a.jsx(ai,{className:at("options",r==null?void 0:r.options),children:l.map(b=>a.jsx(tt,{className:r==null?void 0:r.checkbox,checked:d.includes(b.value),label:b.label,disabled:o,onChange:f=>h(b.value,f.target.checked)},b.value))})]})},Wt={gray:{background:t.alpha(t.COLORS["iron-grey"],10),color:t.COLORS["iron-grey"],deleteHover:t.alpha(t.COLORS["iron-grey"],20)},red:{background:t.alpha(t.COLORS.red,10),color:t.COLORS.red,deleteHover:t.alpha(t.COLORS.red,20)},blue:{background:t.alpha(t.COLORS["steel-blue"],10),color:t.COLORS["steel-blue"],deleteHover:t.alpha(t.COLORS["steel-blue"],20)},black:{background:t.COLORS.black,color:t.COLORS.white,deleteHover:t.alpha(t.COLORS.white,20)}},vt=e=>Wt[e]??Wt.gray,di=s.span`
|
|
434
|
-
display: inline-flex;
|
|
435
|
-
align-items: center;
|
|
436
|
-
gap: 4px;
|
|
437
|
-
padding: 0 ${e=>e.$deletable?"7px":"10px"} 0 10px;
|
|
438
|
-
border-radius: 12px;
|
|
439
|
-
height: 24px;
|
|
440
|
-
font-size: 12px;
|
|
441
|
-
font-weight: 500;
|
|
442
|
-
line-height: 1.5;
|
|
443
|
-
background-color: ${e=>vt(e.$variant).background};
|
|
444
|
-
color: ${e=>vt(e.$variant).color};
|
|
445
|
-
`,ci=s.button`
|
|
446
|
-
display: inline-flex;
|
|
447
|
-
align-items: center;
|
|
448
|
-
justify-content: center;
|
|
449
|
-
padding: 0;
|
|
450
|
-
margin: 0;
|
|
451
|
-
margin-left: 2px;
|
|
452
|
-
border: none;
|
|
453
|
-
background: transparent;
|
|
454
|
-
color: inherit;
|
|
455
|
-
cursor: pointer;
|
|
456
|
-
border-radius: 4px;
|
|
457
|
-
transition: background-color 0.15s ease;
|
|
458
|
-
|
|
459
|
-
&:hover {
|
|
460
|
-
background-color: ${e=>vt(e.$variant).deleteHover};
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
& svg {
|
|
464
|
-
width: 14px;
|
|
465
|
-
height: 14px;
|
|
466
|
-
}
|
|
467
|
-
`,si=s.span`
|
|
468
|
-
flex: 1 0 auto;
|
|
469
|
-
text-align: center;
|
|
470
|
-
`,lt=T.newClassNameGetter("chip"),Qe=({children:e,className:r,classnames:o,deletable:n,onDelete:i,ref:l,variant:c="gray",...d})=>a.jsxs(di,{...d,ref:l,className:lt("container",r),$variant:c,$deletable:!!n,children:[a.jsx(si,{className:lt("label",o==null?void 0:o.label),children:e}),n&&a.jsx(ci,{type:"button",className:lt("delete",o==null?void 0:o.delete),$variant:c,onClick:i,children:a.jsx(a.X,{})})]}),pi="Confirm",ui="Cancel",hi=oe.keyframes`
|
|
106
|
+
border: ${e=>e.$border?`1px solid ${a.alpha(a.COLORS["iron-grey"],15)}`:"none"};
|
|
107
|
+
box-shadow: ${e=>e.$shadow?`0 2px 8px ${a.alpha(a.COLORS.black,10)}`:"none"};
|
|
108
|
+
`,_e=A.newClassNameGetter("card"),De=({children:e,className:t,ref:o,border:i=!1,shadow:n=!1,...r})=>d.jsx(Me,{...r,ref:o,className:_e("container",t),$border:i,$shadow:n,children:e}),Ye="Confirm",Xe="Cancel",qe=V.keyframes`
|
|
471
109
|
from {
|
|
472
110
|
opacity: 0;
|
|
473
111
|
transform: translateX(-50%) translateY(100%);
|
|
@@ -476,7 +114,7 @@
|
|
|
476
114
|
opacity: 1;
|
|
477
115
|
transform: translateX(-50%) translateY(0);
|
|
478
116
|
}
|
|
479
|
-
`,
|
|
117
|
+
`,Ge=V.keyframes`
|
|
480
118
|
from {
|
|
481
119
|
opacity: 1;
|
|
482
120
|
transform: translateX(-50%) translateY(0);
|
|
@@ -485,7 +123,7 @@
|
|
|
485
123
|
opacity: 0;
|
|
486
124
|
transform: translateX(-50%) translateY(100%);
|
|
487
125
|
}
|
|
488
|
-
`,
|
|
126
|
+
`,Ke=c.styled.div`
|
|
489
127
|
position: fixed;
|
|
490
128
|
bottom: 24px;
|
|
491
129
|
left: 50%;
|
|
@@ -493,399 +131,171 @@
|
|
|
493
131
|
align-items: center;
|
|
494
132
|
gap: 16px;
|
|
495
133
|
padding: 12px 16px;
|
|
496
|
-
background-color: ${
|
|
497
|
-
border: 1px dashed ${
|
|
134
|
+
background-color: ${a.COLORS.white};
|
|
135
|
+
border: 1px dashed ${a.COLORS.gray};
|
|
498
136
|
border-radius: 12px;
|
|
499
137
|
box-shadow:
|
|
500
138
|
0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
501
139
|
0 2px 4px -2px rgba(0, 0, 0, 0.1);
|
|
502
|
-
animation: ${({$isExiting:e})=>e?
|
|
140
|
+
animation: ${({$isExiting:e})=>e?Ge:qe} 0.2s ease-out forwards;
|
|
503
141
|
z-index: 1000;
|
|
504
|
-
`,
|
|
142
|
+
`,Ue=c.styled.p`
|
|
505
143
|
margin: 0;
|
|
506
144
|
font-size: 14px;
|
|
507
|
-
color: ${
|
|
145
|
+
color: ${a.COLORS.black};
|
|
508
146
|
white-space: nowrap;
|
|
509
|
-
`,
|
|
147
|
+
`,He=c.styled.div`
|
|
510
148
|
display: flex;
|
|
511
149
|
align-items: center;
|
|
512
150
|
gap: 8px;
|
|
513
|
-
`,
|
|
151
|
+
`,Ve=({confirmation:e,onDone:t})=>{const[o,i]=u.useState(!1),[n,r]=u.useState(!1),{message:l,onConfirm:s,onCancel:p,options:h}=e,g=h.confirmLabel||Ye,f=h.cancelLabel||Xe,x=u.useCallback(m=>{i(!0),setTimeout(()=>{m==null||m(),t()},200)},[t]),b=u.useCallback(async()=>{const m=s();if(m instanceof Promise){r(!0);try{await m}finally{r(!1)}}x()},[x,s]),y=u.useCallback(()=>{n||x(p)},[x,n,p]);return u.useEffect(()=>{const m=$=>{$.key==="Escape"&&!n&&y()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[y,n]),d.jsxs(Ke,{$isExiting:o,children:[d.jsx(Ue,{children:l}),d.jsxs(He,{children:[d.jsx(c.Button,{variant:"system",size:"compact",onClick:y,disabled:n,children:f}),d.jsx(c.Button,{variant:"danger",size:"compact",onClick:b,loading:n,children:g})]})]})},Ee=u.createContext(null),We=()=>{},Ze=({children:e})=>{const[t,o]=u.useState(null),i=u.useCallback((r,l,s,p)=>{o({open:!0,message:r,onConfirm:l,onCancel:s||We,options:p||{}})},[]),n=u.useCallback(()=>{o(null)},[]);return d.jsxs(Ee.Provider,{value:{show:i,hide:n},children:[e,t&&d.jsx(Ve,{confirmation:t,onDone:n})]})},Qe=()=>{const e=u.useContext(Ee);if(!e)throw new Error("useConfirmation must be used within ConfirmationProvider");return e},Z={sm:`${a.BREAKPOINTS.sm}px`,md:`${a.BREAKPOINTS.md}px`,lg:`${a.BREAKPOINTS.lg}px`,xl:`${a.BREAKPOINTS.xl}px`,"2xl":`${a.BREAKPOINTS["2xl"]}px`},Je=c.styled.div`
|
|
514
152
|
width: 100%;
|
|
515
153
|
|
|
516
|
-
${
|
|
517
|
-
max-width: ${
|
|
154
|
+
${_.mediaUp("sm")} {
|
|
155
|
+
max-width: ${Z.sm};
|
|
518
156
|
}
|
|
519
157
|
|
|
520
|
-
${
|
|
521
|
-
max-width: ${
|
|
158
|
+
${_.mediaUp("md")} {
|
|
159
|
+
max-width: ${Z.md};
|
|
522
160
|
}
|
|
523
161
|
|
|
524
|
-
${
|
|
525
|
-
max-width: ${
|
|
162
|
+
${_.mediaUp("lg")} {
|
|
163
|
+
max-width: ${Z.lg};
|
|
526
164
|
}
|
|
527
165
|
|
|
528
|
-
${
|
|
529
|
-
max-width: ${
|
|
166
|
+
${_.mediaUp("xl")} {
|
|
167
|
+
max-width: ${Z.xl};
|
|
530
168
|
}
|
|
531
169
|
|
|
532
|
-
${
|
|
533
|
-
max-width: ${
|
|
170
|
+
${_.mediaUp("2xl")} {
|
|
171
|
+
max-width: ${Z["2xl"]};
|
|
534
172
|
}
|
|
535
|
-
`,
|
|
536
|
-
position: relative;
|
|
537
|
-
display: inline-flex;
|
|
538
|
-
flex-direction: column;
|
|
539
|
-
gap: 2px;
|
|
540
|
-
min-width: 180px;
|
|
541
|
-
width: ${({$fullWidth:e})=>e?"100%":"fit-content"};
|
|
542
|
-
`,Ii=s(ne)`
|
|
543
|
-
margin-left: 6px;
|
|
544
|
-
`,Ai=s.button`
|
|
545
|
-
display: flex;
|
|
546
|
-
align-items: center;
|
|
547
|
-
justify-content: space-between;
|
|
548
|
-
gap: 8px;
|
|
549
|
-
width: 100%;
|
|
550
|
-
cursor: ${({$disabled:e})=>e?"not-allowed":"pointer"};
|
|
551
|
-
outline: none;
|
|
552
|
-
font-size: 14px;
|
|
553
|
-
font-weight: 500;
|
|
554
|
-
text-align: left;
|
|
555
|
-
height: ${({$size:e})=>Je[e].height};
|
|
556
|
-
padding: ${({$size:e})=>Je[e].padding};
|
|
557
|
-
border-radius: ${({$size:e})=>Je[e].radius};
|
|
558
|
-
color: ${({$variant:e,$disabled:r,$hasValue:o})=>o?Pe[e].color[r?"disabled":"static"]:Pe[e].placeholder[r?"disabled":"static"]};
|
|
559
|
-
border: 1px solid
|
|
560
|
-
${({$variant:e,$disabled:r})=>Pe[e].border[r?"disabled":"static"]};
|
|
561
|
-
background-color: ${({$variant:e,$disabled:r})=>Pe[e].background[r?"disabled":"static"]};
|
|
562
|
-
|
|
563
|
-
${({$open:e,$variant:r})=>e&&`
|
|
564
|
-
outline: 2px solid ${Pe[r].focus};
|
|
565
|
-
`}
|
|
566
|
-
`,Di=s.span`
|
|
567
|
-
flex: 1;
|
|
568
|
-
overflow: hidden;
|
|
569
|
-
text-overflow: ellipsis;
|
|
570
|
-
white-space: nowrap;
|
|
571
|
-
`,_i=s.span`
|
|
572
|
-
display: flex;
|
|
573
|
-
align-items: center;
|
|
574
|
-
justify-content: center;
|
|
575
|
-
flex-shrink: 0;
|
|
576
|
-
transition: transform 0.15s ease;
|
|
577
|
-
transform: ${({$open:e})=>e?"rotate(180deg)":"rotate(0deg)"};
|
|
578
|
-
`,kr=`
|
|
579
|
-
z-index: 100;
|
|
580
|
-
background-color: ${t.COLORS.white};
|
|
581
|
-
border: 1px solid ${t.alpha(t.COLORS.black,15)};
|
|
582
|
-
border-radius: 12px;
|
|
583
|
-
box-shadow: 0 4px 16px ${t.alpha(t.COLORS.black,12)};
|
|
584
|
-
padding: ${vi}px;
|
|
585
|
-
`,Er=(e,r)=>e?"translateY(0)":r==="bottom"?"translateY(-8px)":"translateY(8px)",Mi=s.div`
|
|
586
|
-
position: absolute;
|
|
587
|
-
${({$position:e})=>e==="bottom"?"top: calc(100% + 4px);":"bottom: calc(100% + 4px);"}
|
|
588
|
-
left: 0;
|
|
589
|
-
${kr}
|
|
590
|
-
opacity: ${({$open:e})=>e?1:0};
|
|
591
|
-
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
592
|
-
transform: ${({$open:e,$position:r})=>Er(e,r)};
|
|
593
|
-
transition:
|
|
594
|
-
opacity 0.15s ease,
|
|
595
|
-
transform 0.15s ease,
|
|
596
|
-
visibility 0.15s;
|
|
597
|
-
`,Fi=s.div`
|
|
598
|
-
position: fixed;
|
|
599
|
-
${kr}
|
|
600
|
-
opacity: ${({$open:e})=>e?1:0};
|
|
601
|
-
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
602
|
-
transform: ${({$open:e,$position:r})=>Er(e,r)};
|
|
603
|
-
transition:
|
|
604
|
-
opacity 0.15s ease,
|
|
605
|
-
transform 0.15s ease,
|
|
606
|
-
visibility 0.15s;
|
|
607
|
-
`,dt=s.div`
|
|
608
|
-
display: flex;
|
|
609
|
-
align-items: center;
|
|
610
|
-
justify-content: space-between;
|
|
611
|
-
margin-bottom: 8px;
|
|
612
|
-
`,ct=s.button`
|
|
613
|
-
display: flex;
|
|
614
|
-
align-items: center;
|
|
615
|
-
gap: 4px;
|
|
616
|
-
padding: 4px 8px;
|
|
617
|
-
border: none;
|
|
618
|
-
background: transparent;
|
|
619
|
-
border-radius: 6px;
|
|
620
|
-
font-size: 14px;
|
|
621
|
-
font-weight: 600;
|
|
622
|
-
color: ${t.COLORS.black};
|
|
623
|
-
cursor: pointer;
|
|
624
|
-
|
|
625
|
-
&:hover {
|
|
626
|
-
background-color: ${t.alpha(t.COLORS.black,5)};
|
|
627
|
-
}
|
|
628
|
-
`,Se=s.button`
|
|
629
|
-
display: flex;
|
|
630
|
-
align-items: center;
|
|
631
|
-
justify-content: center;
|
|
632
|
-
width: 28px;
|
|
633
|
-
height: 28px;
|
|
634
|
-
border: none;
|
|
635
|
-
background: transparent;
|
|
636
|
-
border-radius: 6px;
|
|
637
|
-
color: ${t.COLORS.black};
|
|
638
|
-
cursor: pointer;
|
|
639
|
-
|
|
640
|
-
&:hover {
|
|
641
|
-
background-color: ${t.alpha(t.COLORS.black,5)};
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
&:disabled {
|
|
645
|
-
opacity: 0.3;
|
|
646
|
-
cursor: not-allowed;
|
|
647
|
-
|
|
648
|
-
&:hover {
|
|
649
|
-
background: transparent;
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
`,st=s.div`
|
|
653
|
-
display: flex;
|
|
654
|
-
gap: 4px;
|
|
655
|
-
`,Bi=s.div`
|
|
656
|
-
display: grid;
|
|
657
|
-
grid-template-columns: repeat(7, ${ie}px);
|
|
658
|
-
gap: ${rt}px;
|
|
659
|
-
margin-bottom: 4px;
|
|
660
|
-
`,Yi=s.div`
|
|
661
|
-
display: flex;
|
|
662
|
-
align-items: center;
|
|
663
|
-
justify-content: center;
|
|
664
|
-
height: ${ie}px;
|
|
665
|
-
font-size: 12px;
|
|
666
|
-
font-weight: 500;
|
|
667
|
-
color: ${t.alpha(t.COLORS.black,50)};
|
|
668
|
-
text-transform: uppercase;
|
|
669
|
-
`,Vi=s.div`
|
|
670
|
-
display: grid;
|
|
671
|
-
grid-template-columns: repeat(7, ${ie}px);
|
|
672
|
-
gap: ${rt}px;
|
|
673
|
-
`,Hi=s.button`
|
|
674
|
-
display: flex;
|
|
675
|
-
align-items: center;
|
|
676
|
-
justify-content: center;
|
|
677
|
-
width: ${ie}px;
|
|
678
|
-
height: ${ie}px;
|
|
679
|
-
border: none;
|
|
680
|
-
border-radius: 8px;
|
|
681
|
-
font-size: 13px;
|
|
682
|
-
font-weight: ${({$selected:e,$today:r})=>e||r?600:500};
|
|
683
|
-
cursor: ${({$disabled:e})=>e?"not-allowed":"pointer"};
|
|
684
|
-
background-color: ${({$selected:e})=>e?t.COLORS.black:"transparent"};
|
|
685
|
-
color: ${({$selected:e,$disabled:r})=>e?t.COLORS.white:r?t.alpha(t.COLORS.black,30):t.COLORS.black};
|
|
686
|
-
|
|
687
|
-
${({$today:e,$selected:r})=>e&&!r&&`
|
|
688
|
-
box-shadow: inset 0 0 0 1px ${t.COLORS.black};
|
|
689
|
-
`}
|
|
690
|
-
|
|
691
|
-
&:hover:not(:disabled) {
|
|
692
|
-
background-color: ${({$selected:e})=>e?t.COLORS.black:t.alpha(t.COLORS.black,8)};
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
&:disabled {
|
|
696
|
-
cursor: not-allowed;
|
|
697
|
-
}
|
|
698
|
-
`,Gi=s.div`
|
|
699
|
-
display: grid;
|
|
700
|
-
grid-template-columns: repeat(3, 1fr);
|
|
701
|
-
gap: 8px;
|
|
702
|
-
width: ${7*ie+6*rt}px;
|
|
703
|
-
`,Wi=s.button`
|
|
704
|
-
display: flex;
|
|
705
|
-
align-items: center;
|
|
706
|
-
justify-content: center;
|
|
707
|
-
padding: 12px 8px;
|
|
708
|
-
border: none;
|
|
709
|
-
border-radius: 8px;
|
|
710
|
-
font-size: 14px;
|
|
711
|
-
font-weight: ${({$selected:e,$current:r})=>e||r?600:400};
|
|
712
|
-
cursor: ${({$disabled:e})=>e?"not-allowed":"pointer"};
|
|
713
|
-
background-color: ${({$selected:e})=>e?t.COLORS.black:"transparent"};
|
|
714
|
-
color: ${({$selected:e,$disabled:r})=>e?t.COLORS.white:r?t.alpha(t.COLORS.black,30):t.COLORS.black};
|
|
715
|
-
|
|
716
|
-
${({$current:e,$selected:r})=>e&&!r&&`
|
|
717
|
-
box-shadow: inset 0 0 0 1px ${t.COLORS.black};
|
|
718
|
-
`}
|
|
719
|
-
|
|
720
|
-
&:hover:not(:disabled) {
|
|
721
|
-
background-color: ${({$selected:e})=>e?t.COLORS.black:t.alpha(t.COLORS.black,8)};
|
|
722
|
-
}
|
|
723
|
-
`,Ki=s.div`
|
|
724
|
-
display: grid;
|
|
725
|
-
grid-template-columns: repeat(3, 1fr);
|
|
726
|
-
gap: 8px;
|
|
727
|
-
width: ${7*ie+6*rt}px;
|
|
728
|
-
`,Ui=s.button`
|
|
729
|
-
display: flex;
|
|
730
|
-
align-items: center;
|
|
731
|
-
justify-content: center;
|
|
732
|
-
padding: 12px 8px;
|
|
733
|
-
border: none;
|
|
734
|
-
border-radius: 8px;
|
|
735
|
-
font-size: 14px;
|
|
736
|
-
font-weight: ${({$selected:e,$current:r})=>e||r?600:400};
|
|
737
|
-
cursor: ${({$disabled:e})=>e?"not-allowed":"pointer"};
|
|
738
|
-
background-color: ${({$selected:e})=>e?t.COLORS.black:"transparent"};
|
|
739
|
-
color: ${({$selected:e,$disabled:r})=>e?t.COLORS.white:r?t.alpha(t.COLORS.black,30):t.COLORS.black};
|
|
740
|
-
|
|
741
|
-
${({$current:e,$selected:r})=>e&&!r&&`
|
|
742
|
-
box-shadow: inset 0 0 0 1px ${t.COLORS.black};
|
|
743
|
-
`}
|
|
744
|
-
|
|
745
|
-
&:hover:not(:disabled) {
|
|
746
|
-
background-color: ${({$selected:e})=>e?t.COLORS.black:t.alpha(t.COLORS.black,8)};
|
|
747
|
-
}
|
|
748
|
-
`,Xi=s.div`
|
|
749
|
-
width: ${ie}px;
|
|
750
|
-
height: ${ie}px;
|
|
751
|
-
`,q=T.newClassNameGetter("date-picker"),Ve=4,qi=300,Zi=({value:e,onChange:r,mode:o="date",displayFormat:n,placeholder:i,locale:l="en",weekStartsOn:c=1,minDate:d,maxDate:u,size:h="default",variant:b="normal",disabled:f=!1,fullWidth:O=!1,label:m,portalRenderNode:S,open:x,onOpen:y,onClose:$,className:C,classnames:g,ref:k,...N})=>{const P=p.useMemo(()=>new Date,[]),[Y,j]=p.useState(!1),[_,M]=p.useState({top:0,left:0}),[E,A]=p.useState("bottom"),[w,I]=p.useState(()=>o==="year"?"years":o==="month"?"months":"days"),[R,z]=p.useState(()=>e??P),[B,F]=p.useState(()=>((e==null?void 0:e.getFullYear())??P.getFullYear())-6),H=p.useRef(null),L=p.useRef(null),D=p.useRef(null),U=x!==void 0,X=U?x:Y,xe=n??Ni(o),_e=p.useMemo(()=>Ei(l,c),[l,c]),ot=p.useMemo(()=>ji(l),[l]),Gr=p.useMemo(()=>ki(R.getFullYear(),R.getMonth(),c),[R,c]),Me=p.useMemo(()=>zi(B+6,12),[B]),Pt=p.useMemo(()=>e?Lr(e,xe,l):null,[e,xe,l]),Wr=i??xe.replace(/2006|06|January|Jan|01|02/g,"__"),we=p.useCallback(()=>{var Re;if(!L.current)return;const v=L.current.getBoundingClientRect(),V=((Re=D.current)==null?void 0:Re.offsetHeight)??qi,ve=window.innerHeight-v.bottom-Ve,Fe=v.top-Ve,Oe=ve<V&&Fe>ve?"top":"bottom";if(A(Oe),S){const Be=Oe==="bottom"?v.bottom+Ve:v.top-V-Ve;M({top:Be,left:v.left})}},[S]),zt=p.useCallback(()=>{if(f)return;U||j(!0),y==null||y(),I(o==="year"?"years":o==="month"?"months":"days");const v=e??P;z(v),F(v.getFullYear()-6)},[f,U,y,o,e,P]),Z=p.useCallback(()=>{U||j(!1),$==null||$()},[U,$]),Kr=p.useCallback(()=>{X?Z():zt()},[X,Z,zt]),Ur=p.useCallback(v=>{const V=new Date(R.getFullYear(),R.getMonth(),v);r==null||r(V),Z()},[R,r,Z]),Xr=p.useCallback(v=>{if(o==="month"){const V=new Date(R.getFullYear(),v,1);r==null||r(V),Z()}else z(new Date(R.getFullYear(),v,1)),I("days")},[o,R,r,Z]),qr=p.useCallback(v=>{if(o==="year"){const V=new Date(v,0,1);r==null||r(V),Z()}else o==="month"?(z(new Date(v,R.getMonth(),1)),I("months")):(z(new Date(v,R.getMonth(),1)),I("months"))},[o,R,r,Z]),Zr=p.useCallback(()=>{z(v=>new Date(v.getFullYear(),v.getMonth()-1,1))},[]),Jr=p.useCallback(()=>{z(v=>new Date(v.getFullYear(),v.getMonth()+1,1))},[]),Qr=p.useCallback(()=>{z(v=>new Date(v.getFullYear()-1,v.getMonth(),1))},[]),eo=p.useCallback(()=>{z(v=>new Date(v.getFullYear()+1,v.getMonth(),1))},[]),to=p.useCallback(()=>{F(v=>v-12)},[]),ro=p.useCallback(()=>{F(v=>v+12)},[]),Nt=p.useCallback(()=>{w==="days"?I("months"):w==="months"&&I("years")},[w]);p.useLayoutEffect(()=>{X&&we()},[X,we]),p.useEffect(()=>{const v=Oe=>{const Re=Oe.target,Be=H.current&&!H.current.contains(Re),co=D.current&&!D.current.contains(Re);S?Be&&co&&Z():Be&&Z()},V=Oe=>{Oe.key==="Escape"&&Z()},ve=()=>{X&&S&&we()},Fe=()=>{X&&S&&we()};return X&&(document.addEventListener("mousedown",v),document.addEventListener("keydown",V),S&&(window.addEventListener("scroll",ve,!0),window.addEventListener("resize",Fe))),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",V),window.removeEventListener("scroll",ve,!0),window.removeEventListener("resize",Fe)}},[X,Z,S,we]);const oo=Je[h].iconSize,io=()=>a.jsxs(a.Fragment,{children:[a.jsxs(dt,{className:q("header",g==null?void 0:g.header),children:[a.jsx(ct,{onClick:Nt,type:"button",children:new Intl.DateTimeFormat(l,{month:"long",year:"numeric"}).format(R)}),a.jsxs(st,{children:[a.jsx(Se,{onClick:Zr,type:"button","aria-label":"Previous month",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(Se,{onClick:Jr,type:"button","aria-label":"Next month",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(Bi,{children:_e.map((v,V)=>a.jsx(Yi,{children:v},V))}),a.jsx(Vi,{className:q("grid",g==null?void 0:g.grid),children:Gr.map((v,V)=>v===null?a.jsx(Xi,{},V):a.jsx(Hi,{type:"button",className:q("cell",g==null?void 0:g.cell),$selected:e?Kt(e,new Date(R.getFullYear(),R.getMonth(),v)):!1,$today:Kt(P,new Date(R.getFullYear(),R.getMonth(),v)),$disabled:Xt(R.getFullYear(),R.getMonth(),v,d,u),disabled:Xt(R.getFullYear(),R.getMonth(),v,d,u),onClick:()=>Ur(v),children:v},V))})]}),no=()=>a.jsxs(a.Fragment,{children:[a.jsxs(dt,{className:q("header",g==null?void 0:g.header),children:[a.jsx(ct,{onClick:Nt,type:"button",children:R.getFullYear()}),a.jsxs(st,{children:[a.jsx(Se,{onClick:Qr,type:"button","aria-label":"Previous year",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(Se,{onClick:eo,type:"button","aria-label":"Next year",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(Gi,{className:q("grid",g==null?void 0:g.grid),children:ot.map((v,V)=>a.jsx(Wi,{type:"button",className:q("cell",g==null?void 0:g.cell),$selected:e?Ut(e,new Date(R.getFullYear(),V,1)):!1,$current:Ut(P,new Date(R.getFullYear(),V,1)),$disabled:qt(R.getFullYear(),V,d,u),disabled:qt(R.getFullYear(),V,d,u),onClick:()=>Xr(V),children:v},V))})]}),ao=()=>a.jsxs(a.Fragment,{children:[a.jsxs(dt,{className:q("header",g==null?void 0:g.header),children:[a.jsxs(ct,{type:"button",style:{cursor:"default"},children:[Me[0]," - ",Me[Me.length-1]]}),a.jsxs(st,{children:[a.jsx(Se,{onClick:to,type:"button","aria-label":"Previous years",children:a.jsx(a.ChevronLeft,{size:16})}),a.jsx(Se,{onClick:ro,type:"button","aria-label":"Next years",children:a.jsx(a.ChevronRight,{size:16})})]})]}),a.jsx(Ki,{className:q("grid",g==null?void 0:g.grid),children:Me.map(v=>a.jsx(Ui,{type:"button",className:q("cell",g==null?void 0:g.cell),$selected:e?Pi(e,new Date(v,0,1)):!1,$current:P.getFullYear()===v,$disabled:Zt(v,d,u),disabled:Zt(v,d,u),onClick:()=>qr(v),children:v},v))})]}),Tt=()=>{switch(w){case"days":return io();case"months":return no();case"years":return ao()}},lo=S?fe.createPortal(a.jsx(Fi,{ref:D,$open:X,$position:E,className:q("calendar",g==null?void 0:g.calendar),style:{top:_.top,left:_.left},children:Tt()}),S):a.jsx(Mi,{ref:D,$open:X,$position:E,className:q("calendar",g==null?void 0:g.calendar),children:Tt()});return a.jsxs(Ti,{...N,ref:k??H,$fullWidth:O,className:q("container",C),children:[m&&a.jsx(Ii,{children:m}),a.jsxs(Ai,{ref:L,type:"button",onClick:Kr,disabled:f,$size:h,$variant:b,$disabled:f,$open:X,$hasValue:!!Pt,className:q("trigger",g==null?void 0:g.trigger),children:[a.jsx(Di,{children:Pt??Wr}),a.jsx(_i,{$open:X,children:a.jsx(a.ChevronDown,{size:oo})})]}),lo]})},Ji=s.div`
|
|
173
|
+
`,et=A.newClassNameGetter("container"),tt=({children:e,className:t,ref:o,...i})=>d.jsx(Je,{...i,ref:o,className:et("container",t),children:e}),ot=c.styled.div`
|
|
752
174
|
display: flex;
|
|
753
175
|
flex-direction: row;
|
|
754
176
|
align-items: center;
|
|
755
177
|
gap: 8px;
|
|
756
178
|
margin-top: ${e=>e.$spacing}px;
|
|
757
179
|
margin-bottom: ${e=>e.$spacing}px;
|
|
758
|
-
`,
|
|
180
|
+
`,fe=c.styled.div`
|
|
759
181
|
flex: 1;
|
|
760
182
|
height: 1px;
|
|
761
|
-
background-color: ${
|
|
762
|
-
`,
|
|
183
|
+
background-color: ${a.COLORS.gray};
|
|
184
|
+
`,nt=c.styled.span`
|
|
763
185
|
font-size: 12px;
|
|
764
|
-
color: ${
|
|
186
|
+
color: ${a.COLORS["iron-grey"]};
|
|
765
187
|
white-space: nowrap;
|
|
766
|
-
`,
|
|
188
|
+
`,te=A.newClassNameGetter("divider"),it=({children:e,className:t,classnames:o,ref:i,spacing:n=8,...r})=>d.jsxs(ot,{...r,ref:i,className:te("container",t),$spacing:n,children:[d.jsx(fe,{className:te("line",o==null?void 0:o.line)}),e&&d.jsxs(d.Fragment,{children:[d.jsx(nt,{className:te("label",o==null?void 0:o.label),children:e}),d.jsx(fe,{className:te("line",o==null?void 0:o.line)})]})]}),rt={left:a.KEYFRAMES.slideInLeft,right:a.KEYFRAMES.slideInRight,top:a.KEYFRAMES.slideInTop,bottom:a.KEYFRAMES.slideInBottom},at=(e,t)=>{switch(e){case"left":return`
|
|
767
189
|
top: 0;
|
|
768
190
|
left: 0;
|
|
769
191
|
height: 100%;
|
|
770
|
-
width: ${
|
|
192
|
+
width: ${t};
|
|
771
193
|
`;case"right":return`
|
|
772
194
|
top: 0;
|
|
773
195
|
right: 0;
|
|
774
196
|
height: 100%;
|
|
775
|
-
width: ${
|
|
197
|
+
width: ${t};
|
|
776
198
|
`;case"top":return`
|
|
777
199
|
top: 0;
|
|
778
200
|
left: 0;
|
|
779
201
|
width: 100%;
|
|
780
|
-
height: ${
|
|
202
|
+
height: ${t};
|
|
781
203
|
`;case"bottom":return`
|
|
782
204
|
bottom: 0;
|
|
783
205
|
left: 0;
|
|
784
206
|
width: 100%;
|
|
785
|
-
height: ${
|
|
786
|
-
`}},
|
|
207
|
+
height: ${t};
|
|
208
|
+
`}},st=c.styled.div`
|
|
787
209
|
position: fixed;
|
|
788
210
|
z-index: 1001;
|
|
789
|
-
background-color: ${
|
|
790
|
-
box-shadow: 0 4px 24px ${
|
|
791
|
-
${e=>
|
|
792
|
-
animation: ${e=>
|
|
793
|
-
`,
|
|
211
|
+
background-color: ${a.COLORS.white};
|
|
212
|
+
box-shadow: 0 4px 24px ${a.alpha(a.COLORS.black,20)};
|
|
213
|
+
${e=>at(e.$position,e.$size)}
|
|
214
|
+
animation: ${e=>rt[e.$position]} ${e=>e.$animated?"0.05s":"0s"} ease-out forwards;
|
|
215
|
+
`,lt=A.newClassNameGetter("drawer"),ct=({animated:e,children:t,className:o,open:i,position:n="right",ref:r,size:l="400px",...s})=>i?he.createPortal(d.jsx(st,{...s,ref:r,className:lt("container",o),$animated:!!e,$position:n,$size:l,children:t}),document.body):null,dt=c.styled.div`
|
|
794
216
|
position: relative;
|
|
795
217
|
display: inline-block;
|
|
796
|
-
`,
|
|
218
|
+
`,pt=c.styled.div`
|
|
797
219
|
cursor: pointer;
|
|
798
|
-
`,
|
|
220
|
+
`,Le=`
|
|
799
221
|
z-index: 100;
|
|
800
222
|
min-width: 160px;
|
|
801
223
|
padding: 8px;
|
|
802
|
-
background-color: ${
|
|
803
|
-
border: 1px solid ${
|
|
224
|
+
background-color: ${a.COLORS.white};
|
|
225
|
+
border: 1px solid ${a.COLORS.gray};
|
|
804
226
|
border-radius: 8px;
|
|
805
227
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
806
|
-
`,
|
|
228
|
+
`,ke=(e,t)=>e?"translateY(0)":t==="bottom"?"translateY(-8px)":"translateY(8px)",ut=c.styled.div`
|
|
807
229
|
position: absolute;
|
|
808
230
|
${({$position:e})=>e==="bottom"?"top: calc(100% + 4px);":"bottom: calc(100% + 4px);"}
|
|
809
231
|
${({$align:e})=>e==="left"?"left: 0;":"right: 0;"}
|
|
810
|
-
${
|
|
232
|
+
${Le}
|
|
811
233
|
opacity: ${({$open:e})=>e?1:0};
|
|
812
234
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
813
|
-
transform: ${({$open:e,$position:
|
|
235
|
+
transform: ${({$open:e,$position:t})=>ke(e,t)};
|
|
814
236
|
transition:
|
|
815
237
|
opacity 0.15s ease,
|
|
816
238
|
transform 0.15s ease,
|
|
817
239
|
visibility 0.15s;
|
|
818
|
-
`,
|
|
240
|
+
`,gt=c.styled.div`
|
|
819
241
|
position: fixed;
|
|
820
|
-
${
|
|
242
|
+
${Le}
|
|
821
243
|
opacity: ${({$open:e})=>e?1:0};
|
|
822
244
|
visibility: ${({$open:e})=>e?"visible":"hidden"};
|
|
823
|
-
transform: ${({$open:e,$position:
|
|
245
|
+
transform: ${({$open:e,$position:t})=>ke(e,t)};
|
|
824
246
|
transition:
|
|
825
247
|
opacity 0.15s ease,
|
|
826
248
|
transform 0.15s ease,
|
|
827
249
|
visibility 0.15s;
|
|
828
|
-
`,
|
|
829
|
-
display:
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
line-height: 1.4;
|
|
835
|
-
color: ${({$isEmpty:e})=>e?t.COLORS["iron-grey"]:t.COLORS.black};
|
|
836
|
-
opacity: ${({$isEmpty:e})=>e?.6:1};
|
|
837
|
-
outline: none;
|
|
250
|
+
`,oe=A.newClassNameGetter("dropdown"),ne=4,ht=100,ft=({align:e="left",autoClose:t=!0,children:o,className:i,classnames:n,onClose:r,onOpen:l,open:s,portalRenderNode:p,ref:h,trigger:g,...f})=>{const[x,b]=u.useState(!1),[y,m]=u.useState({top:0,left:0}),[$,w]=u.useState("bottom"),v=u.useRef(null),C=u.useRef(null),L=u.useRef(null),F=s!==void 0,I=F?s:x,U=u.useCallback(()=>{var z,P;if(!C.current)return;const k=C.current.getBoundingClientRect(),N=((z=L.current)==null?void 0:z.offsetHeight)??ht,D=((P=L.current)==null?void 0:P.offsetWidth)??160,j=window.innerHeight-k.bottom-ne,Y=k.top-ne,X=j<N&&Y>j?"top":"bottom";if(w(X),p){let q;e==="left"?q=k.left:q=k.right-D;const je=X==="bottom"?k.bottom+ne:k.top-N-ne;m({top:je,left:q})}},[e,p]),S=u.useCallback(()=>{F?I?r==null||r():l==null||l():b(k=>{const N=!k;return N?l==null||l():r==null||r(),N})},[F,I,r,l]),T=u.useCallback(()=>{F||b(!1),r==null||r()},[F,r]),M=u.useCallback(()=>{t&&T()},[t,T]);u.useLayoutEffect(()=>{I&&U()},[I,U]),u.useEffect(()=>{const k=Y=>{const X=Y.target,z=v.current&&!v.current.contains(X),P=L.current&&!L.current.contains(X);p?z&&P&&T():z&&T()},N=Y=>{Y.key==="Escape"&&T()},D=()=>{I&&p&&U()},j=()=>{I&&p&&U()};return I&&(document.addEventListener("mousedown",k),document.addEventListener("keydown",N),p&&(window.addEventListener("scroll",D,!0),window.addEventListener("resize",j))),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",N),window.removeEventListener("scroll",D,!0),window.removeEventListener("resize",j)}},[I,T,p,U]);const W=p?he.createPortal(d.jsx(gt,{ref:L,$open:I,$position:$,className:oe("content",n==null?void 0:n.content),style:{top:y.top,left:y.left},onClick:M,children:o}),p):d.jsx(ut,{ref:L,$align:e,$open:I,$position:$,className:oe("content",n==null?void 0:n.content),onClick:M,children:o});return d.jsxs(dt,{...f,ref:h??v,className:oe("container",i),children:[d.jsx(pt,{ref:C,onClick:S,className:oe("trigger",n==null?void 0:n.trigger),children:u.cloneElement(g)}),W]})},xt=c.styled.div`
|
|
251
|
+
display: grid;
|
|
252
|
+
grid-template-rows: auto 1fr auto;
|
|
253
|
+
grid-auto-flow: column;
|
|
254
|
+
grid-auto-columns: 1fr;
|
|
255
|
+
column-gap: ${e=>typeof e.$gap=="number"?`${e.$gap}px`:e.$gap};
|
|
838
256
|
|
|
839
|
-
|
|
840
|
-
|
|
257
|
+
> * {
|
|
258
|
+
grid-row: 1 / -1;
|
|
259
|
+
display: grid;
|
|
260
|
+
grid-template-rows: subgrid;
|
|
261
|
+
gap: 2px;
|
|
841
262
|
}
|
|
842
|
-
`,gn=s.button`
|
|
843
|
-
display: inline-flex;
|
|
844
|
-
align-items: center;
|
|
845
|
-
justify-content: center;
|
|
846
|
-
width: 16px;
|
|
847
|
-
height: 16px;
|
|
848
|
-
padding: 0;
|
|
849
|
-
background: transparent;
|
|
850
|
-
border: none;
|
|
851
|
-
cursor: ${({$disabled:e})=>e?"not-allowed":"pointer"};
|
|
852
|
-
color: ${({$disabled:e})=>e?t.COLORS.gray:t.COLORS["iron-grey"]};
|
|
853
|
-
opacity: ${({$disabled:e})=>e?.5:.7};
|
|
854
|
-
transition: opacity 0.2s ease-in-out;
|
|
855
263
|
|
|
856
|
-
|
|
857
|
-
|
|
264
|
+
> * > [class*='field-label'] {
|
|
265
|
+
grid-row: 1;
|
|
858
266
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
267
|
+
|
|
268
|
+
> * > [class*='field-message'] {
|
|
269
|
+
grid-row: 3;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
> * > :not([class*='field-label']):not([class*='field-message']) {
|
|
273
|
+
grid-row: 2;
|
|
274
|
+
}
|
|
275
|
+
`,mt=A.newClassNameGetter("field-row"),bt=({className:e,gap:t=16,ref:o,...i})=>d.jsx(xt,{...i,ref:o,$gap:t,className:mt("container",e)}),yt=c.styled.div`
|
|
866
276
|
display: flex;
|
|
867
277
|
flex-direction: column;
|
|
868
278
|
gap: 12px;
|
|
869
|
-
`,
|
|
279
|
+
`,wt=c.styled.div`
|
|
870
280
|
width: ${({$size:e})=>e}px;
|
|
871
281
|
height: ${({$size:e})=>e}px;
|
|
872
282
|
border-radius: 8px;
|
|
873
|
-
border: 1px dashed ${
|
|
283
|
+
border: 1px dashed ${a.COLORS.gray};
|
|
874
284
|
overflow: hidden;
|
|
875
285
|
display: flex;
|
|
876
286
|
align-items: center;
|
|
877
287
|
justify-content: center;
|
|
878
|
-
background-color: ${
|
|
288
|
+
background-color: ${a.COLORS.white};
|
|
879
289
|
|
|
880
290
|
img {
|
|
881
291
|
width: 100%;
|
|
882
292
|
height: 100%;
|
|
883
293
|
object-fit: cover;
|
|
884
294
|
}
|
|
885
|
-
|
|
295
|
+
`,$t=c.styled.span`
|
|
886
296
|
font-size: 12px;
|
|
887
|
-
color: ${
|
|
888
|
-
`,
|
|
297
|
+
color: ${a.COLORS["iron-grey"]};
|
|
298
|
+
`,St=e=>`
|
|
889
299
|
.${e} {
|
|
890
300
|
padding: 7px 16px;
|
|
891
301
|
font-size: 14px;
|
|
@@ -903,7 +313,7 @@
|
|
|
903
313
|
.${e}:active {
|
|
904
314
|
transform: translate(0, 1px);
|
|
905
315
|
}
|
|
906
|
-
`,
|
|
316
|
+
`,vt=e=>`
|
|
907
317
|
.${e} {
|
|
908
318
|
display: flex;
|
|
909
319
|
flex: 1 1 auto;
|
|
@@ -927,7 +337,7 @@
|
|
|
927
337
|
max-height: 70vh;
|
|
928
338
|
}
|
|
929
339
|
}
|
|
930
|
-
`,
|
|
340
|
+
`,Ct=e=>`
|
|
931
341
|
.${e} {
|
|
932
342
|
padding: 7px 16px;
|
|
933
343
|
font-size: 14px;
|
|
@@ -945,7 +355,7 @@
|
|
|
945
355
|
.${e}:active {
|
|
946
356
|
transform: translate(0, 1px);
|
|
947
357
|
}
|
|
948
|
-
`,
|
|
358
|
+
`,Ot=e=>`
|
|
949
359
|
.${e} {
|
|
950
360
|
display: flex;
|
|
951
361
|
flex-direction: column;
|
|
@@ -963,7 +373,7 @@
|
|
|
963
373
|
border-radius: 8px;
|
|
964
374
|
}
|
|
965
375
|
}
|
|
966
|
-
`,
|
|
376
|
+
`,Rt=e=>`
|
|
967
377
|
.${e} {
|
|
968
378
|
display: flex;
|
|
969
379
|
justify-content: flex-end;
|
|
@@ -982,7 +392,7 @@
|
|
|
982
392
|
gap: 8px;
|
|
983
393
|
}
|
|
984
394
|
}
|
|
985
|
-
`,
|
|
395
|
+
`,Et=e=>`
|
|
986
396
|
.${e} {
|
|
987
397
|
display: flex;
|
|
988
398
|
justify-content: flex-start;
|
|
@@ -1004,7 +414,7 @@
|
|
|
1004
414
|
font-size: 14px;
|
|
1005
415
|
}
|
|
1006
416
|
}
|
|
1007
|
-
`,
|
|
417
|
+
`,Lt=e=>`
|
|
1008
418
|
.${e} {
|
|
1009
419
|
display: block;
|
|
1010
420
|
z-index: 101;
|
|
@@ -1022,27 +432,27 @@
|
|
|
1022
432
|
position: absolute;
|
|
1023
433
|
touch-action: none;
|
|
1024
434
|
}
|
|
1025
|
-
`,
|
|
435
|
+
`,kt=e=>`
|
|
1026
436
|
.${e} {
|
|
1027
437
|
position: absolute;
|
|
1028
438
|
z-index: 2;
|
|
1029
439
|
background-color: rgba(0, 0, 0, 0.6);
|
|
1030
440
|
touch-action: none;
|
|
1031
441
|
}
|
|
1032
|
-
`,
|
|
442
|
+
`,zt=e=>`
|
|
1033
443
|
.${e} {
|
|
1034
444
|
position: absolute;
|
|
1035
445
|
z-index: 3;
|
|
1036
446
|
touch-action: none;
|
|
1037
447
|
}
|
|
1038
|
-
`,
|
|
448
|
+
`,Tt=e=>`
|
|
1039
449
|
.${e} {
|
|
1040
450
|
backface-visibility: hidden;
|
|
1041
451
|
perspective: 1000px;
|
|
1042
452
|
max-inline-size: unset !important;
|
|
1043
453
|
max-block-size: unset !important;
|
|
1044
454
|
}
|
|
1045
|
-
`,
|
|
455
|
+
`,Pt=e=>`
|
|
1046
456
|
.${e} {
|
|
1047
457
|
position: absolute;
|
|
1048
458
|
z-index: 100;
|
|
@@ -1053,7 +463,7 @@
|
|
|
1053
463
|
overflow: hidden;
|
|
1054
464
|
border-radius: 50%;
|
|
1055
465
|
}
|
|
1056
|
-
`,
|
|
466
|
+
`,At={tl:"nw-resize",tr:"ne-resize",bl:"sw-resize",br:"se-resize"},It={tl:{h:"left",v:"top"},tr:{h:"right",v:"top"},bl:{h:"left",v:"bottom"},br:{h:"right",v:"bottom"}},ie=(e,t)=>{const o=At[t],{h:i,v:n}=It[t];return`
|
|
1057
467
|
.${e} {
|
|
1058
468
|
display: block;
|
|
1059
469
|
z-index: 102;
|
|
@@ -1063,8 +473,8 @@
|
|
|
1063
473
|
-moz-user-select: none;
|
|
1064
474
|
-ms-user-select: none;
|
|
1065
475
|
user-select: none;
|
|
1066
|
-
${n}: -3px;
|
|
1067
476
|
${i}: -3px;
|
|
477
|
+
${n}: -3px;
|
|
1068
478
|
position: absolute;
|
|
1069
479
|
width: 5px;
|
|
1070
480
|
height: 5px;
|
|
@@ -1075,11 +485,11 @@
|
|
|
1075
485
|
.${e} {
|
|
1076
486
|
width: 24px;
|
|
1077
487
|
height: 24px;
|
|
1078
|
-
${n}: -12px;
|
|
1079
488
|
${i}: -12px;
|
|
489
|
+
${n}: -12px;
|
|
1080
490
|
}
|
|
1081
491
|
}
|
|
1082
|
-
`},
|
|
492
|
+
`},Nt=e=>`
|
|
1083
493
|
.${e} {
|
|
1084
494
|
display: flex;
|
|
1085
495
|
align-items: center;
|
|
@@ -1105,7 +515,7 @@
|
|
|
1105
515
|
padding-bottom: env(safe-area-inset-bottom, 8px);
|
|
1106
516
|
}
|
|
1107
517
|
}
|
|
1108
|
-
`,
|
|
518
|
+
`,jt=e=>`
|
|
1109
519
|
.${e} {
|
|
1110
520
|
backface-visibility: hidden;
|
|
1111
521
|
user-select: none;
|
|
@@ -1118,225 +528,97 @@
|
|
|
1118
528
|
position: absolute;
|
|
1119
529
|
z-index: 1;
|
|
1120
530
|
}
|
|
1121
|
-
`,
|
|
1122
|
-
${
|
|
1123
|
-
${
|
|
1124
|
-
${
|
|
1125
|
-
${
|
|
1126
|
-
${
|
|
1127
|
-
${
|
|
1128
|
-
${
|
|
1129
|
-
${
|
|
1130
|
-
${
|
|
1131
|
-
${
|
|
1132
|
-
${
|
|
1133
|
-
${
|
|
1134
|
-
${
|
|
1135
|
-
${
|
|
1136
|
-
${
|
|
1137
|
-
${
|
|
1138
|
-
${
|
|
1139
|
-
`,n=document.createElement("style");return n.innerHTML=o,document.getElementsByTagName("head")[0].prepend(n),r};let Bn=0;const Yn=e=>{const r=new Map,o=new Proxy({...e},{set(n,i,l){return Reflect.set(n,i,l),(r.get(i)||[]).forEach(c=>c.action(l,n,i)),!0}});return{getState:()=>({...o}),setState:n=>{for(const i of Object.keys(n)){const l=n[i];l!==void 0&&(o[i]=l)}},subscribe:(n,i)=>{const l=String(++Bn),c=r.get(n)||[];return r.set(n,[...c,{action:i,id:l}]),l},unsubscribe:n=>{for(const[i,l]of r.entries()){const c=l.filter(d=>d.id!==n);if(c.length!==l.length){r.set(i,c);return}}},unsubscribeAll:()=>{r.clear()}}},Rt={action:null,sourceBase64:"",fileName:"",sourceHeight:0,sourceWidth:0,frame:{left:0,top:0,width:0,height:0},portal:{left:0,top:0,size:0},emitted:{X:0,Y:0,left:0,top:0,size:0},config:{applyButtonLabel:"Apply",cancelButtonLabel:"Cancel",compression:1,framePadding:3,minPortalSize:50,portalPosition:"center",portalSize:150,outputSize:0,type:"jpeg",maxFileSize:0,allowedTypes:["image/jpeg","image/png","image/gif","image/webp"]}},Vn=(e={},r={})=>Yn({...Rt,config:{...Rt.config,...e},css:Fn(r)}),Hn=(e,r)=>{var O;const o=e(),n=document.querySelector(`.${(O=o.css)==null?void 0:O.body[0]}`);if(!n)return o.frame;const{width:i,height:l}=n.getBoundingClientRect(),c=i/l,d=r.width/r.height;let u,h,b=0,f=0;return c>d?(u=l*d,h=l,f=(i-u)/2):(u=i,h=i*(r.height/r.width),b=(l-h)/2),{width:u,height:h,left:f,top:b}},Gn=(e,r,o)=>{const[n,i]=r,l=n+e>o.width?(o.width-e)/2:n,c=i+e>o.height?(o.height-e)/2:i;return[l,c]},Wn=(e,r)=>{const{config:o}=e(),n=Math.min(r.width,r.height)-o.framePadding*2,i=o.portalSize>n?n:o.portalSize;if(Array.isArray(o.portalPosition)&&o.portalPosition.length===2){const[l,c]=Gn(i,o.portalPosition,r);return{left:l,top:c,size:i}}return o.portalPosition==="center"?{size:i,left:(r.width-i)/2,top:(r.height-i)/2}:{left:0,top:0,size:i}};var te=(e=>(e.MOVE="MOVE",e.RESIZE_TL="RESIZE_TL",e.RESIZE_TR="RESIZE_TR",e.RESIZE_BR="RESIZE_BR",e.RESIZE_BL="RESIZE_BL",e))(te||{});const Kn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerMove),o.setAttribute("data-action",te.MOVE),o},Un=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerResizeBottomLeft),o.setAttribute("data-action",te.RESIZE_BL),o},Xn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerResizeBottomRight),o.setAttribute("data-action",te.RESIZE_BR),o},qn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerResizeTopLeft),o.setAttribute("data-action",te.RESIZE_TL),o},Zn=e=>{var n;const r=e(),o=document.createElement("span");return K(o,(n=r.css)==null?void 0:n.handlerResizeTopRight),o.setAttribute("data-action",te.RESIZE_TR),o},Jn=e=>{var n;const r=e(),o=document.createElement("img");return K(o,(n=r.css)==null?void 0:n.previewImage),o},Qn=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.preview),o.appendChild(Jn(e)),o},ea=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.portal),o.appendChild(Qn(e)),o.appendChild(Kn(e)),o.appendChild(qn(e)),o.appendChild(Zn(e)),o.appendChild(Un(e)),o.appendChild(Xn(e)),o},ta=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.portalArea),o.appendChild(ea(e)),o},ra=e=>{var n;const r=e(),o=document.createElement("img");return K(o,(n=r.css)==null?void 0:n.sourceImage),o.setAttribute("alt","source"),o.setAttribute("crossOrigin","anonymous"),o.setAttribute("draggable","false"),o.setAttribute("src",r.sourceBase64),o},oa=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.body),o.appendChild(ra(e)),o.appendChild(ta(e)),o},ia=(e,r)=>{var i;const o=e(),n=document.createElement("div");return K(n,(i=o.css)==null?void 0:i.applyButton),n.setAttribute("role","button"),n.innerText=o.config.applyButtonLabel,n.addEventListener("click",r),n},na=(e,r)=>{var i;const o=e(),n=document.createElement("div");return K(n,(i=o.css)==null?void 0:i.cancelButton),n.setAttribute("role","button"),n.innerText=o.config.cancelButtonLabel,n.addEventListener("click",r),n},aa=(e,r,o)=>{var l;const n=e(),i=document.createElement("div");return K(i,(l=n.css)==null?void 0:l.footer),i.appendChild(na(e,o)),i.appendChild(ia(e,r)),i},la=e=>{var n;const r=e(),o=document.createElement("div");return K(o,(n=r.css)==null?void 0:n.header),o},da=(e,r,o)=>{var l;const n=e(),i=document.createElement("div");return K(i,(l=n.css)==null?void 0:l.container),i.appendChild(la(e)),i.appendChild(oa(e)),i.appendChild(aa(e,r,o)),i},ca=(e,r,o)=>{var l;const n=e(),i=document.createElement("div");K(i,(l=n.css)==null?void 0:l.root),i.appendChild(da(e,r,o)),document.body.appendChild(i)},sa=e=>{const r=document.createElement("input");return r.style.display="none",r.setAttribute("type","file"),r.setAttribute("accept","image/x-png,image/jpeg"),r.addEventListener("change",e,!1),document.body.appendChild(r),r},Ae=new Map,pa={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},ue=(e,r)=>{if(Ae.has(e))return Ae.get(e);if(!r)return null;const o=r[pa[e]],n=document.querySelector(`.${o[0]}`);return Ae.set(e,n),n},ua=()=>{Ae.clear()},ha=()=>{Ae.clear()},ba=(e,r)=>{const o=ue("header",r.css);o&&(o.innerText=e)},ga=(e,r)=>{const o=ue("sourceImage",r.css);o&&(o.setAttribute("src",e),o.style.height=`${r.frame.height}px`,o.style.width=`${r.frame.width}px`,o.style.left=`${r.frame.left}px`,o.style.top=`${r.frame.top}px`);const n=ue("portalArea",r.css);n&&(n.style.height=`${r.frame.height}px`,n.style.width=`${r.frame.width}px`,n.style.left=`${r.frame.left}px`,n.style.top=`${r.frame.top}px`);const i=ue("portal",r.css);i&&(i.style.width=`${r.portal.size}px`,i.style.height=`${r.portal.size}px`,i.style.left=`${r.portal.left}px`,i.style.top=`${r.portal.top}px`);const l=ue("previewImage",r.css);l&&(l.setAttribute("src",e),l.style.height=`${r.frame.height}px`,l.style.width=`${r.frame.width}px`,l.style.marginLeft=`-${r.portal.left}px`,l.style.marginTop=`-${r.portal.top}px`)},fa=(e,r)=>{const o=ue("portal",r.css);o&&(o.style.left=`${e.left}px`,o.style.top=`${e.top}px`,o.style.width=`${e.size}px`,o.style.height=`${e.size}px`);const n=ue("previewImage",r.css);n&&(n.style.marginLeft=`-${e.left}px`,n.style.marginTop=`-${e.top}px`)},pt=1,xa=e=>{var m,S;const r=e(),o=document.createElement("canvas"),n=r.frame.width||pt,i=r.frame.height||pt,l=r.sourceWidth/n,c=r.sourceHeight/i,d=r.portal.left*l,u=r.portal.top*c,h=Math.max(r.portal.size*Math.min(l,c),pt),b=r.config.outputSize>0?r.config.outputSize:h;o.width=b,o.height=b;const f=document.querySelector(`.${(m=r.css)==null?void 0:m.sourceImage[0]}`);f&&((S=o.getContext("2d"))==null||S.drawImage(f,d,u,h,h,0,0,b,b));const O=o.toDataURL(`image/${r.config.type}`,r.config.compression);return new Promise((x,y)=>{try{o.toBlob($=>{if(o.remove(),!$){y(new Error(`Failed to create blob for type: image/${r.config.type}`));return}x([O,$])},`image/${r.config.type}`,r.config.compression)}catch($){o.remove(),y($)}})},Oa=(e,r,o)=>{const{emitted:n,portal:i,frame:l,config:c}=r();let d=n.left-n.X+e.clientX,u=n.top-n.Y+e.clientY;const h=c.framePadding,b=l.width-c.framePadding-i.size,f=c.framePadding,O=l.height-c.framePadding-i.size;d<h&&(d=h),d>b&&(d=b),u<f&&(u=f),u>O&&(u=O),o({portal:{...i,left:d,top:u}})},Sa=(e,r,o)=>{const{action:n,emitted:i,portal:l,frame:c,config:d}=r(),u=e.pageX-i.X,h=e.pageY-i.Y;switch(n){case te.RESIZE_BR:{let b=i.size+Math.max(u,h);return b<d.minPortalSize&&(b=d.minPortalSize),i.top+b>c.height-d.framePadding&&(b=c.height-i.top-d.framePadding),i.left+b>c.width-d.framePadding&&(b=c.width-i.left-d.framePadding),o({portal:{...l,size:b}})}case te.RESIZE_TR:{let b=u+h>0?i.size+u:i.size-h,f=u+h>0?i.top-u:i.top+h;return b<d.minPortalSize&&(f=i.top+i.size-d.minPortalSize,b=d.minPortalSize),i.left+b>c.width-d.framePadding&&(b=c.width-i.left-d.framePadding,f=i.top-c.width+i.left+i.size),f<d.framePadding&&(b=i.top+i.size,f=d.framePadding),o({portal:{...l,top:f,size:b}})}case te.RESIZE_TL:{const b=Math.min(u,h);let f=i.size-b,O=i.left+b,m=i.top+b;if(f<d.minPortalSize){const S=i.size-d.minPortalSize;f=d.minPortalSize,O=i.left+S,m=i.top+S}if(m<d.framePadding){const S=d.framePadding-m;m=d.framePadding,O=O+S,f=f-S}if(O<d.framePadding){const S=d.framePadding-O;O=d.framePadding,m=m+S,f=f-S}return o({portal:{...l,top:m,left:O,size:f}})}case te.RESIZE_BL:{let b=u+h>0?i.size+h:i.size-u,f=u+h>0?i.left-h:i.left+u;return b<d.minPortalSize&&(f=i.left+i.size-d.minPortalSize,b=d.minPortalSize),b+i.top>c.height-d.framePadding&&(f=i.left-c.height+i.top+i.size,b=c.height-i.top-d.framePadding),f<d.framePadding&&(f=d.framePadding,b=i.left+i.size-d.framePadding),o({portal:{...l,left:f,size:b}})}default:return}},Qt=e=>{if("touches"in e&&e.touches.length>0){const o=e.touches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}if("changedTouches"in e&&e.changedTouches.length>0){const o=e.changedTouches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}const r=e;return{clientX:r.clientX,clientY:r.clientY,pageX:r.pageX,pageY:r.pageY}},$a=(e,r)=>{var O,m,S;const o=e(),n=document.querySelector(`.${(O=o.css)==null?void 0:O.portal[0]}`),i=document.querySelector(`.${(m=o.css)==null?void 0:m.portalArea[0]}`),l=document.querySelector(`.${(S=o.css)==null?void 0:S.root[0]}`);let c=null,d=null;const u=x=>{x.preventDefault();const{portal:y}=e(),$=Qt(x);if(x.target){const C=x.target.getAttribute("data-action"),g={X:$.pageX,Y:$.pageY,left:y.left,top:y.top,size:y.size};r({action:C,emitted:g})}},h=()=>{const{action:x}=e();c!==null&&(cancelAnimationFrame(c),c=null),d=null,x&&r({action:null})},b=()=>{if(c=null,!d)return;const x=d;d=null;const{action:y}=e();if(y)switch(y){case te.MOVE:Oa(x,e,r);break;default:Sa(x,e,r)}},f=x=>{const{action:y}=e();y&&(x.preventDefault(),d=Qt(x),c===null&&(c=requestAnimationFrame(b)))};return l&&(l.addEventListener("mouseup",h),l.addEventListener("touchend",h),l.addEventListener("touchcancel",h)),n&&(n.addEventListener("mousedown",u),n.addEventListener("touchstart",u,{passive:!1})),i&&(i.addEventListener("mousemove",f),i.addEventListener("touchmove",f,{passive:!1})),()=>{c!==null&&cancelAnimationFrame(c),l&&(l.removeEventListener("mouseup",h),l.removeEventListener("touchend",h),l.removeEventListener("touchcancel",h)),n&&(n.removeEventListener("mousedown",u),n.removeEventListener("touchstart",u)),i&&(i.removeEventListener("mousemove",f),i.removeEventListener("touchmove",f))}},er=1024*1024,ya=(e,r)=>{if(!r.allowedTypes.includes(e.type))return`Invalid file type "${e.type}". Allowed types: ${r.allowedTypes.join(", ")}`;if(r.maxFileSize>0&&e.size>r.maxFileSize){const o=(r.maxFileSize/er).toFixed(2);return`File size (${(e.size/er).toFixed(2)}MB) exceeds maximum allowed size (${o}MB)`}return null},Ca=(e,r,o,n,i,l,c)=>{const d=$=>{c?c($):console.error(`HqCropper: ${$}`)};if(!e.target.files||e.target.files.length===0){d("Can't read file input");return}const u=e.target.files[0],{config:h}=r(),b=ya(u,h);if(b){d(b),e.target.value="";return}const f=new FileReader;let O=null;const m=()=>{var g;const $=r(),C=document.querySelector(`.${(g=$.css)==null?void 0:g.root[0]}`);C&&(C.remove(),document.removeEventListener("keydown",S),O==null||O(),ha(),l(),o(Rt))},S=$=>{$.key==="Escape"&&r().sourceBase64&&x($)},x=$=>{$.preventDefault(),m()},y=$=>{$.preventDefault();const C=r();xa(r).then(([g,k])=>{n(g,k,C),x($)}).catch(g=>{d(g instanceof Error?g.message:"Failed to crop image")})};f.onload=$=>{const C=new Image;if(!$.target||typeof $.target.result!="string"){d("Can't load result image");return}C.src=$.target.result,C.onerror=()=>{d("Failed to load image")},C.onload=()=>{var N;ca(r,y,x),ua(),i("fileName",ba),i("sourceBase64",ga),i("portal",fa);const g=Hn(r,C),k=Wn(r,g);o({frame:g,portal:k,fileName:u.name,sourceBase64:(N=$.target)==null?void 0:N.result,sourceHeight:C.height,sourceWidth:C.width}),O=$a(r,o),document.addEventListener("keydown",S)}},f.onerror=()=>{d("Failed to read file")},f.readAsDataURL(u),e.target.value=""},ma=(e,r,o,n)=>{const{getState:i,setState:l,subscribe:c,unsubscribeAll:d}=Vn(r,o),u=sa(h=>Ca(h,i,l,e,c,d,n));return{open:()=>u.click()}},le={portalSize:200,outputSize:400,compression:.9,type:"jpeg",maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp"],applyLabel:"Apply",cancelLabel:"Cancel"},tr="vacano-image-cropper-styles",wa=`
|
|
531
|
+
`,Bt=e=>{let t=5381;for(let o=0;o<e.length;o++)t=(t<<5)+t^e.charCodeAt(o);return Math.abs(t).toString(36)},O=e=>`hq-cropper__${Bt(e)}`,R=e=>e||[],E=(e,t)=>{if(t)for(const o of t)e.classList.add(o)},Ft=e=>{const t={applyButton:[O("applyButton"),...R(e.applyButton)],cancelButton:[O("cancelButton"),...R(e.cancelButton)],container:[O("container"),...R(e.container)],handlerMove:[O("handlerMove"),...R(e.handlerMove)],handlerResizeTopLeft:[O("handlerResizeTopLeft"),...R(e.handlerResizeTopLeft)],handlerResizeTopRight:[O("handlerResizeTopRight"),...R(e.handlerResizeTopRight)],handlerResizeBottomLeft:[O("handlerResizeBottomLeft"),...R(e.handlerResizeBottomLeft)],handlerResizeBottomRight:[O("handlerResizeBottomRight"),...R(e.handlerResizeBottomRight)],sourceImage:[O("sourceImage"),...R(e.sourceImage)],portalArea:[O("portalArea"),...R(e.portalArea)],previewImage:[O("previewImage"),...R(e.previewImage)],body:[O("body"),...R(e.body)],header:[O("header"),...R(e.header)],footer:[O("footer"),...R(e.footer)],portal:[O("portal"),...R(e.portal)],preview:[O("preview"),...R(e.preview)],root:[O("root"),...R(e.root)]},o=`
|
|
532
|
+
${St(t.applyButton[0])}
|
|
533
|
+
${vt(t.body[0])}
|
|
534
|
+
${Ct(t.cancelButton[0])}
|
|
535
|
+
${Ot(t.container[0])}
|
|
536
|
+
${Rt(t.footer[0])}
|
|
537
|
+
${Et(t.header[0])}
|
|
538
|
+
${Lt(t.handlerMove[0])}
|
|
539
|
+
${kt(t.portalArea[0])}
|
|
540
|
+
${zt(t.portal[0])}
|
|
541
|
+
${Tt(t.previewImage[0])}
|
|
542
|
+
${Pt(t.preview[0])}
|
|
543
|
+
${ie(t.handlerResizeBottomLeft[0],"bl")}
|
|
544
|
+
${ie(t.handlerResizeBottomRight[0],"br")}
|
|
545
|
+
${ie(t.handlerResizeTopLeft[0],"tl")}
|
|
546
|
+
${ie(t.handlerResizeTopRight[0],"tr")}
|
|
547
|
+
${Nt(t.root[0])}
|
|
548
|
+
${jt(t.sourceImage[0])}
|
|
549
|
+
`,i=document.createElement("style");return i.innerHTML=o,document.getElementsByTagName("head")[0].prepend(i),t};let Mt=0;const _t=e=>{const t=new Map,o=new Proxy({...e},{set(i,n,r){return Reflect.set(i,n,r),(t.get(n)||[]).forEach(l=>l.action(r,i,n)),!0}});return{getState:()=>({...o}),setState:i=>{for(const n of Object.keys(i)){const r=i[n];r!==void 0&&(o[n]=r)}},subscribe:(i,n)=>{const r=String(++Mt),l=t.get(i)||[];return t.set(i,[...l,{action:n,id:r}]),r},unsubscribe:i=>{for(const[n,r]of t.entries()){const l=r.filter(s=>s.id!==i);if(l.length!==r.length){t.set(n,l);return}}},unsubscribeAll:()=>{t.clear()}}},ue={action:null,sourceBase64:"",fileName:"",sourceHeight:0,sourceWidth:0,frame:{left:0,top:0,width:0,height:0},portal:{left:0,top:0,size:0},emitted:{X:0,Y:0,left:0,top:0,size:0},config:{applyButtonLabel:"Apply",cancelButtonLabel:"Cancel",compression:1,framePadding:3,minPortalSize:50,portalPosition:"center",portalSize:150,outputSize:0,type:"jpeg",maxFileSize:0,allowedTypes:["image/jpeg","image/png","image/gif","image/webp"]}},Dt=(e={},t={})=>_t({...ue,config:{...ue.config,...e},css:Ft(t)}),Yt=(e,t)=>{var x;const o=e(),i=document.querySelector(`.${(x=o.css)==null?void 0:x.body[0]}`);if(!i)return o.frame;const{width:n,height:r}=i.getBoundingClientRect(),l=n/r,s=t.width/t.height;let p,h,g=0,f=0;return l>s?(p=r*s,h=r,f=(n-p)/2):(p=n,h=n*(t.height/t.width),g=(r-h)/2),{width:p,height:h,left:f,top:g}},Xt=(e,t,o)=>{const[i,n]=t,r=i+e>o.width?(o.width-e)/2:i,l=n+e>o.height?(o.height-e)/2:n;return[r,l]},qt=(e,t)=>{const{config:o}=e(),i=Math.min(t.width,t.height)-o.framePadding*2,n=o.portalSize>i?i:o.portalSize;if(Array.isArray(o.portalPosition)&&o.portalPosition.length===2){const[r,l]=Xt(n,o.portalPosition,t);return{left:r,top:l,size:n}}return o.portalPosition==="center"?{size:n,left:(t.width-n)/2,top:(t.height-n)/2}:{left:0,top:0,size:n}};var B=(e=>(e.MOVE="MOVE",e.RESIZE_TL="RESIZE_TL",e.RESIZE_TR="RESIZE_TR",e.RESIZE_BR="RESIZE_BR",e.RESIZE_BL="RESIZE_BL",e))(B||{});const Gt=e=>{var i;const t=e(),o=document.createElement("span");return E(o,(i=t.css)==null?void 0:i.handlerMove),o.setAttribute("data-action",B.MOVE),o},Kt=e=>{var i;const t=e(),o=document.createElement("span");return E(o,(i=t.css)==null?void 0:i.handlerResizeBottomLeft),o.setAttribute("data-action",B.RESIZE_BL),o},Ut=e=>{var i;const t=e(),o=document.createElement("span");return E(o,(i=t.css)==null?void 0:i.handlerResizeBottomRight),o.setAttribute("data-action",B.RESIZE_BR),o},Ht=e=>{var i;const t=e(),o=document.createElement("span");return E(o,(i=t.css)==null?void 0:i.handlerResizeTopLeft),o.setAttribute("data-action",B.RESIZE_TL),o},Vt=e=>{var i;const t=e(),o=document.createElement("span");return E(o,(i=t.css)==null?void 0:i.handlerResizeTopRight),o.setAttribute("data-action",B.RESIZE_TR),o},Wt=e=>{var i;const t=e(),o=document.createElement("img");return E(o,(i=t.css)==null?void 0:i.previewImage),o},Zt=e=>{var i;const t=e(),o=document.createElement("div");return E(o,(i=t.css)==null?void 0:i.preview),o.appendChild(Wt(e)),o},Qt=e=>{var i;const t=e(),o=document.createElement("div");return E(o,(i=t.css)==null?void 0:i.portal),o.appendChild(Zt(e)),o.appendChild(Gt(e)),o.appendChild(Ht(e)),o.appendChild(Vt(e)),o.appendChild(Kt(e)),o.appendChild(Ut(e)),o},Jt=e=>{var i;const t=e(),o=document.createElement("div");return E(o,(i=t.css)==null?void 0:i.portalArea),o.appendChild(Qt(e)),o},eo=e=>{var i;const t=e(),o=document.createElement("img");return E(o,(i=t.css)==null?void 0:i.sourceImage),o.setAttribute("alt","source"),o.setAttribute("crossOrigin","anonymous"),o.setAttribute("draggable","false"),o.setAttribute("src",t.sourceBase64),o},to=e=>{var i;const t=e(),o=document.createElement("div");return E(o,(i=t.css)==null?void 0:i.body),o.appendChild(eo(e)),o.appendChild(Jt(e)),o},oo=(e,t)=>{var n;const o=e(),i=document.createElement("div");return E(i,(n=o.css)==null?void 0:n.applyButton),i.setAttribute("role","button"),i.innerText=o.config.applyButtonLabel,i.addEventListener("click",t),i},no=(e,t)=>{var n;const o=e(),i=document.createElement("div");return E(i,(n=o.css)==null?void 0:n.cancelButton),i.setAttribute("role","button"),i.innerText=o.config.cancelButtonLabel,i.addEventListener("click",t),i},io=(e,t,o)=>{var r;const i=e(),n=document.createElement("div");return E(n,(r=i.css)==null?void 0:r.footer),n.appendChild(no(e,o)),n.appendChild(oo(e,t)),n},ro=e=>{var i;const t=e(),o=document.createElement("div");return E(o,(i=t.css)==null?void 0:i.header),o},ao=(e,t,o)=>{var r;const i=e(),n=document.createElement("div");return E(n,(r=i.css)==null?void 0:r.container),n.appendChild(ro(e)),n.appendChild(to(e)),n.appendChild(io(e,t,o)),n},so=(e,t,o)=>{var r;const i=e(),n=document.createElement("div");E(n,(r=i.css)==null?void 0:r.root),n.appendChild(ao(e,t,o)),document.body.appendChild(n)},lo=e=>{const t=document.createElement("input");return t.style.display="none",t.setAttribute("type","file"),t.setAttribute("accept","image/x-png,image/jpeg"),t.addEventListener("change",e,!1),document.body.appendChild(t),t},J=new Map,co={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},H=(e,t)=>{if(J.has(e))return J.get(e);if(!t)return null;const o=t[co[e]],i=document.querySelector(`.${o[0]}`);return J.set(e,i),i},po=()=>{J.clear()},uo=()=>{J.clear()},go=(e,t)=>{const o=H("header",t.css);o&&(o.innerText=e)},ho=(e,t)=>{const o=H("sourceImage",t.css);o&&(o.setAttribute("src",e),o.style.height=`${t.frame.height}px`,o.style.width=`${t.frame.width}px`,o.style.left=`${t.frame.left}px`,o.style.top=`${t.frame.top}px`);const i=H("portalArea",t.css);i&&(i.style.height=`${t.frame.height}px`,i.style.width=`${t.frame.width}px`,i.style.left=`${t.frame.left}px`,i.style.top=`${t.frame.top}px`);const n=H("portal",t.css);n&&(n.style.width=`${t.portal.size}px`,n.style.height=`${t.portal.size}px`,n.style.left=`${t.portal.left}px`,n.style.top=`${t.portal.top}px`);const r=H("previewImage",t.css);r&&(r.setAttribute("src",e),r.style.height=`${t.frame.height}px`,r.style.width=`${t.frame.width}px`,r.style.marginLeft=`-${t.portal.left}px`,r.style.marginTop=`-${t.portal.top}px`)},fo=(e,t)=>{const o=H("portal",t.css);o&&(o.style.left=`${e.left}px`,o.style.top=`${e.top}px`,o.style.width=`${e.size}px`,o.style.height=`${e.size}px`);const i=H("previewImage",t.css);i&&(i.style.marginLeft=`-${e.left}px`,i.style.marginTop=`-${e.top}px`)},se=1,xo=e=>{var b,y;const t=e(),o=document.createElement("canvas"),i=t.frame.width||se,n=t.frame.height||se,r=t.sourceWidth/i,l=t.sourceHeight/n,s=t.portal.left*r,p=t.portal.top*l,h=Math.max(t.portal.size*Math.min(r,l),se),g=t.config.outputSize>0?t.config.outputSize:h;o.width=g,o.height=g;const f=document.querySelector(`.${(b=t.css)==null?void 0:b.sourceImage[0]}`);f&&((y=o.getContext("2d"))==null||y.drawImage(f,s,p,h,h,0,0,g,g));const x=o.toDataURL(`image/${t.config.type}`,t.config.compression);return new Promise((m,$)=>{try{o.toBlob(w=>{if(o.remove(),!w){$(new Error(`Failed to create blob for type: image/${t.config.type}`));return}m([x,w])},`image/${t.config.type}`,t.config.compression)}catch(w){o.remove(),$(w)}})},mo=(e,t,o)=>{const{emitted:i,portal:n,frame:r,config:l}=t();let s=i.left-i.X+e.clientX,p=i.top-i.Y+e.clientY;const h=l.framePadding,g=r.width-l.framePadding-n.size,f=l.framePadding,x=r.height-l.framePadding-n.size;s<h&&(s=h),s>g&&(s=g),p<f&&(p=f),p>x&&(p=x),o({portal:{...n,left:s,top:p}})},bo=(e,t,o)=>{const{action:i,emitted:n,portal:r,frame:l,config:s}=t(),p=e.pageX-n.X,h=e.pageY-n.Y;switch(i){case B.RESIZE_BR:{let g=n.size+Math.max(p,h);return g<s.minPortalSize&&(g=s.minPortalSize),n.top+g>l.height-s.framePadding&&(g=l.height-n.top-s.framePadding),n.left+g>l.width-s.framePadding&&(g=l.width-n.left-s.framePadding),o({portal:{...r,size:g}})}case B.RESIZE_TR:{let g=p+h>0?n.size+p:n.size-h,f=p+h>0?n.top-p:n.top+h;return g<s.minPortalSize&&(f=n.top+n.size-s.minPortalSize,g=s.minPortalSize),n.left+g>l.width-s.framePadding&&(g=l.width-n.left-s.framePadding,f=n.top-l.width+n.left+n.size),f<s.framePadding&&(g=n.top+n.size,f=s.framePadding),o({portal:{...r,top:f,size:g}})}case B.RESIZE_TL:{const g=Math.min(p,h);let f=n.size-g,x=n.left+g,b=n.top+g;if(f<s.minPortalSize){const y=n.size-s.minPortalSize;f=s.minPortalSize,x=n.left+y,b=n.top+y}if(b<s.framePadding){const y=s.framePadding-b;b=s.framePadding,x=x+y,f=f-y}if(x<s.framePadding){const y=s.framePadding-x;x=s.framePadding,b=b+y,f=f-y}return o({portal:{...r,top:b,left:x,size:f}})}case B.RESIZE_BL:{let g=p+h>0?n.size+h:n.size-p,f=p+h>0?n.left-h:n.left+p;return g<s.minPortalSize&&(f=n.left+n.size-s.minPortalSize,g=s.minPortalSize),g+n.top>l.height-s.framePadding&&(f=n.left-l.height+n.top+n.size,g=l.height-n.top-s.framePadding),f<s.framePadding&&(f=s.framePadding,g=n.left+n.size-s.framePadding),o({portal:{...r,left:f,size:g}})}default:return}},xe=e=>{if("touches"in e&&e.touches.length>0){const o=e.touches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}if("changedTouches"in e&&e.changedTouches.length>0){const o=e.changedTouches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}const t=e;return{clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY}},yo=(e,t)=>{var x,b,y;const o=e(),i=document.querySelector(`.${(x=o.css)==null?void 0:x.portal[0]}`),n=document.querySelector(`.${(b=o.css)==null?void 0:b.portalArea[0]}`),r=document.querySelector(`.${(y=o.css)==null?void 0:y.root[0]}`);let l=null,s=null;const p=m=>{m.preventDefault();const{portal:$}=e(),w=xe(m);if(m.target){const v=m.target.getAttribute("data-action"),C={X:w.pageX,Y:w.pageY,left:$.left,top:$.top,size:$.size};t({action:v,emitted:C})}},h=()=>{const{action:m}=e();l!==null&&(cancelAnimationFrame(l),l=null),s=null,m&&t({action:null})},g=()=>{if(l=null,!s)return;const m=s;s=null;const{action:$}=e();if($)switch($){case B.MOVE:mo(m,e,t);break;default:bo(m,e,t)}},f=m=>{const{action:$}=e();$&&(m.preventDefault(),s=xe(m),l===null&&(l=requestAnimationFrame(g)))};return r&&(r.addEventListener("mouseup",h),r.addEventListener("touchend",h),r.addEventListener("touchcancel",h)),i&&(i.addEventListener("mousedown",p),i.addEventListener("touchstart",p,{passive:!1})),n&&(n.addEventListener("mousemove",f),n.addEventListener("touchmove",f,{passive:!1})),()=>{l!==null&&cancelAnimationFrame(l),r&&(r.removeEventListener("mouseup",h),r.removeEventListener("touchend",h),r.removeEventListener("touchcancel",h)),i&&(i.removeEventListener("mousedown",p),i.removeEventListener("touchstart",p)),n&&(n.removeEventListener("mousemove",f),n.removeEventListener("touchmove",f))}},me=1024*1024,wo=(e,t)=>{if(!t.allowedTypes.includes(e.type))return`Invalid file type "${e.type}". Allowed types: ${t.allowedTypes.join(", ")}`;if(t.maxFileSize>0&&e.size>t.maxFileSize){const o=(t.maxFileSize/me).toFixed(2);return`File size (${(e.size/me).toFixed(2)}MB) exceeds maximum allowed size (${o}MB)`}return null},$o=(e,t,o,i,n,r,l)=>{const s=w=>{l?l(w):console.error(`HqCropper: ${w}`)};if(!e.target.files||e.target.files.length===0){s("Can't read file input");return}const p=e.target.files[0],{config:h}=t(),g=wo(p,h);if(g){s(g),e.target.value="";return}const f=new FileReader;let x=null;const b=()=>{var C;const w=t(),v=document.querySelector(`.${(C=w.css)==null?void 0:C.root[0]}`);v&&(v.remove(),document.removeEventListener("keydown",y),x==null||x(),uo(),r(),o(ue))},y=w=>{w.key==="Escape"&&t().sourceBase64&&m(w)},m=w=>{w.preventDefault(),b()},$=w=>{w.preventDefault();const v=t();xo(t).then(([C,L])=>{i(C,L,v),m(w)}).catch(C=>{s(C instanceof Error?C.message:"Failed to crop image")})};f.onload=w=>{const v=new Image;if(!w.target||typeof w.target.result!="string"){s("Can't load result image");return}v.src=w.target.result,v.onerror=()=>{s("Failed to load image")},v.onload=()=>{var F;so(t,$,m),po(),n("fileName",go),n("sourceBase64",ho),n("portal",fo);const C=Yt(t,v),L=qt(t,C);o({frame:C,portal:L,fileName:p.name,sourceBase64:(F=w.target)==null?void 0:F.result,sourceHeight:v.height,sourceWidth:v.width}),x=yo(t,o),document.addEventListener("keydown",y)}},f.onerror=()=>{s("Failed to read file")},f.readAsDataURL(p),e.target.value=""},So=(e,t,o,i)=>{const{getState:n,setState:r,subscribe:l,unsubscribeAll:s}=Dt(t,o),p=lo(h=>$o(h,n,r,e,l,s,i));return{open:()=>p.click()}},G={portalSize:200,outputSize:400,compression:.9,type:"jpeg",maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp"],applyLabel:"Apply",cancelLabel:"Cancel"},be="vacano-image-cropper-styles",vo=`
|
|
1140
550
|
.vacano-cropper-root {
|
|
1141
551
|
background-color: rgba(0, 0, 0, 0.5);
|
|
1142
552
|
backdrop-filter: blur(4px);
|
|
1143
553
|
}
|
|
1144
554
|
|
|
1145
555
|
.vacano-cropper-header {
|
|
1146
|
-
border-bottom: 1px solid ${
|
|
556
|
+
border-bottom: 1px solid ${a.COLORS.gray};
|
|
1147
557
|
padding: 16px 20px;
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
.vacano-cropper-footer {
|
|
1151
|
-
border-top: 1px solid ${t.COLORS.gray};
|
|
1152
|
-
padding: 16px 20px;
|
|
1153
|
-
gap: 12px;
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
.vacano-cropper-cancel-button {
|
|
1157
|
-
padding: 8px 16px;
|
|
1158
|
-
border-radius: 16px;
|
|
1159
|
-
border: 1px solid ${t.COLORS.gray};
|
|
1160
|
-
background-color: ${t.COLORS.white};
|
|
1161
|
-
color: ${t.COLORS.black};
|
|
1162
|
-
font-size: 14px;
|
|
1163
|
-
font-weight: 500;
|
|
1164
|
-
cursor: pointer;
|
|
1165
|
-
transition: background-color 0.2s;
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
.vacano-cropper-cancel-button:hover {
|
|
1169
|
-
background-color: ${t.COLORS.gray};
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
.vacano-cropper-apply-button {
|
|
1173
|
-
padding: 8px 16px;
|
|
1174
|
-
border-radius: 16px;
|
|
1175
|
-
border: none;
|
|
1176
|
-
background-color: ${t.COLORS.black};
|
|
1177
|
-
color: ${t.COLORS.white};
|
|
1178
|
-
font-size: 14px;
|
|
1179
|
-
font-weight: 500;
|
|
1180
|
-
cursor: pointer;
|
|
1181
|
-
transition: background-color 0.2s;
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
.vacano-cropper-apply-button:hover {
|
|
1185
|
-
background-color: ${t.COLORS["iron-grey"]};
|
|
1186
|
-
}
|
|
1187
|
-
`,va=()=>{if(typeof document>"u"||document.getElementById(tr))return;const e=document.createElement("style");e.id=tr,e.textContent=wa,document.head.appendChild(e)},Ra={root:["vacano-cropper-root"],container:["vacano-cropper-container"],header:["vacano-cropper-header"],body:["vacano-cropper-body"],footer:["vacano-cropper-footer"],cancelButton:["vacano-cropper-cancel-button"],applyButton:["vacano-cropper-apply-button"],portal:["vacano-cropper-portal"]},zr=(e={})=>{const{allowedTypes:r=le.allowedTypes,applyLabel:o=le.applyLabel,cancelLabel:n=le.cancelLabel,compression:i=le.compression,maxFileSize:l=le.maxFileSize,onCrop:c,onError:d,outputSize:u=le.outputSize,portalSize:h=le.portalSize,type:b=le.type}=e,f=p.useRef(null);return{open:p.useCallback(()=>{f.current||(va(),f.current=ma((m,S,x)=>{S&&(c==null||c({base64:m,blob:S,state:x}))},{portalSize:h,outputSize:u,compression:i,type:b,maxFileSize:l,allowedTypes:r,applyButtonLabel:o,cancelButtonLabel:n},Ra,m=>{d==null||d({code:"CROPPER_ERROR",message:m})})),f.current.open()},[r,o,n,i,l,c,d,u,h,b])}},ut=T.newClassNameGetter("image-cropper"),La=({allowedTypes:e,applyLabel:r,buttonLabel:o="Select Image",cancelLabel:n,className:i,classnames:l,compression:c,maxFileSize:d,onCrop:u,onError:h,outputSize:b,portalSize:f,previewSize:O=120,ref:m,type:S,value:x,...y})=>{const[$,C]=p.useState(x??null),{open:g}=zr({allowedTypes:e,applyLabel:r,cancelLabel:n,compression:c,maxFileSize:d,onCrop:k=>{C(k.base64),u==null||u(k)},onError:h,outputSize:b,portalSize:f,type:S});return a.jsxs(yn,{...y,ref:m,className:ut("container",i),children:[a.jsx(Cn,{$size:O,className:ut("preview",l==null?void 0:l.preview),children:$?a.jsx("img",{src:$,alt:"Preview"}):a.jsx(mn,{children:"No image"})}),a.jsx(ge,{variant:"system",onClick:g,className:ut("button",l==null?void 0:l.button),style:{width:O},children:o})]})},rr={compact:{height:"32px",padding:"0 10px",radius:"14px",prefixSize:"16px"},default:{height:"40px",padding:"0 14px",radius:"16px",prefixSize:"20px"}},or={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:{static:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,65)},focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:{static:t.alpha(t.COLORS.red,40),disabled:t.alpha(t.COLORS.red,65)},focus:t.alpha(t.COLORS.red,30)}},de=e=>or[e]??or.normal,ht=e=>rr[e]??rr.default,ka=s.div`
|
|
1188
|
-
display: grid;
|
|
1189
|
-
flex-direction: column;
|
|
1190
|
-
gap: 2px;
|
|
1191
|
-
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1192
|
-
`,Ea=s(ne)`
|
|
1193
|
-
margin-left: 6px;
|
|
1194
|
-
`,ja=s.input`
|
|
1195
|
-
flex: 1;
|
|
1196
|
-
min-width: 0;
|
|
1197
|
-
outline: none;
|
|
1198
|
-
font-size: 14px;
|
|
1199
|
-
font-weight: 500;
|
|
1200
|
-
height: ${e=>ht(e.$size).height};
|
|
1201
|
-
padding: ${e=>ht(e.$size).padding};
|
|
1202
|
-
border-radius: ${e=>ht(e.$size).radius};
|
|
1203
|
-
|
|
1204
|
-
color: ${e=>de(e.$variant).color.static};
|
|
1205
|
-
border: 1px solid ${e=>de(e.$variant).border.static};
|
|
1206
|
-
background-color: ${e=>de(e.$variant).background.static};
|
|
1207
|
-
|
|
1208
|
-
&::placeholder {
|
|
1209
|
-
color: ${e=>de(e.$variant).placeholder.static};
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
&:disabled {
|
|
1213
|
-
cursor: not-allowed;
|
|
1214
|
-
color: ${e=>de(e.$variant).color.disabled};
|
|
1215
|
-
background-color: ${e=>de(e.$variant).background.disabled};
|
|
1216
|
-
border-color: ${e=>de(e.$variant).border.disabled};
|
|
1217
|
-
|
|
1218
|
-
&::placeholder {
|
|
1219
|
-
color: ${e=>de(e.$variant).placeholder.disabled};
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
`,bt=T.newClassNameGetter("input"),Nr=({className:e,classnames:r,disabled:o,fullWidth:n,label:i,ref:l,size:c="default",variant:d="normal",...u})=>a.jsxs(ka,{className:bt("container",e),$fullWidth:!!n,children:[a.jsx(Ea,{variant:d,className:bt("label",r==null?void 0:r.label),children:i}),a.jsx(ja,{...u,ref:l,disabled:o,$size:c,$variant:d,className:bt("input",r==null?void 0:r.input)})]}),Pa=s.div`
|
|
1223
|
-
position: fixed;
|
|
1224
|
-
inset: 0;
|
|
1225
|
-
z-index: 1000;
|
|
1226
|
-
display: flex;
|
|
1227
|
-
align-items: center;
|
|
1228
|
-
justify-content: center;
|
|
1229
|
-
background-color: ${t.alpha(t.COLORS.black,50)};
|
|
1230
|
-
animation: ${t.KEYFRAMES.fadeIn} ${e=>e.$animated?"0.15s":"0s"} ease-out forwards;
|
|
1231
|
-
`,za=s.div`
|
|
1232
|
-
position: relative;
|
|
1233
|
-
z-index: 1001;
|
|
1234
|
-
width: ${e=>e.$width};
|
|
1235
|
-
max-width: calc(100vw - 32px);
|
|
1236
|
-
max-height: calc(100vh - 32px);
|
|
1237
|
-
overflow: auto;
|
|
1238
|
-
background-color: ${t.COLORS.white};
|
|
1239
|
-
border-radius: 16px;
|
|
1240
|
-
box-shadow: 0 8px 32px ${t.alpha(t.COLORS.black,20)};
|
|
1241
|
-
animation: ${t.KEYFRAMES.scaleIn} ${e=>e.$animated?"0.15s":"0s"} ease-out forwards;
|
|
1242
|
-
`,ir=T.newClassNameGetter("modal"),Tr=({animated:e,children:r,className:o,classnames:n,open:i,ref:l,width:c="500px",...d})=>i?fe.createPortal(a.jsx(Pa,{className:ir("overlay",n==null?void 0:n.overlay),$animated:!!e,children:a.jsx(za,{...d,ref:l,className:ir("content",o,n==null?void 0:n.content),$animated:!!e,$width:c,children:r})}),document.body):null,Ir={normal:{border:t.COLORS["iron-grey"],label:t.COLORS.black},error:{border:t.COLORS.red,label:t.COLORS.red}},Na=s.div`
|
|
1243
|
-
display: flex;
|
|
1244
|
-
flex-direction: column;
|
|
1245
|
-
gap: 4px;
|
|
1246
|
-
`,Ta=s(ne)`
|
|
1247
|
-
margin-left: 6px;
|
|
1248
|
-
color: ${e=>Ir[e.$variant].label};
|
|
1249
|
-
`,Ia=s.button`
|
|
1250
|
-
display: flex;
|
|
1251
|
-
flex-wrap: wrap;
|
|
1252
|
-
align-items: center;
|
|
1253
|
-
gap: 6px;
|
|
1254
|
-
min-height: 44px;
|
|
1255
|
-
padding: 8px 12px;
|
|
1256
|
-
border: 1px dashed ${e=>Ir[e.$variant].border};
|
|
1257
|
-
border-radius: 8px;
|
|
1258
|
-
background: ${t.COLORS.white};
|
|
1259
|
-
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
1260
|
-
opacity: ${e=>e.$disabled?.5:1};
|
|
1261
|
-
transition: border-color 0.15s ease;
|
|
1262
|
-
text-align: left;
|
|
558
|
+
}
|
|
1263
559
|
|
|
1264
|
-
|
|
1265
|
-
border-
|
|
560
|
+
.vacano-cropper-footer {
|
|
561
|
+
border-top: 1px solid ${a.COLORS.gray};
|
|
562
|
+
padding: 16px 20px;
|
|
563
|
+
gap: 12px;
|
|
1266
564
|
}
|
|
1267
|
-
`,Aa=s.span`
|
|
1268
|
-
color: ${t.COLORS["iron-grey"]};
|
|
1269
|
-
font-size: 14px;
|
|
1270
|
-
`,Da=s.div`
|
|
1271
|
-
display: flex;
|
|
1272
|
-
flex-direction: column;
|
|
1273
|
-
padding: 20px;
|
|
1274
|
-
gap: 16px;
|
|
1275
|
-
`,_a=s.div`
|
|
1276
|
-
display: flex;
|
|
1277
|
-
align-items: center;
|
|
1278
|
-
justify-content: space-between;
|
|
1279
|
-
`,Ma=s.h3`
|
|
1280
|
-
margin: 0;
|
|
1281
|
-
font-size: 18px;
|
|
1282
|
-
font-weight: 600;
|
|
1283
|
-
color: ${t.COLORS.black};
|
|
1284
|
-
`,Fa=s.div`
|
|
1285
|
-
display: flex;
|
|
1286
|
-
flex-direction: column;
|
|
1287
|
-
gap: 4px;
|
|
1288
|
-
min-height: 200px;
|
|
1289
|
-
max-height: 300px;
|
|
1290
|
-
overflow-y: auto;
|
|
1291
|
-
`,Ba=s.label`
|
|
1292
|
-
display: flex;
|
|
1293
|
-
align-items: center;
|
|
1294
|
-
gap: 10px;
|
|
1295
|
-
padding: 10px 12px;
|
|
1296
|
-
border-radius: 8px;
|
|
1297
|
-
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
1298
|
-
opacity: ${e=>e.$disabled?.5:1};
|
|
1299
|
-
transition: background-color 0.15s ease;
|
|
1300
565
|
|
|
1301
|
-
|
|
1302
|
-
|
|
566
|
+
.vacano-cropper-cancel-button {
|
|
567
|
+
padding: 8px 16px;
|
|
568
|
+
border-radius: 16px;
|
|
569
|
+
border: 1px solid ${a.COLORS.gray};
|
|
570
|
+
background-color: ${a.COLORS.white};
|
|
571
|
+
color: ${a.COLORS.black};
|
|
572
|
+
font-size: 14px;
|
|
573
|
+
font-weight: 500;
|
|
574
|
+
cursor: pointer;
|
|
575
|
+
transition: background-color 0.2s;
|
|
1303
576
|
}
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
577
|
+
|
|
578
|
+
.vacano-cropper-cancel-button:hover {
|
|
579
|
+
background-color: ${a.COLORS.gray};
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
.vacano-cropper-apply-button {
|
|
583
|
+
padding: 8px 16px;
|
|
584
|
+
border-radius: 16px;
|
|
585
|
+
border: none;
|
|
586
|
+
background-color: ${a.COLORS.black};
|
|
587
|
+
color: ${a.COLORS.white};
|
|
588
|
+
font-size: 14px;
|
|
589
|
+
font-weight: 500;
|
|
590
|
+
cursor: pointer;
|
|
591
|
+
transition: background-color 0.2s;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
.vacano-cropper-apply-button:hover {
|
|
595
|
+
background-color: ${a.COLORS["iron-grey"]};
|
|
596
|
+
}
|
|
597
|
+
`,Co=()=>{if(typeof document>"u"||document.getElementById(be))return;const e=document.createElement("style");e.id=be,e.textContent=vo,document.head.appendChild(e)},Oo={root:["vacano-cropper-root"],container:["vacano-cropper-container"],header:["vacano-cropper-header"],body:["vacano-cropper-body"],footer:["vacano-cropper-footer"],cancelButton:["vacano-cropper-cancel-button"],applyButton:["vacano-cropper-apply-button"],portal:["vacano-cropper-portal"]},ze=(e={})=>{const{allowedTypes:t=G.allowedTypes,applyLabel:o=G.applyLabel,cancelLabel:i=G.cancelLabel,compression:n=G.compression,maxFileSize:r=G.maxFileSize,onCrop:l,onError:s,outputSize:p=G.outputSize,portalSize:h=G.portalSize,type:g=G.type}=e,f=u.useRef(null);return{open:u.useCallback(()=>{f.current||(Co(),f.current=So((b,y,m)=>{y&&(l==null||l({base64:b,blob:y,state:m}))},{portalSize:h,outputSize:p,compression:n,type:g,maxFileSize:r,allowedTypes:t,applyButtonLabel:o,cancelButtonLabel:i},Oo,b=>{s==null||s({code:"CROPPER_ERROR",message:b})})),f.current.open()},[t,o,i,n,r,l,s,p,h,g])}},le=A.newClassNameGetter("image-cropper"),Ro=({allowedTypes:e,applyLabel:t,buttonLabel:o="Select Image",cancelLabel:i,className:n,classnames:r,compression:l,maxFileSize:s,onCrop:p,onError:h,outputSize:g,portalSize:f,previewSize:x=120,ref:b,type:y,value:m,...$})=>{const[w,v]=u.useState(m??null),{open:C}=ze({allowedTypes:e,applyLabel:t,cancelLabel:i,compression:l,maxFileSize:s,onCrop:L=>{v(L.base64),p==null||p(L)},onError:h,outputSize:g,portalSize:f,type:y});return d.jsxs(yt,{...$,ref:b,className:le("container",n),children:[d.jsx(wt,{$size:x,className:le("preview",r==null?void 0:r.preview),children:w?d.jsx("img",{src:w,alt:"Preview"}):d.jsx($t,{children:"No image"})}),d.jsx(c.Button,{variant:"system",onClick:C,className:le("button",r==null?void 0:r.button),style:{width:x},children:o})]})},Eo=5e3,ye={default:{background:"#374151",text:a.COLORS.white},success:{background:a.COLORS.green,text:a.COLORS.white},warning:{background:a.COLORS.yellow,text:a.COLORS.white},danger:{background:a.COLORS.red,text:a.COLORS.white},info:{background:a.COLORS["steel-blue"],text:a.COLORS.white}},Te=u.createContext(null),we=e=>ye[e]??ye.default,Lo=c.styled.div`
|
|
1316
598
|
position: fixed;
|
|
1317
599
|
top: 0;
|
|
1318
600
|
left: 0;
|
|
1319
601
|
right: 0;
|
|
1320
602
|
z-index: 9999;
|
|
1321
603
|
pointer-events: none;
|
|
1322
|
-
`,
|
|
604
|
+
`,ko=c.styled.div`
|
|
1323
605
|
display: flex;
|
|
1324
606
|
align-items: center;
|
|
1325
607
|
justify-content: center;
|
|
1326
608
|
gap: 12px;
|
|
1327
609
|
min-height: 44px;
|
|
1328
610
|
padding: 12px 48px;
|
|
1329
|
-
background-color: ${({$variant:e})=>
|
|
1330
|
-
color: ${({$variant:e})=>
|
|
1331
|
-
animation: ${({$isExiting:e})=>e?
|
|
611
|
+
background-color: ${({$variant:e})=>we(e).background};
|
|
612
|
+
color: ${({$variant:e})=>we(e).text};
|
|
613
|
+
animation: ${({$isExiting:e})=>e?a.KEYFRAMES.slideOutTopFade:a.KEYFRAMES.slideInTopFade}
|
|
1332
614
|
0.3s ease-out forwards;
|
|
1333
615
|
pointer-events: auto;
|
|
1334
|
-
`,
|
|
616
|
+
`,zo=c.styled.span`
|
|
1335
617
|
font-size: 14px;
|
|
1336
618
|
font-weight: 500;
|
|
1337
619
|
line-height: 1.4;
|
|
1338
620
|
text-align: center;
|
|
1339
|
-
`,
|
|
621
|
+
`,To=c.styled.button`
|
|
1340
622
|
position: absolute;
|
|
1341
623
|
right: 16px;
|
|
1342
624
|
top: 50%;
|
|
@@ -1357,9 +639,9 @@
|
|
|
1357
639
|
&:hover {
|
|
1358
640
|
opacity: 1;
|
|
1359
641
|
}
|
|
1360
|
-
`,
|
|
642
|
+
`,Po=c.styled.div`
|
|
1361
643
|
position: relative;
|
|
1362
|
-
`,
|
|
644
|
+
`,Ao=({notification:e,onRemove:t,onAnimationEnd:o})=>{const[i,n]=u.useState(!1),r=()=>{n(!0)},l=()=>{i&&(t(),o())};return u.useEffect(()=>{const s=setTimeout(()=>{r()},e.duration);return()=>clearTimeout(s)},[e.duration,e.id]),d.jsx(Po,{children:d.jsxs(ko,{$variant:e.variant,$isExiting:i,onAnimationEnd:l,children:[d.jsx(zo,{children:e.message}),d.jsx(To,{onClick:r,children:d.jsx(d.X,{style:{width:18,height:18}})})]})})},Io=(e,t)=>{switch(t.type){case"ADD_NOTIFICATION":{const o=t.payload;return e.current?{...e,queue:[...e.queue,o]}:{...e,current:o}}case"REMOVE_CURRENT":return{...e,current:null};case"SHOW_NEXT":{const o=e.queue[0];return o?{current:o,queue:e.queue.slice(1)}:e}default:return e}},No={current:null,queue:[]},jo=({children:e})=>{const[t,o]=u.useReducer(Io,No),i=u.useCallback((s,p="default",h=Eo)=>{const g=`notification-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;o({type:"ADD_NOTIFICATION",payload:{id:g,message:s,variant:p,duration:h}})},[]),n=u.useCallback(()=>{o({type:"REMOVE_CURRENT"})},[]),r=u.useCallback(()=>{o({type:"REMOVE_CURRENT"})},[]),l=u.useCallback(()=>{setTimeout(()=>{o({type:"SHOW_NEXT"})},100)},[]);return d.jsxs(Te.Provider,{value:{show:i,hide:n},children:[e,d.jsx(Lo,{children:t.current&&d.jsx(Ao,{notification:t.current,onRemove:r,onAnimationEnd:l},t.current.id)})]})},Bo=()=>{const e=u.useContext(Te);if(!e)throw new Error("useNotification must be used within NotificationProvider");return e},Pe=u.createContext(null),Fo="Agree",Mo="Discard",_o=V.keyframes`
|
|
1363
645
|
from {
|
|
1364
646
|
opacity: 0;
|
|
1365
647
|
transform: translateY(100%);
|
|
@@ -1368,7 +650,7 @@
|
|
|
1368
650
|
opacity: 1;
|
|
1369
651
|
transform: translateY(0);
|
|
1370
652
|
}
|
|
1371
|
-
`,
|
|
653
|
+
`,Do=V.keyframes`
|
|
1372
654
|
from {
|
|
1373
655
|
opacity: 1;
|
|
1374
656
|
transform: translateY(0);
|
|
@@ -1377,7 +659,7 @@
|
|
|
1377
659
|
opacity: 0;
|
|
1378
660
|
transform: translateY(100%);
|
|
1379
661
|
}
|
|
1380
|
-
`,
|
|
662
|
+
`,Yo=c.styled.div`
|
|
1381
663
|
position: fixed;
|
|
1382
664
|
bottom: 24px;
|
|
1383
665
|
right: 24px;
|
|
@@ -1385,234 +667,76 @@
|
|
|
1385
667
|
flex-direction: column;
|
|
1386
668
|
max-width: 400px;
|
|
1387
669
|
padding: 16px 16px 0 16px;
|
|
1388
|
-
background-color: ${
|
|
1389
|
-
border: 1px dashed ${
|
|
670
|
+
background-color: ${a.COLORS.white};
|
|
671
|
+
border: 1px dashed ${a.COLORS.gray};
|
|
1390
672
|
border-radius: 12px;
|
|
1391
673
|
overflow: hidden;
|
|
1392
674
|
box-shadow:
|
|
1393
675
|
0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
1394
676
|
0 2px 4px -2px rgba(0, 0, 0, 0.1);
|
|
1395
|
-
animation: ${({$isExiting:e})=>e?
|
|
677
|
+
animation: ${({$isExiting:e})=>e?Do:_o} 0.2s ease-out forwards;
|
|
1396
678
|
z-index: 1000;
|
|
1397
|
-
`,
|
|
679
|
+
`,Xo=c.styled.p`
|
|
1398
680
|
margin: 0;
|
|
1399
681
|
font-weight: 600;
|
|
1400
682
|
font-size: 14px;
|
|
1401
|
-
color: ${
|
|
683
|
+
color: ${a.COLORS.black};
|
|
1402
684
|
text-align: left;
|
|
1403
|
-
`,
|
|
685
|
+
`,qo=c.styled.p`
|
|
1404
686
|
margin: 4px 0 0;
|
|
1405
687
|
font-size: 13px;
|
|
1406
|
-
color: ${
|
|
688
|
+
color: ${a.COLORS["iron-grey"]};
|
|
1407
689
|
text-align: left;
|
|
1408
|
-
`,
|
|
690
|
+
`,Go=c.styled.div`
|
|
1409
691
|
display: flex;
|
|
1410
692
|
align-items: center;
|
|
1411
693
|
justify-content: flex-start;
|
|
1412
694
|
gap: 8px;
|
|
1413
695
|
margin: 12px -16px 0;
|
|
1414
696
|
padding: 12px 16px;
|
|
1415
|
-
border-top: 1px solid ${
|
|
697
|
+
border-top: 1px solid ${a.COLORS.gray};
|
|
1416
698
|
background-color: rgba(0, 0, 0, 0.01);
|
|
1417
|
-
`,
|
|
1418
|
-
display: inline-flex;
|
|
1419
|
-
flex-direction: column;
|
|
1420
|
-
gap: 2px;
|
|
1421
|
-
`,gl=s(ne)`
|
|
1422
|
-
margin-left: 6px;
|
|
1423
|
-
`,fl=s.div`
|
|
1424
|
-
display: flex;
|
|
1425
|
-
gap: ${e=>Ie(e.$size).gap};
|
|
1426
|
-
`,xl=s.input`
|
|
1427
|
-
width: ${e=>Ie(e.$size).width};
|
|
1428
|
-
height: ${e=>Ie(e.$size).height};
|
|
1429
|
-
border-radius: ${e=>Ie(e.$size).radius};
|
|
1430
|
-
font-size: ${e=>Ie(e.$size).fontSize};
|
|
1431
|
-
font-weight: 600;
|
|
1432
|
-
text-align: center;
|
|
1433
|
-
outline: none;
|
|
1434
|
-
border: 1px solid ${e=>$e(e.$variant).border.static};
|
|
1435
|
-
background-color: ${e=>$e(e.$variant).background.static};
|
|
1436
|
-
color: ${e=>$e(e.$variant).color.static};
|
|
1437
|
-
transition:
|
|
1438
|
-
border-color 0.15s ease,
|
|
1439
|
-
box-shadow 0.15s ease;
|
|
1440
|
-
|
|
1441
|
-
&:disabled {
|
|
1442
|
-
cursor: not-allowed;
|
|
1443
|
-
color: ${e=>$e(e.$variant).color.disabled};
|
|
1444
|
-
background-color: ${e=>$e(e.$variant).background.disabled};
|
|
1445
|
-
border-color: ${e=>$e(e.$variant).border.disabled};
|
|
1446
|
-
}
|
|
1447
|
-
|
|
1448
|
-
&::selection {
|
|
1449
|
-
background-color: transparent;
|
|
1450
|
-
}
|
|
1451
|
-
`,gt=T.newClassNameGetter("otp-code"),Ol=({autoFocus:e,className:r,classnames:o,disabled:n,label:i,length:l=6,onChange:c,ref:d,size:u="default",value:h="",variant:b="normal",...f})=>{const O=p.useRef([]);p.useEffect(()=>{e&&O.current[0]&&O.current[0].focus()},[e]);const m=p.useCallback($=>{const C=O.current[$];C&&(C.focus(),C.select())},[]),S=p.useCallback(($,C)=>{const k=C.target.value.replace(/\D/g,"").slice(-1);if(!k)return;const N=h.padEnd(l," ").split(""),P=N.findIndex(M=>M===" "||M===""),Y=P!==-1?P:$;N[Y]=k;const j=N.join("").replace(/ /g,"");c==null||c(j);const _=Y+1;_<l&&m(_)},[h,l,c,m]),x=p.useCallback(($,C)=>{if(C.key==="Backspace"){C.preventDefault();const g=h.split("");g[$]?(g[$]="",c==null||c(g.join(""))):$>0&&(g[$-1]="",c==null||c(g.join("")),m($-1))}else C.key==="ArrowLeft"&&$>0?(C.preventDefault(),m($-1)):C.key==="ArrowRight"&&$<l-1&&(C.preventDefault(),m($+1))},[h,l,c,m]),y=p.useCallback($=>{$.preventDefault();const C=$.clipboardData.getData("text").replace(/\D/g,"").slice(0,l);if(C){c==null||c(C);const g=Math.min(C.length,l-1);m(g)}},[l,c,m]);return a.jsxs(bl,{ref:d,className:gt("container",r),...f,children:[i&&a.jsx(gl,{variant:b,className:gt("label",o==null?void 0:o.label),children:i}),a.jsx(fl,{$size:u,children:Array.from({length:l}).map(($,C)=>a.jsx(xl,{ref:g=>{O.current[C]=g},type:"text",inputMode:"numeric",autoComplete:"one-time-code",maxLength:2,disabled:n,value:h[C]??"",onChange:g=>S(C,g),onKeyDown:g=>x(C,g),onPaste:y,onFocus:g=>g.target.select(),$size:u,$variant:b,className:gt("input",o==null?void 0:o.input)},C))})]})},cr={light:{background:t.COLORS.white,border:t.alpha(t.COLORS.black,30),title:t.COLORS.black,description:t.COLORS["iron-grey"]},dark:{background:t.alpha(t.COLORS.white,5),border:t.alpha(t.COLORS.white,30),title:t.COLORS.white,description:"#9ca3af"}},et=e=>cr[e]??cr.light,Sl=s.div`
|
|
699
|
+
`,Ko=({confirmation:e,onDone:t})=>{const[o,i]=u.useState(!1),[n,r]=u.useState(!1),{label:l,description:s,onConfirm:p,onDiscard:h,options:g}=e,f=g.confirmLabel||Fo,x=g.discardLabel||Mo,b=u.useCallback($=>{i(!0),setTimeout(()=>{$==null||$(),t()},200)},[t]),y=u.useCallback(async()=>{const $=p();if($ instanceof Promise){r(!0);try{await $}finally{r(!1)}}b()},[b,p]),m=u.useCallback(()=>{n||b(h)},[b,n,h]);return u.useEffect(()=>{const $=w=>{w.key==="Escape"&&!n&&m()};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[m,n]),d.jsxs(Yo,{$isExiting:o,children:[d.jsx(Xo,{children:l}),d.jsx(qo,{children:s}),d.jsxs(Go,{children:[d.jsx(c.Button,{variant:"transparent",size:"compact",onClick:m,disabled:n,children:x}),d.jsx(c.Button,{variant:"system",size:"compact",onClick:y,loading:n,children:f})]})]})},Uo=()=>{},Ho=({children:e})=>{const[t,o]=u.useState(null),i=u.useCallback((r,l,s,p,h)=>{o({open:!0,label:r,description:l,onConfirm:s,onDiscard:p||Uo,options:h||{}})},[]),n=u.useCallback(()=>{o(null)},[]);return d.jsxs(Pe.Provider,{value:{show:i,hide:n},children:[e,t&&d.jsx(Ko,{confirmation:t,onDone:n})]})},Vo=()=>{const e=u.useContext(Pe);if(!e)throw new Error("useNotifyConfirmation must be used within NotifyConfirmationProvider");return e},$e={light:{background:a.COLORS.white,border:a.alpha(a.COLORS.black,30),title:a.COLORS.black,description:a.COLORS["iron-grey"]},dark:{background:a.alpha(a.COLORS.white,5),border:a.alpha(a.COLORS.white,30),title:a.COLORS.white,description:"#9ca3af"}},ae=e=>$e[e]??$e.light,Wo=c.styled.div`
|
|
1452
700
|
display: flex;
|
|
1453
701
|
flex-direction: column;
|
|
1454
702
|
gap: 16px;
|
|
1455
703
|
padding: 12px;
|
|
1456
|
-
border: 1px dashed ${({$variant:e})=>
|
|
704
|
+
border: 1px dashed ${({$variant:e})=>ae(e).border};
|
|
1457
705
|
border-radius: 16px;
|
|
1458
|
-
background-color: ${({$variant:e})=>
|
|
706
|
+
background-color: ${({$variant:e})=>ae(e).background};
|
|
1459
707
|
box-shadow:
|
|
1460
708
|
0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
1461
709
|
0 2px 4px -2px rgba(0, 0, 0, 0.1);
|
|
1462
|
-
|
|
710
|
+
`,Zo=c.styled.div`
|
|
1463
711
|
display: flex;
|
|
1464
712
|
flex-direction: column;
|
|
1465
713
|
gap: 4px;
|
|
1466
|
-
`,
|
|
714
|
+
`,Qo=c.styled.div`
|
|
1467
715
|
font-size: 18px;
|
|
1468
716
|
font-weight: 600;
|
|
1469
717
|
line-height: 1.4;
|
|
1470
|
-
color: ${({$variant:e})=>
|
|
1471
|
-
`,
|
|
718
|
+
color: ${({$variant:e})=>ae(e).title};
|
|
719
|
+
`,Jo=c.styled.div`
|
|
1472
720
|
font-size: 14px;
|
|
1473
721
|
line-height: 1.5;
|
|
1474
|
-
color: ${({$variant:e})=>
|
|
1475
|
-
`,
|
|
722
|
+
color: ${({$variant:e})=>ae(e).description};
|
|
723
|
+
`,en=c.styled.div`
|
|
1476
724
|
display: flex;
|
|
1477
725
|
flex-wrap: wrap;
|
|
1478
726
|
gap: 8px;
|
|
1479
|
-
`,
|
|
727
|
+
`,re=A.newClassNameGetter("panel"),tn=({children:e,className:t,classnames:o,description:i,ref:n,title:r,variant:l="light",...s})=>{const p=r||i;return d.jsxs(Wo,{...s,ref:n,className:re("container",t),$variant:l,children:[p&&d.jsxs(Zo,{children:[r&&d.jsx(Qo,{className:re("title",o==null?void 0:o.title),$variant:l,children:r}),i&&d.jsx(Jo,{className:re("description",o==null?void 0:o.description),$variant:l,children:i})]}),d.jsx(en,{className:re("content",o==null?void 0:o.content),children:e})]})},ge={compact:{height:4,radius:2},default:{height:8,radius:4}},on=c.styled.div`
|
|
1480
728
|
width: 100%;
|
|
1481
|
-
height: ${({$size:e})=>
|
|
1482
|
-
border-radius: ${({$size:e})=>
|
|
1483
|
-
background-color: ${
|
|
729
|
+
height: ${({$size:e})=>ge[e].height}px;
|
|
730
|
+
border-radius: ${({$size:e})=>ge[e].radius}px;
|
|
731
|
+
background-color: ${a.COLORS.gray};
|
|
1484
732
|
overflow: hidden;
|
|
1485
|
-
`,
|
|
733
|
+
`,nn=c.styled.div`
|
|
1486
734
|
height: 100%;
|
|
1487
735
|
width: ${({$value:e})=>Math.min(100,Math.max(0,e))}%;
|
|
1488
|
-
border-radius: ${({$size:e})=>
|
|
1489
|
-
background-color: ${
|
|
736
|
+
border-radius: ${({$size:e})=>ge[e].radius}px;
|
|
737
|
+
background-color: ${a.COLORS.black};
|
|
1490
738
|
transition: width 0.2s ease;
|
|
1491
|
-
`,
|
|
1492
|
-
display: inline-flex;
|
|
1493
|
-
align-items: flex-start;
|
|
1494
|
-
gap: 8px;
|
|
1495
|
-
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
1496
|
-
opacity: ${e=>e.$disabled?.5:1};
|
|
1497
|
-
`,El=s.input`
|
|
1498
|
-
position: absolute;
|
|
1499
|
-
opacity: 0;
|
|
1500
|
-
width: 0;
|
|
1501
|
-
height: 0;
|
|
1502
|
-
pointer-events: none;
|
|
1503
|
-
`,jl=s.span`
|
|
1504
|
-
display: inline-flex;
|
|
1505
|
-
align-items: center;
|
|
1506
|
-
justify-content: center;
|
|
1507
|
-
flex-shrink: 0;
|
|
1508
|
-
width: 18px;
|
|
1509
|
-
height: 18px;
|
|
1510
|
-
border-radius: 50%;
|
|
1511
|
-
border: 1.5px solid
|
|
1512
|
-
${e=>e.$checked?me(e.$variant).box.borderChecked:me(e.$variant).box.border};
|
|
1513
|
-
background-color: ${e=>e.$checked?me(e.$variant).box.backgroundChecked:me(e.$variant).box.background};
|
|
1514
|
-
transition:
|
|
1515
|
-
border-color 0.15s ease,
|
|
1516
|
-
background-color 0.15s ease,
|
|
1517
|
-
box-shadow 0.15s ease;
|
|
1518
|
-
`,Pl=s.span`
|
|
1519
|
-
width: 8px;
|
|
1520
|
-
height: 8px;
|
|
1521
|
-
border-radius: 50%;
|
|
1522
|
-
background-color: ${e=>me(e.$variant).dot};
|
|
1523
|
-
opacity: ${e=>e.$visible?1:0};
|
|
1524
|
-
transform: ${e=>e.$visible?"scale(1)":"scale(0.5)"};
|
|
1525
|
-
transition:
|
|
1526
|
-
opacity 0.15s ease,
|
|
1527
|
-
transform 0.15s ease;
|
|
1528
|
-
`,zl=s.span`
|
|
1529
|
-
font-size: 14px;
|
|
1530
|
-
font-weight: 500;
|
|
1531
|
-
line-height: 1.5;
|
|
1532
|
-
color: ${e=>me(e.$variant).label};
|
|
1533
|
-
user-select: none;
|
|
1534
|
-
|
|
1535
|
-
a {
|
|
1536
|
-
color: inherit;
|
|
1537
|
-
text-decoration: underline;
|
|
1538
|
-
cursor: pointer;
|
|
1539
|
-
|
|
1540
|
-
&:hover {
|
|
1541
|
-
text-decoration: none;
|
|
1542
|
-
}
|
|
1543
|
-
}
|
|
1544
|
-
`,ze=T.newClassNameGetter("radio"),jt=({checked:e,className:r,classnames:o,disabled:n,label:i,onChange:l,ref:c,variant:d="normal",...u})=>a.jsxs(kl,{className:ze("container",r),$disabled:!!n,$variant:d,children:[a.jsx(El,{...u,ref:c,type:"radio",className:ze("input",o==null?void 0:o.input),checked:e,disabled:n,onChange:l}),a.jsx(jl,{className:ze("box",o==null?void 0:o.box),$checked:e,$variant:d,children:a.jsx(Pl,{className:ze("dot",o==null?void 0:o.dot),$visible:e,$variant:d})}),i&&a.jsx(zl,{className:ze("label",o==null?void 0:o.label),$variant:d,children:i})]}),ur={normal:{border:{static:t.alpha(t.COLORS.black,20),hover:t.alpha(t.COLORS.black,40),active:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,10)},borderChecked:t.COLORS.black,background:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.alpha(t.COLORS.black,5)},backgroundChecked:t.alpha(t.COLORS.black,5),focusRing:t.alpha(t.COLORS.black,20),label:{static:t.COLORS.black,hover:t.COLORS.black,active:t.COLORS.black,disabled:t.alpha(t.COLORS.black,40)},description:{static:t.alpha(t.COLORS.black,60),hover:t.alpha(t.COLORS.black,60),active:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,30)}},error:{border:{static:t.COLORS.red,hover:t.COLORS.red,active:t.COLORS.red,disabled:t.alpha(t.COLORS.red,30)},borderChecked:t.COLORS.red,background:{static:t.COLORS.white,hover:t.COLORS.white,active:t.COLORS.white,disabled:t.alpha(t.COLORS.red,5)},backgroundChecked:t.alpha(t.COLORS.red,5),focusRing:t.alpha(t.COLORS.red,20),label:{static:t.COLORS.red,hover:t.COLORS.red,active:t.COLORS.red,disabled:t.alpha(t.COLORS.red,40)},description:{static:t.alpha(t.COLORS.red,70),hover:t.alpha(t.COLORS.red,70),active:t.alpha(t.COLORS.red,70),disabled:t.alpha(t.COLORS.red,40)}}},be=e=>ur[e]??ur.normal,Nl=s.label`
|
|
1545
|
-
display: grid;
|
|
1546
|
-
grid-template-columns: auto 1fr;
|
|
1547
|
-
align-items: start;
|
|
1548
|
-
gap: 8px;
|
|
1549
|
-
padding: 12px;
|
|
1550
|
-
background-color: ${e=>{const r=be(e.$variant);return e.$disabled?r.background.disabled:e.$checked?r.backgroundChecked:r.background.static}};
|
|
1551
|
-
border: 1px solid
|
|
1552
|
-
${e=>{const r=be(e.$variant);return e.$disabled?r.border.disabled:e.$checked?r.borderChecked:r.border.static}};
|
|
1553
|
-
border-radius: 12px;
|
|
1554
|
-
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
1555
|
-
transition:
|
|
1556
|
-
border-color 0.15s ease,
|
|
1557
|
-
background-color 0.15s ease;
|
|
1558
|
-
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1559
|
-
min-width: 0;
|
|
1560
|
-
|
|
1561
|
-
&:hover:not([data-disabled='true']) {
|
|
1562
|
-
border-color: ${e=>{const r=be(e.$variant);return e.$checked?r.borderChecked:r.border.hover}};
|
|
1563
|
-
}
|
|
1564
|
-
|
|
1565
|
-
.vacano_radio_container {
|
|
1566
|
-
pointer-events: none;
|
|
1567
|
-
}
|
|
1568
|
-
`,Tl=s.input`
|
|
1569
|
-
position: absolute;
|
|
1570
|
-
width: 1px;
|
|
1571
|
-
height: 1px;
|
|
1572
|
-
margin: -1px;
|
|
1573
|
-
padding: 0;
|
|
1574
|
-
overflow: hidden;
|
|
1575
|
-
clip: rect(0, 0, 0, 0);
|
|
1576
|
-
white-space: nowrap;
|
|
1577
|
-
border: 0;
|
|
1578
|
-
`,Il=s.div`
|
|
1579
|
-
display: flex;
|
|
1580
|
-
flex-direction: column;
|
|
1581
|
-
gap: 2px;
|
|
1582
|
-
min-width: 0;
|
|
1583
|
-
`,Al=s.span`
|
|
1584
|
-
font-size: 14px;
|
|
1585
|
-
font-weight: 500;
|
|
1586
|
-
line-height: 1.4;
|
|
1587
|
-
color: ${e=>be(e.$variant).label.static};
|
|
1588
|
-
|
|
1589
|
-
label[data-disabled='true'] & {
|
|
1590
|
-
color: ${e=>be(e.$variant).label.disabled};
|
|
1591
|
-
}
|
|
1592
|
-
`,Dl=s.span`
|
|
1593
|
-
font-size: 12px;
|
|
1594
|
-
font-weight: 400;
|
|
1595
|
-
line-height: 1.4;
|
|
1596
|
-
color: ${e=>be(e.$variant).description.static};
|
|
1597
|
-
|
|
1598
|
-
label[data-disabled='true'] & {
|
|
1599
|
-
color: ${e=>be(e.$variant).description.disabled};
|
|
1600
|
-
}
|
|
1601
|
-
`,Xe=T.newClassNameGetter("radio-card"),_l=({checked:e,className:r,classnames:o,description:n,disabled:i,fullWidth:l=!1,label:c,onChange:d,ref:u,variant:h="normal",...b})=>a.jsxs(Nl,{className:Xe("container",r),$checked:e,$disabled:!!i,$fullWidth:l,$variant:h,"data-disabled":i,children:[a.jsx(Tl,{...b,ref:u,type:"radio",checked:e,disabled:i,onChange:d}),a.jsx(jt,{className:o==null?void 0:o.radio,checked:e,disabled:i,variant:h,onChange:()=>{},tabIndex:-1,"aria-hidden":!0}),a.jsxs(Il,{className:Xe("content",o==null?void 0:o.content),children:[a.jsx(Al,{className:Xe("label",o==null?void 0:o.label),$variant:h,children:c}),n&&a.jsx(Dl,{className:Xe("description",o==null?void 0:o.description),$variant:h,children:n})]})]}),hr={label:{color:t.COLORS.black,disabledColor:t.alpha(t.COLORS.black,40)}},Ml=s.div`
|
|
1602
|
-
display: flex;
|
|
1603
|
-
flex-direction: column;
|
|
1604
|
-
gap: 8px;
|
|
1605
|
-
`,Fl=s.span`
|
|
1606
|
-
font-size: 13px;
|
|
1607
|
-
font-weight: 500;
|
|
1608
|
-
line-height: 1.5;
|
|
1609
|
-
color: ${e=>e.$disabled?hr.label.disabledColor:hr.label.color};
|
|
1610
|
-
margin-bottom: 4px;
|
|
1611
|
-
`,Bl=s.div`
|
|
1612
|
-
display: flex;
|
|
1613
|
-
flex-direction: column;
|
|
1614
|
-
gap: 12px;
|
|
1615
|
-
`,ft=T.newClassNameGetter("radio-group"),Yl=({className:e,classnames:r,disabled:o,label:n,name:i,onChange:l,options:c,ref:d,value:u,...h})=>a.jsxs(Ml,{...h,ref:d,className:ft("container",e),children:[n&&a.jsx(Fl,{className:ft("label",r==null?void 0:r.label),$disabled:o,children:n}),a.jsx(Bl,{className:ft("options",r==null?void 0:r.options),children:c.map(b=>a.jsx(jt,{className:r==null?void 0:r.radio,name:i,checked:u===b.value,label:b.label,disabled:o,onChange:()=>l(b.value)},b.value))})]}),_r=p.createContext(null),Vl=s.div`
|
|
739
|
+
`,Se=A.newClassNameGetter("progress"),rn=({value:e,size:t="default",className:o,classnames:i,ref:n,...r})=>d.jsx(on,{...r,ref:n,$size:t,className:Se("track",o,i==null?void 0:i.track),role:"progressbar","aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,children:d.jsx(nn,{$size:t,$value:e,className:Se("bar",i==null?void 0:i.bar)})}),Ae=u.createContext(null),an=c.styled.div`
|
|
1616
740
|
position: fixed;
|
|
1617
741
|
bottom: 24px;
|
|
1618
742
|
right: 24px;
|
|
@@ -1621,154 +745,21 @@
|
|
|
1621
745
|
align-items: center;
|
|
1622
746
|
gap: 10px;
|
|
1623
747
|
padding: 10px 16px;
|
|
1624
|
-
background-color: ${
|
|
748
|
+
background-color: ${a.alpha(a.COLORS["iron-grey"],10)};
|
|
1625
749
|
backdrop-filter: blur(8px);
|
|
1626
750
|
border-radius: 24px;
|
|
1627
|
-
animation: ${
|
|
751
|
+
animation: ${a.KEYFRAMES.fadeIn} 0.2s ease-out;
|
|
1628
752
|
pointer-events: none;
|
|
1629
|
-
color: ${
|
|
1630
|
-
`,
|
|
1631
|
-
font-size: 14px;
|
|
1632
|
-
font-weight: 500;
|
|
1633
|
-
white-space: nowrap;
|
|
1634
|
-
`,Gl=({children:e,defaultMessage:r="Saving"})=>{const[o,n]=p.useState(!1),[i,l]=p.useState(r),c=p.useCallback(h=>{l(h??r),n(!0)},[r]),d=p.useCallback(()=>{n(!1)},[]),u=p.useMemo(()=>({isVisible:o,show:c,hide:d}),[o,c,d]);return a.jsxs(_r.Provider,{value:u,children:[e,o&&a.jsxs(Vl,{children:[a.jsx(Et,{size:"sm"}),a.jsx(Hl,{children:i})]})]})},Wl=()=>{const e=p.useContext(_r);if(!e)throw new Error("useSaveProgress must be used within SaveProgressProvider");return e},xt=40,Ot=2,Ne=4,br={compact:{height:"32px",padding:"0 10px",radius:"14px"},default:{height:"40px",padding:"0 14px",radius:"16px"}},gr={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:t.alpha(t.COLORS.black,40),focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:t.alpha(t.COLORS.red,40),focus:t.alpha(t.COLORS.red,30)}},St=e=>br[e]??br.default,pe=e=>gr[e]??gr.normal,Kl=s.div`
|
|
1635
|
-
position: relative;
|
|
1636
|
-
display: grid;
|
|
1637
|
-
gap: 2px;
|
|
1638
|
-
min-width: 180px;
|
|
1639
|
-
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1640
|
-
`,Ul=s(ne)`
|
|
1641
|
-
margin-left: 6px;
|
|
1642
|
-
`,Xl=s.button`
|
|
1643
|
-
display: flex;
|
|
1644
|
-
align-items: center;
|
|
1645
|
-
justify-content: space-between;
|
|
1646
|
-
gap: 8px;
|
|
1647
|
-
width: 100%;
|
|
1648
|
-
outline: none;
|
|
753
|
+
color: ${a.COLORS.black};
|
|
754
|
+
`,sn=c.styled.span`
|
|
1649
755
|
font-size: 14px;
|
|
1650
756
|
font-weight: 500;
|
|
1651
|
-
text-align: left;
|
|
1652
|
-
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
1653
|
-
height: ${e=>St(e.$size).height};
|
|
1654
|
-
padding: ${e=>St(e.$size).padding};
|
|
1655
|
-
border-radius: ${e=>St(e.$size).radius};
|
|
1656
|
-
|
|
1657
|
-
color: ${e=>e.$hasValue?e.$disabled?pe(e.$variant).color.disabled:pe(e.$variant).color.static:pe(e.$variant).placeholder};
|
|
1658
|
-
border: 1px solid
|
|
1659
|
-
${e=>e.$disabled?pe(e.$variant).border.disabled:pe(e.$variant).border.static};
|
|
1660
|
-
background-color: ${e=>e.$disabled?pe(e.$variant).background.disabled:pe(e.$variant).background.static};
|
|
1661
|
-
`,ql=s.span`
|
|
1662
|
-
flex: 1;
|
|
1663
|
-
min-width: 0;
|
|
1664
|
-
overflow: hidden;
|
|
1665
|
-
text-overflow: ellipsis;
|
|
1666
757
|
white-space: nowrap;
|
|
1667
|
-
`,
|
|
1668
|
-
display: flex;
|
|
1669
|
-
align-items: center;
|
|
1670
|
-
justify-content: center;
|
|
1671
|
-
flex-shrink: 0;
|
|
1672
|
-
transition: transform 0.2s ease;
|
|
1673
|
-
transform: rotate(${e=>e.$open?"180deg":"0deg"});
|
|
1674
|
-
`,Mr=`
|
|
1675
|
-
display: grid;
|
|
1676
|
-
gap: 2px;
|
|
1677
|
-
padding: 4px;
|
|
1678
|
-
background: ${t.COLORS.white};
|
|
1679
|
-
border: 1px solid ${t.alpha(t.COLORS.black,10)};
|
|
1680
|
-
border-radius: 16px;
|
|
1681
|
-
box-shadow: 0 4px 20px ${t.alpha(t.COLORS.black,15)};
|
|
1682
|
-
z-index: 1000;
|
|
1683
|
-
`,Jl=s.div`
|
|
1684
|
-
position: absolute;
|
|
1685
|
-
left: -4px;
|
|
1686
|
-
width: calc(100% + 8px);
|
|
1687
|
-
${Mr}
|
|
1688
|
-
`,Ql=s.div`
|
|
1689
|
-
position: fixed;
|
|
1690
|
-
${Mr}
|
|
1691
|
-
`,ed=s.button`
|
|
1692
|
-
display: flex;
|
|
1693
|
-
align-items: center;
|
|
1694
|
-
justify-content: space-between;
|
|
1695
|
-
gap: 8px;
|
|
1696
|
-
width: 100%;
|
|
1697
|
-
height: 40px;
|
|
1698
|
-
padding: 0 14px;
|
|
1699
|
-
border: none;
|
|
1700
|
-
background: ${e=>e.$selected?t.alpha(t.COLORS.black,6):"transparent"};
|
|
1701
|
-
border-radius: 12px;
|
|
1702
|
-
font-size: 14px;
|
|
1703
|
-
font-weight: 500;
|
|
1704
|
-
text-align: left;
|
|
1705
|
-
cursor: ${e=>e.$disabled?"not-allowed":"pointer"};
|
|
1706
|
-
color: ${e=>e.$disabled?t.alpha(t.COLORS.black,40):t.COLORS.black};
|
|
1707
|
-
transition: background-color 0.15s ease;
|
|
1708
|
-
|
|
1709
|
-
&:hover:not(:disabled) {
|
|
1710
|
-
background: ${t.alpha(t.COLORS.black,8)};
|
|
1711
|
-
}
|
|
1712
|
-
|
|
1713
|
-
& > span {
|
|
1714
|
-
overflow: hidden;
|
|
1715
|
-
text-overflow: ellipsis;
|
|
1716
|
-
white-space: nowrap;
|
|
1717
|
-
min-width: 0;
|
|
1718
|
-
}
|
|
1719
|
-
`,td=s.span`
|
|
1720
|
-
display: flex;
|
|
1721
|
-
align-items: center;
|
|
1722
|
-
justify-content: center;
|
|
1723
|
-
flex-shrink: 0;
|
|
1724
|
-
color: ${t.COLORS.black};
|
|
1725
|
-
`,ye=T.newClassNameGetter("select"),rd=({className:e,classnames:r,disabled:o=!1,fullWidth:n=!1,label:i,onChange:l,options:c,placeholder:d="Select...",portalRenderNode:u,ref:h,size:b="default",value:f,variant:O="normal",...m})=>{const[S,x]=p.useState(!1),[y,$]=p.useState({top:0,left:0,width:0}),C=p.useRef(null),g=p.useRef(null),k=p.useRef(null),N=c.find(w=>w.value===f),P=Math.max(0,c.findIndex(w=>w.value===f)),Y=-(P*(xt+Ot)+Ne),j=()=>{if(!g.current||!u)return;const w=g.current.getBoundingClientRect(),I=P*(xt+Ot)+Ne;let R=w.top-I;const z=c.length*xt+(c.length-1)*Ot+Ne*2,B=8,F=window.innerHeight-z-8;R<B&&(R=B),R>F&&(R=F),$({top:R,left:w.left-Ne,width:w.width+Ne*2})},_=w=>{var I;l==null||l(w),x(!1),(I=g.current)==null||I.focus()},M=w=>{o||c.length===0||(w.key==="Enter"||w.key===" "?(w.preventDefault(),x(I=>!I)):w.key==="Escape"&&S?(w.preventDefault(),x(!1)):w.key==="ArrowDown"&&!S&&(w.preventDefault(),x(!0)))};p.useLayoutEffect(()=>{S&&u&&j()},[S,u,P,c.length]),p.useEffect(()=>{if(!S)return;const w=z=>{const B=z.target,F=C.current&&!C.current.contains(B),H=k.current&&!k.current.contains(B);u?F&&H&&x(!1):F&&x(!1)},I=()=>{u&&j()},R=()=>{u&&j()};return document.addEventListener("mousedown",w),u&&(window.addEventListener("scroll",I,!0),window.addEventListener("resize",R)),()=>{document.removeEventListener("mousedown",w),window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",R)}},[S,u]);const E=()=>c.map(w=>a.jsxs(ed,{type:"button",role:"option",$selected:w.value===f,$disabled:w.disabled??!1,disabled:w.disabled,"aria-selected":w.value===f,onClick:()=>_(w.value),className:ye("option",r==null?void 0:r.option),children:[a.jsx("span",{children:w.label}),w.value===f&&a.jsx(td,{children:a.jsx(a.Check,{size:16})})]},w.value)),A=u?fe.createPortal(a.jsx(Ql,{ref:k,role:"listbox",style:{top:y.top,left:y.left,width:y.width},className:ye("dropdown",r==null?void 0:r.dropdown),children:E()}),u):a.jsx(Jl,{ref:k,role:"listbox",style:{top:Y},className:ye("dropdown",r==null?void 0:r.dropdown),children:E()});return a.jsxs(Kl,{...m,ref:w=>{C.current=w,typeof h=="function"?h(w):h&&(h.current=w)},$fullWidth:n,className:ye("container",e),children:[i&&a.jsx(Ul,{variant:O==="error"?"error":"normal",className:ye("label",r==null?void 0:r.label),children:i}),a.jsxs(Xl,{ref:g,type:"button",$size:b,$variant:O,$disabled:o,$hasValue:!!N,disabled:o,onClick:()=>!o&&c.length>0&&x(w=>!w),onKeyDown:M,"aria-haspopup":"listbox","aria-expanded":S,className:ye("trigger",r==null?void 0:r.trigger),children:[a.jsx(ql,{children:(N==null?void 0:N.label)??d}),a.jsx(Zl,{$open:S,children:a.jsx(a.ChevronDown,{size:16})})]}),S&&A]})},fr={positive:t.COLORS.green,negative:t.COLORS.red,neutral:t.COLORS["iron-grey"]},od=e=>fr[e]??fr.neutral,id=s.div`
|
|
1726
|
-
display: flex;
|
|
1727
|
-
flex-direction: column;
|
|
1728
|
-
gap: 4px;
|
|
1729
|
-
padding: 20px;
|
|
1730
|
-
background-color: ${t.COLORS.white};
|
|
1731
|
-
border-radius: 16px;
|
|
1732
|
-
border: ${({$border:e})=>e?"1px solid #e5e7eb":"none"};
|
|
1733
|
-
box-shadow: ${({$shadow:e})=>e?"0 4px 6px -1px rgba(0, 0, 0, 0.1)":"none"};
|
|
1734
|
-
`,nd=s.div`
|
|
1735
|
-
display: flex;
|
|
1736
|
-
align-items: center;
|
|
1737
|
-
justify-content: space-between;
|
|
1738
|
-
gap: 8px;
|
|
1739
|
-
`,ad=s.p`
|
|
1740
|
-
margin: 0;
|
|
1741
|
-
font-size: 13px;
|
|
1742
|
-
color: ${t.COLORS["iron-grey"]};
|
|
1743
|
-
`,ld=s.div`
|
|
1744
|
-
display: flex;
|
|
1745
|
-
align-items: center;
|
|
1746
|
-
justify-content: center;
|
|
1747
|
-
width: 32px;
|
|
1748
|
-
height: 32px;
|
|
1749
|
-
border-radius: 8px;
|
|
1750
|
-
background-color: #f5f5f5;
|
|
1751
|
-
color: ${t.COLORS["iron-grey"]};
|
|
1752
|
-
|
|
1753
|
-
& svg {
|
|
1754
|
-
width: 18px;
|
|
1755
|
-
height: 18px;
|
|
1756
|
-
}
|
|
1757
|
-
`,dd=s.h3`
|
|
1758
|
-
margin: 0;
|
|
1759
|
-
font-size: 28px;
|
|
1760
|
-
font-weight: 600;
|
|
1761
|
-
line-height: 1.2;
|
|
1762
|
-
color: ${t.COLORS.black};
|
|
1763
|
-
`,cd=s.p`
|
|
1764
|
-
margin: 0;
|
|
1765
|
-
font-size: 12px;
|
|
1766
|
-
color: ${({$variant:e})=>od(e)};
|
|
1767
|
-
`,qe=T.newClassNameGetter("status-card"),sd=({border:e=!1,className:r,classnames:o,icon:n,label:i,ref:l,shadow:c=!1,trend:d,trendVariant:u="neutral",value:h,...b})=>a.jsxs(id,{...b,ref:l,className:qe("container",r),$border:e,$shadow:c,children:[a.jsxs(nd,{children:[a.jsx(ad,{className:qe("label",o==null?void 0:o.label),children:i}),n&&a.jsx(ld,{children:n})]}),a.jsx(dd,{className:qe("value",o==null?void 0:o.value),children:h}),d&&a.jsx(cd,{className:qe("trend",o==null?void 0:o.trend),$variant:u,children:d})]}),pd=s.div`
|
|
758
|
+
`,ln=({children:e,defaultMessage:t="Saving"})=>{const[o,i]=u.useState(!1),[n,r]=u.useState(t),l=u.useCallback(h=>{r(h??t),i(!0)},[t]),s=u.useCallback(()=>{i(!1)},[]),p=u.useMemo(()=>({isVisible:o,show:l,hide:s}),[o,l,s]);return d.jsxs(Ae.Provider,{value:p,children:[e,o&&d.jsxs(an,{children:[d.jsx(c.Spinner,{size:"sm"}),d.jsx(sn,{children:n})]})]})},cn=()=>{const e=u.useContext(Ae);if(!e)throw new Error("useSaveProgress must be used within SaveProgressProvider");return e},dn=c.styled.div`
|
|
1768
759
|
display: flex;
|
|
1769
760
|
align-items: ${e=>e.$orientation==="vertical"?"flex-start":"center"};
|
|
1770
761
|
flex-direction: ${e=>e.$orientation==="vertical"?"column":"row"};
|
|
1771
|
-
`,
|
|
762
|
+
`,pn=c.styled.div`
|
|
1772
763
|
display: flex;
|
|
1773
764
|
align-items: ${e=>e.$orientation==="vertical"?"flex-start":"center"};
|
|
1774
765
|
flex-direction: ${e=>e.$orientation==="vertical"?"column":"row"};
|
|
@@ -1777,7 +768,7 @@
|
|
|
1777
768
|
&:last-child {
|
|
1778
769
|
flex: 0;
|
|
1779
770
|
}
|
|
1780
|
-
`,
|
|
771
|
+
`,un=c.styled.button`
|
|
1781
772
|
display: flex;
|
|
1782
773
|
align-items: center;
|
|
1783
774
|
gap: 10px;
|
|
@@ -1786,7 +777,7 @@
|
|
|
1786
777
|
background: transparent;
|
|
1787
778
|
cursor: ${e=>e.$clickable?"pointer":"default"};
|
|
1788
779
|
flex-shrink: 0;
|
|
1789
|
-
`,
|
|
780
|
+
`,gn=c.styled.div`
|
|
1790
781
|
display: flex;
|
|
1791
782
|
align-items: center;
|
|
1792
783
|
justify-content: center;
|
|
@@ -1802,22 +793,22 @@
|
|
|
1802
793
|
color 0.2s ease;
|
|
1803
794
|
|
|
1804
795
|
${e=>e.$active||e.$completed?`
|
|
1805
|
-
background-color: ${
|
|
1806
|
-
border: 2px solid ${
|
|
1807
|
-
color: ${
|
|
796
|
+
background-color: ${a.COLORS.black};
|
|
797
|
+
border: 2px solid ${a.COLORS.black};
|
|
798
|
+
color: ${a.COLORS.white};
|
|
1808
799
|
`:`
|
|
1809
800
|
background-color: transparent;
|
|
1810
|
-
border: 2px solid ${
|
|
1811
|
-
color: ${
|
|
801
|
+
border: 2px solid ${a.COLORS.gray};
|
|
802
|
+
color: ${a.COLORS["iron-grey"]};
|
|
1812
803
|
`}
|
|
1813
|
-
`,
|
|
804
|
+
`,hn=c.styled.span`
|
|
1814
805
|
font-size: 14px;
|
|
1815
806
|
font-weight: 500;
|
|
1816
807
|
white-space: nowrap;
|
|
1817
|
-
color: ${e=>e.$active||e.$completed?
|
|
808
|
+
color: ${e=>e.$active||e.$completed?a.COLORS.black:a.COLORS["iron-grey"]};
|
|
1818
809
|
transition: color 0.2s ease;
|
|
1819
|
-
`,
|
|
1820
|
-
background-color: ${e=>e.$completed?
|
|
810
|
+
`,fn=c.styled.div`
|
|
811
|
+
background-color: ${e=>e.$completed?a.COLORS.black:a.COLORS.gray};
|
|
1821
812
|
transition: background-color 0.2s ease;
|
|
1822
813
|
|
|
1823
814
|
${e=>e.$orientation==="vertical"?`
|
|
@@ -1830,128 +821,16 @@
|
|
|
1830
821
|
min-width: 16px;
|
|
1831
822
|
margin: 0 12px;
|
|
1832
823
|
`}
|
|
1833
|
-
`,
|
|
1834
|
-
position: relative;
|
|
1835
|
-
display: flex;
|
|
1836
|
-
flex-direction: column;
|
|
1837
|
-
gap: 4px;
|
|
1838
|
-
`,Sd=s(ne)`
|
|
1839
|
-
margin-left: 6px;
|
|
1840
|
-
color: ${e=>kt[e.$variant].label};
|
|
1841
|
-
`,$d=s.div`
|
|
1842
|
-
display: flex;
|
|
1843
|
-
flex-wrap: wrap;
|
|
1844
|
-
align-items: center;
|
|
1845
|
-
gap: 6px;
|
|
1846
|
-
min-height: 44px;
|
|
1847
|
-
padding: 8px 12px;
|
|
1848
|
-
border: 1px dashed ${e=>kt[e.$variant].border};
|
|
1849
|
-
border-radius: 8px;
|
|
1850
|
-
background: ${t.COLORS.white};
|
|
1851
|
-
cursor: ${e=>e.$disabled?"not-allowed":"text"};
|
|
1852
|
-
opacity: ${e=>e.$disabled?.5:1};
|
|
1853
|
-
transition: border-color 0.15s ease;
|
|
1854
|
-
|
|
1855
|
-
&:hover {
|
|
1856
|
-
border-color: ${e=>e.$disabled?kt[e.$variant].border:e.$variant==="error"?t.COLORS.red:t.COLORS.black};
|
|
1857
|
-
}
|
|
1858
|
-
|
|
1859
|
-
${e=>e.$focused&&`
|
|
1860
|
-
outline: 2px solid ${e.$variant==="error"?t.COLORS.red:t.COLORS["steel-blue"]};
|
|
1861
|
-
outline-offset: 2px;
|
|
1862
|
-
`}
|
|
1863
|
-
`,yd=s.input`
|
|
1864
|
-
flex: 1;
|
|
1865
|
-
min-width: 80px;
|
|
1866
|
-
border: none;
|
|
1867
|
-
outline: none;
|
|
1868
|
-
background: transparent;
|
|
1869
|
-
font-size: 14px;
|
|
1870
|
-
color: ${t.COLORS.black};
|
|
1871
|
-
cursor: ${e=>e.$disabled?"not-allowed":"text"};
|
|
1872
|
-
|
|
1873
|
-
&::placeholder {
|
|
1874
|
-
color: ${t.COLORS["iron-grey"]};
|
|
1875
|
-
}
|
|
1876
|
-
|
|
1877
|
-
&:disabled {
|
|
1878
|
-
cursor: not-allowed;
|
|
1879
|
-
}
|
|
1880
|
-
`,Fr=`
|
|
1881
|
-
z-index: 100;
|
|
1882
|
-
background-color: ${t.COLORS.white};
|
|
1883
|
-
border: 1px solid ${t.alpha(t.COLORS.black,15)};
|
|
1884
|
-
border-radius: 8px;
|
|
1885
|
-
box-shadow: 0 4px 16px ${t.alpha(t.COLORS.black,12)};
|
|
1886
|
-
max-height: 200px;
|
|
1887
|
-
overflow-y: auto;
|
|
1888
|
-
`,Br=(e,r)=>e?"translateY(0)":r==="bottom"?"translateY(-8px)":"translateY(8px)",Yr=`
|
|
1889
|
-
opacity 0.15s ease,
|
|
1890
|
-
transform 0.15s ease,
|
|
1891
|
-
visibility 0.15s;
|
|
1892
|
-
`,Cd=s.div`
|
|
1893
|
-
position: absolute;
|
|
1894
|
-
left: 0;
|
|
1895
|
-
right: 0;
|
|
1896
|
-
${e=>e.$position==="bottom"?"top: calc(100% + 4px);":"bottom: calc(100% + 4px);"}
|
|
1897
|
-
${Fr}
|
|
1898
|
-
opacity: ${e=>e.$open?1:0};
|
|
1899
|
-
visibility: ${e=>e.$open?"visible":"hidden"};
|
|
1900
|
-
transform: ${e=>Br(e.$open,e.$position)};
|
|
1901
|
-
transition: ${Yr};
|
|
1902
|
-
`,md=s.div`
|
|
1903
|
-
position: fixed;
|
|
1904
|
-
${Fr}
|
|
1905
|
-
opacity: ${e=>e.$open?1:0};
|
|
1906
|
-
visibility: ${e=>e.$open?"visible":"hidden"};
|
|
1907
|
-
transform: ${e=>Br(e.$open,e.$position)};
|
|
1908
|
-
transition: ${Yr};
|
|
1909
|
-
`,xr=s.button`
|
|
1910
|
-
display: flex;
|
|
1911
|
-
align-items: center;
|
|
1912
|
-
width: 100%;
|
|
1913
|
-
padding: 10px 12px;
|
|
1914
|
-
border: none;
|
|
1915
|
-
background: transparent;
|
|
1916
|
-
font-size: 14px;
|
|
1917
|
-
color: ${t.COLORS.black};
|
|
1918
|
-
text-align: left;
|
|
1919
|
-
cursor: pointer;
|
|
1920
|
-
transition: background-color 0.15s ease;
|
|
1921
|
-
|
|
1922
|
-
&:hover {
|
|
1923
|
-
background-color: ${t.COLORS.gray};
|
|
1924
|
-
}
|
|
1925
|
-
|
|
1926
|
-
&:first-of-type {
|
|
1927
|
-
border-radius: 7px 7px 0 0;
|
|
1928
|
-
}
|
|
1929
|
-
|
|
1930
|
-
&:last-of-type {
|
|
1931
|
-
border-radius: 0 0 7px 7px;
|
|
1932
|
-
}
|
|
1933
|
-
|
|
1934
|
-
&:only-child {
|
|
1935
|
-
border-radius: 7px;
|
|
1936
|
-
}
|
|
1937
|
-
`,Or=s.div`
|
|
1938
|
-
display: flex;
|
|
1939
|
-
align-items: center;
|
|
1940
|
-
justify-content: center;
|
|
1941
|
-
padding: 16px;
|
|
1942
|
-
color: ${t.COLORS["iron-grey"]};
|
|
1943
|
-
font-size: 14px;
|
|
1944
|
-
text-align: center;
|
|
1945
|
-
`,ee=T.newClassNameGetter("tags"),Ze=4,wd=({className:e,classnames:r,createKey:o="Tab",disabled:n=!1,emptyMessage:i="No options",freeSolo:l=!0,label:c,onChange:d,options:u=[],placeholder:h="Add tag...",portalRenderNode:b,ref:f,value:O,variant:m="normal",...S})=>{const x=p.useRef(null),y=p.useRef(null),$=p.useRef(null),C=p.useRef(null),[g,k]=p.useState(""),[N,P]=p.useState(!1),[Y,j]=p.useState("bottom"),[_,M]=p.useState({top:0,left:0,width:0}),E=p.useMemo(()=>{const L=u.filter(U=>!O.includes(U.value));if(!g.trim())return L;const D=g.toLowerCase().trim();return L.filter(U=>U.label.toLowerCase().includes(D))},[u,O,g]),A=N&&u.length>0,w=p.useCallback(()=>{var _e;if(!y.current)return;const L=y.current.getBoundingClientRect(),D=((_e=$.current)==null?void 0:_e.offsetHeight)??200,U=window.innerHeight-L.bottom-Ze,X=L.top-Ze,xe=U<D&&X>U?"top":"bottom";if(j(xe),b){const ot=xe==="bottom"?L.bottom+Ze:L.top-D-Ze;M({top:ot,left:L.left,width:L.width})}},[b]);p.useEffect(()=>{if(N)return w(),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[N,w]);const I=p.useCallback(L=>{const D=L.trim();return!D||O.includes(D)?!1:(d([...O,D]),k(""),!0)},[O,d]),R=L=>{if(L.key===o&&g.trim())if(L.preventDefault(),l)I(g);else{const D=E.find(U=>U.label.toLowerCase()===g.toLowerCase().trim());D&&I(D.value)}else L.key==="Backspace"&&!g&&O.length>0&&d(O.slice(0,-1))},z=L=>{var D;I(L),(D=C.current)==null||D.focus()},B=L=>{d(O.filter(D=>D!==L))},F=()=>{var L;n||(L=C.current)==null||L.focus()},H=L=>{const D=u.find(U=>U.value===L);return(D==null?void 0:D.label)??L};return a.jsxs(Od,{...S,ref:f,className:ee("container",e),children:[c&&a.jsx(Sd,{$variant:m,className:ee("label"),children:c}),a.jsxs("div",{ref:x,style:{position:"relative"},children:[a.jsxs($d,{ref:y,$variant:m,$disabled:n,$focused:N,onClick:F,className:ee("trigger",r==null?void 0:r.trigger),children:[O.map(L=>a.jsx(Qe,{deletable:!n,onDelete:()=>B(L),className:ee("chip",r==null?void 0:r.chip),children:H(L)},L)),a.jsx(yd,{ref:C,type:"text",value:g,onChange:L=>k(L.target.value),onFocus:()=>P(!0),onBlur:()=>setTimeout(()=>P(!1),150),onKeyDown:R,placeholder:O.length===0?h:"",disabled:n,$disabled:n,className:ee("input",r==null?void 0:r.input)})]}),u.length>0&&(b?fe.createPortal(a.jsx(md,{ref:$,$open:A,$position:Y,style:{top:_.top,left:_.left,width:_.width},className:ee("dropdown",r==null?void 0:r.dropdown),children:E.length===0?a.jsx(Or,{className:ee("empty",r==null?void 0:r.empty),children:i}):E.map(L=>a.jsx(xr,{type:"button",onMouseDown:D=>D.preventDefault(),onClick:()=>z(L.value),className:ee("option",r==null?void 0:r.option),children:L.label},L.value))}),b):a.jsx(Cd,{ref:$,$open:A,$position:Y,className:ee("dropdown",r==null?void 0:r.dropdown),children:E.length===0?a.jsx(Or,{className:ee("empty",r==null?void 0:r.empty),children:i}):E.map(L=>a.jsx(xr,{type:"button",onMouseDown:D=>D.preventDefault(),onClick:()=>z(L.value),className:ee("option",r==null?void 0:r.option),children:L.label},L.value))}))]})]})},vd=s.div`
|
|
824
|
+
`,Q=A.newClassNameGetter("stepper"),xn=({className:e,classnames:t,onChange:o,orientation:i="horizontal",ref:n,steps:r,value:l,...s})=>{const p=u.useMemo(()=>r.findIndex(h=>h.value===l),[r,l]);return d.jsx(dn,{...s,ref:n,$orientation:i,className:Q("container",e),children:r.map((h,g)=>{const f=h.value===l,x=g<p,b=g===r.length-1;return d.jsxs(pn,{$orientation:i,children:[d.jsxs(un,{type:"button",$active:f,$completed:x,$clickable:!!o,onClick:()=>o==null?void 0:o(h.value),className:Q("step",t==null?void 0:t.step),children:[d.jsx(gn,{$active:f,$completed:x,className:Q("circle",t==null?void 0:t.circle),children:g+1}),d.jsx(hn,{$active:f,$completed:x,className:Q("label",t==null?void 0:t.label),children:h.label})]}),!b&&d.jsx(fn,{$completed:x,$orientation:i,className:Q("line",t==null?void 0:t.line)})]},h.value)})})},mn=c.styled.div`
|
|
1946
825
|
display: flex;
|
|
1947
826
|
align-items: center;
|
|
1948
827
|
gap: 6px;
|
|
1949
|
-
`,
|
|
828
|
+
`,bn=c.styled.button`
|
|
1950
829
|
padding: 6px 16px;
|
|
1951
830
|
border: none;
|
|
1952
831
|
border-radius: 12px;
|
|
1953
|
-
background-color: ${e=>e.$active?
|
|
1954
|
-
color: ${
|
|
832
|
+
background-color: ${e=>e.$active?a.COLORS.gray:"transparent"};
|
|
833
|
+
color: ${a.COLORS.black};
|
|
1955
834
|
font-size: 14px;
|
|
1956
835
|
font-weight: 500;
|
|
1957
836
|
line-height: 1.4;
|
|
@@ -1962,46 +841,9 @@
|
|
|
1962
841
|
opacity 0.15s ease;
|
|
1963
842
|
|
|
1964
843
|
&:hover:not(:disabled) {
|
|
1965
|
-
background-color: ${e=>e.$active?
|
|
1966
|
-
}
|
|
1967
|
-
`,Sr=T.newClassNameGetter("tabs"),Ld=({className:e,classnames:r,onChange:o,ref:n,tabs:i,value:l,...c})=>a.jsx(vd,{...c,ref:n,className:Sr("container",e),role:"tablist",children:i.map(d=>a.jsx(Rd,{type:"button",role:"tab","aria-selected":l===d.value,$active:l===d.value,$disabled:!!d.disabled,disabled:d.disabled,onClick:()=>o(d.value),className:Sr("tab",r==null?void 0:r.tab),children:d.label},d.value))}),$r={normal:{background:{static:t.alpha(t.COLORS.black,2),disabled:t.alpha(t.COLORS.black,10)},border:{static:t.alpha(t.COLORS.black,60),disabled:t.alpha(t.COLORS.black,10)},color:{static:t.COLORS.black,disabled:t.alpha(t.COLORS.black,65)},placeholder:{static:t.alpha(t.COLORS.black,40),disabled:t.alpha(t.COLORS.black,65)},focus:t.alpha(t.COLORS["iron-grey"],30)},error:{background:{static:t.alpha(t.COLORS.red,2),disabled:t.alpha(t.COLORS.red,10)},border:{static:t.alpha(t.COLORS.red,60),disabled:t.alpha(t.COLORS.red,10)},color:{static:t.COLORS.red,disabled:t.alpha(t.COLORS.red,65)},placeholder:{static:t.alpha(t.COLORS.red,40),disabled:t.alpha(t.COLORS.red,65)},focus:t.alpha(t.COLORS.red,30)}},ce=e=>$r[e]??$r.normal,kd=s.div`
|
|
1968
|
-
display: grid;
|
|
1969
|
-
flex-direction: column;
|
|
1970
|
-
gap: 2px;
|
|
1971
|
-
width: ${e=>e.$fullWidth?"100%":"fit-content"};
|
|
1972
|
-
`,Ed=s(ne)`
|
|
1973
|
-
margin-left: 6px;
|
|
1974
|
-
`,jd=s.textarea`
|
|
1975
|
-
flex: 1;
|
|
1976
|
-
min-width: 0;
|
|
1977
|
-
outline: none;
|
|
1978
|
-
font-size: 14px;
|
|
1979
|
-
font-weight: 500;
|
|
1980
|
-
font-family: inherit;
|
|
1981
|
-
padding: 10px 14px;
|
|
1982
|
-
border-radius: 16px;
|
|
1983
|
-
resize: vertical;
|
|
1984
|
-
|
|
1985
|
-
color: ${e=>ce(e.$variant).color.static};
|
|
1986
|
-
border: 1px solid ${e=>ce(e.$variant).border.static};
|
|
1987
|
-
background-color: ${e=>ce(e.$variant).background.static};
|
|
1988
|
-
|
|
1989
|
-
&::placeholder {
|
|
1990
|
-
color: ${e=>ce(e.$variant).placeholder.static};
|
|
1991
|
-
}
|
|
1992
|
-
|
|
1993
|
-
&:disabled {
|
|
1994
|
-
cursor: not-allowed;
|
|
1995
|
-
resize: none;
|
|
1996
|
-
color: ${e=>ce(e.$variant).color.disabled};
|
|
1997
|
-
background-color: ${e=>ce(e.$variant).background.disabled};
|
|
1998
|
-
border-color: ${e=>ce(e.$variant).border.disabled};
|
|
1999
|
-
|
|
2000
|
-
&::placeholder {
|
|
2001
|
-
color: ${e=>ce(e.$variant).placeholder.disabled};
|
|
2002
|
-
}
|
|
844
|
+
background-color: ${e=>e.$active?a.COLORS.gray:"rgba(0, 0, 0, 0.05)"};
|
|
2003
845
|
}
|
|
2004
|
-
|
|
846
|
+
`,ve=A.newClassNameGetter("tabs"),yn=({className:e,classnames:t,onChange:o,ref:i,tabs:n,value:r,...l})=>d.jsx(mn,{...l,ref:i,className:ve("container",e),role:"tablist",children:n.map(s=>d.jsx(bn,{type:"button",role:"tab","aria-selected":r===s.value,$active:r===s.value,$disabled:!!s.disabled,disabled:s.disabled,onClick:()=>o(s.value),className:ve("tab",t==null?void 0:t.tab),children:s.label},s.value))}),Ie=u.createContext(null),ce=3,Ce={default:{background:"#374151",text:a.COLORS.white,border:"#374151"},success:{background:a.COLORS.green,text:a.COLORS.white,border:a.COLORS.green},warning:{background:a.COLORS.yellow,text:a.COLORS.white,border:a.COLORS.yellow},danger:{background:a.COLORS.red,text:a.COLORS.white,border:a.COLORS.red}},wn=(e,t)=>{switch(t.type){case"ADD_TOAST":{const o=t.payload;return e.toasts.length<ce?{...e,toasts:[...e.toasts,o]}:{...e,queue:[...e.queue,o]}}case"REMOVE_TOAST":{const o=t.payload,i=e.toasts.filter(r=>r.id!==o),n=e.queue[0];return n&&i.length<ce?{toasts:[...i,n],queue:e.queue.slice(1)}:{...e,toasts:i}}case"SHOW_NEXT_FROM_QUEUE":{const o=e.queue[0];return!o||e.toasts.length>=ce?e:{toasts:[...e.toasts,o],queue:e.queue.slice(1)}}default:return e}},$n={toasts:[],queue:[]},de=e=>Ce[e]??Ce.default,Sn=c.styled.div`
|
|
2005
847
|
position: fixed;
|
|
2006
848
|
bottom: 24px;
|
|
2007
849
|
left: 24px;
|
|
@@ -2012,30 +854,30 @@
|
|
|
2012
854
|
pointer-events: none;
|
|
2013
855
|
width: auto;
|
|
2014
856
|
max-width: 90vw;
|
|
2015
|
-
`,
|
|
857
|
+
`,vn=c.styled.div`
|
|
2016
858
|
display: flex;
|
|
2017
859
|
align-items: center;
|
|
2018
860
|
justify-content: space-between;
|
|
2019
861
|
gap: 12px;
|
|
2020
862
|
min-height: 32px;
|
|
2021
863
|
padding: 8px 8px 8px 16px;
|
|
2022
|
-
background-color: ${({$variant:e})=>
|
|
2023
|
-
color: ${({$variant:e})=>
|
|
2024
|
-
border: 1px solid ${({$variant:e})=>
|
|
864
|
+
background-color: ${({$variant:e})=>de(e).background};
|
|
865
|
+
color: ${({$variant:e})=>de(e).text};
|
|
866
|
+
border: 1px solid ${({$variant:e})=>de(e).border};
|
|
2025
867
|
border-radius: 96px;
|
|
2026
868
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
2027
|
-
animation: ${({$isExiting:e})=>e?
|
|
869
|
+
animation: ${({$isExiting:e})=>e?a.KEYFRAMES.slideOutBottomFade:a.KEYFRAMES.slideInBottomFade}
|
|
2028
870
|
0.3s ease-out;
|
|
2029
871
|
pointer-events: auto;
|
|
2030
872
|
max-width: 500px;
|
|
2031
|
-
`,
|
|
873
|
+
`,Cn=c.styled.span`
|
|
2032
874
|
font-size: 14px;
|
|
2033
875
|
font-weight: 500;
|
|
2034
876
|
line-height: 1.4;
|
|
2035
877
|
white-space: nowrap;
|
|
2036
878
|
overflow: hidden;
|
|
2037
879
|
text-overflow: ellipsis;
|
|
2038
|
-
`,
|
|
880
|
+
`,On=c.styled.button`
|
|
2039
881
|
display: flex;
|
|
2040
882
|
align-items: center;
|
|
2041
883
|
justify-content: center;
|
|
@@ -2053,20 +895,20 @@
|
|
|
2053
895
|
&:hover {
|
|
2054
896
|
opacity: 1;
|
|
2055
897
|
}
|
|
2056
|
-
`,
|
|
898
|
+
`,Rn=c.styled.div`
|
|
2057
899
|
display: flex;
|
|
2058
900
|
align-items: center;
|
|
2059
901
|
justify-content: space-between;
|
|
2060
902
|
gap: 12px;
|
|
2061
903
|
width: 100%;
|
|
2062
|
-
`,
|
|
904
|
+
`,En=c.styled.div`
|
|
2063
905
|
display: flex;
|
|
2064
906
|
align-items: center;
|
|
2065
907
|
justify-content: center;
|
|
2066
908
|
min-height: 32px;
|
|
2067
909
|
padding: 8px 16px;
|
|
2068
910
|
background-color: #374151;
|
|
2069
|
-
color: ${
|
|
911
|
+
color: ${a.COLORS.white};
|
|
2070
912
|
border-radius: 96px;
|
|
2071
913
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
2072
914
|
pointer-events: auto;
|
|
@@ -2074,7 +916,7 @@
|
|
|
2074
916
|
font-weight: 500;
|
|
2075
917
|
white-space: nowrap;
|
|
2076
918
|
margin-left: auto;
|
|
2077
|
-
`,
|
|
919
|
+
`,Oe=({toast:e,onHide:t})=>{const[o,i]=u.useState(!1),n=()=>{i(!0),setTimeout(()=>{t(e.id)},300)};return u.useEffect(()=>{if(e.duration){const r=setTimeout(()=>{n()},e.duration);return()=>clearTimeout(r)}},[e.duration,e.id]),d.jsxs(vn,{$variant:e.variant,$isExiting:o,children:[d.jsx(Cn,{children:e.message}),d.jsx(On,{onClick:n,children:d.jsx(d.X,{style:{width:16,height:16}})})]})},Ln=({toasts:e,queueCount:t,onHide:o})=>{if(e.length===0)return null;const i=e.length-1;return d.jsx(Sn,{children:e.map((n,r)=>r===i&&t>0?d.jsxs(Rn,{children:[d.jsx(Oe,{toast:n,onHide:o}),d.jsxs(En,{children:["+",t]})]},n.id):d.jsx(Oe,{toast:n,onHide:o},n.id))})},kn=({children:e})=>{const[t,o]=u.useReducer(wn,$n),i=u.useCallback((r,l="default",s)=>{const p=`toast-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;o({type:"ADD_TOAST",payload:{id:p,message:r,variant:l,duration:s}})},[]),n=u.useCallback(r=>{o({type:"REMOVE_TOAST",payload:r})},[]);return d.jsxs(Ie.Provider,{value:{show:i,hide:n},children:[e,d.jsx(Ln,{toasts:t.toasts,queueCount:t.queue.length,onHide:n})]})},zn=()=>{const e=u.useContext(Ie);if(!e)throw new Error("useToastr must be used within ToastProvider");return e},Re={dark:{background:a.COLORS.black,text:a.COLORS.white},light:{background:a.COLORS.white,text:a.COLORS.black,border:a.COLORS.gray},success:{background:a.COLORS.green,text:a.COLORS.white},warning:{background:a.COLORS.yellow,text:a.COLORS.white},danger:{background:a.COLORS.red,text:a.COLORS.white}},ee=e=>Re[e]??Re.dark,Tn=(e,t)=>{const o=ee(t).background;switch(e){case"top":return`
|
|
2078
920
|
bottom: -12px;
|
|
2079
921
|
left: 50%;
|
|
2080
922
|
margin-left: -6px;
|
|
@@ -2094,7 +936,7 @@
|
|
|
2094
936
|
top: 50%;
|
|
2095
937
|
margin-top: -6px;
|
|
2096
938
|
border-right-color: ${o};
|
|
2097
|
-
`;default:return""}},
|
|
939
|
+
`;default:return""}},Pn=(e,t)=>{if(t!=="light")return"";const o=ee(t).border;switch(e){case"top":return`
|
|
2098
940
|
&::after {
|
|
2099
941
|
bottom: -14px;
|
|
2100
942
|
left: 50%;
|
|
@@ -2122,11 +964,11 @@
|
|
|
2122
964
|
margin-top: -7px;
|
|
2123
965
|
border-right-color: ${o};
|
|
2124
966
|
}
|
|
2125
|
-
`;default:return""}},
|
|
967
|
+
`;default:return""}},Ne=e=>`
|
|
2126
968
|
z-index: 1000;
|
|
2127
969
|
padding: 6px 12px;
|
|
2128
|
-
background-color: ${
|
|
2129
|
-
color: ${
|
|
970
|
+
background-color: ${ee(e.$variant).background};
|
|
971
|
+
color: ${ee(e.$variant).text};
|
|
2130
972
|
font-size: 13px;
|
|
2131
973
|
line-height: 1.4;
|
|
2132
974
|
border-radius: 6px;
|
|
@@ -2140,7 +982,7 @@
|
|
|
2140
982
|
transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
|
|
2141
983
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
2142
984
|
|
|
2143
|
-
${e.$variant==="light"?`border: 1px solid ${
|
|
985
|
+
${e.$variant==="light"?`border: 1px solid ${ee(e.$variant).border};`:""}
|
|
2144
986
|
|
|
2145
987
|
&::before {
|
|
2146
988
|
content: '';
|
|
@@ -2148,7 +990,7 @@
|
|
|
2148
990
|
width: 0;
|
|
2149
991
|
height: 0;
|
|
2150
992
|
border: 6px solid transparent;
|
|
2151
|
-
${
|
|
993
|
+
${Tn(e.$placement,e.$variant)}
|
|
2152
994
|
}
|
|
2153
995
|
|
|
2154
996
|
${e.$variant==="light"?`
|
|
@@ -2161,12 +1003,12 @@
|
|
|
2161
1003
|
}
|
|
2162
1004
|
`:""}
|
|
2163
1005
|
|
|
2164
|
-
${
|
|
2165
|
-
`,
|
|
1006
|
+
${Pn(e.$placement,e.$variant)}
|
|
1007
|
+
`,An=c.styled.div`
|
|
2166
1008
|
position: relative;
|
|
2167
1009
|
display: inline-block;
|
|
2168
1010
|
width: fit-content;
|
|
2169
|
-
`,
|
|
1011
|
+
`,In=e=>{switch(e){case"top":return`
|
|
2170
1012
|
bottom: calc(100% + 8px);
|
|
2171
1013
|
left: 50%;
|
|
2172
1014
|
transform: translateX(-50%);
|
|
@@ -2182,12 +1024,12 @@
|
|
|
2182
1024
|
left: calc(100% + 8px);
|
|
2183
1025
|
top: 50%;
|
|
2184
1026
|
transform: translateY(-50%);
|
|
2185
|
-
`;default:return""}},
|
|
1027
|
+
`;default:return""}},Nn=c.styled.div`
|
|
2186
1028
|
position: absolute;
|
|
2187
|
-
${e=>
|
|
2188
|
-
${({$placement:e})=>
|
|
2189
|
-
`,
|
|
1029
|
+
${e=>Ne(e)}
|
|
1030
|
+
${({$placement:e})=>In(e)}
|
|
1031
|
+
`,jn=c.styled.div`
|
|
2190
1032
|
position: fixed;
|
|
2191
|
-
${e=>
|
|
2192
|
-
`,
|
|
1033
|
+
${e=>Ne(e)}
|
|
1034
|
+
`,pe=A.newClassNameGetter("tooltip"),K=8,Bn=({children:e,className:t,classnames:o,content:i,delay:n=200,placement:r="top",portalRenderNode:l,ref:s,variant:p="dark",...h})=>{const[g,f]=u.useState(!1),[x,b]=u.useState(null),[y,m]=u.useState(r),[$,w]=u.useState({top:0,left:0}),v=u.useRef(null),C=u.useRef(null),L=u.useCallback(()=>{var Y,X;if(!v.current)return;const S=v.current.getBoundingClientRect(),T=((Y=C.current)==null?void 0:Y.offsetWidth)??100,M=((X=C.current)==null?void 0:X.offsetHeight)??30,W=S.top-K,k=window.innerHeight-S.bottom-K,N=S.left-K,D=window.innerWidth-S.right-K;let j=r;if(r==="top"&&W<M&&k>W?j="bottom":r==="bottom"&&k<M&&W>k?j="top":r==="left"&&N<T&&D>N?j="right":r==="right"&&D<T&&N>D&&(j="left"),m(j),l){let z,P;switch(j){case"top":z=S.top-M-K,P=S.left+S.width/2-T/2;break;case"bottom":z=S.bottom+K,P=S.left+S.width/2-T/2;break;case"left":z=S.top+S.height/2-M/2,P=S.left-T-K;break;case"right":z=S.top+S.height/2-M/2,P=S.right+K;break;default:z=0,P=0}const q=8;P=Math.max(q,Math.min(P,window.innerWidth-T-q)),z=Math.max(q,Math.min(z,window.innerHeight-M-q)),w({top:z,left:P})}},[r,l]);u.useLayoutEffect(()=>{g&&L()},[g,L]);const F=()=>{const S=setTimeout(()=>{f(!0)},n);b(S)},I=()=>{x&&(clearTimeout(x),b(null)),f(!1)},U=l?he.createPortal(d.jsx(jn,{ref:C,className:pe("content",o==null?void 0:o.content),$placement:y,$variant:p,$visible:g,style:{top:$.top,left:$.left},children:i}),l):d.jsx(Nn,{ref:C,className:pe("content",o==null?void 0:o.content),$placement:y,$variant:p,$visible:g,children:i});return d.jsxs(An,{...h,ref:S=>{v.current=S,typeof s=="function"?s(S):s&&(s.current=S)},className:pe("wrapper",t),onMouseEnter:F,onMouseLeave:I,children:[e,U]})};exports.BREAKPOINTS=a.BREAKPOINTS;exports.COLORS=a.COLORS;exports.KEYFRAMES=a.KEYFRAMES;exports.KEY_SYMBOLS=a.KEY_SYMBOLS;exports.alpha=a.alpha;exports.getBrowser=a.getBrowser;exports.getKeySymbols=a.getKeySymbols;exports.getOperatingSystem=a.getOperatingSystem;exports.isValid=a.isValid;exports.toHEX=a.toHEX;exports.useKeyBinding=a.useKeyBinding;exports.mediaBetween=_.mediaBetween;exports.mediaDown=_.mediaDown;exports.mediaUp=_.mediaUp;exports.validation=_.index;exports.Autocomplete=c.Autocomplete;exports.Button=c.Button;exports.Checkbox=c.Checkbox;exports.CheckboxCard=c.CheckboxCard;exports.CheckboxGroup=c.CheckboxGroup;exports.Chip=c.Chip;exports.DatePicker=c.DatePicker;exports.FieldLabel=c.FieldLabel;exports.FieldMessage=c.FieldMessage;exports.Input=c.Input;exports.KeySymbol=c.KeySymbol;exports.KeysBindings=c.KeysBindings;exports.Modal=c.Modal;exports.MultiSelect=c.MultiSelect;exports.OtpCode=c.OtpCode;exports.Radio=c.Radio;exports.RadioCard=c.RadioCard;exports.RadioGroup=c.RadioGroup;exports.Select=c.Select;exports.Spinner=c.Spinner;exports.Tags=c.Tags;exports.Textarea=c.Textarea;exports.Toggle=c.Toggle;exports.ToggleCard=c.ToggleCard;exports.ToggleGroup=c.ToggleGroup;exports.formatDateGo=c.formatDateGo;exports.newClassNameGetter=A.newClassNameGetter;exports.Card=De;exports.ConfirmationProvider=Ze;exports.Container=tt;exports.Divider=it;exports.Drawer=ct;exports.Dropdown=ft;exports.FieldRow=bt;exports.GlobalStyle=Fe;exports.ImageCropper=Ro;exports.NotificationProvider=jo;exports.NotifyConfirmationProvider=Ho;exports.Panel=tn;exports.Progress=rn;exports.SaveProgressProvider=ln;exports.Stepper=xn;exports.Tabs=yn;exports.ToastProvider=kn;exports.Tooltip=Bn;exports.useConfirmation=Qe;exports.useImageCropper=ze;exports.useNotification=Bo;exports.useNotifyConfirmation=Vo;exports.useSaveProgress=cn;exports.useToastr=zn;
|
|
2193
1035
|
//# sourceMappingURL=index.cjs.map
|