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,40 +1,62 @@
1
1
  "use client";
2
- import { jsxs as f, jsx as o } from "@emotion/react/jsx-runtime";
3
- import { forwardRef as z, useState as u, useRef as x, useImperativeHandle as M } from "react";
4
- import { ScrollStyled as V, ScrollBarsStyled as W, ScrollContentStyled as j } from "./ScrollStyled.js";
5
- import { ScrollBar as S } from "./ScrollBar.js";
6
- import { COMPONENT_NAME as i } from "./constants.js";
7
- import { useTheme as A } from "../../../hooks/useTheme/useTheme.js";
8
- import { useAnimationFrame as B } from "../../../utils/animationFrame.js";
9
- const I = z((b, c) => {
10
- const [s, p] = u(!1), [a, g] = u(!1), t = x(null), {
11
- theme: e
12
- } = A(), {
13
- vertical: w = "auto",
14
- horizontal: n = "auto",
15
- children: H,
16
- ...N
17
- } = b, d = (r, l) => r === "visible" ? !0 : r === "hidden" ? !1 : l;
18
- return B(() => {
19
- if (!t.current)
2
+ import { jsxs as g, jsx as i } from "@emotion/react/jsx-runtime";
3
+ import { forwardRef as _, useState as n, useRef as v, useCallback as x, useEffect as O, useImperativeHandle as R } from "react";
4
+ import { ScrollStyled as V, ScrollBarsStyled as C, ScrollContentStyled as W } from "./ScrollStyled.js";
5
+ import { ScrollBar as H } from "./ScrollBar.js";
6
+ import { AUTO_HIDE_TS as j, COMPONENT_NAME as a, ANIMATION_FRAME_TS as B } from "./constants.js";
7
+ import { useTheme as F } from "../../../hooks/useTheme/useTheme.js";
8
+ import { useAnimationFrame as L } from "../../../utils/animationFrame.js";
9
+ const J = _((N, u) => {
10
+ const [d, w] = n(!1), [f, E] = n(!1), [m, h] = n(!1), r = v(null), l = v(null), {
11
+ theme: o
12
+ } = F(), {
13
+ vertical: A = "auto",
14
+ horizontal: S = "auto",
15
+ autoHide: e = !1,
16
+ children: M,
17
+ ...y
18
+ } = N, b = (t, s) => {
19
+ switch (t) {
20
+ case "visible":
21
+ return !0;
22
+ case "hidden":
23
+ return !1;
24
+ default:
25
+ return s;
26
+ }
27
+ };
28
+ L(() => {
29
+ if (!r.current)
20
30
  return;
21
31
  const {
22
- clientHeight: r,
23
- scrollHeight: l,
24
- clientWidth: v,
25
- scrollWidth: y
26
- } = t.current, h = d(w, Math.ceil(r / l * 100) < 100), m = d(n, Math.ceil(v / y * 100) < 100);
27
- h !== s && p(h), m !== a && g(m);
28
- }, 300), M(c, () => t.current, []), /* @__PURE__ */ f(V, { className: "gd-scroll", ref: t, theme: e, ...N, "data-testid": i, children: [
29
- /* @__PURE__ */ f(W, { className: "gd-scroll--scrollbars", theme: e, "data-testid": `${i}-scrollbars`, children: [
30
- s && /* @__PURE__ */ o(S, { direction: "vertical", containerRef: t }),
31
- a && /* @__PURE__ */ o(S, { direction: "horizontal", containerRef: t })
32
+ clientHeight: t,
33
+ scrollHeight: s,
34
+ clientWidth: z,
35
+ scrollWidth: I
36
+ } = r.current, T = b(A, Math.ceil(t / s * 100) < 100), p = b(S, Math.ceil(z / I * 100) < 100);
37
+ T !== d && w(T), p !== f && E(p);
38
+ }, B);
39
+ const c = x(() => {
40
+ e && (h(!0), l.current && clearTimeout(l.current), l.current = setTimeout(() => {
41
+ h(!1);
42
+ }, j));
43
+ }, [e]);
44
+ return O(() => {
45
+ const t = r.current;
46
+ if (!(!t || !e))
47
+ return t.addEventListener("scroll", c), () => {
48
+ t.removeEventListener("scroll", c), l.current && clearTimeout(l.current);
49
+ };
50
+ }, [e, c]), R(u, () => r.current, []), /* @__PURE__ */ g(V, { className: "gd-scroll", ref: r, theme: o, ...y, "data-testid": a, children: [
51
+ /* @__PURE__ */ g(C, { className: "gd-scroll--scrollbars", theme: o, "data-testid": `${a}-scrollbars`, children: [
52
+ d && /* @__PURE__ */ i(H, { direction: "vertical", containerRef: r, autoHide: e, isScrolling: m }),
53
+ f && /* @__PURE__ */ i(H, { direction: "horizontal", containerRef: r, autoHide: e, isScrolling: m })
32
54
  ] }),
33
- /* @__PURE__ */ o(j, { ref: c, className: "gd-scroll--content", theme: e, style: n === "hidden" ? {
55
+ /* @__PURE__ */ i(W, { ref: u, className: "gd-scroll--content", theme: o, style: S === "hidden" ? {
34
56
  maxWidth: "100%"
35
- } : void 0, "data-testid": `${i}-content`, children: H })
57
+ } : void 0, "data-testid": `${a}-content`, children: M })
36
58
  ] });
37
59
  });
38
60
  export {
39
- I as Scroll
61
+ J as Scroll
40
62
  };
@@ -5,10 +5,13 @@ export type ScrollBarPosition = 'hidden' | 'visible' | 'auto';
5
5
  export interface ScrollProps extends PropsWithChildren<CommonCssComponentProps> {
6
6
  vertical?: ScrollBarPosition;
7
7
  horizontal?: ScrollBarPosition;
8
+ autoHide?: boolean;
8
9
  }
9
10
  export interface ScrollBarProps extends CommonCssComponentProps {
10
11
  direction?: ScrollDirection;
11
12
  containerRef?: RefObject<HTMLElement>;
13
+ autoHide?: boolean;
14
+ isScrolling?: boolean;
12
15
  }
13
16
  export interface ScrollStyledProps extends PropsWithChildren<CommonCssComponentStyledProps> {
14
17
  $vertical?: ScrollBarPosition;
@@ -16,4 +19,6 @@ export interface ScrollStyledProps extends PropsWithChildren<CommonCssComponentS
16
19
  }
17
20
  export interface ScrollBarStyledProps extends CommonCssComponentStyledProps {
18
21
  $direction?: ScrollDirection;
22
+ $autoHide?: boolean;
23
+ $isScrolling?: boolean;
19
24
  }
@@ -1,68 +1,70 @@
1
1
  "use client";
2
- import { jsx as T } from "@emotion/react/jsx-runtime";
3
- import { useRef as z, useEffect as A } from "react";
4
- import { getThumbPosition as H } from "./utils.js";
5
- import { SCROLL_BAR_ANIMATION_THROTTLE as x, COMPONENT_NAME as $ } from "./constants.js";
6
- import { ScrollBarStyled as C, ScrollBarThumbStyled as M } from "./ScrollStyled.js";
7
- import { useTheme as D } from "../../../hooks/useTheme/useTheme.js";
8
- import { useAnimationFrame as I } from "../../../utils/animationFrame.js";
9
- const Y = (v) => {
2
+ import { jsx as v } from "@emotion/react/jsx-runtime";
3
+ import { useRef as A, useEffect as x } from "react";
4
+ import { getThumbPosition as C } from "./utils.js";
5
+ import { SCROLL_BAR_ANIMATION_THROTTLE as M, COMPONENT_NAME as E } from "./constants.js";
6
+ import { ScrollBarStyled as D, ScrollBarThumbStyled as I } from "./ScrollStyled.js";
7
+ import { useTheme as R } from "../../../hooks/useTheme/useTheme.js";
8
+ import { useAnimationFrame as V } from "../../../utils/animationFrame.js";
9
+ const q = (S) => {
10
10
  const {
11
- direction: o,
12
- containerRef: t
13
- } = v, s = z(null), {
14
- theme: i
15
- } = D();
16
- return I(() => {
17
- const r = t != null && t.current ? H(t.current, o) : {
11
+ direction: r,
12
+ containerRef: t,
13
+ autoHide: c = !1,
14
+ isScrolling: u = !1
15
+ } = S, s = A(null), {
16
+ theme: m
17
+ } = R();
18
+ return V(() => {
19
+ const o = t != null && t.current ? C(t.current, r) : {
18
20
  position: 0,
19
21
  size: 0
20
22
  };
21
- s.current && (o === "vertical" ? (s.current.style.top = `${r.position}%`, s.current.style.height = `${r.size}%`) : (s.current.style.left = `${r.position}%`, s.current.style.width = `${r.size}%`));
22
- }, x), A(() => {
23
- const r = s.current;
24
- if (!r)
23
+ s.current && (r === "vertical" ? (s.current.style.top = `${o.position}%`, s.current.style.height = `${o.size}%`) : (s.current.style.left = `${o.position}%`, s.current.style.width = `${o.size}%`));
24
+ }, M), x(() => {
25
+ const o = s.current;
26
+ if (!o)
25
27
  return;
26
- let u = 0, m = 0;
27
- const E = ({
28
+ let d = 0, a = 0;
29
+ const _ = ({
28
30
  clientY: e
29
31
  }, {
30
32
  top: n,
31
33
  height: l
32
- }) => (e - n) / l, _ = ({
34
+ }) => (e - n) / l, H = ({
33
35
  clientX: e
34
36
  }, {
35
37
  left: n,
36
38
  width: l
37
39
  }) => (e - n) / l, N = (e, n, l) => {
38
- const a = r.parentElement, c = t == null ? void 0 : t.current;
39
- if (!a || !c)
40
+ const h = o.parentElement, i = t == null ? void 0 : t.current;
41
+ if (!h || !i)
40
42
  return [0, 0];
41
43
  const {
42
- offsetHeight: h,
43
- offsetWidth: g
44
- } = r, {
44
+ offsetHeight: $,
45
+ offsetWidth: b
46
+ } = o, {
45
47
  top: O,
46
- left: S,
47
- height: b,
48
- width: L
49
- } = a.getBoundingClientRect(), w = c.scrollHeight - b, y = c.scrollWidth - L, B = (e.clientY - O - h * n) / (b - h), P = (e.clientX - S - g * l) / (L - g);
50
- return [w * B, y * P];
51
- }, d = (e) => {
52
- const [n, l] = N(e, u, m);
53
- t != null && t.current && (o === "vertical" ? t.current.scrollTop = n : t.current.scrollLeft = l);
54
- }, p = () => {
55
- document.removeEventListener("pointermove", d), document.removeEventListener("pointerup", p);
48
+ left: w,
49
+ height: L,
50
+ width: T
51
+ } = h.getBoundingClientRect(), y = i.scrollHeight - L, B = i.scrollWidth - T, P = (e.clientY - O - $ * n) / (L - $), z = (e.clientX - w - b * l) / (T - b);
52
+ return [y * P, B * z];
56
53
  }, f = (e) => {
54
+ const [n, l] = N(e, d, a);
55
+ t != null && t.current && (r === "vertical" ? t.current.scrollTop = n : t.current.scrollLeft = l);
56
+ }, p = () => {
57
+ document.removeEventListener("pointermove", f), document.removeEventListener("pointerup", p);
58
+ }, g = (e) => {
57
59
  e.stopPropagation(), e.preventDefault();
58
- const n = r.getBoundingClientRect();
59
- u = E(e, n), m = _(e, n), document.addEventListener("pointermove", d), document.addEventListener("pointerup", p);
60
+ const n = o.getBoundingClientRect();
61
+ d = _(e, n), a = H(e, n), document.addEventListener("pointermove", f), document.addEventListener("pointerup", p);
60
62
  };
61
- return r.addEventListener("pointerdown", f), () => {
62
- r.removeEventListener("pointerdown", f);
63
+ return o.addEventListener("pointerdown", g), () => {
64
+ o.removeEventListener("pointerdown", g);
63
65
  };
64
- }, [t, s, o]), /* @__PURE__ */ T(C, { className: `gd-scroll--scrollbar gd-scroll--scrollbar__${o}`, $direction: o, theme: i, "data-testid": `${$}-scrollbar_${o}`, children: /* @__PURE__ */ T(M, { className: `gd-scroll--scrollbar-thumb gd-scroll--scrollbar-thumb__${o}`, ref: s, $direction: o, theme: i, "data-testid": `${$}-scrollbar-thumb_${o}` }) });
66
+ }, [t, s, r]), /* @__PURE__ */ v(D, { className: `gd-scroll--scrollbar gd-scroll--scrollbar__${r}`, $direction: r, $autoHide: c, $isScrolling: u, theme: m, "data-testid": `${E}-scrollbar_${r}`, children: /* @__PURE__ */ v(I, { className: `gd-scroll--scrollbar-thumb gd-scroll--scrollbar-thumb__${r}`, ref: s, $direction: r, $autoHide: c, $isScrolling: u, theme: m, "data-testid": `${E}-scrollbar-thumb_${r}` }) });
65
67
  };
66
68
  export {
67
- Y as ScrollBar
69
+ q as ScrollBar
68
70
  };
@@ -1,62 +1,66 @@
1
1
  "use client";
2
- import { jsx as d } from "@emotion/react/jsx-runtime";
3
- import { forwardRef as u } from "react";
4
- import { tokensHandler as S } from "../../../tokens/utils.js";
5
- import { get as n } from "../../../utils/helpers.js";
6
- const f = u((e, r) => {
2
+ import { jsx as i } from "@emotion/react/jsx-runtime";
3
+ import { forwardRef as S } from "react";
4
+ import { tokensHandler as u } from "../../../tokens/utils.js";
5
+ import { get as t } from "../../../utils/helpers.js";
6
+ const b = S((s, l) => {
7
7
  const {
8
8
  theme: {
9
- scroll: o,
10
- ...s
9
+ scroll: e,
10
+ ...o
11
11
  } = {},
12
- styles: l = {},
13
- ...t
14
- } = e, c = new Proxy(o || {}, S(s)), m = [n(c, "container.default", {}), l];
15
- return /* @__PURE__ */ d("div", { css: m, ...t, ref: r });
16
- }), h = u((e, r) => {
12
+ styles: c = {},
13
+ ...n
14
+ } = s, d = new Proxy(e || {}, u(o)), r = [t(d, "container.default", {}), c];
15
+ return /* @__PURE__ */ i("div", { css: r, ...n, ref: l });
16
+ }), P = S((s, l) => {
17
17
  const {
18
18
  theme: {
19
- scroll: o,
20
- ...s
19
+ scroll: e,
20
+ ...o
21
21
  } = {},
22
- styles: l = {},
23
- ...t
24
- } = e, c = new Proxy(o || {}, S(s)), m = [n(c, "content.default", {}), l];
25
- return /* @__PURE__ */ d("div", { css: m, ...t, ref: r });
26
- }), P = (e) => {
22
+ styles: c = {},
23
+ ...n
24
+ } = s, d = new Proxy(e || {}, u(o)), r = [t(d, "content.default", {}), c];
25
+ return /* @__PURE__ */ i("div", { css: r, ...n, ref: l });
26
+ }), $ = (s) => {
27
27
  const {
28
28
  theme: {
29
- scroll: r,
30
- ...o
29
+ scroll: l,
30
+ ...e
31
31
  } = {},
32
- ...s
33
- } = e, l = new Proxy(r || {}, S(o)), t = n(l, "scrollbars.default", {});
34
- return /* @__PURE__ */ d("div", { css: t, ...s });
35
- }, x = (e) => {
32
+ ...o
33
+ } = s, c = new Proxy(l || {}, u(e)), n = t(c, "scrollbars.default", {});
34
+ return /* @__PURE__ */ i("div", { css: n, ...o });
35
+ }, x = (s) => {
36
36
  const {
37
- $direction: r,
37
+ $direction: l,
38
+ $autoHide: e,
39
+ $isScrolling: o,
38
40
  theme: {
39
- scroll: o,
40
- ...s
41
+ scroll: c,
42
+ ...n
41
43
  } = {},
42
- ...l
43
- } = e, t = new Proxy(o || {}, S(s)), c = [n(t, "scrollbar.default", {}), n(t, `scrollbar.${r}`, {})];
44
- return /* @__PURE__ */ d("div", { css: c, ...l });
45
- }, b = u((e, r) => {
44
+ ...d
45
+ } = s, r = new Proxy(c || {}, u(n)), m = [t(r, "scrollbar.default", {}), t(r, `scrollbar.${l}`, {}), e && t(r, "scrollbar.autoHide", {}), e && o && t(r, "scrollbar.autoHideScrolling", {})];
46
+ return /* @__PURE__ */ i("div", { css: m, ...d });
47
+ }, H = S((s, l) => {
46
48
  const {
47
- $direction: o,
49
+ $direction: e,
50
+ $autoHide: o,
51
+ $isScrolling: c,
48
52
  theme: {
49
- scroll: s,
50
- ...l
53
+ scroll: n,
54
+ ...d
51
55
  } = {},
52
- ...t
53
- } = e, c = new Proxy(s || {}, S(l)), m = [n(c, "thumb.default", {}), n(c, `thumb.${o}`, {})];
54
- return /* @__PURE__ */ d("div", { css: m, ...t, ref: r });
56
+ ...r
57
+ } = s, m = new Proxy(n || {}, u(d)), a = [t(m, "thumb.default", {}), t(m, `thumb.${e}`, {}), o && t(m, "thumb.autoHide", {}), o && c && t(m, "thumb.autoHideScrolling", {})];
58
+ return /* @__PURE__ */ i("div", { css: a, ...r, ref: l });
55
59
  });
56
60
  export {
57
61
  x as ScrollBarStyled,
58
- b as ScrollBarThumbStyled,
59
- P as ScrollBarsStyled,
60
- h as ScrollContentStyled,
61
- f as ScrollStyled
62
+ H as ScrollBarThumbStyled,
63
+ $ as ScrollBarsStyled,
64
+ P as ScrollContentStyled,
65
+ b as ScrollStyled
62
66
  };
@@ -1,3 +1,5 @@
1
1
  export declare const COMPONENT_NAME = "Scroll";
2
2
  export declare const MIN_WIDTH = 24;
3
3
  export declare const SCROLL_BAR_ANIMATION_THROTTLE = 50;
4
+ export declare const ANIMATION_FRAME_TS = 300;
5
+ export declare const AUTO_HIDE_TS = 1000;
@@ -1,6 +1,8 @@
1
- const N = "Scroll", T = 24, o = 50;
1
+ const T = "Scroll", _ = 24, A = 50, N = 300, o = 1e3;
2
2
  export {
3
- N as COMPONENT_NAME,
4
- T as MIN_WIDTH,
5
- o as SCROLL_BAR_ANIMATION_THROTTLE
3
+ N as ANIMATION_FRAME_TS,
4
+ o as AUTO_HIDE_TS,
5
+ T as COMPONENT_NAME,
6
+ _ as MIN_WIDTH,
7
+ A as SCROLL_BAR_ANIMATION_THROTTLE
6
8
  };