@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.
@@ -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"),X=require("../CircularProgressIndicator/CircularProgressIndicator.cjs"),B=require("../Flexbox/Flexbox.cjs"),Y=require("../Icon/Icon.cjs"),Z=require("../Menu/Menu.cjs"),w=require("../Menu/MenuBlock/MenuBlock.cjs");require("../Menu/MenuButton/MenuButton.cjs");const L=require("../TextField/TextField.cjs"),V=require("../Typography/Typography.cjs"),ee=require("../core/useTheme.cjs"),z=require("../utils/getSibling/getSibling.cjs"),x=100,te=n.forwardRef(function({inputValue:o,onInputChange:f,menuValue:T,onMenuChange:y,inputProps:H,minInputLengthForMenu:P=0,options:C=[],isLoading:q=!1,renderOptions:O,renderEmpty:R,filterOptions:E,getOptionLabel:h},U){const D=n.useRef(null),v=n.useRef(null),A=n.useId(),{palette:F}=ee.default();n.useImperativeHandle(U,()=>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)},G=e=>{e.target.value.length>0?S(!0):y("",e,null),f(e.target.value,e)},M=()=>{j&&S(!0)},W=(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)},J=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)},Q=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(L.default,{value:o,onChange:G,onFocus:M,onKeyDown:J,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(Y.default,{name:"InvalidFill",color:"grey.50",size:"medium",role:"button",onClick:K,onKeyDown:Q,tabIndex:0,"aria-hidden":!1,focusable:!0,"aria-label":"지우기",inlineCSS:{cursor:"pointer"}}):null,inlineCSS:{"& svg":{flexShrink:0}},...H}),a.jsxs(Z.default,{id:A,value:T,ref:v,anchorRef:D,open:k&&o.length>=P,onClose:N,onChange:W,transitionDuration:x,disablePadding:!j,children:[q&&a.jsx(w.default,{value:"LOADING",disabled:!0,children:a.jsx(B.default,{justifyContent:"center",children:a.jsx(X.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(V.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=te;
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 V } from "@emotion/react/jsx-runtime";
2
- import { forwardRef as ee, useRef as P, useId as te, useImperativeHandle as re, useState as H, useEffect as le, isValidElement as U, cloneElement as _ } from "react";
3
- import oe from "../CircularProgressIndicator/CircularProgressIndicator.es.js";
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 ne from "../Icon/Icon.es.js";
6
- import ie from "../Menu/Menu.es.js";
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 se from "../TextField/TextField.es.js";
10
- import ce from "../Typography/Typography.es.js";
11
- import ae from "../core/useTheme.es.js";
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, ge = ee(function({
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: J,
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
- }, Q) {
27
- const O = P(null), f = P(null), N = te(), { palette: R } = ae();
28
- re(Q, () => O.current);
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
- }, X = (e) => {
48
+ }, Y = (e) => {
48
49
  e.target.value.length > 0 ? v(!0) : y("", e, null), u(e.target.value, e);
49
- }, Y = () => {
50
+ }, Z = () => {
50
51
  w && v(!0);
51
- }, Z = (e, l) => {
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
- }, M = (e) => {
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
- }, L = (e) => {
158
+ }, V = (e) => {
158
159
  (e.key === "Enter" || e.key === " ") && B(e);
159
160
  };
160
- return le(() => {
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
- se,
165
+ ce,
165
166
  {
166
167
  value: n,
167
- onChange: X,
168
- onFocus: Y,
169
- onKeyDown: M,
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
- ne,
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: L,
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
- ...J
197
+ ...Q
197
198
  }
198
199
  ),
199
200
  /* @__PURE__ */ C(
200
- ie,
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: Z,
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(oe, { size: "small", loop: !0 }) }) }),
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(V, { children: [
244
+ children: n && !I ? /* @__PURE__ */ C(ee, { children: [
243
245
  e.label.slice(0, i),
244
- /* @__PURE__ */ p(ce, { tag: "span", variant: "h5B", color: "primary", children: e.label.slice(i, i + n.length) }),
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
- ge as default
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 y=require("@emotion/react/jsx-runtime"),o=require("react"),st=require("react-dom"),it=require("../hooks/useCheckKeyboardMode/useCheckKeyboardMode.cjs"),z=require("../utils/getSibling/getSibling.cjs"),ut=require("@emotion/styled"),rt=e=>e&&e.__esModule?e:{default:e},$=rt(ut),nt=$.default.div`
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
- `,dt=$.default.div`
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
- `,ct=$.default.ul`
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:a})=>a?null:{padding:`${e.content(1)}px 0`}}}
31
- `,ft=$.default.div`
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
- `,k=24,lt=o.forwardRef(function({children:a,anchorRef:r,open:w,onClose:f,spacing:b=4,transitionDuration:M=200,onChange:m,value:H,showDivider:K,placement:D="bottom-center",disablePadding:C,disableClickOutside:F=!0,width:T,fitToAnchorWidth:q=!0,maxHeight:N=476,style:A,inlineCSS:B,menuProps:G,...U},V){const[g,O]=o.useState(0),[I,_]=o.useState(0),[h,J]=o.useState(0),[j,W]=o.useState(!1),[Q,X]=o.useState(!1),[Y,L]=o.useState(!0),[Z,p]=o.useState(null),v=o.useRef(),x=o.useRef(),E=o.useRef(null),{isKeyboardMode:R}=it.default(),tt=(t,s)=>n=>{n.stopPropagation(),typeof f=="function"&&f(),typeof m=="function"&&m(t,n),typeof s=="function"&&s(n)},et=t=>s=>{var u,c,d,l;if(s.key==="Tab"&&typeof f=="function"&&(f(),p(0)),(s.key==="Enter"||s.key===" ")&&typeof f=="function"&&typeof m=="function"&&(f(),m(t,s),r!=null&&r.current)){const i=r.current.querySelector("button");i&&R&&i.focus()}const n=document.activeElement;if(n){if(s.code==="ArrowDown"){const i=z.default(n,"next",{skipDisabled:!0});i&&i.dataset.index?(p(Number(i.dataset.index)),i.focus()):(p(0),(c=(u=E.current)==null?void 0:u.querySelector('[role="menuitem"]'))==null||c.focus())}if(s.code==="ArrowUp"){const i=z.default(n,"prev",{skipDisabled:!0});i&&i.dataset.index?(p(Number(i.dataset.index)),i.focus()):(p(o.Children.count(a)-1),(l=(d=E.current)==null?void 0:d.querySelector('[role="menuitem"]:last-child'))==null||l.focus())}}};return o.useEffect(()=>{w&&(x.current&&clearTimeout(x.current),document.body.style.overflow="hidden",L(!1),v.current=setTimeout(()=>{W(!0)},100))},[w]),o.useEffect(()=>{w||(v.current&&clearTimeout(v.current),W(!1),document.body.removeAttribute("style"),x.current=setTimeout(()=>{L(!0),p(0)},M))},[w,M]),o.useEffect(()=>{const t=()=>{var P;const{offsetWidth:s=0,offsetHeight:n=0}=(r==null?void 0:r.current)||{},u=((P=r==null?void 0:r.current)==null?void 0:P.getBoundingClientRect())||{top:0,left:0,bottom:0},{offsetWidth:c=0,offsetHeight:d=0}=E.current||{},[l,i]=D.split("-");J(T||s);const S=(u.top||0)-d-b-k<k,ot=(u.bottom||0)+d+b+k>window.innerHeight;switch(l){case"top":O(S?k:u.top-d-b);break;default:O(ot?"auto":u.top+n+b);break}switch(i){case"left":_(u.left);break;case"right":_(u.left-Math.abs(s-c));break;default:_(u.left+s/2-c/2);break}};return t(),window.addEventListener("scroll",t),window.addEventListener("resize",t),()=>{window.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[r,b,D,j,a,T]),o.useEffect(()=>{X(j&&!!g&&!!I&&!!h)},[j,g,I,h]),o.useEffect(()=>()=>{v.current&&clearTimeout(v.current),x.current&&clearTimeout(x.current)},[]),Y?null:st.createPortal(y.jsx(nt,{onClick:f,disableClickOutside:F,children:y.jsx(dt,{ref:V,open:Q,transitionDuration:M,...U,css:B,style:{...A,top:g,left:I,bottom:g==="auto"?24:void 0,width:q?h:void 0},children:y.jsx(ct,{role:"menu",ref:E,disablePadding:C,maxHeight:N,...G,children:o.Children.map(a,(t,s)=>{var u,c,d,l,i,S;if(!o.isValidElement(t))return null;const n=Z===s;return y.jsxs(y.Fragment,{children:[o.cloneElement(t,{...t.props,"data-index":s,selected:!!((u=t==null?void 0:t.props)!=null&&u.value)&&((c=t==null?void 0:t.props)==null?void 0:c.value)===H,onClick:tt((d=t==null?void 0:t.props)==null?void 0:d.value,(l=t==null?void 0:t.props)==null?void 0:l.onClick),onKeyDown:et((i=t==null?void 0:t.props)==null?void 0:i.value),tabIndex:n?0:-1,style:{...(S=t==null?void 0:t.props)==null?void 0:S.style,[T?"width":"minWidth"]:q?void 0:h,maxWidth:q?void 0:"100%"}}),K&&o.Children.count(a)!==s+1&&y.jsx(ft,{})]})})})})}),document.body)});exports.default=lt;
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 $, jsxs as nt, Fragment as ut } from "@emotion/react/jsx-runtime";
2
- import { forwardRef as dt, useState as l, useRef as z, useEffect as v, Children as H, isValidElement as ct, cloneElement as ft } from "react";
3
- import { createPortal as lt } from "react-dom";
4
- import pt from "../hooks/useCheckKeyboardMode/useCheckKeyboardMode.es.js";
5
- import j from "../utils/getSibling/getSibling.es.js";
6
- import T from "@emotion/styled";
7
- const at = T.div`
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
- `, yt = T.div`
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
- `, bt = T.ul`
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: p }) => p ? null : {
44
+ ${({ theme: { spacing: o }, disablePadding: a }) => a ? null : {
46
45
  padding: `${o.content(1)}px 0`
47
46
  }}}
48
- `, mt = T.div`
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
- `, S = 24, Et = dt(function({
57
- children: p,
55
+ `, d = 16, Mt = at(function({
56
+ children: a,
58
57
  anchorRef: s,
59
- open: w,
60
- onClose: c,
61
- spacing: y = 4,
62
- transitionDuration: I = 200,
63
- onChange: x,
64
- value: A,
65
- showDivider: B,
66
- placement: K = "bottom-center",
67
- disablePadding: G,
68
- disableClickOutside: C = !0,
69
- width: M,
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: U = 476,
72
- style: V,
73
- inlineCSS: _,
74
- menuProps: J,
75
- ...Q
76
- }, X) {
77
- const [g, P] = l(0), [D, L] = l(0), [h, Y] = l(0), [O, q] = l(!1), [Z, R] = l(!1), [tt, F] = l(!0), [ot, a] = l(null), b = z(), m = z(), k = z(null), { isKeyboardMode: et } = pt(), it = (t, e) => (n) => {
78
- n.stopPropagation(), typeof c == "function" && c(), typeof x == "function" && x(t, n), typeof e == "function" && e(n);
79
- }, rt = (t) => (e) => {
80
- var r, d, u, f;
81
- if (e.key === "Tab" && typeof c == "function" && (c(), a(0)), (e.key === "Enter" || e.key === " ") && typeof c == "function" && typeof x == "function" && (c(), x(t, e), s != null && s.current)) {
82
- const i = s.current.querySelector("button");
83
- i && et && i.focus();
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 n = document.activeElement;
86
- if (n) {
85
+ const u = document.activeElement;
86
+ if (u) {
87
87
  if (e.code === "ArrowDown") {
88
- const i = j(n, "next", { skipDisabled: !0 });
89
- i && i.dataset.index ? (a(Number(i.dataset.index)), i.focus()) : (a(0), (d = (r = k.current) == null ? void 0 : r.querySelector('[role="menuitem"]')) == null || d.focus());
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 i = j(n, "prev", { skipDisabled: !0 });
93
- i && i.dataset.index ? (a(Number(i.dataset.index)), i.focus()) : (a(H.count(p) - 1), (f = (u = k.current) == null ? void 0 : u.querySelector('[role="menuitem"]:last-child')) == null || f.focus());
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 v(() => {
98
- w && (m.current && clearTimeout(m.current), document.body.style.overflow = "hidden", F(!1), b.current = setTimeout(() => {
99
- q(!0);
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
- }, [w]), v(() => {
102
- w || (b.current && clearTimeout(b.current), q(!1), document.body.removeAttribute("style"), m.current = setTimeout(() => {
103
- F(!0), a(0);
104
- }, I));
105
- }, [w, I]), v(() => {
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 N;
108
- const { offsetWidth: e = 0, offsetHeight: n = 0 } = (s == null ? void 0 : s.current) || {}, r = ((N = s == null ? void 0 : s.current) == null ? void 0 : N.getBoundingClientRect()) || {
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: d = 0, offsetHeight: u = 0 } = k.current || {}, [f, i] = K.split("-");
113
- Y(M || e);
114
- const E = (r.top || 0) - u - y - S < S, st = (r.bottom || 0) + u + y + S > window.innerHeight;
115
- switch (f) {
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
- P(
118
- E ? S : r.top - u - y
117
+ j(
118
+ S ? d : i.top - c - m
119
119
  );
120
120
  break;
121
121
  default:
122
- P(st ? "auto" : r.top + n + y);
122
+ j(dt ? "auto" : i.top + u + m);
123
123
  break;
124
124
  }
125
- switch (i) {
125
+ switch (r) {
126
126
  case "left":
127
- L(r.left);
127
+ K(C ? "auto" : i.left), B(C ? d : "auto");
128
128
  break;
129
129
  case "right":
130
- L(r.left - Math.abs(e - d));
130
+ K(
131
+ U ? d : i.left + e - n
132
+ ), B(U ? "auto" : i.left);
131
133
  break;
132
134
  default:
133
- L(r.left + e / 2 - d / 2);
135
+ K(i.left + e / 2 - n / 2);
134
136
  break;
135
137
  }
136
138
  };
137
- return t(), window.addEventListener("scroll", t), window.addEventListener("resize", t), () => {
138
- window.removeEventListener("scroll", t), window.removeEventListener("resize", t);
139
+ return t(), window.addEventListener("resize", t), () => {
140
+ window.removeEventListener("resize", t);
139
141
  };
140
- }, [s, y, K, O, p, M]), v(() => {
141
- R(O && !!g && !!D && !!h);
142
- }, [O, g, D, h]), v(() => () => {
143
- b.current && clearTimeout(b.current), m.current && clearTimeout(m.current);
144
- }, []), tt ? null : lt(
145
- /* @__PURE__ */ $(at, { onClick: c, disableClickOutside: C, children: /* @__PURE__ */ $(
146
- yt,
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: X,
149
- open: Z,
150
- transitionDuration: I,
151
- ...Q,
152
- css: _,
150
+ ref: tt,
151
+ open: rt,
152
+ transitionDuration: M,
153
+ ...R,
154
+ css: Z,
153
155
  style: {
154
- ...V,
156
+ ...Y,
155
157
  top: g,
156
- left: D,
157
- bottom: g === "auto" ? 24 : void 0,
158
- width: W ? h : void 0
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
- bt,
164
+ children: /* @__PURE__ */ T(
165
+ ht,
162
166
  {
163
167
  role: "menu",
164
- ref: k,
165
- disablePadding: G,
166
- maxHeight: U,
167
- ...J,
168
- children: H.map(p, (t, e) => {
169
- var r, d, u, f, i, E;
170
- if (!ct(t))
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 n = ot === e;
173
- return /* @__PURE__ */ nt(ut, { children: [
174
- ft(t, {
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: !!((r = t == null ? void 0 : t.props) != null && r.value) && ((d = t == null ? void 0 : t.props) == null ? void 0 : d.value) === A,
180
- onClick: it((u = t == null ? void 0 : t.props) == null ? void 0 : u.value, (f = t == null ? void 0 : t.props) == null ? void 0 : f.onClick),
181
- onKeyDown: rt((i = t == null ? void 0 : t.props) == null ? void 0 : i.value),
182
- tabIndex: n ? 0 : -1,
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
- ...(E = t == null ? void 0 : t.props) == null ? void 0 : E.style,
185
- [M ? "width" : "minWidth"]: W ? void 0 : h,
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
- B && H.count(p) !== e + 1 && /* @__PURE__ */ $(mt, {})
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
- Et as default
204
+ Mt as default
201
205
  };
@@ -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 MaxHeight: Story;
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"),w=require("react"),y=require("../../Icon/Icon.cjs"),v=require("../../hooks/useCheckHoverPossible/useCheckHoverPossible.cjs"),S=require("@emotion/styled"),j=e=>e&&e.__esModule?e:{default:e},u=j(S),$=u.default.li`
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:n}},selected:t,disabled:r})=>t?e.primary.main:r?n[30]:"inherit"};
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
- ${({ellipsis:e})=>e?{maxHeight:"40px"}:{}};
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
- ${({ellipsis:e})=>e?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:{}};
20
+ ${({lineClamp:e})=>e?{display:"-webkit-box",overflow:"hidden",WebkitLineClamp:e,WebkitBoxOrient:"vertical"}:null}
23
21
 
24
- ${({theme:{palette:{brand:e,grey:n},typography:{h5B:t,b4R:r}},selected:a,disabled:o})=>{let i={fontSize:r.size,fontWeight:r.weight,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight};return a&&(i={fontSize:t.size,fontWeight:t.weight,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,color:e.primary.text}),o&&(i.color=n[30]),i}}}
25
- `,c=u.default.div`
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
- `,H=w.forwardRef(function({children:n,startAdornment:t,endAdornment:r,inlineCSS:a,selected:o,disabled:i,value:d,onClick:s,ellipsis:p=!0,...h},g){const{isHoverPossible:x}=v.default(),m=f=>{f.stopPropagation(),!i&&typeof s=="function"&&s(f)};return l.jsxs($,{ref:g,selected:o,disabled:i,"data-value":d,isHoverPossible:x,onClick:m,ellipsis:p,role:"menuitem",...h,css:a,children:[t&&l.jsx(c,{children:t}),l.jsx(k,{selected:o,disabled:i,ellipsis:p,children:n}),!o&&r&&l.jsx(c,{children:r}),o&&l.jsx(c,{children:l.jsx(y.default,{name:"CheckLine",color:"primary"})})]})});exports.default=H;
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 w } from "react";
3
- import y from "../../Icon/Icon.es.js";
4
- import k from "../../hooks/useCheckHoverPossible/useCheckHoverPossible.es.js";
5
- import c from "@emotion/styled";
6
- const v = c.li`
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: i }
24
+ palette: { brand: e, grey: r }
25
25
  },
26
26
  selected: t,
27
- disabled: r
28
- }) => t ? e.primary.main : r ? i[30] : "inherit"};
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: i }
33
+ palette: { brand: e, grey: r }
38
34
  },
