@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.
Files changed (159) hide show
  1. package/Accordion/Accordion.cjs +13 -7
  2. package/Accordion/Accordion.d.ts +2 -0
  3. package/Accordion/Accordion.es.js +86 -65
  4. package/Autocomplete/Autocomplete.cjs +1 -1
  5. package/Autocomplete/Autocomplete.d.ts +1 -1
  6. package/Autocomplete/Autocomplete.es.js +235 -80
  7. package/BottomSheet/BottomSheet.cjs +5 -5
  8. package/BottomSheet/BottomSheet.d.ts +3 -0
  9. package/BottomSheet/BottomSheet.es.js +88 -70
  10. package/BottomSheet/BottomSheetText/BottomSheetText.cjs +2 -2
  11. package/BottomSheet/BottomSheetText/BottomSheetText.es.js +18 -6
  12. package/BottomSheet/BottomSheetTitle/BottomSheetTitle.cjs +6 -6
  13. package/BottomSheet/BottomSheetTitle/BottomSheetTitle.d.ts +2 -1
  14. package/BottomSheet/BottomSheetTitle/BottomSheetTitle.es.js +26 -15
  15. package/Button/Button.cjs +6 -6
  16. package/Button/Button.es.js +35 -29
  17. package/ChainPicker/ChainPicker.cjs +16 -6
  18. package/ChainPicker/ChainPicker.d.ts +4 -2
  19. package/ChainPicker/ChainPicker.es.js +155 -110
  20. package/ChainPicker/ChainPicker.stories.d.ts +1 -1
  21. package/Checkbox/Checkbox.cjs +3 -3
  22. package/Checkbox/Checkbox.es.js +12 -10
  23. package/CircularProgressIndicator/CircularProgressIndicator.cjs +5 -5
  24. package/CircularProgressIndicator/CircularProgressIndicator.es.js +25 -22
  25. package/DatePicker/DatePicker.cjs +37 -20
  26. package/DatePicker/DatePicker.d.ts +2 -1
  27. package/DatePicker/DatePicker.es.js +345 -320
  28. package/DatePicker/DatePicker.stories.d.ts +1 -0
  29. package/DatePicker/EventDot/EventDot.cjs +8 -0
  30. package/DatePicker/EventDot/EventDot.d.ts +8 -0
  31. package/DatePicker/EventDot/EventDot.es.js +19 -0
  32. package/DatePicker/EventDot/index.cjs +1 -0
  33. package/DatePicker/EventDot/index.d.ts +3 -0
  34. package/DatePicker/EventDot/index.es.js +4 -0
  35. package/DatePicker/EventDotGroup/EventDotGroup.cjs +8 -0
  36. package/DatePicker/EventDotGroup/EventDotGroup.d.ts +8 -0
  37. package/DatePicker/EventDotGroup/EventDotGroup.es.js +39 -0
  38. package/DatePicker/EventDotGroup/index.cjs +1 -0
  39. package/DatePicker/EventDotGroup/index.d.ts +3 -0
  40. package/DatePicker/EventDotGroup/index.es.js +4 -0
  41. package/DatePicker/index.cjs +1 -1
  42. package/DatePicker/index.d.ts +2 -0
  43. package/DatePicker/index.es.js +6 -2
  44. package/Dialog/Dialog.cjs +2 -2
  45. package/Dialog/Dialog.d.ts +2 -0
  46. package/Dialog/Dialog.es.js +45 -40
  47. package/Dialog/Dialog.stories.d.ts +10 -0
  48. package/Dialog/DialogText/DialogText.cjs +1 -1
  49. package/Dialog/DialogText/DialogText.es.js +1 -1
  50. package/Dialog/DialogTitle/DialogTitle.cjs +4 -4
  51. package/Dialog/DialogTitle/DialogTitle.d.ts +2 -1
  52. package/Dialog/DialogTitle/DialogTitle.es.js +17 -17
  53. package/FocusBoundary/FocusBoundary.cjs +1 -1
  54. package/FocusBoundary/FocusBoundary.d.ts +3 -1
  55. package/FocusBoundary/FocusBoundary.es.js +49 -42
  56. package/FormControlText/FormControlText.cjs +7 -5
  57. package/FormControlText/FormControlText.d.ts +2 -0
  58. package/FormControlText/FormControlText.es.js +50 -40
  59. package/Icon/Icon.cjs +1 -1
  60. package/Icon/Icon.es.js +1 -1
  61. package/IconButton/IconButton.cjs +8 -8
  62. package/IconButton/IconButton.es.js +32 -25
  63. package/LineProgressIndicator/LineProgressIndicator.cjs +6 -6
  64. package/LineProgressIndicator/LineProgressIndicator.es.js +34 -22
  65. package/Menu/Menu.cjs +16 -16
  66. package/Menu/Menu.d.ts +3 -2
  67. package/Menu/Menu.es.js +115 -81
  68. package/Menu/Menu.stories.d.ts +1 -0
  69. package/Menu/MenuBlock/MenuBlock.cjs +14 -7
  70. package/Menu/MenuBlock/MenuBlock.d.ts +1 -0
  71. package/Menu/MenuBlock/MenuBlock.es.js +47 -35
  72. package/Menu/MenuButton/MenuButton.cjs +1 -0
  73. package/Menu/MenuButton/MenuButton.d.ts +10 -0
  74. package/Menu/MenuButton/MenuButton.es.js +44 -0
  75. package/Menu/MenuButton/index.cjs +1 -0
  76. package/Menu/MenuButton/index.d.ts +3 -0
  77. package/Menu/MenuButton/index.es.js +4 -0
  78. package/Menu/index.cjs +1 -1
  79. package/Menu/index.d.ts +1 -0
  80. package/Menu/index.es.js +4 -2
  81. package/NumberKeypad/NumberKeypad.cjs +2 -2
  82. package/NumberKeypad/NumberKeypad.es.js +18 -16
  83. package/NumberKeypad/NumberKeypadBlock/NumberKeypadBlock.cjs +1 -1
  84. package/NumberKeypad/NumberKeypadBlock/NumberKeypadBlock.es.js +10 -1
  85. package/PageControl/PageControl.cjs +16 -5
  86. package/PageControl/PageControl.d.ts +3 -0
  87. package/PageControl/PageControl.es.js +77 -24
  88. package/PageControl/PageControl.stories.d.ts +1 -0
  89. package/Radio/Radio.cjs +3 -3
  90. package/Radio/Radio.es.js +22 -20
  91. package/RadioGroup/RadioGroup.cjs +1 -0
  92. package/RadioGroup/RadioGroup.d.ts +8 -0
  93. package/RadioGroup/RadioGroup.es.js +28 -0
  94. package/RadioGroup/RadioGroup.stories.d.ts +14 -0
  95. package/RadioGroup/index.cjs +1 -0
  96. package/RadioGroup/index.d.ts +3 -0
  97. package/RadioGroup/index.es.js +4 -0
  98. package/SegmentedButton/SegmentedButton.cjs +14 -3
  99. package/SegmentedButton/SegmentedButton.es.js +108 -34
  100. package/Select/Select.cjs +4 -4
  101. package/Select/Select.es.js +95 -86
  102. package/Slider/Slider.cjs +27 -12
  103. package/Slider/Slider.d.ts +1 -0
  104. package/Slider/Slider.es.js +177 -90
  105. package/Switch/Switch.cjs +28 -11
  106. package/Switch/Switch.d.ts +2 -0
  107. package/Switch/Switch.es.js +185 -65
  108. package/Switch/Switch.stories.d.ts +1 -0
  109. package/Tab/Tab.es.js +2 -4
  110. package/TextArea/TextArea.cjs +42 -34
  111. package/TextArea/TextArea.es.js +116 -82
  112. package/TextArea/TextArea.stories.d.ts +1 -1
  113. package/TextField/TextField.cjs +29 -13
  114. package/TextField/TextField.d.ts +2 -1
  115. package/TextField/TextField.es.js +122 -79
  116. package/TextField/TextField.stories.d.ts +1 -0
  117. package/Tooltip/Tooltip.cjs +7 -6
  118. package/Tooltip/Tooltip.d.ts +8 -3
  119. package/Tooltip/Tooltip.es.js +248 -146
  120. package/Tooltip/Tooltip.stories.d.ts +1 -0
  121. package/hooks/index.cjs +1 -1
  122. package/hooks/index.d.ts +3 -0
  123. package/hooks/index.es.js +7 -1
  124. package/hooks/useCheckHasFocus/useCheckHasFocus.cjs +1 -0
  125. package/hooks/useCheckHasFocus/useCheckHasFocus.d.ts +9 -0
  126. package/hooks/useCheckHasFocus/useCheckHasFocus.es.js +21 -0
  127. package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.cjs +1 -0
  128. package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.d.ts +4 -0
  129. package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.es.js +30 -0
  130. package/hooks/useFocusBoundary/useFocusBoundary.cjs +1 -0
  131. package/hooks/useFocusBoundary/useFocusBoundary.d.ts +12 -0
  132. package/hooks/useFocusBoundary/useFocusBoundary.es.js +63 -0
  133. package/index.cjs +1 -1
  134. package/index.d.ts +2 -1
  135. package/index.es.js +97 -90
  136. package/package.json +3 -3
  137. package/resources/tictoccroc/icons/fill/certified-fill.svg-B_RVx6K_.cjs +1 -0
  138. package/resources/tictoccroc/icons/fill/certified-fill.svg-CK7UqYft.js +5 -0
  139. package/resources/tictoccroc/icons/fill/index.d.ts +3 -0
  140. package/resources/tictoccroc/icons/fill/location-fill.svg-DfSHAnsd.js +5 -0
  141. package/resources/tictoccroc/icons/fill/location-fill.svg-Die9mxQH.cjs +1 -0
  142. package/resources/tictoccroc/icons/fill/send-fill.svg-CItD_2L1.js +5 -0
  143. package/resources/tictoccroc/icons/fill/send-fill.svg-D197Lwl0.cjs +1 -0
  144. package/resources/tictoccroc/icons/index.ts-BmqvB_n6.cjs +1 -0
  145. package/resources/tictoccroc/icons/index.ts-CzTh-XsD.js +228 -0
  146. package/resources/tictoccroc/icons/line/index.d.ts +4 -0
  147. package/resources/tictoccroc/icons/line/list-line.svg-r5d5htjN.cjs +1 -0
  148. package/resources/tictoccroc/icons/line/list-line.svg-yFfhZxUp.js +5 -0
  149. package/resources/tictoccroc/icons/line/monthly-line.svg-BdyaJ1t_.cjs +1 -0
  150. package/resources/tictoccroc/icons/line/monthly-line.svg-DY5-Xv34.js +5 -0
  151. package/resources/tictoccroc/icons/line/review-line.svg-B4rfJrsO.js +5 -0
  152. package/resources/tictoccroc/icons/line/review-line.svg-DYUuUybx.cjs +1 -0
  153. package/resources/tictoccroc/icons/line/weekly-line.svg-BCO-LS_a.cjs +1 -0
  154. package/resources/tictoccroc/icons/line/weekly-line.svg-BUPmmgeE.js +5 -0
  155. package/utils/getIconLabel/getIconLabel.cjs +1 -1
  156. package/utils/getIconLabel/getIconLabel.es.js +8 -1
  157. package/utils/getSibling/getSibling.es.js +1 -2
  158. package/resources/tictoccroc/icons/index.ts-CarI_z7q.js +0 -214
  159. package/resources/tictoccroc/icons/index.ts-IVJAK4qr.cjs +0 -1
@@ -1,12 +1,14 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@emotion/react/jsx-runtime"),r=require("react"),C=require("@emotion/styled"),S=e=>e&&e.__esModule?e:{default:e},a=S(C),j=a.default.div`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("@emotion/react/jsx-runtime"),l=require("react"),j=require("@emotion/styled"),w=e=>e&&e.__esModule?e:{default:e},d=w(j),_=d.default.div`
2
2
  display: inline-flex;
3
3
  align-items: center;
4
4
  justify-content: center;
5
5
  gap: ${({theme:{spacing:e}})=>e.content(2)}px;
6
6
  cursor: ${({disabled:e})=>e?"not-allowed":"pointer"};
7
7
  flex-direction: ${({placement:e})=>e==="left"?"row-reverse":"row"};
8
- `,v=a.default.div`
8
+ `,v=d.default.div`
9
9
  display: inline-flex;
10
- `,_=a.default.div`
11
- ${({theme:{palette:{grey:e},typography:{h0R:o,b2R:i}},size:s,disabled:c})=>{let l={fontSize:i.size,fontWeight:i.weight,lineHeight:i.lineHeight,letterSpacing:i.letterSpacing};return s==="2xLarge"&&(l={fontSize:o.size,fontWeight:o.weight,lineHeight:o.lineHeight,letterSpacing:o.letterSpacing}),c&&(l.color=e[30]),l}}
12
- `,w=r.forwardRef(function({control:o,text:i,placement:s,size:c,onClick:l,disabled:f,inlineCSS:g,...h},x){const p=r.useRef(null),y=t=>{var n,d;t.preventDefault(),(d=(n=p.current)==null?void 0:n.getElementsByTagName("input")[0])==null||d.click(),typeof l=="function"&&l(t)},m=t=>n=>{n.stopPropagation(),typeof t=="function"&&t(n)};return u.jsxs(j,{ref:x,onClick:y,placement:s,disabled:f,...h,css:g,children:[u.jsx(v,{ref:p,children:r.Children.map(o,t=>{var n;return r.isValidElement(t)?r.cloneElement(t,{size:c,disabled:f,onClick:m((n=t.props)==null?void 0:n.onClick),...t.props}):null})}),u.jsx(_,{size:c,disabled:f,children:i})]})});exports.default=w;
10
+ `,T=d.default.label`
11
+ cursor: pointer;
12
+
13
+ ${({theme:{palette:{grey:e},typography:{h0R:n,b2R:o}},size:u,disabled:c})=>{let i={fontSize:o.size,fontWeight:o.weight,lineHeight:o.lineHeight,letterSpacing:o.letterSpacing};return u==="2xLarge"&&(i={fontSize:n.size,fontWeight:n.weight,lineHeight:n.lineHeight,letterSpacing:n.letterSpacing}),c&&(i.color=e[30],i.cursor="not-allowed"),i}}
14
+ `,F=l.forwardRef(function({control:n,text:o,placement:u,size:c,onClick:i,disabled:a,inlineCSS:h,controlWrapperProps:p,textProps:x,...s},y){const C=l.useRef(null),m=l.useId(),g=(s==null?void 0:s.id)||m,S=t=>r=>{r.stopPropagation(),typeof t=="function"&&t(r)};return f.jsxs(_,{ref:y,placement:u,disabled:a,...s,css:h,children:[f.jsx(v,{ref:C,...p,children:l.Children.map(n,t=>{var r;return l.isValidElement(t)?l.cloneElement(t,{size:c,disabled:a,onClick:S((r=t.props)==null?void 0:r.onClick),id:g,...t.props}):null})}),f.jsx(T,{size:c,disabled:a,htmlFor:g,...x,children:o})]})});exports.default=F;
@@ -9,6 +9,8 @@ export interface FormControlTextProps extends GeneralComponentProps<HTMLAttribut
9
9
  placement?: 'left' | 'right';
