@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
package/Menu/Menu.es.js CHANGED
@@ -1,8 +1,9 @@
1
- import { jsx as y, jsxs as tt, Fragment as ot } from "@emotion/react/jsx-runtime";
2
- import { forwardRef as et, useState as u, useRef as W, useEffect as a, Children as j, isValidElement as it, cloneElement as rt } from "react";
3
- import { createPortal as st } from "react-dom";
4
- import x from "@emotion/styled";
5
- const nt = x.div`
1
+ import { jsx as $, jsxs as st, Fragment as nt } from "@emotion/react/jsx-runtime";
2
+ import { forwardRef as ut, useState as a, useRef as z, useEffect as b, Children as H, isValidElement as ct, cloneElement as dt } from "react";
3
+ import { createPortal as ft } from "react-dom";
4
+ import A from "../utils/getSibling/getSibling.es.js";
5
+ import I from "@emotion/styled";
6
+ const at = I.div`
6
7
  position: fixed;
7
8
  top: 0;
8
9
  left: 0;
@@ -17,7 +18,7 @@ const nt = x.div`
17
18
  }
18
19
  }}}
19
20
 
20
- `, ut = x.div`
21
+ `, lt = I.div`
21
22
  position: fixed;
22
23
  max-width: calc(100% - ${({ theme: { spacing: o } }) => o.layout(4)}px);
23
24
  border-radius: 10px;
@@ -34,16 +35,16 @@ const nt = x.div`
34
35
  transform: scale(${({ open: o }) => o ? 1 : 0.97});
35
36
  opacity: ${({ open: o }) => o ? 1 : 0};
36
37
  z-index: 100003;
37
- `, dt = x.ul`
38
+ `, pt = I.ul`
38
39
  display: flex;
39
40
  flex-direction: column;
40
41
  max-height: ${({ maxHeight: o }) => o}px;
41
42
  overflow-y: auto;
42
43
 
