@dgshahr/ui-kit 0.0.35 → 0.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),f=require("../../clsx-C11secjj.cjs"),w=require("react"),y=require("../../TextFieldWrapper-BbzQMKCb.cjs"),R=t=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 24 24",...t,children:[e.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"m15.456 9.595-5.852 5.852-1.061-1.06 5.853-5.853z",clipRule:"evenodd"}),e.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"m9.6 8.532 5.856 5.858-1.06 1.06-5.857-5.857z",clipRule:"evenodd"}),e.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12m10-8.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17",clipRule:"evenodd"})]}),N=t=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 24 24",...t,children:[e.jsx("path",{fill:"currentColor",d:"M12.247 20.812c-4.033 0-7.654-2.828-9.686-7.558a.75.75 0 0 1 0-.592c2.034-4.732 5.655-7.557 9.687-7.557s7.657 2.825 9.69 7.557a.75.75 0 0 1 0 .592c-2.032 4.73-5.653 7.554-9.685 7.557zm-8.182-7.853c1.806 3.983 4.846 6.352 8.18 6.352 3.334.002 6.373-2.369 8.18-6.352-1.808-3.986-4.848-6.354-8.182-6.354s-6.37 2.368-8.176 6.354z"}),e.jsx("path",{fill:"currentColor",d:"M12.247 16.789a3.825 3.825 0 1 1 0-7.651 3.825 3.825 0 0 1 0 7.65m0-6.152a2.326 2.326 0 1 0 0 4.651 2.326 2.326 0 0 0 0-4.651"})]}),I=t=>e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 24 24",...t,children:e.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M20.417 3.22a.75.75 0 0 1 0 1.06L4.643 20.055a.744.744 0 0 1-1.06 0 .75.75 0 0 1 0-1.06l1.972-1.971c-1.413-1.293-2.613-3.036-3.493-5.089a.75.75 0 0 1 0-.593C3.082 8.977 4.52 7.02 6.22 5.683c3.292-2.606 7.621-2.744 11.048-.375l2.088-2.088a.75.75 0 0 1 1.06 0m-.37 4.82c.724.962 1.36 2.073 1.891 3.299a.74.74 0 0 1 0 .595C19.842 16.79 16.128 19.69 12 19.69a8.8 8.8 0 0 1-2.769-.451.75.75 0 0 1 .474-1.424A7.3 7.3 0 0 0 12 18.19c3.428 0 6.561-2.442 8.43-6.553a14.5 14.5 0 0 0-1.58-2.694.75.75 0 0 1 1.197-.902M7.15 6.862c-1.437 1.13-2.67 2.776-3.58 4.778.794 1.752 1.836 3.23 3.047 4.322l2.138-2.138a3.87 3.87 0 0 1-.67-2.184A3.92 3.92 0 0 1 12 7.722a3.9 3.9 0 0 1 2.187.669l2.001-2.002c-2.853-1.844-6.325-1.676-9.038.472m8.088 4.6a.75.75 0 0 1 .606.872 3.92 3.92 0 0 1-3.141 3.147.75.75 0 0 1-.268-1.476 2.41 2.41 0 0 0 1.932-1.937.754.754 0 0 1 .87-.606M12 9.221a2.418 2.418 0 0 0-2.152 3.509l3.245-3.246A2.4 2.4 0 0 0 12 9.222",clipRule:"evenodd"})}),M=w.forwardRef(function(n,j){const{dir:s="rtl",placeholderDir:C=s,containerClassName:k,leftIcon:d,prefix:u,postfix:x,isClearOption:g,onClear:h,...r}=n,[o,v]=w.useState(r.type);function p(a){return e.jsx("button",{onClick:()=>{a(""),typeof h=="function"&&h()},children:e.jsx(R,{className:"dgs-ui-kit-text-gray-600",width:20,height:20})})}return e.jsx(y.TextFieldWrapper,{...n,containerClassName:f.clsx("dgs-ui-kit-items-center",k),children:({handleChangeField:a,value:i,setValue:m})=>e.jsxs(e.Fragment,{children:[u&&e.jsx("span",{className:"dgs-ui-kit-font-p1-regular dgs-ui-kit-text-gray-500",children:u}),g&&i&&i.length>0&&s==="ltr"&&p(m),e.jsx("input",{...r,ref:j,className:f.clsx("dgs-ui-kit-bg-transparent focus:dgs-ui-kit-outline-none dgs-ui-kit-flex-1",s==="rtl"?"dgs-ui-kit-text-right":"!dgs-ui-kit-text-left",C==="rtl"?"placeholder:dgs-ui-kit-text-right":"placeholder:dgs-ui-kit-text-left",{ss02:r.type!="password"},n.className),...s==="ltr"?{style:{direction:"ltr"}}:{},value:i,onChange:a,type:o,onInput:c=>{if(o!=="number")return;const l=c.currentTarget;l.value.length>l.maxLength&&(l.value=l.value.slice(0,l.maxLength))}}),g&&i&&i.length>0&&s==="rtl"&&p(m),x&&e.jsx("span",{className:"dgs-ui-kit-font-p1-regular dgs-ui-kit-text-gray-500",children:x}),d&&e.jsx("div",{className:"dgs-ui-kit-text-gray-600",children:d}),r.type==="password"&&e.jsx("button",{onClick:()=>v(c=>c==="text"?"password":"text"),className:"dgs-ui-kit-text-gray-600",children:o==="password"?e.jsx(N,{width:20,height:20}):e.jsx(I,{width:20,height:20})})]})})});module.exports=M;
1
+ "use strict";const e=require("react/jsx-runtime"),m=require("../../clsx-C11secjj.cjs"),w=require("react"),y=require("../../TextFieldWrapper-BbzQMKCb.cjs"),R=t=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 24 24",...t,children:[e.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"m15.456 9.595-5.852 5.852-1.061-1.06 5.853-5.853z",clipRule:"evenodd"}),e.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"m9.6 8.532 5.856 5.858-1.06 1.06-5.857-5.857z",clipRule:"evenodd"}),e.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12m10-8.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17",clipRule:"evenodd"})]}),I=t=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 24 24",...t,children:[e.jsx("path",{fill:"currentColor",d:"M12.247 20.812c-4.033 0-7.654-2.828-9.686-7.558a.75.75 0 0 1 0-.592c2.034-4.732 5.655-7.557 9.687-7.557s7.657 2.825 9.69 7.557a.75.75 0 0 1 0 .592c-2.032 4.73-5.653 7.554-9.685 7.557zm-8.182-7.853c1.806 3.983 4.846 6.352 8.18 6.352 3.334.002 6.373-2.369 8.18-6.352-1.808-3.986-4.848-6.354-8.182-6.354s-6.37 2.368-8.176 6.354z"}),e.jsx("path",{fill:"currentColor",d:"M12.247 16.789a3.825 3.825 0 1 1 0-7.651 3.825 3.825 0 0 1 0 7.65m0-6.152a2.326 2.326 0 1 0 0 4.651 2.326 2.326 0 0 0 0-4.651"})]}),N=t=>e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 24 24",...t,children:e.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M20.417 3.22a.75.75 0 0 1 0 1.06L4.643 20.055a.744.744 0 0 1-1.06 0 .75.75 0 0 1 0-1.06l1.972-1.971c-1.413-1.293-2.613-3.036-3.493-5.089a.75.75 0 0 1 0-.593C3.082 8.977 4.52 7.02 6.22 5.683c3.292-2.606 7.621-2.744 11.048-.375l2.088-2.088a.75.75 0 0 1 1.06 0m-.37 4.82c.724.962 1.36 2.073 1.891 3.299a.74.74 0 0 1 0 .595C19.842 16.79 16.128 19.69 12 19.69a8.8 8.8 0 0 1-2.769-.451.75.75 0 0 1 .474-1.424A7.3 7.3 0 0 0 12 18.19c3.428 0 6.561-2.442 8.43-6.553a14.5 14.5 0 0 0-1.58-2.694.75.75 0 0 1 1.197-.902M7.15 6.862c-1.437 1.13-2.67 2.776-3.58 4.778.794 1.752 1.836 3.23 3.047 4.322l2.138-2.138a3.87 3.87 0 0 1-.67-2.184A3.92 3.92 0 0 1 12 7.722a3.9 3.9 0 0 1 2.187.669l2.001-2.002c-2.853-1.844-6.325-1.676-9.038.472m8.088 4.6a.75.75 0 0 1 .606.872 3.92 3.92 0 0 1-3.141 3.147.75.75 0 0 1-.268-1.476 2.41 2.41 0 0 0 1.932-1.937.754.754 0 0 1 .87-.606M12 9.221a2.418 2.418 0 0 0-2.152 3.509l3.245-3.246A2.4 2.4 0 0 0 12 9.222",clipRule:"evenodd"})}),M=w.forwardRef(function(o,j){const{dir:s="rtl",placeholderDir:C=s,containerClassName:k,leftIcon:d,prefix:u,postfix:x,isClearOption:g,onClear:h,...i}=o,[c,v]=w.useState(i.type);function p(a){return e.jsx("button",{onClick:()=>{a(""),typeof h=="function"&&h()},children:e.jsx(R,{className:"dgs-ui-kit-text-gray-600",width:20,height:20})})}return e.jsx(y.TextFieldWrapper,{...o,containerClassName:m.clsx("dgs-ui-kit-items-center",k),children:({handleChangeField:a,value:l,setValue:f})=>e.jsxs(e.Fragment,{children:[u&&e.jsx("span",{className:"dgs-ui-kit-font-p1-regular dgs-ui-kit-text-gray-500",children:u}),g&&l&&l.length>0&&s==="ltr"&&p(f),e.jsx("input",{...i,ref:j,className:m.clsx("dgs-ui-kit-bg-transparent focus:dgs-ui-kit-outline-none dgs-ui-kit-flex-1",s==="rtl"?"dgs-ui-kit-text-right":"!dgs-ui-kit-text-left",C==="rtl"?"placeholder:dgs-ui-kit-text-right":"placeholder:dgs-ui-kit-text-left",{ss02:i.type!="password"},o.className),...s==="ltr"?{style:{direction:"ltr"}}:{},value:l,onChange:a,type:c,onInput:r=>{if(c!=="number")return;const n=r.currentTarget;n.value.length>n.maxLength&&(n.value=n.value.slice(0,n.maxLength)),typeof i.onInput=="function"&&i.onInput(r)}}),g&&l&&l.length>0&&s==="rtl"&&p(f),x&&e.jsx("span",{className:"dgs-ui-kit-font-p1-regular dgs-ui-kit-text-gray-500",children:x}),d&&e.jsx("div",{className:"dgs-ui-kit-text-gray-600",children:d}),i.type==="password"&&e.jsx("button",{onClick:()=>v(r=>r==="text"?"password":"text"),className:"dgs-ui-kit-text-gray-600",children:c==="password"?e.jsx(I,{width:20,height:20}):e.jsx(N,{width:20,height:20})})]})})});module.exports=M;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Input/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,mBAAmB,EAAwB,MAAM,OAAO,CAAC;AAK1F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAExF,UAAU,UACR,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC,EACxD,kBAAkB;IACpB,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,QAAA,MAAM,KAAK,yGAuGT,CAAC;AACH,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Input/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,mBAAmB,EAAwB,MAAM,OAAO,CAAC;AAK1F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAExF,UAAU,UACR,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC,EACxD,kBAAkB;IACpB,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,QAAA,MAAM,KAAK,yGAwGT,CAAC;AACH,eAAe,KAAK,CAAC"}
@@ -1,8 +1,8 @@
1
- import { jsxs as c, jsx as e, Fragment as N } from "react/jsx-runtime";
1
+ import { jsxs as c, jsx as t, Fragment as I } from "react/jsx-runtime";
2
2
  import { c as w } from "../../clsx-OuTLNxxd.js";