10
10
  size?: Extract<Size, 'medium' | '2xLarge'>;
11
11
  disabled?: boolean;
12
+ controlWrapperProps?: GeneralComponentProps<HTMLAttributes<HTMLDivElement>>;
13
+ textProps?: GeneralComponentProps<HTMLAttributes<HTMLLabelElement>>;
12
14
  }
13
15
  declare const FormControlText: import('react').ForwardRefExoticComponent<FormControlTextProps & import('react').RefAttributes<HTMLDivElement>>;
14
16
  export default FormControlText;
@@ -1,68 +1,78 @@
1
- import { jsxs as y, jsx as g } from "@emotion/react/jsx-runtime";
2
- import { forwardRef as C, useRef as S, Children as w, isValidElement as v, cloneElement as T } from "react";
3
- import p from "@emotion/styled";
4
- const j = p.div`
1
+ import { jsxs as w, jsx as g } from "@emotion/react/jsx-runtime";
2
+ import { forwardRef as S, useRef as j, useId as F, Children as H, isValidElement as T, cloneElement as $ } from "react";
3
+ import a from "@emotion/styled";
4
+ const k = a.div`
5
5
  display: inline-flex;
6
6
  align-items: center;
7
7
  justify-content: center;
8
- gap: ${({ theme: { spacing: e } }) => e.content(2)}px;
9
- cursor: ${({ disabled: e }) => e ? "not-allowed" : "pointer"};
10
- flex-direction: ${({ placement: e }) => e === "left" ? "row-reverse" : "row"};
11
- `, k = p.div`
8
+ gap: ${({ theme: { spacing: t } }) => t.content(2)}px;
9
+ cursor: ${({ disabled: t }) => t ? "not-allowed" : "pointer"};
10
+ flex-direction: ${({ placement: t }) => t === "left" ? "row-reverse" : "row"};
11
+ `, v = a.div`
12
12
  display: inline-flex;