39
35
  selected: t,
40
- isHoverPossible: r
41
- }) => r ? {
36
+ isHoverPossible: i
37
+ }) => i ? {
42
38
  "&:hover:not([disabled]), &:focus:not([disabled])": {
43
- backgroundColor: t ? e.primary.bg : i[10]
39
+ backgroundColor: t ? e.primary.bg : r[10]
44
40
  }
45
41
  } : {}}
46
- `, $ = c.div`
42
+ `, b = p.div`
47
43
  flex-grow: 1;
48
44
 
49
- ${({ ellipsis: e }) => e ? {
45
+ ${({ lineClamp: e }) => e ? {
46
+ display: "-webkit-box",
50
47
  overflow: "hidden",
51
- textOverflow: "ellipsis",
52
- whiteSpace: "nowrap"
53
- } : {}};
48
+ WebkitLineClamp: e,
49
+ WebkitBoxOrient: "vertical"
50
+ } : null}
54
51
 
55
52
  ${({
56
53
  theme: {
57
- palette: { brand: e, grey: i },
58
- typography: { h5B: t, b4R: r }
54
+ palette: { brand: e, grey: r },
55
+ typography: { h5B: t, b4R: i }
59
56
  },
60
- selected: p,
57
+ selected: c,
61
58
  disabled: n
62
59
  }) => {
63
60
  let o = {
64
- fontSize: r.size,
65
- fontWeight: r.weight,
66
- letterSpacing: r.letterSpacing,
67
- lineHeight: r.lineHeight
61
+ fontSize: i.size,
62
+ fontWeight: i.weight,
63
+ letterSpacing: i.letterSpacing,
64
+ lineHeight: i.lineHeight
68
65
  };
69
- return p && (o = {
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 = i[30]), o;
72
+ }), n && (o.color = r[30]), o;
76
73
  }}}
