@orioncactuscorp/ui 1.9.2 → 1.11.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 (99) hide show
  1. package/README.md +119 -54
  2. package/dist/components/Accordion/Accordion.css +1 -1
  3. package/dist/components/Accordion/Accordion.js +169 -177
  4. package/dist/components/ActionArea/ActionAreaLayout.js +20 -24
  5. package/dist/components/Cell/Cell.css +1 -1
  6. package/dist/components/Cell/Cell.js +57 -58
  7. package/dist/components/CheckMark/CheckMark.css +1 -1
  8. package/dist/components/Checkbox/Checkbox.css +1 -1
  9. package/dist/components/Checkbox/Checkbox.js +50 -51
  10. package/dist/components/Menu/Menu.css +1 -1
  11. package/dist/components/Menu/Menu.module.scss.js +20 -22
  12. package/dist/components/Modal/Modal.css +1 -1
  13. package/dist/components/Modal/Modal.js +585 -575
  14. package/dist/components/Modal/bottomSheetGeometry.js +46 -33
  15. package/dist/components/Modal/modalScrollArbitration.js +71 -49
  16. package/dist/components/Modal/snapPoints.js +42 -38
  17. package/dist/components/Modal/useModalContentBlockTransition.js +49 -44
  18. package/dist/components/Modal/useModalDrag.js +937 -854
  19. package/dist/components/Radio/Radio.css +1 -1
  20. package/dist/components/ScrollArea/ScrollArea.js +197 -200
  21. package/dist/components/Select/Select.js +31 -34
  22. package/dist/components/Switch/Switch.css +1 -1
  23. package/dist/components/Tabs/Tabs.css +1 -0
  24. package/dist/components/Tabs/Tabs.js +208 -0
  25. package/dist/components/Tabs/Tabs.module.scss.js +27 -0
  26. package/dist/components/Tabs.d.ts +6 -0
  27. package/dist/components/Tabs.js +8 -0
  28. package/dist/components/TextArea/TextArea.js +57 -58
  29. package/dist/components/TextInput/TextInput.js +30 -33
  30. package/dist/components/Tooltip/Tooltip.css +1 -1
  31. package/dist/foundations/color.theme.dark.css +1 -1
  32. package/dist/foundations/color.theme.light.css +1 -1
  33. package/dist/foundations/focus.css +1 -0
  34. package/dist/foundations/reset.css +1 -1
  35. package/dist/foundations.css +4 -3
  36. package/dist/index.js +69 -64
  37. package/dist/react/motion.js +31 -35
  38. package/dist/reset.css +1 -1
  39. package/dist/styles.css +14 -12
  40. package/dist/ui/src/components/Accordion/Accordion.d.ts.map +1 -1
  41. package/dist/ui/src/components/ActionArea/ActionAreaLayout.d.ts.map +1 -1
  42. package/dist/ui/src/components/Cell/Cell.d.ts.map +1 -1
  43. package/dist/ui/src/components/CheckMark/types.d.ts +10 -0
  44. package/dist/ui/src/components/CheckMark/types.d.ts.map +1 -1
  45. package/dist/ui/src/components/Checkbox/Checkbox.d.ts.map +1 -1
  46. package/dist/ui/src/components/Checkbox/types.d.ts +16 -0
  47. package/dist/ui/src/components/Checkbox/types.d.ts.map +1 -1
  48. package/dist/ui/src/components/Modal/Modal.d.ts +1 -1
  49. package/dist/ui/src/components/Modal/Modal.d.ts.map +1 -1
  50. package/dist/ui/src/components/Modal/bottomSheetGeometry.d.ts +13 -0
  51. package/dist/ui/src/components/Modal/bottomSheetGeometry.d.ts.map +1 -1
  52. package/dist/ui/src/components/Modal/modalScrollArbitration.d.ts.map +1 -1
  53. package/dist/ui/src/components/Modal/snapPoints.d.ts +3 -1
  54. package/dist/ui/src/components/Modal/snapPoints.d.ts.map +1 -1
  55. package/dist/ui/src/components/Modal/types.d.ts +8 -0
  56. package/dist/ui/src/components/Modal/types.d.ts.map +1 -1
  57. package/dist/ui/src/components/Modal/useModalContentBlockTransition.d.ts.map +1 -1
  58. package/dist/ui/src/components/Modal/useModalDrag.d.ts +27 -10
  59. package/dist/ui/src/components/Modal/useModalDrag.d.ts.map +1 -1
  60. package/dist/ui/src/components/Radio/types.d.ts +16 -0
  61. package/dist/ui/src/components/Radio/types.d.ts.map +1 -1
  62. package/dist/ui/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
  63. package/dist/ui/src/components/Select/Select.d.ts.map +1 -1
  64. package/dist/ui/src/components/Switch/types.d.ts +10 -0
  65. package/dist/ui/src/components/Switch/types.d.ts.map +1 -1
  66. package/dist/ui/src/components/Tabs/Tabs.d.ts +7 -0
  67. package/dist/ui/src/components/Tabs/Tabs.d.ts.map +1 -0
  68. package/dist/ui/src/components/Tabs/index.d.ts +3 -0
  69. package/dist/ui/src/components/Tabs/index.d.ts.map +1 -0
  70. package/dist/ui/src/components/Tabs/types.d.ts +26 -0
  71. package/dist/ui/src/components/Tabs/types.d.ts.map +1 -0
  72. package/dist/ui/src/components/TextArea/TextArea.d.ts.map +1 -1
  73. package/dist/ui/src/components/TextInput/TextInput.d.ts.map +1 -1
  74. package/dist/ui/src/index.d.ts +2 -0
  75. package/dist/ui/src/index.d.ts.map +1 -1
  76. package/dist/ui/src/react/motion/index.d.ts.map +1 -1
  77. package/dist/ui/src/utils/mergeRefs.d.ts +13 -0
  78. package/dist/ui/src/utils/mergeRefs.d.ts.map +1 -0
  79. package/dist/utils/mergeRefs.js +24 -0
  80. package/dist/vscode/oc-ui-vars.css +13 -0
  81. package/docs/editor-setup.md +42 -0
  82. package/docs/motion.md +665 -0
  83. package/docs/responsive-foundation-profile.md +230 -0
  84. package/docs/scss-helpers.md +189 -0
  85. package/docs/selector-contract.md +260 -0
  86. package/docs/spring.md +382 -0
  87. package/docs/stability.md +62 -0
  88. package/docs/tokens.md +559 -0
  89. package/package.json +9 -4
  90. package/src/scss/foundations/color-theme.test.ts +14 -0
  91. package/src/scss/foundations/color.theme.dark.scss +1 -0
  92. package/src/scss/foundations/color.theme.light.scss +1 -0
  93. package/src/scss/foundations/focus.scss +4 -0
  94. package/src/scss/foundations/focus.test.ts +48 -0
  95. package/src/scss/foundations/reset.scss +9 -4
  96. package/src/scss/foundations/reset.test.ts +32 -0
  97. package/src/scss/index.scss +2 -0
  98. package/src/scss/mixins/_focus.scss +11 -0
  99. package/src/scss/mixins/_focus.test.ts +58 -0
@@ -1,84 +1,80 @@
1
1
  'use client';
2
- import { jsx as w, jsxs as kt } from "react/jsx-runtime";
3
- import { useRef as p, useSyncExternalStore as wt, useState as X, useCallback as s, useMemo as At, useEffect as it, useLayoutEffect as vt, useContext as Nt } from "react";
4
- import bt from "../Interaction/Interaction.js";
5
- import { ScrollAreaContext as Tt } from "./contexts.js";
6
- import b from "./ScrollArea.module.scss.js";
2
+ import { jsx as g, jsxs as At } from "react/jsx-runtime";
3
+ import { useRef as f, useSyncExternalStore as vt, useState as X, useMemo as st, useCallback as u, useEffect as it, useLayoutEffect as bt, useContext as Nt } from "react";
4
+ import Et from "../Interaction/Interaction.js";
5
+ import { mergeRefs as yt } from "../../utils/mergeRefs.js";
6
+ import { ScrollAreaContext as St } from "./contexts.js";
7
+ import v from "./ScrollArea.module.scss.js";
7
8
  import { useScrollAreaGeometryStabilizer as Ot } from "./useScrollAreaGeometryStabilizer.js";
8
9
  const lt = "oc-scroll-area-container-style", at = "oc-scroll-area-root-style";
9
10
  let F = 0, q = 0;