13
- `, H = p.div`
13
+ `, z = a.label`
14
+ cursor: pointer;
15
+
14
16
  ${({
15
17
  theme: {
16
- palette: { grey: e },
17
- typography: { h0R: o, b2R: i }
18
+ palette: { grey: t },
19
+ typography: { h0R: o, b2R: n }
18
20
  },
19
- size: c,
21
+ size: f,
20
22
  disabled: l
21
23
  }) => {
22
- let r = {
23
- fontSize: i.size,
24
- fontWeight: i.weight,
25
- lineHeight: i.lineHeight,
26
- letterSpacing: i.letterSpacing
24
+ let i = {
25
+ fontSize: n.size,
26
+ fontWeight: n.weight,
27
+ lineHeight: n.lineHeight,
28
+ letterSpacing: n.letterSpacing
27
29
  };
28
- return c === "2xLarge" && (r = {
30
+ return f === "2xLarge" && (i = {
29
31
  fontSize: o.size,
30
32
  fontWeight: o.weight,
31
33
  lineHeight: o.lineHeight,
32
34
  letterSpacing: o.letterSpacing
33
- }), l && (r.color = e[30]), r;
35
+ }), l && (i.color = t[30], i.cursor = "not-allowed"), i;
34
36
  }}
35
- `, F = C(function({ control: o, text: i, placement: c, size: l, onClick: r, disabled: f, inlineCSS: u, ...d }, h) {
36
- const s = S(null), m = (t) => {
37
- var n, a;
38
- t.preventDefault(), (a = (n = s.current) == null ? void 0 : n.getElementsByTagName("input")[0]) == null || a.click(), typeof r == "function" && r(t);
39
- }, x = (t) => (n) => {
40
- n.stopPropagation(), typeof t == "function" && t(n);
37
+ `, L = S(function({
38
+ control: o,
39
+ text: n,
40
+ placement: f,
41
+ size: l,
42
+ onClick: i,
43
+ disabled: s,
44
+ inlineCSS: u,
45
+ controlWrapperProps: p,
46
+ textProps: h,
47
+ ...c
48
+ }, m) {
49
+ const x = j(null), C = F(), d = (c == null ? void 0 : c.id) || C, y = (e) => (r) => {
50
+ r.stopPropagation(), typeof e == "function" && e(r);
41
51
  };
42
- return /* @__PURE__ */ y(
43
- j,
52
+ return /* @__PURE__ */ w(
53
+ k,
44
54
  {
45
- ref: h,
46
- onClick: m,
47
- placement: c,
48
- disabled: f,
49
- ...d,
55
+ ref: m,
56
+ placement: f,
57
+ disabled: s,
58
+ ...c,
50
59
  css: u,
51
60
  children: [
52
- /* @__PURE__ */ g(k, { ref: s, children: w.map(o, (t) => {
53
- var n;
54
- return v(t) ? T(t, {
61
+ /* @__PURE__ */ g(v, { ref: x, ...p, children: H.map(o, (e) => {
62
+ var r;
63
+ return T(e) ? $(e, {
55
64
  size: l,
56
- disabled: f,
57
- onClick: x((n = t.props) == null ? void 0 : n.onClick),
58
- ...t.props
65
+ disabled: s,
66
+ onClick: y((r = e.props) == null ? void 0 : r.onClick),
67
+ id: d,
68
+ ...e.props
59
69
  }) : null;
60
70
  }) }),
61
- /* @__PURE__ */ g(H, { size: l, disabled: f, children: i })
71
+ /* @__PURE__ */ g(z, { size: l, disabled: s, htmlFor: d, ...h, children: n })
62
72
  ]
63
73
  }
64
74
  );
65
75
  });
66
76
  export {
67
- F as default
77
+ L as default
68
78
  };
package/Icon/Icon.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@emotion/react/jsx-runtime"),t=require("react"),S=require("../resources/tictoccroc/icons/index.ts-IVJAK4qr.cjs"),b=require("@emotion/styled"),h=require("../utils/getPaletteColor/getPaletteColor.cjs"),I=r=>r&&r.__esModule?r:{default:r},w=I(b),$=r=>w.default(r)`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@emotion/react/jsx-runtime"),t=require("react"),S=require("../resources/tictoccroc/icons/index.ts-BmqvB_n6.cjs"),b=require("@emotion/styled"),h=require("../utils/getPaletteColor/getPaletteColor.cjs"),I=r=>r&&r.__esModule?r:{default:r},w=I(b),$=r=>w.default(r)`
2
2
  ${({size:o,width:s,height:a})=>{let n={width:s,height:a};switch(o){case"large":n={width:32,height:32};break;case"medium":n={width:24,height:24};break;case"small":n={width:20,height:20};break;case"xSmall":n={width:16,height:16};break}return n}};
3
3
 
4
4
  color: ${({theme:o,color:s="grey.100"})=>h.default(s,{theme:o})};
package/Icon/Icon.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as w } from "@emotion/react/jsx-runtime";
2
2
  import { forwardRef as y, Children as f, isValidElement as i, cloneElement as s } from "react";
3
- import { S as $ } from "../resources/tictoccroc/icons/index.ts-CarI_z7q.js";
3
+ import { S as $ } from "../resources/tictoccroc/icons/index.ts-CzTh-XsD.js";
4
4
  import b from "@emotion/styled";
5
5
  import x from "../utils/getPaletteColor/getPaletteColor.es.js";
6
6
  const g = (p) => b(p)`
@@ -1,21 +1,21 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@emotion/react/jsx-runtime"),h=require("react"),b=require("../Icon/Icon.cjs"),g=require("../hooks/useCheckHoverPossible/useCheckHoverPossible.cjs"),k=require("../utils/getIconLabel/getIconLabel.cjs"),v=require("@emotion/styled"),f=require("../utils/getContrastingTextColor/getContrastingTextColor.cjs"),m=r=>r&&r.__esModule?r:{default:r},s=m(v),C=s.default.button`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("@emotion/react/jsx-runtime"),v=require("react"),m=require("../Icon/Icon.cjs"),C=require("../hooks/useCheckHoverPossible/useCheckHoverPossible.cjs"),p=require("../utils/getIconLabel/getIconLabel.cjs"),w=require("@emotion/styled"),x=require("../utils/getContrastingTextColor/getContrastingTextColor.cjs"),j=r=>r&&r.__esModule?r:{default:r},u=j(w),q=u.default.button`
2
2
  display: inline-flex;
3
3
  align-items: center;
4
4
  justify-content: center;
5
5
  border-radius: 100px;
6
6
 
7
- ${({theme:{spacing:r},size:e})=>{let i={width:40,height:40,padding:r.content(1)};switch(e){case"2xLarge":i={width:80,height:80,padding:0};break;case"xLarge":i={width:56,height:56,padding:r.content(.5)};break;case"large":i={width:48,height:48,padding:r.content(1)};break;case"small":i={width:32,height:32,padding:r.content(1)};break;case"xSmall":i={width:24,height:24,padding:r.content(.5)};break}return i}};
7
+ ${({theme:{spacing:r},size:t})=>{let i={width:40,height:40,padding:r.content(1)};switch(t){case"2xLarge":i={width:80,height:80,padding:0};break;case"xLarge":i={width:56,height:56,padding:r.content(.5)};break;case"large":i={width:48,height:48,padding:r.content(1)};break;case"small":i={width:32,height:32,padding:r.content(1)};break;case"xSmall":i={width:24,height:24,padding:r.content(.5)};break}return i}};
8
8
 
9
- ${({theme:{palette:{yellow:r,grey:e}},variant:i,color:a,isHoverPossible:t})=>{let o={'&:not([aria-disabled="true"]):active > div':{backgroundColor:e[10]},...t?{'&:not([aria-disabled="true"]):hover > div':{backgroundColor:e[10]}}:{}};switch(i){case"standard":a==="tertiary"&&(o={'&:not([aria-disabled="true"]):active > div':{backgroundColor:e[80]},...t?{'&:not([aria-disabled="true"]):hover > div':{backgroundColor:e[80]}}:{}});break;case"filled":a==="primary"&&(o={'&:not([aria-disabled="true"]):active > div':{backgroundColor:r[80]},...t?{'&:not([aria-disabled="true"]):hover > div':{backgroundColor:r[80]}}:{}}),a==="secondary"&&(o={'&:not([aria-disabled="true"]):active > div':{backgroundColor:e[100]},...t?{'&:not([aria-disabled="true"]):hover > div':{backgroundColor:e[100]}}:{}});break;case"outlined":a==="primary"&&(o={'&:not([aria-disabled="true"]):active > div':{backgroundColor:e[10]},...t?{'&:not([aria-disabled="true"]):hover > div':{backgroundColor:e[10]}}:{}}),a==="tertiary"&&(o={'&:not([aria-disabled="true"]):active > div':{backgroundColor:e[100]},...t?{'&:not([aria-disabled="true"]):hover > div':{backgroundColor:e[100]}}:{}});break}return o}};
9
+ ${({theme:{palette:{yellow:r,grey:t}},variant:i,color:a,isHoverPossible:e})=>{let d={'&:not([aria-disabled="true"]):active > div':{backgroundColor:t[10]},...e?{'&:not([aria-disabled="true"]):hover > div':{backgroundColor:t[10]}}:{}};switch(i){case"standard":a==="tertiary"&&(d={'&:not([aria-disabled="true"]):active > div':{backgroundColor:t[80]},...e?{'&:not([aria-disabled="true"]):hover > div':{backgroundColor:t[80]}}:{}});break;case"filled":a==="primary"&&(d={'&:not([aria-disabled="true"]):active > div':{backgroundColor:r[80]},...e?{'&:not([aria-disabled="true"]):hover > div':{backgroundColor:r[80]}}:{}}),a==="secondary"&&(d={'&:not([aria-disabled="true"]):active > div':{backgroundColor:t[100]},...e?{'&:not([aria-disabled="true"]):hover > div':{backgroundColor:t[100]}}:{}});break;case"outlined":a==="primary"&&(d={'&:not([aria-disabled="true"]):active > div':{backgroundColor:t[10]},...e?{'&:not([aria-disabled="true"]):hover > div':{backgroundColor:t[10]}}:{}}),a==="tertiary"&&(d={'&:not([aria-disabled="true"]):active > div':{backgroundColor:t[100]},...e?{'&:not([aria-disabled="true"]):hover > div':{backgroundColor:t[100]}}:{}});break}return d}};
10
10
 
11
11
  &[aria-disabled='true'] {
12
12
  cursor: not-allowed;
13
13
 
14
14
  & > div {
15
- ${({theme:{palette:{brand:r,grey:e}},variant:i,color:a})=>{let t={backgroundColor:"transparent","& svg":{color:e[30]}};switch(i){case"standard":a==="tertiary"&&(t={backgroundColor:"transparent","& svg":{color:e[80]}});break;case"filled":a==="primary"&&(t={backgroundColor:r.primary.disable,"& svg":{color:e[30]}}),a==="secondary"&&(t={backgroundColor:e[10],"& svg":{color:e[30]}});break;case"outlined":a==="secondary"&&(t={backgroundColor:e[10],borderColor:e[30],"& svg":{color:e[30]}}),a==="tertiary"&&(t={backgroundColor:e[80],borderColor:e[70],"& svg":{color:e[70]}});break}return t}};
15
+ ${({theme:{palette:{brand:r,grey:t}},variant:i,color:a})=>{let e={backgroundColor:"transparent","& svg":{color:t[30]}};switch(i){case"standard":a==="tertiary"&&(e={backgroundColor:"transparent","& svg":{color:t[80]}});break;case"filled":a==="primary"&&(e={backgroundColor:r.primary.disable,"& svg":{color:t[30]}}),a==="secondary"&&(e={backgroundColor:t[10],"& svg":{color:t[30]}});break;case"outlined":a==="secondary"&&(e={backgroundColor:t[10],borderColor:t[30],"& svg":{color:t[30]}}),a==="tertiary"&&(e={backgroundColor:t[80],borderColor:t[70],"& svg":{color:t[70]}});break}return e}};
16
16
  }
17
17
  }
18
- `,p=s.default.div`
18
+ `,W=u.default.div`
19
19
  display: flex;
20
20
  align-items: center;
21
21
  justify-content: center;
@@ -24,7 +24,7 @@
24
24
  border: 1px solid transparent;
25
25
  border-radius: 100px;
26
26
 
27
- ${({theme:{palette:{brand:r,grey:e}},variant:i,color:a})=>{let t={backgroundColor:"transparent"};switch(i){case"standard":a==="tertiary"&&(t={backgroundColor:"transparent","& svg":{color:e.white}});break;case"filled":a==="primary"&&(t={backgroundColor:r.primary.main,color:f.default(r.primary.main,[e.white,e[100]]),"& svg":{color:"inherit"}}),a==="secondary"&&(t={backgroundColor:r.secondary,color:e.white,"& svg":{color:"inherit"}});break;case"outlined":a==="primary"&&(t={backgroundColor:e.white,borderColor:e[50]}),a==="tertiary"&&(t={backgroundColor:"transparent",borderColor:e[50],"& svg":{color:e[50]}});break}return t}};
27
+ ${({theme:{palette:{brand:r,grey:t}},variant:i,color:a})=>{let e={backgroundColor:"transparent"};switch(i){case"standard":a==="tertiary"&&(e={backgroundColor:"transparent","& svg":{color:t.white}});break;case"filled":a==="primary"&&(e={backgroundColor:r.primary.main,color:x.default(r.primary.main,[t.white,t[100]]),"& svg":{color:"inherit"}}),a==="secondary"&&(e={backgroundColor:r.secondary,color:t.white,"& svg":{color:"inherit"}});break;case"outlined":a==="primary"&&(e={backgroundColor:t.white,borderColor:t[50]}),a==="tertiary"&&(e={backgroundColor:"transparent",borderColor:t[50],"& svg":{color:t[50]}});break}return e}};
28
28
 
29
- ${({size:r})=>{let e={minWidth:32,minHeight:32,"& svg":{width:24,height:24}};switch(r){case"2xLarge":e={minWidth:80,minHeight:80,borderWidth:2,"& svg":{width:48,height:48}};break;case"xLarge":e={minWidth:52,minHeight:52,"& svg":{width:36,height:36}};break;case"large":e={minWidth:40,minHeight:40,"& svg":{width:32,height:32}};break;case"small":e={minWidth:24,minHeight:24,"& svg":{width:16,height:16}};break;case"xSmall":e={minWidth:20,minHeight:20,"& svg":{width:16,height:16}};break}return e}};
30
- `,w=h.forwardRef(function({name:e,variant:i="standard",size:a="medium",color:t="primary",inlineCSS:o,disabled:n=!1,...c},l){const{isHoverPossible:u}=g.default();return d.jsx(C,{ref:l,variant:i,size:a,color:t,"aria-disabled":n,"aria-label":k.default(e),isHoverPossible:u,disabled:n,...c,css:o,children:d.jsx(p,{variant:i,size:a,color:t,children:d.jsx(b.default,{name:e,focusable:!1})})})});exports.default=w;
29
+ ${({size:r})=>{let t={minWidth:32,minHeight:32,"& svg":{width:24,height:24}};switch(r){case"2xLarge":t={minWidth:80,minHeight:80,borderWidth:2,"& svg":{width:48,height:48}};break;case"xLarge":t={minWidth:52,minHeight:52,"& svg":{width:36,height:36}};break;case"large":t={minWidth:40,minHeight:40,"& svg":{width:32,height:32}};break;case"small":t={minWidth:24,minHeight:24,"& svg":{width:16,height:16}};break;case"xSmall":t={minWidth:20,minHeight:20,"& svg":{width:16,height:16}};break}return t}};
30
+ `,_=v.forwardRef(function({name:t,variant:i="standard",size:a="medium",color:e="primary",inlineCSS:d,disabled:o=!1,onClick:n,onKeyDown:s,...h},b){const{isHoverPossible:g}=C.default(),k=c=>{o||n==null||n(c)},f=c=>{o||s==null||s(c)};return l.jsx(q,{ref:b,variant:i,size:a,color:e,"aria-disabled":o,"aria-label":p.default(t),isHoverPossible:g,onClick:k,onKeyDown:f,...h,css:d,children:l.jsx(W,{variant:i,size:a,color:e,children:l.jsx(m.default,{name:t,focusable:!1})})})});exports.default=_;
@@ -1,11 +1,11 @@
1
- import { jsx as d } from "@emotion/react/jsx-runtime";
2
- import { forwardRef as b } from "react";
3
- import u from "../Icon/Icon.es.js";
4
- import m from "../hooks/useCheckHoverPossible/useCheckHoverPossible.es.js";
5
- import g from "../utils/getIconLabel/getIconLabel.es.js";
6
- import c from "@emotion/styled";
7
- import k from "../utils/getContrastingTextColor/getContrastingTextColor.es.js";
8
- const v = c.button`
1
+ import { jsx as l } from "@emotion/react/jsx-runtime";
2
+ import { forwardRef as f } from "react";
3
+ import v from "../Icon/Icon.es.js";
4
+ import p from "../hooks/useCheckHoverPossible/useCheckHoverPossible.es.js";
5
+ import C from "../utils/getIconLabel/getIconLabel.es.js";
6
+ import h from "@emotion/styled";
7
+ import w from "../utils/getContrastingTextColor/getContrastingTextColor.es.js";
8
+ const x = h.button`
9
9
  display: inline-flex;
10
10
  align-items: center;
11
11
  justify-content: center;
@@ -157,7 +157,7 @@ const v = c.button`
157
157
  }};
158
158
  }
159
159
  }
160
- `, f = c.div`
160
+ `, j = h.div`
161
161
  display: flex;
162
162
  align-items: center;
163
163
  justify-content: center;
@@ -188,7 +188,7 @@ const v = c.button`
188
188
  case "filled":
189
189
  a === "primary" && (t = {
190
190
  backgroundColor: e.primary.main,
191
- color: k(e.primary.main, [r.white, r[100]]),
191
+ color: w(e.primary.main, [r.white, r[100]]),
192
192
  "& svg": {
193
193
  color: "inherit"
194
194
  }
@@ -280,33 +280,40 @@ const v = c.button`
280
280
  }
281
281
  return r;
282
282
  }};
283
- `, L = b(function({
283
+ `, S = f(function({
284
284
  name: r,
285
285
  variant: i = "standard",
286
286
  size: a = "medium",
287
287
  color: t = "primary",
288
288
  inlineCSS: o,
289
- disabled: n = !1,
290
- ...s
291
- }, l) {
292
- const { isHoverPossible: h } = m();
293
- return /* @__PURE__ */ d(
294
- v,
289
+ disabled: d = !1,
290
+ onClick: n,
291
+ onKeyDown: c,
292
+ ...b
293
+ }, u) {
294
+ const { isHoverPossible: m } = p(), g = (s) => {
295
+ d || n == null || n(s);
296
+ }, k = (s) => {
297
+ d || c == null || c(s);
298
+ };
299
+ return /* @__PURE__ */ l(
300
+ x,
295
301
  {
296
- ref: l,
302
+ ref: u,
297
303
  variant: i,
298
304
  size: a,
299
305
  color: t,
300
- "aria-disabled": n,
301
- "aria-label": g(r),
302
- isHoverPossible: h,
303
- disabled: n,
304
- ...s,
306
+ "aria-disabled": d,
307
+ "aria-label": C(r),
308
+ isHoverPossible: m,
309
+ onClick: g,
310
+ onKeyDown: k,
311
+ ...b,
305
312
  css: o,
306
- children: /* @__PURE__ */ d(f, { variant: i, size: a, color: t, children: /* @__PURE__ */ d(u, { name: r, focusable: !1 }) })
313
+ children: /* @__PURE__ */ l(j, { variant: i, size: a, color: t, children: /* @__PURE__ */ l(v, { name: r, focusable: !1 }) })
307
314
  }
308
315
  );
309
316
  });
310
317
  export {
311
- L as default
318
+ S as default
312
319
  };
@@ -1,14 +1,14 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("@emotion/react/jsx-runtime"),f=require("react"),p=require("@emotion/react"),g=require("@emotion/styled"),m=e=>e&&e.__esModule?e:{default:e},n=m(g),h=p.keyframes`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("@emotion/react/jsx-runtime"),f=require("react"),g=require("@emotion/react"),m=require("@emotion/styled"),p=e=>e&&e.__esModule?e:{default:e},o=p(m),b=g.keyframes`
2
2
  to {
3
3
  transform: translateX(100%);
4
4
  }
5
- `,y=n.default.div`
5
+ `,h=o.default.div`
6
6
  position: relative;
7
7
  height: ${({size:e})=>e==="large"?42:4}px;
8
8
  border-radius: 100px;
9
9
  background-color: ${({theme:{palette:{grey:e}}})=>e[10]};
10
10
  overflow: hidden;
11
- `,x=n.default.div`
11
+ `,y=o.default.div`
12
12
  position: absolute;
13
13
  top: 0;
14
14
  left: 0;
@@ -21,8 +21,8 @@
21
21
  transition: transform ${({transitionDuration:e})=>e}ms linear;
22
22
  background-color: ${({theme:{palette:{brand:e}}})=>e.primary.main};
23
23
 
24
- ${({loop:e})=>e?{animation:`${h} 1s infinite`}:{}};
25
- `,b=n.default.div`
24
+ ${({loop:e})=>e?{animation:`${b} 1s infinite`}:{}};
25
+ `,x=o.default.div`
26
26
  position: absolute;
27
27
  top: 0;
28
28
  left: 0;
@@ -32,4 +32,4 @@
32
32
  width: 100%;
33
33
  height: 100%;
34
34
  white-space: nowrap;
35
- `,j=f.forwardRef(function({children:o,size:i,value:s=0,transitionDuration:l=500,loop:a,inlineCSS:d,...c},u){let t=s-100;return t=s>100?0:t,t=a?-80:t,r.jsxs(y,{ref:u,size:i,...c,css:d,children:[r.jsx(x,{transitionDuration:l,loop:a,style:{transform:`translate3d(${t}%, 0, 0)`}}),i==="large"&&o&&r.jsx(b,{children:o})]})});exports.default=j;
35
+ `,j=f.forwardRef(function({children:s,size:l,value:r=0,transitionDuration:d=500,loop:a,inlineCSS:c,...i},u){let t=r-100;return t=r>100?0:t,t=a?-80:t,n.jsxs(h,{role:"progressbar","aria-valuenow":a?void 0:r,"aria-label":i["aria-label"]?i["aria-label"]:"로딩 중",ref:u,size:l,...i,css:c,children:[n.jsx(y,{transitionDuration:d,loop:a,style:{transform:`translate3d(${t}%, 0, 0)`}}),l==="large"&&s&&n.jsx(x,{children:s})]})});exports.default=j;
@@ -1,12 +1,12 @@
1
- import { jsxs as m, jsx as a } from "@emotion/react/jsx-runtime";
1
+ import { jsxs as m, jsx as l } from "@emotion/react/jsx-runtime";
2
2
  import { forwardRef as p } from "react";
3
3
  import { keyframes as g } from "@emotion/react";
4
- import r from "@emotion/styled";
4
+ import a from "@emotion/styled";
5
5
  const h = g`
6
6
  to {
7
7
  transform: translateX(100%);
8
8
  }
9
- `, u = r.div`
9
+ `, b = a.div`
10
10
  position: relative;
11
11
  height: ${({ size: t }) => t === "large" ? 42 : 4}px;
12
12
  border-radius: 100px;
@@ -16,7 +16,7 @@ const h = g`
16
16
  }
17
17
  }) => t[10]};
18
18
  overflow: hidden;
19
- `, y = r.div`
19
+ `, u = a.div`
20
20
  position: absolute;
21
21
  top: 0;
22
22
  left: 0;
@@ -36,7 +36,7 @@ const h = g`
36
36
  ${({ loop: t }) => t ? {
37
37
  animation: `${h} 1s infinite`
38
38
  } : {}};
39
- `, x = r.div`
39
+ `, y = a.div`
40
40
  position: absolute;
41
41
  top: 0;
42
42
  left: 0;
@@ -46,24 +46,36 @@ const h = g`
46
46
  width: 100%;
47
47
  height: 100%;
48
48
  white-space: nowrap;
49
- `, v = p(
50
- function({ children: o, size: i, value: n = 0, transitionDuration: l = 500, loop: s, inlineCSS: d, ...c }, f) {
51
- let e = n - 100;
52
- return e = n > 100 ? 0 : e, e = s ? -80 : e, /* @__PURE__ */ m(u, { ref: f, size: i, ...c, css: d, children: [
53
- /* @__PURE__ */ a(
54
- y,
55
- {
56
- transitionDuration: l,
57
- loop: s,
58
- style: {
59
- transform: `translate3d(${e}%, 0, 0)`
60
- }
61
- }
62
- ),
63
- i === "large" && o && /* @__PURE__ */ a(x, { children: o })
64
- ] });
49
+ `, j = p(
50
+ function({ children: n, size: s, value: r = 0, transitionDuration: d = 500, loop: i, inlineCSS: c, ...o }, f) {
51
+ let e = r - 100;
52
+ return e = r > 100 ? 0 : e, e = i ? -80 : e, /* @__PURE__ */ m(
53
+ b,
54
+ {
55
+ role: "progressbar",
56
+ "aria-valuenow": i ? void 0 : r,
57
+ "aria-label": o["aria-label"] ? o["aria-label"] : "로딩 중",
58
+ ref: f,
59
+ size: s,
60
+ ...o,
61
+ css: c,
62
+ children: [
63
+ /* @__PURE__ */ l(
64
+ u,
65
+ {
66
+ transitionDuration: d,
67
+ loop: i,
68
+ style: {
69
+ transform: `translate3d(${e}%, 0, 0)`
70
+ }
71
+ }
72
+ ),
73
+ s === "large" && n && /* @__PURE__ */ l(y, { children: n })
74
+ ]
75
+ }
76
+ );
65
77
  }
66
78
  );
67
79
  export {
68
- v as default
80
+ j as default
69
81
  };
package/Menu/Menu.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@emotion/react/jsx-runtime"),o=require("react"),X=require("react-dom"),Y=require("@emotion/styled"),Z=t=>t&&t.__esModule?t:{default:t},x=Z(Y),tt=x.default.div`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@emotion/react/jsx-runtime"),o=require("react"),ot=require("react-dom"),z=require("../utils/getSibling/getSibling.cjs"),st=require("@emotion/styled"),it=e=>e&&e.__esModule?e:{default:e},$=it(st),rt=$.default.div`
2
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;
@@ -6,30 +6,30 @@
6
6
  height: 100%;
7
7
  z-index: 100003;
8
8
 
9
- ${({disableClickOutside:t})=>t?null:{pointerEvents:"none","& *":{pointerEvents:"auto"}}}}
9
+ ${({disableClickOutside:e})=>e?null:{pointerEvents:"none","& *":{pointerEvents:"auto"}}}}
10
10
 
11
- `,et=x.default.div`
11
+ `,ut=$.default.div`
12
12
  position: fixed;
13
- max-width: calc(100% - ${({theme:{spacing:t}})=>t.layout(4)}px);
13
+ max-width: calc(100% - ${({theme:{spacing:e}})=>e.layout(4)}px);
14
14
  border-radius: 10px;
15
15
  overflow: hidden;
16
- background-color: ${({theme:{palette:{grey:t}}})=>t.white};
17
- box-shadow: ${({theme:{elevation:t}})=>t[4]};
16
+ background-color: ${({theme:{palette:{grey:e}}})=>e.white};
17
+ box-shadow: ${({theme:{elevation:e}})=>e[4]};
18
18
  transition:
19
- transform ${({transitionDuration:t})=>t}ms,
20
- opacity ${({transitionDuration:t=0})=>t/2}ms;
21
- transform: scale(${({open:t})=>t?1:.97});
22
- opacity: ${({open:t})=>t?1:0};
19
+ transform ${({transitionDuration:e})=>e}ms,
20
+ opacity ${({transitionDuration:e=0})=>e/2}ms;
21
+ transform: scale(${({open:e})=>e?1:.97});
22
+ opacity: ${({open:e})=>e?1:0};
23
23
  z-index: 100003;
24
- `,ot=x.default.ul`
24
+ `,nt=$.default.ul`
25
25
  display: flex;
26
26
  flex-direction: column;
27
- max-height: ${({maxHeight:t})=>t}px;
27
+ max-height: ${({maxHeight:e})=>e}px;
28
28
  overflow-y: auto;
29
29
 
30
- ${({theme:{spacing:t},disablePadding:c})=>c?null:{padding:`${t.content(1)}px 0`}}}
31
- `,st=x.default.div`
30
+ ${({theme:{spacing:e},disablePadding:l})=>l?null:{padding:`${e.content(1)}px 0`}}}
31
+ `,ct=$.default.div`
32
32
  width: 100%;
33
33
  height: 1px;
34
- background-color: ${({theme:{palette:{grey:t}}})=>t[20]};
35
- `,b=24,it=o.forwardRef(function({children:c,anchorRef:u,open:v,onClose:m,spacing:f=4,transitionDuration:g=200,onChange:T,value:L,showDivider:P,placement:_="bottom-center",disablePadding:q,disableClickOutside:z=!0,width:E,fitToAnchorWidth:$=!0,maxHeight:H=476,style:R,inlineCSS:B,...D},G){const[h,j]=o.useState(0),[k,S]=o.useState(0),[w,F]=o.useState(0),[M,C]=o.useState(!1),[N,V]=o.useState(!1),[A,O]=o.useState(!0),l=o.useRef(),a=o.useRef(),W=o.useRef(null),J=(e,i)=>r=>{r.stopPropagation(),typeof m=="function"&&m(),typeof T=="function"&&T(e,r),typeof i=="function"&&i(r)};return o.useEffect(()=>{v&&(a.current&&clearTimeout(a.current),document.body.style.overflow="hidden",O(!1),l.current=setTimeout(()=>{C(!0)},100))},[v]),o.useEffect(()=>{v||(l.current&&clearTimeout(l.current),C(!1),document.body.removeAttribute("style"),a.current=setTimeout(()=>{O(!0)},g))},[v,g]),o.useEffect(()=>{const e=()=>{var I;const{offsetWidth:i=0,offsetHeight:r=0}=(u==null?void 0:u.current)||{},s=((I=u==null?void 0:u.current)==null?void 0:I.getBoundingClientRect())||{top:0,left:0,bottom:0},{offsetWidth:p=0,offsetHeight:n=0}=W.current||{},[y,K]=_.split("-");F(E||i);const Q=(s.top||0)-n-f-b<b,U=(s.bottom||0)+n+f+b>window.innerHeight;switch(y){case"top":j(Q?b:s.top-n-f);break;default:j(U?"auto":s.top+r+f);break}switch(K){case"left":S(s.left);break;case"right":S(s.left-Math.abs(i-p));break;default:S(s.left+i/2-p/2);break}};return e(),window.addEventListener("scroll",e),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e),window.removeEventListener("resize",e)}},[u,f,_,M,c,E]),o.useEffect(()=>{V(M&&!!h&&!!k&&!!w)},[M,h,k,w]),o.useEffect(()=>()=>{l.current&&clearTimeout(l.current),a.current&&clearTimeout(a.current)},[]),A?null:X.createPortal(d.jsx(tt,{onClick:m,disableClickOutside:z,children:d.jsx(et,{ref:G,open:N,transitionDuration:g,...D,css:B,style:{...R,top:h,left:k,bottom:h==="auto"?24:void 0,width:$?w:void 0},children:d.jsx(ot,{ref:W,disablePadding:q,maxHeight:H,children:o.Children.map(c,(e,i)=>{var r,s,p,n,y;return o.isValidElement(e)?d.jsxs(d.Fragment,{children:[o.cloneElement(e,{...e.props,selected:!!((r=e==null?void 0:e.props)!=null&&r.value)&&((s=e==null?void 0:e.props)==null?void 0:s.value)===L,onClick:J((p=e==null?void 0:e.props)==null?void 0:p.value,(n=e==null?void 0:e.props)==null?void 0:n.onClick),style:{...(y=e==null?void 0:e.props)==null?void 0:y.style,[E?"width":"minWidth"]:$?void 0:w,maxWidth:$?void 0:"100%"}}),P&&o.Children.count(c)!==i+1&&d.jsx(st,{})]}):null})})})}),document.body)});exports.default=it;
34
+ background-color: ${({theme:{palette:{grey:e}}})=>e[20]};
35
+ `,k=24,dt=o.forwardRef(function({children:l,anchorRef:d,open:w,onClose:f,spacing:v=4,transitionDuration:T=200,onChange:h,value:H,showDivider:F,placement:D="bottom-center",disablePadding:N,disableClickOutside:R=!0,width:M,fitToAnchorWidth:I=!0,maxHeight:A=476,style:B,inlineCSS:C,menuProps:G,...K},U){const[m,O]=o.useState(0),[_,j]=o.useState(0),[g,V]=o.useState(0),[q,W]=o.useState(!1),[J,Q]=o.useState(!1),[X,L]=o.useState(!0),[Y,p]=o.useState(null),b=o.useRef(),x=o.useRef(),E=o.useRef(null),Z=(t,s)=>u=>{u.stopPropagation(),typeof f=="function"&&f(),typeof h=="function"&&h(t,u),typeof s=="function"&&s(u)},tt=t=>s=>{var r,c,n,a;s.key==="Tab"&&typeof f=="function"&&(f(),p(0)),(s.key==="Enter"||s.key===" ")&&typeof f=="function"&&typeof h=="function"&&(f(),h(t,s));const u=document.activeElement;if(u){if(s.code==="ArrowDown"){const i=z.default(u,"next",{skipDisabled:!0});i&&i.dataset.index?(p(Number(i.dataset.index)),i.focus()):(p(0),(c=(r=E.current)==null?void 0:r.querySelector('[role="menuitem"]'))==null||c.focus())}if(s.code==="ArrowUp"){const i=z.default(u,"prev",{skipDisabled:!0});i&&i.dataset.index?(p(Number(i.dataset.index)),i.focus()):(p(o.Children.count(l)-1),(a=(n=E.current)==null?void 0:n.querySelector('[role="menuitem"]:last-child'))==null||a.focus())}}};return o.useEffect(()=>{w&&(x.current&&clearTimeout(x.current),document.body.style.overflow="hidden",L(!1),b.current=setTimeout(()=>{W(!0)},100))},[w]),o.useEffect(()=>{w||(b.current&&clearTimeout(b.current),W(!1),document.body.removeAttribute("style"),x.current=setTimeout(()=>{L(!0),p(0)},T))},[w,T]),o.useEffect(()=>{const t=()=>{var P;const{offsetWidth:s=0,offsetHeight:u=0}=(d==null?void 0:d.current)||{},r=((P=d==null?void 0:d.current)==null?void 0:P.getBoundingClientRect())||{top:0,left:0,bottom:0},{offsetWidth:c=0,offsetHeight:n=0}=E.current||{},[a,i]=D.split("-");V(M||s);const S=(r.top||0)-n-v-k<k,et=(r.bottom||0)+n+v+k>window.innerHeight;switch(a){case"top":O(S?k:r.top-n-v);break;default:O(et?"auto":r.top+u+v);break}switch(i){case"left":j(r.left);break;case"right":j(r.left-Math.abs(s-c));break;default:j(r.left+s/2-c/2);break}};return t(),window.addEventListener("scroll",t),window.addEventListener("resize",t),()=>{window.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[d,v,D,q,l,M]),o.useEffect(()=>{Q(q&&!!m&&!!_&&!!g)},[q,m,_,g]),o.useEffect(()=>()=>{b.current&&clearTimeout(b.current),x.current&&clearTimeout(x.current)},[]),X?null:ot.createPortal(y.jsx(rt,{onClick:f,disableClickOutside:R,children:y.jsx(ut,{ref:U,open:J,transitionDuration:T,...K,css:C,style:{...B,top:m,left:_,bottom:m==="auto"?24:void 0,width:I?g:void 0},children:y.jsx(nt,{role:"menu",ref:E,disablePadding:N,maxHeight:A,...G,children:o.Children.map(l,(t,s)=>{var r,c,n,a,i,S;if(!o.isValidElement(t))return null;const u=Y===s;return y.jsxs(y.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:Z((n=t==null?void 0:t.props)==null?void 0:n.value,(a=t==null?void 0:t.props)==null?void 0:a.onClick),onKeyDown:tt((i=t==null?void 0:t.props)==null?void 0:i.value),tabIndex:u?0:-1,style:{...(S=t==null?void 0:t.props)==null?void 0:S.style,[M?"width":"minWidth"]:I?void 0:g,maxWidth:I?void 0:"100%"}}),F&&o.Children.count(l)!==s+1&&y.jsx(ct,{})]})})})})}),document.body)});exports.default=dt;
package/Menu/Menu.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { HTMLAttributes, MouseEvent, ReactElement, ReactNode, RefObject } from 'react';
1
+ import { HTMLAttributes, ReactElement, ReactNode, RefObject, SyntheticEvent } from 'react';
2
2
  import { GeneralComponentProps } from '../typings/component';
3
3
  import { default as MenuBlock } from './MenuBlock';
4
4
 
@@ -8,7 +8,7 @@ export interface MenuProps extends GeneralComponentProps<Omit<HTMLAttributes<HTM
8
8
  onClose?: () => void;
9
9
  spacing?: number;
10
10
  transitionDuration?: number;
11
- onChange?: (newValue?: string | number, e?: MouseEvent) => void;
11
+ onChange?: (newValue?: string | number, e?: SyntheticEvent) => void;
12
12
  value?: string | number;
13
13
  showDivider?: boolean;
14
14
  placement?: 'bottom-left' | 'bottom-right' | 'bottom-center' | 'top-left' | 'top-right' | 'top-center';
@@ -18,6 +18,7 @@ export interface MenuProps extends GeneralComponentProps<Omit<HTMLAttributes<HTM
18
18
  width?: number;
19
19
  fitToAnchorWidth?: boolean;
20
20
  maxHeight?: number;
21
+ menuProps?: HTMLAttributes<HTMLUListElement>;
21
22
  }
22
23
  declare const Menu: import('react').ForwardRefExoticComponent<MenuProps & import('react').RefAttributes<HTMLDivElement>>;
23
24
  export default Menu;