77
- `, a = c.div`
74
+ `, a = p.div`
78
75
  white-space: nowrap;
79
- `, M = w(function({
80
- children: i,
76
+ `, j = k(function({
77
+ children: r,
81
78
  startAdornment: t,
82
- endAdornment: r,
83
- inlineCSS: p,
79
+ endAdornment: i,
80
+ inlineCSS: c,
84
81
  selected: n,
85
82
  disabled: o,
86
- value: u,
87
- onClick: h,
88
- ellipsis: f = !0,
83
+ value: g,
84
+ onClick: s,
85
+ lineClamp: h = 1,
89
86
  ...m
90
- }, g) {
91
- const { isHoverPossible: d } = k();
87
+ }, u) {
88
+ const { isHoverPossible: d } = y();
92
89
  return /* @__PURE__ */ x(
93
90
  v,
94
91
  {
95
- ref: g,
92
+ ref: u,
96
93
  selected: n,
97
94
  disabled: o,
98
- "data-value": u,
95
+ "data-value": g,
99
96
  isHoverPossible: d,
100
- onClick: (s) => {
101
- s.stopPropagation(), !o && typeof h == "function" && h(s);
97
+ onClick: (f) => {
98
+ f.stopPropagation(), !o && typeof s == "function" && s(f);
102
99
  },
103
- ellipsis: f,
100
+ lineClamp: h,
104
101
  role: "menuitem",
105
102
  ...m,
106
- css: p,
103
+ css: c,
107
104
  children: [
108
105
  t && /* @__PURE__ */ l(a, { children: t }),
109
- /* @__PURE__ */ l($, { selected: n, disabled: o, ellipsis: f, children: i }),
110
- !n && r && /* @__PURE__ */ l(a, { children: r }),
111
- n && /* @__PURE__ */ l(a, { children: /* @__PURE__ */ l(y, { name: "CheckLine", color: "primary" }) })
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
- M as default
114
+ j as default
118
115
  };
@@ -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"),O=require("@emotion/styled"),_=t=>t&&t.__esModule?t:{default:t},f=_(O),T=f.default.div`
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
- `,V=f.default.div`
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:e,background:o,etc:n}},variant:g,helper:s})=>{let r={backgroundColor:e.white,borderColor:e[50],color:e[100]};switch(g){case"outlined":(s==null?void 0:s.severity)==="success"&&(r={...r,borderColor:`${t[70]} !important`}),(s==null?void 0:s.severity)==="error"&&(r={...r,borderColor:`${n.red} !important`});break;case"filled":r={backgroundColor:o.primary};break}return r}};
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:e})=>{let o={maxHeight:48,padding:`${t.content(3)}px ${t.content(4)}px`,borderRadius:10};switch(e){case"2xLarge":o={maxHeight:80,padding:`${t.content(4)}px ${t.content(5)}px`,borderRadius:12,"& svg":{width:48,height:48}};break;case"xLarge":o={maxHeight:56,padding:t.content(4),borderRadius:12};break}return o}};
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:e,focus:o})=>e==="outlined"&&o?{borderColor:t.primary.line}:null};
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:e,disabled:o})=>{if(!o)return null;let n={backgroundColor:t[10],borderColor:t[30]};switch(e){case"filled":n={backgroundColor:t[10]};break}return n}}
22
- `,M=f.default.input`
23
- width: inherit;
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:e}},inputSize:o})=>o==="2xLarge"?{fontSize:e.size,fontWeight:e.weight,lineHeight:e.lineHeight,letterSpacing:e.letterSpacing}:{fontSize:t.size,fontWeight:t.weight,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing}};
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:e})=>({color:t[50]})};
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
- `,q=f.default.button`
47
+ `,E=f.default.button`
48
48
  &:empty {
49
49
  display: none;
50
50
  }