43
- ${({ theme: { spacing: o }, disablePadding: d }) => d ? null : {
44
+ ${({ theme: { spacing: o }, disablePadding: l }) => l ? null : {
44
45
  padding: `${o.content(1)}px 0`
45
46
  }}}
46
- `, ct = x.div`
47
+ `, yt = I.div`
47
48
  width: 100%;
48
49
  height: 1px;
49
50
  background-color: ${({
@@ -51,113 +52,146 @@ const nt = x.div`
51
52
  palette: { grey: o }
52
53
  }
53
54
  }) => o[20]};
54
- `, b = 24, vt = et(function({
55
- children: d,
56
- anchorRef: s,
57
- open: v,
58
- onClose: g,
59
- spacing: c = 4,
60
- transitionDuration: $ = 200,
61
- onChange: I,
55
+ `, T = 24, ht = ut(function({
56
+ children: l,
57
+ anchorRef: c,
58
+ open: w,
59
+ onClose: d,
60
+ spacing: y = 4,
61
+ transitionDuration: S = 200,
62
+ onChange: x,
62
63
  value: B,
63
64
  showDivider: G,
64
- placement: L = "bottom-center",
65
- disablePadding: F,
66
- disableClickOutside: N = !0,
67
- width: E,
68
- fitToAnchorWidth: k = !0,
65
+ placement: P = "bottom-center",
66
+ disablePadding: K,
67
+ disableClickOutside: U = !0,
68
+ width: M,
69
+ fitToAnchorWidth: W = !0,
69
70
  maxHeight: V = 476,
70
71
  style: _,
71
- inlineCSS: q,
72
- ...A
73
- }, D) {
74
- const [w, O] = u(0), [T, C] = u(0), [h, J] = u(0), [M, z] = u(!1), [K, Q] = u(!1), [U, H] = u(!0), f = W(), l = W(), P = W(null), X = (t, i) => (r) => {
75
- r.stopPropagation(), typeof g == "function" && g(), typeof I == "function" && I(t, r), typeof i == "function" && i(r);
72
+ inlineCSS: C,
73
+ menuProps: J,
74
+ ...Q
75
+ }, X) {
76
+ const [h, F] = a(0), [D, L] = a(0), [g, Y] = a(0), [O, N] = a(!1), [Z, R] = a(!1), [tt, j] = a(!0), [ot, p] = a(null), m = z(), v = z(), k = z(null), et = (t, e) => (s) => {
77
+ s.stopPropagation(), typeof d == "function" && d(), typeof x == "function" && x(t, s), typeof e == "function" && e(s);
78
+ }, it = (t) => (e) => {
79
+ var r, u, n, f;
80
+ e.key === "Tab" && typeof d == "function" && (d(), p(0)), (e.key === "Enter" || e.key === " ") && typeof d == "function" && typeof x == "function" && (d(), x(t, e));
81
+ const s = document.activeElement;
82
+ if (s) {
83
+ if (e.code === "ArrowDown") {
84
+ const i = A(s, "next", { skipDisabled: !0 });
85
+ i && i.dataset.index ? (p(Number(i.dataset.index)), i.focus()) : (p(0), (u = (r = k.current) == null ? void 0 : r.querySelector('[role="menuitem"]')) == null || u.focus());
86
+ }
87
+ if (e.code === "ArrowUp") {
88
+ const i = A(s, "prev", { skipDisabled: !0 });
89
+ i && i.dataset.index ? (p(Number(i.dataset.index)), i.focus()) : (p(H.count(l) - 1), (f = (n = k.current) == null ? void 0 : n.querySelector('[role="menuitem"]:last-child')) == null || f.focus());
90
+ }
91
+ }
76
92
  };
77
- return a(() => {
78
- v && (l.current && clearTimeout(l.current), document.body.style.overflow = "hidden", H(!1), f.current = setTimeout(() => {
79
- z(!0);
93
+ return b(() => {
94
+ w && (v.current && clearTimeout(v.current), document.body.style.overflow = "hidden", j(!1), m.current = setTimeout(() => {
95
+ N(!0);
80
96
  }, 100));
81
- }, [v]), a(() => {
82
- v || (f.current && clearTimeout(f.current), z(!1), document.body.removeAttribute("style"), l.current = setTimeout(() => {
83
- H(!0);
84
- }, $));
85
- }, [v, $]), a(() => {
97
+ }, [w]), b(() => {
98
+ w || (m.current && clearTimeout(m.current), N(!1), document.body.removeAttribute("style"), v.current = setTimeout(() => {
99
+ j(!0), p(0);
100
+ }, S));
101
+ }, [w, S]), b(() => {
86
102
  const t = () => {
87
- var S;
88
- const { offsetWidth: i = 0, offsetHeight: r = 0 } = (s == null ? void 0 : s.current) || {}, e = ((S = s == null ? void 0 : s.current) == null ? void 0 : S.getBoundingClientRect()) || {
103
+ var q;
104
+ const { offsetWidth: e = 0, offsetHeight: s = 0 } = (c == null ? void 0 : c.current) || {}, r = ((q = c == null ? void 0 : c.current) == null ? void 0 : q.getBoundingClientRect()) || {
89
105
  top: 0,
90
106
  left: 0,
91
107
  bottom: 0
92
- }, { offsetWidth: p = 0, offsetHeight: n = 0 } = P.current || {}, [m, Y] = L.split("-");
93
- J(E || i);
94
- const Z = (e.top || 0) - n - c - b < b, R = (e.bottom || 0) + n + c + b > window.innerHeight;
95
- switch (m) {
108
+ }, { offsetWidth: u = 0, offsetHeight: n = 0 } = k.current || {}, [f, i] = P.split("-");
109
+ Y(M || e);
110
+ const E = (r.top || 0) - n - y - T < T, rt = (r.bottom || 0) + n + y + T > window.innerHeight;
111
+ switch (f) {
96
112
  case "top":
97
- O(
98
- Z ? b : e.top - n - c
113
+ F(
114
+ E ? T : r.top - n - y
99
115
  );
100
116
  break;
101
117
  default:
102
- O(R ? "auto" : e.top + r + c);
118
+ F(rt ? "auto" : r.top + s + y);
103
119
  break;
104
120
  }
105
- switch (Y) {
121
+ switch (i) {
106
122
  case "left":
107
- C(e.left);
123
+ L(r.left);
108
124
  break;
109
125
  case "right":
110
- C(e.left - Math.abs(i - p));
126
+ L(r.left - Math.abs(e - u));
111
127
  break;
112
128
  default:
113
- C(e.left + i / 2 - p / 2);
129
+ L(r.left + e / 2 - u / 2);
114
130
  break;
115
131
  }
116
132
  };
117
133
  return t(), window.addEventListener("scroll", t), window.addEventListener("resize", t), () => {
118
134
  window.removeEventListener("scroll", t), window.removeEventListener("resize", t);
119
135
  };
120
- }, [s, c, L, M, d, E]), a(() => {
121
- Q(M && !!w && !!T && !!h);
122
- }, [M, w, T, h]), a(() => () => {
123
- f.current && clearTimeout(f.current), l.current && clearTimeout(l.current);
124
- }, []), U ? null : st(
125
- /* @__PURE__ */ y(nt, { onClick: g, disableClickOutside: N, children: /* @__PURE__ */ y(
126
- ut,
136
+ }, [c, y, P, O, l, M]), b(() => {
137
+ R(O && !!h && !!D && !!g);
138
+ }, [O, h, D, g]), b(() => () => {
139
+ m.current && clearTimeout(m.current), v.current && clearTimeout(v.current);
140
+ }, []), tt ? null : ft(
141
+ /* @__PURE__ */ $(at, { onClick: d, disableClickOutside: U, children: /* @__PURE__ */ $(
142
+ lt,
127
143
  {
128
- ref: D,
129
- open: K,
130
- transitionDuration: $,
131
- ...A,
132
- css: q,
144
+ ref: X,
145
+ open: Z,
146
+ transitionDuration: S,
147
+ ...Q,
148
+ css: C,
133
149
  style: {
134
150
  ..._,
135
- top: w,
136
- left: T,
137
- bottom: w === "auto" ? 24 : void 0,
138
- width: k ? h : void 0
151
+ top: h,
152
+ left: D,
153
+ bottom: h === "auto" ? 24 : void 0,
154
+ width: W ? g : void 0
139
155
  },
140
- children: /* @__PURE__ */ y(dt, { ref: P, disablePadding: F, maxHeight: V, children: j.map(d, (t, i) => {
141
- var r, e, p, n, m;
142
- return it(t) ? /* @__PURE__ */ tt(ot, { children: [
143
- rt(t, {
144
- ...t.props,
145
- selected: !!((r = t == null ? void 0 : t.props) != null && r.value) && ((e = t == null ? void 0 : t.props) == null ? void 0 : e.value) === B,
146
- onClick: X((p = t == null ? void 0 : t.props) == null ? void 0 : p.value, (n = t == null ? void 0 : t.props) == null ? void 0 : n.onClick),
147
- style: {
148
- ...(m = t == null ? void 0 : t.props) == null ? void 0 : m.style,
149
- [E ? "width" : "minWidth"]: k ? void 0 : h,
150
- maxWidth: k ? void 0 : "100%"
151
- }
152
- }),
153
- G && j.count(d) !== i + 1 && /* @__PURE__ */ y(ct, {})
154
- ] }) : null;
155
- }) })
156
+ children: /* @__PURE__ */ $(
157
+ pt,
158
+ {
159
+ role: "menu",
160
+ ref: k,
161
+ disablePadding: K,
162
+ maxHeight: V,
163
+ ...J,
164
+ children: H.map(l, (t, e) => {
165
+ var r, u, n, f, i, E;
166
+ if (!ct(t))
167
+ return null;
168
+ const s = ot === e;
169
+ return /* @__PURE__ */ st(nt, { children: [
170
+ dt(t, {
171
+ ...t.props,
172
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
173
+ // @ts-expect-error
174
+ "data-index": e,
175
+ selected: !!((r = t == null ? void 0 : t.props) != null && r.value) && ((u = t == null ? void 0 : t.props) == null ? void 0 : u.value) === B,
176
+ onClick: et((n = t == null ? void 0 : t.props) == null ? void 0 : n.value, (f = t == null ? void 0 : t.props) == null ? void 0 : f.onClick),
177
+ onKeyDown: it((i = t == null ? void 0 : t.props) == null ? void 0 : i.value),
178
+ tabIndex: s ? 0 : -1,
179
+ style: {
180
+ ...(E = t == null ? void 0 : t.props) == null ? void 0 : E.style,
181
+ [M ? "width" : "minWidth"]: W ? void 0 : g,
182
+ maxWidth: W ? void 0 : "100%"
183
+ }
184
+ }),
185
+ G && H.count(l) !== e + 1 && /* @__PURE__ */ $(yt, {})
186
+ ] });
187
+ })
188
+ }
189
+ )
156
190
  }
157
191
  ) }),
158
192
  document.body
159
193
  );
160
194
  });
161
195
  export {
162
- vt as default
196
+ ht as default
163
197
  };
@@ -28,3 +28,4 @@ export declare const ShowDivider: Story;
28
28
  export declare const Placement: Story;
29
29
  export declare const Custom: Story;
30
30
  export declare const FitToAnchorWidth: Story;
31
+ export declare const WithScreenReaderSupport: Story;
@@ -1,26 +1,33 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("@emotion/react/jsx-runtime"),w=require("react"),y=require("../../Icon/Icon.cjs"),v=require("../../hooks/useCheckHoverPossible/useCheckHoverPossible.cjs"),S=require("@emotion/styled"),j=e=>e&&e.__esModule?e:{default:e},u=j(S),$=u.default.li`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("@emotion/react/jsx-runtime"),w=require("react"),y=require("../../Icon/Icon.cjs"),v=require("../../hooks/useCheckHoverPossible/useCheckHoverPossible.cjs"),S=require("@emotion/styled"),$=e=>e&&e.__esModule?e:{default:e},c=$(S),j=c.default.li`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  gap: ${({theme:{spacing:e}})=>e.content(2)}px;
5
5
  padding: 10px ${({theme:{spacing:e}})=>e.content(3)}px;
6
6
  background-color: ${({theme:{palette:{grey:e}}})=>e.white};
7
7
  cursor: ${({disabled:e})=>e?"not-allowed":"pointer"};
8
+ border: 2px solid transparent;
8
9
 
9
10
  & svg {
10
11
  width: 20px;
11
12
  height: 20px;
12
- color: ${({theme:{palette:{brand:e,grey:i}},selected:t,disabled:r})=>t?e.primary.main:r?i[30]:"inherit"};
13
+ color: ${({theme:{palette:{brand:e,grey:n}},selected:t,disabled:r})=>t?e.primary.main:r?n[30]:"inherit"};
13
14
  }
14
15
 
15
16
  ${({ellipsis:e})=>e?{maxHeight:"40px"}:{}};
16
17
 
17
- ${({theme:{palette:{brand:e,grey:i}},selected:t,isHoverPossible:r})=>r?{"&:hover:not([disabled])":{backgroundColor:t?e.primary.bg:i[10]}}:{}}
18
- `,k=u.default.div`
18
+ ${({theme:{palette:{brand:e,grey:n}},selected:t,isHoverPossible:r})=>r?{"&:hover:not([disabled])":{backgroundColor:t?e.primary.bg:n[10]}}:{}}
19
+
20
+ &:focus {
21
+ outline: none;
22
+ border: 2px solid
23
+ ${({theme:{palette:{grey:e}}})=>e[100]};
24
+ }
25
+ `,k=c.default.div`
19
26
  flex-grow: 1;
20
27
 
21
28
  ${({ellipsis:e})=>e?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:{}};
22
29
 
23
- ${({theme:{palette:{brand:e,grey:i},typography:{h5B:t,b4R:r}},selected:c,disabled:o})=>{let n={fontSize:r.size,fontWeight:r.weight,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight};return c&&(n={fontSize:t.size,fontWeight:t.weight,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,color:e.primary.text}),o&&(n.color=i[30]),n}}}
24
- `,a=u.default.div`
30
+ ${({theme:{palette:{brand:e,grey:n},typography:{h5B:t,b4R:r}},selected:a,disabled:o})=>{let i={fontSize:r.size,fontWeight:r.weight,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight};return a&&(i={fontSize:t.size,fontWeight:t.weight,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,color:e.primary.text}),o&&(i.color=n[30]),i}}}
31
+ `,u=c.default.div`
25
32
  white-space: nowrap;
26
- `,H=w.forwardRef(function({children:i,startAdornment:t,endAdornment:r,inlineCSS:c,selected:o,disabled:n,value:h,onClick:s,ellipsis:p=!0,...d},g){const{isHoverPossible:x}=v.default(),m=f=>{f.stopPropagation(),!n&&typeof s=="function"&&s(f)};return l.jsxs($,{ref:g,selected:o,disabled:n,"data-value":h,isHoverPossible:x,onClick:m,ellipsis:p,...d,css:c,children:[t&&l.jsx(a,{children:t}),l.jsx(k,{selected:o,disabled:n,ellipsis:p,children:i}),!o&&r&&l.jsx(a,{children:r}),o&&l.jsx(a,{children:l.jsx(y.default,{name:"CheckLine",color:"primary"})})]})});exports.default=H;
33
+ `,H=w.forwardRef(function({children:n,startAdornment:t,endAdornment:r,inlineCSS:a,selected:o,disabled:i,value:d,onClick:s,ellipsis:p=!0,...h},g){const{isHoverPossible:x}=v.default(),m=f=>{f.stopPropagation(),!i&&typeof s=="function"&&s(f)};return l.jsxs(j,{ref:g,selected:o,disabled:i,"data-value":d,isHoverPossible:x,onClick:m,ellipsis:p,role:"menuitem",...h,css:a,children:[t&&l.jsx(u,{children:t}),l.jsx(k,{selected:o,disabled:i,ellipsis:p,children:n}),!o&&r&&l.jsx(u,{children:r}),o&&l.jsx(u,{children:l.jsx(y.default,{name:"CheckLine",color:"primary"})})]})});exports.default=H;
@@ -8,6 +8,7 @@ export interface MenuBlockProps extends GeneralComponentProps<HTMLAttributes<HTM
8
8
  disabled?: boolean;
9
9
  value?: string | number;
10
10
  ellipsis?: boolean;
11
+ focused?: boolean;
11
12
  }
12
13
  declare const MenuBlock: import('react').ForwardRefExoticComponent<MenuBlockProps & import('react').RefAttributes<HTMLLIElement>>;
13
14
  export default MenuBlock;
@@ -1,9 +1,9 @@
1
1
  import { jsxs as x, jsx as l } from "@emotion/react/jsx-runtime";
2
2
  import { forwardRef as w } from "react";
3
3
  import y from "../../Icon/Icon.es.js";
4
- import k from "../../hooks/useCheckHoverPossible/useCheckHoverPossible.es.js";
5
- import a from "@emotion/styled";
6
- const v = a.li`
4
+ import $ from "../../hooks/useCheckHoverPossible/useCheckHoverPossible.es.js";
5
+ import c from "@emotion/styled";
6
+ const k = c.li`
7
7
  display: flex;
8
8
  align-items: center;
9
9
  gap: ${({ theme: { spacing: e } }) => e.content(2)}px;
@@ -14,17 +14,18 @@ const v = a.li`
14
14
  }
15
15
  }) => e.white};
16
16
  cursor: ${({ disabled: e }) => e ? "not-allowed" : "pointer"};
17
+ border: 2px solid transparent;
17
18
 
18
19
  & svg {
19
20
  width: 20px;
20
21
  height: 20px;
21
22
  color: ${({
22
23
  theme: {
23
- palette: { brand: e, grey: i }
24
+ palette: { brand: e, grey: o }
24
25
  },
25
26
  selected: t,
26
27
  disabled: r
27
- }) => t ? e.primary.main : r ? i[30] : "inherit"};
28
+ }) => t ? e.primary.main : r ? o[30] : "inherit"};
28
29
  }
