@dgshahr/ui-kit 0.0.51 → 0.0.53
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/Drawer/index.cjs +1 -1
- package/dist/Drawer/index.d.ts.map +1 -1
- package/dist/Drawer/index.js +43 -46
- package/dist/{Slide-D_YyWKvD.js → Slide-Bkfv_374.js} +85 -85
- package/dist/Slide-S7dYK-Ve.cjs +1 -0
- package/dist/Slider/NavigationDot.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-h2OqEiNN.cjs +0 -1
package/dist/Drawer/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";require('../assets/styles.css');const i=require("react/jsx-runtime"),n=require("../clsx-C11secjj.cjs"),
|
|
1
|
+
"use client";"use strict";require('../assets/styles.css');const i=require("react/jsx-runtime"),n=require("../clsx-C11secjj.cjs"),h=require("react");;/* empty css */const R=require("react-dom"),q=require("../CloseRemove-BUG0Hjfl.cjs"),m=150;function x({position:s,padding:l=0,item:u}){return s==="center"?"auto":u==="width"?s==="bottom"||s==="top"?`calc(100% - ${l*2}px)`:"auto":s==="bottom"||s==="top"?"auto":`calc(100% - ${l*2}px)`}function D({position:s,padding:l=0}){const u="dgs-ui-kit-rounded-2xl";if(l>0||s==="center")return u;switch(s){case"bottom":return`${u} dgs-ui-kit-rounded-b-none`;case"left":return`${u} dgs-ui-kit-rounded-l-none`;case"right":return`${u} dgs-ui-kit-rounded-r-none`;case"top":return`${u} dgs-ui-kit-rounded-t-none`;default:return u}}const I=s=>{const{open:l,onClose:u,persist:v,position:t="bottom",children:p,className:w,maskClassName:b,containerClassName:y,padding:d=8,width:N,header:e,footer:o,containerElement:k}=s,[a,f]=h.useState(!1),r=k??document?.body;function j(){r.classList.add("dgs-ui-kit-overflow-hidden","dgs-ui-kit-relative"),setTimeout(()=>{f(!0)},m)}function c(){f(!1),setTimeout(()=>{r.classList.remove("dgs-ui-kit-overflow-hidden","dgs-ui-kit-relative"),u()},m)}h.useEffect(()=>{l?j():a&&c()},[l]);const C=e?Object.values(e).some(g=>!!g):!1,$=t==="center"?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:t!=="bottom"?d??0:"unset",bottom:t!=="top"?d??0:"unset",left:t!=="right"?d??0:"unset",right:t!=="left"?d??0:"unset"};return R.createPortal(i.jsx("div",{className:n.clsx("dgs-ui-kit-bg-black/40 dgs-ui-kit-top-0 dgs-ui-kit-left-0 dgs-ui-kit-z-50 dgs-ui-kit-opacity-0 dgs-ui-kit-overflow-hidden dgs-ui-kit-cursor-default dgs-ui-kit-transition dgs-ui-kit-ease-linear",{"dgs-ui-kit-opacity-100":a,"dgs-ui-kit-w-full dgs-ui-kit-h-full":l},k?"dgs-ui-kit-absolute":"dgs-ui-kit-fixed",b),onClick:()=>v?null:c(),children:i.jsx("div",{className:n.clsx("dgs-ui-kit-absolute dgs-ui-kit-z-10 dgs-ui-kit-opacity-0 dgs-ui-kit-transition dgs-ui-kit-duration-100 dgs-ui-kit-flex dgs-ui-kit-justify-center",{"dgs-ui-kit-opacity-100":a,"dgs-ui-kit-translate-y-full":!a&&t==="bottom","-dgs-ui-kit-translate-y-full":!a&&t==="top","dgs-ui-kit-translate-x-full":!a&&t==="right","-dgs-ui-kit-translate-x-full":!a&&t==="left"},w),style:{...$,maxHeight:`calc(100svh - ${d*2}px)`,maxWidth:`calc(100vw - ${d*2}px)`,width:x({position:t,padding:d,item:"width"}),height:x({position:t,padding:d,item:"height"})},children:i.jsxs("div",{className:n.clsx("dgs-ui-kit-overflow-x-hidden dgs-ui-kit-flex dgs-ui-kit-flex-col dgs-ui-kit-bg-white dgs-ui-kit-divide-y dgs-ui-kit-divide-gray-200 dgs-ui-kit-divide-solid",D({position:t,padding:d})),style:{width:N??"100%"},onClick:g=>g.stopPropagation(),children:[e&&C&&i.jsxs("div",{className:n.clsx("dgs-ui-kit-h-16 dgs-ui-kit-relative dgs-ui-kit-shrink-0",e?.containerClassName),children:[e.actionElement?i.jsx("div",{className:"dgs-ui-kit-absolute dgs-ui-kit-top-1/2 -dgs-ui-kit-translate-y-1/2 dgs-ui-kit-right-4 [&>svg]:dgs-ui-kit-w-6 [&_svg]:dgs-ui-kit-h-6 dgs-ui-kit-text-gray-600",children:e.actionElement}):null,e.title?i.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-flex-col dgs-ui-kit-absolute dgs-ui-kit-top-1/2 dgs-ui-kit-right-1/2 -dgs-ui-kit-translate-y-1/2 dgs-ui-kit-translate-x-1/2 dgs-ui-kit-text-center",children:[i.jsx("span",{className:"dgs-ui-kit-font-h6-bold dgs-ui-kit-text-gray-800",children:e.title}),e.description?i.jsx("span",{className:"dgs-ui-kit-font-caption-regular dgs-ui-kit-text-gray-500",children:e.description}):null]}):null,e.haveCloseIcon&&i.jsx("button",{onClick:c,className:"dgs-ui-kit-absolute dgs-ui-kit-top-1/2 -dgs-ui-kit-translate-y-1/2 dgs-ui-kit-left-4",children:i.jsx(q.CloseRemoveIcon,{width:24,height:24,className:"dgs-ui-kit-text-gray-600"})})]}),i.jsx("div",{className:n.clsx("dgs-ui-kit-p-4 dgs-ui-kit-overflow-y-auto",y),children:p}),o?.element?i.jsx("div",{className:n.clsx("dgs-ui-kit-p-4 dgs-ui-kit-mt-auto",o.containerClassName),children:o.element}):null]})})}),r)};module.exports=I;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/Drawer/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAuB,KAAK,aAAa,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACzF,OAAO,kBAAkB,CAAC;AAM1B,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,aAAa,CAAC,EAAE,SAAS,CAAC;QAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,MAAM,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,SAAS,CAAC;QACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,gBAAgB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACnC;AA4CD,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/Drawer/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAuB,KAAK,aAAa,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACzF,OAAO,kBAAkB,CAAC;AAM1B,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,aAAa,CAAC,EAAE,SAAS,CAAC;QAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,MAAM,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,SAAS,CAAC;QACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,gBAAgB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACnC;AA4CD,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CA+I3B,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/Drawer/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as u, jsxs as
|
|
2
|
+
import { jsx as u, jsxs as k } from "react/jsx-runtime";
|
|
3
3
|
import { c as o } from "../clsx-OuTLNxxd.js";
|
|
4
|
-
import { useState as
|
|
4
|
+
import { useState as j, useEffect as D } from "react";
|
|
5
5
|
import '../assets/styles.css';/* empty css */
|
|
6
|
-
import { createPortal as
|
|
7
|
-
import { C as
|
|
8
|
-
const
|
|
9
|
-
function
|
|
6
|
+
import { createPortal as E } from "react-dom";
|
|
7
|
+
import { C as R } from "../CloseRemove-BzqPxkjk.js";
|
|
8
|
+
const h = 150;
|
|
9
|
+
function p({
|
|
10
10
|
position: e,
|
|
11
11
|
padding: a = 0,
|
|
12
12
|
item: s
|
|
13
13
|
}) {
|
|
14
14
|
return e === "center" ? "auto" : s === "width" ? e === "bottom" || e === "top" ? `calc(100% - ${a * 2}px)` : "auto" : e === "bottom" || e === "top" ? "auto" : `calc(100% - ${a * 2}px)`;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function T({
|
|
17
17
|
position: e,
|
|
18
18
|
padding: a = 0
|
|
19
19
|
}) {
|
|
@@ -32,55 +32,52 @@ function z({
|
|
|
32
32
|
return s;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
const
|
|
35
|
+
const L = (e) => {
|
|
36
36
|
const {
|
|
37
37
|
open: a,
|
|
38
38
|
onClose: s,
|
|
39
|
-
persist:
|
|
39
|
+
persist: v,
|
|
40
40
|
position: t = "bottom",
|
|
41
|
-
children:
|
|
42
|
-
className:
|
|
43
|
-
maskClassName:
|
|
44
|
-
containerClassName:
|
|
41
|
+
children: x,
|
|
42
|
+
className: w,
|
|
43
|
+
maskClassName: b,
|
|
44
|
+
containerClassName: y,
|
|
45
45
|
padding: d = 8,
|
|
46
|
-
width:
|
|
46
|
+
width: N,
|
|
47
47
|
header: i,
|
|
48
48
|
footer: n,
|
|
49
|
-
containerElement:
|
|
50
|
-
} = e, [l,
|
|
51
|
-
function
|
|
49
|
+
containerElement: f
|
|
50
|
+
} = e, [l, m] = j(!1), r = f ?? document?.body;
|
|
51
|
+
function C() {
|
|
52
52
|
r.classList.add("dgs-ui-kit-overflow-hidden", "dgs-ui-kit-relative"), setTimeout(() => {
|
|
53
|
-
|
|
54
|
-
},
|
|
53
|
+
m(!0);
|
|
54
|
+
}, h);
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
setTimeout(() => {
|
|
56
|
+
function g() {
|
|
57
|
+
m(!1), setTimeout(() => {
|
|
58
58
|
r.classList.remove("dgs-ui-kit-overflow-hidden", "dgs-ui-kit-relative"), s();
|
|
59
|
-
},
|
|
59
|
+
}, h);
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
E(() => {
|
|
65
|
-
a ? $() : m();
|
|
61
|
+
D(() => {
|
|
62
|
+
a ? C() : l && g();
|
|
66
63
|
}, [a]);
|
|
67
|
-
const
|
|
64
|
+
const $ = i ? Object.values(i).some((c) => !!c) : !1, I = t === "center" ? { top: "50%", left: "50%", transform: "translate(-50%, -50%)" } : {
|
|
68
65
|
top: t !== "bottom" ? d ?? 0 : "unset",
|
|
69
66
|
bottom: t !== "top" ? d ?? 0 : "unset",
|
|
70
67
|
left: t !== "right" ? d ?? 0 : "unset",
|
|
71
68
|
right: t !== "left" ? d ?? 0 : "unset"
|
|
72
69
|
};
|
|
73
|
-
return
|
|
70
|
+
return E(
|
|
74
71
|
/* @__PURE__ */ u(
|
|
75
72
|
"div",
|
|
76
73
|
{
|
|
77
74
|
className: o(
|
|
78
75
|
"dgs-ui-kit-bg-black/40 dgs-ui-kit-top-0 dgs-ui-kit-left-0 dgs-ui-kit-z-50 dgs-ui-kit-opacity-0 dgs-ui-kit-overflow-hidden dgs-ui-kit-cursor-default dgs-ui-kit-transition dgs-ui-kit-ease-linear",
|
|
79
76
|
{ "dgs-ui-kit-opacity-100": l, "dgs-ui-kit-w-full dgs-ui-kit-h-full": a },
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
f ? "dgs-ui-kit-absolute" : "dgs-ui-kit-fixed",
|
|
78
|
+
b
|
|
82
79
|
),
|
|
83
|
-
onClick: () =>
|
|
80
|
+
onClick: () => v ? null : g(),
|
|
84
81
|
children: /* @__PURE__ */ u(
|
|
85
82
|
"div",
|
|
86
83
|
{
|
|
@@ -93,26 +90,26 @@ const _ = (e) => {
|
|
|
93
90
|
"dgs-ui-kit-translate-x-full": !l && t === "right",
|
|
94
91
|
"-dgs-ui-kit-translate-x-full": !l && t === "left"
|
|
95
92
|
},
|
|
96
|
-
|
|
93
|
+
w
|
|
97
94
|
),
|
|
98
95
|
style: {
|
|
99
|
-
...
|
|
96
|
+
...I,
|
|
100
97
|
maxHeight: `calc(100svh - ${d * 2}px)`,
|
|
101
98
|
maxWidth: `calc(100vw - ${d * 2}px)`,
|
|
102
|
-
width:
|
|
103
|
-
height:
|
|
99
|
+
width: p({ position: t, padding: d, item: "width" }),
|
|
100
|
+
height: p({ position: t, padding: d, item: "height" })
|
|
104
101
|
},
|
|
105
|
-
children: /* @__PURE__ */
|
|
102
|
+
children: /* @__PURE__ */ k(
|
|
106
103
|
"div",
|
|
107
104
|
{
|
|
108
105
|
className: o(
|
|
109
106
|
"dgs-ui-kit-overflow-x-hidden dgs-ui-kit-flex dgs-ui-kit-flex-col dgs-ui-kit-bg-white dgs-ui-kit-divide-y dgs-ui-kit-divide-gray-200 dgs-ui-kit-divide-solid",
|
|
110
|
-
|
|
107
|
+
T({ position: t, padding: d })
|
|
111
108
|
),
|
|
112
|
-
style: { width:
|
|
113
|
-
onClick: (
|
|
109
|
+
style: { width: N ?? "100%" },
|
|
110
|
+
onClick: (c) => c.stopPropagation(),
|
|
114
111
|
children: [
|
|
115
|
-
i &&
|
|
112
|
+
i && $ && /* @__PURE__ */ k(
|
|
116
113
|
"div",
|
|
117
114
|
{
|
|
118
115
|
className: o(
|
|
@@ -121,17 +118,17 @@ const _ = (e) => {
|
|
|
121
118
|
),
|
|
122
119
|
children: [
|
|
123
120
|
i.actionElement ? /* @__PURE__ */ u("div", { className: "dgs-ui-kit-absolute dgs-ui-kit-top-1/2 -dgs-ui-kit-translate-y-1/2 dgs-ui-kit-right-4 [&>svg]:dgs-ui-kit-w-6 [&_svg]:dgs-ui-kit-h-6 dgs-ui-kit-text-gray-600", children: i.actionElement }) : null,
|
|
124
|
-
i.title ? /* @__PURE__ */
|
|
121
|
+
i.title ? /* @__PURE__ */ k("div", { className: "dgs-ui-kit-flex dgs-ui-kit-flex-col dgs-ui-kit-absolute dgs-ui-kit-top-1/2 dgs-ui-kit-right-1/2 -dgs-ui-kit-translate-y-1/2 dgs-ui-kit-translate-x-1/2 dgs-ui-kit-text-center", children: [
|
|
125
122
|
/* @__PURE__ */ u("span", { className: "dgs-ui-kit-font-h6-bold dgs-ui-kit-text-gray-800", children: i.title }),
|
|
126
123
|
i.description ? /* @__PURE__ */ u("span", { className: "dgs-ui-kit-font-caption-regular dgs-ui-kit-text-gray-500", children: i.description }) : null
|
|
127
124
|
] }) : null,
|
|
128
125
|
i.haveCloseIcon && /* @__PURE__ */ u(
|
|
129
126
|
"button",
|
|
130
127
|
{
|
|
131
|
-
onClick:
|
|
128
|
+
onClick: g,
|
|
132
129
|
className: "dgs-ui-kit-absolute dgs-ui-kit-top-1/2 -dgs-ui-kit-translate-y-1/2 dgs-ui-kit-left-4",
|
|
133
130
|
children: /* @__PURE__ */ u(
|
|
134
|
-
|
|
131
|
+
R,
|
|
135
132
|
{
|
|
136
133
|
width: 24,
|
|
137
134
|
height: 24,
|
|
@@ -143,7 +140,7 @@ const _ = (e) => {
|
|
|
143
140
|
]
|
|
144
141
|
}
|
|
145
142
|
),
|
|
146
|
-
/* @__PURE__ */ u("div", { className: o("dgs-ui-kit-p-4 dgs-ui-kit-overflow-y-auto",
|
|
143
|
+
/* @__PURE__ */ u("div", { className: o("dgs-ui-kit-p-4 dgs-ui-kit-overflow-y-auto", y), children: x }),
|
|
147
144
|
n?.element ? /* @__PURE__ */ u("div", { className: o("dgs-ui-kit-p-4 dgs-ui-kit-mt-auto", n.containerClassName), children: n.element }) : null
|
|
148
145
|
]
|
|
149
146
|
}
|
|
@@ -156,5 +153,5 @@ const _ = (e) => {
|
|
|
156
153
|
);
|
|
157
154
|
};
|
|
158
155
|
export {
|
|
159
|
-
|
|
156
|
+
L as default
|
|
160
157
|
};
|
|
@@ -15,8 +15,8 @@ const M = F({
|
|
|
15
15
|
sliderId: ""
|
|
16
16
|
}), A = () => K(M);
|
|
17
17
|
function G({
|
|
18
|
-
active:
|
|
19
|
-
autoplay:
|
|
18
|
+
active: e,
|
|
19
|
+
autoplay: i,
|
|
20
20
|
variant: n = "outside"
|
|
21
21
|
}) {
|
|
22
22
|
return [
|
|
@@ -24,56 +24,56 @@ function G({
|
|
|
24
24
|
inside: "dgs-ui-kit-bg-gray-500/50 hover:dgs-ui-kit-bg-gray-500/80",
|
|
25
25
|
outside: "dgs-ui-kit-bg-gray-200 hover:dgs-ui-kit-bg-gray-300"
|
|
26
26
|
}[n],
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
e ? "dgs-ui-kit-w-[22px]" : "dgs-ui-kit-w-[6px]",
|
|
28
|
+
i ? "dgs-ui-kit-p-[1px]" : ""
|
|
29
29
|
];
|
|
30
30
|
}
|
|
31
|
-
const J = (
|
|
32
|
-
const { active:
|
|
31
|
+
const J = (e) => {
|
|
32
|
+
const { active: i, onClick: n, onNavigateToNext: a } = e, { autoplay: t, navigationVariant: c = "outside" } = A(), [m, s] = b(0);
|
|
33
33
|
return C(() => {
|
|
34
|
-
if (!
|
|
34
|
+
if (!i || !t) return;
|
|
35
35
|
const l = typeof t == "boolean" ? 7e3 : t?.delay ?? 7e3;
|
|
36
36
|
let g = Date.now();
|
|
37
|
-
const
|
|
38
|
-
const d = Date.now() - g,
|
|
39
|
-
|
|
37
|
+
const f = setInterval(() => {
|
|
38
|
+
const d = Date.now() - g, k = d / l * 100;
|
|
39
|
+
s(Math.min(k, 100)), d >= l && typeof a == "function" && (a(), s(0), clearInterval(f));
|
|
40
40
|
}, 100);
|
|
41
41
|
return function() {
|
|
42
|
-
return
|
|
42
|
+
return s(0), g = Date.now(), clearInterval(f);
|
|
43
43
|
};
|
|
44
|
-
}, [
|
|
44
|
+
}, [i, t, a]), /* @__PURE__ */ o(
|
|
45
45
|
"button",
|
|
46
46
|
{
|
|
47
47
|
className: p(
|
|
48
48
|
"dgs-ui-kit-rounded-full dgs-ui-kit-overflow-hidden dgs-ui-kit-transition-all dgs-ui-kit-h-[6px]",
|
|
49
|
-
G({ active:
|
|
49
|
+
G({ active: i, autoplay: t, variant: c })
|
|
50
50
|
),
|
|
51
51
|
onClick: n,
|
|
52
|
-
children:
|
|
52
|
+
children: i && /* @__PURE__ */ o(
|
|
53
53
|
"div",
|
|
54
54
|
{
|
|
55
55
|
className: p("dgs-ui-kit-h-full dgs-ui-kit-rounded-full", {
|
|
56
56
|
"dgs-ui-kit-bg-white": c === "inside",
|
|
57
57
|
"dgs-ui-kit-bg-gray-700": c === "outside"
|
|
58
58
|
}),
|
|
59
|
-
style: { width: t ? `${
|
|
59
|
+
style: { width: t ? `${m}%` : "100%" }
|
|
60
60
|
}
|
|
61
61
|
)
|
|
62
62
|
}
|
|
63
63
|
);
|
|
64
|
-
}, Q = (
|
|
65
|
-
const { onNavigate:
|
|
64
|
+
}, Q = (e) => {
|
|
65
|
+
const { onNavigate: i, slideIndex: n, slidesCount: a } = e, {
|
|
66
66
|
navigationButtonsShowType: t = "hide",
|
|
67
67
|
dotsClassName: c,
|
|
68
|
-
navigationContainerClassName:
|
|
69
|
-
navigationVariant:
|
|
68
|
+
navigationContainerClassName: m,
|
|
69
|
+
navigationVariant: s = "outside",
|
|
70
70
|
showNavigationDots: l = !0,
|
|
71
71
|
showPaginationText: g
|
|
72
|
-
} = A(),
|
|
72
|
+
} = A(), f = /* @__PURE__ */ w(
|
|
73
73
|
"div",
|
|
74
74
|
{
|
|
75
75
|
className: p("dgs-ui-kit-flex dgs-ui-kit-gap-2", {
|
|
76
|
-
"dgs-ui-kit-absolute dgs-ui-kit-bottom-0 dgs-ui-kit-left-[5.5%]":
|
|
76
|
+
"dgs-ui-kit-absolute dgs-ui-kit-bottom-0 dgs-ui-kit-left-[5.5%]": s === "inside" && t !== "onSides",
|
|
77
77
|
"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",
|
|
78
78
|
"dgs-ui-kit-opacity-0 group-hover:dgs-ui-kit-opacity-100 dgs-ui-kit-transition": t === "hover" || t === "onSides"
|
|
79
79
|
}),
|
|
@@ -83,7 +83,7 @@ const J = (i) => {
|
|
|
83
83
|
{
|
|
84
84
|
type: "button",
|
|
85
85
|
variant: "secondary",
|
|
86
|
-
onClick: () =>
|
|
86
|
+
onClick: () => i(n - 1),
|
|
87
87
|
rightIcon: /* @__PURE__ */ o(H, {})
|
|
88
88
|
}
|
|
89
89
|
),
|
|
@@ -92,7 +92,7 @@ const J = (i) => {
|
|
|
92
92
|
{
|
|
93
93
|
type: "button",
|
|
94
94
|
variant: "secondary",
|
|
95
|
-
onClick: () =>
|
|
95
|
+
onClick: () => i(n + 1),
|
|
96
96
|
rightIcon: /* @__PURE__ */ o(q, {})
|
|
97
97
|
}
|
|
98
98
|
)
|
|
@@ -100,30 +100,30 @@ const J = (i) => {
|
|
|
100
100
|
}
|
|
101
101
|
);
|
|
102
102
|
return /* @__PURE__ */ w(V, { children: [
|
|
103
|
-
t && t !== "hide" && t === "onSides" &&
|
|
103
|
+
t && t !== "hide" && t === "onSides" && f,
|
|
104
104
|
/* @__PURE__ */ w(
|
|
105
105
|
"div",
|
|
106
106
|
{
|
|
107
107
|
className: p(
|
|
108
108
|
"dgs-ui-kit-flex",
|
|
109
109
|
{
|
|
110
|
-
"dgs-ui-kit-items-center dgs-ui-kit-mt-2":
|
|
111
|
-
"dgs-ui-kit-absolute dgs-ui-kit-bottom-4 dgs-ui-kit-w-full dgs-ui-kit-justify-center":
|
|
112
|
-
"dgs-ui-kit-justify-between":
|
|
113
|
-
"dgs-ui-kit-justify-center":
|
|
110
|
+
"dgs-ui-kit-items-center dgs-ui-kit-mt-2": s === "outside",
|
|
111
|
+
"dgs-ui-kit-absolute dgs-ui-kit-bottom-4 dgs-ui-kit-w-full dgs-ui-kit-justify-center": s === "inside",
|
|
112
|
+
"dgs-ui-kit-justify-between": s === "outside" && t !== "hide" && t !== "onSides",
|
|
113
|
+
"dgs-ui-kit-justify-center": s === "outside" && (t === "hide" || t === "onSides")
|
|
114
114
|
},
|
|
115
|
-
|
|
115
|
+
m
|
|
116
116
|
),
|
|
117
117
|
children: [
|
|
118
|
-
t && t !== "hide" && t !== "onSides" &&
|
|
118
|
+
t && t !== "hide" && t !== "onSides" && f,
|
|
119
119
|
(l || g) && /* @__PURE__ */ w("div", { className: "dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-gap-3", children: [
|
|
120
120
|
g && /* @__PURE__ */ w("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: [
|
|
121
121
|
/* @__PURE__ */ o(
|
|
122
122
|
"span",
|
|
123
123
|
{
|
|
124
124
|
className: p("dgs-ui-kit-font-bold", {
|
|
125
|
-
"dgs-ui-kit-text-gray-600":
|
|
126
|
-
"dgs-ui-kit-text-white":
|
|
125
|
+
"dgs-ui-kit-text-gray-600": s === "outside",
|
|
126
|
+
"dgs-ui-kit-text-white": s === "inside"
|
|
127
127
|
}),
|
|
128
128
|
children: n + 1
|
|
129
129
|
}
|
|
@@ -138,12 +138,12 @@ const J = (i) => {
|
|
|
138
138
|
"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-justify-center dgs-ui-kit-gap-2",
|
|
139
139
|
c
|
|
140
140
|
),
|
|
141
|
-
children: Array.from(Array(a).keys()).map((d,
|
|
141
|
+
children: Array.from(Array(a).keys()).map((d, k) => /* @__PURE__ */ o(
|
|
142
142
|
J,
|
|
143
143
|
{
|
|
144
|
-
active: n ===
|
|
145
|
-
onClick: () =>
|
|
146
|
-
onNavigateToNext: () =>
|
|
144
|
+
active: n === k,
|
|
145
|
+
onClick: () => i(k),
|
|
146
|
+
onNavigateToNext: () => i(n + 1)
|
|
147
147
|
},
|
|
148
148
|
d + a
|
|
149
149
|
))
|
|
@@ -154,61 +154,61 @@ const J = (i) => {
|
|
|
154
154
|
}
|
|
155
155
|
)
|
|
156
156
|
] });
|
|
157
|
-
}, U = $((
|
|
158
|
-
const [n, a] = b(
|
|
157
|
+
}, U = $((e, i) => {
|
|
158
|
+
const [n, a] = b(e), {
|
|
159
159
|
className: t = "",
|
|
160
160
|
containerClassName: c = "",
|
|
161
|
-
showNavigationDots:
|
|
162
|
-
slidesPerView:
|
|
161
|
+
showNavigationDots: m = !0,
|
|
162
|
+
slidesPerView: s = 1,
|
|
163
163
|
navigationButtonsShowType: l = "hide",
|
|
164
164
|
spaceBetween: g = 0,
|
|
165
|
-
showPaginationText:
|
|
165
|
+
showPaginationText: f,
|
|
166
166
|
onSlideIndexChange: d,
|
|
167
|
-
initialSlide:
|
|
167
|
+
initialSlide: k,
|
|
168
168
|
containerXPadding: h = 0
|
|
169
|
-
} = n, [S,
|
|
170
|
-
Object.entries(n).filter(([
|
|
171
|
-
), u = W(null), v = Math.ceil(j / Math.floor(
|
|
172
|
-
function E(
|
|
173
|
-
if (Math.ceil(Math.abs(
|
|
174
|
-
|
|
169
|
+
} = n, [S, I] = b(0), [j, B] = b(0), D = Object.fromEntries(
|
|
170
|
+
Object.entries(n).filter(([r]) => r !== "children")
|
|
171
|
+
), u = W(null), v = Math.ceil(j / Math.floor(s)), R = (m || l && l !== "hide" || f) && v > 1;
|
|
172
|
+
function E(r) {
|
|
173
|
+
if (Math.ceil(Math.abs(r.currentTarget.scrollLeft)) + r.currentTarget.clientWidth + 1 + h >= r.currentTarget.scrollWidth) {
|
|
174
|
+
I(v - 1);
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
|
-
const y =
|
|
177
|
+
const y = r.currentTarget.scrollWidth - h * 2, N = y / v, x = (y - r.currentTarget.scrollLeft - h) / N;
|
|
178
178
|
if (x <= v) {
|
|
179
|
-
|
|
179
|
+
I(0);
|
|
180
180
|
return;
|
|
181
181
|
}
|
|
182
|
-
|
|
182
|
+
I(Math.round(x % v));
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function P(r) {
|
|
185
185
|
if (!u.current) return;
|
|
186
|
-
const y = u.current.offsetWidth, N = S -
|
|
187
|
-
|
|
186
|
+
const y = u.current.offsetWidth, N = S - r, x = u.current.scrollWidth / v, O = N * x;
|
|
187
|
+
r < 0 ? u.current.scrollTo({ behavior: "smooth", left: -(y * v) }) : r >= v ? u.current.scrollTo({ behavior: "smooth", left: 0 }) : u.current.scrollBy({ behavior: "smooth", left: O });
|
|
188
188
|
}
|
|
189
189
|
function T() {
|
|
190
|
-
const y = Object.keys(
|
|
190
|
+
const y = Object.keys(e.responsive).sort().findLast(
|
|
191
191
|
(x) => Number(x) <= window.innerWidth
|
|
192
|
-
), N = y ?
|
|
193
|
-
a(N ? { ...n, ...N } :
|
|
192
|
+
), N = y ? e.responsive[Number(y)] : null;
|
|
193
|
+
a(N ? { ...n, ...N } : e);
|
|
194
194
|
}
|
|
195
|
-
return z(
|
|
195
|
+
return z(i, () => ({
|
|
196
196
|
element: u.current,
|
|
197
|
-
navigate: (
|
|
197
|
+
navigate: (r) => P(Math.max(0, r - 1))
|
|
198
198
|
})), C(() => {
|
|
199
199
|
if (!u.current) return;
|
|
200
|
-
let
|
|
201
|
-
h > 0 && (
|
|
202
|
-
}, [
|
|
203
|
-
if (!(!
|
|
200
|
+
let r = u.current.childElementCount;
|
|
201
|
+
h > 0 && (r -= 2), B(r);
|
|
202
|
+
}, [e.children, u, h]), C(() => {
|
|
203
|
+
if (!(!e.responsive || Object.keys(e.responsive).length <= 0))
|
|
204
204
|
return T(), window.addEventListener("resize", T), () => {
|
|
205
205
|
window.removeEventListener("resize", T);
|
|
206
206
|
};
|
|
207
|
-
}, [
|
|
207
|
+
}, [e.responsive]), C(() => {
|
|
208
208
|
d && typeof d == "function" && d(S);
|
|
209
209
|
}, [S]), C(() => {
|
|
210
|
-
typeof
|
|
211
|
-
}, [
|
|
210
|
+
typeof k == "number" && u.current && P(Math.max(0, k - 1));
|
|
211
|
+
}, [k, u.current]), /* @__PURE__ */ o(M.Provider, { value: { ...D, childrenCount: j, sliderId: X() }, children: /* @__PURE__ */ w(
|
|
212
212
|
"div",
|
|
213
213
|
{
|
|
214
214
|
className: p(
|
|
@@ -238,7 +238,7 @@ const J = (i) => {
|
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
),
|
|
241
|
-
|
|
241
|
+
e.children,
|
|
242
242
|
h > 0 && /* @__PURE__ */ o(
|
|
243
243
|
"div",
|
|
244
244
|
{
|
|
@@ -255,7 +255,7 @@ const J = (i) => {
|
|
|
255
255
|
R && /* @__PURE__ */ o(
|
|
256
256
|
Q,
|
|
257
257
|
{
|
|
258
|
-
onNavigate:
|
|
258
|
+
onNavigate: P,
|
|
259
259
|
slideIndex: S,
|
|
260
260
|
slidesCount: v
|
|
261
261
|
}
|
|
@@ -266,36 +266,36 @@ const J = (i) => {
|
|
|
266
266
|
});
|
|
267
267
|
U.displayName = "Slider";
|
|
268
268
|
function Y({
|
|
269
|
-
slidesPerView:
|
|
270
|
-
childIndex:
|
|
269
|
+
slidesPerView: e,
|
|
270
|
+
childIndex: i,
|
|
271
271
|
centerMode: n,
|
|
272
272
|
childrenCount: a,
|
|
273
273
|
haveContainerPadding: t
|
|
274
274
|
}) {
|
|
275
|
-
const c =
|
|
275
|
+
const c = i % Math.floor(e) === 0, m = e % 1 !== 0, s = i === 0, l = i === a - 1;
|
|
276
276
|
if (!c) return "none";
|
|
277
277
|
if (n) {
|
|
278
|
-
if (
|
|
279
|
-
if (
|
|
278
|
+
if (m && !t) {
|
|
279
|
+
if (s) return "start";
|
|
280
280
|
if (l) return "end";
|
|
281
281
|
}
|
|
282
282
|
return "center";
|
|
283
283
|
}
|
|
284
284
|
return "start";
|
|
285
285
|
}
|
|
286
|
-
const st = (
|
|
287
|
-
const { children:
|
|
286
|
+
const st = (e) => {
|
|
287
|
+
const { children: i, className: n, style: a, ...t } = e, {
|
|
288
288
|
slidesPerView: c = 1,
|
|
289
|
-
spaceBetween:
|
|
290
|
-
centerMode:
|
|
289
|
+
spaceBetween: m = 0,
|
|
290
|
+
centerMode: s = !1,
|
|
291
291
|
containerXPadding: l = 0,
|
|
292
292
|
childrenCount: g = 0,
|
|
293
|
-
sliderId:
|
|
294
|
-
} = A(), d = W(null), [
|
|
293
|
+
sliderId: f
|
|
294
|
+
} = A(), d = W(null), [k, h] = b(0);
|
|
295
295
|
return C(() => {
|
|
296
296
|
d.current && h(
|
|
297
297
|
Array.prototype.indexOf.call(
|
|
298
|
-
document.querySelectorAll(`[id='slide-item-${
|
|
298
|
+
document.querySelectorAll(`[id='slide-item-${f}']`),
|
|
299
299
|
d.current
|
|
300
300
|
)
|
|
301
301
|
);
|
|
@@ -304,21 +304,21 @@ const st = (i) => {
|
|
|
304
304
|
{
|
|
305
305
|
...t,
|
|
306
306
|
ref: d,
|
|
307
|
-
id: `slide-item-${
|
|
307
|
+
id: `slide-item-${f}`,
|
|
308
308
|
className: p("dgs-ui-kit-shrink-0 dgs-ui-kit-snap-normal", n),
|
|
309
309
|
style: {
|
|
310
310
|
width: 100 / (c ?? 1) + "%",
|
|
311
|
-
paddingLeft:
|
|
311
|
+
paddingLeft: m,
|
|
312
312
|
scrollSnapAlign: Y({
|
|
313
313
|
slidesPerView: c,
|
|
314
|
-
childIndex:
|
|
315
|
-
centerMode:
|
|
314
|
+
childIndex: k,
|
|
315
|
+
centerMode: s,
|
|
316
316
|
childrenCount: g || 0,
|
|
317
317
|
haveContainerPadding: l > 0
|
|
318
318
|
}),
|
|
319
319
|
...a
|
|
320
320
|
},
|
|
321
|
-
children:
|
|
321
|
+
children: i
|
|
322
322
|
}
|
|
323
323
|
);
|
|
324
324
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";const e=require("react/jsx-runtime"),y=require("./clsx-C11secjj.cjs"),n=require("react"),D=require("./ArrowLeft2-B76dkC-C.cjs"),q=require("./ArrowRight2-CYowPzS8.cjs"),T=require("./Button/index.cjs"),A=n.createContext({slidesPerView:1,spaceBetween:0,navigationVariant:"outside",showNavigationDots:!0,showPaginationText:!1,childrenCount:0,sliderId:""}),I=()=>n.useContext(A);function O({active:i,autoplay:s,variant:r="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"}[r],i?"dgs-ui-kit-w-[22px]":"dgs-ui-kit-w-[6px]",s?"dgs-ui-kit-p-[1px]":""]}const V=i=>{const{active:s,onClick:r,onNavigateToNext:d}=i,{autoplay:t,navigationVariant:g="outside"}=I(),[x,o]=n.useState(0);return n.useEffect(()=>{if(!s||!t)return;const u=typeof t=="boolean"?7e3:t?.delay??7e3;let f=Date.now();const k=setInterval(()=>{const l=Date.now()-f,v=l/u*100;o(Math.min(v,100)),l>=u&&typeof d=="function"&&(d(),o(0),clearInterval(k))},100);return function(){return o(0),f=Date.now(),clearInterval(k)}},[s,t,d]),e.jsx("button",{className:y.clsx("dgs-ui-kit-rounded-full dgs-ui-kit-overflow-hidden dgs-ui-kit-transition-all dgs-ui-kit-h-[6px]",O({active:s,autoplay:t,variant:g})),onClick:r,children:s&&e.jsx("div",{className:y.clsx("dgs-ui-kit-h-full dgs-ui-kit-rounded-full",{"dgs-ui-kit-bg-white":g==="inside","dgs-ui-kit-bg-gray-700":g==="outside"}),style:{width:t?`${x}%`:"100%"}})})},F=i=>{const{onNavigate:s,slideIndex:r,slidesCount:d}=i,{navigationButtonsShowType:t="hide",dotsClassName:g,navigationContainerClassName:x,navigationVariant:o="outside",showNavigationDots:u=!0,showPaginationText:f}=I(),k=e.jsxs("div",{className:y.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(T,{type:"button",variant:"secondary",onClick:()=>s(r-1),rightIcon:e.jsx(q.ArrowRight2Icon,{})}),e.jsx(T,{type:"button",variant:"secondary",onClick:()=>s(r+1),rightIcon:e.jsx(D.ArrowLeft2Icon,{})})]});return e.jsxs(e.Fragment,{children:[t&&t!=="hide"&&t==="onSides"&&k,e.jsxs("div",{className:y.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")},x),children:[t&&t!=="hide"&&t!=="onSides"&&k,(u||f)&&e.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-gap-3",children:[f&&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:y.clsx("dgs-ui-kit-font-bold",{"dgs-ui-kit-text-gray-600":o==="outside","dgs-ui-kit-text-white":o==="inside"}),children:r+1}),e.jsx("span",{children:"از"}),e.jsx("span",{children:d})]}),u&&e.jsx("div",{className:y.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-justify-center dgs-ui-kit-gap-2",g),children:Array.from(Array(d).keys()).map((l,v)=>e.jsx(V,{active:r===v,onClick:()=>s(v),onNavigateToNext:()=>s(r+1)},l+d))})]})]})]})},L=n.forwardRef((i,s)=>{const[r,d]=n.useState(i),{className:t="",containerClassName:g="",showNavigationDots:x=!0,slidesPerView:o=1,navigationButtonsShowType:u="hide",spaceBetween:f=0,showPaginationText:k,onSlideIndexChange:l,initialSlide:v,containerXPadding:h=0}=r,[C,j]=n.useState(0),[P,R]=n.useState(0),W=Object.fromEntries(Object.entries(r).filter(([a])=>a!=="children")),c=n.useRef(null),m=Math.ceil(P/Math.floor(o)),E=(x||u&&u!=="hide"||k)&&m>1;function M(a){if(Math.ceil(Math.abs(a.currentTarget.scrollLeft))+a.currentTarget.clientWidth+1+h>=a.currentTarget.scrollWidth){j(m-1);return}const p=a.currentTarget.scrollWidth-h*2,w=p/m,N=(p-a.currentTarget.scrollLeft-h)/w;if(N<=m){j(0);return}j(Math.round(N%m))}function S(a){if(!c.current)return;const p=c.current.offsetWidth,w=C-a,N=c.current.scrollWidth/m,B=w*N;a<0?c.current.scrollTo({behavior:"smooth",left:-(p*m)}):a>=m?c.current.scrollTo({behavior:"smooth",left:0}):c.current.scrollBy({behavior:"smooth",left:B})}function b(){const p=Object.keys(i.responsive).sort().findLast(N=>Number(N)<=window.innerWidth),w=p?i.responsive[Number(p)]:null;d(w?{...r,...w}:i)}return n.useImperativeHandle(s,()=>({element:c.current,navigate:a=>S(Math.max(0,a-1))})),n.useEffect(()=>{if(!c.current)return;let a=c.current.childElementCount;h>0&&(a-=2),R(a)},[i.children,c,h]),n.useEffect(()=>{if(!(!i.responsive||Object.keys(i.responsive).length<=0))return b(),window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)}},[i.responsive]),n.useEffect(()=>{l&&typeof l=="function"&&l(C)},[C]),n.useEffect(()=>{typeof v=="number"&&c.current&&S(Math.max(0,v-1))},[v,c.current]),e.jsx(A.Provider,{value:{...W,childrenCount:P,sliderId:n.useId()},children:e.jsxs("div",{className:y.clsx("dgs-ui-kit-overflow-hidden dgs-ui-kit-relative dgs-ui-kit-group",t),style:{direction:"rtl"},children:[e.jsxs("div",{className:y.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:M,ref:c,children:[h>0&&e.jsx("div",{className:"dgs-ui-kit-shrink-0",style:{width:h,paddingLeft:f}}),i.children,h>0&&e.jsx("div",{className:"dgs-ui-kit-shrink-0",style:{width:h,paddingLeft:f}})]}),E&&e.jsx(F,{onNavigate:S,slideIndex:C,slidesCount:m})]})})});L.displayName="Slider";function K({slidesPerView:i,childIndex:s,centerMode:r,childrenCount:d,haveContainerPadding:t}){const g=s%Math.floor(i)===0,x=i%1!==0,o=s===0,u=s===d-1;if(!g)return"none";if(r){if(x&&!t){if(o)return"start";if(u)return"end"}return"center"}return"start"}const $=i=>{const{children:s,className:r,style:d,...t}=i,{slidesPerView:g=1,spaceBetween:x=0,centerMode:o=!1,containerXPadding:u=0,childrenCount:f=0,sliderId:k}=I(),l=n.useRef(null),[v,h]=n.useState(0);return n.useEffect(()=>{l.current&&h(Array.prototype.indexOf.call(document.querySelectorAll(`[id='slide-item-${k}']`),l.current))},[l,f,u]),e.jsx("div",{...t,ref:l,id:`slide-item-${k}`,className:y.clsx("dgs-ui-kit-shrink-0 dgs-ui-kit-snap-normal",r),style:{width:100/(g??1)+"%",paddingLeft:x,scrollSnapAlign:K({slidesPerView:g,childIndex:v,centerMode:o,childrenCount:f||0,haveContainerPadding:u>0}),...d},children:s})};exports.Slide=$;exports.Slider=L;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationDot.d.ts","sourceRoot":"","sources":["../../src/components/Slider/NavigationDot.tsx"],"names":[],"mappings":"AAKA,UAAU,kBAAkB;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/B;AAuBD,QAAA,MAAM,aAAa,UAAW,kBAAkB,
|
|
1
|
+
{"version":3,"file":"NavigationDot.d.ts","sourceRoot":"","sources":["../../src/components/Slider/NavigationDot.tsx"],"names":[],"mappings":"AAKA,UAAU,kBAAkB;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/B;AAuBD,QAAA,MAAM,aAAa,UAAW,kBAAkB,4CAgD/C,CAAC;AAEF,eAAe,aAAa,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-S7dYK-Ve.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-S7dYK-Ve.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-Bkfv_374.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-h2OqEiNN.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";const e=require("react/jsx-runtime"),y=require("./clsx-C11secjj.cjs"),n=require("react"),D=require("./ArrowLeft2-B76dkC-C.cjs"),q=require("./ArrowRight2-CYowPzS8.cjs"),T=require("./Button/index.cjs"),A=n.createContext({slidesPerView:1,spaceBetween:0,navigationVariant:"outside",showNavigationDots:!0,showPaginationText:!1,childrenCount:0,sliderId:""}),P=()=>n.useContext(A);function O({active:i,autoplay:s,variant:r="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"}[r],i?"dgs-ui-kit-w-[22px]":"dgs-ui-kit-w-[6px]",s?"dgs-ui-kit-p-[1px]":""]}const V=i=>{const{active:s,onClick:r,onNavigateToNext:d}=i,{autoplay:t,navigationVariant:g="outside"}=P(),[v,a]=n.useState(0);return n.useEffect(()=>{if(!s||!t)return;const l=typeof t=="boolean"?7e3:t?.delay??7e3;let f=Date.now();const x=setInterval(()=>{const u=Date.now()-f,k=u/l*100;a(Math.min(k,100)),u>=l&&typeof d=="function"&&d()},100);return function(){return a(0),f=Date.now(),clearInterval(x)}},[s,t,d]),e.jsx("button",{className:y.clsx("dgs-ui-kit-rounded-full dgs-ui-kit-overflow-hidden dgs-ui-kit-transition-all dgs-ui-kit-h-[6px]",O({active:s,autoplay:t,variant:g})),onClick:r,children:s&&e.jsx("div",{className:y.clsx("dgs-ui-kit-h-full dgs-ui-kit-rounded-full",{"dgs-ui-kit-bg-white":g==="inside","dgs-ui-kit-bg-gray-700":g==="outside"}),style:{width:t?`${v}%`:"100%"}})})},F=i=>{const{onNavigate:s,slideIndex:r,slidesCount:d}=i,{navigationButtonsShowType:t="hide",dotsClassName:g,navigationContainerClassName:v,navigationVariant:a="outside",showNavigationDots:l=!0,showPaginationText:f}=P(),x=e.jsxs("div",{className:y.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%]":a==="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(T,{type:"button",variant:"secondary",onClick:()=>s(r-1),rightIcon:e.jsx(q.ArrowRight2Icon,{})}),e.jsx(T,{type:"button",variant:"secondary",onClick:()=>s(r+1),rightIcon:e.jsx(D.ArrowLeft2Icon,{})})]});return e.jsxs(e.Fragment,{children:[t&&t!=="hide"&&t==="onSides"&&x,e.jsxs("div",{className:y.clsx("dgs-ui-kit-flex",{"dgs-ui-kit-items-center dgs-ui-kit-mt-2":a==="outside","dgs-ui-kit-absolute dgs-ui-kit-bottom-4 dgs-ui-kit-w-full dgs-ui-kit-justify-center":a==="inside","dgs-ui-kit-justify-between":a==="outside"&&t!=="hide"&&t!=="onSides","dgs-ui-kit-justify-center":a==="outside"&&(t==="hide"||t==="onSides")},v),children:[t&&t!=="hide"&&t!=="onSides"&&x,(l||f)&&e.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-gap-3",children:[f&&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:y.clsx("dgs-ui-kit-font-bold",{"dgs-ui-kit-text-gray-600":a==="outside","dgs-ui-kit-text-white":a==="inside"}),children:r+1}),e.jsx("span",{children:"از"}),e.jsx("span",{children:d})]}),l&&e.jsx("div",{className:y.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-justify-center dgs-ui-kit-gap-2",g),children:Array.from(Array(d).keys()).map((u,k)=>e.jsx(V,{active:r===k,onClick:()=>s(k),onNavigateToNext:()=>s(r+1)},u+d))})]})]})]})},L=n.forwardRef((i,s)=>{const[r,d]=n.useState(i),{className:t="",containerClassName:g="",showNavigationDots:v=!0,slidesPerView:a=1,navigationButtonsShowType:l="hide",spaceBetween:f=0,showPaginationText:x,onSlideIndexChange:u,initialSlide:k,containerXPadding:h=0}=r,[C,j]=n.useState(0),[I,R]=n.useState(0),W=Object.fromEntries(Object.entries(r).filter(([o])=>o!=="children")),c=n.useRef(null),m=Math.ceil(I/Math.floor(a)),E=(v||l&&l!=="hide"||x)&&m>1;function M(o){if(Math.ceil(Math.abs(o.currentTarget.scrollLeft))+o.currentTarget.clientWidth+1+h>=o.currentTarget.scrollWidth){j(m-1);return}const p=o.currentTarget.scrollWidth-h*2,w=p/m,N=(p-o.currentTarget.scrollLeft-h)/w;if(N<=m){j(0);return}j(Math.round(N%m))}function S(o){if(!c.current)return;const p=c.current.offsetWidth,w=C-o,N=c.current.scrollWidth/m,B=w*N;o<0?c.current.scrollTo({behavior:"smooth",left:-(p*m)}):o>=m?c.current.scrollTo({behavior:"smooth",left:0}):c.current.scrollBy({behavior:"smooth",left:B})}function b(){const p=Object.keys(i.responsive).sort().findLast(N=>Number(N)<=window.innerWidth),w=p?i.responsive[Number(p)]:null;d(w?{...r,...w}:i)}return n.useImperativeHandle(s,()=>({element:c.current,navigate:o=>S(Math.max(0,o-1))})),n.useEffect(()=>{if(!c.current)return;let o=c.current.childElementCount;h>0&&(o-=2),R(o)},[i.children,c,h]),n.useEffect(()=>{if(!(!i.responsive||Object.keys(i.responsive).length<=0))return b(),window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)}},[i.responsive]),n.useEffect(()=>{u&&typeof u=="function"&&u(C)},[C]),n.useEffect(()=>{typeof k=="number"&&c.current&&S(Math.max(0,k-1))},[k,c.current]),e.jsx(A.Provider,{value:{...W,childrenCount:I,sliderId:n.useId()},children:e.jsxs("div",{className:y.clsx("dgs-ui-kit-overflow-hidden dgs-ui-kit-relative dgs-ui-kit-group",t),style:{direction:"rtl"},children:[e.jsxs("div",{className:y.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:M,ref:c,children:[h>0&&e.jsx("div",{className:"dgs-ui-kit-shrink-0",style:{width:h,paddingLeft:f}}),i.children,h>0&&e.jsx("div",{className:"dgs-ui-kit-shrink-0",style:{width:h,paddingLeft:f}})]}),E&&e.jsx(F,{onNavigate:S,slideIndex:C,slidesCount:m})]})})});L.displayName="Slider";function K({slidesPerView:i,childIndex:s,centerMode:r,childrenCount:d,haveContainerPadding:t}){const g=s%Math.floor(i)===0,v=i%1!==0,a=s===0,l=s===d-1;if(!g)return"none";if(r){if(v&&!t){if(a)return"start";if(l)return"end"}return"center"}return"start"}const $=i=>{const{children:s,className:r,style:d,...t}=i,{slidesPerView:g=1,spaceBetween:v=0,centerMode:a=!1,containerXPadding:l=0,childrenCount:f=0,sliderId:x}=P(),u=n.useRef(null),[k,h]=n.useState(0);return n.useEffect(()=>{u.current&&h(Array.prototype.indexOf.call(document.querySelectorAll(`[id='slide-item-${x}']`),u.current))},[u,f,l]),e.jsx("div",{...t,ref:u,id:`slide-item-${x}`,className:y.clsx("dgs-ui-kit-shrink-0 dgs-ui-kit-snap-normal",r),style:{width:100/(g??1)+"%",paddingLeft:v,scrollSnapAlign:K({slidesPerView:g,childIndex:k,centerMode:a,childrenCount:f||0,haveContainerPadding:l>0}),...d},children:s})};exports.Slide=$;exports.Slider=L;
|