@dotss/ui 0.0.10 → 0.0.12
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 +13 -7
- package/Accordion/Accordion.d.ts +2 -0
- package/Accordion/Accordion.es.js +86 -65
- package/Autocomplete/Autocomplete.cjs +1 -1
- package/Autocomplete/Autocomplete.d.ts +1 -1
- package/Autocomplete/Autocomplete.es.js +235 -80
- package/BottomSheet/BottomSheet.cjs +5 -5
- package/BottomSheet/BottomSheet.d.ts +3 -0
- package/BottomSheet/BottomSheet.es.js +88 -70
- package/BottomSheet/BottomSheetText/BottomSheetText.cjs +2 -2
- package/BottomSheet/BottomSheetText/BottomSheetText.es.js +18 -6
- package/BottomSheet/BottomSheetTitle/BottomSheetTitle.cjs +6 -6
- package/BottomSheet/BottomSheetTitle/BottomSheetTitle.d.ts +2 -1
- package/BottomSheet/BottomSheetTitle/BottomSheetTitle.es.js +26 -15
- package/Button/Button.cjs +6 -6
- package/Button/Button.es.js +35 -29
- package/ChainPicker/ChainPicker.cjs +16 -6
- package/ChainPicker/ChainPicker.d.ts +4 -2
- package/ChainPicker/ChainPicker.es.js +155 -110
- package/ChainPicker/ChainPicker.stories.d.ts +1 -1
- package/Checkbox/Checkbox.cjs +3 -3
- package/Checkbox/Checkbox.es.js +12 -10
- package/CircularProgressIndicator/CircularProgressIndicator.cjs +5 -5
- package/CircularProgressIndicator/CircularProgressIndicator.es.js +25 -22
- package/DatePicker/DatePicker.cjs +37 -20
- package/DatePicker/DatePicker.d.ts +2 -1
- package/DatePicker/DatePicker.es.js +345 -320
- package/DatePicker/DatePicker.stories.d.ts +1 -0
- package/DatePicker/EventDot/EventDot.cjs +8 -0
- package/DatePicker/EventDot/EventDot.d.ts +8 -0
- package/DatePicker/EventDot/EventDot.es.js +19 -0
- package/DatePicker/EventDot/index.cjs +1 -0
- package/DatePicker/EventDot/index.d.ts +3 -0
- package/DatePicker/EventDot/index.es.js +4 -0
- package/DatePicker/EventDotGroup/EventDotGroup.cjs +8 -0
- package/DatePicker/EventDotGroup/EventDotGroup.d.ts +8 -0
- package/DatePicker/EventDotGroup/EventDotGroup.es.js +39 -0
- package/DatePicker/EventDotGroup/index.cjs +1 -0
- package/DatePicker/EventDotGroup/index.d.ts +3 -0
- package/DatePicker/EventDotGroup/index.es.js +4 -0
- package/DatePicker/index.cjs +1 -1
- package/DatePicker/index.d.ts +2 -0
- package/DatePicker/index.es.js +6 -2
- package/Dialog/Dialog.cjs +2 -2
- package/Dialog/Dialog.d.ts +2 -0
- package/Dialog/Dialog.es.js +45 -40
- package/Dialog/Dialog.stories.d.ts +10 -0
- package/Dialog/DialogText/DialogText.cjs +1 -1
- package/Dialog/DialogText/DialogText.es.js +1 -1
- package/Dialog/DialogTitle/DialogTitle.cjs +4 -4
- package/Dialog/DialogTitle/DialogTitle.d.ts +2 -1
- package/Dialog/DialogTitle/DialogTitle.es.js +17 -17
- package/FocusBoundary/FocusBoundary.cjs +1 -1
- package/FocusBoundary/FocusBoundary.d.ts +3 -1
- package/FocusBoundary/FocusBoundary.es.js +49 -42
- package/FormControlText/FormControlText.cjs +7 -5
- package/FormControlText/FormControlText.d.ts +2 -0
- package/FormControlText/FormControlText.es.js +50 -40
- package/Icon/Icon.cjs +1 -1
- package/Icon/Icon.es.js +1 -1
- package/IconButton/IconButton.cjs +8 -8
- package/IconButton/IconButton.es.js +32 -25
- package/LineProgressIndicator/LineProgressIndicator.cjs +6 -6
- package/LineProgressIndicator/LineProgressIndicator.es.js +34 -22
- package/Menu/Menu.cjs +16 -16
- package/Menu/Menu.d.ts +3 -2
- package/Menu/Menu.es.js +115 -81
- package/Menu/Menu.stories.d.ts +1 -0
- package/Menu/MenuBlock/MenuBlock.cjs +14 -7
- package/Menu/MenuBlock/MenuBlock.d.ts +1 -0
- package/Menu/MenuBlock/MenuBlock.es.js +47 -35
- package/Menu/MenuButton/MenuButton.cjs +1 -0
- package/Menu/MenuButton/MenuButton.d.ts +10 -0
- package/Menu/MenuButton/MenuButton.es.js +44 -0
- package/Menu/MenuButton/index.cjs +1 -0
- package/Menu/MenuButton/index.d.ts +3 -0
- package/Menu/MenuButton/index.es.js +4 -0
- package/Menu/index.cjs +1 -1
- package/Menu/index.d.ts +1 -0
- package/Menu/index.es.js +4 -2
- package/NumberKeypad/NumberKeypad.cjs +2 -2
- package/NumberKeypad/NumberKeypad.es.js +18 -16
- package/NumberKeypad/NumberKeypadBlock/NumberKeypadBlock.cjs +1 -1
- package/NumberKeypad/NumberKeypadBlock/NumberKeypadBlock.es.js +10 -1
- package/PageControl/PageControl.cjs +16 -5
- package/PageControl/PageControl.d.ts +3 -0
- package/PageControl/PageControl.es.js +77 -24
- package/PageControl/PageControl.stories.d.ts +1 -0
- package/Radio/Radio.cjs +3 -3
- package/Radio/Radio.es.js +22 -20
- package/RadioGroup/RadioGroup.cjs +1 -0
- package/RadioGroup/RadioGroup.d.ts +8 -0
- package/RadioGroup/RadioGroup.es.js +28 -0
- package/RadioGroup/RadioGroup.stories.d.ts +14 -0
- package/RadioGroup/index.cjs +1 -0
- package/RadioGroup/index.d.ts +3 -0
- package/RadioGroup/index.es.js +4 -0
- package/SegmentedButton/SegmentedButton.cjs +14 -3
- package/SegmentedButton/SegmentedButton.es.js +108 -34
- package/Select/Select.cjs +4 -4
- package/Select/Select.es.js +95 -86
- package/Slider/Slider.cjs +27 -12
- package/Slider/Slider.d.ts +1 -0
- package/Slider/Slider.es.js +177 -90
- package/Switch/Switch.cjs +28 -11
- package/Switch/Switch.d.ts +2 -0
- package/Switch/Switch.es.js +185 -65
- package/Switch/Switch.stories.d.ts +1 -0
- package/Tab/Tab.es.js +2 -4
- package/TextArea/TextArea.cjs +42 -34
- package/TextArea/TextArea.es.js +116 -82
- package/TextArea/TextArea.stories.d.ts +1 -1
- package/TextField/TextField.cjs +29 -13
- package/TextField/TextField.d.ts +2 -1
- package/TextField/TextField.es.js +122 -79
- package/TextField/TextField.stories.d.ts +1 -0
- package/Tooltip/Tooltip.cjs +7 -6
- package/Tooltip/Tooltip.d.ts +8 -3
- package/Tooltip/Tooltip.es.js +248 -146
- package/Tooltip/Tooltip.stories.d.ts +1 -0
- package/hooks/index.cjs +1 -1
- package/hooks/index.d.ts +3 -0
- package/hooks/index.es.js +7 -1
- package/hooks/useCheckHasFocus/useCheckHasFocus.cjs +1 -0
- package/hooks/useCheckHasFocus/useCheckHasFocus.d.ts +9 -0
- package/hooks/useCheckHasFocus/useCheckHasFocus.es.js +21 -0
- package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.cjs +1 -0
- package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.d.ts +4 -0
- package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.es.js +30 -0
- package/hooks/useFocusBoundary/useFocusBoundary.cjs +1 -0
- package/hooks/useFocusBoundary/useFocusBoundary.d.ts +12 -0
- package/hooks/useFocusBoundary/useFocusBoundary.es.js +63 -0
- package/index.cjs +1 -1
- package/index.d.ts +2 -1
- package/index.es.js +97 -90
- package/package.json +3 -3
- package/resources/tictoccroc/icons/fill/certified-fill.svg-B_RVx6K_.cjs +1 -0
- package/resources/tictoccroc/icons/fill/certified-fill.svg-CK7UqYft.js +5 -0
- package/resources/tictoccroc/icons/fill/index.d.ts +3 -0
- package/resources/tictoccroc/icons/fill/location-fill.svg-DfSHAnsd.js +5 -0
- package/resources/tictoccroc/icons/fill/location-fill.svg-Die9mxQH.cjs +1 -0
- package/resources/tictoccroc/icons/fill/send-fill.svg-CItD_2L1.js +5 -0
- package/resources/tictoccroc/icons/fill/send-fill.svg-D197Lwl0.cjs +1 -0
- package/resources/tictoccroc/icons/index.ts-BmqvB_n6.cjs +1 -0
- package/resources/tictoccroc/icons/index.ts-CzTh-XsD.js +228 -0
- package/resources/tictoccroc/icons/line/index.d.ts +4 -0
- package/resources/tictoccroc/icons/line/list-line.svg-r5d5htjN.cjs +1 -0
- package/resources/tictoccroc/icons/line/list-line.svg-yFfhZxUp.js +5 -0
- package/resources/tictoccroc/icons/line/monthly-line.svg-BdyaJ1t_.cjs +1 -0
- package/resources/tictoccroc/icons/line/monthly-line.svg-DY5-Xv34.js +5 -0
- package/resources/tictoccroc/icons/line/review-line.svg-B4rfJrsO.js +5 -0
- package/resources/tictoccroc/icons/line/review-line.svg-DYUuUybx.cjs +1 -0
- package/resources/tictoccroc/icons/line/weekly-line.svg-BCO-LS_a.cjs +1 -0
- package/resources/tictoccroc/icons/line/weekly-line.svg-BUPmmgeE.js +5 -0
- package/utils/getIconLabel/getIconLabel.cjs +1 -1
- package/utils/getIconLabel/getIconLabel.es.js +8 -1
- package/utils/getSibling/getSibling.es.js +1 -2
- package/resources/tictoccroc/icons/index.ts-CarI_z7q.js +0 -214
- package/resources/tictoccroc/icons/index.ts-IVJAK4qr.cjs +0 -1
package/Accordion/Accordion.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("@emotion/react/jsx-runtime"),l=require("react"),z=require("../Icon/Icon.cjs"),A=require("../utils/convertNumberToCSSValue.cjs"),D=require("@emotion/styled"),L=e=>e&&e.__esModule?e:{default:e},s=L(D),N=s.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
border-radius: 12px;
|
|
5
5
|
background-color: ${({theme:{palette:{grey:e,background:n}},disabled:t})=>t?n.secondary:e.white};
|
|
6
6
|
|
|
7
7
|
${({fullWidth:e})=>e?{width:"100%"}:null};
|
|
8
|
-
`,
|
|
8
|
+
`,O=s.default.div`
|
|
9
9
|
display: flex;
|
|
10
10
|
align-items: center;
|
|
11
11
|
justify-content: space-between;
|
|
@@ -14,21 +14,27 @@
|
|
|
14
14
|
cursor: ${({disabled:e})=>e?"not-allowed":"pointer"};
|
|
15
15
|
|
|
16
16
|
${({theme:{palette:{grey:e},typography:{h5M:n}},disabled:t})=>({fontSize:n.size,fontWeight:n.weight,lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,color:t?e[50]:e[70],"& svg":{color:t?e[50]:e[70]}})};
|
|
17
|
-
`,
|
|
17
|
+
`,V=s.default.button`
|
|
18
18
|
display: flex;
|
|
19
19
|
align-items: center;
|
|
20
20
|
justify-content: space-between;
|
|
21
21
|
gap: ${({theme:{spacing:e}})=>e.content(2)}px;
|
|
22
22
|
padding: ${({theme:{spacing:e}})=>e.content(4)}px;
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
&[aria-disabled='true'] {
|
|
25
|
+
cursor: not-allowed;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
${({fullWidth:e})=>e?{width:"100%"}:null};
|
|
29
|
+
`,F=s.default.div`
|
|
24
30
|
display: inline-flex;
|
|
25
31
|
align-items: center;
|
|
26
32
|
justify-content: center;
|
|
27
33
|
transition: transform 0.2s;
|
|
28
34
|
transform: rotate(${({expand:e})=>e?"180deg":"0deg"});
|
|
29
|
-
`,
|
|
35
|
+
`,G=s.default.div`
|
|
30
36
|
transition: height 0.2s;
|
|
31
37
|
overflow: hidden;
|
|
32
|
-
`,
|
|
38
|
+
`,J=s.default.div`
|
|
33
39
|
padding: ${({theme:{spacing:e}})=>`0 ${e.content(4)}px ${e.content(4)}px ${e.content(4)}px`};
|
|
34
|
-
`,
|
|
40
|
+
`,K=l.forwardRef(function({children:n,expand:t=!1,title:I,endAdornment:E,onChange:g,disabled:u=!1,inlineCSS:b,fullWidth:p=!1,headerProps:d,headerButtonProps:f,panelProps:m,...H},R){const _=l.useId(),q=l.useId(),y=(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:p,...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:y,"aria-disabled":u,"aria-expanded":c,"aria-controls":$,fullWidth:p,...f,children:[I,o.jsx(F,{expand:c,children:E||o.jsx(z.default,{name:"ChevronDownLine",size:"xSmall"})})]})}),o.jsx(G,{children:o.jsx(J,{role:"region",id:$,"aria-labelledby":y,ref:i,...m,children:n})})]})});exports.default=K;
|
package/Accordion/Accordion.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export interface AccordionProps extends Omit<GeneralComponentProps<HTMLAttribute
|
|
|
9
9
|
fullWidth?: boolean;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
headerProps?: PolymorphicComponentProps<ElementType>;
|
|
12
|
+
headerButtonProps?: HTMLAttributes<HTMLButtonElement>;
|
|
13
|
+
panelProps?: HTMLAttributes<HTMLDivElement>;
|
|
12
14
|
}
|
|
13
15
|
declare const Accordion: import('react').ForwardRefExoticComponent<AccordionProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
14
16
|
export default Accordion;
|
|
@@ -1,115 +1,136 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const
|
|
1
|
+
import { jsxs as E, jsx as a } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { forwardRef as V, useId as S, useState as H, useRef as q, useEffect as b } from "react";
|
|
3
|
+
import F from "../Icon/Icon.es.js";
|
|
4
|
+
import G from "../utils/convertNumberToCSSValue.es.js";
|
|
5
|
+
import c from "@emotion/styled";
|
|
6
|
+
const J = c.div`
|
|
7
7
|
display: flex;
|
|
8
8
|
flex-direction: column;
|
|
9
9
|
border-radius: 12px;
|
|
10
10
|
background-color: ${({
|
|
11
11
|
theme: {
|
|
12
|
-
palette: { grey:
|
|
12
|
+
palette: { grey: t, background: n }
|
|
13
13
|
},
|
|
14
|
-
disabled:
|
|
15
|
-
}) =>
|
|
14
|
+
disabled: e
|
|
15
|
+
}) => e ? n.secondary : t.white};
|
|
16
16
|
|
|
17
|
-
${({ fullWidth:
|
|
18
|
-
`,
|
|
17
|
+
${({ fullWidth: t }) => t ? { width: "100%" } : null};
|
|
18
|
+
`, K = c.div`
|
|
19
19
|
display: flex;
|
|
20
20
|
align-items: center;
|
|
21
21
|
justify-content: space-between;
|
|
22
|
-
min-height: calc(24px + (${({ theme: { spacing:
|
|
23
|
-
gap: ${({ theme: { spacing:
|
|
24
|
-
cursor: ${({ disabled:
|
|
22
|
+
min-height: calc(24px + (${({ theme: { spacing: t } }) => t.content(4)}px * 2));
|
|
23
|
+
gap: ${({ theme: { spacing: t } }) => t.content(2)}px;
|
|
24
|
+
cursor: ${({ disabled: t }) => t ? "not-allowed" : "pointer"};
|
|
25
25
|
|
|
26
26
|
${({
|
|
27
27
|
theme: {
|
|
28
|
-
palette: { grey:
|
|
28
|
+
palette: { grey: t },
|
|
29
29
|
typography: { h5M: n }
|
|
30
30
|
},
|
|
31
|
-
disabled:
|
|
31
|
+
disabled: e
|
|
32
32
|
}) => ({
|
|
33
33
|
fontSize: n.size,
|
|
34
34
|
fontWeight: n.weight,
|
|
35
35
|
lineHeight: n.lineHeight,
|
|
36
36
|
letterSpacing: n.letterSpacing,
|
|
37
|
-
color:
|
|
37
|
+
color: e ? t[50] : t[70],
|
|
38
38
|
"& svg": {
|
|
39
|
-
color:
|
|
39
|
+
color: e ? t[50] : t[70]
|
|
40
40
|
}
|
|
41
41
|
})};
|
|
42
|
-
`,
|
|
42
|
+
`, O = c.button`
|
|
43
43
|
display: flex;
|
|
44
44
|
align-items: center;
|
|
45
45
|
justify-content: space-between;
|
|
46
|
-
gap: ${({ theme: { spacing:
|
|
47
|
-
padding: ${({ theme: { spacing:
|
|
48
|
-
|
|
46
|
+
gap: ${({ theme: { spacing: t } }) => t.content(2)}px;
|
|
47
|
+
padding: ${({ theme: { spacing: t } }) => t.content(4)}px;
|
|
48
|
+
|
|
49
|
+
&[aria-disabled='true'] {
|
|
50
|
+
cursor: not-allowed;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
${({ fullWidth: t }) => t ? { width: "100%" } : null};
|
|
54
|
+
`, Q = c.div`
|
|
49
55
|
display: inline-flex;
|
|
50
56
|
align-items: center;
|
|
51
57
|
justify-content: center;
|
|
52
58
|
transition: transform 0.2s;
|
|
53
|
-
transform: rotate(${({ expand:
|
|
54
|
-
`,
|
|
59
|
+
transform: rotate(${({ expand: t }) => t ? "180deg" : "0deg"});
|
|
60
|
+
`, U = c.div`
|
|
55
61
|
transition: height 0.2s;
|
|
56
62
|
overflow: hidden;
|
|
57
|
-
`,
|
|
58
|
-
padding: ${({ theme: { spacing:
|
|
59
|
-
`,
|
|
63
|
+
`, W = c.div`
|
|
64
|
+
padding: ${({ theme: { spacing: t } }) => `0 ${t.content(4)}px ${t.content(4)}px ${t.content(4)}px`};
|
|
65
|
+
`, M = V(function({
|
|
60
66
|
children: n,
|
|
61
|
-
expand:
|
|
62
|
-
title:
|
|
63
|
-
endAdornment:
|
|
64
|
-
onChange:
|
|
65
|
-
disabled:
|
|
66
|
-
inlineCSS:
|
|
67
|
+
expand: e = !1,
|
|
68
|
+
title: j,
|
|
69
|
+
endAdornment: C,
|
|
70
|
+
onChange: g,
|
|
71
|
+
disabled: s = !1,
|
|
72
|
+
inlineCSS: R,
|
|
73
|
+
fullWidth: p = !1,
|
|
67
74
|
headerProps: d,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
headerButtonProps: f,
|
|
76
|
+
panelProps: u,
|
|
77
|
+
...T
|
|
78
|
+
}, k) {
|
|
79
|
+
const z = S(), A = S(), x = (f == null ? void 0 : f.id) || z, y = (u == null ? void 0 : u.id) || A, [o, $] = H(e), [m, h] = H(e ? "auto" : "0px"), i = q(null), D = (l) => {
|
|
80
|
+
s || (typeof g == "function" ? g(l) : $((r) => !r));
|
|
72
81
|
};
|
|
73
|
-
return
|
|
74
|
-
|
|
75
|
-
}, [
|
|
76
|
-
var
|
|
77
|
-
let
|
|
78
|
-
const
|
|
79
|
-
((
|
|
80
|
-
),
|
|
81
|
-
return (
|
|
82
|
-
var
|
|
83
|
-
|
|
84
|
-
}, 200)) :
|
|
85
|
-
|
|
82
|
+
return b(() => {
|
|
83
|
+
$(e);
|
|
84
|
+
}, [e]), b(() => {
|
|
85
|
+
var w, I;
|
|
86
|
+
let l;
|
|
87
|
+
const r = G(
|
|
88
|
+
((w = i.current) == null ? void 0 : w.scrollHeight) || 0
|
|
89
|
+
), L = !o && m === "auto", N = !o && m !== "auto";
|
|
90
|
+
return (I = i.current) != null && I.parentElement && (o ? (i.current.parentElement.style.height = r, l = setTimeout(() => {
|
|
91
|
+
var v;
|
|
92
|
+
h("auto"), (v = i.current) != null && v.parentElement && (i.current.parentElement.style.height = "auto");
|
|
93
|
+
}, 200)) : L ? (i.current.parentElement.style.height = r, h(r)) : N && (i.current.parentElement.style.height = "0px", h("0px"))), () => {
|
|
94
|
+
l && clearTimeout(l);
|
|
86
95
|
};
|
|
87
|
-
}, [
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
|
|
96
|
+
}, [o, m]), /* @__PURE__ */ E(J, { ref: k, disabled: s, fullWidth: p, ...T, css: R, children: [
|
|
97
|
+
/* @__PURE__ */ a(
|
|
98
|
+
K,
|
|
90
99
|
{
|
|
91
100
|
as: (d == null ? void 0 : d.tag) || "h3",
|
|
92
|
-
onClick:
|
|
93
|
-
disabled:
|
|
101
|
+
onClick: D,
|
|
102
|
+
disabled: s,
|
|
94
103
|
...d,
|
|
95
|
-
children: /* @__PURE__ */
|
|
96
|
-
|
|
104
|
+
children: /* @__PURE__ */ E(
|
|
105
|
+
O,
|
|
97
106
|
{
|
|
98
|
-
id:
|
|
99
|
-
"aria-disabled":
|
|
100
|
-
"aria-expanded":
|
|
101
|
-
"aria-controls":
|
|
107
|
+
id: x,
|
|
108
|
+
"aria-disabled": s,
|
|
109
|
+
"aria-expanded": o,
|
|
110
|
+
"aria-controls": y,
|
|
111
|
+
fullWidth: p,
|
|
112
|
+
...f,
|
|
102
113
|
children: [
|
|
103
|
-
|
|
104
|
-
/* @__PURE__ */
|
|
114
|
+
j,
|
|
115
|
+
/* @__PURE__ */ a(Q, { expand: o, children: C || /* @__PURE__ */ a(F, { name: "ChevronDownLine", size: "xSmall" }) })
|
|
105
116
|
]
|
|
106
117
|
}
|
|
107
118
|
)
|
|
108
119
|
}
|
|
109
120
|
),
|
|
110
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ a(U, { children: /* @__PURE__ */ a(
|
|
122
|
+
W,
|
|
123
|
+
{
|
|
124
|
+
role: "region",
|
|
125
|
+
id: y,
|
|
126
|
+
"aria-labelledby": x,
|
|
127
|
+
ref: i,
|
|
128
|
+
...u,
|
|
129
|
+
children: n
|
|
130
|
+
}
|
|
131
|
+
) })
|
|
111
132
|
] });
|
|
112
133
|
});
|
|
113
134
|
export {
|
|
114
|
-
|
|
135
|
+
M as default
|
|
115
136
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("@emotion/react/jsx-runtime"),n=require("react"),X=require("../CircularProgressIndicator/CircularProgressIndicator.cjs"),B=require("../Flexbox/Flexbox.cjs"),Y=require("../Icon/Icon.cjs"),Z=require("../Menu/Menu.cjs"),w=require("../Menu/MenuBlock/MenuBlock.cjs");require("../Menu/MenuButton/MenuButton.cjs");const L=require("../TextField/TextField.cjs"),V=require("../Typography/Typography.cjs"),ee=require("../core/useTheme.cjs"),z=require("../utils/getSibling/getSibling.cjs"),x=100,te=n.forwardRef(function({inputValue:o,onInputChange:f,menuValue:T,onMenuChange:y,inputProps:H,minInputLengthForMenu:P=0,options:C=[],isLoading:q=!1,renderOptions:O,renderEmpty:R,filterOptions:E,getOptionLabel:h},U){const D=n.useRef(null),v=n.useRef(null),A=n.useId(),{palette:F}=ee.default();n.useImperativeHandle(U,()=>D.current);const[k,S]=n.useState(!1),[p,m]=n.useState(void 0),r=n.useRef(!1),g=E?E(C):C.filter(e=>e.label.includes(o)),$=g.length>0,j=o.length>=P,N=()=>{if(k&&!T){S(!1),setTimeout(()=>{f("")},x);return}if(k&&T){const e=g.find(l=>l.value===T);if(e){const l=h?h(e):e.label;S(!1),setTimeout(()=>{f(l)});return}}S(e=>!e)},G=e=>{e.target.value.length>0?S(!0):y("",e,null),f(e.target.value,e)},M=()=>{j&&S(!0)},W=(e,l)=>{var u;if(e===void 0||!l||!((u=l==null?void 0:l.target)!=null&&u.textContent))return;const i=g.find(d=>d.value===e);if(h){i&&setTimeout(()=>{f(h(i),l),y(e.toString(),l,i)},x);return}setTimeout(()=>{f(l.target.textContent||"",l),y(e.toString(),l,i||null)},x)},J=e=>{var l,i,u,d,I,b,_;if(!r.current){if(e.key==="ArrowDown"){e.preventDefault(),e.stopPropagation(),r.current=!0;const t=(l=v.current)==null?void 0:l.querySelector('li[role="option"]');if(!p)t&&(m(t.id),t.scrollIntoView({block:"end"}));else{const s=(i=v.current)==null?void 0:i.querySelector(`#${CSS.escape(p)}`);if(!s){r.current=!1;return}const c=z.default(s,"next",{skipDisabled:!0});c&&c.id&&(m(c.id),c.scrollIntoView({block:"end"})),c||(m(t.id),t.scrollIntoView({block:"end"}))}setTimeout(()=>{r.current=!1},0)}if(e.key==="ArrowUp"){if(e.preventDefault(),e.stopPropagation(),r.current=!0,!p){r.current=!1;return}const t=(u=v.current)==null?void 0:u.querySelector(`#${CSS.escape(p)}`);if(!t){r.current=!1;return}const s=z.default(t,"prev",{skipDisabled:!0});if(s&&s.id&&(m(s.id),s.scrollIntoView({block:"end"})),!s){const c=(d=v.current)==null?void 0:d.querySelector('li[role="option"]:last-child');c&&(m(c.id),c.scrollIntoView({block:"end"}))}setTimeout(()=>{r.current=!1},0)}if(e.key==="Enter"){if(e.preventDefault(),e.stopPropagation(),r.current=!0,!p){r.current=!1;return}const t=(I=v.current)==null?void 0:I.querySelector(`#${CSS.escape(p)}`);if(!t){r.current=!1;return}const s=g.find(c=>c.value===t.dataset.value);S(!1),setTimeout(h&&s?()=>{f(h(s),e),y(t.dataset.value||"",e,s)}:()=>{f(t.textContent||"",e),y(t.dataset.value||"",e,s||null)},x),setTimeout(()=>{r.current=!1},0)}if(e.key==="Home"){e.preventDefault(),e.stopPropagation(),r.current=!0;const t=(b=v.current)==null?void 0:b.querySelector('li[role="option"]');t&&(m(t.id),t.scrollIntoView({block:"start"})),setTimeout(()=>{r.current=!1},0)}if(e.key==="End"){e.preventDefault(),e.stopPropagation(),r.current=!0;const t=(_=v.current)==null?void 0:_.querySelector('li[role="option"]:last-child');t&&(m(t.id),t.scrollIntoView({block:"end"})),setTimeout(()=>{r.current=!1},0)}e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),r.current=!0,N(),setTimeout(()=>{r.current=!1},0))}},K=e=>{S(!1),setTimeout(()=>{f("",e),y("",e,null)},x)},Q=e=>{(e.key==="Enter"||e.key===" ")&&K(e)};return n.useEffect(()=>{k||m(void 0)},[k]),a.jsxs(B.default,{ref:D,inlineCSS:{position:"relative"},children:[a.jsx(L.default,{value:o,onChange:G,onFocus:M,onKeyDown:J,fullWidth:!0,autoComplete:"off",role:"combobox","aria-expanded":k,"aria-autocomplete":"list","aria-controls":A,"aria-activedescendant":p,"aria-busy":q,"aria-haspopup":"listbox",endAdornment:o?a.jsx(Y.default,{name:"InvalidFill",color:"grey.50",size:"medium",role:"button",onClick:K,onKeyDown:Q,tabIndex:0,"aria-hidden":!1,focusable:!0,"aria-label":"지우기",inlineCSS:{cursor:"pointer"}}):null,inlineCSS:{"& svg":{flexShrink:0}},...H}),a.jsxs(Z.default,{id:A,value:T,ref:v,anchorRef:D,open:k&&o.length>=P,onClose:N,onChange:W,transitionDuration:x,disablePadding:!j,children:[q&&a.jsx(w.default,{value:"LOADING",disabled:!0,children:a.jsx(B.default,{justifyContent:"center",children:a.jsx(X.default,{size:"small",loop:!0})})}),!q&&$&&g.map((e,l)=>{const i=e.label.indexOf(o),u=`menu-option-${e.value}-${e.label}`,d=p===u,I=e.value===T;if(O&&typeof O=="function"){const b=O(e,l,g);return n.isValidElement(b)?n.cloneElement(b,{id:u,key:e.value,role:"option","aria-selected":d,"data-value":e.value,inlineCSS:{border:d?`2px solid ${F.grey[100]}`:"2px solid transparent"},...b.props}):b}if(!(o&&!e.label.includes(o))&&j)return a.jsx(w.default,{id:u,value:e.value,role:"option","aria-selected":d,"data-value":e.value,inlineCSS:{border:d?`2px solid ${F.grey[100]}`:"2px solid transparent"},...e==null?void 0:e.menuBlockProps,children:o&&!I?a.jsxs(a.Fragment,{children:[e.label.slice(0,i),a.jsx(V.default,{tag:"span",variant:"h5B",color:"primary",children:e.label.slice(i,i+o.length)}),e.label.slice(i+o.length)]}):e.label},e.value)}),!q&&!$&&(R?(()=>{const e=R(o);return n.isValidElement(e)?n.cloneElement(e,{...e.props,disabled:!0}):e})():a.jsx(w.default,{value:"NO_OPTION",disabled:!0,children:"검색 결과가 없어요."}))]})]})});exports.default=te;
|
|
@@ -10,7 +10,7 @@ export interface Option {
|
|
|
10
10
|
}
|
|
11
11
|
export interface AutocompleteProps {
|
|
12
12
|
inputValue: string;
|
|
13
|
-
onInputChange: (inputValue: string, e
|
|
13
|
+
onInputChange: (inputValue: string, e?: SyntheticEvent) => void;
|
|
14
14
|
menuValue: Option['value'];
|
|
15
15
|
onMenuChange: (menuValue: string, e: SyntheticEvent, option: Option | null) => void;
|
|
16
16
|
options: Array<Option>;
|