@dotss/ui 1.2.1 → 1.3.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/Accordion/Accordion.cjs +1 -1
- package/Accordion/Accordion.es.js +1 -1
- package/CircularProgressIndicator/CircularProgressIndicator.cjs +7 -6
- package/CircularProgressIndicator/CircularProgressIndicator.es.js +19 -17
- package/Collapse/Collapse.cjs +1 -0
- package/Collapse/Collapse.d.ts +7 -0
- package/Collapse/Collapse.es.js +28 -0
- package/Collapse/Collapse.stories.d.ts +27 -0
- package/Collapse/index.cjs +1 -0
- package/Collapse/index.d.ts +4 -0
- package/Collapse/index.es.js +4 -0
- package/Select/Select.cjs +10 -10
- package/Select/Select.es.js +124 -121
- package/hooks/index.cjs +1 -1
- package/hooks/index.d.ts +5 -0
- package/hooks/index.es.js +9 -3
- package/hooks/interactions/useCollapse/useCollapse.cjs +1 -0
- package/hooks/interactions/useCollapse/useCollapse.d.ts +22 -0
- package/hooks/interactions/useCollapse/useCollapse.es.js +51 -0
- package/hooks/useFocusBoundary/useFocusBoundary.d.ts +1 -1
- package/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.cjs +1 -0
- package/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +4 -0
- package/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.es.js +6 -0
- package/hooks/usePrefersReducedMotion/usePrefersReducedMotion.cjs +1 -0
- package/hooks/usePrefersReducedMotion/usePrefersReducedMotion.d.ts +3 -0
- package/hooks/usePrefersReducedMotion/usePrefersReducedMotion.es.js +15 -0
- package/index.cjs +1 -1
- package/index.d.ts +1 -0
- package/index.es.js +14 -12
- package/package.json +1 -1
- package/utils/isPrefersReducedMotion/isPrefersReducedMotion.cjs +1 -0
- package/utils/isPrefersReducedMotion/isPrefersReducedMotion.d.ts +1 -0
- package/utils/isPrefersReducedMotion/isPrefersReducedMotion.es.js +6 -0
- package/utils/isServer/isServer.cjs +1 -0
- package/utils/isServer/isServer.d.ts +1 -0
- package/utils/isServer/isServer.es.js +6 -0
package/Accordion/Accordion.cjs
CHANGED
|
@@ -37,4 +37,4 @@
|
|
|
37
37
|
overflow: hidden;
|
|
38
38
|
`,J=s.default.div`
|
|
39
39
|
padding: ${({theme:{spacing:e}})=>`0 ${e.content(4)}px ${e.content(4)}px ${e.content(4)}px`};
|
|
40
|
-
`,K=l.forwardRef(function({children:n,expand:t=!1,title:I,endAdornment:E,onChange:g,disabled:u=!1,inlineCSS:b,fullWidth:
|
|
40
|
+
`,K=l.forwardRef(function({children:n,expand:t=!1,title:I,endAdornment:E,onChange:g,disabled:u=!1,inlineCSS:b,fullWidth:y=!1,headerProps:d,headerButtonProps:f,panelProps:m,...H},R){const _=l.useId(),q=l.useId(),p=(f==null?void 0:f.id)||_,$=(m==null?void 0:m.id)||q,[c,j]=l.useState(t),[h,x]=l.useState(t?"auto":"0px"),i=l.useRef(null),C=r=>{u||(typeof g=="function"?g(r):j(a=>!a))};return l.useEffect(()=>{j(t)},[t]),l.useEffect(()=>{var S,v;let r;const a=A.default(((S=i.current)==null?void 0:S.scrollHeight)||0),T=!c&&h==="auto",k=!c&&h!=="auto";return(v=i.current)!=null&&v.parentElement&&(c?(i.current.parentElement.style.height=a,r=setTimeout(()=>{var w;x("auto"),(w=i.current)!=null&&w.parentElement&&(i.current.parentElement.style.height="auto")},200)):T?(i.current.parentElement.style.height=a,x(a)):k&&(i.current.parentElement.style.height="0px",x("0px"))),()=>{r&&clearTimeout(r)}},[c,h]),o.jsxs(N,{ref:R,disabled:u,fullWidth:y,...H,css:b,children:[o.jsx(O,{as:(d==null?void 0:d.tag)||"h3",onClick:C,disabled:u,...d,children:o.jsxs(V,{id:p,"aria-disabled":u,"aria-expanded":c,"aria-controls":$,fullWidth:y,...f,children:[I,o.jsx(F,{expand:c,children:E||o.jsx(z.default,{name:"ChevronDownLine",size:"xSmall"})})]})}),o.jsx(G,{style:{height:h},children:o.jsx(J,{role:"region",id:$,"aria-labelledby":p,ref:i,...m,children:n})})]})});exports.default=K;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("@emotion/react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("@emotion/react/jsx-runtime"),m=require("react"),g=require("@emotion/react"),k=require("@emotion/styled"),y=e=>e&&e.__esModule?e:{default:e},i=y(k),x=g.keyframes`
|
|
2
2
|
100% {
|
|
3
3
|
transform: rotate(270deg);
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
`,$=i.default.svg`
|
|
6
6
|
${({size:e})=>e==="large"?{width:120,height:120}:{width:40,height:40}};
|
|
7
7
|
|
|
8
8
|
transform: rotate(-90deg);
|
|
9
9
|
|
|
10
|
-
${({loop:e})=>e?{animation:`${
|
|
11
|
-
|
|
10
|
+
${({loop:e})=>e?{animation:`${x} 1s infinite`}:{}};
|
|
11
|
+
`,_=i.default.circle`
|
|
12
12
|
${({size:e})=>e==="large"?{cx:60,cy:60,strokeWidth:16}:{cx:20,cy:20,strokeWidth:4}};
|
|
13
13
|
stroke: ${({theme:{palette:{grey:e}}})=>e[10]};
|
|
14
|
-
`,
|
|
14
|
+
`,b=i.default.circle`
|
|
15
15
|
transition: stroke-dashoffset ${({transitionDuration:e})=>e}ms linear 0s;
|
|
16
16
|
${({size:e})=>e==="large"?{cx:60,cy:60,strokeWidth:16}:{cx:20,cy:20,strokeWidth:4}};
|
|
17
17
|
stroke: ${({theme:{palette:{brand:e}}})=>e.primary.main};
|
|
18
|
-
|
|
18
|
+
will-change: stroke-dashoffset;
|
|
19
|
+
`,w=m.forwardRef(function({size:r="small",value:c=0,transitionDuration:n=500,inlineCSS:d,loop:t,...a},u){const s=r==="large"?52:18,l=2*Math.PI*s,f=Math.min(100,Math.max(0,t?20:c)),h=l*(1-f/100);return o.jsxs($,{ref:u,viewBox:r==="large"?"0 0 120 120":"0 0 40 40",fill:"none",size:r,loop:t,role:"progressbar","aria-valuenow":t?void 0:c,"aria-label":a["aria-label"]?a["aria-label"]:"로딩 중",...a,css:d,children:[o.jsx(_,{size:r,r:s}),o.jsx(b,{className:"progress-indicator",size:r,transitionDuration:n,r:s,strokeLinecap:"round",strokeDashoffset:h,strokeDasharray:l})]})});exports.default=w;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { keyframes as
|
|
1
|
+
import { jsxs as g, jsx as n } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { forwardRef as k } from "react";
|
|
3
|
+
import { keyframes as u } from "@emotion/react";
|
|
4
4
|
import s from "@emotion/styled";
|
|
5
|
-
const y =
|
|
5
|
+
const y = u`
|
|
6
6
|
100% {
|
|
7
7
|
transform: rotate(270deg);
|
|
8
8
|
}
|
|
9
|
-
`,
|
|
9
|
+
`, x = s.svg`
|
|
10
10
|
${({ size: r }) => r === "large" ? {
|
|
11
11
|
width: 120,
|
|
12
12
|
height: 120
|
|
@@ -20,7 +20,7 @@ const y = k`
|
|
|
20
20
|
${({ loop: r }) => r ? {
|
|
21
21
|
animation: `${y} 1s infinite`
|
|
22
22
|
} : {}};
|
|
23
|
-
`,
|
|
23
|
+
`, $ = s.circle`
|
|
24
24
|
${({ size: r }) => r === "large" ? {
|
|
25
25
|
cx: 60,
|
|
26
26
|
cy: 60,
|
|
@@ -35,7 +35,7 @@ const y = k`
|
|
|
35
35
|
palette: { grey: r }
|
|
36
36
|
}
|
|
37
37
|
}) => r[10]};
|
|
38
|
-
`,
|
|
38
|
+
`, p = s.circle`
|
|
39
39
|
transition: stroke-dashoffset ${({ transitionDuration: r }) => r}ms linear 0s;
|
|
40
40
|
${({ size: r }) => r === "large" ? {
|
|
41
41
|
cx: 60,
|
|
@@ -51,13 +51,14 @@ const y = k`
|
|
|
51
51
|
palette: { brand: r }
|
|
52
52
|
}
|
|
53
53
|
}) => r.primary.main};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
will-change: stroke-dashoffset;
|
|
55
|
+
`, W = k(
|
|
56
|
+
function({ size: e = "small", value: i = 0, transitionDuration: l = 500, inlineCSS: d, loop: t, ...a }, m) {
|
|
57
|
+
const o = e === "large" ? 52 : 18, c = 2 * Math.PI * o, f = Math.min(100, Math.max(0, t ? 20 : i)), h = c * (1 - f / 100);
|
|
58
|
+
return /* @__PURE__ */ g(
|
|
59
|
+
x,
|
|
59
60
|
{
|
|
60
|
-
ref:
|
|
61
|
+
ref: m,
|
|
61
62
|
viewBox: e === "large" ? "0 0 120 120" : "0 0 40 40",
|
|
62
63
|
fill: "none",
|
|
63
64
|
size: e,
|
|
@@ -68,15 +69,16 @@ const y = k`
|
|
|
68
69
|
...a,
|
|
69
70
|
css: d,
|
|
70
71
|
children: [
|
|
71
|
-
/* @__PURE__ */ n(
|
|
72
|
+
/* @__PURE__ */ n($, { size: e, r: o }),
|
|
72
73
|
/* @__PURE__ */ n(
|
|
73
|
-
|
|
74
|
+
p,
|
|
74
75
|
{
|
|
76
|
+
className: "progress-indicator",
|
|
75
77
|
size: e,
|
|
76
78
|
transitionDuration: l,
|
|
77
79
|
r: o,
|
|
78
80
|
strokeLinecap: "round",
|
|
79
|
-
strokeDashoffset:
|
|
81
|
+
strokeDashoffset: h,
|
|
80
82
|
strokeDasharray: c
|
|
81
83
|
}
|
|
82
84
|
)
|
|
@@ -86,5 +88,5 @@ const y = k`
|
|
|
86
88
|
}
|
|
87
89
|
);
|
|
88
90
|
export {
|
|
89
|
-
|
|
91
|
+
W as default
|
|
90
92
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("@emotion/react/jsx-runtime"),t=require("react"),q=require("../Box/Box.cjs"),x=require("../hooks/interactions/useCollapse/useCollapse.cjs"),R=t.forwardRef(function({children:r,isCollapsed:s=!0,duration:u=200,delay:l=0,easing:o,onTransitionStart:a,onTransitionEnd:n,...i},c){t.useImperativeHandle(c,()=>e.current);const{targetRef:e,style:f,ariaProps:d}=x.default({isCollapsed:s,duration:u,delay:l,easing:o,onTransitionStart:a,onTransitionEnd:n});return p.jsx(q.default,{ref:e,style:{flexShrink:0,...f},...d,...i,children:r})});exports.default=R;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { UseCollapseProps } from '../hooks/interactions/useCollapse/useCollapse';
|
|
3
|
+
import { GeneralComponentProps } from '../typings/component';
|
|
4
|
+
|
|
5
|
+
export type CollapseProps = Omit<GeneralComponentProps<HTMLAttributes<HTMLDivElement>>, 'onTransitionStart' | 'onTransitionEnd'> & UseCollapseProps;
|
|
6
|
+
declare const Collapse: import('react').ForwardRefExoticComponent<Omit<GeneralComponentProps<HTMLAttributes<HTMLDivElement>>, "onTransitionEnd" | "onTransitionStart"> & UseCollapseProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export default Collapse;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as u } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { forwardRef as c, useImperativeHandle as x } from "react";
|
|
3
|
+
import d from "../Box/Box.es.js";
|
|
4
|
+
import C from "../hooks/interactions/useCollapse/useCollapse.es.js";
|
|
5
|
+
const k = c(function({
|
|
6
|
+
children: e,
|
|
7
|
+
isCollapsed: o = !0,
|
|
8
|
+
duration: t = 200,
|
|
9
|
+
delay: s = 0,
|
|
10
|
+
easing: a,
|
|
11
|
+
onTransitionStart: f,
|
|
12
|
+
onTransitionEnd: l,
|
|
13
|
+
...p
|
|
14
|
+
}, m) {
|
|
15
|
+
x(m, () => r.current);
|
|
16
|
+
const { targetRef: r, style: i, ariaProps: n } = C({
|
|
17
|
+
isCollapsed: o,
|
|
18
|
+
duration: t,
|
|
19
|
+
delay: s,
|
|
20
|
+
easing: a,
|
|
21
|
+
onTransitionStart: f,
|
|
22
|
+
onTransitionEnd: l
|
|
23
|
+
});
|
|
24
|
+
return /* @__PURE__ */ u(d, { ref: r, style: { flexShrink: 0, ...i }, ...n, ...p, children: e });
|
|
25
|
+
});
|
|
26
|
+
export {
|
|
27
|
+
k as default
|
|
28
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: import('react').ForwardRefExoticComponent<Omit<import('../../typings/component').GeneralComponentProps<import('react').HTMLAttributes<HTMLDivElement>>, "onTransitionEnd" | "onTransitionStart"> & import('../../hooks').UseCollapseProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
tags: string[];
|
|
10
|
+
argTypes: {
|
|
11
|
+
isCollapsed: {
|
|
12
|
+
control: "boolean";
|
|
13
|
+
};
|
|
14
|
+
duration: {
|
|
15
|
+
control: {
|
|
16
|
+
type: "number";
|
|
17
|
+
min: number;
|
|
18
|
+
max: number;
|
|
19
|
+
step: number;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export default meta;
|
|
25
|
+
type Story = StoryObj<typeof meta>;
|
|
26
|
+
export declare const Default: Story;
|
|
27
|
+
export declare const Custom: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Collapse.cjs");exports.default=e.default;
|
package/Select/Select.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("@emotion/react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("@emotion/react/jsx-runtime"),r=require("react"),P=require("../Backdrop/Backdrop.cjs"),T=require("../Box/Box.cjs"),K=require("../Flexbox/Flexbox.cjs"),U=require("../Icon/Icon.cjs"),X=require("@emotion/styled"),E=require("../utils/getSibling/getSibling.cjs"),G=e=>e&&e.__esModule?e:{default:e},S=G(X),J=S.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: space-between;
|
|
4
4
|
align-items: center;
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
color: inherit;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
${({theme:{palette:{grey:e,background:
|
|
15
|
+
${({theme:{palette:{grey:e,background:i}},variant:h})=>{let s={};switch(h){case"outlined":s={border:`1px solid ${e[50]}`,"&[disabled]":{backgroundColor:e[10],border:`1px solid ${e[30]}`,color:e[30],cursor:"not-allowed"}};break;case"filled":s={border:"1px solid transparent",backgroundColor:i.primary,"&[disabled]":{backgroundColor:e[10],color:e[30],cursor:"not-allowed"}};break}return s}}
|
|
16
16
|
|
|
17
|
-
${({theme:{palette:{brand:e}},isFocused:
|
|
17
|
+
${({theme:{palette:{brand:e}},isFocused:i})=>i?{border:`1px solid ${e.primary.line}`}:{}}
|
|
18
18
|
|
|
19
|
-
${({size:e})=>{let
|
|
20
|
-
`,N=
|
|
19
|
+
${({size:e})=>{let i={};switch(e){case"large":i={height:"48px"};break;case"xLarge":i={height:"56px"};break}return i}}
|
|
20
|
+
`,N=S.default.div`
|
|
21
21
|
display: flex;
|
|
22
22
|
width: calc(100% - 24px - 8px);
|
|
23
23
|
gap: ${({theme:e})=>`${e.spacing.content(2)}px`};
|
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
color: inherit;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
${({theme:{typography:e,palette:{grey:
|
|
29
|
-
`,Q=
|
|
28
|
+
${({theme:{typography:e,palette:{grey:i}},value:h})=>{const s={fontSize:e.b2R.size,fontWeight:e.b2R.size,lineHeight:e.b2R.lineHeight,letterSpacing:e.b2R.letterSpacing,"&[disabled]":{color:i[30]}};return h?{...s,color:i[100]}:{...s,color:i[50]}}}
|
|
29
|
+
`,Q=S.default.div`
|
|
30
30
|
overflow: hidden;
|
|
31
31
|
text-overflow: ellipsis;
|
|
32
32
|
white-space: nowrap;
|
|
33
|
-
`,Y=
|
|
33
|
+
`,Y=S.default.div`
|
|
34
34
|
display: flex;
|
|
35
35
|
align-items: center;
|
|
36
36
|
justify-content: center;
|
|
37
37
|
transform: ${({isFocused:e})=>e?"rotate(180deg)":"rotate(0deg)"};
|
|
38
38
|
transition: transform 200ms linear;
|
|
39
|
-
`,Z=
|
|
39
|
+
`,Z=S.default.ul`
|
|
40
40
|
position: fixed;
|
|
41
41
|
max-height: 476px;
|
|
42
42
|
overflow-y: auto;
|
|
@@ -50,4 +50,4 @@
|
|
|
50
50
|
box-shadow: ${({theme:{elevation:e}})=>e[4]};
|
|
51
51
|
transition: opacity 200ms linear;
|
|
52
52
|
opacity: ${({isFocused:e})=>e?1:0};
|
|
53
|
-
`,ee=
|
|
53
|
+
`,ee=r.forwardRef(function({value:i,onChange:h,open:s,onOpen:C,onClose:k,variant:O="outlined",size:q="large",startAdornment:j,placeholder:W="TEXT",disabled:d=!1,fullWidth:D,children:w,inlineCSS:z,...$},V){const _=r.useId(),g=r.useRef(null),m=r.useRef(null),b=r.useRef(""),[u,f]=r.useState(s||!1),[p,c]=r.useState(""),[v,y]=r.useState({top:0,bottom:0,left:0,width:0}),x=($==null?void 0:$.id)||_,H=()=>{d||(s===void 0?f(t=>!t):s===!1&&C&&typeof C=="function"&&C())},I=t=>()=>{d||(h(t.toString()),R())},R=()=>{d||(s===void 0?(f(!1),c("")):s===!0&&k&&typeof k=="function"&&k())},B=t=>{if(!d){if(t.preventDefault(),t.code==="Escape"&&f(!1),t.code==="Space"||t.code==="Enter")if(b.current?c(b.current):p||c(`${x}-0`),u){if(p){const n=document.querySelector(`#${CSS.escape(p)}`);n&&n.hasAttribute("value")&&(b.current=n==null?void 0:n.id,I(n.value)())}f(!1)}else f(!0);if(t.code==="ArrowDown"||t.code==="ArrowUp"){if(u||f(!0),b.current?c(b.current):c(`${x}-0`),!m.current||!p)return;const n=m.current.querySelector(`#${CSS.escape(p)}`);if(!n)return;if(t.code==="ArrowDown"){const o=E.default(n,"next",{skipDisabled:!0});if(o&&o.id)c(o.id),o.scrollIntoView({block:"end"});else{const l=m.current.firstElementChild;l&&(c(l.id),l.scrollIntoView({block:"start"}))}}if(t.code==="ArrowUp"){const o=E.default(n,"prev",{skipDisabled:!0});if(o&&o.id)c(o.id),o.scrollIntoView({block:"end"});else{const l=m.current.lastElementChild;l&&(c(l.id),l.scrollIntoView({block:"end"}))}}}if(t.code==="Home"&&c(`${x}-0`),t.code==="End"){const n=r.Children.count(w);c(`${x}-${n-1}`)}}},L=t=>{const n=r.Children.map(t,o=>r.isValidElement(o)&&o&&o.props.value===i?o.props.children:null);return n&&n.length?n[0]:""};return r.useEffect(()=>{const t=()=>{if(g.current){const n=g.current.getBoundingClientRect(),o=r.Children.count(w),l=40,A=24,F=l*o>476?476:l*o,M=g.current.getBoundingClientRect().bottom+F+A>window.innerHeight;y(M?{bottom:24,left:n.left,width:g.current.offsetWidth}:{top:n.top+n.height,left:n.left,width:g.current.offsetWidth})}};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[w]),r.useEffect(()=>{s!==void 0&&f(s)},[s]),a.jsxs(T.default,{ref:V,inlineCSS:{position:"relative"},children:[a.jsxs(J,{role:"combobox",ref:g,tabIndex:0,variant:O,size:q,disabled:d,fullWidth:D,isFocused:u,onClick:H,onKeyDown:B,"aria-controls":x,"aria-expanded":u,"aria-haspopup":"listbox","aria-activedescendant":p,"aria-disabled":d,...$,css:z,children:[a.jsxs(N,{value:i==="0"||!!i,disabled:d,children:[j&&a.jsx(K.default,{justifyContent:"center",alignItems:"center",children:j}),a.jsx(Q,{children:L(w)||W})]}),a.jsx(Y,{isFocused:u,children:a.jsx(U.default,{name:"ChevronDownLine",size:"small",color:d?"grey.30":"grey.100"})})]}),a.jsx(P.default,{open:u,onClose:R,inlineCSS:{backgroundColor:"transparent"},children:a.jsx(Z,{id:x,role:"listbox",ref:m,tabIndex:-1,isFocused:u,style:{top:v.top,bottom:v.bottom,left:v.left,width:v.width},children:r.Children.map(w,(t,n)=>{if(!r.isValidElement(t)||!t.props.value)return null;const o=`${x}-${n}`,l=i===t.props.value;return l&&(b.current=o),r.cloneElement(t,{id:o,selected:l,focused:o===p,onClick:I(t.props.value),...t.props})})})})]})});exports.default=ee;
|
package/Select/Select.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsxs as I, jsx as
|
|
2
|
-
import { forwardRef as J, useId as N, useRef as y, useState as
|
|
1
|
+
import { jsxs as I, jsx as g } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { forwardRef as J, useId as N, useRef as y, useState as R, useEffect as z, Children as v, isValidElement as D, cloneElement as Q } from "react";
|
|
3
3
|
import Y from "../Backdrop/Backdrop.es.js";
|
|
4
4
|
import Z from "../Box/Box.es.js";
|
|
5
5
|
import _ from "../Flexbox/Flexbox.es.js";
|
|
6
6
|
import ee from "../Icon/Icon.es.js";
|
|
7
|
-
import
|
|
7
|
+
import w from "@emotion/styled";
|
|
8
8
|
import H from "../utils/getSibling/getSibling.es.js";
|
|
9
|
-
const te =
|
|
9
|
+
const te = w.div`
|
|
10
10
|
display: flex;
|
|
11
11
|
justify-content: space-between;
|
|
12
12
|
align-items: center;
|
|
@@ -22,64 +22,64 @@ const te = h.div`
|
|
|
22
22
|
|
|
23
23
|
${({
|
|
24
24
|
theme: {
|
|
25
|
-
palette: { grey: e, background:
|
|
25
|
+
palette: { grey: e, background: r }
|
|
26
26
|
},
|
|
27
|
-
variant:
|
|
27
|
+
variant: b
|
|
28
28
|
}) => {
|
|
29
|
-
let
|
|
30
|
-
switch (
|
|
29
|
+
let i = {};
|
|
30
|
+
switch (b) {
|
|
31
31
|
case "outlined":
|
|
32
|
-
|
|
32
|
+
i = {
|
|
33
33
|
border: `1px solid ${e[50]}`,
|
|
34
34
|
"&[disabled]": {
|
|
35
35
|
backgroundColor: e[10],
|
|
36
36
|
border: `1px solid ${e[30]}`,
|
|
37
37
|
color: e[30],
|
|
38
|
-
|
|
38
|
+
cursor: "not-allowed"
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
break;
|
|
42
42
|
case "filled":
|
|
43
|
-
|
|
43
|
+
i = {
|
|
44
44
|
border: "1px solid transparent",
|
|
45
|
-
backgroundColor:
|
|
45
|
+
backgroundColor: r.primary,
|
|
46
46
|
"&[disabled]": {
|
|
47
47
|
backgroundColor: e[10],
|
|
48
48
|
color: e[30],
|
|
49
|
-
|
|
49
|
+
cursor: "not-allowed"
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
break;
|
|
53
53
|
}
|
|
54
|
-
return
|
|
54
|
+
return i;
|
|
55
55
|
}}
|
|
56
56
|
|
|
57
57
|
${({
|
|
58
58
|
theme: {
|
|
59
59
|
palette: { brand: e }
|
|
60
60
|
},
|
|
61
|
-
isFocused:
|
|
62
|
-
}) =>
|
|
61
|
+
isFocused: r
|
|
62
|
+
}) => r ? {
|
|
63
63
|
border: `1px solid ${e.primary.line}`
|
|
64
64
|
} : {}}
|
|
65
65
|
|
|
66
66
|
${({ size: e }) => {
|
|
67
|
-
let
|
|
67
|
+
let r = {};
|
|
68
68
|
switch (e) {
|
|
69
69
|
case "large":
|
|
70
|
-
|
|
70
|
+
r = {
|
|
71
71
|
height: "48px"
|
|
72
72
|
};
|
|
73
73
|
break;
|
|
74
74
|
case "xLarge":
|
|
75
|
-
|
|
75
|
+
r = {
|
|
76
76
|
height: "56px"
|
|
77
77
|
};
|
|
78
78
|
break;
|
|
79
79
|
}
|
|
80
|
-
return
|
|
80
|
+
return r;
|
|
81
81
|
}}
|
|
82
|
-
`,
|
|
82
|
+
`, oe = w.div`
|
|
83
83
|
display: flex;
|
|
84
84
|
width: calc(100% - 24px - 8px);
|
|
85
85
|
gap: ${({ theme: e }) => `${e.spacing.content(2)}px`};
|
|
@@ -90,38 +90,38 @@ const te = h.div`
|
|
|
90
90
|
${({
|
|
91
91
|
theme: {
|
|
92
92
|
typography: e,
|
|
93
|
-
palette: { grey:
|
|
93
|
+
palette: { grey: r }
|
|
94
94
|
},
|
|
95
|
-
value:
|
|
95
|
+
value: b
|
|
96
96
|
}) => {
|
|
97
|
-
const
|
|
97
|
+
const i = {
|
|
98
98
|
fontSize: e.b2R.size,
|
|
99
99
|
fontWeight: e.b2R.size,
|
|
100
100
|
lineHeight: e.b2R.lineHeight,
|
|
101
101
|
letterSpacing: e.b2R.letterSpacing,
|
|
102
102
|
"&[disabled]": {
|
|
103
|
-
color:
|
|
103
|
+
color: r[30]
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
|
-
return
|
|
107
|
-
...
|
|
108
|
-
color:
|
|
106
|
+
return b ? {
|
|
107
|
+
...i,
|
|
108
|
+
color: r[100]
|
|
109
109
|
} : {
|
|
110
|
-
...
|
|
111
|
-
color:
|
|
110
|
+
...i,
|
|
111
|
+
color: r[50]
|
|
112
112
|
};
|
|
113
113
|
}}
|
|
114
|
-
`,
|
|
114
|
+
`, ne = w.div`
|
|
115
115
|
overflow: hidden;
|
|
116
116
|
text-overflow: ellipsis;
|
|
117
117
|
white-space: nowrap;
|
|
118
|
-
`,
|
|
118
|
+
`, re = w.div`
|
|
119
119
|
display: flex;
|
|
120
120
|
align-items: center;
|
|
121
121
|
justify-content: center;
|
|
122
122
|
transform: ${({ isFocused: e }) => e ? "rotate(180deg)" : "rotate(0deg)"};
|
|
123
123
|
transition: transform 200ms linear;
|
|
124
|
-
`,
|
|
124
|
+
`, ie = w.ul`
|
|
125
125
|
position: fixed;
|
|
126
126
|
max-height: 476px;
|
|
127
127
|
overflow-y: auto;
|
|
@@ -135,150 +135,153 @@ const te = h.div`
|
|
|
135
135
|
box-shadow: ${({ theme: { elevation: e } }) => e[4]};
|
|
136
136
|
transition: opacity 200ms linear;
|
|
137
137
|
opacity: ${({ isFocused: e }) => e ? 1 : 0};
|
|
138
|
-
`,
|
|
139
|
-
value:
|
|
140
|
-
onChange:
|
|
141
|
-
open:
|
|
142
|
-
onOpen:
|
|
143
|
-
onClose:
|
|
138
|
+
`, me = J(function({
|
|
139
|
+
value: r,
|
|
140
|
+
onChange: b,
|
|
141
|
+
open: i,
|
|
142
|
+
onOpen: C,
|
|
143
|
+
onClose: k,
|
|
144
144
|
variant: V = "outlined",
|
|
145
145
|
size: B = "large",
|
|
146
|
-
startAdornment:
|
|
146
|
+
startAdornment: E,
|
|
147
147
|
placeholder: L = "TEXT",
|
|
148
|
-
disabled:
|
|
148
|
+
disabled: c = !1,
|
|
149
149
|
fullWidth: A,
|
|
150
|
-
children:
|
|
150
|
+
children: x,
|
|
151
151
|
inlineCSS: F,
|
|
152
|
-
|
|
152
|
+
...$
|
|
153
153
|
}, q) {
|
|
154
|
-
const K = N(),
|
|
155
|
-
|
|
154
|
+
const K = N(), u = y(null), h = y(null), m = y(""), [a, d] = R(i || !1), [f, s] = R(""), [S, O] = R({ top: 0, bottom: 0, left: 0, width: 0 }), p = ($ == null ? void 0 : $.id) || K, P = () => {
|
|
155
|
+
c || (i === void 0 ? d((t) => !t) : i === !1 && C && typeof C == "function" && C());
|
|
156
156
|
}, W = (t) => () => {
|
|
157
|
-
|
|
157
|
+
c || (b(t.toString()), j());
|
|
158
158
|
}, j = () => {
|
|
159
|
-
|
|
159
|
+
c || (i === void 0 ? (d(!1), s("")) : i === !0 && k && typeof k == "function" && k());
|
|
160
160
|
}, T = (t) => {
|
|
161
|
-
if (
|
|
162
|
-
if (
|
|
163
|
-
if (
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
161
|
+
if (!c) {
|
|
162
|
+
if (t.preventDefault(), t.code === "Escape" && d(!1), t.code === "Space" || t.code === "Enter")
|
|
163
|
+
if (m.current ? s(m.current) : f || s(`${p}-0`), a) {
|
|
164
|
+
if (f) {
|
|
165
|
+
const o = document.querySelector(
|
|
166
|
+
`#${CSS.escape(f)}`
|
|
167
|
+
);
|
|
168
|
+
o && o.hasAttribute("value") && (m.current = o == null ? void 0 : o.id, W(o.value)());
|
|
169
|
+
}
|
|
170
|
+
d(!1);
|
|
171
|
+
} else
|
|
172
|
+
d(!0);
|
|
173
|
+
if (t.code === "ArrowDown" || t.code === "ArrowUp") {
|
|
174
|
+
if (a || d(!0), m.current ? s(m.current) : s(`${p}-0`), !h.current || !f) return;
|
|
175
|
+
const o = h.current.querySelector(
|
|
176
|
+
`#${CSS.escape(f)}`
|
|
177
|
+
);
|
|
178
|
+
if (!o) return;
|
|
179
|
+
if (t.code === "ArrowDown") {
|
|
180
|
+
const n = H(o, "next", { skipDisabled: !0 });
|
|
181
|
+
if (n && n.id)
|
|
182
|
+
s(n.id), n.scrollIntoView({ block: "end" });
|
|
183
|
+
else {
|
|
184
|
+
const l = h.current.firstElementChild;
|
|
185
|
+
l && (s(l.id), l.scrollIntoView({ block: "start" }));
|
|
186
|
+
}
|
|
168
187
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if (!n) return;
|
|
178
|
-
if (t.code === "ArrowDown") {
|
|
179
|
-
const o = H(n, "next", { skipDisabled: !0 });
|
|
180
|
-
if (o && o.id)
|
|
181
|
-
l(o.id), o.scrollIntoView({ block: "end" });
|
|
182
|
-
else {
|
|
183
|
-
const s = x.current.firstElementChild;
|
|
184
|
-
s && (l(s.id), s.scrollIntoView({ block: "start" }));
|
|
188
|
+
if (t.code === "ArrowUp") {
|
|
189
|
+
const n = H(o, "prev", { skipDisabled: !0 });
|
|
190
|
+
if (n && n.id)
|
|
191
|
+
s(n.id), n.scrollIntoView({ block: "end" });
|
|
192
|
+
else {
|
|
193
|
+
const l = h.current.lastElementChild;
|
|
194
|
+
l && (s(l.id), l.scrollIntoView({ block: "end" }));
|
|
195
|
+
}
|
|
185
196
|
}
|
|
186
197
|
}
|
|
187
|
-
if (t.code === "
|
|
188
|
-
const o =
|
|
189
|
-
|
|
190
|
-
l(o.id), o.scrollIntoView({ block: "end" });
|
|
191
|
-
else {
|
|
192
|
-
const s = x.current.lastElementChild;
|
|
193
|
-
s && (l(s.id), s.scrollIntoView({ block: "end" }));
|
|
194
|
-
}
|
|
198
|
+
if (t.code === "Home" && s(`${p}-0`), t.code === "End") {
|
|
199
|
+
const o = v.count(x);
|
|
200
|
+
s(`${p}-${o - 1}`);
|
|
195
201
|
}
|
|
196
202
|
}
|
|
197
|
-
if (t.code === "Home" && l(`${p}-0`), t.code === "End") {
|
|
198
|
-
const n = v.count(g);
|
|
199
|
-
l(`${p}-${n - 1}`);
|
|
200
|
-
}
|
|
201
203
|
}, U = (t) => {
|
|
202
|
-
const
|
|
203
|
-
return
|
|
204
|
+
const o = v.map(t, (n) => D(n) && n && n.props.value === r ? n.props.children : null);
|
|
205
|
+
return o && o.length ? o[0] : "";
|
|
204
206
|
};
|
|
205
207
|
return z(() => {
|
|
206
208
|
const t = () => {
|
|
207
|
-
if (
|
|
208
|
-
const
|
|
209
|
+
if (u.current) {
|
|
210
|
+
const o = u.current.getBoundingClientRect(), n = v.count(x), l = 40, M = 24, X = l * n > 476 ? 476 : l * n, G = u.current.getBoundingClientRect().bottom + X + M > window.innerHeight;
|
|
209
211
|
O(G ? {
|
|
210
212
|
bottom: 24,
|
|
211
|
-
left:
|
|
212
|
-
width:
|
|
213
|
+
left: o.left,
|
|
214
|
+
width: u.current.offsetWidth
|
|
213
215
|
} : {
|
|
214
|
-
top:
|
|
215
|
-
left:
|
|
216
|
-
width:
|
|
216
|
+
top: o.top + o.height,
|
|
217
|
+
left: o.left,
|
|
218
|
+
width: u.current.offsetWidth
|
|
217
219
|
});
|
|
218
220
|
}
|
|
219
221
|
};
|
|
220
222
|
return t(), window.addEventListener("resize", t), () => {
|
|
221
223
|
window.removeEventListener("resize", t);
|
|
222
224
|
};
|
|
223
|
-
}, [
|
|
224
|
-
|
|
225
|
-
}, [
|
|
225
|
+
}, [x]), z(() => {
|
|
226
|
+
i !== void 0 && d(i);
|
|
227
|
+
}, [i]), /* @__PURE__ */ I(Z, { ref: q, inlineCSS: { position: "relative" }, children: [
|
|
226
228
|
/* @__PURE__ */ I(
|
|
227
229
|
te,
|
|
228
230
|
{
|
|
229
231
|
role: "combobox",
|
|
230
|
-
ref:
|
|
232
|
+
ref: u,
|
|
231
233
|
tabIndex: 0,
|
|
232
234
|
variant: V,
|
|
233
235
|
size: B,
|
|
234
|
-
disabled:
|
|
236
|
+
disabled: c,
|
|
235
237
|
fullWidth: A,
|
|
236
|
-
isFocused:
|
|
238
|
+
isFocused: a,
|
|
237
239
|
onClick: P,
|
|
238
240
|
onKeyDown: T,
|
|
239
241
|
"aria-controls": p,
|
|
240
|
-
"aria-expanded":
|
|
242
|
+
"aria-expanded": a,
|
|
241
243
|
"aria-haspopup": "listbox",
|
|
242
|
-
"aria-activedescendant":
|
|
243
|
-
|
|
244
|
+
"aria-activedescendant": f,
|
|
245
|
+
"aria-disabled": c,
|
|
246
|
+
...$,
|
|
244
247
|
css: F,
|
|
245
248
|
children: [
|
|
246
|
-
/* @__PURE__ */ I(
|
|
247
|
-
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ I(oe, { value: r === "0" || !!r, disabled: c, children: [
|
|
250
|
+
E && /* @__PURE__ */ g(_, { justifyContent: "center", alignItems: "center", children: E }),
|
|
251
|
+
/* @__PURE__ */ g(ne, { children: U(x) || L })
|
|
249
252
|
] }),
|
|
250
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ g(re, { isFocused: a, children: /* @__PURE__ */ g(ee, { name: "ChevronDownLine", size: "small", color: c ? "grey.30" : "grey.100" }) })
|
|
251
254
|
]
|
|
252
255
|
}
|
|
253
256
|
),
|
|
254
|
-
/* @__PURE__ */
|
|
257
|
+
/* @__PURE__ */ g(
|
|
255
258
|
Y,
|
|
256
259
|
{
|
|
257
|
-
open:
|
|
260
|
+
open: a,
|
|
258
261
|
onClose: j,
|
|
259
262
|
inlineCSS: { backgroundColor: "transparent" },
|
|
260
|
-
children: /* @__PURE__ */
|
|
261
|
-
|
|
263
|
+
children: /* @__PURE__ */ g(
|
|
264
|
+
ie,
|
|
262
265
|
{
|
|
263
266
|
id: p,
|
|
264
267
|
role: "listbox",
|
|
265
|
-
ref:
|
|
268
|
+
ref: h,
|
|
266
269
|
tabIndex: -1,
|
|
267
|
-
isFocused:
|
|
270
|
+
isFocused: a,
|
|
268
271
|
style: {
|
|
269
|
-
top:
|
|
270
|
-
bottom:
|
|
271
|
-
left:
|
|
272
|
-
width:
|
|
272
|
+
top: S.top,
|
|
273
|
+
bottom: S.bottom,
|
|
274
|
+
left: S.left,
|
|
275
|
+
width: S.width
|
|
273
276
|
},
|
|
274
|
-
children: v.map(
|
|
277
|
+
children: v.map(x, (t, o) => {
|
|
275
278
|
if (!D(t) || !t.props.value)
|
|
276
279
|
return null;
|
|
277
|
-
const
|
|
278
|
-
return
|
|
279
|
-
id:
|
|
280
|
-
selected:
|
|
281
|
-
focused:
|
|
280
|
+
const n = `${p}-${o}`, l = r === t.props.value;
|
|
281
|
+
return l && (m.current = n), Q(t, {
|
|
282
|
+
id: n,
|
|
283
|
+
selected: l,
|
|
284
|
+
focused: n === f,
|
|
282
285
|
onClick: W(t.props.value),
|
|
283
286
|
...t.props
|
|
284
287
|
});
|
|
@@ -290,5 +293,5 @@ const te = h.div`
|
|
|
290
293
|
] });
|
|
291
294
|
});
|
|
292
295
|
export {
|
|
293
|
-
|
|
296
|
+
me as default
|
|
294
297
|
};
|
package/hooks/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useCheckHoverPossible/useCheckHoverPossible.cjs"),u=require("./useCheckKeyboardMode/useCheckKeyboardMode.cjs"),s=require("./useCheckHasFocus/useCheckHasFocus.cjs"),o=require("./useFocusBoundary/useFocusBoundary.cjs");exports.useCheckHoverPossible=e.default;exports.useCheckKeyboardMode=u.default;exports.useCheckHasFocus=s.default;exports.useFocusBoundary=o.default;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useCheckHoverPossible/useCheckHoverPossible.cjs"),u=require("./useCheckKeyboardMode/useCheckKeyboardMode.cjs"),s=require("./useCheckHasFocus/useCheckHasFocus.cjs"),o=require("./useFocusBoundary/useFocusBoundary.cjs"),r=require("./interactions/useCollapse/useCollapse.cjs"),t=require("./useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.cjs"),c=require("./usePrefersReducedMotion/usePrefersReducedMotion.cjs");exports.useCheckHoverPossible=e.default;exports.useCheckKeyboardMode=u.default;exports.useCheckHasFocus=s.default;exports.useFocusBoundary=o.default;exports.useCollapse=r.default;exports.useIsomorphicLayoutEffect=t.default;exports.usePrefersReducedMotion=c.default;
|
package/hooks/index.d.ts
CHANGED
|
@@ -2,3 +2,8 @@ export { default as useCheckHoverPossible } from './useCheckHoverPossible/useChe
|
|
|
2
2
|
export { default as useCheckKeyboardMode } from './useCheckKeyboardMode/useCheckKeyboardMode';
|
|
3
3
|
export { default as useCheckHasFocus } from './useCheckHasFocus/useCheckHasFocus';
|
|
4
4
|
export { default as useFocusBoundary } from './useFocusBoundary/useFocusBoundary';
|
|
5
|
+
export { default as useCollapse } from './interactions/useCollapse/useCollapse';
|
|
6
|
+
export { default as useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect/useIsomorphicLayoutEffect';
|
|
7
|
+
export { default as usePrefersReducedMotion } from './usePrefersReducedMotion/usePrefersReducedMotion';
|
|
8
|
+
export type { UseFocusBoundaryProps } from './useFocusBoundary/useFocusBoundary';
|
|
9
|
+
export type { UseCollapseProps } from './interactions/useCollapse/useCollapse';
|
package/hooks/index.es.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { default as s } from "./useCheckHoverPossible/useCheckHoverPossible.es.js";
|
|
2
|
-
import { default as
|
|
2
|
+
import { default as a } from "./useCheckKeyboardMode/useCheckKeyboardMode.es.js";
|
|
3
3
|
import { default as f } from "./useCheckHasFocus/useCheckHasFocus.es.js";
|
|
4
4
|
import { default as d } from "./useFocusBoundary/useFocusBoundary.es.js";
|
|
5
|
+
import { default as p } from "./interactions/useCollapse/useCollapse.es.js";
|
|
6
|
+
import { default as m } from "./useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.es.js";
|
|
7
|
+
import { default as h } from "./usePrefersReducedMotion/usePrefersReducedMotion.es.js";
|
|
5
8
|
export {
|
|
6
9
|
f as useCheckHasFocus,
|
|
7
10
|
s as useCheckHoverPossible,
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
a as useCheckKeyboardMode,
|
|
12
|
+
p as useCollapse,
|
|
13
|
+
d as useFocusBoundary,
|
|
14
|
+
m as useIsomorphicLayoutEffect,
|
|
15
|
+
h as usePrefersReducedMotion
|
|
10
16
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react"),v=require("../../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.cjs"),y=require("../../usePrefersReducedMotion/usePrefersReducedMotion.cjs");function P({isCollapsed:t=!0,duration:s=200,delay:f=0,easing:o="ease-in-out",onTransitionStart:i,onTransitionEnd:l}={}){const{prefersReducedMotion:x}=y.default(),h=r.useRef(null),e=r.useRef(null),u=r.useRef(i),c=r.useRef(l),a=r.useRef(!0);u.current=i,c.current=l;const[g,H]=r.useState(t?"0px":"auto");return v.default(()=>{var d;if(a.current){a.current=!1;return}const n=h.current;if(!n)return;e.current&&(e.current.cancel(),e.current=null);const R=n.scrollHeight,M=t?[{height:`${R}px`},{height:"0px"}]:[{height:"0px"},{height:`${R}px`}],q=t?"0px":"auto";return(d=u.current)==null||d.call(u),e.current=n.animate(M,{duration:x?0:s,easing:o,delay:f,fill:"forwards"}),e.current.onfinish=()=>{var m,p;(m=e.current)==null||m.commitStyles(),H(q),(p=c.current)==null||p.call(c),e.current=null},()=>{e.current&&(e.current.cancel(),e.current=null)}},[t,s,f,o]),{targetRef:h,isCollapsed:t,height:g,style:{height:g,overflow:"hidden"},ariaProps:{"aria-hidden":t}}}exports.default=P;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CSSValue } from '../../../typings/utility';
|
|
2
|
+
|
|
3
|
+
export interface UseCollapseProps {
|
|
4
|
+
isCollapsed?: boolean;
|
|
5
|
+
duration?: number;
|
|
6
|
+
delay?: number;
|
|
7
|
+
easing?: string;
|
|
8
|
+
onTransitionStart?: () => void;
|
|
9
|
+
onTransitionEnd?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export default function useCollapse({ isCollapsed, duration, delay, easing, onTransitionStart, onTransitionEnd }?: UseCollapseProps): {
|
|
12
|
+
targetRef: import('react').RefObject<HTMLDivElement>;
|
|
13
|
+
isCollapsed: boolean;
|
|
14
|
+
height: CSSValue;
|
|
15
|
+
style: {
|
|
16
|
+
height: CSSValue;
|
|
17
|
+
overflow: string;
|
|
18
|
+
};
|
|
19
|
+
ariaProps: {
|
|
20
|
+
'aria-hidden': boolean;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useRef as r, useState as M } from "react";
|
|
2
|
+
import P from "../../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.es.js";
|
|
3
|
+
import $ from "../../usePrefersReducedMotion/usePrefersReducedMotion.es.js";
|
|
4
|
+
function L({
|
|
5
|
+
isCollapsed: t = !0,
|
|
6
|
+
duration: o = 200,
|
|
7
|
+
delay: f = 0,
|
|
8
|
+
easing: i = "ease-in-out",
|
|
9
|
+
onTransitionStart: s,
|
|
10
|
+
onTransitionEnd: h
|
|
11
|
+
} = {}) {
|
|
12
|
+
const { prefersReducedMotion: H } = $(), l = r(null), e = r(null), u = r(s), c = r(h), m = r(!0);
|
|
13
|
+
u.current = s, c.current = h;
|
|
14
|
+
const [p, d] = M(t ? "0px" : "auto");
|
|
15
|
+
return P(() => {
|
|
16
|
+
var g;
|
|
17
|
+
if (m.current) {
|
|
18
|
+
m.current = !1;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const n = l.current;
|
|
22
|
+
if (!n) return;
|
|
23
|
+
e.current && (e.current.cancel(), e.current = null);
|
|
24
|
+
const a = n.scrollHeight, w = t ? [{ height: `${a}px` }, { height: "0px" }] : [{ height: "0px" }, { height: `${a}px` }], y = t ? "0px" : "auto";
|
|
25
|
+
return (g = u.current) == null || g.call(u), e.current = n.animate(w, {
|
|
26
|
+
duration: H ? 0 : o,
|
|
27
|
+
easing: i,
|
|
28
|
+
delay: f,
|
|
29
|
+
fill: "forwards"
|
|
30
|
+
}), e.current.onfinish = () => {
|
|
31
|
+
var x, R;
|
|
32
|
+
(x = e.current) == null || x.commitStyles(), d(y), (R = c.current) == null || R.call(c), e.current = null;
|
|
33
|
+
}, () => {
|
|
34
|
+
e.current && (e.current.cancel(), e.current = null);
|
|
35
|
+
};
|
|
36
|
+
}, [t, o, f, i]), {
|
|
37
|
+
targetRef: l,
|
|
38
|
+
isCollapsed: t,
|
|
39
|
+
height: p,
|
|
40
|
+
style: {
|
|
41
|
+
height: p,
|
|
42
|
+
overflow: "hidden"
|
|
43
|
+
},
|
|
44
|
+
ariaProps: {
|
|
45
|
+
"aria-hidden": t
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
L as default
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react"),t=require("../../utils/isServer/isServer.cjs"),u=t.default()?e.useEffect:e.useLayoutEffect;exports.default=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react"),o=require("../../utils/isPrefersReducedMotion/isPrefersReducedMotion.cjs");function c(){const[n,r]=d.useState(()=>o.default());return d.useEffect(()=>{if(typeof window>"u"||!(window!=null&&window.matchMedia))return;const e=window.matchMedia("(prefers-reduced-motion: reduce)"),t=u=>r(u.matches);return e.addEventListener("change",t),()=>{e.removeEventListener("change",t)}},[]),{prefersReducedMotion:n}}exports.default=c;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useState as o, useEffect as i } from "react";
|
|
2
|
+
import c from "../../utils/isPrefersReducedMotion/isPrefersReducedMotion.es.js";
|
|
3
|
+
function a() {
|
|
4
|
+
const [d, n] = o(() => c());
|
|
5
|
+
return i(() => {
|
|
6
|
+
if (typeof window > "u" || !(window != null && window.matchMedia)) return;
|
|
7
|
+
const e = window.matchMedia("(prefers-reduced-motion: reduce)"), t = (r) => n(r.matches);
|
|
8
|
+
return e.addEventListener("change", t), () => {
|
|
9
|
+
e.removeEventListener("change", t);
|
|
10
|
+
};
|
|
11
|
+
}, []), { prefersReducedMotion: d };
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
a as default
|
|
15
|
+
};
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Button/Button.cjs"),t=require("./Icon/Icon.cjs"),o=require("./Label/Label.cjs"),r=require("./Typography/Typography.cjs"),u=require("./Box/Box.cjs"),n=require("./Flexbox/Flexbox.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Button/Button.cjs"),t=require("./Icon/Icon.cjs"),o=require("./Label/Label.cjs"),r=require("./Typography/Typography.cjs"),u=require("./Box/Box.cjs"),n=require("./Flexbox/Flexbox.cjs"),a=require("./TextField/TextField.cjs"),i=require("./TextArea/TextArea.cjs"),l=require("./IconButton/IconButton.cjs"),c=require("./PageControl/PageControl.cjs"),d=require("./Checkbox/Checkbox.cjs"),s=require("./Radio/Radio.cjs"),f=require("./Chip/Chip.cjs"),q=require("./SegmentedButton/SegmentedButton.cjs"),B=require("./SegmentedButton/SegmentedButtonBlock/SegmentedButtonBlock.cjs"),g=require("./Backdrop/Backdrop.cjs"),S=require("./Dialog/Dialog.cjs"),p=require("./Dialog/DialogTitle/DialogTitle.cjs"),T=require("./Dialog/DialogContent/DialogContent.cjs"),k=require("./Dialog/DialogAction/DialogAction.cjs"),C=require("./Dialog/DialogText/DialogText.cjs"),m=require("./Tooltip/Tooltip.cjs"),h=require("./Select/Select.cjs"),b=require("./Select/Option/Option.cjs"),x=require("./Menu/Menu.cjs"),D=require("./Menu/MenuBlock/MenuBlock.cjs");require("./Menu/MenuButton/MenuButton.cjs");const y=require("./Skeleton/Skeleton.cjs"),P=require("./Switch/Switch.cjs"),A=require("./BottomSheet/BottomSheet.cjs"),F=require("./BottomSheet/BottomSheetTitle/BottomSheetTitle.cjs"),I=require("./BottomSheet/BottomSheetContent/BottomSheetContent.cjs"),L=require("./BottomSheet/BottomSheetAction/BottomSheetAction.cjs"),v=require("./BottomSheet/BottomSheetText/BottomSheetText.cjs"),M=require("./Snackbar/Snackbar.cjs"),w=require("./ChainPicker/ChainPicker.cjs"),E=require("./DatePicker/DatePicker.cjs"),G=require("./DatePicker/EventDot/EventDot.cjs"),K=require("./DatePicker/EventDotGroup/EventDotGroup.cjs"),N=require("./FormControlText/FormControlText.cjs"),R=require("./ClickAwayListener/ClickAwayListener.cjs"),O=require("./Card/Card.cjs"),j=require("./LineProgressIndicator/LineProgressIndicator.cjs"),z=require("./CircularProgressIndicator/CircularProgressIndicator.cjs"),H=require("./NumberKeypad/NumberKeypad.cjs"),J=require("./NumberKeypad/NumberKeypadBlock/NumberKeypadBlock.cjs"),Q=require("./FocusBoundary/FocusBoundary.cjs"),U=require("./Badge/Badge.cjs"),V=require("./Tab/Tab.cjs"),W=require("./Tab/TabBlock/TabBlock.cjs"),X=require("./Slider/Slider.cjs"),Y=require("./Accordion/Accordion.cjs"),Z=require("./RadioGroup/RadioGroup.cjs"),_=require("./Collapse/Collapse.cjs");exports.Button=e.default;exports.Icon=t.default;exports.Label=o.default;exports.Typography=r.default;exports.Box=u.default;exports.Flexbox=n.default;exports.TextField=a.default;exports.TextArea=i.default;exports.IconButton=l.default;exports.PageControl=c.default;exports.Checkbox=d.default;exports.Radio=s.default;exports.Chip=f.default;exports.SegmentedButton=q.default;exports.SegmentedButtonBlock=B.default;exports.Backdrop=g.default;exports.Dialog=S.default;exports.DialogTitle=p.default;exports.DialogContent=T.default;exports.DialogAction=k.default;exports.DialogText=C.default;exports.Tooltip=m.default;exports.Select=h.default;exports.Option=b.default;exports.Menu=x.default;exports.MenuBlock=D.default;exports.Skeleton=y.default;exports.Switch=P.default;exports.BottomSheet=A.default;exports.BottomSheetTitle=F.default;exports.BottomSheetContent=I.default;exports.BottomSheetAction=L.default;exports.BottomSheetText=v.default;exports.Snackbar=M.default;exports.ChainPicker=w.default;exports.DatePicker=E.default;exports.EventDot=G.default;exports.EventDotGroup=K.default;exports.FormControlText=N.default;exports.ClickAwayListener=R.default;exports.Card=O.default;exports.LineProgressIndicator=j.default;exports.CircularProgressIndicator=z.default;exports.NumberKeypad=H.default;exports.NumberKeypadBlock=J.default;exports.FocusBoundary=Q.default;exports.Badge=U.default;exports.Tab=V.default;exports.TabBlock=W.default;exports.Slider=X.default;exports.Accordion=Y.default;exports.RadioGroup=Z.default;exports.Collapse=_.default;
|
package/index.d.ts
CHANGED
package/index.es.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { default as a } from "./Button/Button.es.js";
|
|
2
2
|
import { default as f } from "./Icon/Icon.es.js";
|
|
3
3
|
import { default as d } from "./Label/Label.es.js";
|
|
4
|
-
import { default as
|
|
4
|
+
import { default as p } from "./Typography/Typography.es.js";
|
|
5
5
|
import { default as x } from "./Box/Box.es.js";
|
|
6
6
|
import { default as n } from "./Flexbox/Flexbox.es.js";
|
|
7
7
|
import { default as c } from "./TextField/TextField.es.js";
|
|
8
8
|
import { default as g } from "./TextArea/TextArea.es.js";
|
|
9
9
|
import { default as k } from "./IconButton/IconButton.es.js";
|
|
10
|
-
import { default as
|
|
10
|
+
import { default as T } from "./PageControl/PageControl.es.js";
|
|
11
11
|
import { default as b } from "./Checkbox/Checkbox.es.js";
|
|
12
12
|
import { default as y } from "./Radio/Radio.es.js";
|
|
13
13
|
import { default as P } from "./Chip/Chip.es.js";
|
|
@@ -25,17 +25,17 @@ import { default as X } from "./Select/Option/Option.es.js";
|
|
|
25
25
|
import { default as Z } from "./Menu/Menu.es.js";
|
|
26
26
|
import { default as $ } from "./Menu/MenuBlock/MenuBlock.es.js";
|
|
27
27
|
import "./Menu/MenuButton/MenuButton.es.js";
|
|
28
|
-
import { default as
|
|
28
|
+
import { default as eo } from "./Skeleton/Skeleton.es.js";
|
|
29
29
|
import { default as ao } from "./Switch/Switch.es.js";
|
|
30
30
|
import { default as fo } from "./BottomSheet/BottomSheet.es.js";
|
|
31
31
|
import { default as uo } from "./BottomSheet/BottomSheetTitle/BottomSheetTitle.es.js";
|
|
32
|
-
import { default as
|
|
32
|
+
import { default as mo } from "./BottomSheet/BottomSheetContent/BottomSheetContent.es.js";
|
|
33
33
|
import { default as so } from "./BottomSheet/BottomSheetAction/BottomSheetAction.es.js";
|
|
34
34
|
import { default as io } from "./BottomSheet/BottomSheetText/BottomSheetText.es.js";
|
|
35
35
|
import { default as Bo } from "./Snackbar/Snackbar.es.js";
|
|
36
36
|
import { default as So } from "./ChainPicker/ChainPicker.es.js";
|
|
37
|
-
import { default as
|
|
38
|
-
import { default as
|
|
37
|
+
import { default as Co } from "./DatePicker/DatePicker.es.js";
|
|
38
|
+
import { default as ho } from "./DatePicker/EventDot/EventDot.es.js";
|
|
39
39
|
import { default as Do } from "./DatePicker/EventDotGroup/EventDotGroup.es.js";
|
|
40
40
|
import { default as Ao } from "./FormControlText/FormControlText.es.js";
|
|
41
41
|
import { default as Fo } from "./ClickAwayListener/ClickAwayListener.es.js";
|
|
@@ -51,13 +51,14 @@ import { default as Uo } from "./Tab/TabBlock/TabBlock.es.js";
|
|
|
51
51
|
import { default as Wo } from "./Slider/Slider.es.js";
|
|
52
52
|
import { default as Yo } from "./Accordion/Accordion.es.js";
|
|
53
53
|
import { default as _o } from "./RadioGroup/RadioGroup.es.js";
|
|
54
|
+
import { default as oe } from "./Collapse/Collapse.es.js";
|
|
54
55
|
export {
|
|
55
56
|
Yo as Accordion,
|
|
56
57
|
E as Backdrop,
|
|
57
58
|
zo as Badge,
|
|
58
59
|
fo as BottomSheet,
|
|
59
60
|
so as BottomSheetAction,
|
|
60
|
-
|
|
61
|
+
mo as BottomSheetContent,
|
|
61
62
|
io as BottomSheetText,
|
|
62
63
|
uo as BottomSheetTitle,
|
|
63
64
|
x as Box,
|
|
@@ -68,13 +69,14 @@ export {
|
|
|
68
69
|
P as Chip,
|
|
69
70
|
Go as CircularProgressIndicator,
|
|
70
71
|
Fo as ClickAwayListener,
|
|
71
|
-
|
|
72
|
+
oe as Collapse,
|
|
73
|
+
Co as DatePicker,
|
|
72
74
|
K as Dialog,
|
|
73
75
|
q as DialogAction,
|
|
74
76
|
O as DialogContent,
|
|
75
77
|
H as DialogText,
|
|
76
78
|
N as DialogTitle,
|
|
77
|
-
|
|
79
|
+
ho as EventDot,
|
|
78
80
|
Do as EventDotGroup,
|
|
79
81
|
n as Flexbox,
|
|
80
82
|
jo as FocusBoundary,
|
|
@@ -88,13 +90,13 @@ export {
|
|
|
88
90
|
Mo as NumberKeypad,
|
|
89
91
|
Ro as NumberKeypadBlock,
|
|
90
92
|
X as Option,
|
|
91
|
-
|
|
93
|
+
T as PageControl,
|
|
92
94
|
y as Radio,
|
|
93
95
|
_o as RadioGroup,
|
|
94
96
|
I as SegmentedButton,
|
|
95
97
|
v as SegmentedButtonBlock,
|
|
96
98
|
V as Select,
|
|
97
|
-
|
|
99
|
+
eo as Skeleton,
|
|
98
100
|
Wo as Slider,
|
|
99
101
|
Bo as Snackbar,
|
|
100
102
|
ao as Switch,
|
|
@@ -103,5 +105,5 @@ export {
|
|
|
103
105
|
g as TextArea,
|
|
104
106
|
c as TextField,
|
|
105
107
|
Q as Tooltip,
|
|
106
|
-
|
|
108
|
+
p as Typography
|
|
107
109
|
};
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function e(){return window!=null&&window.matchMedia?window.matchMedia("(prefers-reduced-motion: reduce)").matches:!1}exports.default=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function isPrefersReducedMotion(): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function e(){return typeof document>"u"}exports.default=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function isServer(): boolean;
|