@dgshahr/ui-kit 0.0.22 → 0.0.23
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/{Slide-BOiA1lJh.js → Slide-CQBJqAor.js} +101 -104
- package/dist/Slide-DAapDHVY.cjs +1 -0
- package/dist/Slider/Slide.d.ts.map +1 -1
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/index.cjs +1 -1
- package/dist/Slider/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/Slide-CTeuUKkl.cjs +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as r, jsxs as
|
|
3
|
-
import { c as
|
|
4
|
-
import { createContext as
|
|
2
|
+
import { jsx as r, jsxs as y, Fragment as D } from "react/jsx-runtime";
|
|
3
|
+
import { c as v } from "./clsx-OuTLNxxd.js";
|
|
4
|
+
import { createContext as M, useContext as R, useState as N, useEffect as x, useRef as T } from "react";
|
|
5
5
|
import { A as O } from "./ArrowLeft2-jP2w1vwt.js";
|
|
6
|
-
import { A as
|
|
7
|
-
import
|
|
8
|
-
const
|
|
6
|
+
import { A as V } from "./ArrowRight2-CcHdxGRE.js";
|
|
7
|
+
import S from "./Button/index.js";
|
|
8
|
+
const P = M({
|
|
9
9
|
slidesPerView: 1,
|
|
10
10
|
spaceBetween: 0,
|
|
11
11
|
navigationVariant: "outside",
|
|
12
12
|
showNavigationDots: !0,
|
|
13
13
|
showPaginationText: !1
|
|
14
|
-
}),
|
|
15
|
-
function
|
|
14
|
+
}), C = () => R(P);
|
|
15
|
+
function E({
|
|
16
16
|
active: e,
|
|
17
17
|
autoplay: i,
|
|
18
18
|
variant: s = "outside"
|
|
@@ -26,67 +26,67 @@ function K({
|
|
|
26
26
|
i ? "dgs-ui-kit-p-[1px]" : ""
|
|
27
27
|
];
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
const { active: i, onClick: s, onNavigateToNext: n } = e, { autoplay: t, navigationVariant:
|
|
31
|
-
return
|
|
29
|
+
const F = (e) => {
|
|
30
|
+
const { active: i, onClick: s, onNavigateToNext: n } = e, { autoplay: t, navigationVariant: u = "outside" } = C(), [l, o] = N(0);
|
|
31
|
+
return x(() => {
|
|
32
32
|
if (!i || !t) return;
|
|
33
33
|
const c = typeof t == "boolean" ? 7e3 : t?.delay ?? 7e3;
|
|
34
34
|
let a = Date.now();
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
o(Math.min(
|
|
35
|
+
const g = setInterval(() => {
|
|
36
|
+
const h = Date.now() - a, f = h / c * 100;
|
|
37
|
+
o(Math.min(f, 100)), h >= c && typeof n == "function" && n();
|
|
38
38
|
}, 100);
|
|
39
39
|
return function() {
|
|
40
|
-
return o(0), a = Date.now(), clearInterval(
|
|
40
|
+
return o(0), a = Date.now(), clearInterval(g);
|
|
41
41
|
};
|
|
42
42
|
}, [i, t, n]), /* @__PURE__ */ r(
|
|
43
43
|
"button",
|
|
44
44
|
{
|
|
45
|
-
className:
|
|
45
|
+
className: v(
|
|
46
46
|
"dgs-ui-kit-rounded-full dgs-ui-kit-overflow-hidden dgs-ui-kit-transition-all dgs-ui-kit-h-[6px]",
|
|
47
|
-
|
|
47
|
+
E({ active: i, autoplay: t, variant: u })
|
|
48
48
|
),
|
|
49
49
|
onClick: s,
|
|
50
50
|
children: i && /* @__PURE__ */ r(
|
|
51
51
|
"div",
|
|
52
52
|
{
|
|
53
|
-
className:
|
|
54
|
-
"dgs-ui-kit-bg-white":
|
|
55
|
-
"dgs-ui-kit-bg-gray-700":
|
|
53
|
+
className: v("dgs-ui-kit-h-full dgs-ui-kit-rounded-full", {
|
|
54
|
+
"dgs-ui-kit-bg-white": u === "inside",
|
|
55
|
+
"dgs-ui-kit-bg-gray-700": u === "outside"
|
|
56
56
|
}),
|
|
57
|
-
style: { width: t ? `${
|
|
57
|
+
style: { width: t ? `${l}%` : "100%" }
|
|
58
58
|
}
|
|
59
59
|
)
|
|
60
60
|
}
|
|
61
61
|
);
|
|
62
|
-
},
|
|
62
|
+
}, K = (e) => {
|
|
63
63
|
const { onNavigate: i, slideIndex: s, slidesCount: n } = e, {
|
|
64
64
|
navigationButtonsShowType: t = "hide",
|
|
65
|
-
dotsClassName:
|
|
66
|
-
navigationContainerClassName:
|
|
65
|
+
dotsClassName: u,
|
|
66
|
+
navigationContainerClassName: l,
|
|
67
67
|
navigationVariant: o = "outside",
|
|
68
68
|
showNavigationDots: c = !0,
|
|
69
69
|
showPaginationText: a
|
|
70
|
-
} =
|
|
70
|
+
} = C(), g = /* @__PURE__ */ y(
|
|
71
71
|
"div",
|
|
72
72
|
{
|
|
73
|
-
className:
|
|
73
|
+
className: v("dgs-ui-kit-flex dgs-ui-kit-gap-2", {
|
|
74
74
|
"dgs-ui-kit-absolute dgs-ui-kit-bottom-0 dgs-ui-kit-left-[5.5%]": o === "inside" && t !== "onSides",
|
|
75
75
|
"dgs-ui-kit-absolute dgs-ui-kit-justify-between dgs-ui-kit-top-1/2 -dgs-ui-kit-translate-y-1/2 dgs-ui-kit-w-full dgs-ui-kit-px-[5.5%]": t === "onSides",
|
|
76
76
|
"dgs-ui-kit-opacity-0 group-hover:dgs-ui-kit-opacity-100 dgs-ui-kit-transition": t === "hover" || t === "onSides"
|
|
77
77
|
}),
|
|
78
78
|
children: [
|
|
79
79
|
/* @__PURE__ */ r(
|
|
80
|
-
|
|
80
|
+
S,
|
|
81
81
|
{
|
|
82
82
|
type: "button",
|
|
83
83
|
variant: "secondary",
|
|
84
84
|
onClick: () => i(s - 1),
|
|
85
|
-
rightIcon: /* @__PURE__ */ r(
|
|
85
|
+
rightIcon: /* @__PURE__ */ r(V, {})
|
|
86
86
|
}
|
|
87
87
|
),
|
|
88
88
|
/* @__PURE__ */ r(
|
|
89
|
-
|
|
89
|
+
S,
|
|
90
90
|
{
|
|
91
91
|
type: "button",
|
|
92
92
|
variant: "secondary",
|
|
@@ -97,12 +97,12 @@ const z = (e) => {
|
|
|
97
97
|
]
|
|
98
98
|
}
|
|
99
99
|
);
|
|
100
|
-
return /* @__PURE__ */
|
|
101
|
-
t && t !== "hide" && t === "onSides" &&
|
|
102
|
-
/* @__PURE__ */
|
|
100
|
+
return /* @__PURE__ */ y(D, { children: [
|
|
101
|
+
t && t !== "hide" && t === "onSides" && g,
|
|
102
|
+
/* @__PURE__ */ y(
|
|
103
103
|
"div",
|
|
104
104
|
{
|
|
105
|
-
className:
|
|
105
|
+
className: v(
|
|
106
106
|
"dgs-ui-kit-flex",
|
|
107
107
|
{
|
|
108
108
|
"dgs-ui-kit-items-center dgs-ui-kit-mt-2": o === "outside",
|
|
@@ -110,16 +110,16 @@ const z = (e) => {
|
|
|
110
110
|
"dgs-ui-kit-justify-between": o === "outside" && t !== "hide" && t !== "onSides",
|
|
111
111
|
"dgs-ui-kit-justify-center": o === "outside" && (t === "hide" || t === "onSides")
|
|
112
112
|
},
|
|
113
|
-
|
|
113
|
+
l
|
|
114
114
|
),
|
|
115
115
|
children: [
|
|
116
|
-
t && t !== "hide" && t !== "onSides" &&
|
|
117
|
-
(c || a) && /* @__PURE__ */
|
|
118
|
-
a && /* @__PURE__ */
|
|
116
|
+
t && t !== "hide" && t !== "onSides" && g,
|
|
117
|
+
(c || a) && /* @__PURE__ */ y("div", { className: "dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-gap-3", children: [
|
|
118
|
+
a && /* @__PURE__ */ y("div", { className: "dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-gap-1 dgs-ui-kit-font-caption-regular dgs-ui-kit-text-gray-400 ss02", children: [
|
|
119
119
|
/* @__PURE__ */ r(
|
|
120
120
|
"span",
|
|
121
121
|
{
|
|
122
|
-
className:
|
|
122
|
+
className: v("dgs-ui-kit-font-bold", {
|
|
123
123
|
"dgs-ui-kit-text-gray-600": o === "outside",
|
|
124
124
|
"dgs-ui-kit-text-white": o === "inside"
|
|
125
125
|
}),
|
|
@@ -132,18 +132,18 @@ const z = (e) => {
|
|
|
132
132
|
c && /* @__PURE__ */ r(
|
|
133
133
|
"div",
|
|
134
134
|
{
|
|
135
|
-
className:
|
|
135
|
+
className: v(
|
|
136
136
|
"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-justify-center dgs-ui-kit-gap-2",
|
|
137
|
-
|
|
137
|
+
u
|
|
138
138
|
),
|
|
139
|
-
children: Array.from(Array(n).keys()).map((
|
|
140
|
-
|
|
139
|
+
children: Array.from(Array(n).keys()).map((h, f) => /* @__PURE__ */ r(
|
|
140
|
+
F,
|
|
141
141
|
{
|
|
142
|
-
active: s ===
|
|
143
|
-
onClick: () => i(
|
|
142
|
+
active: s === f,
|
|
143
|
+
onClick: () => i(f),
|
|
144
144
|
onNavigateToNext: () => i(s + 1)
|
|
145
145
|
},
|
|
146
|
-
|
|
146
|
+
h + n
|
|
147
147
|
))
|
|
148
148
|
}
|
|
149
149
|
)
|
|
@@ -152,56 +152,52 @@ const z = (e) => {
|
|
|
152
152
|
}
|
|
153
153
|
)
|
|
154
154
|
] });
|
|
155
|
-
},
|
|
156
|
-
const [i, s] = N(0), [n, t] = N(e), [
|
|
155
|
+
}, Q = (e) => {
|
|
156
|
+
const [i, s] = N(0), [n, t] = N(e), [u, l] = N(0), {
|
|
157
157
|
className: o = "",
|
|
158
158
|
containerClassName: c = "",
|
|
159
159
|
showNavigationDots: a = !0,
|
|
160
|
-
slidesPerView:
|
|
161
|
-
navigationButtonsShowType:
|
|
162
|
-
spaceBetween:
|
|
163
|
-
showPaginationText:
|
|
164
|
-
} = n,
|
|
160
|
+
slidesPerView: g = 1,
|
|
161
|
+
navigationButtonsShowType: h = "hide",
|
|
162
|
+
spaceBetween: f = 0,
|
|
163
|
+
showPaginationText: j
|
|
164
|
+
} = n, I = Object.fromEntries(
|
|
165
165
|
Object.entries(n).filter(([d]) => d !== "children")
|
|
166
|
-
),
|
|
167
|
-
function
|
|
166
|
+
), k = T(null), m = Math.ceil(u / Math.floor(g)), A = (a || h && h !== "hide" || j) && m > 1;
|
|
167
|
+
function B(d) {
|
|
168
168
|
if (Math.ceil(Math.abs(d.currentTarget.scrollLeft)) + d.currentTarget.clientWidth === d.currentTarget.scrollWidth) {
|
|
169
|
-
s(
|
|
169
|
+
s(m - 1);
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
172
|
-
const
|
|
173
|
-
if (
|
|
172
|
+
const p = d.currentTarget.scrollWidth / m, w = (d.currentTarget.scrollWidth - d.currentTarget.scrollLeft) / p;
|
|
173
|
+
if (w <= m) {
|
|
174
174
|
s(0);
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
|
-
s(Math.round(
|
|
177
|
+
s(Math.round(w % m));
|
|
178
178
|
}
|
|
179
|
-
function
|
|
180
|
-
if (!
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
d < 0 ? S = -(x * v) : d >= v && (S = 0), m.current.scrollTo({
|
|
184
|
-
left: S,
|
|
185
|
-
behavior: "smooth"
|
|
186
|
-
});
|
|
179
|
+
function L(d) {
|
|
180
|
+
if (!k.current) return;
|
|
181
|
+
const p = k.current.offsetWidth;
|
|
182
|
+
d < 0 ? k.current.scrollTo({ behavior: "smooth", left: -(p * m) }) : d >= m ? k.current.scrollTo({ behavior: "smooth", left: 0 }) : i > d ? k.current.scrollBy({ behavior: "smooth", left: p }) : k.current.scrollBy({ behavior: "smooth", left: -p });
|
|
187
183
|
}
|
|
188
|
-
function
|
|
189
|
-
const
|
|
190
|
-
(
|
|
191
|
-
),
|
|
192
|
-
t(
|
|
184
|
+
function b() {
|
|
185
|
+
const p = Object.keys(e.responsive).sort().findLast(
|
|
186
|
+
(W) => Number(W) <= window.innerWidth
|
|
187
|
+
), w = p ? e.responsive[Number(p)] : null;
|
|
188
|
+
t(w ? { ...n, ...w } : e);
|
|
193
189
|
}
|
|
194
|
-
return
|
|
195
|
-
|
|
196
|
-
}, [e.children]),
|
|
190
|
+
return x(() => {
|
|
191
|
+
k.current && l(k.current.childNodes.length);
|
|
192
|
+
}, [e.children]), x(() => {
|
|
197
193
|
if (!(!e.responsive || Object.keys(e.responsive).length <= 0))
|
|
198
|
-
return
|
|
199
|
-
window.removeEventListener("resize",
|
|
194
|
+
return b(), window.addEventListener("resize", b), () => {
|
|
195
|
+
window.removeEventListener("resize", b);
|
|
200
196
|
};
|
|
201
|
-
}, [e.responsive]), /* @__PURE__ */ r(
|
|
197
|
+
}, [e.responsive]), /* @__PURE__ */ r(P.Provider, { value: I, children: /* @__PURE__ */ y(
|
|
202
198
|
"div",
|
|
203
199
|
{
|
|
204
|
-
className:
|
|
200
|
+
className: v(
|
|
205
201
|
"dgs-ui-kit-overflow-hidden dgs-ui-kit-relative dgs-ui-kit-group",
|
|
206
202
|
o
|
|
207
203
|
),
|
|
@@ -210,60 +206,61 @@ const z = (e) => {
|
|
|
210
206
|
/* @__PURE__ */ r(
|
|
211
207
|
"div",
|
|
212
208
|
{
|
|
213
|
-
className:
|
|
209
|
+
className: v(
|
|
214
210
|
"dgs-ui-kit-flex dgs-ui-kit-snap-x dgs-ui-kit-snap-mandatory dgs-ui-kit-overflow-x-auto no-scrollbar",
|
|
215
211
|
c
|
|
216
212
|
),
|
|
217
|
-
style: { marginLeft: -
|
|
218
|
-
onScroll:
|
|
219
|
-
ref:
|
|
213
|
+
style: { marginLeft: -f },
|
|
214
|
+
onScroll: B,
|
|
215
|
+
ref: k,
|
|
220
216
|
children: e.children
|
|
221
217
|
}
|
|
222
218
|
),
|
|
223
219
|
A && /* @__PURE__ */ r(
|
|
224
|
-
|
|
220
|
+
K,
|
|
225
221
|
{
|
|
226
|
-
onNavigate:
|
|
222
|
+
onNavigate: L,
|
|
227
223
|
slideIndex: i,
|
|
228
|
-
slidesCount:
|
|
224
|
+
slidesCount: m
|
|
229
225
|
}
|
|
230
226
|
)
|
|
231
227
|
]
|
|
232
228
|
}
|
|
233
229
|
) });
|
|
234
230
|
};
|
|
235
|
-
function
|
|
231
|
+
function z({
|
|
236
232
|
slidesPerView: e,
|
|
237
233
|
childIndex: i,
|
|
238
234
|
centerMode: s,
|
|
239
|
-
|
|
235
|
+
childrenCount: n
|
|
240
236
|
}) {
|
|
241
|
-
|
|
237
|
+
const t = i % Math.floor(e) === 0, u = e % 1 !== 0, l = i === 0, o = i === n - 1;
|
|
238
|
+
return t ? s && u ? l ? "start" : o ? "end" : "center" : "start" : "none";
|
|
242
239
|
}
|
|
243
|
-
const
|
|
240
|
+
const U = (e) => {
|
|
244
241
|
const { children: i, className: s, style: n, ...t } = e, {
|
|
245
|
-
slidesPerView:
|
|
246
|
-
spaceBetween:
|
|
242
|
+
slidesPerView: u = 1,
|
|
243
|
+
spaceBetween: l = 0,
|
|
247
244
|
centerMode: o = !1,
|
|
248
245
|
containerXPadding: c = 0
|
|
249
|
-
} =
|
|
250
|
-
return
|
|
251
|
-
a.current &&
|
|
246
|
+
} = C(), a = T(null), [g, h] = N(0), f = a.current?.parentNode?.children.length;
|
|
247
|
+
return x(() => {
|
|
248
|
+
a.current && h(Array.prototype.indexOf.call(a.current.parentNode?.children, a.current));
|
|
252
249
|
}, [a]), /* @__PURE__ */ r(
|
|
253
250
|
"div",
|
|
254
251
|
{
|
|
255
252
|
...t,
|
|
256
253
|
ref: a,
|
|
257
|
-
className:
|
|
254
|
+
className: v("dgs-ui-kit-shrink-0 dgs-ui-kit-snap-always", s),
|
|
258
255
|
style: {
|
|
259
|
-
width: 100 / (
|
|
260
|
-
paddingLeft:
|
|
261
|
-
paddingRight:
|
|
262
|
-
scrollSnapAlign:
|
|
263
|
-
slidesPerView:
|
|
264
|
-
childIndex:
|
|
256
|
+
width: 100 / (u ?? 1) + "%",
|
|
257
|
+
paddingLeft: f && g === f - 1 ? c + l : l,
|
|
258
|
+
paddingRight: g === 0 ? c : 0,
|
|
259
|
+
scrollSnapAlign: z({
|
|
260
|
+
slidesPerView: u,
|
|
261
|
+
childIndex: g,
|
|
265
262
|
centerMode: o,
|
|
266
|
-
|
|
263
|
+
childrenCount: f || 0
|
|
267
264
|
}),
|
|
268
265
|
...n
|
|
269
266
|
},
|
|
@@ -272,6 +269,6 @@ const Y = (e) => {
|
|
|
272
269
|
);
|
|
273
270
|
};
|
|
274
271
|
export {
|
|
275
|
-
|
|
276
|
-
|
|
272
|
+
Q as S,
|
|
273
|
+
U as a
|
|
277
274
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";const e=require("react/jsx-runtime"),x=require("./clsx-C11secjj.cjs"),u=require("react"),L=require("./ArrowLeft2-B76dkC-C.cjs"),A=require("./ArrowRight2-CYowPzS8.cjs"),j=require("./Button/index.cjs"),b=u.createContext({slidesPerView:1,spaceBetween:0,navigationVariant:"outside",showNavigationDots:!0,showPaginationText:!1}),N=()=>u.useContext(b);function B({active:i,autoplay:s,variant:n="outside"}){return[{inside:"dgs-ui-kit-bg-gray-500/50 hover:dgs-ui-kit-bg-gray-500/80",outside:"dgs-ui-kit-bg-gray-200 hover:dgs-ui-kit-bg-gray-300"}[n],i?"dgs-ui-kit-w-[22px]":"dgs-ui-kit-w-[6px]",s?"dgs-ui-kit-p-[1px]":""]}const W=i=>{const{active:s,onClick:n,onNavigateToNext:r}=i,{autoplay:t,navigationVariant:l="outside"}=N(),[c,o]=u.useState(0);return u.useEffect(()=>{if(!s||!t)return;const g=typeof t=="boolean"?7e3:t?.delay??7e3;let a=Date.now();const h=setInterval(()=>{const f=Date.now()-a,k=f/g*100;o(Math.min(k,100)),f>=g&&typeof r=="function"&&r()},100);return function(){return o(0),a=Date.now(),clearInterval(h)}},[s,t,r]),e.jsx("button",{className:x.clsx("dgs-ui-kit-rounded-full dgs-ui-kit-overflow-hidden dgs-ui-kit-transition-all dgs-ui-kit-h-[6px]",B({active:s,autoplay:t,variant:l})),onClick:n,children:s&&e.jsx("div",{className:x.clsx("dgs-ui-kit-h-full dgs-ui-kit-rounded-full",{"dgs-ui-kit-bg-white":l==="inside","dgs-ui-kit-bg-gray-700":l==="outside"}),style:{width:t?`${c}%`:"100%"}})})},D=i=>{const{onNavigate:s,slideIndex:n,slidesCount:r}=i,{navigationButtonsShowType:t="hide",dotsClassName:l,navigationContainerClassName:c,navigationVariant:o="outside",showNavigationDots:g=!0,showPaginationText:a}=N(),h=e.jsxs("div",{className:x.clsx("dgs-ui-kit-flex dgs-ui-kit-gap-2",{"dgs-ui-kit-absolute dgs-ui-kit-bottom-0 dgs-ui-kit-left-[5.5%]":o==="inside"&&t!=="onSides","dgs-ui-kit-absolute dgs-ui-kit-justify-between dgs-ui-kit-top-1/2 -dgs-ui-kit-translate-y-1/2 dgs-ui-kit-w-full dgs-ui-kit-px-[5.5%]":t==="onSides","dgs-ui-kit-opacity-0 group-hover:dgs-ui-kit-opacity-100 dgs-ui-kit-transition":t==="hover"||t==="onSides"}),children:[e.jsx(j,{type:"button",variant:"secondary",onClick:()=>s(n-1),rightIcon:e.jsx(A.ArrowRight2Icon,{})}),e.jsx(j,{type:"button",variant:"secondary",onClick:()=>s(n+1),rightIcon:e.jsx(L.ArrowLeft2Icon,{})})]});return e.jsxs(e.Fragment,{children:[t&&t!=="hide"&&t==="onSides"&&h,e.jsxs("div",{className:x.clsx("dgs-ui-kit-flex",{"dgs-ui-kit-items-center dgs-ui-kit-mt-2":o==="outside","dgs-ui-kit-absolute dgs-ui-kit-bottom-4 dgs-ui-kit-w-full dgs-ui-kit-justify-center":o==="inside","dgs-ui-kit-justify-between":o==="outside"&&t!=="hide"&&t!=="onSides","dgs-ui-kit-justify-center":o==="outside"&&(t==="hide"||t==="onSides")},c),children:[t&&t!=="hide"&&t!=="onSides"&&h,(g||a)&&e.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-gap-3",children:[a&&e.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-gap-1 dgs-ui-kit-font-caption-regular dgs-ui-kit-text-gray-400 ss02",children:[e.jsx("span",{className:x.clsx("dgs-ui-kit-font-bold",{"dgs-ui-kit-text-gray-600":o==="outside","dgs-ui-kit-text-white":o==="inside"}),children:n+1}),e.jsx("span",{children:"از"}),e.jsx("span",{children:r})]}),g&&e.jsx("div",{className:x.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-justify-center dgs-ui-kit-gap-2",l),children:Array.from(Array(r).keys()).map((f,k)=>e.jsx(W,{active:n===k,onClick:()=>s(k),onNavigateToNext:()=>s(n+1)},f+r))})]})]})]})},M=i=>{const[s,n]=u.useState(0),[r,t]=u.useState(i),[l,c]=u.useState(0),{className:o="",containerClassName:g="",showNavigationDots:a=!0,slidesPerView:h=1,navigationButtonsShowType:f="hide",spaceBetween:k=0,showPaginationText:C}=r,S=Object.fromEntries(Object.entries(r).filter(([d])=>d!=="children")),v=u.useRef(null),y=Math.ceil(l/Math.floor(h)),T=(a||f&&f!=="hide"||C)&&y>1;function P(d){if(Math.ceil(Math.abs(d.currentTarget.scrollLeft))+d.currentTarget.clientWidth===d.currentTarget.scrollWidth){n(y-1);return}const p=d.currentTarget.scrollWidth/y,m=(d.currentTarget.scrollWidth-d.currentTarget.scrollLeft)/p;if(m<=y){n(0);return}n(Math.round(m%y))}function R(d){if(!v.current)return;const p=v.current.offsetWidth;d<0?v.current.scrollTo({behavior:"smooth",left:-(p*y)}):d>=y?v.current.scrollTo({behavior:"smooth",left:0}):s>d?v.current.scrollBy({behavior:"smooth",left:p}):v.current.scrollBy({behavior:"smooth",left:-p})}function w(){const p=Object.keys(i.responsive).sort().findLast(I=>Number(I)<=window.innerWidth),m=p?i.responsive[Number(p)]:null;t(m?{...r,...m}:i)}return u.useEffect(()=>{v.current&&c(v.current.childNodes.length)},[i.children]),u.useEffect(()=>{if(!(!i.responsive||Object.keys(i.responsive).length<=0))return w(),window.addEventListener("resize",w),()=>{window.removeEventListener("resize",w)}},[i.responsive]),e.jsx(b.Provider,{value:S,children:e.jsxs("div",{className:x.clsx("dgs-ui-kit-overflow-hidden dgs-ui-kit-relative dgs-ui-kit-group",o),style:{direction:"rtl"},children:[e.jsx("div",{className:x.clsx("dgs-ui-kit-flex dgs-ui-kit-snap-x dgs-ui-kit-snap-mandatory dgs-ui-kit-overflow-x-auto no-scrollbar",g),style:{marginLeft:-k},onScroll:P,ref:v,children:i.children}),T&&e.jsx(D,{onNavigate:R,slideIndex:s,slidesCount:y})]})})};function E({slidesPerView:i,childIndex:s,centerMode:n,childrenCount:r}){const t=s%Math.floor(i)===0,l=i%1!==0,c=s===0,o=s===r-1;return t?n&&l?c?"start":o?"end":"center":"start":"none"}const q=i=>{const{children:s,className:n,style:r,...t}=i,{slidesPerView:l=1,spaceBetween:c=0,centerMode:o=!1,containerXPadding:g=0}=N(),a=u.useRef(null),[h,f]=u.useState(0),k=a.current?.parentNode?.children.length;return u.useEffect(()=>{a.current&&f(Array.prototype.indexOf.call(a.current.parentNode?.children,a.current))},[a]),e.jsx("div",{...t,ref:a,className:x.clsx("dgs-ui-kit-shrink-0 dgs-ui-kit-snap-always",n),style:{width:100/(l??1)+"%",paddingLeft:k&&h===k-1?g+c:c,paddingRight:h===0?g:0,scrollSnapAlign:E({slidesPerView:l,childIndex:h,centerMode:o,childrenCount:k||0}),...r},children:s})};exports.Slide=q;exports.Slider=M;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slide.d.ts","sourceRoot":"","sources":["../../src/components/Slider/Slide.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,EAAE,EACP,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Slide.d.ts","sourceRoot":"","sources":["../../src/components/Slider/Slide.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,EAAE,EACP,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AA4Bf,QAAA,MAAM,KAAK,EAAE,EAAE,CACb,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC,CAAC,CA0CrF,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../src/components/Slider/Slider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAA2B,MAAM,OAAO,CAAC;AAInG,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EACL,OAAO,GACP;QACE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACvB,CAAC;IACN,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,iBAAiB,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACzC,yBAAyB,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,WAAW,GAAG,SAAS,CAAC;IACvE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;IAC7D,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../src/components/Slider/Slider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAA2B,MAAM,OAAO,CAAC;AAInG,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EACL,OAAO,GACP;QACE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACvB,CAAC;IACN,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,iBAAiB,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACzC,yBAAyB,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,WAAW,GAAG,SAAS,CAAC;IACvE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;IAC7D,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAoH9C,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/Slider/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../assets/styles.css');;/* empty css */const e=require("../Slide-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../assets/styles.css');;/* empty css */const e=require("../Slide-DAapDHVY.cjs");exports.Slide=e.Slide;exports.Slider=e.Slider;
|
package/dist/Slider/index.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./assets/styles.css');;/* empty css */const r=require("./AccordionItem-AwBSlD0h.cjs"),o=require("./Alert/index.cjs"),t=require("./Badge/index.cjs"),i=require("./Breadcrumb/index.cjs"),n=require("./Button/index.cjs"),c=require("./Divider/index.cjs"),u=require("./Drawer/index.cjs"),s=require("./Form/Checkbox/index.cjs"),a=require("./Form/Input/index.cjs"),d=require("./Form/OtpInput/index.cjs"),q=require("./Form/RadioButton/index.cjs"),m=require("./Form/Textarea/index.cjs"),l=require("./Pagination/index.cjs"),B=require("./Progress/Bar/index.cjs"),e=require("./Slide-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./assets/styles.css');;/* empty css */const r=require("./AccordionItem-AwBSlD0h.cjs"),o=require("./Alert/index.cjs"),t=require("./Badge/index.cjs"),i=require("./Breadcrumb/index.cjs"),n=require("./Button/index.cjs"),c=require("./Divider/index.cjs"),u=require("./Drawer/index.cjs"),s=require("./Form/Checkbox/index.cjs"),a=require("./Form/Input/index.cjs"),d=require("./Form/OtpInput/index.cjs"),q=require("./Form/RadioButton/index.cjs"),m=require("./Form/Textarea/index.cjs"),l=require("./Pagination/index.cjs"),B=require("./Progress/Bar/index.cjs"),e=require("./Slide-DAapDHVY.cjs"),p=require("./Tabs/index.cjs");exports.AccordionGroup=r.AccordionGroup;exports.AccordionItem=r.AccordionItem;exports.Alert=o;exports.Badge=t;exports.Breadcrumb=i;exports.Button=n;exports.Divider=c;exports.Drawer=u;exports.Checkbox=s;exports.Input=a;exports.OtpInput=d;exports.RadioButton=q;exports.Textarea=m;exports.Pagination=l;exports.ProgressBar=B;exports.Slide=e.Slide;exports.Slider=e.Slider;exports.Tabs=p;
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { default as T } from "./Form/RadioButton/index.js";
|
|
|
13
13
|
import { default as k } from "./Form/Textarea/index.js";
|
|
14
14
|
import { default as w } from "./Pagination/index.js";
|
|
15
15
|
import { default as G } from "./Progress/Bar/index.js";
|
|
16
|
-
import { a as R, S as j } from "./Slide-
|
|
16
|
+
import { a as R, S as j } from "./Slide-CQBJqAor.js";
|
|
17
17
|
import { default as y } from "./Tabs/index.js";
|
|
18
18
|
export {
|
|
19
19
|
e as AccordionGroup,
|
package/package.json
CHANGED
package/dist/Slide-CTeuUKkl.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";const e=require("react/jsx-runtime"),k=require("./clsx-C11secjj.cjs"),u=require("react"),W=require("./ArrowLeft2-B76dkC-C.cjs"),A=require("./ArrowRight2-CYowPzS8.cjs"),S=require("./Button/index.cjs"),C=u.createContext({slidesPerView:1,spaceBetween:0,navigationVariant:"outside",showNavigationDots:!0,showPaginationText:!1}),b=()=>u.useContext(C);function D({active:i,autoplay:s,variant:n="outside"}){return[{inside:"dgs-ui-kit-bg-gray-500/50 hover:dgs-ui-kit-bg-gray-500/80",outside:"dgs-ui-kit-bg-gray-200 hover:dgs-ui-kit-bg-gray-300"}[n],i?"dgs-ui-kit-w-[22px]":"dgs-ui-kit-w-[6px]",s?"dgs-ui-kit-p-[1px]":""]}const M=i=>{const{active:s,onClick:n,onNavigateToNext:r}=i,{autoplay:t,navigationVariant:l="outside"}=b(),[v,o]=u.useState(0);return u.useEffect(()=>{if(!s||!t)return;const g=typeof t=="boolean"?7e3:t?.delay??7e3;let a=Date.now();const c=setInterval(()=>{const h=Date.now()-a,f=h/g*100;o(Math.min(f,100)),h>=g&&typeof r=="function"&&r()},100);return function(){return o(0),a=Date.now(),clearInterval(c)}},[s,t,r]),e.jsx("button",{className:k.clsx("dgs-ui-kit-rounded-full dgs-ui-kit-overflow-hidden dgs-ui-kit-transition-all dgs-ui-kit-h-[6px]",D({active:s,autoplay:t,variant:l})),onClick:n,children:s&&e.jsx("div",{className:k.clsx("dgs-ui-kit-h-full dgs-ui-kit-rounded-full",{"dgs-ui-kit-bg-white":l==="inside","dgs-ui-kit-bg-gray-700":l==="outside"}),style:{width:t?`${v}%`:"100%"}})})},B=i=>{const{onNavigate:s,slideIndex:n,slidesCount:r}=i,{navigationButtonsShowType:t="hide",dotsClassName:l,navigationContainerClassName:v,navigationVariant:o="outside",showNavigationDots:g=!0,showPaginationText:a}=b(),c=e.jsxs("div",{className:k.clsx("dgs-ui-kit-flex dgs-ui-kit-gap-2",{"dgs-ui-kit-absolute dgs-ui-kit-bottom-0 dgs-ui-kit-left-[5.5%]":o==="inside"&&t!=="onSides","dgs-ui-kit-absolute dgs-ui-kit-justify-between dgs-ui-kit-top-1/2 -dgs-ui-kit-translate-y-1/2 dgs-ui-kit-w-full dgs-ui-kit-px-[5.5%]":t==="onSides","dgs-ui-kit-opacity-0 group-hover:dgs-ui-kit-opacity-100 dgs-ui-kit-transition":t==="hover"||t==="onSides"}),children:[e.jsx(S,{type:"button",variant:"secondary",onClick:()=>s(n-1),rightIcon:e.jsx(A.ArrowRight2Icon,{})}),e.jsx(S,{type:"button",variant:"secondary",onClick:()=>s(n+1),rightIcon:e.jsx(W.ArrowLeft2Icon,{})})]});return e.jsxs(e.Fragment,{children:[t&&t!=="hide"&&t==="onSides"&&c,e.jsxs("div",{className:k.clsx("dgs-ui-kit-flex",{"dgs-ui-kit-items-center dgs-ui-kit-mt-2":o==="outside","dgs-ui-kit-absolute dgs-ui-kit-bottom-4 dgs-ui-kit-w-full dgs-ui-kit-justify-center":o==="inside","dgs-ui-kit-justify-between":o==="outside"&&t!=="hide"&&t!=="onSides","dgs-ui-kit-justify-center":o==="outside"&&(t==="hide"||t==="onSides")},v),children:[t&&t!=="hide"&&t!=="onSides"&&c,(g||a)&&e.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-gap-3",children:[a&&e.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-gap-1 dgs-ui-kit-font-caption-regular dgs-ui-kit-text-gray-400 ss02",children:[e.jsx("span",{className:k.clsx("dgs-ui-kit-font-bold",{"dgs-ui-kit-text-gray-600":o==="outside","dgs-ui-kit-text-white":o==="inside"}),children:n+1}),e.jsx("span",{children:"از"}),e.jsx("span",{children:r})]}),g&&e.jsx("div",{className:k.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-justify-center dgs-ui-kit-gap-2",l),children:Array.from(Array(r).keys()).map((h,f)=>e.jsx(M,{active:n===f,onClick:()=>s(f),onNavigateToNext:()=>s(n+1)},h+r))})]})]})]})},E=i=>{const[s,n]=u.useState(0),[r,t]=u.useState(i),[l,v]=u.useState(0),{className:o="",containerClassName:g="",showNavigationDots:a=!0,slidesPerView:c=1,navigationButtonsShowType:h="hide",spaceBetween:f=0,showPaginationText:P}=r,T=Object.fromEntries(Object.entries(r).filter(([d])=>d!=="children")),y=u.useRef(null),x=Math.ceil(l/Math.floor(c)),L=(a||h&&h!=="hide"||P)&&x>1;function R(d){if(Math.ceil(Math.abs(d.currentTarget.scrollLeft))+d.currentTarget.clientWidth===d.currentTarget.scrollWidth){n(x-1);return}const m=d.currentTarget.scrollWidth/x,p=(d.currentTarget.scrollWidth-d.currentTarget.scrollLeft)/m;if(p<=x){n(0);return}n(Math.round(p%x))}function I(d){if(!y.current)return;const m=c%1!==0,p=y.current.offsetWidth,w=m?p/c:p;let j=-(w*d);d<0?j=-(w*x):d>=x&&(j=0),y.current.scrollTo({left:j,behavior:"smooth"})}function N(){const m=Object.keys(i.responsive).sort().findLast(w=>Number(w)<=window.innerWidth),p=m?i.responsive[Number(m)]:null;t(p?{...r,...p}:i)}return u.useEffect(()=>{y.current&&v(y.current.childNodes.length)},[i.children]),u.useEffect(()=>{if(!(!i.responsive||Object.keys(i.responsive).length<=0))return N(),window.addEventListener("resize",N),()=>{window.removeEventListener("resize",N)}},[i.responsive]),e.jsx(C.Provider,{value:T,children:e.jsxs("div",{className:k.clsx("dgs-ui-kit-overflow-hidden dgs-ui-kit-relative dgs-ui-kit-group",o),style:{direction:"rtl"},children:[e.jsx("div",{className:k.clsx("dgs-ui-kit-flex dgs-ui-kit-snap-x dgs-ui-kit-snap-mandatory dgs-ui-kit-overflow-x-auto no-scrollbar",g),style:{marginLeft:-f},onScroll:R,ref:y,children:i.children}),L&&e.jsx(B,{onNavigate:I,slideIndex:s,slidesCount:x})]})})};function q({slidesPerView:i,childIndex:s,centerMode:n,childsLength:r}){return s%Math.floor(i)!==0?"none":n&&i%1!==0?s===0?"start":s===r-1?"end":"center":"start"}const V=i=>{const{children:s,className:n,style:r,...t}=i,{slidesPerView:l=1,spaceBetween:v=0,centerMode:o=!1,containerXPadding:g=0}=b(),a=u.useRef(null),[c,h]=u.useState(0),f=a.current?.parentNode?.children.length;return u.useEffect(()=>{a.current&&h(Array.prototype.indexOf.call(a.current.parentNode?.children,a.current))},[a]),e.jsx("div",{...t,ref:a,className:k.clsx("dgs-ui-kit-shrink-0 dgs-ui-kit-snap-always",n),style:{width:100/(l??1)+"%",paddingLeft:f&&c===f-1?g+v:v,paddingRight:c===0?g:0,scrollSnapAlign:q({slidesPerView:l,childIndex:c,centerMode:o,childsLength:f||0}),...r},children:s})};exports.Slide=V;exports.Slider=E;
|