@dotss/ui 1.2.0 → 1.2.1

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.
@@ -37,4 +37,4 @@
37
37
  margin: -8px -8px -8px 0;
38
38
 
39
39
  ${({theme:{palette:{grey:e}},variant:c})=>{let s={"& svg":{color:e.white}};return c==="secondary"&&(s={"& svg":{color:"inherit"}}),s}}
40
- `,D=r.forwardRef(function({children:c,open:s,onClose:n,hideClose:y,bottom:q=96,icon:h,action:$,severity:v,variant:x="primary",transitionDuration:T=200,autoHideDuration:b=3e3,containerRef:u,inlineCSS:I,role:_="alert",ariaLive:z="assertive",focusable:a=!1,...O},W){const f=r.useRef(null),g=r.useRef(null),[S,j]=r.useState(!1),[R,k]=r.useState(!0),[F,P]=r.useState(0),[B,A]=r.useState(0),[H,M]=r.useState(0),d=r.useRef(),m=r.useRef(),o=r.useRef(),C=!!h||["success","error"].includes(v),N=!!(u!=null&&u.current),G=t=>t.stopPropagation();return r.useEffect(()=>{s&&(a&&(g.current=document.activeElement),o.current&&clearTimeout(o.current),m.current&&clearTimeout(m.current),k(!1),d.current=setTimeout(()=>{var t;if(j(!0),a&&f.current){const i=(t=f.current.parentElement)==null?void 0:t.querySelector('button, [tabindex]:not([tabindex="-1"])');i==null||i.focus()}},100))},[s,a]),r.useEffect(()=>{s||(o.current&&clearTimeout(o.current),d.current&&clearTimeout(d.current),j(!1),m.current=setTimeout(()=>{k(!0),a&&g.current&&(g.current.focus(),g.current=null)},T))},[s,T,a]),r.useEffect(()=>{S&&b&&(o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{typeof n=="function"&&n()},b))},[S,n,b]),r.useEffect(()=>{const t=i=>{var p,E;f.current&&((E=(p=f.current)==null?void 0:p.parentNode)!=null&&E.contains(i.target)||typeof n=="function"&&n())};return window.addEventListener("mousedown",t),()=>{window.removeEventListener("mousedown",t)}},[n]),r.useEffect(()=>{const t=u==null?void 0:u.current,i=()=>{var p;t&&(P((t==null?void 0:t.offsetTop)||0),A(((p=t.getBoundingClientRect())==null?void 0:p.left)||0),M((t==null?void 0:t.offsetWidth)||0))};return t&&(i(),window.addEventListener("resize",i)),()=>{t&&window.removeEventListener("resize",i)}},[u]),r.useEffect(()=>()=>{d.current&&clearTimeout(d.current),m.current&&clearTimeout(m.current),o.current&&clearTimeout(o.current)},[]),R?null:J.createPortal(l.jsxs(V,{ref:W,open:S,variant:x,bottom:q,transitionDuration:T,onClick:G,hasContainer:N,containerTop:F,containerLeft:B,containerWidth:H,role:_,"aria-live":z,...O,css:I,children:[C&&l.jsxs(Y,{children:[!h&&v==="success"&&l.jsx(L.default,{name:"CompleteFill",color:"green.70"}),!h&&v==="error"&&l.jsx(L.default,{name:"AlertFill",color:"etc.red"}),h]}),l.jsx(X,{ref:f,variant:x,hasIcon:C,tabIndex:a?-1:void 0,children:c}),!y&&!$&&l.jsx(Z,{variant:x,children:l.jsx(K.default,{name:"CloseLine",color:x==="primary"?"tertiary":"primary",onClick:n,"aria-label":"닫기"})}),$]}),document.body)});exports.default=D;
40
+ `,D=r.forwardRef(function({children:c,open:s,onClose:n,hideClose:y,bottom:q=96,icon:h,action:$,severity:T,variant:x="primary",transitionDuration:b=200,autoHideDuration:v=3e3,containerRef:u,inlineCSS:I,role:_="status",ariaLive:z="polite",focusable:a=!1,...O},W){const f=r.useRef(null),g=r.useRef(null),[S,j]=r.useState(!1),[R,k]=r.useState(!0),[F,P]=r.useState(0),[B,A]=r.useState(0),[H,M]=r.useState(0),d=r.useRef(),m=r.useRef(),o=r.useRef(),C=!!h||["success","error"].includes(T),N=!!(u!=null&&u.current),G=t=>t.stopPropagation();return r.useEffect(()=>{s&&(a&&(g.current=document.activeElement),o.current&&clearTimeout(o.current),m.current&&clearTimeout(m.current),k(!1),d.current=setTimeout(()=>{var t;if(j(!0),a&&f.current){const i=(t=f.current.parentElement)==null?void 0:t.querySelector('button, [tabindex]:not([tabindex="-1"])');i==null||i.focus()}},100))},[s,a]),r.useEffect(()=>{s||(o.current&&clearTimeout(o.current),d.current&&clearTimeout(d.current),j(!1),m.current=setTimeout(()=>{k(!0),a&&g.current&&(g.current.focus(),g.current=null)},b))},[s,b,a]),r.useEffect(()=>{S&&v&&(o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{typeof n=="function"&&n()},v))},[S,n,v]),r.useEffect(()=>{const t=i=>{var p,E;f.current&&((E=(p=f.current)==null?void 0:p.parentNode)!=null&&E.contains(i.target)||typeof n=="function"&&n())};return window.addEventListener("mousedown",t),()=>{window.removeEventListener("mousedown",t)}},[n]),r.useEffect(()=>{const t=u==null?void 0:u.current,i=()=>{var p;t&&(P((t==null?void 0:t.offsetTop)||0),A(((p=t.getBoundingClientRect())==null?void 0:p.left)||0),M((t==null?void 0:t.offsetWidth)||0))};return t&&(i(),window.addEventListener("resize",i)),()=>{t&&window.removeEventListener("resize",i)}},[u]),r.useEffect(()=>()=>{d.current&&clearTimeout(d.current),m.current&&clearTimeout(m.current),o.current&&clearTimeout(o.current)},[]),R?null:J.createPortal(l.jsxs(V,{ref:W,open:S,variant:x,bottom:q,transitionDuration:b,onClick:G,hasContainer:N,containerTop:F,containerLeft:B,containerWidth:H,role:_,"aria-live":z,...O,css:I,children:[C&&l.jsxs(Y,{children:[!h&&T==="success"&&l.jsx(L.default,{name:"CompleteFill",color:"green.70"}),!h&&T==="error"&&l.jsx(L.default,{name:"AlertFill",color:"etc.red"}),h]}),l.jsx(X,{ref:f,variant:x,hasIcon:C,tabIndex:a?-1:void 0,children:c}),!y&&!$&&l.jsx(Z,{variant:x,children:l.jsx(K.default,{name:"CloseLine",color:x==="primary"?"tertiary":"primary",onClick:n,"aria-label":"닫기"})}),$]}),document.body)});exports.default=D;
@@ -13,12 +13,12 @@ const M = T.div`
13
13
  hasContainer: o,
14
14
  containerTop: n,
15
15
  containerLeft: r,
16
- containerWidth: v
16
+ containerWidth: b
17
17
  }) => o ? {
18
18
  left: r,
19
19
  bottom: n,
20
20
  // 32: 좌우 너비
21
- width: v - e.layout(4)
21
+ width: b - e.layout(4)
22
22
  } : {
23
23
  left: 0,
24
24
  width: "calc(100% - 32px)"
@@ -102,22 +102,22 @@ const M = T.div`
102
102
  children: o,