29
30
 
30
31
  ${({ ellipsis: e }) => e ? {
@@ -33,16 +34,26 @@ const v = a.li`
33
34
 
34
35
  ${({
35
36
  theme: {
36
- palette: { brand: e, grey: i }
37
+ palette: { brand: e, grey: o }
37
38
  },
38
39
  selected: t,
39
40
  isHoverPossible: r
40
41
  }) => r ? {
41
42
  "&:hover:not([disabled])": {
42
- backgroundColor: t ? e.primary.bg : i[10]
43
+ backgroundColor: t ? e.primary.bg : o[10]
43
44
  }
44
45
  } : {}}
45
- `, $ = a.div`
46
+
47
+ &:focus {
48
+ outline: none;
49
+ border: 2px solid
50
+ ${({
51
+ theme: {
52
+ palette: { grey: e }
53
+ }
54
+ }) => e[100]};
55
+ }
56
+ `, v = c.div`
46
57
  flex-grow: 1;
47
58
 
48
59
  ${({ ellipsis: e }) => e ? {
@@ -53,64 +64,65 @@ const v = a.li`
53
64
 
54
65
  ${({
55
66
  theme: {
56
- palette: { brand: e, grey: i },
67
+ palette: { brand: e, grey: o },
57
68
  typography: { h5B: t, b4R: r }
58
69
  },
59
- selected: c,
70
+ selected: p,
60
71
  disabled: n
61
72
  }) => {
62
- let o = {
73
+ let i = {
63
74
  fontSize: r.size,
64
75
  fontWeight: r.weight,
65
76
  letterSpacing: r.letterSpacing,
66
77
  lineHeight: r.lineHeight
67
78
  };
68
- return c && (o = {
79
+ return p && (i = {
69
80
  fontSize: t.size,
70
81
  fontWeight: t.weight,
71
82
  letterSpacing: t.letterSpacing,
72
83
  lineHeight: t.lineHeight,
73
84
  color: e.primary.text
74
- }), n && (o.color = i[30]), o;
85
+ }), n && (i.color = o[30]), i;
75
86
  }}}
76
- `, p = a.div`
87
+ `, a = c.div`
77
88
  white-space: nowrap;
78
- `, P = w(function({
79
- children: i,
89
+ `, M = w(function({
90
+ children: o,
80
91
  startAdornment: t,
81
92
  endAdornment: r,
82
- inlineCSS: c,
93
+ inlineCSS: p,
83
94
  selected: n,
84
- disabled: o,
85
- value: s,
95
+ disabled: i,
96
+ value: u,
86
97
  onClick: h,
87
98
  ellipsis: f = !0,
88
- ...u
89
- }, m) {
90
- const { isHoverPossible: d } = k();
99
+ ...m
100
+ }, g) {
101
+ const { isHoverPossible: d } = $();
91
102
  return /* @__PURE__ */ x(
92
- v,
103
+ k,
93
104
  {
94
- ref: m,
105
+ ref: g,
95
106
  selected: n,
96
- disabled: o,
97
- "data-value": s,
107
+ disabled: i,
108
+ "data-value": u,
98
109
  isHoverPossible: d,
99
- onClick: (g) => {
100
- g.stopPropagation(), !o && typeof h == "function" && h(g);
110
+ onClick: (s) => {
111
+ s.stopPropagation(), !i && typeof h == "function" && h(s);
101
112
  },
102
113
  ellipsis: f,
103
- ...u,
104
- css: c,
114
+ role: "menuitem",
115
+ ...m,
116
+ css: p,
105
117
  children: [
106
- t && /* @__PURE__ */ l(p, { children: t }),
107
- /* @__PURE__ */ l($, { selected: n, disabled: o, ellipsis: f, children: i }),
108
- !n && r && /* @__PURE__ */ l(p, { children: r }),
109
- n && /* @__PURE__ */ l(p, { children: /* @__PURE__ */ l(y, { name: "CheckLine", color: "primary" }) })
118
+ t && /* @__PURE__ */ l(a, { children: t }),
119
+ /* @__PURE__ */ l(v, { selected: n, disabled: i, ellipsis: f, children: o }),
120
+ !n && r && /* @__PURE__ */ l(a, { children: r }),
121
+ n && /* @__PURE__ */ l(a, { children: /* @__PURE__ */ l(y, { name: "CheckLine", color: "primary" }) })
110
122
  ]
111
123
  }
112
124
  );
113
125
  });
114
126
  export {
115
- P as default
127
+ M as default
116
128
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@emotion/react/jsx-runtime"),u=require("react"),l=require("../../Button/Button.cjs"),m=u.forwardRef(function({isMenuOpen:n,menuId:a,onClick:o,...i},s){const t=u.useRef(),c=()=>{t.current&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(()=>{t.current=requestAnimationFrame(()=>{const e=document.getElementById(a);if(e){const r=e.querySelector('[role="menuitem"]');r==null||r.setAttribute("tabindex","0"),r==null||r.focus()}t.current=void 0})})},f=e=>{if(e.stopPropagation(),e.key==="ArrowDown"&&!n){o(e),c();return}if((e.key==="Enter"||e.key===" ")&&!n){o(e),c();return}};return u.useEffect(()=>()=>{t.current&&cancelAnimationFrame(t.current)},[]),d.jsx(l.default,{ref:s,type:"button","aria-haspopup":!0,"aria-expanded":n,"aria-controls":a,onKeyDown:f,onClick:o,...i})});exports.default=m;
@@ -0,0 +1,10 @@
1
+ import { SyntheticEvent } from 'react';
2
+ import { ButtonProps } from '../Button/Button';
3
+
4
+ export interface MenuButtonProps extends ButtonProps {
5
+ isMenuOpen: boolean;
6
+ menuId: string;
7
+ onClick: (e: SyntheticEvent) => void;
8
+ }
9
+ declare const MenuButton: import('react').ForwardRefExoticComponent<MenuButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
10
+ export default MenuButton;
@@ -0,0 +1,44 @@
1
+ import { jsx as m } from "@emotion/react/jsx-runtime";
2
+ import { forwardRef as s, useRef as d, useEffect as p } from "react";
3
+ import y from "../../Button/Button.es.js";
4
+ const F = s(function({ isMenuOpen: n, menuId: a, onClick: o, ...c }, i) {
5
+ const t = d(), u = () => {
6
+ t.current && cancelAnimationFrame(t.current), t.current = requestAnimationFrame(() => {
7
+ t.current = requestAnimationFrame(() => {
8
+ const r = document.getElementById(a);
9
+ if (r) {
10
+ const e = r.querySelector('[role="menuitem"]');
11
+ e == null || e.setAttribute("tabindex", "0"), e == null || e.focus();
12
+ }
13
+ t.current = void 0;
14
+ });
15
+ });
16
+ }, f = (r) => {
17
+ if (r.stopPropagation(), r.key === "ArrowDown" && !n) {
18
+ o(r), u();
19
+ return;
20
+ }
21
+ if ((r.key === "Enter" || r.key === " ") && !n) {
22
+ o(r), u();
23
+ return;
24
+ }
25
+ };
26
+ return p(() => () => {
27
+ t.current && cancelAnimationFrame(t.current);
28
+ }, []), /* @__PURE__ */ m(
29
+ y,
30
+ {
31
+ ref: i,
32
+ type: "button",
33
+ "aria-haspopup": !0,
34
+ "aria-expanded": n,
35
+ "aria-controls": a,
36
+ onKeyDown: f,
37
+ onClick: o,
38
+ ...c
39
+ }
40
+ );
41
+ });
42
+ export {
43
+ F as default
44
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./MenuButton.cjs");exports.default=e.default;
@@ -0,0 +1,3 @@
1
+ import { default as MenuButton } from './MenuButton';
2
+
3
+ export default MenuButton;
@@ -0,0 +1,4 @@
1
+ import o from "./MenuButton.es.js";
2
+ export {
3
+ o as default
4
+ };
package/Menu/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Menu.cjs"),u=require("./MenuBlock/MenuBlock.cjs");exports.default=e.default;exports.MenuBlock=u.default;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Menu.cjs"),u=require("./MenuBlock/MenuBlock.cjs"),t=require("./MenuButton/MenuButton.cjs");exports.default=e.default;exports.MenuBlock=u.default;exports.MenuButton=t.default;
package/Menu/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { default as Menu } from './Menu';
2
2
 
3
3
  export { default as MenuBlock } from './MenuBlock';
4
+ export { default as MenuButton } from './MenuButton';
4
5
  export default Menu;
package/Menu/index.es.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import o from "./Menu.es.js";
2
- import { default as a } from "./MenuBlock/MenuBlock.es.js";
2
+ import { default as u } from "./MenuBlock/MenuBlock.es.js";
3
+ import { default as f } from "./MenuButton/MenuButton.es.js";
3
4
  export {
4
- a as MenuBlock,
5
+ u as MenuBlock,
6
+ f as MenuButton,
5
7
  o as default
6
8
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@emotion/react/jsx-runtime"),l=require("react"),m=require("@emotion/styled"),_=e=>e&&e.__esModule?e:{default:e},b=_(m),x=b.default.div`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=require("@emotion/react/jsx-runtime"),n=require("react"),b=require("@emotion/styled"),m=e=>e&&e.__esModule?e:{default:e},_=m(b),g=_.default.div`
2
2
  display: flex;
3
3
  align-content: center;
4
4
  justify-content: space-between;
@@ -6,4 +6,4 @@
6
6
  gap: ${({theme:{spacing:e}})=>e.content(3)}px;
7
7
 
8
8
  ${({maxWidth:e})=>({maxWidth:e})}
9
- `,g=l.forwardRef(function({children:s,maxWidth:u,size:o="small",onChange:a,disabled:i,inlineCSS:c,...d},p){const f=(t,r)=>n=>{n.stopPropagation(),typeof a=="function"&&a(t,r)};return y.jsx(x,{ref:p,maxWidth:u||(o==="large"?264:228),...d,css:c,children:l.Children.map(s,t=>{var r,n;return l.isValidElement(t)?l.cloneElement(t,{disabled:i,size:o,onClick:f((r=t.props)==null?void 0:r.value,(n=t.props)==null?void 0:n.children),...t.props}):null})})});exports.default=g;
9
+ `,x=n.forwardRef(function({children:u,maxWidth:s,size:o="small",onChange:a,disabled:i,inlineCSS:c,...d},p){const f=(t,r)=>l=>{l.stopPropagation(),typeof a=="function"&&a(t,r)};return y.jsx(g,{ref:p,maxWidth:s||(o==="large"?264:228),role:"group","aria-label":"가상 숫자 키패드",...d,css:c,children:n.Children.map(u,t=>{var r,l;return n.isValidElement(t)?n.cloneElement(t,{disabled:i,size:o,onClick:f((r=t.props)==null?void 0:r.value,(l=t.props)==null?void 0:l.children),...t.props}):null})})});exports.default=x;
@@ -1,31 +1,33 @@
1
1
  import { jsx as u } from "@emotion/react/jsx-runtime";
2
- import { forwardRef as m, Children as y, isValidElement as x, cloneElement as h } from "react";
3
- import b from "@emotion/styled";
4
- const w = b.div`
2
+ import { forwardRef as m, Children as y, isValidElement as x, cloneElement as b } from "react";
3
+ import h from "@emotion/styled";
4
+ const g = h.div`
5
5
  display: flex;
6
6
  align-content: center;
7
7
  justify-content: space-between;
8
8
  flex-wrap: wrap;
9
- gap: ${({ theme: { spacing: t } }) => t.content(3)}px;
9
+ gap: ${({ theme: { spacing: e } }) => e.content(3)}px;
10
10
 
11
- ${({ maxWidth: t }) => ({ maxWidth: t })}
12
- `, j = m(function({ children: a, maxWidth: i, size: n = "small", onChange: p, disabled: l, inlineCSS: c, ...s }, d) {
13
- const f = (r, e) => (o) => {
14
- o.stopPropagation(), typeof p == "function" && p(r, e);
11
+ ${({ maxWidth: e }) => ({ maxWidth: e })}
12
+ `, j = m(function({ children: n, maxWidth: l, size: p = "small", onChange: a, disabled: i, inlineCSS: c, ...s }, d) {
13
+ const f = (r, t) => (o) => {
14
+ o.stopPropagation(), typeof a == "function" && a(r, t);
15
15
  };
16
16
  return /* @__PURE__ */ u(
17
- w,
17
+ g,
18
18
  {
19
19
  ref: d,
20
- maxWidth: i || (n === "large" ? 264 : 228),
20
+ maxWidth: l || (p === "large" ? 264 : 228),
21
+ role: "group",
22
+ "aria-label": "가상 숫자 키패드",
21
23
  ...s,
22
24
  css: c,
23
- children: y.map(a, (r) => {
24
- var e, o;
25
- return x(r) ? h(r, {
26
- disabled: l,
27
- size: n,
28
- onClick: f((e = r.props) == null ? void 0 : e.value, (o = r.props) == null ? void 0 : o.children),
25
+ children: y.map(n, (r) => {
26
+ var t, o;
27
+ return x(r) ? b(r, {
28
+ disabled: i,
29
+ size: p,
30
+ onClick: f((t = r.props) == null ? void 0 : t.value, (o = r.props) == null ? void 0 : o.children),
29
31
  ...r.props
30
32
  }) : null;
31
33
  })