51
- `,E=f.default.div`
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:e}},inputSize:o})=>o==="2xLarge"?{fontSize:e.size,fontWeight:e.weight,lineHeight:e.lineHeight,letterSpacing:e.letterSpacing}:{fontSize:t.size,fontWeight:t.weight,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing}};
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:e}},helper:o})=>{const n={color:e[100]};return(o==null?void 0:o.severity)==="error"?{color:t.red}:n}}
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
- `,W=u.forwardRef(function({type:e="text",variant:o="outlined",size:n="large",startAdornment:g,endAdornment:s,fullWidth:r,helper:i,disabled:x,inlineCSS:w,onFocus:y,onBlur:m,disablePasswordVisibility:S,helperProps:$,...j},k){const C=u.useId(),p=u.useId(),[H,v]=u.useState(!1),[d,I]=u.useState(!1),a=!S&&!s&&e==="password"&&(i==null?void 0:i.severity)!=="success",L=l=>{v(!0),typeof y=="function"&&y(l)},z=l=>{v(!1),typeof m=="function"&&m(l)},F=()=>I(l=>!l),h=()=>a&&d?"text":a&&!d?"password":e;return c.jsxs(T,{fullWidth:r,children:[c.jsxs(V,{variant:o,size:n,focus:H,fullWidth:r,helper:i,disabled:x,css:w,children:[g,c.jsx(M,{ref:k,id:C,type:h(),variant:o,inputSize:n,disabled:x,"aria-invalid":(i==null?void 0:i.severity)==="error","aria-describedby":i!=null&&i.message?p:void 0,...j,onFocus:L,onBlur:z}),s,!s&&(i==null?void 0:i.severity)==="success"&&c.jsx(b.default,{name:"CheckLine",color:"green.70","aria-label":"성공",role:"img"}),c.jsxs(q,{type:"button",tabIndex:a?0:-1,"aria-pressed":a?d:void 0,onClick:F,"aria-hidden":!a,"aria-label":a&&d?"비밀번호 표시됨":"비밀번호 숨김됨",children:[a&&d&&c.jsx(b.default,{name:"EyeVisibleLine","data-testid":"EyeVisibleLine",inlineCSS:{cursor:"pointer"}}),a&&!d&&c.jsx(b.default,{name:"EyeInvisibleLine","data-testid":"EyeInvisibleLine",inlineCSS:{cursor:"pointer"}})]})]}),c.jsx(E,{id:p,className:"textfield-helper","aria-live":(i==null?void 0:i.severity)==="error"?"assertive":"off",role:(i==null?void 0:i.severity)==="error"?"alert":"status",helper:i,inputSize:n,"data-testid":"helper",...$,children:i==null?void 0:i.message})]})});exports.default=W;
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 T, useId as v, useState as S } from "react";
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 V = u.div`
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
- `, E = u.div`
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: e, background: o, etc: n }
19
+ palette: { green: t, grey: i, background: o, etc: n }
20
20
  },
21
21
  variant: f,
22
- helper: r
22
+ helper: s
23
23
  }) => {
24
- let s = {
25
- backgroundColor: e.white,
26
- borderColor: e[50],
27
- color: e[100]
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
- (r == null ? void 0 : r.severity) === "success" && (s = {
32
- ...s,
31
+ (s == null ? void 0 : s.severity) === "success" && (r = {
32
+ ...r,
33
33
  borderColor: `${t[70]} !important`
34
- }), (r == null ? void 0 : r.severity) === "error" && (s = {
35
- ...s,
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
- s = {
40
+ r = {
41
41
  backgroundColor: o.primary
42
42
  };
43
43
  break;
44
44
  }
45
- return s;
45
+ return r;
46
46
  }};
47
47
 
48
- ${({ theme: { spacing: t }, size: e }) => {
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 (e) {
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: e,
81
+ variant: i,
82
82
  focus: o
83
- }) => e === "outlined" && o ? {
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: e,
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 (e) {
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
- `, W = u.input`
111
- width: inherit;
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: e }
119
+ typography: { b2R: t, h0R: i }
120
120
  },
121
121
  inputSize: o
122
122
  }) => o === "2xLarge" ? {
123
- fontSize: e.size,
124
- fontWeight: e.weight,
125
- lineHeight: e.lineHeight,
126
- letterSpacing: e.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: e
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
- `, B = u.button`
166
+ `, M = u.button`
167
167
  &:empty {
168
168
  display: none;
169
169
  }
170
- `, M = u.div`
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: e }
177
+ typography: { c3R: t, b1R: i }
178
178
  },
179
179
  inputSize: o
180
180
  }) => o === "2xLarge" ? {
181
- fontSize: e.size,
182
- fontWeight: e.weight,
183
- lineHeight: e.lineHeight,
184
- letterSpacing: e.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: e }
194
+ palette: { etc: t, grey: i }
195
195
  },
