@dotss/ui 1.0.5 → 1.0.7
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/Autocomplete/Autocomplete.cjs +1 -1
- package/Autocomplete/Autocomplete.d.ts +1 -1
- package/Autocomplete/Autocomplete.es.js +35 -33
- package/Menu/Menu.cjs +7 -8
- package/Menu/Menu.d.ts +1 -0
- package/Menu/Menu.es.js +108 -104
- package/Menu/Menu.stories.d.ts +7 -2
- package/Menu/MenuBlock/MenuBlock.cjs +8 -10
- package/Menu/MenuBlock/MenuBlock.d.ts +1 -1
- package/Menu/MenuBlock/MenuBlock.es.js +47 -50
- package/TextField/TextField.cjs +15 -15
- package/TextField/TextField.es.js +70 -70
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("@emotion/react/jsx-runtime"),n=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("@emotion/react/jsx-runtime"),n=require("react"),Y=require("../CircularProgressIndicator/CircularProgressIndicator.cjs"),B=require("../Flexbox/Flexbox.cjs"),Z=require("../Icon/Icon.cjs"),L=require("../Menu/Menu.cjs"),w=require("../Menu/MenuBlock/MenuBlock.cjs");require("../Menu/MenuButton/MenuButton.cjs");const V=require("../TextField/TextField.cjs"),ee=require("../Typography/Typography.cjs"),te=require("../core/useTheme.cjs"),z=require("../utils/getSibling/getSibling.cjs"),x=100,re=n.forwardRef(function({inputValue:o,onInputChange:f,menuValue:T,menuProps:H,onMenuChange:y,inputProps:U,minInputLengthForMenu:P=0,options:C=[],isLoading:q=!1,renderOptions:O,renderEmpty:R,filterOptions:E,getOptionLabel:h},G){const D=n.useRef(null),v=n.useRef(null),A=n.useId(),{palette:F}=te.default();n.useImperativeHandle(G,()=>D.current);const[k,S]=n.useState(!1),[p,m]=n.useState(void 0),r=n.useRef(!1),g=E?E(C):C.filter(e=>e.label.includes(o)),$=g.length>0,j=o.length>=P,N=()=>{if(k&&!T){S(!1),setTimeout(()=>{f("")},x);return}if(k&&T){const e=g.find(l=>l.value===T);if(e){const l=h?h(e):e.label;S(!1),setTimeout(()=>{f(l)});return}}S(e=>!e)},M=e=>{e.target.value.length>0?S(!0):y("",e,null),f(e.target.value,e)},W=()=>{j&&S(!0)},J=(e,l)=>{var u;if(e===void 0||!l||!((u=l==null?void 0:l.target)!=null&&u.textContent))return;const i=g.find(d=>d.value===e);if(h){i&&setTimeout(()=>{f(h(i),l),y(e.toString(),l,i)},x);return}setTimeout(()=>{f(l.target.textContent||"",l),y(e.toString(),l,i||null)},x)},Q=e=>{var l,i,u,d,I,b,_;if(!r.current){if(e.key==="ArrowDown"){e.preventDefault(),e.stopPropagation(),r.current=!0;const t=(l=v.current)==null?void 0:l.querySelector('li[role="option"]');if(!p)t&&(m(t.id),t.scrollIntoView({block:"end"}));else{const s=(i=v.current)==null?void 0:i.querySelector(`#${CSS.escape(p)}`);if(!s){r.current=!1;return}const c=z.default(s,"next",{skipDisabled:!0});c&&c.id&&(m(c.id),c.scrollIntoView({block:"end"})),c||(m(t.id),t.scrollIntoView({block:"end"}))}setTimeout(()=>{r.current=!1},0)}if(e.key==="ArrowUp"){if(e.preventDefault(),e.stopPropagation(),r.current=!0,!p){r.current=!1;return}const t=(u=v.current)==null?void 0:u.querySelector(`#${CSS.escape(p)}`);if(!t){r.current=!1;return}const s=z.default(t,"prev",{skipDisabled:!0});if(s&&s.id&&(m(s.id),s.scrollIntoView({block:"end"})),!s){const c=(d=v.current)==null?void 0:d.querySelector('li[role="option"]:last-child');c&&(m(c.id),c.scrollIntoView({block:"end"}))}setTimeout(()=>{r.current=!1},0)}if(e.key==="Enter"){if(e.preventDefault(),e.stopPropagation(),r.current=!0,!p){r.current=!1;return}const t=(I=v.current)==null?void 0:I.querySelector(`#${CSS.escape(p)}`);if(!t){r.current=!1;return}const s=g.find(c=>c.value===t.dataset.value);S(!1),setTimeout(h&&s?()=>{f(h(s),e),y(t.dataset.value||"",e,s)}:()=>{f(t.textContent||"",e),y(t.dataset.value||"",e,s||null)},x),setTimeout(()=>{r.current=!1},0)}if(e.key==="Home"){e.preventDefault(),e.stopPropagation(),r.current=!0;const t=(b=v.current)==null?void 0:b.querySelector('li[role="option"]');t&&(m(t.id),t.scrollIntoView({block:"start"})),setTimeout(()=>{r.current=!1},0)}if(e.key==="End"){e.preventDefault(),e.stopPropagation(),r.current=!0;const t=(_=v.current)==null?void 0:_.querySelector('li[role="option"]:last-child');t&&(m(t.id),t.scrollIntoView({block:"end"})),setTimeout(()=>{r.current=!1},0)}e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),r.current=!0,N(),setTimeout(()=>{r.current=!1},0))}},K=e=>{S(!1),setTimeout(()=>{f("",e),y("",e,null)},x)},X=e=>{(e.key==="Enter"||e.key===" ")&&K(e)};return n.useEffect(()=>{k||m(void 0)},[k]),a.jsxs(B.default,{ref:D,inlineCSS:{position:"relative"},children:[a.jsx(V.default,{value:o,onChange:M,onFocus:W,onKeyDown:Q,fullWidth:!0,autoComplete:"off",role:"combobox","aria-expanded":k,"aria-autocomplete":"list","aria-controls":A,"aria-activedescendant":p,"aria-busy":q,"aria-haspopup":"listbox",endAdornment:o?a.jsx(Z.default,{name:"InvalidFill",color:"grey.50",size:"medium",role:"button",onClick:K,onKeyDown:X,tabIndex:0,"aria-hidden":!1,focusable:!0,"aria-label":"지우기",inlineCSS:{cursor:"pointer"}}):null,inlineCSS:{"& svg":{flexShrink:0}},...U}),a.jsxs(L.default,{id:A,value:T,ref:v,open:k&&o.length>=P,onClose:N,onChange:J,transitionDuration:x,disablePadding:!j,...H,anchorRef:D,children:[q&&a.jsx(w.default,{value:"LOADING",disabled:!0,children:a.jsx(B.default,{justifyContent:"center",children:a.jsx(Y.default,{size:"small",loop:!0})})}),!q&&$&&g.map((e,l)=>{const i=e.label.indexOf(o),u=`menu-option-${e.value}-${e.label}`,d=p===u,I=e.value===T;if(O&&typeof O=="function"){const b=O(e,l,g);return n.isValidElement(b)?n.cloneElement(b,{id:u,key:e.value,role:"option","aria-selected":d,"data-value":e.value,inlineCSS:{border:d?`2px solid ${F.grey[100]}`:"2px solid transparent"},...b.props}):b}if(!(o&&!e.label.includes(o))&&j)return a.jsx(w.default,{id:u,value:e.value,role:"option","aria-selected":d,"data-value":e.value,inlineCSS:{border:d?`2px solid ${F.grey[100]}`:"2px solid transparent"},...e==null?void 0:e.menuBlockProps,children:o&&!I?a.jsxs(a.Fragment,{children:[e.label.slice(0,i),a.jsx(ee.default,{tag:"span",variant:"h5B",color:"primary",children:e.label.slice(i,i+o.length)}),e.label.slice(i+o.length)]}):e.label},e.value)}),!q&&!$&&(R?(()=>{const e=R(o);return n.isValidElement(e)?n.cloneElement(e,{...e.props,disabled:!0}):e})():a.jsx(w.default,{value:"NO_OPTION",disabled:!0,children:"검색 결과가 없어요."}))]})]})});exports.default=re;
|
|
@@ -16,7 +16,7 @@ export interface AutocompleteProps {
|
|
|
16
16
|
options: Array<Option>;
|
|
17
17
|
minInputLengthForMenu?: number;
|
|
18
18
|
inputProps?: TextFieldProps;
|
|
19
|
-
menuProps?: MenuProps
|
|
19
|
+
menuProps?: Omit<MenuProps, 'anchorRef'>;
|
|
20
20
|
isLoading?: boolean;
|
|
21
21
|
renderOptions?: (option: Option, index: number, options: AutocompleteProps['options']) => ReactNode;
|
|
22
22
|
renderEmpty?: (searchText: string) => ReactNode;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { jsxs as C, jsx as p, Fragment as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
1
|
+
import { jsxs as C, jsx as p, Fragment as ee } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { forwardRef as te, useRef as P, useId as re, useImperativeHandle as le, useState as H, useEffect as oe, isValidElement as U, cloneElement as _ } from "react";
|
|
3
|
+
import ne from "../CircularProgressIndicator/CircularProgressIndicator.es.js";
|
|
4
4
|
import G from "../Flexbox/Flexbox.es.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import ie from "../Icon/Icon.es.js";
|
|
6
|
+
import se from "../Menu/Menu.es.js";
|
|
7
7
|
import A from "../Menu/MenuBlock/MenuBlock.es.js";
|
|
8
8
|
import "../Menu/MenuButton/MenuButton.es.js";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
9
|
+
import ce from "../TextField/TextField.es.js";
|
|
10
|
+
import ae from "../Typography/Typography.es.js";
|
|
11
|
+
import ue from "../core/useTheme.es.js";
|
|
12
12
|
import W from "../utils/getSibling/getSibling.es.js";
|
|
13
|
-
const S = 100,
|
|
13
|
+
const S = 100, Ie = te(function({
|
|
14
14
|
inputValue: n,
|
|
15
15
|
onInputChange: u,
|
|
16
16
|
menuValue: T,
|
|
17
|
+
menuProps: J,
|
|
17
18
|
onMenuChange: y,
|
|
18
|
-
inputProps:
|
|
19
|
+
inputProps: Q,
|
|
19
20
|
minInputLengthForMenu: q = 0,
|
|
20
21
|
options: E = [],
|
|
21
22
|
isLoading: g = !1,
|
|
@@ -23,9 +24,9 @@ const S = 100, ge = ee(function({
|
|
|
23
24
|
renderEmpty: F,
|
|
24
25
|
filterOptions: $,
|
|
25
26
|
getOptionLabel: h
|
|
26
|
-
},
|
|
27
|
-
const O = P(null), f = P(null), N =
|
|
28
|
-
|
|
27
|
+
}, X) {
|
|
28
|
+
const O = P(null), f = P(null), N = re(), { palette: R } = ue();
|
|
29
|
+
le(X, () => O.current);
|
|
29
30
|
const [k, v] = H(!1), [d, m] = H(void 0), r = P(!1), x = $ ? $(E) : E.filter((e) => e.label.includes(n)), K = x.length > 0, w = n.length >= q, j = () => {
|
|
30
31
|
if (k && !T) {
|
|
31
32
|
v(!1), setTimeout(() => {
|
|
@@ -44,11 +45,11 @@ const S = 100, ge = ee(function({
|
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
v((e) => !e);
|
|
47
|
-
},
|
|
48
|
+
}, Y = (e) => {
|
|
48
49
|
e.target.value.length > 0 ? v(!0) : y("", e, null), u(e.target.value, e);
|
|
49
|
-
},
|
|
50
|
+
}, Z = () => {
|
|
50
51
|
w && v(!0);
|
|
51
|
-
},
|
|
52
|
+
}, M = (e, l) => {
|
|
52
53
|
var c;
|
|
53
54
|
if (e === void 0 || !l || !((c = l == null ? void 0 : l.target) != null && c.textContent)) return;
|
|
54
55
|
const i = x.find((a) => a.value === e);
|
|
@@ -61,7 +62,7 @@ const S = 100, ge = ee(function({
|
|
|
61
62
|
setTimeout(() => {
|
|
62
63
|
u(l.target.textContent || "", l), y(e.toString(), l, i || null);
|
|
63
64
|
}, S);
|
|
64
|
-
},
|
|
65
|
+
}, L = (e) => {
|
|
65
66
|
var l, i, c, a, I, b, z;
|
|
66
67
|
if (!r.current) {
|
|
67
68
|
if (e.key === "ArrowDown") {
|
|
@@ -154,19 +155,19 @@ const S = 100, ge = ee(function({
|
|
|
154
155
|
v(!1), setTimeout(() => {
|
|
155
156
|
u("", e), y("", e, null);
|
|
156
157
|
}, S);
|
|
157
|
-
},
|
|
158
|
+
}, V = (e) => {
|
|
158
159
|
(e.key === "Enter" || e.key === " ") && B(e);
|
|
159
160
|
};
|
|
160
|
-
return
|
|
161
|
+
return oe(() => {
|
|
161
162
|
k || m(void 0);
|
|
162
163
|
}, [k]), /* @__PURE__ */ C(G, { ref: O, inlineCSS: { position: "relative" }, children: [
|
|
163
164
|
/* @__PURE__ */ p(
|
|
164
|
-
|
|
165
|
+
ce,
|
|
165
166
|
{
|
|
166
167
|
value: n,
|
|
167
|
-
onChange:
|
|
168
|
-
onFocus:
|
|
169
|
-
onKeyDown:
|
|
168
|
+
onChange: Y,
|
|
169
|
+
onFocus: Z,
|
|
170
|
+
onKeyDown: L,
|
|
170
171
|
fullWidth: !0,
|
|
171
172
|
autoComplete: "off",
|
|
172
173
|
role: "combobox",
|
|
@@ -177,14 +178,14 @@ const S = 100, ge = ee(function({
|
|
|
177
178
|
"aria-busy": g,
|
|
178
179
|
"aria-haspopup": "listbox",
|
|
179
180
|
endAdornment: n ? /* @__PURE__ */ p(
|
|
180
|
-
|
|
181
|
+
ie,
|
|
181
182
|
{
|
|
182
183
|
name: "InvalidFill",
|
|
183
184
|
color: "grey.50",
|
|
184
185
|
size: "medium",
|
|
185
186
|
role: "button",
|
|
186
187
|
onClick: B,
|
|
187
|
-
onKeyDown:
|
|
188
|
+
onKeyDown: V,
|
|
188
189
|
tabIndex: 0,
|
|
189
190
|
"aria-hidden": !1,
|
|
190
191
|
focusable: !0,
|
|
@@ -193,23 +194,24 @@ const S = 100, ge = ee(function({
|
|
|
193
194
|
}
|
|
194
195
|
) : null,
|
|
195
196
|
inlineCSS: { "& svg": { flexShrink: 0 } },
|
|
196
|
-
...
|
|
197
|
+
...Q
|
|
197
198
|
}
|
|
198
199
|
),
|
|
199
200
|
/* @__PURE__ */ C(
|
|
200
|
-
|
|
201
|
+
se,
|
|
201
202
|
{
|
|
202
203
|
id: N,
|
|
203
204
|
value: T,
|
|
204
205
|
ref: f,
|
|
205
|
-
anchorRef: O,
|
|
206
206
|
open: k && n.length >= q,
|
|
207
207
|
onClose: j,
|
|
208
|
-
onChange:
|
|
208
|
+
onChange: M,
|
|
209
209
|
transitionDuration: S,
|
|
210
210
|
disablePadding: !w,
|
|
211
|
+
...J,
|
|
212
|
+
anchorRef: O,
|
|
211
213
|
children: [
|
|
212
|
-
g && /* @__PURE__ */ p(A, { value: "LOADING", disabled: !0, children: /* @__PURE__ */ p(G, { justifyContent: "center", children: /* @__PURE__ */ p(
|
|
214
|
+
g && /* @__PURE__ */ p(A, { value: "LOADING", disabled: !0, children: /* @__PURE__ */ p(G, { justifyContent: "center", children: /* @__PURE__ */ p(ne, { size: "small", loop: !0 }) }) }),
|
|
213
215
|
!g && K && x.map((e, l) => {
|
|
214
216
|
const i = e.label.indexOf(n), c = `menu-option-${e.value}-${e.label}`, a = d === c, I = e.value === T;
|
|
215
217
|
if (D && typeof D == "function") {
|
|
@@ -239,9 +241,9 @@ const S = 100, ge = ee(function({
|
|
|
239
241
|
border: a ? `2px solid ${R.grey[100]}` : "2px solid transparent"
|
|
240
242
|
},
|
|
241
243
|
...e == null ? void 0 : e.menuBlockProps,
|
|
242
|
-
children: n && !I ? /* @__PURE__ */ C(
|
|
244
|
+
children: n && !I ? /* @__PURE__ */ C(ee, { children: [
|
|
243
245
|
e.label.slice(0, i),
|
|
244
|
-
/* @__PURE__ */ p(
|
|
246
|
+
/* @__PURE__ */ p(ae, { tag: "span", variant: "h5B", color: "primary", children: e.label.slice(i, i + n.length) }),
|
|
245
247
|
e.label.slice(i + n.length)
|
|
246
248
|
] }) : e.label
|
|
247
249
|
},
|
|
@@ -261,5 +263,5 @@ const S = 100, ge = ee(function({
|
|
|
261
263
|
] });
|
|
262
264
|
});
|
|
263
265
|
export {
|
|
264
|
-
|
|
266
|
+
Ie as default
|
|
265
267
|
};
|
package/Menu/Menu.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@emotion/react/jsx-runtime"),o=require("react"),ct=require("../hooks/useCheckKeyboardMode/useCheckKeyboardMode.cjs"),G=require("../utils/getSibling/getSibling.cjs"),dt=require("react-dom"),ft=require("@emotion/styled"),lt=e=>e&&e.__esModule?e:{default:e},M=lt(ft),at=M.default.div`
|
|
2
2
|
position: fixed;
|
|
3
3
|
top: 0;
|
|
4
4
|
left: 0;
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
${({disableClickOutside:e})=>e?null:{pointerEvents:"none","& *":{pointerEvents:"auto"}}}}
|
|
10
10
|
|
|
11
|
-
`,
|
|
11
|
+
`,pt=M.default.div`
|
|
12
12
|
position: fixed;
|
|
13
13
|
max-width: calc(100% - ${({theme:{spacing:e}})=>e.layout(4)}px);
|
|
14
|
+
overflow-y: auto;
|
|
14
15
|
border-radius: 10px;
|
|
15
|
-
overflow: hidden;
|
|
16
16
|
background-color: ${({theme:{palette:{grey:e}}})=>e.white};
|
|
17
17
|
box-shadow: ${({theme:{elevation:e}})=>e[4]};
|
|
18
18
|
transition:
|
|
@@ -21,15 +21,14 @@
|
|
|
21
21
|
transform: scale(${({open:e})=>e?1:.97});
|
|
22
22
|
opacity: ${({open:e})=>e?1:0};
|
|
23
23
|
z-index: 100003;
|
|
24
|
-
`,
|
|
24
|
+
`,yt=M.default.ul`
|
|
25
25
|
display: flex;
|
|
26
26
|
flex-direction: column;
|
|
27
27
|
max-height: ${({maxHeight:e})=>e}px;
|
|
28
|
-
overflow-y: auto;
|
|
29
28
|
|
|
30
|
-
${({theme:{spacing:e},disablePadding:
|
|
31
|
-
`,
|
|
29
|
+
${({theme:{spacing:e},disablePadding:p})=>p?null:{padding:`${e.content(1)}px 0`}}}
|
|
30
|
+
`,bt=M.default.div`
|
|
32
31
|
width: 100%;
|
|
33
32
|
height: 1px;
|
|
34
33
|
background-color: ${({theme:{palette:{grey:e}}})=>e[20]};
|
|
35
|
-
`,
|
|
34
|
+
`,f=16,vt=o.forwardRef(function({children:p,anchorRef:i,open:h,onClose:l,spacing:v=4,transitionDuration:T=200,onChange:S,value:H,showDivider:P,placement:W="bottom-center",disablePadding:U=!1,disableClickOutside:V=!0,disableAutoPositioning:w=!1,width:q,fitToAnchorWidth:I=!0,maxHeight:O=476,style:J,inlineCSS:Q,menuProps:X,...Y},Z){const[g,z]=o.useState(0),[_,j]=o.useState("auto"),[R,K]=o.useState("auto"),[k,A]=o.useState(0),[D,L]=o.useState(!1),[tt,et]=o.useState(!1),[ot,C]=o.useState(!0),[st,y]=o.useState(null),x=o.useRef(),m=o.useRef(),E=o.useRef(null),{isKeyboardMode:ut}=ct.default(),rt=(t,s)=>n=>{n.stopPropagation(),typeof l=="function"&&l(),typeof S=="function"&&S(t,n),typeof s=="function"&&s(n)},it=t=>s=>{var r,c,d,a;if(s.key==="Tab"&&typeof l=="function"&&(l(),y(0)),(s.key==="Enter"||s.key===" ")&&typeof l=="function"&&typeof S=="function"&&(l(),S(t,s),i!=null&&i.current)){const u=i.current.querySelector("button");u&&ut&&u.focus()}const n=document.activeElement;if(n){if(s.code==="ArrowDown"){const u=G.default(n,"next",{skipDisabled:!0});u&&u.dataset.index?(y(Number(u.dataset.index)),u.focus()):(y(0),(c=(r=E.current)==null?void 0:r.querySelector('[role="menuitem"]'))==null||c.focus())}if(s.code==="ArrowUp"){const u=G.default(n,"prev",{skipDisabled:!0});u&&u.dataset.index?(y(Number(u.dataset.index)),u.focus()):(y(o.Children.count(p)-1),(a=(d=E.current)==null?void 0:d.querySelector('[role="menuitem"]:last-child'))==null||a.focus())}}};return o.useEffect(()=>{h&&(m.current&&clearTimeout(m.current),document.body.style.overflow="hidden",C(!1),x.current=setTimeout(()=>{L(!0)},100))},[h]),o.useEffect(()=>{h||(x.current&&clearTimeout(x.current),L(!1),document.body.removeAttribute("style"),m.current=setTimeout(()=>{C(!0),y(0)},T))},[h,T]),o.useEffect(()=>{const t=()=>{var B;const{offsetWidth:s=0,offsetHeight:n=0}=(i==null?void 0:i.current)||{},r=((B=i==null?void 0:i.current)==null?void 0:B.getBoundingClientRect())||{top:0,left:0,bottom:0},{offsetWidth:c=0,offsetHeight:d=0}=E.current||{},[a,u]=W.split("-");A(q||s);const $=r.top-d-v<f&&!w,nt=r.bottom+d+v+f>window.innerHeight&&!w,F=r.left+c+f>window.innerWidth&&!w,N=r.left+s-c<f&&!w;switch(a){case"top":z($?f:r.top-d-v);break;default:z(nt?"auto":r.top+n+v);break}switch(u){case"left":j(F?"auto":r.left),K(F?f:"auto");break;case"right":j(N?f:r.left+s-c),K(N?"auto":r.left);break;default:j(r.left+s/2-c/2);break}};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[i,v,W,D,p,q,w,O]),o.useEffect(()=>{et(D&&!!g&&!!_&&!!k)},[D,g,_,k]),o.useEffect(()=>()=>{x.current&&clearTimeout(x.current),m.current&&clearTimeout(m.current)},[]),ot?null:dt.createPortal(b.jsx(at,{onClick:l,disableClickOutside:V,children:b.jsx(pt,{ref:Z,open:tt,transitionDuration:T,...Y,css:Q,style:{...J,top:g,left:_,bottom:g==="auto"?f:void 0,right:R,width:I?k:void 0,maxHeight:O},children:b.jsx(yt,{role:"menu",ref:E,disablePadding:U,maxHeight:O,...X,children:o.Children.map(p,(t,s)=>{var r,c,d,a,u,$;if(!o.isValidElement(t))return null;const n=st===s;return b.jsxs(b.Fragment,{children:[o.cloneElement(t,{...t.props,"data-index":s,selected:!!((r=t==null?void 0:t.props)!=null&&r.value)&&((c=t==null?void 0:t.props)==null?void 0:c.value)===H,onClick:rt((d=t==null?void 0:t.props)==null?void 0:d.value,(a=t==null?void 0:t.props)==null?void 0:a.onClick),onKeyDown:it((u=t==null?void 0:t.props)==null?void 0:u.value),tabIndex:n?0:-1,style:{...($=t==null?void 0:t.props)==null?void 0:$.style,[q?"width":"minWidth"]:I?void 0:k,maxWidth:I?void 0:"100%"}}),P&&o.Children.count(p)!==s+1&&b.jsx(bt,{})]})})})})}),document.body)});exports.default=vt;
|
package/Menu/Menu.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export interface MenuProps extends GeneralComponentProps<Omit<HTMLAttributes<HTM
|
|
|
14
14
|
placement?: 'bottom-left' | 'bottom-right' | 'bottom-center' | 'top-left' | 'top-right' | 'top-center';
|
|
15
15
|
disablePadding?: boolean;
|
|
16
16
|
disableClickOutside?: boolean;
|
|
17
|
+
disableAutoPositioning?: boolean;
|
|
17
18
|
children?: ReactElement<typeof MenuBlock> | ReactElement<typeof MenuBlock>[] | ReactNode;
|
|
18
19
|
width?: number;
|
|
19
20
|
fitToAnchorWidth?: boolean;
|
package/Menu/Menu.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const
|
|
1
|
+
import { jsx as T, jsxs as pt, Fragment as lt } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { forwardRef as at, useState as f, useRef as q, useEffect as x, Children as F, isValidElement as yt, cloneElement as mt } from "react";
|
|
3
|
+
import bt from "../hooks/useCheckKeyboardMode/useCheckKeyboardMode.es.js";
|
|
4
|
+
import _ from "../utils/getSibling/getSibling.es.js";
|
|
5
|
+
import { createPortal as vt } from "react-dom";
|
|
6
|
+
import I from "@emotion/styled";
|
|
7
|
+
const wt = I.div`
|
|
8
8
|
position: fixed;
|
|
9
9
|
top: 0;
|
|
10
10
|
left: 0;
|
|
@@ -19,11 +19,11 @@ const at = T.div`
|
|
|
19
19
|
}
|
|
20
20
|
}}}
|
|
21
21
|
|
|
22
|
-
`,
|
|
22
|
+
`, xt = I.div`
|
|
23
23
|
position: fixed;
|
|
24
24
|
max-width: calc(100% - ${({ theme: { spacing: o } }) => o.layout(4)}px);
|
|
25
|
+
overflow-y: auto;
|
|
25
26
|
border-radius: 10px;
|
|
26
|
-
overflow: hidden;
|
|
27
27
|
background-color: ${({
|
|
28
28
|
theme: {
|
|
29
29
|
palette: { grey: o }
|
|
@@ -36,16 +36,15 @@ const at = T.div`
|
|
|
36
36
|
transform: scale(${({ open: o }) => o ? 1 : 0.97});
|
|
37
37
|
opacity: ${({ open: o }) => o ? 1 : 0};
|
|
38
38
|
z-index: 100003;
|
|
39
|
-
`,
|
|
39
|
+
`, ht = I.ul`
|
|
40
40
|
display: flex;
|
|
41
41
|
flex-direction: column;
|
|
42
42
|
max-height: ${({ maxHeight: o }) => o}px;
|
|
43
|
-
overflow-y: auto;
|
|
44
43
|
|
|
45
|
-
${({ theme: { spacing: o }, disablePadding:
|
|
44
|
+
${({ theme: { spacing: o }, disablePadding: a }) => a ? null : {
|
|
46
45
|
padding: `${o.content(1)}px 0`
|
|
47
46
|
}}}
|
|
48
|
-
`,
|
|
47
|
+
`, kt = I.div`
|
|
49
48
|
width: 100%;
|
|
50
49
|
height: 1px;
|
|
51
50
|
background-color: ${({
|
|
@@ -53,140 +52,145 @@ const at = T.div`
|
|
|
53
52
|
palette: { grey: o }
|
|
54
53
|
}
|
|
55
54
|
}) => o[20]};
|
|
56
|
-
`,
|
|
57
|
-
children:
|
|
55
|
+
`, d = 16, Mt = at(function({
|
|
56
|
+
children: a,
|
|
58
57
|
anchorRef: s,
|
|
59
|
-
open:
|
|
60
|
-
onClose:
|
|
61
|
-
spacing:
|
|
62
|
-
transitionDuration:
|
|
63
|
-
onChange:
|
|
64
|
-
value:
|
|
65
|
-
showDivider:
|
|
66
|
-
placement:
|
|
67
|
-
disablePadding:
|
|
68
|
-
disableClickOutside:
|
|
69
|
-
|
|
58
|
+
open: h,
|
|
59
|
+
onClose: p,
|
|
60
|
+
spacing: m = 4,
|
|
61
|
+
transitionDuration: M = 200,
|
|
62
|
+
onChange: k,
|
|
63
|
+
value: J,
|
|
64
|
+
showDivider: P,
|
|
65
|
+
placement: N = "bottom-center",
|
|
66
|
+
disablePadding: Q = !1,
|
|
67
|
+
disableClickOutside: X = !0,
|
|
68
|
+
disableAutoPositioning: b = !1,
|
|
69
|
+
width: O,
|
|
70
70
|
fitToAnchorWidth: W = !0,
|
|
71
|
-
maxHeight:
|
|
72
|
-
style:
|
|
73
|
-
inlineCSS:
|
|
74
|
-
menuProps:
|
|
75
|
-
...
|
|
76
|
-
},
|
|
77
|
-
const [g,
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
var
|
|
81
|
-
if (e.key === "Tab" && typeof
|
|
82
|
-
const
|
|
83
|
-
|
|
71
|
+
maxHeight: D = 476,
|
|
72
|
+
style: Y,
|
|
73
|
+
inlineCSS: Z,
|
|
74
|
+
menuProps: A,
|
|
75
|
+
...R
|
|
76
|
+
}, tt) {
|
|
77
|
+
const [g, j] = f(0), [z, K] = f("auto"), [ot, B] = f("auto"), [E, et] = f(0), [L, G] = f(!1), [rt, it] = f(!1), [st, H] = f(!0), [ut, y] = f(null), v = q(), w = q(), $ = q(null), { isKeyboardMode: nt } = bt(), ct = (t, e) => (u) => {
|
|
78
|
+
u.stopPropagation(), typeof p == "function" && p(), typeof k == "function" && k(t, u), typeof e == "function" && e(u);
|
|
79
|
+
}, ft = (t) => (e) => {
|
|
80
|
+
var i, n, c, l;
|
|
81
|
+
if (e.key === "Tab" && typeof p == "function" && (p(), y(0)), (e.key === "Enter" || e.key === " ") && typeof p == "function" && typeof k == "function" && (p(), k(t, e), s != null && s.current)) {
|
|
82
|
+
const r = s.current.querySelector("button");
|
|
83
|
+
r && nt && r.focus();
|
|
84
84
|
}
|
|
85
|
-
const
|
|
86
|
-
if (
|
|
85
|
+
const u = document.activeElement;
|
|
86
|
+
if (u) {
|
|
87
87
|
if (e.code === "ArrowDown") {
|
|
88
|
-
const
|
|
89
|
-
|
|
88
|
+
const r = _(u, "next", { skipDisabled: !0 });
|
|
89
|
+
r && r.dataset.index ? (y(Number(r.dataset.index)), r.focus()) : (y(0), (n = (i = $.current) == null ? void 0 : i.querySelector('[role="menuitem"]')) == null || n.focus());
|
|
90
90
|
}
|
|
91
91
|
if (e.code === "ArrowUp") {
|
|
92
|
-
const
|
|
93
|
-
|
|
92
|
+
const r = _(u, "prev", { skipDisabled: !0 });
|
|
93
|
+
r && r.dataset.index ? (y(Number(r.dataset.index)), r.focus()) : (y(F.count(a) - 1), (l = (c = $.current) == null ? void 0 : c.querySelector('[role="menuitem"]:last-child')) == null || l.focus());
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
|
-
return
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
return x(() => {
|
|
98
|
+
h && (w.current && clearTimeout(w.current), document.body.style.overflow = "hidden", H(!1), v.current = setTimeout(() => {
|
|
99
|
+
G(!0);
|
|
100
100
|
}, 100));
|
|
101
|
-
}, [
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
},
|
|
105
|
-
}, [
|
|
101
|
+
}, [h]), x(() => {
|
|
102
|
+
h || (v.current && clearTimeout(v.current), G(!1), document.body.removeAttribute("style"), w.current = setTimeout(() => {
|
|
103
|
+
H(!0), y(0);
|
|
104
|
+
}, M));
|
|
105
|
+
}, [h, M]), x(() => {
|
|
106
106
|
const t = () => {
|
|
107
|
-
var
|
|
108
|
-
const { offsetWidth: e = 0, offsetHeight:
|
|
107
|
+
var V;
|
|
108
|
+
const { offsetWidth: e = 0, offsetHeight: u = 0 } = (s == null ? void 0 : s.current) || {}, i = ((V = s == null ? void 0 : s.current) == null ? void 0 : V.getBoundingClientRect()) || {
|
|
109
109
|
top: 0,
|
|
110
110
|
left: 0,
|
|
111
111
|
bottom: 0
|
|
112
|
-
}, { offsetWidth:
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
switch (
|
|
112
|
+
}, { offsetWidth: n = 0, offsetHeight: c = 0 } = $.current || {}, [l, r] = N.split("-");
|
|
113
|
+
et(O || e);
|
|
114
|
+
const S = i.top - c - m < d && !b, dt = i.bottom + c + m + d > window.innerHeight && !b, C = i.left + n + d > window.innerWidth && !b, U = i.left + e - n < d && !b;
|
|
115
|
+
switch (l) {
|
|
116
116
|
case "top":
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
j(
|
|
118
|
+
S ? d : i.top - c - m
|
|
119
119
|
);
|
|
120
120
|
break;
|
|
121
121
|
default:
|
|
122
|
-
|
|
122
|
+
j(dt ? "auto" : i.top + u + m);
|
|
123
123
|
break;
|
|
124
124
|
}
|
|
125
|
-
switch (
|
|
125
|
+
switch (r) {
|
|
126
126
|
case "left":
|
|
127
|
-
|
|
127
|
+
K(C ? "auto" : i.left), B(C ? d : "auto");
|
|
128
128
|
break;
|
|
129
129
|
case "right":
|
|
130
|
-
|
|
130
|
+
K(
|
|
131
|
+
U ? d : i.left + e - n
|
|
132
|
+
), B(U ? "auto" : i.left);
|
|
131
133
|
break;
|
|
132
134
|
default:
|
|
133
|
-
|
|
135
|
+
K(i.left + e / 2 - n / 2);
|
|
134
136
|
break;
|
|
135
137
|
}
|
|
136
138
|
};
|
|
137
|
-
return t(), window.addEventListener("
|
|
138
|
-
window.removeEventListener("
|
|
139
|
+
return t(), window.addEventListener("resize", t), () => {
|
|
140
|
+
window.removeEventListener("resize", t);
|
|
139
141
|
};
|
|
140
|
-
}, [s,
|
|
141
|
-
|
|
142
|
-
}, [
|
|
143
|
-
|
|
144
|
-
}, []),
|
|
145
|
-
/* @__PURE__ */
|
|
146
|
-
|
|
142
|
+
}, [s, m, N, L, a, O, b, D]), x(() => {
|
|
143
|
+
it(L && !!g && !!z && !!E);
|
|
144
|
+
}, [L, g, z, E]), x(() => () => {
|
|
145
|
+
v.current && clearTimeout(v.current), w.current && clearTimeout(w.current);
|
|
146
|
+
}, []), st ? null : vt(
|
|
147
|
+
/* @__PURE__ */ T(wt, { onClick: p, disableClickOutside: X, children: /* @__PURE__ */ T(
|
|
148
|
+
xt,
|
|
147
149
|
{
|
|
148
|
-
ref:
|
|
149
|
-
open:
|
|
150
|
-
transitionDuration:
|
|
151
|
-
...
|
|
152
|
-
css:
|
|
150
|
+
ref: tt,
|
|
151
|
+
open: rt,
|
|
152
|
+
transitionDuration: M,
|
|
153
|
+
...R,
|
|
154
|
+
css: Z,
|
|
153
155
|
style: {
|
|
154
|
-
...
|
|
156
|
+
...Y,
|
|
155
157
|
top: g,
|
|
156
|
-
left:
|
|
157
|
-
bottom: g === "auto" ?
|
|
158
|
-
|
|
158
|
+
left: z,
|
|
159
|
+
bottom: g === "auto" ? d : void 0,
|
|
160
|
+
right: ot,
|
|
161
|
+
width: W ? E : void 0,
|
|
162
|
+
maxHeight: D
|
|
159
163
|
},
|
|
160
|
-
children: /* @__PURE__ */
|
|
161
|
-
|
|
164
|
+
children: /* @__PURE__ */ T(
|
|
165
|
+
ht,
|
|
162
166
|
{
|
|
163
167
|
role: "menu",
|
|
164
|
-
ref:
|
|
165
|
-
disablePadding:
|
|
166
|
-
maxHeight:
|
|
167
|
-
...
|
|
168
|
-
children:
|
|
169
|
-
var
|
|
170
|
-
if (!
|
|
168
|
+
ref: $,
|
|
169
|
+
disablePadding: Q,
|
|
170
|
+
maxHeight: D,
|
|
171
|
+
...A,
|
|
172
|
+
children: F.map(a, (t, e) => {
|
|
173
|
+
var i, n, c, l, r, S;
|
|
174
|
+
if (!yt(t))
|
|
171
175
|
return null;
|
|
172
|
-
const
|
|
173
|
-
return /* @__PURE__ */
|
|
174
|
-
|
|
176
|
+
const u = ut === e;
|
|
177
|
+
return /* @__PURE__ */ pt(lt, { children: [
|
|
178
|
+
mt(t, {
|
|
175
179
|
...t.props,
|
|
176
180
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
177
181
|
// @ts-expect-error
|
|
178
182
|
"data-index": e,
|
|
179
|
-
selected: !!((
|
|
180
|
-
onClick:
|
|
181
|
-
onKeyDown:
|
|
182
|
-
tabIndex:
|
|
183
|
+
selected: !!((i = t == null ? void 0 : t.props) != null && i.value) && ((n = t == null ? void 0 : t.props) == null ? void 0 : n.value) === J,
|
|
184
|
+
onClick: ct((c = t == null ? void 0 : t.props) == null ? void 0 : c.value, (l = t == null ? void 0 : t.props) == null ? void 0 : l.onClick),
|
|
185
|
+
onKeyDown: ft((r = t == null ? void 0 : t.props) == null ? void 0 : r.value),
|
|
186
|
+
tabIndex: u ? 0 : -1,
|
|
183
187
|
style: {
|
|
184
|
-
...(
|
|
185
|
-
[
|
|
188
|
+
...(S = t == null ? void 0 : t.props) == null ? void 0 : S.style,
|
|
189
|
+
[O ? "width" : "minWidth"]: W ? void 0 : E,
|
|
186
190
|
maxWidth: W ? void 0 : "100%"
|
|
187
191
|
}
|
|
188
192
|
}),
|
|
189
|
-
|
|
193
|
+
P && F.count(a) !== e + 1 && /* @__PURE__ */ T(kt, {})
|
|
190
194
|
] });
|
|
191
195
|
})
|
|
192
196
|
}
|
|
@@ -197,5 +201,5 @@ const at = T.div`
|
|
|
197
201
|
);
|
|
198
202
|
});
|
|
199
203
|
export {
|
|
200
|
-
|
|
204
|
+
Mt as default
|
|
201
205
|
};
|
package/Menu/Menu.stories.d.ts
CHANGED
|
@@ -12,6 +12,11 @@ declare const meta: {
|
|
|
12
12
|
disable: true;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
+
menuProps: {
|
|
16
|
+
control: {
|
|
17
|
+
disable: true;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
15
20
|
};
|
|
16
21
|
tags: string[];
|
|
17
22
|
};
|
|
@@ -22,10 +27,10 @@ export declare const StartAdornment: Story;
|
|
|
22
27
|
export declare const EndAdornment: Story;
|
|
23
28
|
export declare const BothAdornment: Story;
|
|
24
29
|
export declare const VariableWidth: Story;
|
|
25
|
-
export declare const
|
|
26
|
-
export declare const MaxWidth: Story;
|
|
30
|
+
export declare const Width: Story;
|
|
27
31
|
export declare const ShowDivider: Story;
|
|
28
32
|
export declare const Placement: Story;
|
|
29
33
|
export declare const Custom: Story;
|
|
30
34
|
export declare const FitToAnchorWidth: Story;
|
|
35
|
+
export declare const DisableAutoPositioning: Story;
|
|
31
36
|
export declare const WithScreenReaderSupport: Story;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("@emotion/react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("@emotion/react/jsx-runtime"),y=require("react"),k=require("../../Icon/Icon.cjs"),v=require("../../hooks/useCheckHoverPossible/useCheckHoverPossible.cjs"),w=require("@emotion/styled"),b=e=>e&&e.__esModule?e:{default:e},s=b(w),j=s.default.li`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
gap: ${({theme:{spacing:e}})=>e.content(2)}px;
|
|
@@ -10,18 +10,16 @@
|
|
|
10
10
|
& svg {
|
|
11
11
|
width: 20px;
|
|
12
12
|
height: 20px;
|
|
13
|
-
color: ${({theme:{palette:{brand:e,grey:
|
|
13
|
+
color: ${({theme:{palette:{brand:e,grey:r}},selected:t,disabled:i})=>t?e.primary.main:i?r[30]:"inherit"};
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
${({
|
|
17
|
-
|
|
18
|
-
${({theme:{palette:{brand:e,grey:n}},selected:t,isHoverPossible:r})=>r?{"&:hover:not([disabled]), &:focus:not([disabled])":{backgroundColor:t?e.primary.bg:n[10]}}:{}}
|
|
19
|
-
`,k=u.default.div`
|
|
16
|
+
${({theme:{palette:{brand:e,grey:r}},selected:t,isHoverPossible:i})=>i?{"&:hover:not([disabled]), &:focus:not([disabled])":{backgroundColor:t?e.primary.bg:r[10]}}:{}}
|
|
17
|
+
`,S=s.default.div`
|
|
20
18
|
flex-grow: 1;
|
|
21
19
|
|
|
22
|
-
${({
|
|
20
|
+
${({lineClamp:e})=>e?{display:"-webkit-box",overflow:"hidden",WebkitLineClamp:e,WebkitBoxOrient:"vertical"}:null}
|
|
23
21
|
|
|
24
|
-
${({theme:{palette:{brand:e,grey:
|
|
25
|
-
`,
|
|
22
|
+
${({theme:{palette:{brand:e,grey:r},typography:{h5B:t,b4R:i}},selected:c,disabled:o})=>{let n={fontSize:i.size,fontWeight:i.weight,letterSpacing:i.letterSpacing,lineHeight:i.lineHeight};return c&&(n={fontSize:t.size,fontWeight:t.weight,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,color:e.primary.text}),o&&(n.color=r[30]),n}}}
|
|
23
|
+
`,a=s.default.div`
|
|
26
24
|
white-space: nowrap;
|
|
27
|
-
|
|
25
|
+
`,$=y.forwardRef(function({children:r,startAdornment:t,endAdornment:i,inlineCSS:c,selected:o,disabled:n,value:f,onClick:u,lineClamp:p=1,...h},g){const{isHoverPossible:x}=v.default(),m=d=>{d.stopPropagation(),!n&&typeof u=="function"&&u(d)};return l.jsxs(j,{ref:g,selected:o,disabled:n,"data-value":f,isHoverPossible:x,onClick:m,lineClamp:p,role:"menuitem",...h,css:c,children:[t&&l.jsx(a,{children:t}),l.jsx(S,{selected:o,disabled:n,lineClamp:p,children:r}),!o&&i&&l.jsx(a,{children:i}),o&&l.jsx(a,{children:l.jsx(k.default,{name:"CheckLine",color:"primary"})})]})});exports.default=$;
|
|
@@ -7,8 +7,8 @@ export interface MenuBlockProps extends GeneralComponentProps<HTMLAttributes<HTM
|
|
|
7
7
|
selected?: boolean;
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
value?: string | number;
|
|
10
|
-
ellipsis?: boolean;
|
|
11
10
|
focused?: boolean;
|
|
11
|
+
lineClamp?: number;
|
|
12
12
|
}
|
|
13
13
|
declare const MenuBlock: import('react').ForwardRefExoticComponent<MenuBlockProps & import('react').RefAttributes<HTMLLIElement>>;
|
|
14
14
|
export default MenuBlock;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as x, jsx as l } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const v =
|
|
2
|
+
import { forwardRef as k } from "react";
|
|
3
|
+
import w from "../../Icon/Icon.es.js";
|
|
4
|
+
import y from "../../hooks/useCheckHoverPossible/useCheckHoverPossible.es.js";
|
|
5
|
+
import p from "@emotion/styled";
|
|
6
|
+
const v = p.li`
|
|
7
7
|
display: flex;
|
|
8
8
|
align-items: center;
|
|
9
9
|
gap: ${({ theme: { spacing: e } }) => e.content(2)}px;
|
|
@@ -21,98 +21,95 @@ const v = c.li`
|
|
|
21
21
|
height: 20px;
|
|
22
22
|
color: ${({
|
|
23
23
|
theme: {
|
|
24
|
-
palette: { brand: e, grey:
|
|
24
|
+
palette: { brand: e, grey: r }
|
|
25
25
|
},
|
|
26
26
|
selected: t,
|
|
27
|
-
disabled:
|
|
28
|
-
}) => t ? e.primary.main :
|
|
27
|
+
disabled: i
|
|
28
|
+
}) => t ? e.primary.main : i ? r[30] : "inherit"};
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
${({ ellipsis: e }) => e ? {
|
|
32
|
-
maxHeight: "40px"
|
|
33
|
-
} : {}};
|
|
34
|
-
|
|
35
31
|
${({
|
|
36
32
|
theme: {
|
|
37
|
-
palette: { brand: e, grey:
|
|
33
|
+
palette: { brand: e, grey: r }
|
|
38
34
|
},
|
|
39
35
|
selected: t,
|
|
40
|
-
isHoverPossible:
|
|
41
|
-
}) =>
|
|
36
|
+
isHoverPossible: i
|
|
37
|
+
}) => i ? {
|
|
42
38
|
"&:hover:not([disabled]), &:focus:not([disabled])": {
|
|
43
|
-
backgroundColor: t ? e.primary.bg :
|
|
39
|
+
backgroundColor: t ? e.primary.bg : r[10]
|
|
44
40
|
}
|
|
45
41
|
} : {}}
|
|
46
|
-
`,
|
|
42
|
+
`, b = p.div`
|
|
47
43
|
flex-grow: 1;
|
|
48
44
|
|
|
49
|
-
${({
|
|
45
|
+
${({ lineClamp: e }) => e ? {
|
|
46
|
+
display: "-webkit-box",
|
|
50
47
|
overflow: "hidden",
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} :
|
|
48
|
+
WebkitLineClamp: e,
|
|
49
|
+
WebkitBoxOrient: "vertical"
|
|
50
|
+
} : null}
|
|
54
51
|
|
|
55
52
|
${({
|
|
56
53
|
theme: {
|
|
57
|
-
palette: { brand: e, grey:
|
|
58
|
-
typography: { h5B: t, b4R:
|
|
54
|
+
palette: { brand: e, grey: r },
|
|
55
|
+
typography: { h5B: t, b4R: i }
|
|
59
56
|
},
|
|
60
|
-
selected:
|
|
57
|
+
selected: c,
|
|
61
58
|
disabled: n
|
|
62
59
|
}) => {
|
|
63
60
|
let o = {
|
|
64
|
-
fontSize:
|
|
65
|
-
fontWeight:
|
|
66
|
-
letterSpacing:
|
|
67
|
-
lineHeight:
|
|
61
|
+
fontSize: i.size,
|
|
62
|
+
fontWeight: i.weight,
|
|
63
|
+
letterSpacing: i.letterSpacing,
|
|
64
|
+
lineHeight: i.lineHeight
|
|
68
65
|
};
|
|
69
|
-
return
|
|
66
|
+
return c && (o = {
|
|
70
67
|
fontSize: t.size,
|
|
71
68
|
fontWeight: t.weight,
|
|
72
69
|
letterSpacing: t.letterSpacing,
|
|
73
70
|
lineHeight: t.lineHeight,
|
|
74
71
|
color: e.primary.text
|
|
75
|
-
}), n && (o.color =
|
|
72
|
+
}), n && (o.color = r[30]), o;
|
|
76
73
|
}}}
|
|
77
|
-
`, a =
|
|
74
|
+
`, a = p.div`
|
|
78
75
|
white-space: nowrap;
|
|
79
|
-
`,
|
|
80
|
-
children:
|
|
76
|
+
`, j = k(function({
|
|
77
|
+
children: r,
|
|
81
78
|
startAdornment: t,
|
|
82
|
-
endAdornment:
|
|
83
|
-
inlineCSS:
|
|
79
|
+
endAdornment: i,
|
|
80
|
+
inlineCSS: c,
|
|
84
81
|
selected: n,
|
|
85
82
|
disabled: o,
|
|
86
|
-
value:
|
|
87
|
-
onClick:
|
|
88
|
-
|
|
83
|
+
value: g,
|
|
84
|
+
onClick: s,
|
|
85
|
+
lineClamp: h = 1,
|
|
89
86
|
...m
|
|
90
|
-
},
|
|
91
|
-
const { isHoverPossible: d } =
|
|
87
|
+
}, u) {
|
|
88
|
+
const { isHoverPossible: d } = y();
|
|
92
89
|
return /* @__PURE__ */ x(
|
|
93
90
|
v,
|
|
94
91
|
{
|
|
95
|
-
ref:
|
|
92
|
+
ref: u,
|
|
96
93
|
selected: n,
|
|
97
94
|
disabled: o,
|
|
98
|
-
"data-value":
|
|
95
|
+
"data-value": g,
|
|
99
96
|
isHoverPossible: d,
|
|
100
|
-
onClick: (
|
|
101
|
-
|
|
97
|
+
onClick: (f) => {
|
|
98
|
+
f.stopPropagation(), !o && typeof s == "function" && s(f);
|
|
102
99
|
},
|
|
103
|
-
|
|
100
|
+
lineClamp: h,
|
|
104
101
|
role: "menuitem",
|
|
105
102
|
...m,
|
|
106
|
-
css:
|
|
103
|
+
css: c,
|
|
107
104
|
children: [
|
|
108
105
|
t && /* @__PURE__ */ l(a, { children: t }),
|
|
109
|
-
/* @__PURE__ */ l(
|
|
110
|
-
!n &&
|
|
111
|
-
n && /* @__PURE__ */ l(a, { children: /* @__PURE__ */ l(
|
|
106
|
+
/* @__PURE__ */ l(b, { selected: n, disabled: o, lineClamp: h, children: r }),
|
|
107
|
+
!n && i && /* @__PURE__ */ l(a, { children: i }),
|
|
108
|
+
n && /* @__PURE__ */ l(a, { children: /* @__PURE__ */ l(w, { name: "CheckLine", color: "primary" }) })
|
|
112
109
|
]
|
|
113
110
|
}
|
|
114
111
|
);
|
|
115
112
|
});
|
|
116
113
|
export {
|
|
117
|
-
|
|
114
|
+
j as default
|
|
118
115
|
};
|
package/TextField/TextField.cjs
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@emotion/react/jsx-runtime"),u=require("react"),b=require("../Icon/Icon.cjs"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@emotion/react/jsx-runtime"),u=require("react"),b=require("../Icon/Icon.cjs"),_=require("@emotion/styled"),T=t=>t&&t.__esModule?t:{default:t},f=T(_),V=f.default.div`
|
|
2
2
|
position: relative;
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
${({fullWidth:t})=>t?{width:"100%"}:null};
|
|
6
|
-
`,
|
|
6
|
+
`,M=f.default.div`
|
|
7
7
|
display: flex;
|
|
8
8
|
align-items: center;
|
|
9
9
|
justify-content: center;
|
|
10
10
|
gap: ${({theme:{spacing:t}})=>t.content(2)}px;
|
|
11
11
|
border: 1px solid transparent;
|
|
12
12
|
|
|
13
|
-
${({theme:{palette:{green:t,grey:
|
|
13
|
+
${({theme:{palette:{green:t,grey:i,background:s,etc:o}},variant:g,helper:n})=>{let r={backgroundColor:i.white,borderColor:i[50],color:i[100]};switch(g){case"outlined":(n==null?void 0:n.severity)==="success"&&(r={...r,borderColor:`${t[70]} !important`}),(n==null?void 0:n.severity)==="error"&&(r={...r,borderColor:`${o.red} !important`});break;case"filled":r={backgroundColor:s.primary};break}return r}};
|
|
14
14
|
|
|
15
|
-
${({theme:{spacing:t},size:
|
|
15
|
+
${({theme:{spacing:t},size:i})=>{let s={maxHeight:48,padding:`${t.content(3)}px ${t.content(4)}px`,borderRadius:10};switch(i){case"2xLarge":s={maxHeight:80,padding:`${t.content(4)}px ${t.content(5)}px`,borderRadius:12,"& svg":{width:48,height:48}};break;case"xLarge":s={maxHeight:56,padding:t.content(4),borderRadius:12};break}return s}};
|
|
16
16
|
|
|
17
|
-
${({theme:{palette:{brand:t}},variant:
|
|
17
|
+
${({theme:{palette:{brand:t}},variant:i,focus:s})=>i==="outlined"&&s?{borderColor:t.primary.line}:null};
|
|
18
18
|
|
|
19
19
|
${({fullWidth:t})=>t?{width:"100%"}:null};
|
|
20
20
|
|
|
21
|
-
${({theme:{palette:{grey:t}},variant:
|
|
22
|
-
`,
|
|
23
|
-
width:
|
|
21
|
+
${({theme:{palette:{grey:t}},variant:i,disabled:s})=>{if(!s)return null;let o={backgroundColor:t[10],borderColor:t[30]};switch(i){case"filled":o={backgroundColor:t[10]};break}return o}}
|
|
22
|
+
`,q=f.default.input`
|
|
23
|
+
width: 100%;
|
|
24
24
|
flex-grow: 1;
|
|
25
25
|
border: none;
|
|
26
26
|
background-color: transparent;
|
|
27
27
|
outline: 0;
|
|
28
28
|
|
|
29
|
-
${({theme:{typography:{b2R:t,h0R:
|
|
29
|
+
${({theme:{typography:{b2R:t,h0R:i}},inputSize:s})=>s==="2xLarge"?{fontSize:i.size,fontWeight:i.weight,lineHeight:i.lineHeight,letterSpacing:i.letterSpacing}:{fontSize:t.size,fontWeight:t.weight,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing}};
|
|
30
30
|
|
|
31
31
|
&::placeholder, &::-webkit-input-placeholder, &::-ms-input-placeholder, &::-moz-placeholder {
|
|
32
|
-
${({theme:{palette:{grey:t}},variant:
|
|
32
|
+
${({theme:{palette:{grey:t}},variant:i})=>({color:t[50]})};
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
&:disabled {
|
|
@@ -44,20 +44,20 @@
|
|
|
44
44
|
&[type='password']::-ms-reveal {
|
|
45
45
|
display: none;
|
|
46
46
|
}
|
|
47
|
-
`,
|
|
47
|
+
`,E=f.default.button`
|
|
48
48
|
&:empty {
|
|
49
49
|
display: none;
|
|
50
50
|
}
|
|
51
|
-
`,
|
|
51
|
+
`,W=f.default.div`
|
|
52
52
|
position: absolute;
|
|
53
53
|
left: 0;
|
|
54
54
|
bottom: ${({inputSize:t})=>t==="2xLarge"?"-26px":"-16px"};
|
|
55
55
|
white-space: nowrap;
|
|
56
|
-
${({theme:{typography:{c3R:t,b1R:
|
|
56
|
+
${({theme:{typography:{c3R:t,b1R:i}},inputSize:s})=>s==="2xLarge"?{fontSize:i.size,fontWeight:i.weight,lineHeight:i.lineHeight,letterSpacing:i.letterSpacing}:{fontSize:t.size,fontWeight:t.weight,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing}};
|
|
57
57
|
|
|
58
|
-
${({theme:{palette:{etc:t,grey:
|
|
58
|
+
${({theme:{palette:{etc:t,grey:i}},helper:s})=>{const o={color:i[100]};return(s==null?void 0:s.severity)==="error"?{color:t.red}:o}}
|
|
59
59
|
|
|
60
60
|
&:empty {
|
|
61
61
|
display: none;
|
|
62
62
|
}
|
|
63
|
-
`,
|
|
63
|
+
`,B=u.forwardRef(function({type:i="text",variant:s="outlined",size:o="large",startAdornment:g,endAdornment:n,fullWidth:r,helper:e,disabled:x,inlineCSS:S,onFocus:y,onBlur:m,disablePasswordVisibility:p,helperProps:$,...j},k){const C=u.useId(),v=u.useId(),[H,w]=u.useState(!1),[d,I]=u.useState(!1),a=!p&&!n&&i==="password",L=l=>{w(!0),typeof y=="function"&&y(l)},z=l=>{w(!1),typeof m=="function"&&m(l)},F=()=>I(l=>!l),O=()=>a&&d?"text":a&&!d?"password":i;return c.jsxs(V,{fullWidth:r,children:[c.jsxs(M,{variant:s,size:o,focus:H,fullWidth:r,helper:e,disabled:x,css:S,children:[g,c.jsx(q,{ref:k,id:C,type:O(),variant:s,inputSize:o,disabled:x,"aria-invalid":(e==null?void 0:e.severity)==="error","aria-describedby":e!=null&&e.message?v:void 0,...j,onFocus:L,onBlur:z}),n,!n&&(e==null?void 0:e.severity)==="success"&&c.jsx(b.default,{name:"CheckLine",color:"green.70","aria-label":"성공",role:"img"}),c.jsxs(E,{type:"button",tabIndex:a?0:-1,"aria-pressed":a?d:void 0,onClick:F,"aria-hidden":!a,"aria-label":a&&d?"비밀번호 표시됨":"비밀번호 숨김됨",children:[a&&d&&(e==null?void 0:e.severity)!=="success"&&c.jsx(b.default,{name:"EyeVisibleLine","data-testid":"EyeVisibleLine",inlineCSS:{cursor:"pointer"}}),a&&!d&&(e==null?void 0:e.severity)!=="success"&&c.jsx(b.default,{name:"EyeInvisibleLine","data-testid":"EyeInvisibleLine",inlineCSS:{cursor:"pointer"}})]})]}),c.jsx(W,{id:v,className:"textfield-helper","aria-live":(e==null?void 0:e.severity)==="error"?"assertive":"off",role:(e==null?void 0:e.severity)==="error"?"alert":"status",helper:e,inputSize:o,"data-testid":"helper",...$,children:e==null?void 0:e.message})]})});exports.default=B;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs as g, jsx as l } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
2
|
+
import { forwardRef as V, useId as w, useState as S } from "react";
|
|
3
3
|
import b from "../Icon/Icon.es.js";
|
|
4
4
|
import u from "@emotion/styled";
|
|
5
|
-
const
|
|
5
|
+
const E = u.div`
|
|
6
6
|
position: relative;
|
|
7
7
|
display: flex;
|
|
8
8
|
flex-direction: column;
|
|
9
9
|
${({ fullWidth: t }) => t ? { width: "100%" } : null};
|
|
10
|
-
`,
|
|
10
|
+
`, W = u.div`
|
|
11
11
|
display: flex;
|
|
12
12
|
align-items: center;
|
|
13
13
|
justify-content: center;
|
|
@@ -16,42 +16,42 @@ const V = u.div`
|
|
|
16
16
|
|
|
17
17
|
${({
|
|
18
18
|
theme: {
|
|
19
|
-
palette: { green: t, grey:
|
|
19
|
+
palette: { green: t, grey: i, background: o, etc: n }
|
|
20
20
|
},
|
|
21
21
|
variant: f,
|
|
22
|
-
helper:
|
|
22
|
+
helper: s
|
|
23
23
|
}) => {
|
|
24
|
-
let
|
|
25
|
-
backgroundColor:
|
|
26
|
-
borderColor:
|
|
27
|
-
color:
|
|
24
|
+
let r = {
|
|
25
|
+
backgroundColor: i.white,
|
|
26
|
+
borderColor: i[50],
|
|
27
|
+
color: i[100]
|
|
28
28
|
};
|
|
29
29
|
switch (f) {
|
|
30
30
|
case "outlined":
|
|
31
|
-
(
|
|
32
|
-
...
|
|
31
|
+
(s == null ? void 0 : s.severity) === "success" && (r = {
|
|
32
|
+
...r,
|
|
33
33
|
borderColor: `${t[70]} !important`
|
|
34
|
-
}), (
|
|
35
|
-
...
|
|
34
|
+
}), (s == null ? void 0 : s.severity) === "error" && (r = {
|
|
35
|
+
...r,
|
|
36
36
|
borderColor: `${n.red} !important`
|
|
37
37
|
});
|
|
38
38
|
break;
|
|
39
39
|
case "filled":
|
|
40
|
-
|
|
40
|
+
r = {
|
|
41
41
|
backgroundColor: o.primary
|
|
42
42
|
};
|
|
43
43
|
break;
|
|
44
44
|
}
|
|
45
|
-
return
|
|
45
|
+
return r;
|
|
46
46
|
}};
|
|
47
47
|
|
|
48
|
-
${({ theme: { spacing: t }, size:
|
|
48
|
+
${({ theme: { spacing: t }, size: i }) => {
|
|
49
49
|
let o = {
|
|
50
50
|
maxHeight: 48,
|
|
51
51
|
padding: `${t.content(3)}px ${t.content(4)}px`,
|
|
52
52
|
borderRadius: 10
|
|
53
53
|
};
|
|
54
|
-
switch (
|
|
54
|
+
switch (i) {
|
|
55
55
|
case "2xLarge":
|
|
56
56
|
o = {
|
|
57
57
|
maxHeight: 80,
|
|
@@ -78,9 +78,9 @@ const V = u.div`
|
|
|
78
78
|
theme: {
|
|
79
79
|
palette: { brand: t }
|
|
80
80
|
},
|
|
81
|
-
variant:
|
|
81
|
+
variant: i,
|
|
82
82
|
focus: o
|
|
83
|
-
}) =>
|
|
83
|
+
}) => i === "outlined" && o ? {
|
|
84
84
|
borderColor: t.primary.line
|
|
85
85
|
} : null};
|
|
86
86
|
|
|
@@ -90,7 +90,7 @@ const V = u.div`
|
|
|
90
90
|
theme: {
|
|
91
91
|
palette: { grey: t }
|
|
92
92
|
},
|
|
93
|
-
variant:
|
|
93
|
+
variant: i,
|
|
94
94
|
disabled: o
|
|
95
95
|
}) => {
|
|
96
96
|
if (!o) return null;
|
|
@@ -98,7 +98,7 @@ const V = u.div`
|
|
|
98
98
|
backgroundColor: t[10],
|
|
99
99
|
borderColor: t[30]
|
|
100
100
|
};
|
|
101
|
-
switch (
|
|
101
|
+
switch (i) {
|
|
102
102
|
case "filled":
|
|
103
103
|
n = {
|
|
104
104
|
backgroundColor: t[10]
|
|
@@ -107,8 +107,8 @@ const V = u.div`
|
|
|
107
107
|
}
|
|
108
108
|
return n;
|
|
109
109
|
}}
|
|
110
|
-
`,
|
|
111
|
-
width:
|
|
110
|
+
`, B = u.input`
|
|
111
|
+
width: 100%;
|
|
112
112
|
flex-grow: 1;
|
|
113
113
|
border: none;
|
|
114
114
|
background-color: transparent;
|
|
@@ -116,14 +116,14 @@ const V = u.div`
|
|
|
116
116
|
|
|
117
117
|
${({
|
|
118
118
|
theme: {
|
|
119
|
-
typography: { b2R: t, h0R:
|
|
119
|
+
typography: { b2R: t, h0R: i }
|
|
120
120
|
},
|
|
121
121
|
inputSize: o
|
|
122
122
|
}) => o === "2xLarge" ? {
|
|
123
|
-
fontSize:
|
|
124
|
-
fontWeight:
|
|
125
|
-
lineHeight:
|
|
126
|
-
letterSpacing:
|
|
123
|
+
fontSize: i.size,
|
|
124
|
+
fontWeight: i.weight,
|
|
125
|
+
lineHeight: i.lineHeight,
|
|
126
|
+
letterSpacing: i.letterSpacing
|
|
127
127
|
} : {
|
|
128
128
|
fontSize: t.size,
|
|
129
129
|
fontWeight: t.weight,
|
|
@@ -136,7 +136,7 @@ const V = u.div`
|
|
|
136
136
|
theme: {
|
|
137
137
|
palette: { grey: t }
|
|
138
138
|
},
|
|
139
|
-
variant:
|
|
139
|
+
variant: i
|
|
140
140
|
}) => ({
|
|
141
141
|
color: t[50]
|
|
142
142
|
})};
|
|
@@ -163,25 +163,25 @@ const V = u.div`
|
|
|
163
163
|
&[type='password']::-ms-reveal {
|
|
164
164
|
display: none;
|
|
165
165
|
}
|
|
166
|
-
`,
|
|
166
|
+
`, M = u.button`
|
|
167
167
|
&:empty {
|
|
168
168
|
display: none;
|
|
169
169
|
}
|
|
170
|
-
`,
|
|
170
|
+
`, P = u.div`
|
|
171
171
|
position: absolute;
|
|
172
172
|
left: 0;
|
|
173
173
|
bottom: ${({ inputSize: t }) => t === "2xLarge" ? "-26px" : "-16px"};
|
|
174
174
|
white-space: nowrap;
|
|
175
175
|
${({
|
|
176
176
|
theme: {
|
|
177
|
-
typography: { c3R: t, b1R:
|
|
177
|
+
typography: { c3R: t, b1R: i }
|
|
178
178
|
},
|
|
179
179
|
inputSize: o
|
|
180
180
|
}) => o === "2xLarge" ? {
|
|
181
|
-
fontSize:
|
|
182
|
-
fontWeight:
|
|
183
|
-
lineHeight:
|
|
184
|
-
letterSpacing:
|
|
181
|
+
fontSize: i.size,
|
|
182
|
+
fontWeight: i.weight,
|
|
183
|
+
lineHeight: i.lineHeight,
|
|
184
|
+
letterSpacing: i.letterSpacing
|
|
185
185
|
} : {
|
|
186
186
|
fontSize: t.size,
|
|
187
187
|
fontWeight: t.weight,
|
|
@@ -191,12 +191,12 @@ const V = u.div`
|
|
|
191
191
|
|
|
192
192
|
${({
|
|
193
193
|
theme: {
|
|
194
|
-
palette: { etc: t, grey:
|
|
194
|
+
palette: { etc: t, grey: i }
|
|
195
195
|
},
|
|
196
196
|
helper: o
|
|
197
197
|
}) => {
|
|
198
198
|
const n = {
|
|
199
|
-
color:
|
|
199
|
+
color: i[100]
|
|
200
200
|
};
|
|
201
201
|
return (o == null ? void 0 : o.severity) === "error" ? {
|
|
202
202
|
color: t.red
|
|
@@ -206,69 +206,69 @@ const V = u.div`
|
|
|
206
206
|
&:empty {
|
|
207
207
|
display: none;
|
|
208
208
|
}
|
|
209
|
-
`, J =
|
|
210
|
-
type:
|
|
209
|
+
`, J = V(function({
|
|
210
|
+
type: i = "text",
|
|
211
211
|
variant: o = "outlined",
|
|
212
212
|
size: n = "large",
|
|
213
213
|
startAdornment: f,
|
|
214
|
-
endAdornment:
|
|
215
|
-
fullWidth:
|
|
216
|
-
helper:
|
|
214
|
+
endAdornment: s,
|
|
215
|
+
fullWidth: r,
|
|
216
|
+
helper: e,
|
|
217
217
|
disabled: m,
|
|
218
218
|
inlineCSS: $,
|
|
219
|
-
onFocus:
|
|
220
|
-
onBlur:
|
|
219
|
+
onFocus: y,
|
|
220
|
+
onBlur: x,
|
|
221
221
|
disablePasswordVisibility: k,
|
|
222
222
|
helperProps: C,
|
|
223
223
|
...H
|
|
224
224
|
}, L) {
|
|
225
|
-
const j =
|
|
226
|
-
|
|
227
|
-
},
|
|
228
|
-
|
|
229
|
-
},
|
|
230
|
-
return /* @__PURE__ */ g(
|
|
225
|
+
const j = w(), p = w(), [z, v] = S(!1), [c, I] = S(!1), a = !k && !s && i === "password", F = (d) => {
|
|
226
|
+
v(!0), typeof y == "function" && y(d);
|
|
227
|
+
}, O = (d) => {
|
|
228
|
+
v(!1), typeof x == "function" && x(d);
|
|
229
|
+
}, T = () => I((d) => !d);
|
|
230
|
+
return /* @__PURE__ */ g(E, { fullWidth: r, children: [
|
|
231
231
|
/* @__PURE__ */ g(
|
|
232
|
-
|
|
232
|
+
W,
|
|
233
233
|
{
|
|
234
234
|
variant: o,
|
|
235
235
|
size: n,
|
|
236
236
|
focus: z,
|
|
237
|
-
fullWidth:
|
|
238
|
-
helper:
|
|
237
|
+
fullWidth: r,
|
|
238
|
+
helper: e,
|
|
239
239
|
disabled: m,
|
|
240
240
|
css: $,
|
|
241
241
|
children: [
|
|
242
242
|
f,
|
|
243
243
|
/* @__PURE__ */ l(
|
|
244
|
-
|
|
244
|
+
B,
|
|
245
245
|
{
|
|
246
246
|
ref: L,
|
|
247
247
|
id: j,
|
|
248
|
-
type: a && c ? "text" : a && !c ? "password" :
|
|
248
|
+
type: a && c ? "text" : a && !c ? "password" : i,
|
|
249
249
|
variant: o,
|
|
250
250
|
inputSize: n,
|
|
251
251
|
disabled: m,
|
|
252
|
-
"aria-invalid": (
|
|
253
|
-
"aria-describedby":
|
|
252
|
+
"aria-invalid": (e == null ? void 0 : e.severity) === "error",
|
|
253
|
+
"aria-describedby": e != null && e.message ? p : void 0,
|
|
254
254
|
...H,
|
|
255
255
|
onFocus: F,
|
|
256
|
-
onBlur:
|
|
256
|
+
onBlur: O
|
|
257
257
|
}
|
|
258
258
|
),
|
|
259
|
-
|
|
260
|
-
!
|
|
259
|
+
s,
|
|
260
|
+
!s && (e == null ? void 0 : e.severity) === "success" && /* @__PURE__ */ l(b, { name: "CheckLine", color: "green.70", "aria-label": "성공", role: "img" }),
|
|
261
261
|
/* @__PURE__ */ g(
|
|
262
|
-
|
|
262
|
+
M,
|
|
263
263
|
{
|
|
264
264
|
type: "button",
|
|
265
265
|
tabIndex: a ? 0 : -1,
|
|
266
266
|
"aria-pressed": a ? c : void 0,
|
|
267
|
-
onClick:
|
|
267
|
+
onClick: T,
|
|
268
268
|
"aria-hidden": !a,
|
|
269
269
|
"aria-label": a && c ? "비밀번호 표시됨" : "비밀번호 숨김됨",
|
|
270
270
|
children: [
|
|
271
|
-
a && c && /* @__PURE__ */ l(
|
|
271
|
+
a && c && (e == null ? void 0 : e.severity) !== "success" && /* @__PURE__ */ l(
|
|
272
272
|
b,
|
|
273
273
|
{
|
|
274
274
|
name: "EyeVisibleLine",
|
|
@@ -278,7 +278,7 @@ const V = u.div`
|
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
),
|
|
281
|
-
a && !c && /* @__PURE__ */ l(
|
|
281
|
+
a && !c && (e == null ? void 0 : e.severity) !== "success" && /* @__PURE__ */ l(
|
|
282
282
|
b,
|
|
283
283
|
{
|
|
284
284
|
name: "EyeInvisibleLine",
|
|
@@ -295,17 +295,17 @@ const V = u.div`
|
|
|
295
295
|
}
|
|
296
296
|
),
|
|
297
297
|
/* @__PURE__ */ l(
|
|
298
|
-
|
|
298
|
+
P,
|
|
299
299
|
{
|
|
300
300
|
id: p,
|
|
301
301
|
className: "textfield-helper",
|
|
302
|
-
"aria-live": (
|
|
303
|
-
role: (
|
|
304
|
-
helper:
|
|
302
|
+
"aria-live": (e == null ? void 0 : e.severity) === "error" ? "assertive" : "off",
|
|
303
|
+
role: (e == null ? void 0 : e.severity) === "error" ? "alert" : "status",
|
|
304
|
+
helper: e,
|
|
305
305
|
inputSize: n,
|
|
306
306
|
"data-testid": "helper",
|
|
307
307
|
...C,
|
|
308
|
-
children:
|
|
308
|
+
children: e == null ? void 0 : e.message
|
|
309
309
|
}
|
|
310
310
|
)
|
|
311
311
|
] });
|