quirk-ui 0.0.177 → 0.0.179

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.
@@ -1,4 +1,4 @@
1
- import { jsxs as A, jsx as a } from "react/jsx-runtime";
1
+ import { jsxs as A, jsx as r } from "react/jsx-runtime";
2
2
  import { useState as c, useRef as C, useEffect as E } from "react";
3
3
  import { A as Mt } from "../../arrow-left-BIJvHwNQ.js";
4
4
  import { A as bt } from "../../arrow-right-QEwnX3Sk.js";
@@ -18,51 +18,51 @@ import '../../assets/index31.css';const gt = "_carousel_wqwci_1", xt = "_noPoint
18
18
  next: At
19
19
  };
20
20
  function Pt({
21
- items: m,
22
- itemsPerPage: l = 9,
23
- itemsPerRow: W = 3,
21
+ items: M,
22
+ itemsPerPage: i = 9,
23
+ itemsPerRow: J = 3,
24
24
  autoplay: K = !1,
25
- autoplayInterval: D = 3,
25
+ autoplayInterval: W = 3,
26
26
  className: Q,
27
27
  externalRef: V,
28
- siblingRef: i,
29
- isSplit: S = !1
28
+ siblingRef: l,
29
+ isSplit: D = !1
30
30
  }) {
31
- const [d, u] = c(0), [w, M] = c(0), [L, Z] = c(0), [b, tt] = c(l), [f, et] = c(!1), [P, nt] = c(K), ot = C(null), g = C(null), p = C(null), x = V, [v, X] = c(!1), [z, Y] = c(null), [$, j] = c(null), [R, U] = c(null), [st, B] = c(!1), [_, G] = c(null), [y, O] = c(null), ct = (t) => {
32
- Math.abs((y ?? 0) - (_ ?? 0)) > 25 && (t.stopPropagation(), t.preventDefault());
33
- }, at = (t) => {
34
- G(t.clientX);
31
+ const [d, u] = c(0), [w, b] = c(0), [S, Z] = c(0), [f, tt] = c(i), [p, et] = c(!1), [L, nt] = c(K), ot = C(null), g = C(null), v = C(null), x = V, [_, X] = c(!1), [P, z] = c(null), [$, Y] = c(null), [R, j] = c(null), [st, U] = c(!1), [m, B] = c(null), [y, G] = c(null), ct = (t) => {
32
+ Math.abs((y ?? 0) - (m ?? 0)) > 25 && (t.stopPropagation(), t.preventDefault());
35
33
  }, rt = (t) => {
36
- _ !== null && Math.abs(t.clientX - _) > 5 && (B(!0), O(t.clientX));
37
- }, lt = () => {
38
- if (!_ || !y) {
34
+ B(t.clientX);
35
+ }, at = (t) => {
36
+ m !== null && Math.abs(t.clientX - m) > 5 && (U(!0), G(t.clientX));
37
+ }, it = () => {
38
+ if (!m || !y) {
39
39
  I();
40
40
  return;
41
41
  }
42
- const t = _ - y;
42
+ const t = m - y;
43
43
  Math.abs(t) > 50 && (t > 0 ? q() : T()), I();
44
- }, it = () => {
44
+ }, lt = () => {
45
45
  I();
46
46
  }, I = () => {
47
- B(!1), G(null), O(null);
47
+ U(!1), B(null), G(null);
48
48
  }, dt = (t) => {
49
- j(t.touches[0].clientX), Y(t.touches[0].clientY), X(!1);
50
- }, F = C(null);
49
+ Y(t.touches[0].clientX), z(t.touches[0].clientY), X(!1);
50
+ }, O = C(null);
51
51
  E(() => {
52
- const t = F.current;
52
+ const t = O.current;
53
53
  if (!t) return;
54
54
  const e = (n) => {
55
- const s = n.touches[0].clientX - ($ ?? 0), r = n.touches[0].clientY - (z ?? 0);
56
- !v && Math.abs(s) > Math.abs(r) && X(!0), v && (n.preventDefault(), U(n.touches[0].clientX));
55
+ const s = n.touches[0].clientX - ($ ?? 0), a = n.touches[0].clientY - (P ?? 0);
56
+ !_ && Math.abs(s) > Math.abs(a) && X(!0), _ && (n.preventDefault(), j(n.touches[0].clientX));
57
57
  };
58
58
  return t.addEventListener("touchmove", e), () => {
59
59
  t.removeEventListener("touchmove", e);
60
60
  };
61
- }, [v, $, z]);
61
+ }, [_, $, P]);
62
62
  const ut = () => {
63
63
  if ($ === null || R === null) return;
64
64
  const t = $ - R;
65
- Math.abs(t) > 50 && (t > 0 ? q() : T()), j(null), U(null), Y(null), X(!1);
65
+ Math.abs(t) > 50 && (t > 0 ? q() : T()), Y(null), j(null), z(null), X(!1);
66
66
  }, ht = (t, e) => {
67
67
  const n = [];
68
68
  for (let s = 0; s < t.length; s += e)
@@ -72,90 +72,90 @@ function Pt({
72
72
  E(() => {
73
73
  if (typeof window < "u") {
74
74
  const t = () => {
75
- const e = window.innerWidth < 768, n = e ? 1 : l;
76
- et(e), tt(e ? 1 : l), u(
77
- (s) => Math.min(s, Math.ceil(m.length / n) - 1)
75
+ const e = window.innerWidth < 768, n = e ? 1 : i;
76
+ et(e), tt(e ? 1 : i), u(
77
+ (s) => Math.min(s, Math.ceil(M.length / n) - 1)
78
78
  );
79
79
  };
80
80
  return t(), window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
81
81
  }
82
- }, [l]);
83
- const N = Math.ceil(b / W), H = ht(m, b), h = H.length, wt = 3 * 16, ft = 3 * 16;
82
+ }, [i]);
83
+ const N = Math.ceil(f / J), F = ht(M, f), h = F.length, wt = 3 * 16, ft = 3 * 16;
84
84
  E(() => {
85
85
  const t = new ResizeObserver((e) => {
86
86
  var n, s;
87
- for (let r of e)
88
- if (r.contentRect) {
89
- f ? M(r.contentRect.width - ft) : S ? i != null && i.current ? M(
90
- r.contentRect.width - ((n = i == null ? void 0 : i.current) == null ? void 0 : n.offsetWidth) - wt
91
- ) : M(r.contentRect.width) : (M(r.contentRect.width), Z(
87
+ for (let a of e)
88
+ if (a.contentRect) {
89
+ p ? b(a.contentRect.width - ft) : D ? l != null && l.current ? b(
90
+ a.contentRect.width - ((n = l == null ? void 0 : l.current) == null ? void 0 : n.offsetWidth) - wt
91
+ ) : b(a.contentRect.width) : (b(a.contentRect.width), Z(
92
92
  ((s = g == null ? void 0 : g.current) == null ? void 0 : s.children[0].children[0].children[0].getBoundingClientRect().width) ?? 0
93
93
  ));
94
- const _t = f ? 1 : l;
94
+ const _t = p ? 1 : i;
95
95
  u(
96
- (mt) => Math.min(mt, Math.ceil(m.length / _t) - 1)
96
+ (mt) => Math.min(mt, Math.ceil(M.length / _t) - 1)
97
97
  );
98
98
  }
99
99
  });
100
100
  return x != null && x.current && t.observe(x.current), () => t.disconnect();
101
- }, [f, S]);
101
+ }, [p, D]);
102
102
  const k = () => {
103
- p.current && clearInterval(p.current), nt(!1);
103
+ v.current && clearInterval(v.current), nt(!1);
104
104
  }, q = () => {
105
105
  k(), u((t) => Math.min(t + 1, h - 1));
106
106
  }, T = () => {
107
107
  k(), u((t) => Math.max(t - 1, 0));
108
108
  }, pt = (t) => {
109
109
  k(), u(t);
110
- }, vt = () => w ? `translateX(-${d * w}px)` : "translateX(0px)", J = () => {
110
+ }, vt = () => w ? `translateX(-${d * w}px)` : "translateX(0px)", H = () => {
111
111
  u((t) => t >= h - 1 ? 0 : t + 1);
112
112
  };
113
- return E(() => (P && (p.current = setInterval(
114
- J,
115
- D * 1e3
113
+ return E(() => (L && (v.current = setInterval(
114
+ H,
115
+ W * 1e3
116
116
  )), () => {
117
- p.current && clearInterval(p.current);
118
- }), [P, D, J]), /* @__PURE__ */ A("div", { className: `${Q ?? ""} ${o.carousel}`, ref: ot, children: [
119
- /* @__PURE__ */ a(
117
+ v.current && clearInterval(v.current);
118
+ }), [L, W, H]), /* @__PURE__ */ A("div", { className: `${Q ?? ""} ${o.carousel}`, ref: ot, children: [
119
+ /* @__PURE__ */ r(
120
120
  "div",
121
121
  {
122
- ref: F,
123
- className: `${o.trackContainer} ${st || v ? o.noPointerEvents : ""}
122
+ ref: O,
123
+ className: `${o.trackContainer} ${st || _ ? o.noPointerEvents : ""}
124
124
  `,
125
125
  style: {
126
126
  maxWidth: `${w}px`,
127
- touchAction: v ? "none" : "pan-y"
127
+ touchAction: _ ? "none" : "pan-y"
128
128
  },
129
129
  onTouchStart: dt,
130
130
  onTouchEnd: ut,
131
- onMouseDown: at,
132
- onMouseMove: rt,
133
- onMouseUp: lt,
134
- onMouseLeave: it,
135
- children: /* @__PURE__ */ a(
131
+ onMouseDown: rt,
132
+ onMouseMove: at,
133
+ onMouseUp: it,
134
+ onMouseLeave: lt,
135
+ children: /* @__PURE__ */ r(
136
136
  "div",
137
137
  {
138
138
  ref: g,
139
139
  className: o.track,
140
140
  style: { width: `${h * 100}%`, transform: vt() },
141
- children: H.map((t, e) => /* @__PURE__ */ a(
141
+ children: F.map((t, e) => /* @__PURE__ */ r(
142
142
  "div",
143
143
  {
144
144
  className: o.page,
145
145
  style: {
146
146
  display: N > 1 ? "grid" : "flex",
147
147
  gridTemplateColumns: `repeat(${Math.ceil(
148
- b / N
148
+ f / N
149
149
  )}, 1fr)`,
150
150
  gridTemplateRows: `repeat(${N}, auto)`,
151
151
  width: `${w}px`
152
152
  },
153
- children: t.map((n, s) => /* @__PURE__ */ a(
153
+ children: t.map((n, s) => /* @__PURE__ */ r(
154
154
  "div",
155
155
  {
156
156
  onClickCapture: ct,
157
157
  style: {
158
- width: f ? `${w / W - 16}px` : "unset"
158
+ width: p ? `${w / f - 16}px` : "unset"
159
159
  },
160
160
  children: n
161
161
  },
@@ -173,10 +173,10 @@ function Pt({
173
173
  {
174
174
  className: o.controls,
175
175
  style: {
176
- maxWidth: L > 0 && l === 1 && !f ? `${L}px` : "unset"
176
+ maxWidth: S > 0 && i === 1 && !p ? `${S}px` : "unset"
177
177
  },
178
178
  children: [
179
- /* @__PURE__ */ a("div", { className: o.indicators, children: Array.from({ length: h }).map((t, e) => /* @__PURE__ */ a(
179
+ /* @__PURE__ */ r("div", { className: o.indicators, children: Array.from({ length: h }).map((t, e) => /* @__PURE__ */ r(
180
180
  "button",
181
181
  {
182
182
  className: `${o.indicator} ${e === d ? o.active : ""}`,
@@ -186,24 +186,24 @@ function Pt({
186
186
  e
187
187
  )) }),
188
188
  /* @__PURE__ */ A("div", { className: o.buttons, children: [
189
- /* @__PURE__ */ a(
189
+ /* @__PURE__ */ r(
190
190
  "button",
191
191
  {
192
192
  "aria-label": "Previous slide",
193
193
  className: `${o.prev} ${d === 0 ? o.disabled : ""}`,
194
194
  onClick: T,
195
195
  disabled: d === 0,
196
- children: /* @__PURE__ */ a(Mt, { size: 36 })
196
+ children: /* @__PURE__ */ r(Mt, { size: 36 })
197
197
  }
198
198
  ),
199
- /* @__PURE__ */ a(
199
+ /* @__PURE__ */ r(
200
200
  "button",
201
201
  {
202
202
  "aria-label": "Next slide",
203
203
  className: `${o.next} ${d >= h - 1 ? o.disabled : ""}`,
204
204
  onClick: q,
205
- disabled: d >= m.length - b,
206
- children: /* @__PURE__ */ a(bt, { size: 36 })
205
+ disabled: d >= M.length - f,
206
+ children: /* @__PURE__ */ r(bt, { size: 36 })
207
207
  }
208
208
  )
209
209
  ] })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "quirk-ui",
3
3
  "private": false,
4
- "version": "0.0.177",
4
+ "version": "0.0.179",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {