@dotss/ui 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Menu/Menu.cjs CHANGED
@@ -1,4 +1,4 @@
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("react-dom"),dt=require("../hooks/useCheckKeyboardMode/useCheckKeyboardMode.cjs"),G=require("../utils/getSibling/getSibling.cjs"),ft=require("@emotion/styled"),lt=e=>e&&e.__esModule?e:{default:e},M=lt(ft),at=M.default.div`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("@emotion/react/jsx-runtime"),s=require("react"),ft=require("react-dom"),dt=require("../hooks/useCheckKeyboardMode/useCheckKeyboardMode.cjs"),H=require("../utils/getSibling/getSibling.cjs"),at=require("@emotion/styled"),lt=e=>e&&e.__esModule?e:{default:e},M=lt(at),pt=M.default.div`
2
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;
@@ -8,7 +8,7 @@
8
8
 
9
9
  ${({disableClickOutside:e})=>e?null:{pointerEvents:"none","& *":{pointerEvents:"auto"}}}}
10
10
 
11
- `,pt=M.default.div`
11
+ `,yt=M.default.div`
12
12
  position: fixed;
13
13
  max-width: calc(100% - ${({theme:{spacing:e}})=>e.layout(4)}px);
14
14
  overflow-y: auto;
@@ -21,14 +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
- `,yt=M.default.ul`
24
+ `,vt=M.default.ul`
25
25
  display: flex;
26
26
  flex-direction: column;
27
27
  max-height: ${({maxHeight:e})=>e}px;
28
28
 
29
- ${({theme:{spacing:e},disablePadding:p})=>p?null:{padding:`${e.content(1)}px 0`}}}
29
+ ${({theme:{spacing:e},disablePadding:y})=>y?null:{padding:`${e.content(1)}px 0`}}}
30
30
  `,bt=M.default.div`
31
31
  width: 100%;
32
32
  height: 1px;
33
33
  background-color: ${({theme:{palette:{grey:e}}})=>e[20]};
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}=dt.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:ct.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;
34
+ `,a=16,wt=s.forwardRef(function({children:y,anchorRef:i,open:h,onClose:f,spacing:b=4,transitionDuration:T=200,onChange:m,value:C,showDivider:U,placement:z="bottom-center",disablePadding:V=!1,disableClickOutside:J=!0,disableAutoPositioning:w=!1,width:q,fitToAnchorWidth:I=!0,maxHeight:O=476,style:Q,inlineCSS:X,menuProps:Y,...Z},A){const[k,K]=s.useState(0),[_,j]=s.useState("auto"),[R,L]=s.useState("auto"),[E,tt]=s.useState(0),[W,P]=s.useState(!1),[et,ot]=s.useState(!1),[st,B]=s.useState(!0),[ut,l]=s.useState(null),x=s.useRef(),g=s.useRef(),S=s.useRef(null),{isKeyboardMode:rt}=dt.default(),$=()=>{i!=null&&i.current&&rt&&i.current.focus()},it=(t,o)=>n=>{n.stopPropagation(),typeof f=="function"&&f(),typeof m=="function"&&m(t,n),typeof o=="function"&&o(n),$()},nt=t=>o=>{var u,c,d,p;o.key==="Tab"&&typeof f=="function"&&(o.preventDefault(),o.stopPropagation(),f(),l(0),$()),(o.key==="Enter"||o.key===" ")&&typeof f=="function"&&typeof m=="function"&&(o.preventDefault(),o.stopPropagation(),f(),m(t,o),$()),o.key==="Escape"&&typeof f=="function"&&(o.preventDefault(),o.stopPropagation(),f(),l(0),$());const n=document.activeElement;if(n){if(o.code==="ArrowDown"){const r=H.default(n,"next",{skipDisabled:!0});r&&r.dataset.index?(l(Number(r.dataset.index)),r.focus()):(l(0),(c=(u=S.current)==null?void 0:u.querySelector('[role="menuitem"]'))==null||c.focus())}if(o.code==="ArrowUp"){const r=H.default(n,"prev",{skipDisabled:!0});r&&r.dataset.index?(l(Number(r.dataset.index)),r.focus()):(l(s.Children.count(y)-1),(p=(d=S.current)==null?void 0:d.querySelector('[role="menuitem"]:last-child'))==null||p.focus())}}};return s.useEffect(()=>{h&&(g.current&&clearTimeout(g.current),document.body.style.overflow="hidden",B(!1),x.current=setTimeout(()=>{P(!0)},100))},[h]),s.useEffect(()=>{h||(x.current&&clearTimeout(x.current),P(!1),document.body.removeAttribute("style"),g.current=setTimeout(()=>{B(!0),l(0)},T))},[h,T]),s.useEffect(()=>{const t=()=>{var G;const{offsetWidth:o=0,offsetHeight:n=0}=(i==null?void 0:i.current)||{},u=((G=i==null?void 0:i.current)==null?void 0:G.getBoundingClientRect())||{top:0,left:0,bottom:0},{offsetWidth:c=0,offsetHeight:d=0}=S.current||{},[p,r]=z.split("-");tt(q||o);const D=u.top-d-b<a&&!w,ct=u.bottom+d+b+a>window.innerHeight&&!w,F=u.left+c+a>window.innerWidth&&!w,N=u.left+o-c<a&&!w;switch(p){case"top":K(D?a:u.top-d-b);break;default:K(ct?"auto":u.top+n+b);break}switch(r){case"left":j(F?"auto":u.left),L(F?a:"auto");break;case"right":j(N?a:u.left+o-c),L(N?"auto":u.left);break;default:j(u.left+o/2-c/2);break}};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[i,b,z,W,y,q,w,O]),s.useEffect(()=>{ot(W&&!!k&&!!_&&!!E)},[W,k,_,E]),s.useEffect(()=>()=>{x.current&&clearTimeout(x.current),g.current&&clearTimeout(g.current)},[]),st?null:ft.createPortal(v.jsx(pt,{onClick:f,disableClickOutside:J,children:v.jsx(yt,{ref:A,open:et,transitionDuration:T,...Z,css:X,style:{...Q,top:k,left:_,bottom:k==="auto"?a:void 0,right:R,width:I?E:void 0,maxHeight:O},children:v.jsx(vt,{role:"menu",ref:S,disablePadding:V,maxHeight:O,...Y,children:s.Children.map(y,(t,o)=>{var u,c,d,p,r,D;if(!s.isValidElement(t))return null;const n=ut===o;return v.jsxs(v.Fragment,{children:[s.cloneElement(t,{...t.props,"data-index":o,selected:!!((u=t==null?void 0:t.props)!=null&&u.value)&&((c=t==null?void 0:t.props)==null?void 0:c.value)===C,onClick:it((d=t==null?void 0:t.props)==null?void 0:d.value,(p=t==null?void 0:t.props)==null?void 0:p.onClick),onKeyDown:nt((r=t==null?void 0:t.props)==null?void 0:r.value),tabIndex:n?0:-1,style:{...(D=t==null?void 0:t.props)==null?void 0:D.style,[q?"width":"minWidth"]:I?void 0:E,maxWidth:I?void 0:"100%"}}),U&&s.Children.count(y)!==o+1&&v.jsx(bt,{})]})})})})}),document.body)});exports.default=wt;
package/Menu/Menu.es.js CHANGED
@@ -1,10 +1,10 @@
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 { createPortal as bt } from "react-dom";
4
- import vt from "../hooks/useCheckKeyboardMode/useCheckKeyboardMode.es.js";
5
- import _ from "../utils/getSibling/getSibling.es.js";
6
- import I from "@emotion/styled";
7
- const wt = I.div`
1
+ import { jsx as I, jsxs as at, Fragment as lt } from "@emotion/react/jsx-runtime";
2
+ import { forwardRef as yt, useState as d, useRef as F, useEffect as x, Children as N, isValidElement as vt, cloneElement as mt } from "react";
3
+ import { createPortal as wt } from "react-dom";
4
+ import bt from "../hooks/useCheckKeyboardMode/useCheckKeyboardMode.es.js";
5
+ import J from "../utils/getSibling/getSibling.es.js";
6
+ import S from "@emotion/styled";
7
+ const xt = S.div`
8
8
  position: fixed;
9
9
  top: 0;
10
10
  left: 0;
@@ -12,185 +12,184 @@ const wt = I.div`
12
12
  height: 100%;
13
13
  z-index: 100003;
14
14
 
15
- ${({ disableClickOutside: o }) => o ? null : {
15
+ ${({ disableClickOutside: e }) => e ? null : {
16
16
  pointerEvents: "none",
17
17
  "& *": {
18
18
  pointerEvents: "auto"
19
19
  }
20
20
  }}}
21
21
 
22
- `, xt = I.div`
22
+ `, gt = S.div`
23
23
  position: fixed;
24
- max-width: calc(100% - ${({ theme: { spacing: o } }) => o.layout(4)}px);
24
+ max-width: calc(100% - ${({ theme: { spacing: e } }) => e.layout(4)}px);
25
25
  overflow-y: auto;
26
26
  border-radius: 10px;
27
27
  background-color: ${({
28
28
  theme: {
29
- palette: { grey: o }
29
+ palette: { grey: e }
30
30
  }
31
- }) => o.white};
32
- box-shadow: ${({ theme: { elevation: o } }) => o[4]};
31
+ }) => e.white};
32
+ box-shadow: ${({ theme: { elevation: e } }) => e[4]};
33
33
  transition:
34
- transform ${({ transitionDuration: o }) => o}ms,
35
- opacity ${({ transitionDuration: o = 0 }) => o / 2}ms;
36
- transform: scale(${({ open: o }) => o ? 1 : 0.97});
37
- opacity: ${({ open: o }) => o ? 1 : 0};
34
+ transform ${({ transitionDuration: e }) => e}ms,
35
+ opacity ${({ transitionDuration: e = 0 }) => e / 2}ms;
36
+ transform: scale(${({ open: e }) => e ? 1 : 0.97});
37
+ opacity: ${({ open: e }) => e ? 1 : 0};
38
38
  z-index: 100003;
39
- `, ht = I.ul`
39
+ `, ht = S.ul`
40
40
  display: flex;
41
41
  flex-direction: column;
42
- max-height: ${({ maxHeight: o }) => o}px;
42
+ max-height: ${({ maxHeight: e }) => e}px;
43
43
 
44
- ${({ theme: { spacing: o }, disablePadding: a }) => a ? null : {
45
- padding: `${o.content(1)}px 0`
44
+ ${({ theme: { spacing: e }, disablePadding: y }) => y ? null : {
45
+ padding: `${e.content(1)}px 0`
46
46
  }}}
47
- `, kt = I.div`
47
+ `, kt = S.div`
48
48
  width: 100%;
49
49
  height: 1px;
50
50
  background-color: ${({
51
51
  theme: {
52
- palette: { grey: o }
52
+ palette: { grey: e }
53
53
  }
54
- }) => o[20]};
55
- `, d = 16, Mt = at(function({
56
- children: a,
54
+ }) => e[20]};
55
+ `, p = 16, Mt = yt(function({
56
+ children: y,
57
57
  anchorRef: s,
58
- open: h,
59
- onClose: p,
60
- spacing: m = 4,
58
+ open: g,
59
+ onClose: c,
60
+ spacing: v = 4,
61
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,
62
+ onChange: h,
63
+ value: Q,
64
+ showDivider: X,
65
+ placement: P = "bottom-center",
66
+ disablePadding: Y = !1,
67
+ disableClickOutside: Z = !0,
68
+ disableAutoPositioning: m = !1,
69
69
  width: O,
70
70
  fitToAnchorWidth: W = !0,
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 } = vt(), 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
- }
71
+ maxHeight: z = 476,
72
+ style: A,
73
+ inlineCSS: C,
74
+ menuProps: R,
75
+ ...tt
76
+ }, ot) {
77
+ const [k, j] = d(0), [K, L] = d("auto"), [et, q] = d("auto"), [E, rt] = d(0), [B, G] = d(!1), [it, st] = d(!1), [ut, H] = d(!0), [nt, a] = d(null), w = F(), b = F(), $ = F(null), { isKeyboardMode: ct } = bt(), T = () => {
78
+ s != null && s.current && ct && s.current.focus();
79
+ }, ft = (t, o) => (u) => {
80
+ u.stopPropagation(), typeof c == "function" && c(), typeof h == "function" && h(t, u), typeof o == "function" && o(u), T();
81
+ }, dt = (t) => (o) => {
82
+ var r, n, f, l;
83
+ o.key === "Tab" && typeof c == "function" && (o.preventDefault(), o.stopPropagation(), c(), a(0), T()), (o.key === "Enter" || o.key === " ") && typeof c == "function" && typeof h == "function" && (o.preventDefault(), o.stopPropagation(), c(), h(t, o), T()), o.key === "Escape" && typeof c == "function" && (o.preventDefault(), o.stopPropagation(), c(), a(0), T());
85
84
  const u = document.activeElement;
86
85
  if (u) {
87
- if (e.code === "ArrowDown") {
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());
86
+ if (o.code === "ArrowDown") {
87
+ const i = J(u, "next", { skipDisabled: !0 });
88
+ i && i.dataset.index ? (a(Number(i.dataset.index)), i.focus()) : (a(0), (n = (r = $.current) == null ? void 0 : r.querySelector('[role="menuitem"]')) == null || n.focus());
90
89
  }
91
- if (e.code === "ArrowUp") {
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());
90
+ if (o.code === "ArrowUp") {
91
+ const i = J(u, "prev", { skipDisabled: !0 });
92
+ i && i.dataset.index ? (a(Number(i.dataset.index)), i.focus()) : (a(N.count(y) - 1), (l = (f = $.current) == null ? void 0 : f.querySelector('[role="menuitem"]:last-child')) == null || l.focus());
94
93
  }
95
94
  }
96
95
  };
97
96
  return x(() => {
98
- h && (w.current && clearTimeout(w.current), document.body.style.overflow = "hidden", H(!1), v.current = setTimeout(() => {
97
+ g && (b.current && clearTimeout(b.current), document.body.style.overflow = "hidden", H(!1), w.current = setTimeout(() => {
99
98
  G(!0);
100
99
  }, 100));
101
- }, [h]), x(() => {
102
- h || (v.current && clearTimeout(v.current), G(!1), document.body.removeAttribute("style"), w.current = setTimeout(() => {
103
- H(!0), y(0);
100
+ }, [g]), x(() => {
101
+ g || (w.current && clearTimeout(w.current), G(!1), document.body.removeAttribute("style"), b.current = setTimeout(() => {
102
+ H(!0), a(0);
104
103
  }, M));
105
- }, [h, M]), x(() => {
104
+ }, [g, M]), x(() => {
106
105
  const t = () => {
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()) || {
106
+ var _;
107
+ const { offsetWidth: o = 0, offsetHeight: u = 0 } = (s == null ? void 0 : s.current) || {}, r = ((_ = s == null ? void 0 : s.current) == null ? void 0 : _.getBoundingClientRect()) || {
109
108
  top: 0,
110
109
  left: 0,
111
110
  bottom: 0
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;
111
+ }, { offsetWidth: n = 0, offsetHeight: f = 0 } = $.current || {}, [l, i] = P.split("-");
112
+ rt(O || o);
113
+ const D = r.top - f - v < p && !m, pt = r.bottom + f + v + p > window.innerHeight && !m, U = r.left + n + p > window.innerWidth && !m, V = r.left + o - n < p && !m;
115
114
  switch (l) {
116
115
  case "top":
117
116
  j(
118
- S ? d : i.top - c - m
117
+ D ? p : r.top - f - v
119
118
  );
120
119
  break;
121
120
  default:
122
- j(dt ? "auto" : i.top + u + m);
121
+ j(pt ? "auto" : r.top + u + v);
123
122
  break;
124
123
  }
125
- switch (r) {
124
+ switch (i) {
126
125
  case "left":
127
- K(C ? "auto" : i.left), B(C ? d : "auto");
126
+ L(U ? "auto" : r.left), q(U ? p : "auto");
128
127
  break;
129
128
  case "right":
130
- K(
131
- U ? d : i.left + e - n
132
- ), B(U ? "auto" : i.left);
129
+ L(
130
+ V ? p : r.left + o - n
131
+ ), q(V ? "auto" : r.left);
133
132
  break;
134
133
  default:
135
- K(i.left + e / 2 - n / 2);
134
+ L(r.left + o / 2 - n / 2);
136
135
  break;
137
136
  }
138
137
  };
139
138
  return t(), window.addEventListener("resize", t), () => {
140
139
  window.removeEventListener("resize", t);
141
140
  };
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 : bt(
147
- /* @__PURE__ */ T(wt, { onClick: p, disableClickOutside: X, children: /* @__PURE__ */ T(
148
- xt,
141
+ }, [s, v, P, B, y, O, m, z]), x(() => {
142
+ st(B && !!k && !!K && !!E);
143
+ }, [B, k, K, E]), x(() => () => {
144
+ w.current && clearTimeout(w.current), b.current && clearTimeout(b.current);
145
+ }, []), ut ? null : wt(
146
+ /* @__PURE__ */ I(xt, { onClick: c, disableClickOutside: Z, children: /* @__PURE__ */ I(
147
+ gt,
149
148
  {
150
- ref: tt,
151
- open: rt,
149
+ ref: ot,
150
+ open: it,
152
151
  transitionDuration: M,
153
- ...R,
154
- css: Z,
152
+ ...tt,
153
+ css: C,
155
154
  style: {
156
- ...Y,
157
- top: g,
158
- left: z,
159
- bottom: g === "auto" ? d : void 0,
160
- right: ot,
155
+ ...A,
156
+ top: k,
157
+ left: K,
158
+ bottom: k === "auto" ? p : void 0,
159
+ right: et,
161
160
  width: W ? E : void 0,
162
- maxHeight: D
161
+ maxHeight: z
163
162
  },
164
- children: /* @__PURE__ */ T(
163
+ children: /* @__PURE__ */ I(
165
164
  ht,
166
165
  {
167
166
  role: "menu",
168
167
  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))
168
+ disablePadding: Y,
169
+ maxHeight: z,
170
+ ...R,
171
+ children: N.map(y, (t, o) => {
172
+ var r, n, f, l, i, D;
173
+ if (!vt(t))
175
174
  return null;
176
- const u = ut === e;
177
- return /* @__PURE__ */ pt(lt, { children: [
175
+ const u = nt === o;
176
+ return /* @__PURE__ */ at(lt, { children: [
178
177
  mt(t, {
179
178
  ...t.props,
180
179
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
181
180
  // @ts-expect-error
182
- "data-index": e,
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),
181
+ "data-index": o,
182
+ selected: !!((r = t == null ? void 0 : t.props) != null && r.value) && ((n = t == null ? void 0 : t.props) == null ? void 0 : n.value) === Q,
183
+ onClick: ft((f = t == null ? void 0 : t.props) == null ? void 0 : f.value, (l = t == null ? void 0 : t.props) == null ? void 0 : l.onClick),
184
+ onKeyDown: dt((i = t == null ? void 0 : t.props) == null ? void 0 : i.value),
186
185
  tabIndex: u ? 0 : -1,
187
186
  style: {
188
- ...(S = t == null ? void 0 : t.props) == null ? void 0 : S.style,
187
+ ...(D = t == null ? void 0 : t.props) == null ? void 0 : D.style,
189
188
  [O ? "width" : "minWidth"]: W ? void 0 : E,
190
189
  maxWidth: W ? void 0 : "100%"
191
190
  }
192
191
  }),
193
- P && F.count(a) !== e + 1 && /* @__PURE__ */ T(kt, {})
192
+ X && N.count(y) !== o + 1 && /* @__PURE__ */ I(kt, {})
194
193
  ] });
195
194
  })
196
195
  }
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("@emotion/react/jsx-runtime"),d=require("react"),u=require("../../hooks/useCheckHoverPossible/useCheckHoverPossible.cjs"),p=require("@emotion/styled"),g=require("../../utils/getContrastingTextColor/getContrastingTextColor.cjs"),h=e=>e&&e.__esModule?e:{default:e},l=h(p),f=l.default.div`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("@emotion/react/jsx-runtime"),p=require("react"),g=require("../../hooks/useCheckHoverPossible/useCheckHoverPossible.cjs"),h=require("@emotion/styled"),f=require("../../utils/getContrastingTextColor/getContrastingTextColor.cjs"),m=e=>e&&e.__esModule?e:{default:e},l=m(h),b=l.default.div`
2
2
  flex-basis: calc((100% / 3) - ${({theme:{spacing:e}})=>e.content(3)}px);
3
3
  display: inline-flex;
4
4
  align-items: center;
5
5
  justify-content: center;
6
- `,m=l.default.button`
6
+ `,y=l.default.button`
7
7
  display: inline-flex;
8
8
  align-items: center;
9
9
  justify-content: center;
@@ -13,7 +13,7 @@
13
13
  white-space: nowrap;
14
14
  text-overflow: ellipsis;
15
15
  background-color: ${({theme:{palette:{brand:e}}})=>e.primary.main};
16
- color: ${({theme:{palette:{brand:e,grey:t}}})=>g.default(e.primary.main,[t.white,t[100]])};
16
+ color: ${({theme:{palette:{brand:e,grey:t}}})=>f.default(e.primary.main,[t.white,t[100]])};
17
17
  & svg {
18
18
  color: inherit;
19
19
  }
@@ -31,4 +31,4 @@
31
31
  color: ${({theme:{palette:{grey:e}}})=>e[30]};
32
32
  cursor: not-allowed;
33
33
  }
34
- `,b=d.forwardRef(function({children:t,size:r,disabled:i,inlineCSS:n,...s},a){const{isHoverPossible:c}=u.default();return o.jsx(f,{ref:a,...s,css:n,children:o.jsx(m,{type:"button",size:r,disabled:i,isHoverPossible:c,children:t})})});exports.default=b;
34
+ `,v=p.forwardRef(function({children:t,size:r,disabled:i,inlineCSS:n,value:a,buttonProps:s,...c},d){const{isHoverPossible:u}=g.default();return o.jsx(b,{ref:d,...c,css:n,"data-value":a,children:o.jsx(y,{type:"button",size:r,disabled:i,isHoverPossible:u,...s,children:t})})});exports.default=v;
@@ -4,6 +4,7 @@ import { NumberKeypadProps } from '../NumberKeypad';
4
4
 
5
5
  export interface NumberKeypadBlockProps extends GeneralComponentProps<HTMLAttributes<HTMLDivElement> & Pick<NumberKeypadProps, 'size' | 'disabled'>> {
6
6
  value?: string | number;
7
+ buttonProps?: HTMLAttributes<HTMLButtonElement>;
7
8
  }
8
9
  declare const NumberKeypadBlock: import('react').ForwardRefExoticComponent<NumberKeypadBlockProps & import('react').RefAttributes<HTMLDivElement>>;
9
10
  export default NumberKeypadBlock;
@@ -1,14 +1,14 @@
1
1
  import { jsx as o } from "@emotion/react/jsx-runtime";
2
- import { forwardRef as p } from "react";
3
- import d from "../../hooks/useCheckHoverPossible/useCheckHoverPossible.es.js";
2
+ import { forwardRef as h } from "react";
3
+ import m from "../../hooks/useCheckHoverPossible/useCheckHoverPossible.es.js";
4
4
  import n from "@emotion/styled";
5
- import h from "../../utils/getContrastingTextColor/getContrastingTextColor.es.js";
6
- const m = n.div`
5
+ import g from "../../utils/getContrastingTextColor/getContrastingTextColor.es.js";
6
+ const u = n.div`
7
7
  flex-basis: calc((100% / 3) - ${({ theme: { spacing: e } }) => e.content(3)}px);
8
8
  display: inline-flex;
9
9
  align-items: center;
10
10
  justify-content: center;
11
- `, g = n.button`
11
+ `, f = n.button`
12
12
  display: inline-flex;
13
13
  align-items: center;
14
14
  justify-content: center;
@@ -26,7 +26,7 @@ const m = n.div`
26
26
  theme: {
27
27
  palette: { brand: e, grey: t }
28
28
  }
29
- }) => h(e.primary.main, [t.white, t[100]])};
29
+ }) => g(e.primary.main, [t.white, t[100]])};
30
30
  & svg {
31
31
  color: inherit;
32
32
  }
@@ -95,21 +95,22 @@ const m = n.div`
95
95
  }) => e[30]};
96
96
  cursor: not-allowed;
97
97
  }
98
- `, v = p(
99
- function({ children: t, size: r, disabled: i, inlineCSS: l, ...a }, s) {
100
- const { isHoverPossible: c } = d();
101
- return /* @__PURE__ */ o(m, { ref: s, ...a, css: l, children: /* @__PURE__ */ o(
102
- g,
98
+ `, x = h(
99
+ function({ children: t, size: r, disabled: i, inlineCSS: l, value: a, buttonProps: s, ...c }, p) {
100
+ const { isHoverPossible: d } = m();
101
+ return /* @__PURE__ */ o(u, { ref: p, ...c, css: l, "data-value": a, children: /* @__PURE__ */ o(
102
+ f,
103
103
  {
104
104
  type: "button",
105
105
  size: r,
106
106
  disabled: i,
107
- isHoverPossible: c,
107
+ isHoverPossible: d,
108
+ ...s,
108
109
  children: t
109
110
  }
110
111
  ) });
111
112
  }
112
113
  );
113
114
  export {
114
- v as default
115
+ x as default
115
116
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("@emotion/react/jsx-runtime"),n=require("react"),j=require("../Flexbox/Flexbox.cjs"),q=require("../hooks/useCheckHasFocus/useCheckHasFocus.cjs"),A=require("@emotion/styled"),D=e=>e&&e.__esModule?e:{default:e},d=D(A),L=d.default.div`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("@emotion/react/jsx-runtime"),n=require("react"),j=require("../Flexbox/Flexbox.cjs"),q=require("../hooks/useCheckHasFocus/useCheckHasFocus.cjs"),A=require("@emotion/styled"),D=e=>e&&e.__esModule?e:{default:e},b=D(A),L=b.default.div`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  gap: ${({theme:{spacing:e}})=>e.content(2)}px;
@@ -11,16 +11,16 @@
11
11
  }
12
12
 
13
13
  @supports not selector(:has(:focus-visible)) {
14
- ${({focusWithin:e,theme:r})=>e?{outline:`${r.palette.grey[100]} solid 2px`,outlineOffset:2}:{}}
14
+ ${({focusWithin:e,theme:o})=>e?{outline:`${o.palette.grey[100]} solid 2px`,outlineOffset:2}:{}}
15
15
  }
16
- `,S=d.default.button`
16
+ `,S=b.default.button`
17
17
  width: 8px;
18
18
  height: 8px;
19
19
  border-radius: 4px;
20
- background-color: ${({theme:{palette:{grey:e}},color:r})=>r==="primary"?e[10]:e[30]};
20
+ background-color: ${({theme:{palette:{grey:e}},color:o})=>o==="primary"?e[10]:e[30]};
21
21
  cursor: pointer;
22
22
  transition: all 150ms ease;
23
23
  transition-property: width, border-radius, background-color, cursor;
24
24
 
25
- ${({theme:{palette:{brand:e}},color:r,isActive:o})=>o?{width:24,borderRadius:8,backgroundColor:r==="primary"?e.primary.pageControl:e.primary.tooltip,cursor:"default"}:null}
26
- `,F=n.forwardRef(function({totalCount:r=1,page:o=1,onChange:l,color:p="primary",inlineCSS:y,tabIdPrefix:b,controlIdPrefix:m,tabProps:x,...h},$){const k=n.useRef(null),R=$??k,f=n.useRef(null),{hasFocus:w}=q.default({ref:f}),P=n.useId(),v=n.useId(),a=`${b??P}-`,I=`${m??v}-`,_=i=>t=>{t.preventDefault(),typeof l=="function"&&l(i)},g=i=>{let t=o;if(i.key==="ArrowLeft"?o>1?t=o-1:o===1&&(t=r):i.key==="ArrowRight"?o<r?t=o+1:o===r&&(t=1):i.key==="Home"?t=1:i.key==="End"&&(t=r),t!==o){const s=document.getElementById(`${a}${t}`);s==null||s.focus(),l==null||l(t)}};return c.jsx(L,{ref:R,role:"tablist",...h,css:y,focusWithin:w,children:c.jsx(j.default,{ref:f,gap:2,children:Array.from({length:r},(i,t)=>{const s=t+1,u=s===o;return c.jsx(S,{id:`${a}${s}`,"aria-controls":`${I}${s}`,isActive:u,"data-page":s,onClick:_(s),role:"tab",type:"button","aria-selected":u,onKeyDown:g,tabIndex:u?0:-1,...x,color:p},t)})})})});exports.default=F;
25
+ ${({theme:{palette:{brand:e}},color:o,isActive:r})=>r?{width:24,borderRadius:8,backgroundColor:o==="primary"?e.primary.pageControl:e.primary.tooltip,cursor:"default"}:null}
26
+ `,F=n.forwardRef(function({totalCount:o=1,page:r=1,onChange:l,color:y="primary",inlineCSS:m,tabIdPrefix:p,controlIdPrefix:x,tabProps:$,...u},h){const k=n.useRef(null),R=h??k,f=n.useRef(null),{hasFocus:w}=q.default({ref:f}),P=n.useId(),v=n.useId(),d=`${p??P}-`,I=`${x??v}-`,_=i=>t=>{t.preventDefault(),typeof l=="function"&&l(i)},g=i=>{let t=r;if(i.key==="ArrowLeft"?r>1?t=r-1:r===1&&(t=o):i.key==="ArrowRight"?r<o?t=r+1:r===o&&(t=1):i.key==="Home"?t=1:i.key==="End"&&(t=o),t!==r){const s=document.getElementById(`${d}${t}`);s==null||s.focus(),l==null||l(t)}};return a.jsx(L,{ref:R,role:"tablist",...u,css:m,focusWithin:w,children:a.jsx(j.default,{ref:f,gap:2,children:Array.from({length:o},(i,t)=>{const s=t+1,c=s===r;return a.jsx(S,{id:`${d}${s}`,"aria-controls":`${I}${s}`,isActive:c,"data-page":s,onClick:_(s),role:"tab",type:"button","aria-selected":c,onKeyDown:g,tabIndex:c?0:-1,"aria-label":`${u==null?void 0:u["aria-label"]} ${s} 이동, 현재 ${r}`,...$,color:y},t)})})})});exports.default=F;
@@ -1,5 +1,5 @@
1
- import { jsx as f } from "@emotion/react/jsx-runtime";
2
- import { forwardRef as D, useRef as u, useId as d } from "react";
1
+ import { jsx as c } from "@emotion/react/jsx-runtime";
2
+ import { forwardRef as D, useRef as d, useId as m } from "react";
3
3
  import F from "../Flexbox/Flexbox.es.js";
4
4
  import E from "../hooks/useCheckHasFocus/useCheckHasFocus.es.js";
5
5
  import p from "@emotion/styled";
@@ -16,8 +16,8 @@ const H = p.div`
16
16
  }
17
17
 
18
18
  @supports not selector(:has(:focus-visible)) {
19
- ${({ focusWithin: t, theme: r }) => t ? {
20
- outline: `${r.palette.grey[100]} solid 2px`,
19
+ ${({ focusWithin: t, theme: o }) => t ? {
20
+ outline: `${o.palette.grey[100]} solid 2px`,
21
21
  outlineOffset: 2
22
22
  } : {}}
23
23
  }
@@ -29,8 +29,8 @@ const H = p.div`
29
29
  theme: {
30
30
  palette: { grey: t }
31
31
  },
32
- color: r
33
- }) => r === "primary" ? t[10] : t[30]};
32
+ color: o
33
+ }) => o === "primary" ? t[10] : t[30]};
34
34
  cursor: pointer;
35
35
  transition: all 150ms ease;
36
36
  transition-property: width, border-radius, background-color, cursor;
@@ -39,59 +39,60 @@ const H = p.div`
39
39
  theme: {
40
40
  palette: { brand: t }
41
41
  },
42
- color: r,
43
- isActive: o
44
- }) => o ? {
42
+ color: o,
43
+ isActive: r
44
+ }) => r ? {
45
45
  width: 24,
46
46
  borderRadius: 8,
47
- backgroundColor: r === "primary" ? t.primary.pageControl : t.primary.tooltip,
47
+ backgroundColor: o === "primary" ? t.primary.pageControl : t.primary.tooltip,
48
48
  cursor: "default"
49
49
  } : null}
50
50
  `, O = D(function({
51
- totalCount: r = 1,
52
- page: o = 1,
51
+ totalCount: o = 1,
52
+ page: r = 1,
53
53
  onChange: l,
54
- color: m = "primary",
54
+ color: b = "primary",
55
55
  inlineCSS: y,
56
- tabIdPrefix: b,
56
+ tabIdPrefix: $,
57
57
  controlIdPrefix: x,
58
58
  tabProps: h,
59
- ...$
59
+ ...n
60
60
  }, k) {
61
- const w = u(null), P = k ?? w, c = u(null), { hasFocus: I } = E({ ref: c }), R = d(), v = d(), a = `${b ?? R}-`, g = `${x ?? v}-`, A = (s) => (e) => {
61
+ const w = d(null), P = k ?? w, a = d(null), { hasFocus: I } = E({ ref: a }), R = m(), v = m(), u = `${$ ?? R}-`, A = `${x ?? v}-`, L = (s) => (e) => {
62
62
  e.preventDefault(), typeof l == "function" && l(s);
63
- }, L = (s) => {
64
- let e = o;
65
- if (s.key === "ArrowLeft" ? o > 1 ? e = o - 1 : o === 1 && (e = r) : s.key === "ArrowRight" ? o < r ? e = o + 1 : o === r && (e = 1) : s.key === "Home" ? e = 1 : s.key === "End" && (e = r), e !== o) {
66
- const i = document.getElementById(`${a}${e}`);
63
+ }, g = (s) => {
64
+ let e = r;
65
+ if (s.key === "ArrowLeft" ? r > 1 ? e = r - 1 : r === 1 && (e = o) : s.key === "ArrowRight" ? r < o ? e = r + 1 : r === o && (e = 1) : s.key === "Home" ? e = 1 : s.key === "End" && (e = o), e !== r) {
66
+ const i = document.getElementById(`${u}${e}`);
67
67
  i == null || i.focus(), l == null || l(e);
68
68
  }
69
69
  };
70
- return /* @__PURE__ */ f(
70
+ return /* @__PURE__ */ c(
71
71
  H,
72
72
  {
73
73
  ref: P,
74
74
  role: "tablist",
75
- ...$,
75
+ ...n,
76
76
  css: y,
77
77
  focusWithin: I,
78
- children: /* @__PURE__ */ f(F, { ref: c, gap: 2, children: Array.from({ length: r }, (s, e) => {
79
- const i = e + 1, n = i === o;
80
- return /* @__PURE__ */ f(
78
+ children: /* @__PURE__ */ c(F, { ref: a, gap: 2, children: Array.from({ length: o }, (s, e) => {
79
+ const i = e + 1, f = i === r;
80
+ return /* @__PURE__ */ c(
81
81
  K,
82
82
  {
83
- id: `${a}${i}`,
84
- "aria-controls": `${g}${i}`,
85
- isActive: n,
83
+ id: `${u}${i}`,
84
+ "aria-controls": `${A}${i}`,
85
+ isActive: f,
86
86
  "data-page": i,
87
- onClick: A(i),
87
+ onClick: L(i),
88
88
  role: "tab",
89
89
  type: "button",
90
- "aria-selected": n,
91
- onKeyDown: L,
92
- tabIndex: n ? 0 : -1,
90
+ "aria-selected": f,
91
+ onKeyDown: g,
92
+ tabIndex: f ? 0 : -1,
93
+ "aria-label": `${n == null ? void 0 : n["aria-label"]} ${i} 이동, 현재 ${r}`,
93
94
  ...h,
94
- color: m
95
+ color: b
95
96
  },
96
97
  e
97
98
  );
@@ -24,4 +24,4 @@
24
24
  ${({theme:{typography:t}})=>({fontSize:t.b4R.size,fontWeight:t.b4R.weight,lineHeight:t.b4R.lineHeight,letterSpacing:t.b4R.letterSpacing,"& svg:not(.tooltip-closer)":{width:24,height:24}})};
25
25
 
26
26
  ${({theme:{palette:{brand:t,grey:r}},placement:m,color:e,offset:c,arrowOffset:d})=>{let o={};const n=(c==null?void 0:c.x)||0,l=(c==null?void 0:c.y)||0,p=(d==null?void 0:d.x)||0,a=(d==null?void 0:d.y)||0;switch(m){case"bottom-left":o={top:`calc(-12px + ${l}px)`,left:`calc(-6px + ${n}px)`,transform:"translateY(-100%)","&:after":{content:'""',position:"absolute",top:"100%",left:`calc(12px + ${p}px)`,borderTop:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderRight:"6px solid transparent",borderBottom:"8px solid transparent",borderLeft:"6px solid transparent"}};break;case"bottom-center":o={top:`calc(-12px + ${l}px)`,left:"50%",transform:`translate(calc(-50% + ${n}px), -100%)`,"&:after":{content:'""',position:"absolute",top:"100%",left:`calc(50% + ${p}px)`,transform:"translateX(-50%)",borderTop:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderRight:"6px solid transparent",borderBottom:"8px solid transparent",borderLeft:"6px solid transparent"}};break;case"bottom-right":o={top:`calc(-12px + ${l}px)`,right:`calc(-6px - ${n}px)`,transform:"translateY(-100%)","&:after":{content:'""',position:"absolute",top:"100%",right:`calc(12px - ${p}px)`,borderTop:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderRight:"6px solid transparent",borderBottom:"8px solid transparent",borderLeft:"6px solid transparent"}};break;case"left-top":o={top:`calc(-6px + ${l}px)`,left:`calc(100% + 12px + ${n}px)`,"&:after":{content:'""',position:"absolute",top:`calc(12px + ${a}px)`,right:"100%",borderTop:"6px solid transparent",borderRight:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderBottom:"6px solid transparent",borderLeft:"8px solid transparent"}};break;case"left-middle":o={top:"50%",left:`calc(100% + 12px + ${n}px)`,transform:`translateY(calc(-50% + ${l}px))`,"&:after":{content:'""',position:"absolute",top:`calc(50% + ${a}px)`,right:"100%",transform:"translateY(-50%)",borderTop:"6px solid transparent",borderRight:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderBottom:"6px solid transparent",borderLeft:"8px solid transparent"}};break;case"left-bottom":o={bottom:`calc(-6px - ${l}px)`,left:`calc(100% + 12px + ${n}px)`,"&:after":{content:'""',position:"absolute",bottom:`calc(12px - ${a}px)`,right:"100%",borderTop:"6px solid transparent",borderRight:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderBottom:"6px solid transparent",borderLeft:"8px solid transparent"}};break;case"top-left":o={left:`calc(-6px + ${n}px)`,transform:`translate(0, calc(12px + ${l}px))`,"&:after":{content:'""',position:"absolute",bottom:"100%",left:`calc(12px + ${p}px)`,borderTop:"8px solid transparent",borderRight:"6px solid transparent",borderBottom:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderLeft:"6px solid transparent"}};break;case"top-center":o={right:"50%",transform:`translate(calc(50% + ${n}px), calc(12px + ${l}px))`,"&:after":{content:'""',position:"absolute",bottom:"100%",left:`calc(50% + ${p}px)`,transform:"translateX(-50%)",borderTop:"8px solid transparent",borderRight:"6px solid transparent",borderBottom:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderLeft:"6px solid transparent"}};break;case"top-right":o={right:`calc(-6px - ${n}px)`,transform:`translate(0, calc(12px + ${l}px))`,"&:after":{content:'""',position:"absolute",bottom:"100%",right:`calc(12px - ${p}px)`,borderTop:"8px solid transparent",borderRight:"6px solid transparent",borderBottom:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderLeft:"6px solid transparent"}};break;case"right-top":o={top:`calc(-6px + ${l}px)`,right:`calc(100% + 12px + ${n}px)`,"&:after":{content:'""',position:"absolute",top:`calc(12px + ${a}px)`,left:"100%",borderTop:"6px solid transparent",borderRight:"8px solid transparent",borderBottom:"6px solid transparent",borderLeft:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`}};break;case"right-middle":o={top:"50%",right:`calc(100% + 12px + ${n}px)`,transform:`translateY(calc(-50% + ${l}px))`,"&:after":{content:'""',position:"absolute",top:`calc(50% + ${a}px)`,left:"100%",transform:"translateY(-50%)",borderTop:"6px solid transparent",borderRight:"8px solid transparent",borderBottom:"6px solid transparent",borderLeft:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`}};break;case"right-bottom":o={bottom:`calc(-6px - ${l}px)`,right:`calc(100% + 12px + ${n}px)`,"&:after":{content:'""',position:"absolute",bottom:`calc(12px - ${a}px)`,left:"100%",borderTop:"6px solid transparent",borderRight:"8px solid transparent",borderBottom:"6px solid transparent",borderLeft:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`}};break}return o}};
27
- `,G=s.forwardRef(function({children:r,placement:m="bottom-center",color:e="primary",title:c,body:d,closer:o,endAdornment:n,inlineCSS:l,open:p=!1,onClose:a,wrapperProps:g,offset:E,arrowOffset:K,...x},Y){const C=s.useId(),D=s.useId(),_=s.useId(),{isKeyboardMode:k}=N.default(),S=s.useRef(null),R=s.useRef(null),T=s.useRef(!0),[z,M]=s.useState(!1),I=(x==null?void 0:x.id)||C,B=(x==null?void 0:x.titleId)||D,L=(x==null?void 0:x.bodyId)||_,v=i=>{(i.key==="Enter"||i.key===" ")&&(a==null||a(i))};return s.useEffect(()=>{R.current&&R.current.getBoundingClientRect().width>=276&&M(!0)},[p]),s.useEffect(()=>{const i=b=>{b.key==="Escape"&&p&&(b.stopPropagation(),a==null||a(b))};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[p,a]),s.useEffect(()=>{var b,h,f;if(T.current){T.current=!1;return}if(p){const $=(b=S.current)==null?void 0:b.querySelector('.tooltip-closer[role="button"]');if($&&k&&$.focus(),!$){const w=(h=S.current)==null?void 0:h.querySelector('[role="button"]');w&&k&&w.focus()}return}const i=(f=S.current)==null?void 0:f.querySelector('[role="button"]');i&&k&&i.focus()},[p,k]),u.jsxs(V,{ref:S,open:p,...g,css:g==null?void 0:g.inlineCSS,children:[s.Children.map(r,i=>{if(!s.isValidElement(i))return i;const b=h=>{var f,$;(h.key==="Enter"||h.key===" ")&&(($=(f=i.props)==null?void 0:f.onClick)==null||$.call(f,h))};return s.cloneElement(i,{inlineCSS:{cursor:"pointer","&:active":{outline:"none"},...i.props.inlineCSS},role:"button",tabIndex:0,"aria-hidden":!1,"aria-expanded":p,"aria-haspopup":"dialog","aria-controls":I,focusable:!0,onKeyDown:b,...i.props})}),u.jsxs(W,{id:I,className:"tooltip",role:"dialog","aria-modal":"true","aria-labelledby":c?B:void 0,"aria-describedby":d?L:void 0,ref:Y,placement:m,color:e,offset:E,arrowOffset:K,...x,css:l,children:[c&&u.jsxs(y.default,{alignItems:"center",justifyContent:"space-between",gap:2,children:[u.jsx(X.default,{id:B,variant:"h5B",color:e==="primary"?"grey.100":"grey.white",children:c}),o&&u.jsx(y.default,{flexShrink:0,children:u.jsx(j.default,{className:"tooltip-closer",name:"CloseLine",size:"xSmall",color:e==="primary"?"grey.100":"grey.white",role:"button","aria-hidden":"false",focusable:"true",tabIndex:0,onClick:a,onKeyDown:v,"aria-label":"닫기",inlineCSS:{marginLeft:"2px",cursor:"pointer","&:active":{outline:"none"}}})})]}),d&&u.jsxs(y.default,{id:L,alignItems:"center",gap:2,ref:R,style:z?{width:"276px",whiteSpace:"wrap"}:{},children:[d,n&&u.jsx(y.default,{flexShrink:0,inlineCSS:{fontSize:"24px"},children:n}),!c&&o&&u.jsx(y.default,{flexShrink:0,children:u.jsx(j.default,{className:"tooltip-closer",name:"CloseLine",size:"xSmall",color:e==="primary"?"grey.100":"grey.white",role:"button","aria-hidden":"false",focusable:"true",tabIndex:0,onClick:a,onKeyDown:v,"aria-label":"닫기",inlineCSS:{marginLeft:"2px",cursor:"pointer","&:active":{outline:"none"}}})})]})]})]})});exports.default=G;
27
+ `,G=s.forwardRef(function({children:r,placement:m="bottom-center",color:e="primary",title:c,body:d,closer:o,endAdornment:n,inlineCSS:l,open:p=!1,onClose:a,wrapperProps:g,offset:E,arrowOffset:K,...x},Y){const C=s.useId(),D=s.useId(),_=s.useId(),{isKeyboardMode:k}=N.default(),S=s.useRef(null),R=s.useRef(null),I=s.useRef(!0),[z,M]=s.useState(!1),B=(x==null?void 0:x.id)||C,L=(x==null?void 0:x.titleId)||D,T=(x==null?void 0:x.bodyId)||_,w=i=>{(i.key==="Enter"||i.key===" ")&&(a==null||a(i))};return s.useEffect(()=>{R.current&&R.current.getBoundingClientRect().width>=276&&M(!0)},[p]),s.useEffect(()=>{const i=b=>{b.key==="Escape"&&p&&(b.stopPropagation(),a==null||a(b))};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[p,a]),s.useEffect(()=>{var b,h,f;if(I.current){I.current=!1;return}if(p){const $=(b=S.current)==null?void 0:b.querySelector('.tooltip-closer[role="button"]');if($&&k&&$.focus(),!$){const v=(h=S.current)==null?void 0:h.querySelector('[role="button"]');v&&k&&v.focus()}return}const i=(f=S.current)==null?void 0:f.querySelector('[role="button"]');i&&k&&i.focus()},[p,k]),u.jsxs(V,{ref:S,open:p,...g,css:g==null?void 0:g.inlineCSS,children:[s.Children.map(r,i=>{if(!s.isValidElement(i))return i;const b=h=>{var f,$;(h.key==="Enter"||h.key===" ")&&(($=(f=i.props)==null?void 0:f.onClick)==null||$.call(f,h))};return s.cloneElement(i,{inlineCSS:{cursor:"pointer","&:active":{outline:"none"},...i.props.inlineCSS},role:"button",tabIndex:0,"aria-hidden":!1,"aria-expanded":p,"aria-haspopup":"dialog","aria-controls":B,focusable:!0,onKeyDown:b,...i.props})}),u.jsxs(W,{id:B,className:"tooltip",role:"dialog","aria-modal":"true","aria-labelledby":c?L:T,"aria-describedby":d?T:void 0,ref:Y,placement:m,color:e,offset:E,arrowOffset:K,...x,css:l,children:[c&&u.jsxs(y.default,{alignItems:"center",justifyContent:"space-between",gap:2,children:[u.jsx(X.default,{id:L,variant:"h5B",color:e==="primary"?"grey.100":"grey.white",children:c}),o&&u.jsx(y.default,{flexShrink:0,children:u.jsx(j.default,{className:"tooltip-closer",name:"CloseLine",size:"xSmall",color:e==="primary"?"grey.100":"grey.white",role:"button","aria-hidden":"false",focusable:"true",tabIndex:0,onClick:a,onKeyDown:w,"aria-label":"닫기",inlineCSS:{marginLeft:"2px",cursor:"pointer","&:active":{outline:"none"}}})})]}),d&&u.jsxs(y.default,{id:T,alignItems:"center",gap:2,ref:R,style:z?{width:"276px",whiteSpace:"wrap"}:{},children:[d,n&&u.jsx(y.default,{flexShrink:0,inlineCSS:{fontSize:"24px"},children:n}),!c&&o&&u.jsx(y.default,{flexShrink:0,children:u.jsx(j.default,{className:"tooltip-closer",name:"CloseLine",size:"xSmall",color:e==="primary"?"grey.100":"grey.white",role:"button","aria-hidden":"false",focusable:"true",tabIndex:0,onClick:a,onKeyDown:w,"aria-label":"닫기",inlineCSS:{marginLeft:"2px",cursor:"pointer","&:active":{outline:"none"}}})})]})]})]})});exports.default=G;
@@ -1,5 +1,5 @@
1
1
  import { jsxs as S, jsx as h } from "@emotion/react/jsx-runtime";
2
- import { forwardRef as V, useId as T, useRef as B, useState as W, useEffect as L, Children as G, isValidElement as J, cloneElement as Q } from "react";
2
+ import { forwardRef as V, useId as B, useRef as L, useState as W, useEffect as w, Children as G, isValidElement as J, cloneElement as Q } from "react";
3
3
  import $ from "../Flexbox/Flexbox.es.js";
4
4
  import C from "../Icon/Icon.es.js";
5
5
  import U from "../Typography/Typography.es.js";
@@ -285,20 +285,20 @@ const _ = z.div`
285
285
  arrowOffset: j,
286
286
  ...d
287
287
  }, X) {
288
- const q = T(), N = T(), F = T(), { isKeyboardMode: g } = Z(), k = B(null), R = B(null), w = B(!0), [H, M] = W(!1), I = (d == null ? void 0 : d.id) || q, v = (d == null ? void 0 : d.titleId) || N, E = (d == null ? void 0 : d.bodyId) || F, K = (i) => {
288
+ const q = B(), N = B(), F = B(), { isKeyboardMode: g } = Z(), k = L(null), R = L(null), I = L(!0), [H, M] = W(!1), v = (d == null ? void 0 : d.id) || q, E = (d == null ? void 0 : d.titleId) || N, T = (d == null ? void 0 : d.bodyId) || F, K = (i) => {
289
289
  (i.key === "Enter" || i.key === " ") && (a == null || a(i));
290
290
  };
291
- return L(() => {
291
+ return w(() => {
292
292
  R.current && R.current.getBoundingClientRect().width >= 276 && M(!0);
293
- }, [l]), L(() => {
293
+ }, [l]), w(() => {
294
294
  const i = (x) => {
295
295
  x.key === "Escape" && l && (x.stopPropagation(), a == null || a(x));
296
296
  };
297
297
  return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
298
- }, [l, a]), L(() => {
298
+ }, [l, a]), w(() => {
299
299
  var x, f, b;
300
- if (w.current) {
301
- w.current = !1;
300
+ if (I.current) {
301
+ I.current = !1;
302
302
  return;
303
303
  }
304
304
  if (l) {
@@ -341,7 +341,7 @@ const _ = z.div`
341
341
  "aria-hidden": !1,
342
342
  "aria-expanded": l,
343
343
  "aria-haspopup": "dialog",
344
- "aria-controls": I,
344
+ "aria-controls": v,
345
345
  focusable: !0,
346
346
  onKeyDown: x,
347
347
  ...i.props
@@ -350,12 +350,12 @@ const _ = z.div`
350
350
  /* @__PURE__ */ S(
351
351
  A,
352
352
  {
353
- id: I,
353
+ id: v,
354
354
  className: "tooltip",
355
355
  role: "dialog",
356
356
  "aria-modal": "true",
357
- "aria-labelledby": s ? v : void 0,
358
- "aria-describedby": c ? E : void 0,
357
+ "aria-labelledby": s ? E : T,
358
+ "aria-describedby": c ? T : void 0,
359
359
  ref: X,
360
360
  placement: m,
361
361
  color: e,
@@ -368,7 +368,7 @@ const _ = z.div`
368
368
  /* @__PURE__ */ h(
369
369
  U,
370
370
  {
371
- id: v,
371
+ id: E,
372
372
  variant: "h5B",
373
373
  color: e === "primary" ? "grey.100" : "grey.white",
374
374
  children: s
@@ -399,7 +399,7 @@ const _ = z.div`
399
399
  c && /* @__PURE__ */ S(
400
400
  $,
401
401
  {
402
- id: E,
402
+ id: T,
403
403
  alignItems: "center",
404
404
  gap: 2,
405
405
  ref: R,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotss/ui",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "React UI components for Dotss",
5
5
  "type": "module",
6
6
  "main": "./index.cjs",