quirk-ui 0.0.40 → 0.0.42
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.
package/dist/assets/index31.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--card-width: 80%}.
|
|
1
|
+
:root{--card-width: 80%}._carousel_1eliz_5{position:relative;width:100%;overflow:hidden;box-sizing:border-box}._track_1eliz_12{display:flex;transition:transform .5s ease;will-change:transform}._page_1eliz_18{flex:0 0 auto;width:100%;padding:0 var(--spacing-md);box-sizing:border-box;padding:var(--spacing-md)}._slide_1eliz_26{flex:0 0 var(--card-width);padding:0 var(--spacing-md)}@media (min-width: 768px){._slide_1eliz_26{flex:0 0 calc(100% / 3)}}._controls_1eliz_38{display:flex;justify-content:space-between;align-items:center;margin-top:var(--spacing-md);padding:0 var(--spacing-md);width:100%}@media (max-width: 767px){._controls_1eliz_38{width:var(--card-width);margin-left:auto;margin-right:auto}}._indicators_1eliz_55{display:flex;flex-wrap:wrap;gap:var(--spacing-sm);max-width:125px}._indicator_1eliz_55{width:10px;height:10px;border-radius:50%;background-color:#e0e0e0;border:none;cursor:pointer;transition:background-color .3s}._indicator_1eliz_55._active_1eliz_72{background-color:var(--color-primary)}._buttons_1eliz_76{display:flex;gap:var(--spacing-md)}._prev_1eliz_81._disabled_1eliz_81,._next_1eliz_82._disabled_1eliz_81{opacity:.5;pointer-events:none}._buttons_1eliz_76 button:not(._disabled_1eliz_81):hover{background-color:var(--color-primary);color:#fff}._prev_1eliz_81,._next_1eliz_82{background-color:#e0e0e0;color:var(--color-text-primary);border:none;padding:var(--spacing-sm);cursor:pointer;transition:background-color .3s,color .3s;border-radius:50%;width:40px;height:40px}
|
|
@@ -1,41 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { d as
|
|
3
|
-
import { Carousel as
|
|
1
|
+
import { jsxs as t, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { d as o, i, r as a, g as n, s as c } from "../../vi.ClIskdbk-CZ8iFAMK.js";
|
|
3
|
+
import { Carousel as m } from "./index.js";
|
|
4
4
|
import "../../index-BBIdMcpm.js";
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/* @__PURE__ */ n("div", { children: "Slide 5" }, "5"),
|
|
11
|
-
/* @__PURE__ */ n("div", { children: "Slide 6" }, "6")
|
|
12
|
-
];
|
|
13
|
-
h("Carousel", () => {
|
|
5
|
+
const d = (e) => Array.from({ length: e }, (l, r) => /* @__PURE__ */ t("div", { "data-testid": "carousel-item", children: [
|
|
6
|
+
"Item ",
|
|
7
|
+
r + 1
|
|
8
|
+
] }, r));
|
|
9
|
+
o("Carousel", () => {
|
|
14
10
|
beforeEach(() => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const e =
|
|
23
|
-
|
|
24
|
-
}), s("advances to the next group on the next button click", () => {
|
|
25
|
-
window.innerWidth = 1024, window.dispatchEvent(new Event("resize")), a(/* @__PURE__ */ n(l, { items: c }));
|
|
26
|
-
const e = t.getByRole("list"), o = t.getByLabelText("Next slide");
|
|
27
|
-
i(e).toHaveStyle({ transform: "translateX(-0%)" }), r.click(o), i(e).toHaveStyle({ transform: "translateX(-100%)" });
|
|
28
|
-
}), s("does not advance past the last group if autoplay is false", () => {
|
|
29
|
-
window.innerWidth = 1024, window.dispatchEvent(new Event("resize")), a(/* @__PURE__ */ n(l, { items: c, autoPlay: !1 }));
|
|
30
|
-
const e = t.getByRole("list"), o = t.getByLabelText("Next slide");
|
|
31
|
-
r.click(o), i(e).toHaveStyle({ transform: "translateX(-100%)" }), r.click(o), i(e).toHaveStyle({ transform: "translateX(-100%)" });
|
|
32
|
-
}), s("advances to the previous group on the previous button click", () => {
|
|
33
|
-
window.innerWidth = 1024, window.dispatchEvent(new Event("resize")), a(/* @__PURE__ */ n(l, { items: c }));
|
|
34
|
-
const e = t.getByRole("list"), o = t.getByLabelText("Next slide"), v = t.getByLabelText("Previous slide");
|
|
35
|
-
r.click(o), i(e).toHaveStyle({ transform: "translateX(-100%)" }), r.click(v), i(e).toHaveStyle({ transform: "translateX(-0%)" });
|
|
36
|
-
}), s("centers the active card and shows cards peeking on mobile", () => {
|
|
37
|
-
window.innerWidth = 375, window.dispatchEvent(new Event("resize")), a(/* @__PURE__ */ n(l, { items: c }));
|
|
38
|
-
const e = t.getByRole("list"), o = t.getByLabelText("Next slide");
|
|
39
|
-
i(e).toHaveStyle({ transform: "translateX(calc(-0% + 10%))" }), r.click(o), i(e).toHaveStyle({ transform: "translateX(calc(-80% + 10%))" });
|
|
11
|
+
Object.defineProperty(window, "innerWidth", {
|
|
12
|
+
writable: !0,
|
|
13
|
+
configurable: !0,
|
|
14
|
+
value: 1024
|
|
15
|
+
// Desktop
|
|
16
|
+
}), window.dispatchEvent(new Event("resize"));
|
|
17
|
+
}), i("renders the correct number of items", () => {
|
|
18
|
+
const e = d(9);
|
|
19
|
+
a(/* @__PURE__ */ s(m, { items: e })), n(c.getAllByTestId("carousel-item")).toHaveLength(9);
|
|
40
20
|
});
|
|
41
21
|
});
|
|
@@ -1,92 +1,113 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { A as
|
|
4
|
-
import { A as
|
|
5
|
-
import '../../assets/index31.css';const
|
|
6
|
-
carousel:
|
|
7
|
-
track:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { jsxs as m, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useRef as E, useEffect as $ } from "react";
|
|
3
|
+
import { A as T } from "../../arrow-left-BIJvHwNQ.js";
|
|
4
|
+
import { A as j } from "../../arrow-right-QEwnX3Sk.js";
|
|
5
|
+
import '../../assets/index31.css';const L = "_carousel_1eliz_5", R = "_track_1eliz_12", W = "_page_1eliz_18", V = "_slide_1eliz_26", X = "_controls_1eliz_38", G = "_indicators_1eliz_55", q = "_indicator_1eliz_55", B = "_active_1eliz_72", D = "_buttons_1eliz_76", F = "_prev_1eliz_81", H = "_disabled_1eliz_81", J = "_next_1eliz_82", t = {
|
|
6
|
+
carousel: L,
|
|
7
|
+
track: R,
|
|
8
|
+
page: W,
|
|
9
|
+
slide: V,
|
|
10
|
+
controls: X,
|
|
11
|
+
indicators: G,
|
|
12
|
+
indicator: q,
|
|
13
|
+
active: B,
|
|
14
|
+
buttons: D,
|
|
15
|
+
prev: F,
|
|
16
|
+
disabled: H,
|
|
17
|
+
next: J
|
|
17
18
|
};
|
|
18
|
-
function
|
|
19
|
-
items:
|
|
19
|
+
function Z({
|
|
20
|
+
items: _,
|
|
21
|
+
itemsPerPage: f = 9,
|
|
22
|
+
itemsPerRow: v = 3,
|
|
20
23
|
autoPlay: r = !1,
|
|
21
|
-
autoPlayInterval:
|
|
22
|
-
className:
|
|
24
|
+
autoPlayInterval: b = 3e3,
|
|
25
|
+
className: w
|
|
23
26
|
}) {
|
|
24
|
-
const [i,
|
|
25
|
-
|
|
27
|
+
const [i, o] = p(0), [z, N] = p(1), [a, x] = p(!1), h = E(null), k = i === 0, A = i === _.length - 1, C = Math.ceil(f / v), g = ((e, s) => {
|
|
28
|
+
const d = [];
|
|
29
|
+
for (let c = 0; c < e.length; c += s)
|
|
30
|
+
d.push(e.slice(c, c + s));
|
|
31
|
+
return d;
|
|
32
|
+
})(_, a ? 1 : f), l = g.length;
|
|
33
|
+
$(() => {
|
|
26
34
|
const e = () => {
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
35
|
+
o(0);
|
|
36
|
+
const s = window.innerWidth < 768;
|
|
37
|
+
x(s), N(s ? 1 : 3);
|
|
30
38
|
};
|
|
31
39
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
32
40
|
}, []);
|
|
33
|
-
const
|
|
34
|
-
(r || !
|
|
35
|
-
|
|
36
|
-
);
|
|
37
|
-
},
|
|
38
|
-
(
|
|
39
|
-
}, x = (e) => {
|
|
40
|
-
l(e * s);
|
|
41
|
+
const u = () => {
|
|
42
|
+
(r || !A) && o((e) => Math.min(e + 1, l - 1));
|
|
43
|
+
}, I = () => {
|
|
44
|
+
(r || !k) && o((e) => Math.max(e - 1, 0));
|
|
45
|
+
}, M = (e) => {
|
|
46
|
+
o(e * z);
|
|
41
47
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}), [r,
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const e = 100 / s;
|
|
49
|
-
return `translateX(-${i * e}%)`;
|
|
50
|
-
};
|
|
51
|
-
return /* @__PURE__ */ u("div", { className: `${b ?? ""} ${t.carousel}`, children: [
|
|
52
|
-
/* @__PURE__ */ o(
|
|
48
|
+
$(() => (r && (h.current = setInterval(u, b)), () => {
|
|
49
|
+
h.current && clearInterval(h.current);
|
|
50
|
+
}), [r, b, u]);
|
|
51
|
+
const S = () => a ? `translateX(calc(-${i * 80}%))` : `translateX(-${i * 100 / l}%)`;
|
|
52
|
+
return /* @__PURE__ */ m("div", { className: `${w ?? ""} ${t.carousel}`, children: [
|
|
53
|
+
/* @__PURE__ */ n(
|
|
53
54
|
"div",
|
|
54
55
|
{
|
|
55
56
|
className: t.track,
|
|
56
|
-
style: {
|
|
57
|
+
style: {
|
|
58
|
+
width: a ? `${_.length * 80}%` : `${l * 100}%`,
|
|
59
|
+
transform: S()
|
|
60
|
+
},
|
|
57
61
|
role: "list",
|
|
58
|
-
children:
|
|
62
|
+
children: g.map((e, s) => /* @__PURE__ */ n(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
className: t.page,
|
|
66
|
+
style: a ? {
|
|
67
|
+
width: "var(--card-width)",
|
|
68
|
+
display: "flex",
|
|
69
|
+
justifyContent: "center"
|
|
70
|
+
} : {
|
|
71
|
+
width: `${100 / l}%`,
|
|
72
|
+
display: "grid",
|
|
73
|
+
gridTemplateColumns: `repeat(${v}, 1fr)`,
|
|
74
|
+
gridTemplateRows: `repeat(${C}, auto)`
|
|
75
|
+
},
|
|
76
|
+
children: e.map((d, c) => /* @__PURE__ */ n("div", { className: t.slide, children: d }, c))
|
|
77
|
+
},
|
|
78
|
+
s
|
|
79
|
+
))
|
|
59
80
|
}
|
|
60
81
|
),
|
|
61
|
-
|
|
62
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ m("div", { className: t.controls, children: [
|
|
83
|
+
/* @__PURE__ */ n("div", { className: t.indicators, children: Array.from({ length: l }).map((e, s) => /* @__PURE__ */ n(
|
|
63
84
|
"button",
|
|
64
85
|
{
|
|
65
|
-
className: `${t.indicator} ${
|
|
66
|
-
onClick: () =>
|
|
67
|
-
"aria-label": `Go to group ${
|
|
86
|
+
className: `${t.indicator} ${s === i ? t.active : ""}`,
|
|
87
|
+
onClick: () => M(s),
|
|
88
|
+
"aria-label": `Go to group ${s + 1}`
|
|
68
89
|
},
|
|
69
|
-
|
|
90
|
+
s
|
|
70
91
|
)) }),
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
/* @__PURE__ */
|
|
92
|
+
/* @__PURE__ */ m("div", { className: t.buttons, children: [
|
|
93
|
+
/* @__PURE__ */ n(
|
|
73
94
|
"button",
|
|
74
95
|
{
|
|
75
96
|
className: `${t.prev} ${!r && i === 0 ? t.disabled : ""}`,
|
|
76
|
-
onClick:
|
|
97
|
+
onClick: I,
|
|
77
98
|
"aria-label": "Previous slide",
|
|
78
99
|
disabled: !r && i === 0,
|
|
79
|
-
children: /* @__PURE__ */
|
|
100
|
+
children: /* @__PURE__ */ n(T, {})
|
|
80
101
|
}
|
|
81
102
|
),
|
|
82
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ n(
|
|
83
104
|
"button",
|
|
84
105
|
{
|
|
85
|
-
className: `${t.next} ${!r && i
|
|
86
|
-
onClick:
|
|
106
|
+
className: `${t.next} ${!r && i === l - 1 ? t.disabled : ""}`,
|
|
107
|
+
onClick: u,
|
|
87
108
|
"aria-label": "Next slide",
|
|
88
|
-
disabled: !r && i
|
|
89
|
-
children: /* @__PURE__ */
|
|
109
|
+
disabled: !r && i === l - 1,
|
|
110
|
+
children: /* @__PURE__ */ n(j, {})
|
|
90
111
|
}
|
|
91
112
|
)
|
|
92
113
|
] })
|
|
@@ -94,5 +115,5 @@ function H({
|
|
|
94
115
|
] });
|
|
95
116
|
}
|
|
96
117
|
export {
|
|
97
|
-
|
|
118
|
+
Z as Carousel
|
|
98
119
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
type CarouselProps = {
|
|
3
3
|
items: React.ReactNode[];
|
|
4
|
+
itemsPerPage?: number;
|
|
5
|
+
itemsPerRow?: number;
|
|
4
6
|
autoPlay?: boolean;
|
|
5
7
|
autoPlayInterval?: number;
|
|
6
8
|
className?: string;
|
|
7
9
|
};
|
|
8
|
-
export declare function Carousel({ items, autoPlay, autoPlayInterval, className, }: CarouselProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function Carousel({ items, itemsPerPage, itemsPerRow, autoPlay, autoPlayInterval, className, }: CarouselProps): import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
export {};
|
package/dist/styles.css
CHANGED
|
@@ -28,7 +28,7 @@ ul._list_4w9h5_1{list-style-type:none;padding:0;margin:0}ol._list_4w9h5_1{list-s
|
|
|
28
28
|
._notification_1txoc_1{display:flex;align-items:center;padding:var(--spacing-md);background-color:var(--color-secondary);color:var(--color-text-primaray);box-shadow:0 4px 8px #0000001a;border-radius:var(--radius-md);font-size:var(--font-size-md);font-weight:var(--font-weight-semibold);gap:var(--spacing-sm);animation:_slideIn_1txoc_1 .3s ease forwards;opacity:1;transform-origin:right center;width:fit-content}._enter_1txoc_18{opacity:1;transform:translate(0)}._exiting_1txoc_23{animation:_slideOut_1txoc_1 .3s ease forwards}._info_1txoc_27{background-color:var(--color-info-bg);color:var(--color-info-text)}._success_1txoc_32{background-color:var(--color-success-bg);color:var(--color-success-text)}._warning_1txoc_37{background-color:var(--color-warning-bg);color:var(--color-warning-text)}._error_1txoc_42{background-color:var(--color-error-bg);color:var(--color-error-text)}._closeButton_1txoc_47{background:none;border:none;cursor:pointer;color:#fff;padding:0;margin-left:auto;display:flex;align-items:center}@keyframes _slideIn_1txoc_1{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}@keyframes _slideOut_1txoc_1{0%{transform:translate(0);opacity:1}to{transform:translate(100%);opacity:0}}
|
|
29
29
|
._container_61msx_1{position:fixed;bottom:1rem;right:1rem;display:flex;flex-direction:column;justify-content:flex-end;align-items:flex-end;gap:.5rem;z-index:1000}
|
|
30
30
|
._progressBarContainer_a1m8u_1{display:flex;align-items:center;justify-content:center;gap:.25rem;width:100%}._progressBar_a1m8u_1{flex:1;height:12px;background-color:#f0f0f0;border-radius:4px;overflow:hidden;position:relative}._fill_a1m8u_18{height:100%;transition:width .3s ease;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:700;border-radius:4px}._primary_a1m8u_29 ._fill_a1m8u_18{background-color:var(--color-primary)}._success_a1m8u_33 ._fill_a1m8u_18{background-color:var(--color-success)}._warning_a1m8u_37 ._fill_a1m8u_18{background-color:var(--color-warning)}._danger_a1m8u_41 ._fill_a1m8u_18{background-color:var(--color-error)}._label_a1m8u_45{flex:.1;position:relative;width:auto;text-align:center;color:var(--color-text-primary);font-size:var(--font-size-xs);font-weight:var(--font-weight-semibold)}
|
|
31
|
-
:root{--card-width: 80%}.
|
|
31
|
+
:root{--card-width: 80%}._carousel_1eliz_5{position:relative;width:100%;overflow:hidden;box-sizing:border-box}._track_1eliz_12{display:flex;transition:transform .5s ease;will-change:transform}._page_1eliz_18{flex:0 0 auto;width:100%;padding:0 var(--spacing-md);box-sizing:border-box;padding:var(--spacing-md)}._slide_1eliz_26{flex:0 0 var(--card-width);padding:0 var(--spacing-md)}@media (min-width: 768px){._slide_1eliz_26{flex:0 0 calc(100% / 3)}}._controls_1eliz_38{display:flex;justify-content:space-between;align-items:center;margin-top:var(--spacing-md);padding:0 var(--spacing-md);width:100%}@media (max-width: 767px){._controls_1eliz_38{width:var(--card-width);margin-left:auto;margin-right:auto}}._indicators_1eliz_55{display:flex;flex-wrap:wrap;gap:var(--spacing-sm);max-width:125px}._indicator_1eliz_55{width:10px;height:10px;border-radius:50%;background-color:#e0e0e0;border:none;cursor:pointer;transition:background-color .3s}._indicator_1eliz_55._active_1eliz_72{background-color:var(--color-primary)}._buttons_1eliz_76{display:flex;gap:var(--spacing-md)}._prev_1eliz_81._disabled_1eliz_81,._next_1eliz_82._disabled_1eliz_81{opacity:.5;pointer-events:none}._buttons_1eliz_76 button:not(._disabled_1eliz_81):hover{background-color:var(--color-primary);color:#fff}._prev_1eliz_81,._next_1eliz_82{background-color:#e0e0e0;color:var(--color-text-primary);border:none;padding:var(--spacing-sm);cursor:pointer;transition:background-color .3s,color .3s;border-radius:50%;width:40px;height:40px}
|
|
32
32
|
._drawer_55xty_1{position:fixed;background-color:var(--color-background);transition:transform .3s ease-in-out;z-index:1000;width:300px;height:100%;box-shadow:0 0 10px #00000026;padding:var(--spacing-md)}._right_55xty_12{top:0;right:0;transform:translate(100%)}._left_55xty_18{top:0;left:0;transform:translate(-100%)}._top_55xty_24{top:0;left:0;width:100%;height:auto;transform:translateY(-100%)}._bottom_55xty_32{bottom:0;left:0;width:100%;height:auto;transform:translateY(100%)}._open_55xty_40._right_55xty_12,._open_55xty_40._left_55xty_18{transform:translate(0)}._open_55xty_40._top_55xty_24,._open_55xty_40._bottom_55xty_32{transform:translateY(0)}._overlay_55xty_50{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#0000004d;opacity:0;pointer-events:none;transition:opacity .3s ease-in-out;z-index:999}._overlay_55xty_50._show_55xty_60{opacity:1;pointer-events:all}
|
|
33
33
|
._tabs_f06du_1{display:flex;flex-direction:column;width:100%}._tabsList_f06du_7{display:flex;border-bottom:2px solid var(--color-border)}._left_f06du_12{justify-content:flex-start}._center_f06du_16{justify-content:center}._right_f06du_20{justify-content:flex-end}._tabsTrigger_f06du_24{padding:var(--spacing-md);border:none;border-bottom:2px solid transparent;background:none;cursor:pointer;color:var(--color-muted);font-weight:var(--font-weight-semibold);font-size:var(--font-size-md);transition:color .3s ease,border-color .3s ease;position:relative;top:2px}._tabsTrigger_f06du_24._active_f06du_38{border-color:var(--color-primary);color:var(--color-primary)}._tabsPanelWrapper_f06du_43{position:relative;min-height:100px}._tabsPanel_f06du_43{animation:_fadeSlide_f06du_1 .3s ease both;position:absolute;width:100%;top:0;left:0;padding:var(--spacing-md);color:var(--color-text-primary)}@keyframes _fadeSlide_f06du_1{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
|
|
34
34
|
._breadcrumbs_1nbgu_1{display:block;font-size:var(--font-size-sm);line-height:1.5}._list_1nbgu_7{display:flex;flex-wrap:wrap;list-style:none;padding:0;margin:0}._item_1nbgu_15{display:flex;align-items:center}._separator_1nbgu_20{margin:0 var(--spacing-xs);color:var(--color-muted)}._link_1nbgu_25{color:var(--color-muted);text-decoration:none;transition:color .3s ease}._link_1nbgu_25:hover{color:var(--color-primary)}._label_1nbgu_35{color:var(--color-muted)}._active_1nbgu_39{font-weight:var(--font-weight-bold);color:var(--color-primary)}
|