103
103
  open: n,
104
104
  onClose: r,
105
- hideClose: v,
105
+ hideClose: b,
106
106
  bottom: E = 96,
107
107
  icon: g,
108
108
  action: S,
109
- severity: b,
109
+ severity: v,
110
110
  variant: x = "primary",
111
111
  transitionDuration: $ = 200,
112
112
  autoHideDuration: k = 3e3,
113
113
  containerRef: s,
114
114
  inlineCSS: F,
115
- role: B = "alert",
116
- ariaLive: P = "assertive",
115
+ role: B = "status",
116
+ ariaLive: P = "polite",
117
117
  focusable: u = !1,
118
118
  ...q
119
119
  }, A) {
120
- const a = h(null), y = h(null), [C, L] = w(!1), [H, I] = w(!0), [N, G] = w(0), [J, K] = w(0), [Q, U] = w(0), d = h(), m = h(), i = h(), z = !!g || ["success", "error"].includes(b), V = !!(s != null && s.current), X = (t) => t.stopPropagation();
120
+ const a = h(null), y = h(null), [C, L] = w(!1), [H, I] = w(!0), [N, G] = w(0), [J, K] = w(0), [Q, U] = w(0), d = h(), m = h(), i = h(), z = !!g || ["success", "error"].includes(v), V = !!(s != null && s.current), X = (t) => t.stopPropagation();
121
121
  return l(() => {
122
122
  n && (u && (y.current = document.activeElement), i.current && clearTimeout(i.current), m.current && clearTimeout(m.current), I(!1), d.current = setTimeout(() => {
123
123
  var t;
@@ -174,8 +174,8 @@ const M = T.div`
174
174
  css: F,
175
175
  children: [
176
176
  z && /* @__PURE__ */ O(D, { children: [
177
- !g && b === "success" && /* @__PURE__ */ p(W, { name: "CompleteFill", color: "green.70" }),
178
- !g && b === "error" && /* @__PURE__ */ p(W, { name: "AlertFill", color: "etc.red" }),
177
+ !g && v === "success" && /* @__PURE__ */ p(W, { name: "CompleteFill", color: "green.70" }),
178
+ !g && v === "error" && /* @__PURE__ */ p(W, { name: "AlertFill", color: "etc.red" }),
179
179
  g
180
180
  ] }),
181
181
  /* @__PURE__ */ p(
@@ -188,7 +188,7 @@ const M = T.div`
188
188
  children: o
189
189
  }
190
190
  ),
191
- !v && !S && /* @__PURE__ */ p(ee, { variant: x, children: /* @__PURE__ */ p(
191
+ !b && !S && /* @__PURE__ */ p(ee, { variant: x, children: /* @__PURE__ */ p(
192
192
  _,
193
193
  {
194
194
  name: "CloseLine",
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@emotion/react/jsx-runtime"),s=require("react"),y=require("../Flexbox/Flexbox.cjs"),j=require("../Icon/Icon.cjs"),X=require("../Typography/Typography.cjs"),N=require("../hooks/useCheckKeyboardMode/useCheckKeyboardMode.cjs"),F=require("@emotion/styled"),H=t=>t&&t.__esModule?t:{default:t},q=H(F),V=q.default.div`
2
2
  position: relative;
3
3
  display: inline-block;
4
- &[open] > .tooltip {
4
+ &[open] > [role='dialog'] {
5
5
  display: flex;
6
6
  }
7
7
  `,W=q.default.div`
@@ -8,7 +8,7 @@ import z from "@emotion/styled";
8
8
  const _ = z.div`
9
9
  position: relative;
10
10
  display: inline-block;
11
- &[open] > .tooltip {
11
+ &[open] > [role='dialog'] {
12
12
  display: flex;
13
13
  }
14
14
  `, A = z.div`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotss/ui",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "React UI components for Dotss",
5
5
  "type": "module",
6
6
  "main": "./index.cjs",