@dgshahr/ui-kit 0.0.27 → 0.0.29

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"),u=require("../../clsx-C11secjj.cjs"),x=require("react"),C=require("../../TextFieldWrapper-BC0mP63G.cjs"),v=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"})]}),y=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"})]}),R=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"})}),N=x.forwardRef(function(i,h){const{dir:l="rtl",placeholderDir:g=l,containerClassName:p,leftIcon:n,prefix:o,postfix:a,isClearOption:f,onClear:c,...s}=i,[d,m]=x.useState(s.type);return e.jsx(C.TextFieldWrapper,{...i,containerClassName:u.clsx("dgs-ui-kit-items-center",p),children:({handleChangeField:w,value:r,setValue:j})=>e.jsxs(e.Fragment,{children:[o&&e.jsx("span",{className:"dgs-ui-kit-font-p1-regular dgs-ui-kit-text-gray-500",children:o}),e.jsx("input",{...s,ref:h,className:u.clsx("dgs-ui-kit-bg-transparent focus:dgs-ui-kit-outline-none dgs-ui-kit-flex-1",l==="rtl"?"dgs-ui-kit-text-right":"!dgs-ui-kit-text-left",g==="rtl"?"placeholder:dgs-ui-kit-text-right":"placeholder:dgs-ui-kit-text-left",{ss02:s.type!="password"},i.className),...l==="ltr"?{style:{direction:"ltr"}}:{},value:r,onChange:w,type:d}),f&&r&&r.length>0&&e.jsx("button",{onClick:()=>{j(""),typeof c=="function"&&c()},children:e.jsx(v,{className:"dgs-ui-kit-text-gray-600",width:20,height:20})}),a&&e.jsx("span",{className:"dgs-ui-kit-font-p1-regular dgs-ui-kit-text-gray-500",children:a}),n&&e.jsx("div",{className:"dgs-ui-kit-text-gray-600",children:n}),s.type==="password"&&e.jsx("button",{onClick:()=>m(k=>k==="text"?"password":"text"),className:"dgs-ui-kit-text-gray-600",children:d==="password"?e.jsx(y,{width:20,height:20}):e.jsx(R,{width:20,height:20})})]})})});module.exports=N;
1
+ "use strict";const e=require("react/jsx-runtime"),p=require("../../clsx-C11secjj.cjs"),f=require("react"),v=require("../../TextFieldWrapper-BC0mP63G.cjs"),y=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"})]}),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",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"})}),I=f.forwardRef(function(r,m){const{dir:s="rtl",placeholderDir:w=s,containerClassName:j,leftIcon:o,prefix:c,postfix:d,isClearOption:a,onClear:u,...l}=r,[x,C]=f.useState(l.type);function h(n){return e.jsx("button",{onClick:()=>{n(""),typeof u=="function"&&u()},children:e.jsx(y,{className:"dgs-ui-kit-text-gray-600",width:20,height:20})})}return e.jsx(v.TextFieldWrapper,{...r,containerClassName:p.clsx("dgs-ui-kit-items-center",j),children:({handleChangeField:n,value:i,setValue:g})=>e.jsxs(e.Fragment,{children:[c&&e.jsx("span",{className:"dgs-ui-kit-font-p1-regular dgs-ui-kit-text-gray-500",children:c}),a&&i&&i.length>0&&s==="ltr"&&h(g),e.jsx("input",{...l,ref:m,className:p.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",w==="rtl"?"placeholder:dgs-ui-kit-text-right":"placeholder:dgs-ui-kit-text-left",{ss02:l.type!="password"},r.className),...s==="ltr"?{style:{direction:"ltr"}}:{},value:i,onChange:n,type:x}),a&&i&&i.length>0&&s==="rtl"&&h(g),d&&e.jsx("span",{className:"dgs-ui-kit-font-p1-regular dgs-ui-kit-text-gray-500",children:d}),o&&e.jsx("div",{className:"dgs-ui-kit-text-gray-600",children:o}),l.type==="password"&&e.jsx("button",{onClick:()=>C(k=>k==="text"?"password":"text"),className:"dgs-ui-kit-text-gray-600",children:x==="password"?e.jsx(R,{width:20,height:20}):e.jsx(N,{width:20,height:20})})]})})});module.exports=I;
@@ -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,yGAoFT,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,yGAiGT,CAAC;AACH,eAAe,KAAK,CAAC"}
@@ -1,8 +1,8 @@
1
- import { jsxs as n, jsx as e, Fragment as v } from "react/jsx-runtime";
2
- import { c as g } from "../../clsx-OuTLNxxd.js";
3
- import { forwardRef as y, useState as N } from "react";
4
- import { T as R } from "../../TextFieldWrapper-Dva9vxfn.js";
5
- const I = (t) => /* @__PURE__ */ n(
1
+ import { jsxs as o, jsx as t, Fragment as y } from "react/jsx-runtime";
2
+ import { c as f } from "../../clsx-OuTLNxxd.js";
3
+ import { forwardRef as N, useState as R } from "react";
4
+ import { T as I } from "../../TextFieldWrapper-Dva9vxfn.js";
5
+ const M = (e) => /* @__PURE__ */ o(
6
6
  "svg",
7
7
  {
8
8
  xmlns: "http://www.w3.org/2000/svg",
@@ -10,9 +10,9 @@ const I = (t) => /* @__PURE__ */ n(
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 I = (t) => /* @__PURE__ */ n(
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 I = (t) => /* @__PURE__ */ n(
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 I = (t) => /* @__PURE__ */ n(
41
41
  )
42
42
  ]
43
43
  }
44
- ), M = (t) => /* @__PURE__ */ n(
44
+ ), z = (e) => /* @__PURE__ */ o(
45
45
  "svg",
46
46
  {
47
47
  xmlns: "http://www.w3.org/2000/svg",
@@ -49,16 +49,16 @@ const I = (t) => /* @__PURE__ */ n(
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 I = (t) => /* @__PURE__ */ n(
67
67
  )
68
68
  ]
69
69
  }
70
- ), z = (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 I = (t) => /* @__PURE__ */ n(
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,76 +86,80 @@ const I = (t) => /* @__PURE__ */ n(
86
86
  }
87
87
  )
88
88
  }
89
- ), T = y(function(l, u) {
89
+ ), j = N(function(n, w) {
90
90
  const {
91
- dir: r = "rtl",
92
- placeholderDir: p = r,
93
- containerClassName: m,
94
- leftIcon: o,
95
- prefix: a,
96
- postfix: d,
97
- isClearOption: f,
98
- onClear: c,
99
- ...i
100
- } = l, [h, w] = N(i.type);
101
- return /* @__PURE__ */ e(
102
- R,
91
+ dir: i = "rtl",
92
+ placeholderDir: x = i,
93
+ containerClassName: C,
94
+ leftIcon: a,
95
+ prefix: d,
96
+ postfix: c,
97
+ isClearOption: h,
98
+ onClear: g,
99
+ ...r
100
+ } = n, [u, k] = R(r.type);
101
+ function p(s) {
102
+ return /* @__PURE__ */ t(
103
+ "button",
104
+ {
105
+ onClick: () => {
106
+ s(""), typeof g == "function" && g();
107
+ },
108
+ children: /* @__PURE__ */ t(
109
+ M,
110
+ {
111
+ className: "dgs-ui-kit-text-gray-600",
112
+ width: 20,
113
+ height: 20
114
+ }
115
+ )
116
+ }
117
+ );
118
+ }
119
+ return /* @__PURE__ */ t(
120
+ I,
103
121
  {
104
- ...l,
105
- containerClassName: g("dgs-ui-kit-items-center", m),
106
- children: ({ handleChangeField: x, value: s, setValue: k }) => /* @__PURE__ */ n(v, { children: [
107
- a && /* @__PURE__ */ e("span", { className: "dgs-ui-kit-font-p1-regular dgs-ui-kit-text-gray-500", children: a }),
108
- /* @__PURE__ */ e(
122
+ ...n,
123
+ containerClassName: f("dgs-ui-kit-items-center", C),
124
+ children: ({ handleChangeField: s, value: l, setValue: m }) => /* @__PURE__ */ o(y, { children: [
125
+ d && /* @__PURE__ */ t("span", { className: "dgs-ui-kit-font-p1-regular dgs-ui-kit-text-gray-500", children: d }),
126
+ h && l && l.length > 0 && i === "ltr" && p(m),
127
+ /* @__PURE__ */ t(
109
128
  "input",
110
129
  {
111
- ...i,
112
- ref: u,
113
- className: g(
130
+ ...r,
131
+ ref: w,
132
+ className: f(
114
133
  "dgs-ui-kit-bg-transparent focus:dgs-ui-kit-outline-none dgs-ui-kit-flex-1",
115
- r === "rtl" ? "dgs-ui-kit-text-right" : "!dgs-ui-kit-text-left",
116
- p === "rtl" ? "placeholder:dgs-ui-kit-text-right" : "placeholder:dgs-ui-kit-text-left",
134
+ i === "rtl" ? "dgs-ui-kit-text-right" : "!dgs-ui-kit-text-left",
135
+ x === "rtl" ? "placeholder:dgs-ui-kit-text-right" : "placeholder:dgs-ui-kit-text-left",
117
136
  {
118
- ss02: i.type != "password"
137
+ ss02: r.type != "password"
119
138
  },
120
- l.className
139
+ n.className
121
140
  ),
122
- ...r === "ltr" ? { style: { direction: "ltr" } } : {},
123
- value: s,
124
- onChange: x,
125
- type: h
126
- }
127
- ),
128
- f && s && s.length > 0 && /* @__PURE__ */ e(
129
- "button",
130
- {
131
- onClick: () => {
132
- k(""), typeof c == "function" && c();
133
- },
134
- children: /* @__PURE__ */ e(
135
- I,
136
- {
137
- className: "dgs-ui-kit-text-gray-600",
138
- width: 20,
139
- height: 20
140
- }
141
- )
141
+ ...i === "ltr" ? { style: { direction: "ltr" } } : {},
142
+ value: l,
143
+ onChange: s,
144
+ type: u
142
145
  }
143
146
  ),
144
- d && /* @__PURE__ */ e("span", { className: "dgs-ui-kit-font-p1-regular dgs-ui-kit-text-gray-500", children: d }),
145
- o && /* @__PURE__ */ e("div", { className: "dgs-ui-kit-text-gray-600", children: o }),
146
- i.type === "password" && /* @__PURE__ */ e(
147
+ h && l && l.length > 0 && i === "rtl" && p(m),
148
+ c && /* @__PURE__ */ t("span", { className: "dgs-ui-kit-font-p1-regular dgs-ui-kit-text-gray-500", children: c }),
149
+ a && /* @__PURE__ */ t("div", { className: "dgs-ui-kit-text-gray-600", children: a }),
150
+ r.type === "password" && /* @__PURE__ */ t(
147
151
  "button",
148
152
  {
149
- onClick: () => w((C) => C === "text" ? "password" : "text"),
153
+ onClick: () => k((v) => v === "text" ? "password" : "text"),
150
154
  className: "dgs-ui-kit-text-gray-600",
151
- children: h === "password" ? /* @__PURE__ */ e(
152
- M,
155
+ children: u === "password" ? /* @__PURE__ */ t(
156
+ z,
153
157
  {
154
158
  width: 20,
155
159
  height: 20
156
160
  }
157
- ) : /* @__PURE__ */ e(
158
- z,
161
+ ) : /* @__PURE__ */ t(
162
+ B,
159
163
  {
160
164
  width: 20,
161
165
  height: 20
@@ -168,5 +172,5 @@ const I = (t) => /* @__PURE__ */ n(
168
172
  );
169
173
  });
170
174
  export {
171
- T as default
175
+ j as default
172
176
  };
@@ -1 +1 @@
1
- "use client";"use strict";require('../../assets/styles.css');const l=require("react/jsx-runtime"),h=require("../../clsx-C11secjj.cjs"),k=require("react"),q=require("../Input/index.cjs"),m=require("../../TextFieldWrapper-BC0mP63G.cjs");;/* empty css */const v=y=>{const{inputsNumber:o=4,onChange:p,onEnd:f,className:I,inputsContainerClassName:j,labelContent:g,hintMessage:d,errorMessage:c,isError:w,value:i}=y,[r,a]=k.useState([]);function u(s){const e=document.getElementById(`dgs-ui-kit-otp-input-${s}`);e?.focus(),e?.select()}function C(s,e){const t=[s.code,s.key];if(t.includes("Backspace")||t.includes("Delete")){const n=[...r];n[e]="",e!==0&&(n[e-1]="",u(e-1)),a(n)}else t.includes("ArrowLeft")?u(e+1):t.includes("ArrowRight")&&u(e-1)}function N(s,e){const t=s.currentTarget.value,n=[...r];n[e]=t,e+1!==o&&t&&u(e+1),a(n),typeof p=="function"&&p(n.join(""))}return k.useEffect(()=>{if(i){const s=i.split("");a(s);const e=o===i.length;u(i.length),e&&typeof f=="function"&&f(i)}},[i]),l.jsxs("div",{className:h.clsx("dgs-ui-kit-space-y-2",I),children:[g?l.jsx(m.FieldLabel,{labelContent:g}):null,l.jsx("div",{className:h.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-gap-2",j),children:Array.from(Array(o).keys()).map((s,e)=>l.jsx(q,{containerClassName:"dgs-ui-kit-w-12 dgs-ui-kit-h-12 dgs-ui-kit-p-0",className:"dgs-ui-kit-w-full dgs-ui-kit-h-full !dgs-ui-kit-text-center placeholder:!dgs-ui-kit-text-center",placeholder:"-",type:"tel",autoFocus:e===0,onChange:t=>N(t,e),onKeyUp:t=>C(t,e),id:`dgs-ui-kit-otp-input-${e}`,maxLength:1,value:r[e],showMaxLength:!1,isError:!!c||w},s))}),c||d?l.jsx(m.FieldBottomInfo,{errorMessage:c,hintMessage:d}):null]})};module.exports=v;
1
+ "use client";"use strict";require('../../assets/styles.css');const l=require("react/jsx-runtime"),k=require("../../clsx-C11secjj.cjs"),y=require("react"),E=require("../Input/index.cjs"),m=require("../../TextFieldWrapper-BC0mP63G.cjs");;/* empty css */const F=j=>{const{inputsNumber:c=4,onChange:o,onEnd:r,className:C,inputsContainerClassName:I,labelContent:d,hintMessage:h,errorMessage:f,isError:v,value:n}=j,[a,p]=y.useState([]);function u(i){const e=document.getElementById(`dgs-ui-kit-otp-input-${i}`);e?.focus(),e?.select()}function w(i,e){const t=[i.code,i.key];if(t.includes("Backspace")||t.includes("Delete")){const s=[...a];s[e]="",e!==0&&(s[e-1]="",u(e-1)),p(s)}else t.includes("ArrowLeft")?u(e+1):t.includes("ArrowRight")&&u(e-1);t.includes(a[e])&&u(e)}function N(i,e){const t=i.currentTarget.value,s=[...a];t.length>1?t.split("").forEach((g,q)=>s[q]=g):s[e]=t,e+1!==c&&t?u(e+1):typeof r=="function"&&s.every(g=>!!g)&&((typeof o=="function"&&!n||typeof o!="function"&&n||typeof o!="function"&&!n||n!==s.join(""))&&r(s.join("")),u(c-1)),p(s),typeof o=="function"&&o(s.join(""))}return y.useEffect(()=>{if(n){const i=n.split("");p(i);const e=c===n.length;u(n.length),e&&typeof r=="function"&&r(n)}},[n]),l.jsxs("div",{className:k.clsx("dgs-ui-kit-space-y-2",C),children:[d?l.jsx(m.FieldLabel,{labelContent:d}):null,l.jsx("div",{className:k.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-gap-2",I),children:Array.from(Array(c).keys()).map((i,e)=>l.jsx(E,{containerClassName:"dgs-ui-kit-w-12 dgs-ui-kit-h-12 dgs-ui-kit-p-0",className:"dgs-ui-kit-w-full dgs-ui-kit-h-full !dgs-ui-kit-text-center placeholder:!dgs-ui-kit-text-center",placeholder:"-",type:"tel",autoFocus:e===0,onChange:t=>N(t,e),onKeyUp:t=>w(t,e),id:`dgs-ui-kit-otp-input-${e}`,value:a[e],showMaxLength:!1,isError:!!f||v,autoComplete:"off"},i))}),f||h?l.jsx(m.FieldBottomInfo,{errorMessage:f,hintMessage:h}):null]})};module.exports=F;
@@ -1,6 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  import { TextFieldBaseProps } from '../Wrappers/TextFieldWrapper/TextFieldWrapper';
3
- interface OtpInputProps extends Pick<TextFieldBaseProps, 'labelContent' | 'errorMessage' | 'isError' | 'hintMessage'> {
3
+ export interface OtpInputProps extends Pick<TextFieldBaseProps, 'labelContent' | 'errorMessage' | 'isError' | 'hintMessage'> {
4
4
  inputsNumber?: number;
5
5
  onChange?: (value: string) => void;
6
6
  onEnd?: (value: string) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Form/OtpInput/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAyC,KAAK,EAAE,EAAsB,MAAM,OAAO,CAAC;AAI3F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACxF,OAAO,kBAAkB,CAAC;AAE1B,UAAU,aACR,SAAQ,IAAI,CAAC,kBAAkB,EAAE,cAAc,GAAG,cAAc,GAAG,SAAS,GAAG,aAAa,CAAC;IAC7F,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CA4F/B,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Form/OtpInput/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAyC,KAAK,EAAE,EAAsB,MAAM,OAAO,CAAC;AAI3F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACxF,OAAO,kBAAkB,CAAC;AAE1B,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,cAAc,GAAG,cAAc,GAAG,SAAS,GAAG,aAAa,CAAC;IAC7F,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CA6G/B,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -1,83 +1,84 @@
1
1
  "use client";
2
- import { jsxs as N, jsx as l } from "react/jsx-runtime";
3
- import { c as d } from "../../clsx-OuTLNxxd.js";
4
- import { useState as v, useEffect as V } from "react";
5
- import E from "../Input/index.js";
2
+ import { jsxs as E, jsx as r } from "react/jsx-runtime";
3
+ import { c as h } from "../../clsx-OuTLNxxd.js";
4
+ import { useState as V, useEffect as j } from "react";
5
+ import B from "../Input/index.js";
6
6
  import { F, a as A } from "../../TextFieldWrapper-Dva9vxfn.js";
7
7
  import '../../assets/styles.css';/* empty css */
8
- const O = (h) => {
8
+ const U = (k) => {
9
9
  const {
10
10
  inputsNumber: u = 4,
11
- onChange: p,
12
- onEnd: f,
13
- className: k,
14
- inputsContainerClassName: y,
15
- labelContent: g,
16
- hintMessage: m,
17
- errorMessage: a,
11
+ onChange: l,
12
+ onEnd: a,
13
+ className: y,
14
+ inputsContainerClassName: C,
15
+ labelContent: m,
16
+ hintMessage: d,
17
+ errorMessage: f,
18
18
  isError: I,
19
- value: n
20
- } = h, [r, c] = v([]);
21
- function o(s) {
22
- const t = document.getElementById(`dgs-ui-kit-otp-input-${s}`);
23
- t?.focus(), t?.select();
19
+ value: o
20
+ } = k, [c, p] = V([]);
21
+ function n(i) {
22
+ const e = document.getElementById(`dgs-ui-kit-otp-input-${i}`);
23
+ e?.focus(), e?.select();
24
24
  }
25
- function w(s, t) {
26
- const e = [s.code, s.key];
27
- if (e.includes("Backspace") || e.includes("Delete")) {
28
- const i = [...r];
29
- i[t] = "", t !== 0 && (i[t - 1] = "", o(t - 1)), c(i);
30
- } else e.includes("ArrowLeft") ? o(t + 1) : e.includes("ArrowRight") && o(t - 1);
25
+ function v(i, e) {
26
+ const t = [i.code, i.key];
27
+ if (t.includes("Backspace") || t.includes("Delete")) {
28
+ const s = [...c];
29
+ s[e] = "", e !== 0 && (s[e - 1] = "", n(e - 1)), p(s);
30
+ } else t.includes("ArrowLeft") ? n(e + 1) : t.includes("ArrowRight") && n(e - 1);
31
+ t.includes(c[e]) && n(e);
31
32
  }
32
- function C(s, t) {
33
- const e = s.currentTarget.value, i = [...r];
34
- i[t] = e, t + 1 !== u && e && o(t + 1), c(i), typeof p == "function" && p(i.join(""));
33
+ function w(i, e) {
34
+ const t = i.currentTarget.value, s = [...c];
35
+ t.length > 1 ? t.split("").forEach((g, N) => s[N] = g) : s[e] = t, e + 1 !== u && t ? n(e + 1) : typeof a == "function" && s.every((g) => !!g) && ((typeof l == "function" && !o || typeof l != "function" && o || typeof l != "function" && !o || o !== s.join("")) && a(s.join("")), n(u - 1)), p(s), typeof l == "function" && l(s.join(""));
35
36
  }
36
- return V(() => {
37
- if (n) {
38
- const s = n.split("");
39
- c(s);
40
- const t = u === n.length;
41
- o(n.length), t && typeof f == "function" && f(n);
37
+ return j(() => {
38
+ if (o) {
39
+ const i = o.split("");
40
+ p(i);
41
+ const e = u === o.length;
42
+ n(o.length), e && typeof a == "function" && a(o);
42
43
  }
43
- }, [n]), /* @__PURE__ */ N("div", { className: d("dgs-ui-kit-space-y-2", k), children: [
44
- g ? /* @__PURE__ */ l(F, { labelContent: g }) : null,
45
- /* @__PURE__ */ l(
44
+ }, [o]), /* @__PURE__ */ E("div", { className: h("dgs-ui-kit-space-y-2", y), children: [
45
+ m ? /* @__PURE__ */ r(F, { labelContent: m }) : null,
46
+ /* @__PURE__ */ r(
46
47
  "div",
47
48
  {
48
- className: d(
49
+ className: h(
49
50
  "dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-gap-2",
50
- y
51
+ C
51
52
  ),
52
- children: Array.from(Array(u).keys()).map((s, t) => /* @__PURE__ */ l(
53
- E,
53
+ children: Array.from(Array(u).keys()).map((i, e) => /* @__PURE__ */ r(
54
+ B,
54
55
  {
55
56
  containerClassName: "dgs-ui-kit-w-12 dgs-ui-kit-h-12 dgs-ui-kit-p-0",
56
57
  className: "dgs-ui-kit-w-full dgs-ui-kit-h-full !dgs-ui-kit-text-center placeholder:!dgs-ui-kit-text-center",
57
58
  placeholder: "-",
58
59
  type: "tel",
59
- autoFocus: t === 0,
60
- onChange: (e) => C(e, t),
61
- onKeyUp: (e) => w(e, t),
62
- id: `dgs-ui-kit-otp-input-${t}`,
63
- maxLength: 1,
64
- value: r[t],
60
+ autoFocus: e === 0,
61
+ onChange: (t) => w(t, e),
62
+ onKeyUp: (t) => v(t, e),
63
+ id: `dgs-ui-kit-otp-input-${e}`,
64
+ value: c[e],
65
65
  showMaxLength: !1,
66
- isError: !!a || I
66
+ isError: !!f || I,
67
+ autoComplete: "off"
67
68
  },
68
- s
69
+ i
69
70
  ))
70
71
  }
71
72
  ),
72
- a || m ? /* @__PURE__ */ l(
73
+ f || d ? /* @__PURE__ */ r(
73
74
  A,
74
75
  {
75
- errorMessage: a,
76
- hintMessage: m
76
+ errorMessage: f,
77
+ hintMessage: d
77
78
  }
78
79
  ) : null
79
80
  ] });
80
81
  };
81
82
  export {
82
- O as default
83
+ U as default
83
84
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dgshahr/ui-kit",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "description": "dgshahr ui-kit",
5
5
  "author": "dgshahr",
6
6
  "license": "MIT",