196
196
  helper: o
197
197
  }) => {
198
198
  const n = {
199
- color: e[100]
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 = T(function({
210
- type: e = "text",
209
+ `, J = V(function({
210
+ type: i = "text",
211
211
  variant: o = "outlined",
212
212
  size: n = "large",
213
213
  startAdornment: f,
214
- endAdornment: r,
215
- fullWidth: s,
216
- helper: i,
214
+ endAdornment: s,
215
+ fullWidth: r,
216
+ helper: e,
217
217
  disabled: m,
218
218
  inlineCSS: $,
219
- onFocus: x,
220
- onBlur: y,
219
+ onFocus: y,
220
+ onBlur: x,
221
221
  disablePasswordVisibility: k,
222
222
  helperProps: C,
223
223
  ...H
224
224
  }, L) {
225
- const j = v(), p = v(), [z, w] = S(!1), [c, I] = S(!1), a = !k && !r && e === "password" && (i == null ? void 0 : i.severity) !== "success", F = (d) => {
226
- w(!0), typeof x == "function" && x(d);
227
- }, h = (d) => {
228
- w(!1), typeof y == "function" && y(d);
229
- }, O = () => I((d) => !d);
230
- return /* @__PURE__ */ g(V, { fullWidth: s, children: [
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
- E,
232
+ W,
233
233
  {
234
234
  variant: o,
235
235
  size: n,
236
236
  focus: z,
237
- fullWidth: s,
238
- helper: i,
237
+ fullWidth: r,
238
+ helper: e,
239
239
  disabled: m,
240
240
  css: $,
241
241
  children: [
242
242
  f,
243
243
  /* @__PURE__ */ l(
244
- W,
244
+ B,
245
245
  {
246
246
  ref: L,
247
247
  id: j,
248
- type: a && c ? "text" : a && !c ? "password" : e,
248
+ type: a && c ? "text" : a && !c ? "password" : i,
249
249
  variant: o,
250
250
  inputSize: n,
251
251
  disabled: m,
252
- "aria-invalid": (i == null ? void 0 : i.severity) === "error",
253
- "aria-describedby": i != null && i.message ? p : void 0,
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: h
256
+ onBlur: O
257
257
  }
258
258
  ),
259
- r,
260
- !r && (i == null ? void 0 : i.severity) === "success" && /* @__PURE__ */ l(b, { name: "CheckLine", color: "green.70", "aria-label": "성공", role: "img" }),
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
- B,
262
+ M,
263
263
  {
264
264
  type: "button",
265
265
  tabIndex: a ? 0 : -1,
266
266
  "aria-pressed": a ? c : void 0,
267
- onClick: O,
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
- M,
298
+ P,
299
299
  {
300
300
  id: p,
301
301
  className: "textfield-helper",
302
- "aria-live": (i == null ? void 0 : i.severity) === "error" ? "assertive" : "off",
303
- role: (i == null ? void 0 : i.severity) === "error" ? "alert" : "status",
304
- helper: i,
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: i == null ? void 0 : i.message
308
+ children: e == null ? void 0 : e.message
309
309
  }
310
310
  )
311
311
  ] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotss/ui",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "React UI components for Dotss",
5
5
  "type": "module",
6
6
  "main": "./index.cjs",