gd-design-library 1.0.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/README.md +2 -2
  2. package/ai/README.md +210 -16
  3. package/ai/schemas/components/Accordion.d.ts +84 -0
  4. package/ai/schemas/components/Button.d.ts +12 -0
  5. package/ai/schemas/components/ChatContainer.d.ts +0 -8
  6. package/ai/schemas/components/Column.d.ts +5 -5
  7. package/ai/schemas/components/InputFile.d.ts +17 -5
  8. package/ai/schemas/components/Menu.d.ts +37 -0
  9. package/ai/schemas/components/Row.d.ts +6 -6
  10. package/ai/schemas/components/Scroll.d.ts +7 -0
  11. package/ai/schemas/components/Typography.d.ts +0 -21
  12. package/assets/icons/account_circle.d.ts +1 -3
  13. package/assets/icons/account_circle.js +7 -14
  14. package/assets/icons/arrow-down.d.ts +2 -3
  15. package/assets/icons/arrow-down.js +6 -11
  16. package/assets/icons/arrow-forward.d.ts +1 -3
  17. package/assets/icons/arrow-forward.js +6 -13
  18. package/assets/icons/attachment.d.ts +1 -3
  19. package/assets/icons/attachment.js +7 -14
  20. package/assets/icons/check.d.ts +1 -3
  21. package/assets/icons/check.js +5 -11
  22. package/assets/icons/chevron-left.d.ts +1 -3
  23. package/assets/icons/chevron-left.js +7 -14
  24. package/assets/icons/chevron-right.d.ts +1 -3
  25. package/assets/icons/chevron-right.js +6 -13
  26. package/assets/icons/content-copy.d.ts +1 -3
  27. package/assets/icons/content-copy.js +7 -14
  28. package/assets/icons/delete_outlined.d.ts +1 -3
  29. package/assets/icons/delete_outlined.js +5 -12
  30. package/assets/icons/dot.d.ts +1 -3
  31. package/assets/icons/dot.js +5 -11
  32. package/assets/icons/error_outline.d.ts +1 -4
  33. package/assets/icons/error_outline.js +6 -18
  34. package/assets/icons/eye.d.ts +1 -3
  35. package/assets/icons/eye.js +7 -14
  36. package/assets/icons/file-copy.d.ts +1 -3
  37. package/assets/icons/file-copy.js +7 -13
  38. package/assets/icons/filter.d.ts +1 -3
  39. package/assets/icons/filter.js +6 -13
  40. package/assets/icons/folder.d.ts +1 -3
  41. package/assets/icons/folder.js +6 -13
  42. package/assets/icons/folderOpen.d.ts +1 -3
  43. package/assets/icons/folderOpen.js +7 -14
  44. package/assets/icons/home.d.ts +1 -3
  45. package/assets/icons/home.js +6 -13
  46. package/assets/icons/local_shipping.d.ts +1 -3
  47. package/assets/icons/local_shipping.js +4 -11
  48. package/assets/icons/minus.d.ts +1 -3
  49. package/assets/icons/minus.js +7 -13
  50. package/assets/icons/mobile_menu_button.d.ts +1 -3
  51. package/assets/icons/mobile_menu_button.js +7 -14
  52. package/assets/icons/paymentCard.d.ts +1 -3
  53. package/assets/icons/paymentCard.js +6 -13
  54. package/assets/icons/plus.d.ts +1 -3
  55. package/assets/icons/plus.js +5 -11
  56. package/assets/icons/portrait.d.ts +1 -3
  57. package/assets/icons/portrait.js +5 -12
  58. package/assets/icons/processing.d.ts +1 -3
  59. package/assets/icons/processing.js +6 -13
  60. package/assets/icons/ruler.d.ts +1 -3
  61. package/assets/icons/ruler.js +6 -13
  62. package/assets/icons/search.d.ts +1 -3
  63. package/assets/icons/search.js +6 -13
  64. package/assets/icons/shopping_bag.d.ts +1 -3
  65. package/assets/icons/shopping_bag.js +7 -14
  66. package/assets/icons/slash.d.ts +1 -3
  67. package/assets/icons/slash.js +6 -13
  68. package/assets/icons/star.d.ts +1 -3
  69. package/assets/icons/star.js +6 -12
  70. package/assets/icons/starOutlined.d.ts +1 -3
  71. package/assets/icons/starOutlined.js +5 -11
  72. package/assets/icons/toast_error.d.ts +1 -3
  73. package/assets/icons/toast_error.js +9 -15
  74. package/assets/icons/toast_info.d.ts +1 -3
  75. package/assets/icons/toast_info.js +7 -13
  76. package/assets/icons/toast_warning.d.ts +1 -3
  77. package/assets/icons/toast_warning.js +7 -13
  78. package/assets/icons/upload.d.ts +1 -3
  79. package/assets/icons/upload.js +6 -13
  80. package/assets/icons/volume-up.d.ts +1 -3
  81. package/assets/icons/volume-up.js +6 -13
  82. package/assets/icons/wifiTethering.d.ts +1 -3
  83. package/assets/icons/wifiTethering.js +4 -11
  84. package/components/core/Button/Button.js +30 -27
  85. package/components/core/Button/Button.types.d.ts +2 -2
  86. package/components/core/Button/ButtonStyled.js +40 -39
  87. package/components/core/Dropdown/Dropdown.d.ts +1 -1
  88. package/components/core/Dropdown/Dropdown.js +16 -16
  89. package/components/core/Dropdown/Dropdown.types.d.ts +3 -3
  90. package/components/core/Dropdown/DropdownStyled.js +13 -14
  91. package/components/core/Icon/Icon.js +41 -33
  92. package/components/core/Icon/Icon.types.d.ts +2 -1
  93. package/components/core/Icon/constants.d.ts +37 -109
  94. package/components/core/Input/Input.d.ts +1 -1
  95. package/components/core/InputFile/InputFile.d.ts +0 -32
  96. package/components/core/InputFile/InputFile.js +47 -33
  97. package/components/core/InputFile/InputFileStyled.js +24 -22
  98. package/components/core/Loader/Loader.js +19 -17
  99. package/components/core/Loader/Loader.types.d.ts +3 -1
  100. package/components/core/Loader/LoaderStyled.js +34 -30
  101. package/components/core/Menu/Menu.d.ts +2 -2
  102. package/components/core/Menu/Menu.js +113 -93
  103. package/components/core/Menu/Menu.types.d.ts +16 -11
  104. package/components/core/Menu/MenuStyled.d.ts +1 -1
  105. package/components/core/Menu/constants.js +4 -12
  106. package/components/core/Modal/Modal.js +60 -36
  107. package/components/core/Modal/ModalStyled.js +21 -22
  108. package/components/core/Scroll/Scroll.d.ts +6 -0
  109. package/components/core/Scroll/Scroll.js +53 -31
  110. package/components/core/Scroll/Scroll.types.d.ts +5 -0
  111. package/components/core/Scroll/ScrollBar.js +45 -43
  112. package/components/core/Scroll/ScrollStyled.js +46 -42
  113. package/components/core/Scroll/constants.d.ts +2 -0
  114. package/components/core/Scroll/constants.js +6 -4
  115. package/components/core/Select/Select.js +162 -134
  116. package/components/core/Select/Select.types.d.ts +2 -4
  117. package/components/core/Snackbar/Snackbar.js +60 -37
  118. package/components/core/Snackbar/Snackbar.types.d.ts +1 -2
  119. package/components/core/Snackbar/SnackbarManager.js +45 -30
  120. package/components/core/Snackbar/SnackbarStyled.d.ts +5 -5
  121. package/components/core/Snackbar/SnackbarStyled.js +111 -101
  122. package/components/core/Textarea/Textarea.d.ts +4 -0
  123. package/components/core/Tooltip/Tooltip.js +68 -44
  124. package/components/core/Tooltip/TooltipStyled.js +26 -27
  125. package/components/core/Tooltip/utils.js +47 -45
  126. package/components/core/Typography/Typography.js +18 -18
  127. package/components/core/Typography/Typography.types.d.ts +3 -3
  128. package/components/core/Typography/TypographyStyled.js +28 -29
  129. package/components/domainSpecific/Accordion/Accordion.d.ts +1 -1
  130. package/components/domainSpecific/Accordion/Accordion.js +19 -17
  131. package/components/domainSpecific/Accordion/Accordion.types.d.ts +7 -4
  132. package/components/domainSpecific/Accordion/AccordionContent/AccordionContent.d.ts +1 -1
  133. package/components/domainSpecific/Accordion/AccordionContent/AccordionContent.js +13 -12
  134. package/components/domainSpecific/Accordion/AccordionHeader/AccordionHeader.d.ts +1 -1
  135. package/components/domainSpecific/Accordion/AccordionHeader/AccordionHeader.js +15 -14
  136. package/components/domainSpecific/Accordion/AccordionItem/AccordionItem.d.ts +1 -1
  137. package/components/domainSpecific/Accordion/AccordionItem/AccordionItem.js +18 -16
  138. package/components/domainSpecific/Accordion/AccordionStyled.js +44 -35
  139. package/components/domainSpecific/Card/Card.js +31 -27
  140. package/components/domainSpecific/Card/CardTitle/constants.js +4 -4
  141. package/components/domainSpecific/Header/Header.js +4 -4
  142. package/components/domainSpecific/SearchModal/SearchModal.js +0 -1
  143. package/components/domainSpecific/SearchModal/SearchModal.types.d.ts +1 -1
  144. package/components/index.types.d.ts +1 -0
  145. package/components/layout/ChatContainer/ChatContainer.d.ts +1 -1
  146. package/components/layout/ChatContainer/ChatContainer.js +58 -41
  147. package/components/layout/ChatContainer/ChatContainer.types.d.ts +8 -5
  148. package/components/layout/ChatContainer/ChatContainerStyled.d.ts +2 -0
  149. package/components/layout/ChatContainer/ChatContainerStyled.js +105 -84
  150. package/components/layout/Column/Column.types.d.ts +3 -1
  151. package/components/layout/Column/ColumnStyled.js +23 -23
  152. package/components/layout/FlexContainer/FlexContainerStyled.js +7 -8
  153. package/components/layout/Row/Row.d.ts +1 -1
  154. package/components/layout/Row/Row.js +20 -20
  155. package/components/layout/Row/Row.types.d.ts +3 -1
  156. package/components/layout/Row/RowStyled.js +26 -26
  157. package/constants/index.d.ts +0 -1
  158. package/hooks/index.d.ts +1 -0
  159. package/hooks/useLogger/NoOpLogger.d.ts +11 -0
  160. package/hooks/useLogger/NoOpLogger.js +15 -0
  161. package/hooks/useLogger/index.d.ts +2 -0
  162. package/hooks/useLogger/useLogger.d.ts +4 -0
  163. package/hooks/useLogger/useLogger.js +27 -0
  164. package/hooks/useLogger/useLogger.types.d.ts +30 -0
  165. package/hooks/useTheme/NoOpTheme.d.ts +4050 -0
  166. package/hooks/useTheme/NoOpTheme.js +15 -0
  167. package/hooks/useTheme/useTheme.d.ts +3 -4
  168. package/hooks/useTheme/useTheme.js +62 -41
  169. package/hooks/useTheme/useTheme.types.d.ts +3 -2
  170. package/index.d.ts +4 -0
  171. package/index.js +354 -350
  172. package/llms.txt +39 -19
  173. package/package.json +1 -1
  174. package/tokens/accordion.d.ts +9 -3
  175. package/tokens/accordion.js +14 -11
  176. package/tokens/button.d.ts +17 -19
  177. package/tokens/button.js +54 -56
  178. package/tokens/card.d.ts +2 -3
  179. package/tokens/card.js +50 -53
  180. package/tokens/carousel.d.ts +2 -2
  181. package/tokens/carousel.js +8 -9
  182. package/tokens/chat.d.ts +69 -48
  183. package/tokens/chat.js +86 -68
  184. package/tokens/constants.d.ts +0 -1
  185. package/tokens/constants.js +1 -1
  186. package/tokens/defaultTheme.d.ts +199 -112
  187. package/tokens/defaultTheme.js +27 -25
  188. package/tokens/header.d.ts +1 -1
  189. package/tokens/header.js +3 -4
  190. package/tokens/index.d.ts +175 -104
  191. package/tokens/index.js +102 -101
  192. package/tokens/input.d.ts +2 -2
  193. package/tokens/input.js +25 -26
  194. package/tokens/inputfile.d.ts +1 -1
  195. package/tokens/inputfile.js +4 -4
  196. package/tokens/link.d.ts +5 -0
  197. package/tokens/loader.d.ts +3 -0
  198. package/tokens/loader.js +3 -0
  199. package/tokens/menu.d.ts +1 -0
  200. package/tokens/menu.js +1 -0
  201. package/tokens/modal.d.ts +6 -4
  202. package/tokens/modal.js +42 -60
  203. package/tokens/scroll.d.ts +19 -2
  204. package/tokens/scroll.js +23 -7
  205. package/tokens/select.d.ts +9 -7
  206. package/tokens/select.js +30 -29
  207. package/tokens/snackbar.d.ts +36 -20
  208. package/tokens/snackbar.js +92 -93
  209. package/tokens/stepper.d.ts +1 -1
  210. package/tokens/stepper.js +3 -3
  211. package/tokens/tabs.d.ts +1 -1
  212. package/tokens/tabs.js +1 -1
  213. package/tokens/textarea.d.ts +4 -0
  214. package/tokens/tooltip.d.ts +5 -1
  215. package/tokens/tooltip.js +23 -21
  216. package/tokens/typography.js +114 -116
  217. package/tokens/values.d.ts +5 -1
  218. package/tokens/values.js +12 -8
  219. package/tokens/wrapper.d.ts +2 -2
  220. package/tokens/wrapper.js +7 -7
  221. package/tokens/zIndex.d.ts +9 -0
  222. package/tokens/zIndex.js +12 -0
  223. package/types/index.d.ts +0 -1
  224. package/types/styles.d.ts +1 -0
  225. package/utils/helpers.js +14 -15
  226. package/CHANGELOG.md +0 -177
  227. package/constants/positioning.d.ts +0 -9
  228. package/constants/positioning.js +0 -11
  229. package/types/chat.d.ts +0 -5
  230. package/types/chat.js +0 -4