10
- function Et() {
11
+ function Rt() {
11
12
  return () => {
12
13
  };
13
14
  }
14
15
  function $t() {
15
16
  return !0;
16
17
  }
17
- function Rt() {
18
+ function Tt() {
18
19
  return !1;
19
20
  }
20
21
  function Vt() {
21
22
  return typeof window < "u" && ("ontouchstart" in window || navigator.maxTouchPoints > 0);
22
23
  }
23
- function C(m) {
24
- return m.preventDefault(), !1;
24
+ function C(w) {
25
+ return w.preventDefault(), !1;
25
26
  }
26
- function Ut(m, e) {
27
+ function Ut(w, n) {
27
28
  let E = !1;
28
29
  return () => {
29
- E || (m(), E = !0, window.setTimeout(() => {
30
+ E || (w(), E = !0, window.setTimeout(() => {
30
31
  E = !1;
31
- }, e));
32
+ }, n));
32
33
  };
33
34
  }
34
- function yt(m, e) {
35
- typeof m == "function" ? m(e) : m && (m.current = e);
35
+ function T(w, n) {
36
+ w && (w.dataset.state = n, w.dataset.ocState = n);
36
37
  }
37
- function T(m, e) {
38
- m && (m.dataset.state = e, m.dataset.ocState = e);
39
- }
40
- function Qt({
41
- as: m,
42
- root: e = !1,
38
+ function Zt({
39
+ as: w,
40
+ root: n = !1,
43
41
  children: E,
44
42
  className: L = "",
45
43
  ref: k,
46
44
  "data-oc-component": A = "scroll-area",
47
45
  ...N
48
46
  }) {
49
- const M = m ?? "div", P = p(null), v = wt(
50
- Et,
47
+ const M = w ?? "div", P = f(null), b = vt(
48
+ Rt,
51
49
  $t,
52
- Rt
53
- ), y = wt(
54
- Et,
50
+ Tt
51
+ ), y = vt(
52
+ Rt,
55
53
  Vt,
56
- Rt
57
- ), [o, St] = X(null), [J, Ht] = X(!1), [K, Wt] = X(!1), B = p(null), f = p(null), u = p(null), D = p(null), g = p(null), d = p(null), [O, Ct] = X(null), [$, Lt] = X(null), x = p(!1), Y = p(!1), Q = p(0), Z = p(0), H = p(null), S = p(null), V = p(null), U = p(null), st = s(
58
- (t) => {
59
- P.current = t, yt(k, t);
60
- },
54
+ Tt
55
+ ), [o, Ht] = X(null), [J, Wt] = X(!1), [K, Ct] = X(!1), B = f(null), m = f(null), s = f(null), D = f(null), p = f(null), d = f(null), [O, Lt] = X(null), [$, Mt] = X(null), x = f(!1), Y = f(!1), Q = f(0), Z = f(0), H = f(null), S = f(null), V = f(null), U = f(null), ut = st(
56
+ () => yt(P, k),
61
57
  [k]
62
- ), ut = s((t) => {
63
- St(t);
64
- }, []), Mt = s((t) => {
65
- f.current = t, Ct(t);
66
- }, []), Pt = s((t) => {
67
- g.current = t, Lt(t);
68
- }, []), Bt = At(
69
- () => ({ isRoot: e, setContainerRef: ut }),
70
- [e, ut]
58
+ ), dt = u((t) => {
59
+ Ht(t);
60
+ }, []), Pt = u((t) => {
61
+ m.current = t, Lt(t);
62
+ }, []), Bt = u((t) => {
63
+ p.current = t, Mt(t);
64
+ }, []), Dt = st(
65
+ () => ({ isRoot: n, setContainerRef: dt }),
66
+ [n, dt]
71
67
  );
72
68
  it(() => {
73
- if (!(!v || y || typeof document > "u")) {
74
- if (F += 1, e && (q += 1), !document.getElementById(lt)) {
69
+ if (!(!b || y || typeof document > "u")) {
70
+ if (F += 1, n && (q += 1), !document.getElementById(lt)) {
75
71
  const t = document.createElement("style");
76
72
  t.id = lt, t.textContent = `
77
73
  [data-oc-scroll-container]::-webkit-scrollbar { display: none; }
78
74
  [data-oc-scroll-container] { scrollbar-width: none; }
79
75
  `, document.head.appendChild(t);
80
76
  }
81
- if (e && !document.getElementById(at)) {
77
+ if (n && !document.getElementById(at)) {
82
78
  const t = document.createElement("style");
83
79
  t.id = at, t.textContent = `
84
80
  ::-webkit-scrollbar { display: none; }
@@ -86,204 +82,204 @@ function Qt({
86
82
  `, document.head.appendChild(t);
87
83
  }
88
84
  return () => {
89
- F = Math.max(0, F - 1), e && (q = Math.max(
85
+ F = Math.max(0, F - 1), n && (q = Math.max(
90
86
  0,
91
87
  q - 1
92
88
  )), q === 0 && document.getElementById(at)?.remove(), F === 0 && document.getElementById(lt)?.remove();
93
89
  };
94
90
  }
95
- }, [v, e, y]), it(() => {
96
- if (!v || !e || typeof document > "u")
91
+ }, [b, n, y]), it(() => {
92
+ if (!b || !n || typeof document > "u")
97
93
  return;
98
94
  const t = document.body.style.overflow;
99
95
  document.body.style.overflow = "hidden";
100
- const n = window.setTimeout(() => {
96
+ const e = window.setTimeout(() => {
101
97
  document.body.style.overflow = t;
102
98
  }, 1);
103
99
  return () => {
104
100
  document.body.style.overflow = "hidden", window.setTimeout(() => {
105
101
  document.body.style.overflow = t;
106
- }, 1), window.clearTimeout(n);
102
+ }, 1), window.clearTimeout(e);
107
103
  };
108
- }, [v, e]);
109
- const dt = s(() => {
104
+ }, [b, n]);
105
+ const ht = u(() => {
110
106
  const t = o;
111
107
  if (t) {
112
- if (f.current) {
113
- const n = f.current.getBoundingClientRect().height, r = e ? window.innerHeight : t.clientHeight, c = t.scrollHeight, i = c <= r ? n : r / c * n;
114
- f.current.style.setProperty(
108
+ if (m.current) {
109
+ const e = m.current.getBoundingClientRect().height, r = n ? window.innerHeight : t.clientHeight, c = t.scrollHeight, i = c <= r ? e : r / c * e;
110
+ m.current.style.setProperty(
115
111
  "--oc-scroll-area-thumb-height",
116
112
  `${i}px`
117
113
  );
118
114
  }
119
- if (g.current) {
120
- const n = g.current.getBoundingClientRect().width, r = e ? window.innerWidth : t.clientWidth, c = t.scrollWidth, i = c <= r ? n : r / c * n;
121
- g.current.style.setProperty(
115
+ if (p.current) {
116
+ const e = p.current.getBoundingClientRect().width, r = n ? window.innerWidth : t.clientWidth, c = t.scrollWidth, i = c <= r ? e : r / c * e;
117
+ p.current.style.setProperty(
122
118
  "--oc-scroll-area-thumb-width",
123
119
  `${i}px`
124
120
  );
125
121
  }
126
122
  }
127
- }, [o, e]), R = s(() => {
123
+ }, [o, n]), R = u(() => {
128
124
  const t = o;
129
125
  if (t) {
130
- if (f.current && u.current)
131
- if (e) {
132
- const n = window.scrollY || document.documentElement.scrollTop, r = window.innerHeight, c = document.documentElement.scrollHeight;
126
+ if (m.current && s.current)
127
+ if (n) {
128
+ const e = window.scrollY || document.documentElement.scrollTop, r = window.innerHeight, c = document.documentElement.scrollHeight;
133
129
  if (c > r) {
134
- const i = f.current.getBoundingClientRect().height - u.current.clientHeight, a = c - r;
135
- let l = n, h = 0;
136
- n > a ? (h = n - a, l = a) : n < 0 && (h = n, l = 0);
130
+ const i = m.current.getBoundingClientRect().height - s.current.clientHeight, a = c - r;
131
+ let l = e, h = 0;
132
+ e > a ? (h = e - a, l = a) : e < 0 && (h = e, l = 0);
137
133
  const ot = l / a * i + h;
138
- u.current.style.transform = `translateY(${ot}px)`;
134
+ s.current.style.transform = `translateY(${ot}px)`;
139
135
  }
140
136
  } else {
141
- const { scrollTop: n, clientHeight: r, scrollHeight: c } = t;
137
+ const { scrollTop: e, clientHeight: r, scrollHeight: c } = t;
142
138
  if (c > r) {
143
- const i = f.current.getBoundingClientRect().height - u.current.clientHeight, a = n / (c - r) * i;
144
- u.current.style.transform = `translateY(${a}px)`;
139
+ const i = m.current.getBoundingClientRect().height - s.current.clientHeight, a = e / (c - r) * i;
140
+ s.current.style.transform = `translateY(${a}px)`;
145
141
  }
146
142
  }
147
- if (g.current && d.current) {
148
- const n = e ? window.scrollX || document.documentElement.scrollLeft : t.scrollLeft, r = e ? window.innerWidth : t.clientWidth, c = e ? document.documentElement.scrollWidth : t.scrollWidth;
143
+ if (p.current && d.current) {
144
+ const e = n ? window.scrollX || document.documentElement.scrollLeft : t.scrollLeft, r = n ? window.innerWidth : t.clientWidth, c = n ? document.documentElement.scrollWidth : t.scrollWidth;
149
145
  if (c > r) {
150
- const i = g.current.getBoundingClientRect().width - d.current.clientWidth, a = n / (c - r) * i;
146
+ const i = p.current.getBoundingClientRect().width - d.current.clientWidth, a = e / (c - r) * i;
151
147
  d.current.style.transform = `translateX(${a}px)`;
152
148
  }
153
149
  }
154
150
  }
155
- }, [o, e]), ht = s(() => {
151
+ }, [o, n]), mt = u(() => {
156
152
  T(B.current, "active"), T(D.current, "active"), H.current !== null && window.clearTimeout(H.current), H.current = window.setTimeout(() => {
157
153
  T(B.current, "hidden"), T(D.current, "hidden"), H.current = null;
158
154
  }, 1e3);
159
- }, []), tt = s(() => {
160
- R(), ht();
161
- }, [ht, R]), mt = s(() => {
155
+ }, []), tt = u(() => {
156
+ R(), mt();
157
+ }, [mt, R]), ft = u(() => {
162
158
  const t = o;
163
159
  if (!t) return;
164
- const n = e ? window.innerHeight : t.clientHeight, r = e ? window.innerWidth : t.clientWidth;
165
- Ht(t.scrollHeight > n), Wt(t.scrollWidth > r);
166
- }, [o, e]), Dt = s(() => {
160
+ const e = n ? window.innerHeight : t.clientHeight, r = n ? window.innerWidth : t.clientWidth;
161
+ Wt(t.scrollHeight > e), Ct(t.scrollWidth > r);
162
+ }, [o, n]), xt = u(() => {
167
163
  const t = o;
168
164
  if (!t) return "";
169
- const n = f.current?.getBoundingClientRect().height ?? 0, r = g.current?.getBoundingClientRect().width ?? 0;
165
+ const e = m.current?.getBoundingClientRect().height ?? 0, r = p.current?.getBoundingClientRect().width ?? 0;
170
166
  return [
171
167
  t.clientWidth,
172
168
  t.clientHeight,
173
169
  t.scrollWidth,
174
170
  t.scrollHeight,
175
- n,
171
+ e,
176
172
  r
177
173
  ].join(":");
178
- }, [o]), xt = s(() => {
179
- mt(), dt(), R();
180
- }, [mt, dt, R]), { cancelGeometryUpdate: _, scheduleGeometryUpdate: W } = Ot({
181
- enabled: v && !!o && !y,
182
- getGeometrySignature: Dt,
183
- updateGeometry: xt
184
- }), Yt = (t) => {
185
- if (t.preventDefault(), t.stopPropagation(), !f.current || !u.current || !o) return;
186
- x.current = !0, u.current.dataset.state = "dragging", u.current.dataset.ocState = "dragging";
187
- const n = e ? window.scrollY / (document.documentElement.scrollHeight - window.innerHeight) : o.scrollTop / (o.scrollHeight - o.clientHeight), r = f.current.getBoundingClientRect().height - u.current.clientHeight;
188
- Q.current = t.clientY - n * r, document.addEventListener("selectstart", C), document.addEventListener("dragstart", C);
189
- }, It = (t) => {
190
- if (t.preventDefault(), t.stopPropagation(), !g.current || !d.current || !o) return;
174
+ }, [o]), Yt = u(() => {
175
+ ft(), ht(), R();
176
+ }, [ft, ht, R]), { cancelGeometryUpdate: _, scheduleGeometryUpdate: W } = Ot({
177
+ enabled: b && !!o && !y,
178
+ getGeometrySignature: xt,
179
+ updateGeometry: Yt
180
+ }), It = (t) => {
181
+ if (t.preventDefault(), t.stopPropagation(), !m.current || !s.current || !o) return;
182
+ x.current = !0, s.current.dataset.state = "dragging", s.current.dataset.ocState = "dragging";
183
+ const e = n ? window.scrollY / (document.documentElement.scrollHeight - window.innerHeight) : o.scrollTop / (o.scrollHeight - o.clientHeight), r = m.current.getBoundingClientRect().height - s.current.clientHeight;
184
+ Q.current = t.clientY - e * r, document.addEventListener("selectstart", C), document.addEventListener("dragstart", C);
185
+ }, zt = (t) => {
186
+ if (t.preventDefault(), t.stopPropagation(), !p.current || !d.current || !o) return;
191
187
  Y.current = !0, d.current.dataset.state = "dragging", d.current.dataset.ocState = "dragging";
192
- const n = e ? window.scrollX / (document.documentElement.scrollWidth - window.innerWidth) : o.scrollLeft / (o.scrollWidth - o.clientWidth), r = g.current.getBoundingClientRect().width - d.current.clientWidth;
193
- Z.current = t.clientX - n * r, document.addEventListener("selectstart", C), document.addEventListener("dragstart", C);
194
- }, et = s(
195
- (t, n, r) => {
196
- const c = t === "vertical" ? f.current : g.current, i = t === "vertical" ? u.current : d.current;
188
+ const e = n ? window.scrollX / (document.documentElement.scrollWidth - window.innerWidth) : o.scrollLeft / (o.scrollWidth - o.clientWidth), r = p.current.getBoundingClientRect().width - d.current.clientWidth;
189
+ Z.current = t.clientX - e * r, document.addEventListener("selectstart", C), document.addEventListener("dragstart", C);
190
+ }, et = u(
191
+ (t, e, r) => {
192
+ const c = t === "vertical" ? m.current : p.current, i = t === "vertical" ? s.current : d.current;
197
193
  if (!c || !i) return;
198
194
  const a = t === "vertical" ? window.innerHeight : window.innerWidth, l = t === "vertical" ? document.documentElement.scrollHeight : document.documentElement.scrollWidth, h = t === "vertical" ? c.getBoundingClientRect().height : c.getBoundingClientRect().width, ot = t === "vertical" ? i.clientHeight : i.clientWidth, ct = h - ot;
199
195
  if (ct <= 0) return;
200
- const gt = Math.max(
196
+ const wt = Math.max(
201
197
  0,
202
- Math.min(n - r.current, ct)
198
+ Math.min(e - r.current, ct)
203
199
  ) / ct;
204
- t === "vertical" ? document.documentElement.scrollTop = gt * (l - a) : document.documentElement.scrollLeft = gt * (l - a);
200
+ t === "vertical" ? document.documentElement.scrollTop = wt * (l - a) : document.documentElement.scrollLeft = wt * (l - a);
205
201
  },
206
202
  []
207
- ), nt = s(
203
+ ), nt = u(
208
204
  (t) => {
209
205
  if (!o) return;
210
- let n = !1;
211
- if (e) {
206
+ let e = !1;
207
+ if (n) {
212
208
  const r = document.documentElement.style.scrollBehavior;
213
- document.documentElement.style.scrollBehavior = "auto", x.current && (t.preventDefault(), t.stopPropagation(), et("vertical", t.clientY, Q), n = !0), Y.current && (t.preventDefault(), t.stopPropagation(), et("horizontal", t.clientX, Z), n = !0), document.documentElement.style.scrollBehavior = r;
209
+ document.documentElement.style.scrollBehavior = "auto", x.current && (t.preventDefault(), t.stopPropagation(), et("vertical", t.clientY, Q), e = !0), Y.current && (t.preventDefault(), t.stopPropagation(), et("horizontal", t.clientX, Z), e = !0), document.documentElement.style.scrollBehavior = r;
214
210
  } else {
215
- if (x.current && f.current && u.current) {
211
+ if (x.current && m.current && s.current) {
216
212
  t.preventDefault(), t.stopPropagation();
217
- const r = f.current.getBoundingClientRect().height - u.current.clientHeight;
213
+ const r = m.current.getBoundingClientRect().height - s.current.clientHeight;
218
214
  if (r > 0) {
219
215
  const i = Math.max(
220
216
  0,
221
217
  Math.min(t.clientY - Q.current, r)
222
218
  ) / r * (o.scrollHeight - o.clientHeight);
223
- o.scrollTo({ top: i, behavior: "auto" }), n = !0;
219
+ o.scrollTo({ top: i, behavior: "auto" }), e = !0;
224
220
  }
225
221
  }
226
- if (Y.current && g.current && d.current) {
222
+ if (Y.current && p.current && d.current) {
227
223
  t.preventDefault(), t.stopPropagation();
228
- const r = g.current.getBoundingClientRect().width - d.current.clientWidth;
224
+ const r = p.current.getBoundingClientRect().width - d.current.clientWidth;
229
225
  if (r > 0) {
230
226
  const i = Math.max(
231
227
  0,
232
228
  Math.min(t.clientX - Z.current, r)
233
229
  ) / r * (o.scrollWidth - o.clientWidth);
234
- o.scrollTo({ left: i, behavior: "auto" }), n = !0;
230
+ o.scrollTo({ left: i, behavior: "auto" }), e = !0;
235
231
  }
236
232
  }
237
233
  }
238
- n && R();
234
+ e && R();
239
235
  },
240
- [o, e, et, R]
241
- ), rt = s(() => {
242
- x.current = !1, Y.current = !1, u.current && (u.current.dataset.state = "hidden", u.current.dataset.ocState = "hidden"), d.current && (d.current.dataset.state = "hidden", d.current.dataset.ocState = "hidden"), document.removeEventListener("selectstart", C), document.removeEventListener("dragstart", C);
243
- }, []), ft = (t) => {
236
+ [o, n, et, R]
237
+ ), rt = u(() => {
238
+ x.current = !1, Y.current = !1, s.current && (s.current.dataset.state = "hidden", s.current.dataset.ocState = "hidden"), d.current && (d.current.dataset.state = "hidden", d.current.dataset.ocState = "hidden"), document.removeEventListener("selectstart", C), document.removeEventListener("dragstart", C);
239
+ }, []), pt = (t) => {
244
240
  t.preventDefault();
245
- const n = t.currentTarget.dataset.ocOrientation ?? t.currentTarget.dataset.orientation;
246
- if (e) {
247
- n === "horizontal" ? window.scrollBy({
241
+ const e = t.currentTarget.dataset.ocOrientation ?? t.currentTarget.dataset.orientation;
242
+ if (n) {
243
+ e === "horizontal" ? window.scrollBy({
248
244
  left: t.deltaY || t.deltaX,
249
245
  behavior: "auto"
250
246
  }) : window.scrollBy({ top: t.deltaY, behavior: "auto" });
251
247
  return;
252
248
  }
253
- o && (n === "horizontal" ? o.scrollTo({
249
+ o && (e === "horizontal" ? o.scrollTo({
254
250
  left: o.scrollLeft + (t.deltaY || t.deltaX),
255
251
  behavior: "auto"
256
252
  }) : o.scrollTo({
257
253
  top: o.scrollTop + t.deltaY,
258
254
  behavior: "auto"
259
255
  }));
260
- }, G = s(() => {
256
+ }, G = u(() => {
261
257
  S.current !== null && (window.clearTimeout(S.current), S.current = null);
262
- }, []), pt = s(() => {
258
+ }, []), gt = u(() => {
263
259
  G(), S.current = window.setTimeout(() => {
264
- T(f.current, "hidden"), T(g.current, "hidden"), S.current = null;
260
+ T(m.current, "hidden"), T(p.current, "hidden"), S.current = null;
265
261
  }, 200);
266
- }, [G]), j = s(
262
+ }, [G]), j = u(
267
263
  (t) => {
268
- t ? (T(f.current, "active"), T(g.current, "active"), G()) : !x.current && !Y.current && pt();
264
+ t ? (T(m.current, "active"), T(p.current, "active"), G()) : !x.current && !Y.current && gt();
269
265
  },
270
- [G, pt]
271
- ), I = s(() => {
266
+ [G, gt]
267
+ ), I = u(() => {
272
268
  V.current !== null && (window.clearInterval(V.current), V.current = null);
273
- }, []), z = s(() => {
269
+ }, []), z = u(() => {
274
270
  U.current !== null && (window.clearInterval(U.current), U.current = null);
275
- }, []), zt = (t) => {
276
- if (t.target !== t.currentTarget || !o || !u.current)
271
+ }, []), Xt = (t) => {
272
+ if (t.target !== t.currentTarget || !o || !s.current)
277
273
  return;
278
- const n = t.clientY, r = u.current.getBoundingClientRect(), c = n < r.top ? "up" : n > r.bottom ? "down" : null;
274
+ const e = t.clientY, r = s.current.getBoundingClientRect(), c = e < r.top ? "up" : e > r.bottom ? "down" : null;
279
275
  if (!c) return;
280
- const i = e ? window.innerHeight : o.clientHeight, a = () => {
281
- const l = u.current?.getBoundingClientRect();
282
- if (l && n >= l.top && n <= l.bottom) {
276
+ const i = n ? window.innerHeight : o.clientHeight, a = () => {
277
+ const l = s.current?.getBoundingClientRect();
278
+ if (l && e >= l.top && e <= l.bottom) {
283
279
  I();
284
280
  return;
285
281
  }
286
- if (e) {
282
+ if (n) {
287
283
  const h = window.scrollY || document.documentElement.scrollTop;
288
284
  window.scrollTo({
289
285
  top: c === "up" ? h - i : h + i,
@@ -299,18 +295,18 @@ function Qt({
299
295
  R();
300
296
  };
301
297
  a(), V.current = window.setInterval(a, 300);
302
- }, Xt = (t) => {
298
+ }, kt = (t) => {
303
299
  if (t.target !== t.currentTarget || !o || !d.current)
304
300
  return;
305
- const n = t.clientX, r = d.current.getBoundingClientRect(), c = n < r.left ? "left" : n > r.right ? "right" : null;
301
+ const e = t.clientX, r = d.current.getBoundingClientRect(), c = e < r.left ? "left" : e > r.right ? "right" : null;
306
302
  if (!c) return;
307
- const i = e ? window.innerWidth : o.clientWidth, a = () => {
303
+ const i = n ? window.innerWidth : o.clientWidth, a = () => {
308
304
  const l = d.current?.getBoundingClientRect();
309
- if (l && n >= l.left && n <= l.right) {
305
+ if (l && e >= l.left && e <= l.right) {
310
306
  z();
311
307
  return;
312
308
  }
313
- if (e) {
309
+ if (n) {
314
310
  const h = window.scrollX || document.documentElement.scrollLeft;
315
311
  window.scrollTo({
316
312
  left: c === "left" ? h - i : h + i,
@@ -327,10 +323,10 @@ function Qt({
327
323
  };
328
324
  a(), U.current = window.setInterval(a, 300);
329
325
  };
330
- return vt(() => {
326
+ return bt(() => {
331
327
  const t = o;
332
- if (!v || !t || y) return;
333
- const n = window.requestAnimationFrame(W), r = e ? window : t;
328
+ if (!b || !t || y) return;
329
+ const e = window.requestAnimationFrame(W), r = n ? window : t;
334
330
  r.addEventListener("scroll", tt, {
335
331
  passive: !0
336
332
  });
@@ -349,27 +345,27 @@ function Qt({
349
345
  });
350
346
  const l = typeof ResizeObserver > "u" ? null : new ResizeObserver(i);
351
347
  return l && (l.observe(t), P.current && l.observe(P.current), t.firstElementChild instanceof HTMLElement && l.observe(t.firstElementChild), B.current && l.observe(B.current), O && l.observe(O), D.current && l.observe(D.current), $ && l.observe($)), () => {
352
- r.removeEventListener("scroll", tt), window.removeEventListener("resize", c), document.removeEventListener("mousemove", nt), document.removeEventListener("mouseup", rt), window.cancelAnimationFrame(n), _(), a.disconnect(), l?.disconnect();
348
+ r.removeEventListener("scroll", tt), window.removeEventListener("resize", c), document.removeEventListener("mousemove", nt), document.removeEventListener("mouseup", rt), window.cancelAnimationFrame(e), _(), a.disconnect(), l?.disconnect();
353
349
  };
354
350
  }, [
355
351
  _,
356
352
  o,
357
353
  W,
358
- v,
354
+ b,
359
355
  tt,
360
356
  nt,
361
357
  rt,
362
- e,
358
+ n,
363
359
  K,
364
360
  J,
365
361
  $,
366
362
  y,
367
363
  O
368
- ]), vt(() => {
364
+ ]), bt(() => {
369
365
  W();
370
366
  }, [
371
367
  o,
372
- v,
368
+ b,
373
369
  K,
374
370
  J,
375
371
  $,
@@ -381,72 +377,72 @@ function Qt({
381
377
  H.current !== null && window.clearTimeout(H.current), S.current !== null && window.clearTimeout(S.current), I(), z(), _();
382
378
  },
383
379
  [_, z, I]
384
- ), !v || y ? /* @__PURE__ */ w(
380
+ ), !b || y ? /* @__PURE__ */ g(
385
381
  M,
386
382
  {
387
- ref: st,
388
- className: `${b.scrollArea} ${L}`.trim(),
383
+ ref: ut,
384
+ className: `${v.scrollArea} ${L}`.trim(),
389
385
  ...N,
390
386
  "data-oc-component": A,
391
- "data-root": e ? "" : void 0,
392
- "data-oc-scroll-root": e ? "true" : void 0,
387
+ "data-root": n ? "" : void 0,
388
+ "data-oc-scroll-root": n ? "true" : void 0,
393
389
  "data-scroll": "",
394
390
  "data-oc-scroll": "",
395
- "data-scroll-label": e ? "root" : void 0,
396
- "data-oc-scroll-label": e ? "root" : void 0,
391
+ "data-scroll-label": n ? "root" : void 0,
392
+ "data-oc-scroll-label": n ? "root" : void 0,
397
393
  children: E
398
394
  }
399
- ) : /* @__PURE__ */ w(Tt.Provider, { value: Bt, children: /* @__PURE__ */ kt(
395
+ ) : /* @__PURE__ */ g(St.Provider, { value: Dt, children: /* @__PURE__ */ At(
400
396
  M,
401
397
  {
402
- ref: st,
403
- className: `${b.scrollArea} ${L}`.trim(),
398
+ ref: ut,
399
+ className: `${v.scrollArea} ${L}`.trim(),
404
400
  ...N,
405
401
  "data-oc-component": A,
406
- "data-root": e ? "" : void 0,
407
- "data-oc-scroll-root": e ? "true" : void 0,
402
+ "data-root": n ? "" : void 0,
403
+ "data-oc-scroll-root": n ? "true" : void 0,
408
404
  "data-scroll": "",
409
405
  "data-oc-scroll": "",
410
- "data-scroll-label": e ? "root" : void 0,
411
- "data-oc-scroll-label": e ? "root" : void 0,
406
+ "data-scroll-label": n ? "root" : void 0,
407
+ "data-oc-scroll-label": n ? "root" : void 0,
412
408
  children: [
413
409
  E,
414
- J ? /* @__PURE__ */ w(
410
+ J ? /* @__PURE__ */ g(
415
411
  "div",
416
412
  {
417
413
  ref: B,
418
- className: b.scrollbar,
414
+ className: v.scrollbar,
419
415
  "data-oc-part": "scrollbar-vertical",
420
416
  "data-orientation": "vertical",
421
417
  "data-oc-orientation": "vertical",
422
418
  "data-state": "hidden",
423
419
  "data-oc-state": "hidden",
424
- onWheel: ft,
425
- children: /* @__PURE__ */ w(
420
+ onWheel: pt,
421
+ children: /* @__PURE__ */ g(
426
422
  "div",
427
423
  {
428
- ref: Mt,
429
- className: b.wrapper,
424
+ ref: Pt,
425
+ className: v.wrapper,
430
426
  "data-oc-part": "scrollbar-track",
431
427
  "data-state": "hidden",
432
428
  "data-oc-state": "hidden",
433
429
  role: "presentation",
434
- onMouseDown: zt,
430
+ onMouseDown: Xt,
435
431
  onMouseEnter: () => j(!0),
436
432
  onMouseLeave: () => {
437
433
  I(), j(!1);
438
434
  },
439
435
  onMouseUp: I,
440
- children: /* @__PURE__ */ w(
436
+ children: /* @__PURE__ */ g(
441
437
  "div",
442
438
  {
443
- ref: u,
444
- className: b.thumb,
439
+ ref: s,
440
+ className: v.thumb,
445
441
  "data-oc-part": "thumb",
446
442
  "data-state": "hidden",
447
443
  "data-oc-state": "hidden",
448
444
  role: "presentation",
449
- onMouseDown: Yt,
445
+ onMouseDown: It,
450
446
  onPointerDownCapture: (t) => {
451
447
  t.stopPropagation(), t.nativeEvent.stopImmediatePropagation();
452
448
  },
@@ -456,12 +452,12 @@ function Qt({
456
452
  onPointerUpCapture: (t) => {
457
453
  t.stopPropagation(), t.nativeEvent.stopImmediatePropagation();
458
454
  },
459
- children: /* @__PURE__ */ w(
455
+ children: /* @__PURE__ */ g(
460
456
  "div",
461
457
  {
462
- className: b.background,
458
+ className: v.background,
463
459
  "data-oc-part": "thumb-background",
464
- children: /* @__PURE__ */ w(bt, { variant: "light", self: !0 })
460
+ children: /* @__PURE__ */ g(Et, { variant: "light", self: !0 })
465
461
  }
466
462
  )
467
463
  }
@@ -470,42 +466,42 @@ function Qt({
470
466
  )
471
467
  }
472
468
  ) : null,
473
- K ? /* @__PURE__ */ w(
469
+ K ? /* @__PURE__ */ g(
474
470
  "div",
475
471
  {
476
472
  ref: D,
477
- className: b.scrollbar,
473
+ className: v.scrollbar,
478
474
  "data-oc-part": "scrollbar-horizontal",
479
475
  "data-orientation": "horizontal",
480
476
  "data-oc-orientation": "horizontal",
481
477
  "data-state": "hidden",
482
478
  "data-oc-state": "hidden",
483
- onWheel: ft,
484
- children: /* @__PURE__ */ w(
479
+ onWheel: pt,
480
+ children: /* @__PURE__ */ g(
485
481
  "div",
486
482
  {
487
- ref: Pt,
488
- className: b.wrapper,
483
+ ref: Bt,
484
+ className: v.wrapper,
489
485
  "data-oc-part": "scrollbar-track",
490
486
  "data-state": "hidden",
491
487
  "data-oc-state": "hidden",
492
488
  role: "presentation",
493
- onMouseDown: Xt,
489
+ onMouseDown: kt,
494
490
  onMouseEnter: () => j(!0),
495
491
  onMouseLeave: () => {
496
492
  z(), j(!1);
497
493
  },
498
494
  onMouseUp: z,
499
- children: /* @__PURE__ */ w(
495
+ children: /* @__PURE__ */ g(
500
496
  "div",
501
497
  {
502
498
  ref: d,
503
- className: b.thumb,
499
+ className: v.thumb,
504
500
  "data-oc-part": "thumb",
505
501
  "data-state": "hidden",
506
502
  "data-oc-state": "hidden",
507
503
  role: "presentation",
508
- onMouseDown: It,
504
+ onMouseDown: zt,
509
505
  onPointerDownCapture: (t) => {
510
506
  t.stopPropagation(), t.nativeEvent.stopImmediatePropagation();
511
507
  },
@@ -515,12 +511,12 @@ function Qt({
515
511
  onPointerUpCapture: (t) => {
516
512
  t.stopPropagation(), t.nativeEvent.stopImmediatePropagation();
517
513
  },
518
- children: /* @__PURE__ */ w(
514
+ children: /* @__PURE__ */ g(
519
515
  "div",
520
516
  {
521
- className: b.background,
517
+ className: v.background,
522
518
  "data-oc-part": "thumb-background",
523
- children: /* @__PURE__ */ w(bt, { variant: "light", self: !0 })
519
+ children: /* @__PURE__ */ g(Et, { variant: "light", self: !0 })
524
520
  }
525
521
  )
526
522
  }
@@ -533,36 +529,37 @@ function Qt({
533
529
  }
534
530
  ) });
535
531
  }
536
- function Zt({
537
- as: m,
538
- children: e,
532
+ function te({
533
+ as: w,
534
+ children: n,
539
535
  className: E = "",
540
536
  ref: L,
541
537
  "data-oc-component": k = "scroll-area-container",
542
538
  ...A
543
539
  }) {
544
- const N = m ?? "div", M = Nt(Tt), P = s(
545
- (v) => {
546
- M?.setContainerRef(v), yt(L, v);
547
- },
540
+ const N = w ?? "div", M = Nt(St), P = st(
541
+ () => yt(
542
+ M?.setContainerRef,
543
+ L
544
+ ),
548
545
  [M, L]
549
546
  );
550
- return /* @__PURE__ */ w(
547
+ return /* @__PURE__ */ g(
551
548
  N,
552
549
  {
553
550
  ref: P,
554
- className: `${b.container} ${E}`.trim(),
551
+ className: `${v.container} ${E}`.trim(),
555
552
  ...A,
556
553
  "data-oc-part": "scroll-area-container",
557
554
  "data-oc-component": k,
558
555
  "data-scroll-container": "",
559
556
  "data-oc-scroll-container": "",
560
- children: e
557
+ children: n
561
558
  }
562
559
  );
563
560
  }
564
561
  export {
565
- Qt as ScrollArea,
566
- Zt as ScrollAreaContainer,
567
- Qt as default
562
+ Zt as ScrollArea,
563
+ te as ScrollAreaContainer,
564
+ Zt as default
568
565
  };