3
- import { forwardRef as R, useState as I } from "react";
3
+ import { forwardRef as N, useState as R } from "react";
4
4
  import { T as M } from "../../TextFieldWrapper-D9d-4wo1.js";
5
- const b = (t) => /* @__PURE__ */ c(
5
+ const b = (e) => /* @__PURE__ */ c(
6
6
  "svg",
7
7
  {
8
8
  xmlns: "http://www.w3.org/2000/svg",
@@ -10,9 +10,9 @@ const b = (t) => /* @__PURE__ */ c(
10
10
  height: "1em",
11
11
  fill: "none",
12
12
  viewBox: "0 0 24 24",
13
- ...t,
13
+ ...e,
14
14
  children: [
15
- /* @__PURE__ */ e(
15
+ /* @__PURE__ */ t(
16
16
  "path",
17
17
  {
18
18
  fill: "currentColor",
@@ -21,7 +21,7 @@ const b = (t) => /* @__PURE__ */ c(
21
21
  clipRule: "evenodd"
22
22
  }
23
23
  ),
24
- /* @__PURE__ */ e(
24
+ /* @__PURE__ */ t(
25
25
  "path",
26
26
  {
27
27
  fill: "currentColor",
@@ -30,7 +30,7 @@ const b = (t) => /* @__PURE__ */ c(
30
30
  clipRule: "evenodd"
31
31
  }
32
32
  ),
33
- /* @__PURE__ */ e(
33
+ /* @__PURE__ */ t(
34
34
  "path",
35
35
  {
36
36
  fill: "currentColor",
@@ -41,7 +41,7 @@ const b = (t) => /* @__PURE__ */ c(
41
41
  )
42
42
  ]
43
43
  }
44
- ), z = (t) => /* @__PURE__ */ c(
44
+ ), z = (e) => /* @__PURE__ */ c(
45
45
  "svg",
46
46
  {
47
47
  xmlns: "http://www.w3.org/2000/svg",
@@ -49,16 +49,16 @@ const b = (t) => /* @__PURE__ */ c(
49
49
  height: "1em",
50
50
  fill: "none",
51
51
  viewBox: "0 0 24 24",
52
- ...t,
52
+ ...e,
53
53
  children: [
54
- /* @__PURE__ */ e(
54
+ /* @__PURE__ */ t(
55
55
  "path",
56
56
  {
57
57
  fill: "currentColor",
58
58
  d: "M12.247 20.812c-4.033 0-7.654-2.828-9.686-7.558a.75.75 0 0 1 0-.592c2.034-4.732 5.655-7.557 9.687-7.557s7.657 2.825 9.69 7.557a.75.75 0 0 1 0 .592c-2.032 4.73-5.653 7.554-9.685 7.557zm-8.182-7.853c1.806 3.983 4.846 6.352 8.18 6.352 3.334.002 6.373-2.369 8.18-6.352-1.808-3.986-4.848-6.354-8.182-6.354s-6.37 2.368-8.176 6.354z"
59
59
  }
60
60
  ),
61
- /* @__PURE__ */ e(
61
+ /* @__PURE__ */ t(
62
62
  "path",
63
63
  {
64
64
  fill: "currentColor",
@@ -67,7 +67,7 @@ const b = (t) => /* @__PURE__ */ c(
67
67
  )
68
68
  ]
69
69
  }
70
- ), B = (t) => /* @__PURE__ */ e(
70
+ ), B = (e) => /* @__PURE__ */ t(
71
71
  "svg",
72
72
  {
73
73
  xmlns: "http://www.w3.org/2000/svg",
@@ -75,8 +75,8 @@ const b = (t) => /* @__PURE__ */ c(
75
75
  height: "1em",
76
76
  fill: "none",
77
77
  viewBox: "0 0 24 24",
78
- ...t,
79
- children: /* @__PURE__ */ e(
78
+ ...e,
79
+ children: /* @__PURE__ */ t(
80
80
  "path",
81
81
  {
82
82
  fill: "currentColor",
@@ -86,7 +86,7 @@ const b = (t) => /* @__PURE__ */ c(
86
86
  }
87
87
  )
88
88
  }
89
- ), j = R(function(s, C) {
89
+ ), j = N(function(s, C) {
90
90
  const {
91
91
  dir: l = "rtl",
92
92
  placeholderDir: k = l,
@@ -95,17 +95,17 @@ const b = (t) => /* @__PURE__ */ c(
95
95
  prefix: g,
96
96
  postfix: h,
97
97
  isClearOption: p,
98
- onClear: m,
99
- ...n
100
- } = s, [o, y] = I(n.type);
101
- function f(a) {
102
- return /* @__PURE__ */ e(
98
+ onClear: f,
99
+ ...i
100
+ } = s, [a, y] = R(i.type);
101
+ function m(d) {
102
+ return /* @__PURE__ */ t(
103
103
  "button",
104
104
  {
105
105
  onClick: () => {
106
- a(""), typeof m == "function" && m();
106
+ d(""), typeof f == "function" && f();
107
107
  },
108
- children: /* @__PURE__ */ e(
108
+ children: /* @__PURE__ */ t(
109
109
  b,
110
110
  {
111
111
  className: "dgs-ui-kit-text-gray-600",
@@ -116,54 +116,54 @@ const b = (t) => /* @__PURE__ */ c(
116
116
  }
117
117
  );
118
118
  }
119
- return /* @__PURE__ */ e(
119
+ return /* @__PURE__ */ t(
120
120
  M,
121
121
  {
122
122
  ...s,
123
123
  containerClassName: w("dgs-ui-kit-items-center", v),
124
- children: ({ handleChangeField: a, value: i, setValue: x }) => /* @__PURE__ */ c(N, { children: [
125
- g && /* @__PURE__ */ e("span", { className: "dgs-ui-kit-font-p1-regular dgs-ui-kit-text-gray-500", children: g }),
126
- p && i && i.length > 0 && l === "ltr" && f(x),
127
- /* @__PURE__ */ e(
124
+ children: ({ handleChangeField: d, value: n, setValue: x }) => /* @__PURE__ */ c(I, { children: [
125
+ g && /* @__PURE__ */ t("span", { className: "dgs-ui-kit-font-p1-regular dgs-ui-kit-text-gray-500", children: g }),
126
+ p && n && n.length > 0 && l === "ltr" && m(x),
127
+ /* @__PURE__ */ t(
128
128
  "input",
129
129
  {
130
- ...n,
130
+ ...i,
131
131
  ref: C,
132
132
  className: w(
133
133
  "dgs-ui-kit-bg-transparent focus:dgs-ui-kit-outline-none dgs-ui-kit-flex-1",
134
134
  l === "rtl" ? "dgs-ui-kit-text-right" : "!dgs-ui-kit-text-left",
135
135
  k === "rtl" ? "placeholder:dgs-ui-kit-text-right" : "placeholder:dgs-ui-kit-text-left",
136
136
  {
137
- ss02: n.type != "password"
137
+ ss02: i.type != "password"
138
138
  },
139
139
  s.className
140
140
  ),
141
141
  ...l === "ltr" ? { style: { direction: "ltr" } } : {},
142
- value: i,
143
- onChange: a,
144
- type: o,
145
- onInput: (d) => {
146
- if (o !== "number") return;
147
- const r = d.currentTarget;
148
- r.value.length > r.maxLength && (r.value = r.value.slice(0, r.maxLength));
142
+ value: n,
143
+ onChange: d,
144
+ type: a,
145
+ onInput: (o) => {
146
+ if (a !== "number") return;
147
+ const r = o.currentTarget;
148
+ r.value.length > r.maxLength && (r.value = r.value.slice(0, r.maxLength)), typeof i.onInput == "function" && i.onInput(o);
149
149
  }
150
150
  }
151
151
  ),
152
- p && i && i.length > 0 && l === "rtl" && f(x),
153
- h && /* @__PURE__ */ e("span", { className: "dgs-ui-kit-font-p1-regular dgs-ui-kit-text-gray-500", children: h }),
154
- u && /* @__PURE__ */ e("div", { className: "dgs-ui-kit-text-gray-600", children: u }),
155
- n.type === "password" && /* @__PURE__ */ e(
152
+ p && n && n.length > 0 && l === "rtl" && m(x),
153
+ h && /* @__PURE__ */ t("span", { className: "dgs-ui-kit-font-p1-regular dgs-ui-kit-text-gray-500", children: h }),
154
+ u && /* @__PURE__ */ t("div", { className: "dgs-ui-kit-text-gray-600", children: u }),
155
+ i.type === "password" && /* @__PURE__ */ t(
156
156
  "button",
157
157
  {
158
- onClick: () => y((d) => d === "text" ? "password" : "text"),
158
+ onClick: () => y((o) => o === "text" ? "password" : "text"),
159
159
  className: "dgs-ui-kit-text-gray-600",
160
- children: o === "password" ? /* @__PURE__ */ e(
160
+ children: a === "password" ? /* @__PURE__ */ t(
161
161
  z,
162
162
  {
163
163
  width: 20,
164
164
  height: 20
165
165
  }
166
- ) : /* @__PURE__ */ e(
166
+ ) : /* @__PURE__ */ t(
167
167
  B,
168
168
  {
169
169
  width: 20,
@@ -29,14 +29,14 @@ function G({
29
29
  ];
30
30
  }
31
31
  const J = (i) => {
32
- const { active: e, onClick: n, onNavigateToNext: d } = i, { autoplay: t, navigationVariant: u = "outside" } = A(), [h, o] = b(0);
32
+ const { active: e, onClick: n, onNavigateToNext: d } = i, { autoplay: t, navigationVariant: c = "outside" } = A(), [h, o] = b(0);
33
33
  return C(() => {
34
34
  if (!e || !t) return;
35
35
  const a = typeof t == "boolean" ? 7e3 : t?.delay ?? 7e3;
36
36
  let f = Date.now();
37
37
  const k = setInterval(() => {
38
- const l = Date.now() - f, c = l / a * 100;
39
- o(Math.min(c, 100)), l >= a && typeof d == "function" && d();
38
+ const l = Date.now() - f, g = l / a * 100;
39
+ o(Math.min(g, 100)), l >= a && typeof d == "function" && d();
40
40
  }, 100);
41
41
  return function() {
42
42
  return o(0), f = Date.now(), clearInterval(k);
@@ -46,15 +46,15 @@ const J = (i) => {
46
46
  {
47
47
  className: v(
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: e, autoplay: t, variant: u })
49
+ G({ active: e, autoplay: t, variant: c })
50
50
  ),
51
51
  onClick: n,
52
52
  children: e && /* @__PURE__ */ r(
53
53
  "div",
54
54
  {
55
55
  className: v("dgs-ui-kit-h-full dgs-ui-kit-rounded-full", {
56
- "dgs-ui-kit-bg-white": u === "inside",
57
- "dgs-ui-kit-bg-gray-700": u === "outside"
56
+ "dgs-ui-kit-bg-white": c === "inside",
57
+ "dgs-ui-kit-bg-gray-700": c === "outside"
58
58
  }),
59
59
  style: { width: t ? `${h}%` : "100%" }
60
60
  }
@@ -64,7 +64,7 @@ const J = (i) => {
64
64
  }, Q = (i) => {
65
65
  const { onNavigate: e, slideIndex: n, slidesCount: d } = i, {
66
66
  navigationButtonsShowType: t = "hide",
67
- dotsClassName: u,
67
+ dotsClassName: c,
68
68
  navigationContainerClassName: h,
69
69
  navigationVariant: o = "outside",
70
70
  showNavigationDots: a = !0,
@@ -136,13 +136,13 @@ const J = (i) => {
136
136
  {
137
137
  className: v(
138
138
  "dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-justify-center dgs-ui-kit-gap-2",
139
- u
139
+ c
140
140
  ),
141
- children: Array.from(Array(d).keys()).map((l, c) => /* @__PURE__ */ r(
141
+ children: Array.from(Array(d).keys()).map((l, g) => /* @__PURE__ */ r(
142
142
  J,
143
143
  {
144
- active: n === c,
145
- onClick: () => e(c),
144
+ active: n === g,
145
+ onClick: () => e(g),
146
146
  onNavigateToNext: () => e(n + 1)
147
147
  },
148
148
  l + d
@@ -157,18 +157,18 @@ const J = (i) => {
157
157
  }, U = $((i, e) => {
158
158
  const [n, d] = b(i), {
159
159
  className: t = "",
160
- containerClassName: u = "",
160
+ containerClassName: c = "",
161
161
  showNavigationDots: h = !0,
162
162
  slidesPerView: o = 1,
163
163
  navigationButtonsShowType: a = "hide",
164
164
  spaceBetween: f = 0,
165
165
  showPaginationText: k,
166
166
  onSlideIndexChange: l,
167
- initialSlide: c,
167
+ initialSlide: g,
168
168
  containerXPadding: w = 0
169
169
  } = n, [S, P] = b(0), [j, D] = b(0), R = Object.fromEntries(
170
170
  Object.entries(n).filter(([s]) => s !== "children")
171
- ), g = M(null), m = Math.ceil(j / Math.floor(o)), E = (h || a && a !== "hide" || k) && m > 1;
171
+ ), u = M(null), m = Math.ceil(j / Math.floor(o)), E = (h || a && a !== "hide" || k) && m > 1;
172
172
  function O(s) {
173
173
  if (Math.ceil(Math.abs(s.currentTarget.scrollLeft)) + s.currentTarget.clientWidth + 1 + w >= s.currentTarget.scrollWidth) {
174
174
  P(m - 1);
@@ -182,9 +182,9 @@ const J = (i) => {
182
182
  P(Math.round(x % m));
183
183
  }
184
184
  function I(s) {
185
- if (!g.current) return;
186
- const p = g.current.offsetWidth, N = S - s, x = g.current.scrollWidth / m, V = N * x;
187
- s < 0 ? g.current.scrollTo({ behavior: "smooth", left: -(p * m) }) : s >= m ? g.current.scrollTo({ behavior: "smooth", left: 0 }) : g.current.scrollBy({ behavior: "smooth", left: V });
185
+ if (!u.current) return;
186
+ const p = u.current.offsetWidth, N = S - s, x = u.current.scrollWidth / m, V = N * x;
187
+ s < 0 ? u.current.scrollTo({ behavior: "smooth", left: -(p * m) }) : s >= m ? u.current.scrollTo({ behavior: "smooth", left: 0 }) : u.current.scrollBy({ behavior: "smooth", left: V });
188
188
  }
189
189
  function T() {
190
190
  const p = Object.keys(i.responsive).sort().findLast(
@@ -193,13 +193,13 @@ const J = (i) => {
193
193
  d(N ? { ...n, ...N } : i);
194
194
  }
195
195
  return z(e, () => ({
196
- element: g.current,
196
+ element: u.current,
197
197
  navigate: (s) => I(Math.max(0, s - 1))
198
198
  })), C(() => {
199
- if (!g.current) return;
200
- let s = g.current.childElementCount;
199
+ if (!u.current) return;
200
+ let s = u.current.childElementCount;
201
201
  w > 0 && (s -= 2), D(s);
202
- }, [i.children]), C(() => {
202
+ }, [i.children, u]), C(() => {
203
203
  if (!(!i.responsive || Object.keys(i.responsive).length <= 0))
204
204
  return T(), window.addEventListener("resize", T), () => {
205
205
  window.removeEventListener("resize", T);
@@ -207,8 +207,8 @@ const J = (i) => {
207
207
  }, [i.responsive]), C(() => {
208
208
  l && typeof l == "function" && l(S);
209
209
  }, [S]), C(() => {
210
- typeof c == "number" && g.current && I(Math.max(0, c - 1));
211
- }, [c, g.current]), /* @__PURE__ */ r(B.Provider, { value: { ...R, childrenCount: j, sliderId: X() }, children: /* @__PURE__ */ y(
210
+ typeof g == "number" && u.current && I(Math.max(0, g - 1));
211
+ }, [g, u.current]), /* @__PURE__ */ r(B.Provider, { value: { ...R, childrenCount: j, sliderId: X() }, children: /* @__PURE__ */ y(
212
212
  "div",
213
213
  {
214
214
  className: v(
@@ -222,11 +222,11 @@ const J = (i) => {
222
222
  {
223
223
  className: v(
224
224
  "dgs-ui-kit-flex dgs-ui-kit-snap-x dgs-ui-kit-snap-mandatory dgs-ui-kit-overflow-x-auto no-scrollbar",
225
- u
225
+ c
226
226
  ),
227
227
  style: { marginLeft: -f },
228
228
  onScroll: O,
229
- ref: g,
229
+ ref: u,
230
230
  children: i.children
231
231
  }
232
232
  ),
@@ -250,8 +250,8 @@ function Y({
250
250
  childrenCount: d,
251
251
  haveContainerPadding: t
252
252
  }) {
253
- const u = e % Math.floor(i) === 0, h = i % 1 !== 0, o = e === 0, a = e === d - 1;
254
- if (!u) return "none";
253
+ const c = e % Math.floor(i) === 0, h = i % 1 !== 0, o = e === 0, a = e === d - 1;
254
+ if (!c) return "none";
255
255
  if (n) {
256
256
  if (h && !t) {
257
257
  if (o) return "start";
@@ -263,13 +263,13 @@ function Y({
263
263
  }
264
264
  const st = (i) => {
265
265
  const { children: e, className: n, style: d, ...t } = i, {
266
- slidesPerView: u = 1,
266
+ slidesPerView: c = 1,
267
267
  spaceBetween: h = 0,
268
268
  centerMode: o = !1,
269
269
  containerXPadding: a = 0,
270
270
  childrenCount: f = 0,
271
271
  sliderId: k
272
- } = A(), l = M(null), [c, w] = b(0);
272
+ } = A(), l = M(null), [g, w] = b(0);
273
273
  return C(() => {
274
274
  l.current && w(
275
275
  Array.prototype.indexOf.call(
@@ -277,8 +277,8 @@ const st = (i) => {
277
277
  l.current
278
278
  )
279
279
  );
280
- }, [l]), /* @__PURE__ */ y(W, { children: [
281
- c === 0 && a > 0 && /* @__PURE__ */ r(
280
+ }, [l, f]), /* @__PURE__ */ y(W, { children: [
281
+ g === 0 && a > 0 && /* @__PURE__ */ r(
282
282
  "div",
283
283
  {
284
284
  className: "dgs-ui-kit-shrink-0",
@@ -296,11 +296,11 @@ const st = (i) => {
296
296
  id: `slide-item-${k}`,
297
297
  className: v("dgs-ui-kit-shrink-0 dgs-ui-kit-snap-normal", n),
298
298
  style: {
299
- width: 100 / (u ?? 1) + "%",
299
+ width: 100 / (c ?? 1) + "%",
300
300
  paddingLeft: h,
301
301
  scrollSnapAlign: Y({
302
- slidesPerView: u,
303
- childIndex: c,
302
+ slidesPerView: c,
303
+ childIndex: g,
304
304
  centerMode: o,
305
305
  childrenCount: f || 0,
306
306
  haveContainerPadding: a > 0
@@ -310,7 +310,7 @@ const st = (i) => {
310
310
  children: e
311
311
  }
312
312
  ),
313
- c === f - 1 && a > 0 && /* @__PURE__ */ r(
313
+ g === f - 1 && a > 0 && /* @__PURE__ */ r(
314
314
  "div",
315
315
  {
316
316
  className: "dgs-ui-kit-shrink-0 ",
@@ -1 +1 @@
1
- "use client";"use strict";const e=require("react/jsx-runtime"),m=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 F({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 O=i=>{const{active:s,onClick:r,onNavigateToNext:u}=i,{autoplay:t,navigationVariant:c="outside"}=P(),[h,a]=n.useState(0);return n.useEffect(()=>{if(!s||!t)return;const d=typeof t=="boolean"?7e3:t?.delay??7e3;let k=Date.now();const v=setInterval(()=>{const l=Date.now()-k,g=l/d*100;a(Math.min(g,100)),l>=d&&typeof u=="function"&&u()},100);return function(){return a(0),k=Date.now(),clearInterval(v)}},[s,t,u]),e.jsx("button",{className:m.clsx("dgs-ui-kit-rounded-full dgs-ui-kit-overflow-hidden dgs-ui-kit-transition-all dgs-ui-kit-h-[6px]",F({active:s,autoplay:t,variant:c})),onClick:r,children:s&&e.jsx("div",{className:m.clsx("dgs-ui-kit-h-full dgs-ui-kit-rounded-full",{"dgs-ui-kit-bg-white":c==="inside","dgs-ui-kit-bg-gray-700":c==="outside"}),style:{width:t?`${h}%`:"100%"}})})},V=i=>{const{onNavigate:s,slideIndex:r,slidesCount:u}=i,{navigationButtonsShowType:t="hide",dotsClassName:c,navigationContainerClassName:h,navigationVariant:a="outside",showNavigationDots:d=!0,showPaginationText:k}=P(),v=e.jsxs("div",{className:m.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"&&v,e.jsxs("div",{className:m.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")},h),children:[t&&t!=="hide"&&t!=="onSides"&&v,(d||k)&&e.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-gap-3",children:[k&&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:m.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:u})]}),d&&e.jsx("div",{className:m.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-justify-center dgs-ui-kit-gap-2",c),children:Array.from(Array(u).keys()).map((l,g)=>e.jsx(O,{active:r===g,onClick:()=>s(g),onNavigateToNext:()=>s(r+1)},l+u))})]})]})]})},L=n.forwardRef((i,s)=>{const[r,u]=n.useState(i),{className:t="",containerClassName:c="",showNavigationDots:h=!0,slidesPerView:a=1,navigationButtonsShowType:d="hide",spaceBetween:k=0,showPaginationText:v,onSlideIndexChange:l,initialSlide:g,containerXPadding:p=0}=r,[C,j]=n.useState(0),[I,R]=n.useState(0),W=Object.fromEntries(Object.entries(r).filter(([o])=>o!=="children")),f=n.useRef(null),x=Math.ceil(I/Math.floor(a)),E=(h||d&&d!=="hide"||v)&&x>1;function M(o){if(Math.ceil(Math.abs(o.currentTarget.scrollLeft))+o.currentTarget.clientWidth+1+p>=o.currentTarget.scrollWidth){j(x-1);return}const y=o.currentTarget.scrollWidth-p*2,w=y/x,N=(y-o.currentTarget.scrollLeft-p)/w;if(N<=x){j(0);return}j(Math.round(N%x))}function S(o){if(!f.current)return;const y=f.current.offsetWidth,w=C-o,N=f.current.scrollWidth/x,B=w*N;o<0?f.current.scrollTo({behavior:"smooth",left:-(y*x)}):o>=x?f.current.scrollTo({behavior:"smooth",left:0}):f.current.scrollBy({behavior:"smooth",left:B})}function b(){const y=Object.keys(i.responsive).sort().findLast(N=>Number(N)<=window.innerWidth),w=y?i.responsive[Number(y)]:null;u(w?{...r,...w}:i)}return n.useImperativeHandle(s,()=>({element:f.current,navigate:o=>S(Math.max(0,o-1))})),n.useEffect(()=>{if(!f.current)return;let o=f.current.childElementCount;p>0&&(o-=2),R(o)},[i.children]),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 g=="number"&&f.current&&S(Math.max(0,g-1))},[g,f.current]),e.jsx(A.Provider,{value:{...W,childrenCount:I,sliderId:n.useId()},children:e.jsxs("div",{className:m.clsx("dgs-ui-kit-overflow-hidden dgs-ui-kit-relative dgs-ui-kit-group",t),style:{direction:"rtl"},children:[e.jsx("div",{className:m.clsx("dgs-ui-kit-flex dgs-ui-kit-snap-x dgs-ui-kit-snap-mandatory dgs-ui-kit-overflow-x-auto no-scrollbar",c),style:{marginLeft:-k},onScroll:M,ref:f,children:i.children}),E&&e.jsx(V,{onNavigate:S,slideIndex:C,slidesCount:x})]})})});L.displayName="Slider";function K({slidesPerView:i,childIndex:s,centerMode:r,childrenCount:u,haveContainerPadding:t}){const c=s%Math.floor(i)===0,h=i%1!==0,a=s===0,d=s===u-1;if(!c)return"none";if(r){if(h&&!t){if(a)return"start";if(d)return"end"}return"center"}return"start"}const $=i=>{const{children:s,className:r,style:u,...t}=i,{slidesPerView:c=1,spaceBetween:h=0,centerMode:a=!1,containerXPadding:d=0,childrenCount:k=0,sliderId:v}=P(),l=n.useRef(null),[g,p]=n.useState(0);return n.useEffect(()=>{l.current&&p(Array.prototype.indexOf.call(document.querySelectorAll(`[id='slide-item-${v}']`),l.current))},[l]),e.jsxs(e.Fragment,{children:[g===0&&d>0&&e.jsx("div",{className:"dgs-ui-kit-shrink-0",style:{width:d,paddingLeft:h}}),e.jsx("div",{...t,ref:l,id:`slide-item-${v}`,className:m.clsx("dgs-ui-kit-shrink-0 dgs-ui-kit-snap-normal",r),style:{width:100/(c??1)+"%",paddingLeft:h,scrollSnapAlign:K({slidesPerView:c,childIndex:g,centerMode:a,childrenCount:k||0,haveContainerPadding:d>0}),...u},children:s}),g===k-1&&d>0&&e.jsx("div",{className:"dgs-ui-kit-shrink-0 ",style:{width:d,paddingLeft:h}})]})};exports.Slide=$;exports.Slider=L;
1
+ "use client";"use strict";const e=require("react/jsx-runtime"),m=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 F({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 O=i=>{const{active:s,onClick:r,onNavigateToNext:u}=i,{autoplay:t,navigationVariant:g="outside"}=P(),[h,a]=n.useState(0);return n.useEffect(()=>{if(!s||!t)return;const d=typeof t=="boolean"?7e3:t?.delay??7e3;let k=Date.now();const v=setInterval(()=>{const l=Date.now()-k,f=l/d*100;a(Math.min(f,100)),l>=d&&typeof u=="function"&&u()},100);return function(){return a(0),k=Date.now(),clearInterval(v)}},[s,t,u]),e.jsx("button",{className:m.clsx("dgs-ui-kit-rounded-full dgs-ui-kit-overflow-hidden dgs-ui-kit-transition-all dgs-ui-kit-h-[6px]",F({active:s,autoplay:t,variant:g})),onClick:r,children:s&&e.jsx("div",{className:m.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?`${h}%`:"100%"}})})},V=i=>{const{onNavigate:s,slideIndex:r,slidesCount:u}=i,{navigationButtonsShowType:t="hide",dotsClassName:g,navigationContainerClassName:h,navigationVariant:a="outside",showNavigationDots:d=!0,showPaginationText:k}=P(),v=e.jsxs("div",{className:m.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"&&v,e.jsxs("div",{className:m.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")},h),children:[t&&t!=="hide"&&t!=="onSides"&&v,(d||k)&&e.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-gap-3",children:[k&&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:m.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:u})]}),d&&e.jsx("div",{className:m.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(u).keys()).map((l,f)=>e.jsx(O,{active:r===f,onClick:()=>s(f),onNavigateToNext:()=>s(r+1)},l+u))})]})]})]})},L=n.forwardRef((i,s)=>{const[r,u]=n.useState(i),{className:t="",containerClassName:g="",showNavigationDots:h=!0,slidesPerView:a=1,navigationButtonsShowType:d="hide",spaceBetween:k=0,showPaginationText:v,onSlideIndexChange:l,initialSlide:f,containerXPadding:p=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),x=Math.ceil(I/Math.floor(a)),E=(h||d&&d!=="hide"||v)&&x>1;function M(o){if(Math.ceil(Math.abs(o.currentTarget.scrollLeft))+o.currentTarget.clientWidth+1+p>=o.currentTarget.scrollWidth){j(x-1);return}const y=o.currentTarget.scrollWidth-p*2,w=y/x,N=(y-o.currentTarget.scrollLeft-p)/w;if(N<=x){j(0);return}j(Math.round(N%x))}function S(o){if(!c.current)return;const y=c.current.offsetWidth,w=C-o,N=c.current.scrollWidth/x,B=w*N;o<0?c.current.scrollTo({behavior:"smooth",left:-(y*x)}):o>=x?c.current.scrollTo({behavior:"smooth",left:0}):c.current.scrollBy({behavior:"smooth",left:B})}function b(){const y=Object.keys(i.responsive).sort().findLast(N=>Number(N)<=window.innerWidth),w=y?i.responsive[Number(y)]:null;u(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;p>0&&(o-=2),R(o)},[i.children,c]),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 f=="number"&&c.current&&S(Math.max(0,f-1))},[f,c.current]),e.jsx(A.Provider,{value:{...W,childrenCount:I,sliderId:n.useId()},children:e.jsxs("div",{className:m.clsx("dgs-ui-kit-overflow-hidden dgs-ui-kit-relative dgs-ui-kit-group",t),style:{direction:"rtl"},children:[e.jsx("div",{className:m.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:M,ref:c,children:i.children}),E&&e.jsx(V,{onNavigate:S,slideIndex:C,slidesCount:x})]})})});L.displayName="Slider";function K({slidesPerView:i,childIndex:s,centerMode:r,childrenCount:u,haveContainerPadding:t}){const g=s%Math.floor(i)===0,h=i%1!==0,a=s===0,d=s===u-1;if(!g)return"none";if(r){if(h&&!t){if(a)return"start";if(d)return"end"}return"center"}return"start"}const $=i=>{const{children:s,className:r,style:u,...t}=i,{slidesPerView:g=1,spaceBetween:h=0,centerMode:a=!1,containerXPadding:d=0,childrenCount:k=0,sliderId:v}=P(),l=n.useRef(null),[f,p]=n.useState(0);return n.useEffect(()=>{l.current&&p(Array.prototype.indexOf.call(document.querySelectorAll(`[id='slide-item-${v}']`),l.current))},[l,k]),e.jsxs(e.Fragment,{children:[f===0&&d>0&&e.jsx("div",{className:"dgs-ui-kit-shrink-0",style:{width:d,paddingLeft:h}}),e.jsx("div",{...t,ref:l,id:`slide-item-${v}`,className:m.clsx("dgs-ui-kit-shrink-0 dgs-ui-kit-snap-normal",r),style:{width:100/(g??1)+"%",paddingLeft:h,scrollSnapAlign:K({slidesPerView:g,childIndex:f,centerMode:a,childrenCount:k||0,haveContainerPadding:d>0}),...u},children:s}),f===k-1&&d>0&&e.jsx("div",{className:"dgs-ui-kit-shrink-0 ",style:{width:d,paddingLeft:h}})]})};exports.Slide=$;exports.Slider=L;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../assets/styles.css');;/* empty css */const e=require("../Slide-x4dWg92P.cjs");exports.Slide=e.Slide;exports.Slider=e.Slider;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../assets/styles.css');;/* empty css */const e=require("../Slide-GqF7m8gP.cjs");exports.Slide=e.Slide;exports.Slider=e.Slider;
@@ -1,5 +1,5 @@
1
1
  import '../assets/styles.css';/* empty css */
2
- import { a as i, S as o } from "../Slide-DymRQdjm.js";
2
+ import { a as i, S as o } from "../Slide-BsHb9vsb.js";
3
3
  export {
4
4
  i as Slide,
5
5
  o as Slider
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-x4dWg92P.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;
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-GqF7m8gP.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-DymRQdjm.js";
16
+ import { a as R, S as j } from "./Slide-BsHb9vsb.js";
17
17
  import { default as y } from "./Tabs/index.js";
18
18
  export {
19
19
  e as AccordionGroup,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dgshahr/ui-kit",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "description": "dgshahr ui-kit",
5
5
  "author": "dgshahr",
6
6
  "license": "MIT",