@@ -1,39 +1,43 @@
1
- "use client";
2
- import { jsxs as g, jsx as w } from "@emotion/react/jsx-runtime";
3
- import { forwardRef as N } from "react";
4
- import { getBoxStyles as V, tokensHandler as j } from "../../../tokens/utils.js";
5
- import { getAnimationDataByName as z } from "./utils.js";
6
- import { WrapperVariant as A } from "../../../types/wrapper.js";
7
- import { SizeVariant as B } from "../../../types/common.js";
1
+ import { jsxs as N, jsx as P } from "@emotion/react/jsx-runtime";
2
+ import { forwardRef as V } from "react";
3
+ import { getBoxStyles as b, tokensHandler as j } from "../../../tokens/utils.js";
4
+ import { getAnimationDataByName as A } from "./utils.js";
8
5
  import { get as t } from "../../../utils/helpers.js";
9
- const K = N((n, a) => {
6
+ import { WrapperVariant as B } from "../../../types/wrapper.js";
7
+ import { SizeVariant as L } from "../../../types/common.js";
8
+ const M = V(({
9
+ theme: {
10
+ loader: a,
11
+ animations: n,
12
+ ...e
13
+ } = {},
14
+ styles: m,
15
+ $name: o,
16
+ $variant: s = B.Inline,
17
+ $size: d = L.Md,
18
+ $animationProps: p,
19
+ children: f,
20
+ $rounded: c,
21
+ ...l
22
+ }, y) => {
10
23
  const {
11
- theme: {
12
- loader: i,
13
- animations: s,
14
- ...m
15
- } = {},
16
- styles: p,
17
- $name: o,
18
- $variant: l = A.Inline,
19
- $size: c = B.Md,
20
- $animationProps: d,
21
- children: f,
22
- ...y
23
- } = n, {
24
24
  boxStyles: x,
25
- restProps: S
26
- } = V(y), e = new Proxy(i || {}, j(m)), u = t(e, ["animation", o, "name"], ""), P = t(s, u, {}), {
27
- animation: r,
25
+ restProps: u
26
+ } = b(l), r = new Proxy(a || {}, j(e)), S = t(r, ["animation", o, "name"], ""), g = t(n, S, {}), {
27
+ animation: i,
28
28
  AnimationView: h
29
- } = z(o, P, d), $ = [t(e, "default", {}), t(e, l, {}), t(e, [o, "default"], {}), t(e, [o, c], {}), ...r ? [{
30
- animation: r
31
- }] : [], x, p];
32
- return /* @__PURE__ */ g("span", { css: $, ...S, ref: a, children: [
33
- /* @__PURE__ */ w(h, {}),
29
+ } = A(o, g, p), w = [t(r, "default", {}), t(r, s, {}), t(r, [o, "default"], {}), t(r, [o, d], {}), o !== "circle" ? {
30
+ ".dot": {
31
+ borderRadius: t(e, ["radius", c], "0px")
32
+ }
33
+ } : {}, ...i ? [{
34
+ animation: i
35
+ }] : [], x, m];
36
+ return /* @__PURE__ */ N("span", { css: w, ...u, ref: y, children: [
37
+ /* @__PURE__ */ P(h, {}),
34
38
  f
35
39
  ] });
36
40
  });
37
41
  export {
38
- K as LoaderStyled
42
+ M as LoaderStyled
39
43
  };
@@ -1,2 +1,2 @@
1
- import { MenuProps } from './Menu.types';
2
- export declare const Menu: import('react').ForwardRefExoticComponent<MenuProps<unknown> & import('react').RefAttributes<HTMLDivElement>>;
1
+ import { MenuProps, MenuRef } from './';
2
+ export declare const Menu: import('react').ForwardRefExoticComponent<MenuProps & import('react').RefAttributes<MenuRef>>;
@@ -1,106 +1,126 @@
1
1
  "use client";
2
- import { jsxs as K, Fragment as V, jsx as g } from "@emotion/react/jsx-runtime";
3
- import { forwardRef as W, useState as M, useMemo as Y, useRef as h, useCallback as O, useImperativeHandle as $, useEffect as I } from "react";
4
- import { MENU_DEFAULT_OPTIONS as j, EMPTY_CLIENT_RECT as P, COMPONENT_NAME as w } from "./constants.js";
5
- import { MenuTriggerStyled as U, MenuContentStyled as J } from "./MenuStyled.js";
6
- import { useAnimationFrame as q } from "../../../utils/animationFrame.js";
7
- import { SelectContext as z } from "../Select/hooks/useSelectContext.js";
8
- import { convertToInlineBoxStyles as G } from "../../../tokens/utils.js";
9
- import { useTheme as Q } from "../../../hooks/useTheme/useTheme.js";
10
- import { Portal as X } from "../Portal/Portal.js";
11
- import { KEYBOARD_KEYS as Z } from "../../../constants/keyboard.js";
12
- const tt = W((S, T) => {
2
+ import { jsxs as X, jsx as x } from "@emotion/react/jsx-runtime";
3
+ import { forwardRef as K, useState as y, useRef as H, useCallback as L, useEffect as U, useImperativeHandle as W } from "react";
4
+ import { EMPTY_CLIENT_RECT as j, COMPONENT_NAME as m } from "./constants.js";
5
+ import { MenuTriggerStyled as G, MenuContentStyled as R } from "./MenuStyled.js";
6
+ import { useAnimationFrame as V } from "../../../utils/animationFrame.js";
7
+ import { SelectContext as q } from "../Select/hooks/useSelectContext.js";
8
+ import { convertToInlineBoxStyles as z } from "../../../tokens/utils.js";
9
+ import { useTheme as J } from "../../../hooks/useTheme/useTheme.js";
10
+ import { useLogger as Q } from "../../../hooks/useLogger/useLogger.js";
11
+ import { Portal as Z } from "../Portal/Portal.js";
12
+ import { KEYBOARD_KEYS as ee } from "../../../constants/keyboard.js";
13
+ const n = 4, te = 400, oe = 80, ne = K(({
14
+ onSelect: a,
15
+ children: A,
16
+ content: Y,
17
+ itemIdentifier: I = (f, r) => (f == null ? void 0 : f.value) === (r == null ? void 0 : r.value),
18
+ closeOnSelect: M = !0,
19
+ placement: _,
20
+ ...$
21
+ }, v) => {
13
22
  const {
14
- onSelect: v,
15
- children: N,
16
- content: k,
17
- options: x = {},
18
- itemIdentifier: R = (t, n) => (t == null ? void 0 : t.value) === (n == null ? void 0 : n.value),
19
- ...y
20
- } = S, {
21
- theme: C
22
- } = Q(), [B, L] = M(), a = Y(() => ({
23
- ...j,
24
- ...x
25
- }), [JSON.stringify(x)]), r = h(null), o = h(null), b = h(), _ = h({
23
+ theme: f
24
+ } = J(), r = Q(), [l, g] = y(!1), [i, P] = y(), [N, E] = y(), p = H(null), s = H(null), S = H({
26
25
  top: 0,
27
- left: 0,
28
- maxHeight: a.maxHeight
29
- }), [u, f] = M(!1), A = O(({
26
+ left: 0
27
+ }), F = L(({
30
28
  width: t,
31
- height: n
29
+ height: e
32
30
  }) => {
33
- const e = r.current ? r.current.getBoundingClientRect() : P, {
34
- minHeight: i,
35
- align: c,
36
- direction: m,
37
- offset: s
38
- } = a, l = b.current || m || "top", E = e.right + s, p = {
39
- top: e.top - 2 * s,
40
- bottom: window.innerHeight - e.bottom - 2 * s
41
- }, d = {
42
- top: e.top,
43
- bottom: e.bottom + s,
44
- right: E,
45
- center: e.left + e.width / 2 + t / 2 < window.innerWidth - s ? e.left + e.width / 2 - t / 2 : E,
46
- left: e.left + t < window.innerWidth - s ? e.left : E
47
- }, H = p.top > p.bottom ? "top" : "bottom";
48
- return p[l] > i && m || p[l] > n ? {
49
- top: d[l],
50
- left: d[c]
51
- } : (b.current = H, {
52
- top: d[H],
53
- left: d[c]
54
- });
55
- }, [a]), D = {
56
- onSelect: ({
31
+ const o = p.current ? p.current.getBoundingClientRect() : j, w = window.innerWidth, d = window.innerHeight, h = window.scrollX || window.pageXOffset || 0, k = window.scrollY || window.pageYOffset || 0, O = _ || "bottom-right";
32
+ let c, u;
33
+ switch (O) {
34
+ case "top-left": {
35
+ c = o.left - t, u = o.top - e - n;
36
+ break;
37
+ }
38
+ case "top-right": {
39
+ c = o.right + n, u = o.top - e - n;
40
+ break;
41
+ }
42
+ case "bottom-left": {
43
+ c = o.left - t, u = o.bottom + n;
44
+ break;
45
+ }
46
+ case "bottom-right": {
47
+ c = o.right + n, u = o.bottom + n;
48
+ break;
49
+ }
50
+ }
51
+ return c + t > w && (c = w - t - n), c < 0 && (c = n), u + e > d && (u = d - e - n), u < 0 && (u = n), {
52
+ left: c + h,
53
+ top: u + k
54
+ };
55
+ }, [_]), C = L(({
56
+ event: t,
57
+ data: e
58
+ }) => {
59
+ r.debug(`${m}: Select`, {
60
+ value: e == null ? void 0 : e.value,
61
+ name: e == null ? void 0 : e.name,
62
+ previousValue: i == null ? void 0 : i.value,
63
+ previousName: i == null ? void 0 : i.name
64
+ }), a == null || a({
57
65
  event: t,
58
- data: n
59
- }) => {
60
- v == null || v({
61
- event: t,
62
- data: n
63
- }), L(n), f(!1);
64
- },
65
- value: B,
66
- itemIdentifier: R
67
- }, F = O(() => {
68
- f((t) => !t);
69
- }, []);
70
- return $(T, () => r.current), q(() => {
71
- if (o.current && u) {
72
- const t = o.current.getBoundingClientRect(), n = r.current ? r.current.getBoundingClientRect() : P, {
66
+ data: e
67
+ }), P(e), M && g(!1);
68
+ }, [a, M, i]), B = L(() => {
69
+ g((t) => {
70
+ const e = !t;
71
+ return r.debug(`${m}: ${e ? "Open" : "Close"}`, {
72
+ trigger: "toggle"
73
+ }), e;
74
+ });
75
+ }, []), D = {
76
+ onSelect: C,
77
+ value: i,
78
+ itemIdentifier: I
79
+ }, b = (t) => {
80
+ var e;
81
+ ((e = v == null ? void 0 : v.current) != null && e.isOpen || l) && t.key === ee.ESCAPE && (r.debug(`${m}: Close`, {
82
+ trigger: "escape"
83
+ }), g(!1));
84
+ }, T = (t) => {
85
+ var e, o;
86
+ !((e = p == null ? void 0 : p.current) != null && e.contains(N || t.target)) && !((o = s == null ? void 0 : s.current) != null && o.contains(t.target)) && (r.debug(`${m}: Close`, {
87
+ trigger: "outsideClick"
88
+ }), g(!1), E(null));
89
+ };
90
+ return U(() => (l ? (document.addEventListener("keydown", b), document.addEventListener("mousedown", T)) : (document.removeEventListener("keydown", b), document.removeEventListener("mousedown", T)), () => {
91
+ document.removeEventListener("keydown", b), document.removeEventListener("mousedown", T);
92
+ }), [l]), V(() => {
93
+ if (s.current && l) {
94
+ const t = s.current.getBoundingClientRect(), {
73
95
  top: e,
74
- left: i
75
- } = A(t), {
76
- offset: c,
77
- maxHeight: m
78
- } = a, l = i < n.right && t.right > n.left && e < 2 * c ? n.top - 2 * c : window.innerHeight - e - c;
79
- _.current = {
96
+ left: o
97
+ } = F(t), w = window.innerHeight, d = window.scrollY || window.pageYOffset || 0, h = e - d, k = w - h - n, O = Math.max(oe, Math.min(te, k));
98
+ S.current = {
80
99
  top: e,
81
- left: i,
82
- maxHeight: Math.min(m, l)
83
- }, o.current && (o.current.style.left = `${i}px`, o.current.style.top = `${e}px`, o.current.style.maxHeight = `${Math.min(m, l)}px`);
100
+ left: o
101
+ }, s.current && (s.current.style.left = `${o}px`, s.current.style.top = `${e}px`, s.current.style.maxHeight = `${O}px`);
84
102
  }
85
- }), I(() => {
86
- const t = (n) => {
87
- u && n.key === Z.ESCAPE && f(!1);
88
- };
89
- return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
90
- }, [u]), I(() => {
91
- const t = (n) => {
92
- var e, i;
93
- !((e = r == null ? void 0 : r.current) != null && e.contains(n.target)) && !((i = o == null ? void 0 : o.current) != null && i.contains(n.target)) && f(!1);
94
- };
95
- return document.addEventListener("mousedown", t), () => {
96
- document.removeEventListener("mousedown", t);
97
- };
98
- }, [o]), /* @__PURE__ */ K(V, { children: [
99
- /* @__PURE__ */ g(U, { onClick: F, theme: C, ref: r, "data-testid": w, ...y, children: N }),
100
- u && /* @__PURE__ */ g(X, { withWrapper: !1, children: /* @__PURE__ */ g(z.Provider, { value: D, children: /* @__PURE__ */ g(J, { ref: o, "data-testid": w, theme: C, ...G(y), children: k }) }) })
103
+ }), W(v, () => ({
104
+ ref: p,
105
+ isOpen: l,
106
+ selectedValue: i,
107
+ onSelect: C,
108
+ open: (t) => {
109
+ r.debug(`${m}: Open`, {
110
+ trigger: "ref"
111
+ }), !l && (E(t || null), g(!0));
112
+ },
113
+ close: (t) => {
114
+ r.debug(`${m}: Close`, {
115
+ trigger: "ref"
116
+ }), l && (E(t || null), g(!1));
117
+ }
118
+ }), [l, i, C]), /* @__PURE__ */ X(q.Provider, { value: D, children: [
119
+ /* @__PURE__ */ x(G, { onClick: B, theme: f, ref: p, "data-testid": m, ...$, children: A }),
120
+ l && /* @__PURE__ */ x(Z, { withWrapper: !1, children: /* @__PURE__ */ x(R, { ref: s, "data-testid": m, theme: f, ...z($), children: Y }) })
101
121
  ] });
102
122
  });
103
- tt.displayName = w;
123
+ ne.displayName = m;
104
124
  export {
105
- tt as Menu
125
+ ne as Menu
106
126
  };
@@ -1,15 +1,20 @@
1
- import { ReactNode } from 'react';
2
- import { Theme } from '../../../hooks';
3
- import { ButtonProps, CommonCssComponentStyledProps, SelectProps } from '../..';
4
- import { MENU_DEFAULT_OPTIONS } from './constants';
5
- export type MenuOptions = Partial<typeof MENU_DEFAULT_OPTIONS>;
6
- export type VerticalAlignment = 'bottom' | 'top';
7
- export interface MenuProps<T> extends Partial<Pick<SelectProps<T>, 'styles' | 'onSelect' | 'itemIdentifier' | 'children'>> {
8
- title?: string;
1
+ import { ReactNode, Ref } from 'react';
2
+ import { BoxCssComponentProps, CommonCssComponentStyledProps, Option, SelectOnSelect, ItemIdentifier } from '../..';
3
+ export type MenuPlacement = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
4
+ export interface MenuProps extends Omit<BoxCssComponentProps, 'content' | 'onSelect'> {
5
+ itemIdentifier?: ItemIdentifier;
9
6
  content?: ReactNode;
10
- options?: MenuOptions;
7
+ onSelect?: SelectOnSelect;
8
+ closeOnSelect?: boolean;
9
+ placement?: MenuPlacement;
11
10
  }
12
- export interface MenuTriggerStyledProps extends Partial<ButtonProps> {
13
- theme?: Theme;
11
+ export interface MenuRef {
12
+ ref: Ref<HTMLDivElement>;
13
+ selectedValue?: Option | null;
14
+ isOpen: boolean;
15
+ onSelect: SelectOnSelect;
16
+ open: (target?: EventTarget | null) => void;
17
+ close: (target?: EventTarget | null) => void;
14
18
  }
19
+ export type MenuTriggerStyledProps = CommonCssComponentStyledProps;
15
20
  export type MenuContentStyledProps = CommonCssComponentStyledProps;
@@ -1,3 +1,3 @@
1
1
  import { MenuTriggerStyledProps, MenuContentStyledProps } from './Menu.types';
2
- export declare const MenuTriggerStyled: import('react').ForwardRefExoticComponent<MenuTriggerStyledProps & import('react').RefAttributes<HTMLDivElement>>;
2
+ export declare const MenuTriggerStyled: import('react').ForwardRefExoticComponent<Omit<MenuTriggerStyledProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
3
3
  export declare const MenuContentStyled: import('react').ForwardRefExoticComponent<Omit<MenuContentStyledProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
@@ -1,4 +1,4 @@
1
- const i = "Menu", t = {
1
+ const o = "Menu", t = {
2
2
  bottom: 0,
3
3
  height: 0,
4
4
  left: 0,
@@ -7,18 +7,10 @@ const i = "Menu", t = {
7
7
  width: 0,
8
8
  x: 0,
9
9
  y: 0
10
- }, o = {
11
- ...t
12
10
  }, e = {
13
- align: "right",
14
- direction: null,
15
- limitWidth: "auto",
16
- maxHeight: 400,
17
- minHeight: 80,
18
- offset: 4
11
+ ...t
19
12
  };
20
13
  export {
21
- i as COMPONENT_NAME,
22
- o as EMPTY_CLIENT_RECT,
23
- e as MENU_DEFAULT_OPTIONS
14
+ o as COMPONENT_NAME,
15
+ e as EMPTY_CLIENT_RECT
24
16
  };
@@ -1,47 +1,71 @@
1
1
  "use client";
2
- import { jsx as t, jsxs as m, Fragment as k } from "@emotion/react/jsx-runtime";
3
- import { forwardRef as w, useEffect as O } from "react";
4
- import { COMPONENT_NAME as r } from "./constants.js";
5
- import { ModalOverlayStyled as v, ModalContentStyled as B, ModalHeaderStyled as T, ModalTitleStyled as b, CloseButtonStyled as x, ModalBodyStyled as N, ModalFooterStyled as P } from "./ModalStyled.js";
6
- import { useTheme as $ } from "../../../hooks/useTheme/useTheme.js";
7
- import { get as f } from "../../../utils/helpers.js";
8
- import { Portal as g } from "../Portal/Portal.js";
9
- import { convertToInlineBoxStyles as A } from "../../../tokens/utils.js";
10
- import { Icon as K } from "../Icon/Icon.js";
11
- import { KEYBOARD_KEYS as j } from "../../../constants/keyboard.js";
12
- const D = w((y, p) => {
2
+ import { jsx as a, jsxs as g, Fragment as T } from "@emotion/react/jsx-runtime";
3
+ import { forwardRef as x, useEffect as u, useCallback as h } from "react";
4
+ import { COMPONENT_NAME as t } from "./constants.js";
5
+ import { ModalOverlayStyled as N, ModalContentStyled as P, ModalHeaderStyled as A, ModalTitleStyled as B, CloseButtonStyled as F, ModalBodyStyled as K, ModalFooterStyled as L } from "./ModalStyled.js";
6
+ import { useTheme as j } from "../../../hooks/useTheme/useTheme.js";
7
+ import { useLogger as D } from "../../../hooks/useLogger/useLogger.js";
8
+ import { get as p } from "../../../utils/helpers.js";
9
+ import { Portal as H } from "../Portal/Portal.js";
10
+ import { convertToInlineBoxStyles as I } from "../../../tokens/utils.js";
11
+ import { Icon as R } from "../Icon/Icon.js";
12
+ import { KEYBOARD_KEYS as Y } from "../../../constants/keyboard.js";
13
+ const _ = x(({
14
+ isOpen: o = !1,
15
+ isCustomView: f = !1,
16
+ onClose: r,
17
+ showCloseButton: i = !0,
18
+ closeOnEscape: c,
19
+ title: e,
20
+ children: y,
21
+ footer: m,
22
+ styles: s,
23
+ ...S
24
+ }, k) => {
13
25
  const {
14
- isOpen: d = !1,
15
- isCustomView: u = !1,
16
- onClose: o,
17
- showCloseButton: s = !0,
18
- closeOnEscape: a,
19
- title: l,
20
- children: i,
21
- footer: c,
22
- styles: h,
23
- ...S
24
- } = y, {
25
- theme: e
26
- } = $(), C = f(e, "modal.icons", {}), E = l || s && o;
27
- return O(() => {
28
- if (!a) return;
29
- const n = (M) => {
30
- o && M.key === j.ESCAPE && o();
26
+ theme: d
27
+ } = j(), l = D(), b = p(d, "modal.icons", {}), M = e || !!(i && r);
28
+ u(() => {
29
+ o && l.debug(`${t}: Open`, {
30
+ title: e,
31
+ isCustomView: f,
32
+ showCloseButton: i,
33
+ closeOnEscape: c,
34
+ hasFooter: !!m
35
+ });
36
+ }, [o, e, f, i, c, m]);
37
+ const $ = h(() => {
38
+ l.debug(`${t}: Close`, {
39
+ title: e,
40
+ trigger: "overlay"
41
+ }), r == null || r();
42
+ }, [r, e]), v = h(() => {
43
+ l.debug(`${t}: Close`, {
44
+ title: e,
45
+ trigger: "closeButton"
46
+ }), r == null || r();
47
+ }, [r, e]);
48
+ return u(() => {
49
+ if (!c) return;
50
+ const n = (E) => {
51
+ r && E.key === Y.ESCAPE && (l.debug(`${t}: Close`, {
52
+ title: e,
53
+ trigger: "escape"
54
+ }), r());
31
55
  };
32
56
  return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
33
- }, [d, a, o]), d ? /* @__PURE__ */ t(g, { blocksScroll: !0, children: /* @__PURE__ */ t(v, { onClick: o, theme: e, children: /* @__PURE__ */ t(B, { ref: p, onClick: (n) => n.stopPropagation(), "data-testid": r, theme: e, styles: h, ...A(S), children: u ? i : /* @__PURE__ */ m(k, { children: [
34
- E && /* @__PURE__ */ m(T, { theme: e, $withTitle: !!l, children: [
35
- l && /* @__PURE__ */ t(b, { theme: e, "data-testid": `${r}-title`, children: l }),
36
- s && o && /* @__PURE__ */ t(x, { onClick: o, "data-testid": "close-button", theme: e, children: /* @__PURE__ */ t(K, { ...f(C, "close", {
57
+ }, [o, c, r, e]), o ? /* @__PURE__ */ a(H, { blocksScroll: !0, children: /* @__PURE__ */ a(N, { onClick: $, theme: d, children: /* @__PURE__ */ a(P, { ref: k, onClick: (n) => n.stopPropagation(), "data-testid": t, theme: d, styles: s, ...I(S), children: f ? y : /* @__PURE__ */ g(T, { children: [
58
+ M && /* @__PURE__ */ g(A, { theme: d, $withTitle: !!e, "data-testid": `${t}-header`, children: [
59
+ e && /* @__PURE__ */ a(B, { theme: d, "data-testid": `${t}-title`, children: e }),
60
+ i && r && /* @__PURE__ */ a(F, { onClick: v, "data-testid": "close-button", theme: d, children: /* @__PURE__ */ a(R, { ...p(b, "close", {
37
61
  name: "cross"
38
62
  }) }) })
39
63
  ] }),
40
- i && /* @__PURE__ */ t(N, { theme: e, "data-testid": `${r}-body`, children: i }),
41
- c && /* @__PURE__ */ t(P, { theme: e, "data-testid": `${r}-footer`, children: c })
64
+ y && /* @__PURE__ */ a(K, { theme: d, "data-testid": `${t}-body`, children: y }),
65
+ m && /* @__PURE__ */ a(L, { theme: d, "data-testid": `${t}-footer`, children: m })
42
66
  ] }) }) }) }) : null;
43
67
  });
44
- D.displayName = r;
68
+ _.displayName = t;
45
69
  export {
46
- D as Modal
70
+ _ as Modal
47
71
  };
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  import { jsx as m } from "@emotion/react/jsx-runtime";
3
2
  import { forwardRef as u } from "react";
4
3
  import { getBoxStyles as p, tokensHandler as a } from "../../../tokens/utils.js";
@@ -7,93 +6,93 @@ const M = (t) => {
7
6
  const {
8
7
  theme: {
9
8
  modal: e,
10
- ...s
9
+ ...o
11
10
  } = {},
12
- styles: o,
11
+ styles: s,
13
12
  ...r
14
13
  } = t, {
15
14
  boxStyles: l,
16
15
  restProps: n
17
- } = p(r), d = new Proxy(e || {}, a(s)), c = [y(d, "overlay.default", {}), l, o];
16
+ } = p(r), d = new Proxy(e || {}, a(o)), c = [y(d, "overlay.default", {}), l, s];
18
17
  return /* @__PURE__ */ m("div", { css: c, ...n });
19
18
  }, w = u((t, e) => {
20
19
  const {
21
20
  theme: {
22
- modal: s,
23
- ...o
21
+ modal: o,
22
+ ...s
24
23
  } = {},
25
24
  styles: r = {},
26
25
  ...l
27
26
  } = t, {
28
27
  boxStyles: n,
29
28
  restProps: d
30
- } = p(l), c = new Proxy(s || {}, a(o)), S = [y(c, "content.default", {}), n, r];
29
+ } = p(l), c = new Proxy(o || {}, a(s)), S = [y(c, "content.default", {}), n, r];
31
30
  return /* @__PURE__ */ m("div", { css: S, ...d, ref: e });
32
31
  }), b = (t) => {
33
32
  const {
34
33
  theme: {
35
34
  modal: e,
36
- ...s
35
+ ...o
37
36
  } = {},
38
- $withTitle: o,
37
+ $withTitle: s,
39
38
  styles: r,
40
39
  ...l
41
40
  } = t, {
42
41
  boxStyles: n,
43
42
  restProps: d
44
- } = p(l), c = new Proxy(e || {}, a(s)), S = y(c, "header", {}), P = [y(S, "default", {}), o ? y(S, "withTitle", {}) : {}, n, r];
43
+ } = p(l), c = new Proxy(e || {}, a(o)), S = y(c, "header", {}), P = [y(S, "default", {}), s ? y(S, "withTitle", {}) : {}, n, r];
45
44
  return /* @__PURE__ */ m("div", { css: P, ...d });
46
45
  }, v = (t) => {
47
46
  const {
48
47
  theme: {
49
48
  modal: e,
50
- ...s
49
+ ...o
51
50
  } = {},
52
- styles: o,
51
+ styles: s,
53
52
  ...r
54
53
  } = t, {
55
54
  boxStyles: l,
56
55
  restProps: n
57
- } = p(r), d = new Proxy(e || {}, a(s)), c = [y(d, "title.default", {}), l, o];
56
+ } = p(r), d = new Proxy(e || {}, a(o)), c = [y(d, "title.default", {}), l, s];
58
57
  return /* @__PURE__ */ m("div", { css: c, ...n });
59
58
  }, N = (t) => {
60
59
  const {
61
60
  theme: {
62
61
  modal: e,
63
- ...s
62
+ ...o
64
63
  } = {},
65
- styles: o,
64
+ styles: s,
66
65
  ...r
67
66
  } = t, {
68
67
  boxStyles: l,
69
68
  restProps: n
70
- } = p(r), d = new Proxy(e || {}, a(s)), c = [y(d, "body.default", {}), l, o];
69
+ } = p(r), d = new Proxy(e || {}, a(o)), c = [y(d, "body.default", {}), l, s];
71
70
  return /* @__PURE__ */ m("div", { css: c, ...n });
72
71
  }, B = (t) => {
73
72
  const {
74
73
  theme: {
75
74
  modal: e,
76
- ...s
75
+ ...o
77
76
  } = {},
78
- styles: o,
77
+ styles: s,
79
78
  ...r
80
79
  } = t, {
81
80
  boxStyles: l,
82
81
  restProps: n
83
- } = p(r), d = new Proxy(e || {}, a(s)), c = [y(d, "footer.default", {}), l, o];
82
+ } = p(r), d = new Proxy(e || {}, a(o)), c = [y(d, "footer.default", {}), l, s];
84
83
  return /* @__PURE__ */ m("div", { css: c, ...n });
85
84
  }, T = (t) => {
86
85
  const {
87
86
  theme: {
88
87
  modal: e,
89
- ...s
88
+ ...o
90
89
  } = {},
91
- styles: o,
90
+ styles: s,
92
91
  ...r
93
92
  } = t, {
94
93
  boxStyles: l,
95
94
  restProps: n
96
- } = p(r), d = new Proxy(e || {}, a(s)), c = [y(d, "closeButton.default", {}), l, o];
95
+ } = p(r), d = new Proxy(e || {}, a(o)), c = [y(d, "closeButton.default", {}), l, s];
97
96
  return /* @__PURE__ */ m("button", { css: c, ...n });
98
97
  };
99
98
  export {
@@ -10,10 +10,16 @@ import { ScrollProps } from './Scroll.types';
10
10
  * @component
11
11
  * @param {'auto' | 'hidden' | 'visible'} [vertical='auto'] - Controls vertical scrollbar visibility.
12
12
  * @param {'auto' | 'hidden' | 'visible'} [horizontal='auto'] - Controls horizontal scrollbar visibility.
13
+ * @param {boolean} [autoHide=false] - When true, scrollbars are only visible during scrolling.
13
14
  *
14
15
  * @example
15
16
  * <Scroll vertical="auto" horizontal="hidden">
16
17
  * <div>Scrollable content</div>
17
18
  * </Scroll>
19
+ *
20
+ * @example
21
+ * <Scroll vertical="auto" autoHide>
22
+ * <div>Scrollable content with auto-hiding scrollbars</div>
23
+ * </Scroll>
18
24
  */
19
25
  export declare const Scroll: import('react').ForwardRefExoticComponent<ScrollProps & import('react').RefAttributes<HTMLDivElement>>;